using MECF.Framework.Common.CommonData.Metal; using MECF.Framework.Common.CommonData.Reservoir; using MECF.Framework.Common.DataCenter; using MECF.Framework.Common.OperationCenter; using MECF.Framework.Common.Persistent.Reservoirs; using MECF.Framework.Common.RecipeCenter; using MECF.Framework.Common.Utilities; using CyberX8_Core; using CyberX8_MainPages.PMs; using Prism.Commands; using Prism.Mvvm; using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Windows.Input; using System.Windows.Threading; using MECF.Framework.Common.CommonData.TemperatureControl; using MECF.Framework.Common.CommonData.PowerSupplier; using MECF.Framework.Common.Device.Safety; using MECF.Framework.Common.ProcessCell; namespace CyberX8_MainPages.ViewModels { public class StandardHotReservoirsViewModel : BindableBase { #region 常量 private const string RESERVOIRS_DATA = "ReservoirsData"; private const string RESERVOIRS = "reservoirs"; private const string PERSISTENT_VALUE = "PersistentValue"; private const string METALDEVICEDATA = "MetalDeviceData"; private const string RESERVOIRDEVICEDATA = "ReservoirDeviceData"; private const string REPLEN_PERSISTENT_VALUE = "ReplenPersistentValue"; #endregion #region 内部变量 #region system /// /// rt查询key /// private List _rtDataKeys = new List(); /// /// 时钟 /// DispatcherTimer _timer; /// /// rt查询数据 /// private Dictionary _rtDataValueDic = new Dictionary(); #endregion #region Common private double _avgLevel; /// /// Module /// private string _module; /// /// Operation Mode /// private string _operatingMode; /// /// 状态 /// private string _state; /// /// Reservoirs Persistent数据 /// private ReservoirsPersistentValue _reservoirsPersistent; /// /// Reservoir数据 /// private StandardHotReservoirData _reservoirData; /// /// Metal数据集合 /// private ObservableCollection _metalDataCollection = new ObservableCollection(); /// /// CellModuleName集合 /// private ObservableCollection _cellModuleNameCollection = new ObservableCollection(); /// /// Cells数量 /// private int _cellsCount; /// /// 手动注水时长(秒) /// private int _manualFillSeconds; /// /// 是否正在手动注水 /// private bool _isManualReplen; /// /// DIValveMaxOnTime /// private double _diValveMaxOnTime; /// /// 是否超过PH值下限 /// private bool _isPHLowLimit; /// /// 是否超过PH值下限 /// private bool _isPHHighLimit; /// /// TemperatureControl Module Name /// private TemperatureControllerData _temperatureControlData; /// /// PowerSupply Module Name /// private PowerSupplierData _cmmPowerSupplierData; /// /// 是否超过HighLevel /// private bool _isHighLevel; /// /// 是否超过LowLevel /// private bool _isLowLevel; /// /// 是否触发highsafety /// private bool _isHighSafety; /// /// HED Flow /// private bool _hedFlowIsOn; /// /// DiReplen是否报错 /// private bool _isDiReplenFault; /// /// Safety Data /// private SafetyData _safetyData; /// /// 页面功能启用 /// private bool _isEnabled; /// /// AutoMode页面功能启用 /// private bool _isAutoEnabled; /// /// DosingSystem是否启用 /// private bool _isDosingSystemEnabled; /// /// TC Enable状态 /// private string _tcEnableStatus; /// /// 是否error状态 /// private bool _isError; #endregion #region Recipe /// /// 当前的recipe /// private ResRecipe _currentRecipe; /// /// Recipe Mode /// private string _recipeMode; /// /// Selected Recipe Node /// private RecipeNode _selectedRecipeNode; /// /// Recipe Type /// private string _recipeType; /// /// Recipe Manager /// private UiRecipeManager _uiRecipeManager = new UiRecipeManager(); #endregion #region CMM /// /// Flow High 状态(Warning:黄色,Error:红色) /// private string _flowHighStatus = ""; /// /// Flow Low 状态(Warning:黄色,Error:红色) /// private string _flowLowStatus = ""; /// /// PowerSupplier High电流状态 /// private string _currentHighStatus = ""; /// /// PowerSupplier Low电流状态 /// private string _currentLowStatus = ""; /// /// 是否低于最小电压 /// private bool _isBelowMinVoltage = false; /// /// CMM Anode AHrs /// private double _reservoirCMMAnodeAHrs; /// /// CMM Cathode AHrs /// private double _reservoirCMMCathodeAHrs; /// /// CMM Anode用电量 /// private double _cmmAnodeUsage; /// /// CMM Cathode用电量 /// private double _cmmCathodeUsage; /// /// CMM Flow High Warning /// private double _reservoirCMMFlowHighWarning; /// /// CMM Flow High Error /// private double _reservoirCMMFlowHighError; /// /// CMM Flow Low Warning /// private double _reservoirCMMFlowLowWarning; /// /// CMM Flow Low Error /// private double _reservoirCMMFlowLowError; /// /// CMM Anode LifeTime AHrs /// private double _reservoirCMMAnodeLifeTimeAHrs; /// /// CMM Cathode LifeTime AHrs /// private double _reservoirCMMCathodeLifeTimeAHrs; /// /// HighLevel /// private double _reservoirHighLevel; /// /// LowLevel /// private double _reservoirLowLevel; /// /// CMM电量limit /// private double _cmmAnodeTotalAmpHoursWarningLimit; private double _cmmAnodeTotalAmpHoursFaultLimit; private double _cmmCathodeTotalAmpHoursWarningLimit; private double _cmmCathodeTotalAmpHoursFaultLimit; /// /// CMM电量报警灯 /// private bool _isCMMAnodeTotalAmpHoursWarning; private bool _isCMMAnodeTotalAmpHoursFault; private bool _isCMMCathodeTotalAmpHoursWarning; private bool _isCMMCathodeTotalAmpHoursFault; #endregion #endregion #region 属性 #region Common public double AvgLevel { get { return _avgLevel; } set { SetProperty(ref _avgLevel, value); } } /// /// Module /// public string Module { get { return _module; } set { SetProperty(ref _module, value); } } /// /// Operation Mode /// public string OperatingMode { get { return _operatingMode; } set { SetProperty(ref _operatingMode, value); } } /// /// 状态 /// public string State { get { return _state; } set { SetProperty(ref _state, value); } } /// /// Reservoirs Persistent数据 /// public ReservoirsPersistentValue ReservoirsPersistent { get { return _reservoirsPersistent; } set { SetProperty(ref _reservoirsPersistent, value); } } /// /// Reservoir数据 /// public StandardHotReservoirData ReservoirData { get { return _reservoirData; } set { SetProperty(ref _reservoirData, value); } } /// /// Metal数据集合 /// public ObservableCollection MetalDataCollection { get { return _metalDataCollection; } set { SetProperty(ref _metalDataCollection, value); } } /// /// CellModuleName集合 /// public ObservableCollection CellModuleNameCollection { get { return _cellModuleNameCollection; } set { SetProperty(ref _cellModuleNameCollection, value); } } /// /// Cells数量 /// public int CellsCount { get { return _cellsCount; } set { SetProperty(ref _cellsCount, value); } } /// /// 是否超过PH值下限 /// public bool IsPHLowLimit { get { return _isPHLowLimit; } set { SetProperty(ref _isPHLowLimit, value); } } /// /// 是否超过PH值下限 /// public bool IsPHHighLimit { get { return _isPHHighLimit; } set { SetProperty(ref _isPHHighLimit, value); } } /// /// 手动注水时长(秒) /// public int ManualFillSeconds { get { return _manualFillSeconds; } set { SetProperty(ref _manualFillSeconds, value); } } /// /// 是否正在手动注水 /// public bool IsManualReplen { get { return _isManualReplen; } set { SetProperty(ref _isManualReplen, value); } } /// /// DIValveMaxOnTime /// public double DIValveMaxOnTime { get { return _diValveMaxOnTime; } set { SetProperty(ref _diValveMaxOnTime, value);} } /// /// TemperatureControl Module Name /// public TemperatureControllerData TemperatureControlData { get { return _temperatureControlData; } set { SetProperty(ref _temperatureControlData, value); } } /// /// PowerSupply Module Name /// public PowerSupplierData CmmPowerSupplierData { get { return _cmmPowerSupplierData; } set { SetProperty(ref _cmmPowerSupplierData, value); } } /// /// 是否超过HighLevel /// public bool IsHighLevel { get { return _isHighLevel; } set { SetProperty(ref _isHighLevel, value); } } /// /// 是否超过LowLevel /// public bool IsLowLevel { get { return _isLowLevel; } set { SetProperty(ref _isLowLevel, value); } } /// /// 是否触发Highsafety /// public bool IsHighSafety { get { return _isHighSafety; } set { SetProperty(ref _isHighSafety, value); } } /// /// HED Flow /// public bool HEDFlowIsOn { get { return _hedFlowIsOn; } set { SetProperty(ref _hedFlowIsOn, value); } } /// /// DI Replen是否报错 /// public bool IsDiReplenFault { get { return _isDiReplenFault; } set { SetProperty(ref _hedFlowIsOn, value); } } /// /// Safety数据 /// public SafetyData CommonSafetyData { get { return _safetyData; } set { SetProperty(ref _safetyData, value); } } /// /// 页面功能启用 /// public bool IsEnabled { get { return _isEnabled; } set { SetProperty(ref _isEnabled, value); } } /// /// AutoMode页面功能启用 /// public bool IsAutoEnabled { get { return _isAutoEnabled; } set { SetProperty(ref _isAutoEnabled, value); } } /// /// DosingSystem是否启用 /// public bool IsDosingSystemEnabled { get { return _isDosingSystemEnabled; } set { SetProperty(ref _isDosingSystemEnabled, value); } } /// /// TC Enable状态 /// public string TCEnableStatus { get { return _tcEnableStatus; } set { SetProperty(ref _tcEnableStatus, value); } } /// /// 是否Error /// public bool IsError { get { return _isError; } set { SetProperty(ref _isError, value); } } #endregion #region Recipe /// /// Recipe内容 /// public ResRecipe CurrentRecipe { get { return _currentRecipe; } set { SetProperty(ref _currentRecipe, value); } } /// /// Selected Recipe Node /// public RecipeNode SelectedRecipeNode { get { return _selectedRecipeNode; } set { SetProperty(ref _selectedRecipeNode, value); } } /// /// Recipe Mode /// public string RecipeMode { get { return _recipeMode; } set { SetProperty(ref _recipeMode, value); } } /// /// Recipe Type /// public string RecipeType { get { return _recipeType; } set { SetProperty(ref _recipeType, value); } } #endregion #region CMM /// /// Flow High 状态(Warning:黄色,Error:红色) /// public string FlowHighStatus { get { return _flowHighStatus; } set { SetProperty(ref _flowHighStatus, value); } } /// /// Flow Low 状态(Warning:黄色,Error:红色) /// public string FlowLowStatus { get { return _flowLowStatus; } set { SetProperty(ref _flowLowStatus, value); } } /// /// PowerSupplier High电流状态 /// public string CurrentHighStatus { get { return _currentHighStatus; } set { SetProperty(ref _currentHighStatus, value); } } /// /// PowerSupplier Low电流状态 /// public string CurrentLowStatus { get { return _currentLowStatus; } set { SetProperty(ref _currentLowStatus, value); } } /// /// 是否低于最小电压 /// public bool IsBelowMinVoltage { get { return _isBelowMinVoltage; } set { SetProperty(ref _isBelowMinVoltage, value); } } /// /// CMM Anode 用电量 /// public double CMMAnodeAHrs { get { return _reservoirCMMAnodeAHrs; ; } set { SetProperty(ref _reservoirCMMAnodeAHrs, value); } } /// /// CMM Cathode 用电量 /// public double CMMCathodeAHrs { get { return _reservoirCMMCathodeAHrs; ; } set { SetProperty(ref _reservoirCMMCathodeAHrs, value); } } #endregion #region Config /// /// CMM Anode LifeTime用电量 /// public double CMMAnodeLifeTimeAHrs { get { return _reservoirCMMAnodeLifeTimeAHrs; ; } set { SetProperty(ref _reservoirCMMAnodeLifeTimeAHrs, value); } } /// /// CMM Cathode LifeTime用电量 /// public double CMMCathodeLifeTimeAHrs { get { return _reservoirCMMCathodeLifeTimeAHrs; ; } set { SetProperty(ref _reservoirCMMCathodeLifeTimeAHrs, value); } } /// /// CMM Anode用电量 /// public double CMMAnodeUsage { get { return _cmmAnodeUsage; ; } set { SetProperty(ref _cmmAnodeUsage, value); } } /// /// CMM Cathode用电量 /// public double CMMCathodeUsage { get { return _cmmCathodeUsage; ; } set { SetProperty(ref _cmmCathodeUsage, value); } } /// /// CMM电量报警灯 /// public bool IsCMMAnodeTotalAmpHoursWarning { get { return _isCMMAnodeTotalAmpHoursWarning; } set { SetProperty(ref _isCMMAnodeTotalAmpHoursWarning, value); } } public bool IsCMMAnodeTotalAmpHoursFault { get { return _isCMMAnodeTotalAmpHoursFault; } set { SetProperty(ref _isCMMAnodeTotalAmpHoursFault, value); } } public bool IsCMMCathodeTotalAmpHoursWarning { get { return _isCMMCathodeTotalAmpHoursWarning; } set { SetProperty(ref _isCMMCathodeTotalAmpHoursWarning, value); } } public bool IsCMMCathodeTotalAmpHoursFault { get { return _isCMMCathodeTotalAmpHoursFault; } set { SetProperty(ref _isCMMCathodeTotalAmpHoursFault, value); } } #endregion #endregion #region 命令 public ICommand InitializeCommand { get; set; } public ICommand OpenDIReplenValveCommand { get; set; } public ICommand CloseDIReplenValveCommand { get; set; } public ICommand OpenCellFlow1Command { get; set; } public ICommand OpenCellBypass1Command { get; set; } public ICommand OpenCellFlow2Command { get; set; } public ICommand OpenCellBypass2Command { get; set; } public ICommand OpenClampValve1Command { get; set; } public ICommand CloseClampValve1Command { get; set; } public ICommand OpenClampValve2Command { get; set; } public ICommand CloseClampValve2Command { get; set; } public ICommand ManualDireplenCommand { get; set; } public ICommand ResetTotalCommand { get; set; } public ICommand GotoPMCounterCommand { get; set; } public ICommand JumpDosingSystemCommand { get; set; } #endregion /// /// 构造函数 /// public StandardHotReservoirsViewModel() { InitializeCommand = new DelegateCommand(InitializeAction); OpenDIReplenValveCommand = new DelegateCommand(OnOpenDIReplenValve); CloseDIReplenValveCommand = new DelegateCommand(OnCloseDIReplenValve); OpenCellFlow1Command = new DelegateCommand(OnCellFlow1); OpenCellBypass1Command = new DelegateCommand(OnCellBypass1); OpenCellFlow2Command = new DelegateCommand(OnCellFlow2); OpenCellBypass2Command = new DelegateCommand(OnCellBypass2); OpenClampValve1Command = new DelegateCommand(OnOpenClampValve1); CloseClampValve1Command = new DelegateCommand(OnCloseClampValve1); OpenClampValve2Command = new DelegateCommand(OnOpenClampValve2); CloseClampValve2Command = new DelegateCommand(OnCloseClampValve2); ManualDireplenCommand = new DelegateCommand(ManualDireplenAction); ResetTotalCommand = new DelegateCommand(ResetTotalAction); GotoPMCounterCommand = new DelegateCommand(GotoPMCounterAction); JumpDosingSystemCommand = new DelegateCommand(JumpDosingSystemAction); } /// /// 加载数据 /// public void LoadData(string systemName) { RecipeType = "res"; Module = systemName; _rtDataKeys.Clear(); _rtDataKeys.Add($"{Module}.Metals"); _rtDataKeys.Add($"{Module}.ReplenType"); Dictionary tmpMetals = QueryDataClient.Instance.Service.PollData(_rtDataKeys); if (tmpMetals != null) { string replenType = CommonFunction.GetValue(tmpMetals, $"{Module}.ReplenType"); IsDosingSystemEnabled = replenType != "" ? true : false; List strMetals = CommonFunction.GetValue>(tmpMetals, $"{Module}.Metals"); CellsCount = strMetals.Count; if(strMetals!=null&& CellsCount>= 2) { CellModuleNameCollection.Clear(); MetalDataCollection.Clear(); for (int i = 0; i < CellsCount; i++) { string metal=strMetals[i]; if (!string.IsNullOrEmpty(metal)) { CellModuleNameCollection.Add(metal); _rtDataKeys.Add($"{metal}.MetalData"); } MetalDataCollection.Add(new StandardHotMetalDeviceData()); } } } _rtDataKeys.Add($"{Module}.ReservoirData"); _rtDataKeys.Add($"{Module}.PersistentValue"); _rtDataKeys.Add($"{Module}.IsManualReplen"); _rtDataKeys.Add($"{Module}.DIValveMaxOnTime"); _rtDataKeys.Add($"{Module}.CurrentRecipe"); _rtDataKeys.Add($"{Module}.TemperatureControllerData"); _rtDataKeys.Add($"{Module}.CmmPowerSupplierData"); _rtDataKeys.Add($"Safety.SafetyData"); _rtDataKeys.Add($"{Module}.FsmState"); _rtDataKeys.Add($"{Module}.ReservoirAverageLevel"); _rtDataKeys.Add($"{Module}.ReservoirUsage"); if (_timer == null) { _timer = new DispatcherTimer(); _timer.Interval = TimeSpan.FromMilliseconds(200); _timer.Tick += Timer_Tick; } _timer.Start(); //加载Config _reservoirCMMFlowHighWarning = Convert.ToDouble(QueryDataClient.Instance.Service.GetConfig("Reservoir.CMM.CMMFlowHighWarning")); _reservoirCMMFlowHighError = Convert.ToDouble(QueryDataClient.Instance.Service.GetConfig("Reservoir.CMM.CMMFlowHighFault")); _reservoirCMMFlowLowWarning = Convert.ToDouble(QueryDataClient.Instance.Service.GetConfig("Reservoir.CMM.CMMFlowLowWarning")); _reservoirCMMFlowLowError = Convert.ToDouble(QueryDataClient.Instance.Service.GetConfig("Reservoir.CMM.CMMFlowLowFault")); CMMAnodeLifeTimeAHrs = Convert.ToDouble(QueryDataClient.Instance.Service.GetConfig("Reservoir.CMM.CMMAnodeLifeTimeAHrs")); CMMCathodeLifeTimeAHrs = Convert.ToDouble(QueryDataClient.Instance.Service.GetConfig("Reservoir.CMM.CMMCathodeLifeTimeAHrs")); _reservoirHighLevel = Convert.ToDouble(QueryDataClient.Instance.Service.GetConfig($"Reservoir.{Module}.HighLevel")); _cmmAnodeTotalAmpHoursWarningLimit = (double)Convert.ToDouble(QueryDataClient.Instance.Service.GetConfig("Reservoir.CMM.CMMAnodeTotalAmpHoursWarningLimit")); _cmmAnodeTotalAmpHoursFaultLimit = (double)Convert.ToDouble(QueryDataClient.Instance.Service.GetConfig("Reservoir.CMM.CMMAnodeTotalAmpHoursFaultLimit")); _cmmCathodeTotalAmpHoursWarningLimit = (double)Convert.ToDouble(QueryDataClient.Instance.Service.GetConfig("Reservoir.CMM.CMMCathodeTotalAmpHoursWarningLimit")); _cmmCathodeTotalAmpHoursFaultLimit = (double)Convert.ToDouble(QueryDataClient.Instance.Service.GetConfig("Reservoir.CMM.CMMCathodeTotalAmpHoursFaultLimit")); } #region 命令方法 /// /// 初始化 /// /// private void InitializeAction(object param) { InvokeClient.Instance.Service.DoOperation($"{Module}.InitializeAll"); } /// /// 重置TotalTime /// private void ResetTotalAction() { InvokeClient.Instance.Service.DoOperation($"{Module}.ResetTotalTime"); } /// /// Cell1三向阀开启CellFlow /// /// private void OnCellFlow1(object param) { if(CellModuleNameCollection[0] != "") { InvokeClient.Instance.Service.DoOperation($"{CellModuleNameCollection[0]}.CellSwitchToFlow"); } } /// /// Cell1三向阀开启CellBypass /// private void OnCellBypass1(object param) { if(CellModuleNameCollection[0] != "") { InvokeClient.Instance.Service.DoOperation($"{CellModuleNameCollection[0]}.CellSwitchToBypass"); } } /// /// Cell2三向阀开启CellFlow /// /// private void OnCellFlow2(object param) { if(CellModuleNameCollection[1] != "") { InvokeClient.Instance.Service.DoOperation($"{CellModuleNameCollection[1]}.CellSwitchToFlow"); } } /// /// Cell2三向阀开启CellBypass /// private void OnCellBypass2(object param) { if (CellModuleNameCollection[1] != "") { InvokeClient.Instance.Service.DoOperation($"{CellModuleNameCollection[1]}.CellSwitchToBypass"); } } /// /// Cell1 Open Clamp Valve /// private void OnOpenClampValve1(object param) { if (CellModuleNameCollection[0] != "") { InvokeClient.Instance.Service.DoOperation($"{CellModuleNameCollection[0]}.ClampOn"); } } /// /// Cell1 Close Clamp Valve /// private void OnCloseClampValve1(object param) { if (CellModuleNameCollection[0] != "") { InvokeClient.Instance.Service.DoOperation($"{CellModuleNameCollection[0]}.ClampOff"); } } /// /// Cell2 Open Clamp Valve /// private void OnOpenClampValve2(object param) { if (CellModuleNameCollection[1] != "") { InvokeClient.Instance.Service.DoOperation($"{CellModuleNameCollection[1]}.ClampOn"); } } /// /// Cell2 Close Clamp Valve /// private void OnCloseClampValve2(object param) { if (CellModuleNameCollection[1] != "") { InvokeClient.Instance.Service.DoOperation($"{CellModuleNameCollection[1]}.ClampOff"); } } /// /// Open DI Replen Valve /// private void OnOpenDIReplenValve(object param) { InvokeClient.Instance.Service.DoOperation($"{Module}.DiReplenOn"); } /// /// Close DI Replen Valve /// private void OnCloseDIReplenValve(object param) { InvokeClient.Instance.Service.DoOperation($"{Module}.DiReplenOff"); } /// /// Manual DireplenAction /// /// private void ManualDireplenAction(object param) { InvokeClient.Instance.Service.DoOperation($"{Module}.ManualDiReplen",ManualFillSeconds); } /// /// 进入PMCounter页面 /// /// private void GotoPMCounterAction(object param) { GlobalEvents.OnSwitchFixedChildSubItem(Module, $"PMCounter{Module.Substring(9, 1)}"); } /// /// 跳转DosingSystem /// /// private void JumpDosingSystemAction(object param) { GlobalEvents.OnSwitchFixedChildSubItem(Module, $"DosingSystem1"); } #endregion /// /// 时钟 /// /// /// private void Timer_Tick(object sender, EventArgs e) { if (_rtDataKeys.Count != 0) { _rtDataValueDic = QueryDataClient.Instance.Service.PollData(_rtDataKeys); if (_rtDataValueDic != null) { ReservoirsPersistent = CommonFunction.GetValue(_rtDataValueDic, $"{Module}.PersistentValue"); IsManualReplen = CommonFunction.GetValue(_rtDataValueDic, $"{Module}.IsManualReplen"); DIValveMaxOnTime = CommonFunction.GetValue(_rtDataValueDic, $"{Module}.DIValveMaxOnTime"); CurrentRecipe = CommonFunction.GetValue(_rtDataValueDic, $"{Module}.CurrentRecipe"); TemperatureControlData = CommonFunction.GetValue(_rtDataValueDic, $"{Module}.TemperatureControllerData"); TCEnableStatus = TemperatureControlData.ControlOperationModel == 0 ? "Disable" : "Enable"; CmmPowerSupplierData = CommonFunction.GetValue(_rtDataValueDic, $"{Module}.CmmPowerSupplierData"); CommonSafetyData = CommonFunction.GetValue(_rtDataValueDic, $"Safety.SafetyData"); State = CommonFunction.GetValue(_rtDataValueDic, $"{Module}.FsmState"); AvgLevel = CommonFunction.GetValue(_rtDataValueDic, $"{Module}.ReservoirAverageLevel"); ReservoirUsage reservoirUsage = CommonFunction.GetValue(_rtDataValueDic, $"{Module}.ReservoirUsage"); if(reservoirUsage != null) { CMMAnodeUsage = reservoirUsage.CMMAnodeUsage; CMMCathodeUsage = reservoirUsage.CMMMembranceUsage; //CMM AnodeUsage if (CMMAnodeUsage > _cmmAnodeTotalAmpHoursFaultLimit) { IsCMMAnodeTotalAmpHoursFault = true; IsCMMAnodeTotalAmpHoursWarning = false; } else if(CMMAnodeUsage > _cmmAnodeTotalAmpHoursWarningLimit) { IsCMMAnodeTotalAmpHoursWarning = true; IsCMMAnodeTotalAmpHoursFault = false; } else { IsCMMAnodeTotalAmpHoursWarning = false; IsCMMAnodeTotalAmpHoursFault = false; } //CMM CathodeUsage if (CMMCathodeUsage > _cmmCathodeTotalAmpHoursFaultLimit) { IsCMMCathodeTotalAmpHoursFault = true; IsCMMCathodeTotalAmpHoursWarning = false; } else if (CMMCathodeUsage > _cmmCathodeTotalAmpHoursWarningLimit) { IsCMMCathodeTotalAmpHoursWarning = true; IsCMMCathodeTotalAmpHoursFault = false; } else { IsCMMCathodeTotalAmpHoursWarning = false; IsCMMCathodeTotalAmpHoursFault = false; } } if ("Manual".Equals(ReservoirsPersistent.OperatingMode)) { IsEnabled = true; IsAutoEnabled = true; } else if ("Auto".Equals(ReservoirsPersistent.OperatingMode)) { IsAutoEnabled = true; IsEnabled = false; } else { State = "Stopped"; IsEnabled = false; IsAutoEnabled = false; } for (int i = 0;i < CellsCount;i++) { MetalDataCollection[i] = CommonFunction.GetValue(_rtDataValueDic, $"{CellModuleNameCollection[i]}.MetalData"); } ReservoirData = CommonFunction.GetValue(_rtDataValueDic, $"{Module}.ReservoirData"); if (CurrentRecipe != null) { //PHLow报警灯 IsPHLowLimit = (ReservoirData != null && ReservoirData.PHValue < CurrentRecipe.PHErrorLow) ? true : false; //PHHigh报警灯 IsPHHighLimit = (ReservoirData != null && ReservoirData.PHValue > CurrentRecipe.PHErrorHigh) ? true : false; if(CmmPowerSupplierData != null) { //PowerSupply High报警灯 if (CmmPowerSupplierData.Current <= CurrentRecipe.CMMCurrentSetPoint * (1 + (double)CurrentRecipe.CMMCurrentWarningPercent/100)) { CurrentHighStatus = "Normal"; } else if (CmmPowerSupplierData.Current > CurrentRecipe.CMMCurrentSetPoint * (1 + (double)CurrentRecipe.CMMCurrentFaultPercent/100)) { CurrentHighStatus = "Error"; } else { CurrentHighStatus = "Warning"; } //PowerSupply Low报警灯 if (CmmPowerSupplierData.Current >= CurrentRecipe.CMMCurrentSetPoint * (1 - (double)CurrentRecipe.CMMCurrentWarningPercent/100)) { CurrentLowStatus = "Normal"; } else if (CmmPowerSupplierData.Current < CurrentRecipe.CMMCurrentSetPoint * (1 - (double)CurrentRecipe.CMMCurrentFaultPercent/100)) { CurrentLowStatus = "Error"; } else { CurrentLowStatus = "Warning"; } IsBelowMinVoltage = CmmPowerSupplierData.Voltage < CurrentRecipe.CMMMinVoltage ? true : false; } } if (ReservoirData != null) { //CMM Flow High报警灯 if (ReservoirData.Flow <= _reservoirCMMFlowHighWarning) { FlowHighStatus = "Normal"; } else if (ReservoirData.Flow > _reservoirCMMFlowHighError) { FlowHighStatus = "Error"; } else { FlowHighStatus = "Warning"; } //CMM Flow Low报警灯 if (ReservoirData.Flow >= _reservoirCMMFlowLowWarning) { FlowLowStatus = "Normal"; } else if (ReservoirData.Flow < _reservoirCMMFlowLowError) { FlowLowStatus = "Error"; } else { FlowLowStatus = "Warning"; } //High Level报警灯 IsHighLevel = (ReservoirData.WaterLevel > _reservoirHighLevel) ? true : false; //Low Level报警灯 IsLowLevel = ReservoirData.LowLevel; //HighSafety if(CommonSafetyData != null) IsHighSafety = CommonSafetyData.ReservoirHighLevel; //HedFlow管流 HEDFlowIsOn = (ReservoirData.HedFlow > 0) ? true : false; //DIReplenFault IsDiReplenFault = false; IsError = State== "Error" ? true : false; } } } } /// /// 隐藏 /// public void Hide() { if (_timer != null) { _timer.Stop(); } } } }