1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075 |
- 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
- /// <summary>
- /// rt查询key
- /// </summary>
- private List<string> _rtDataKeys = new List<string>();
- /// <summary>
- /// 时钟
- /// </summary>
- DispatcherTimer _timer;
- /// <summary>
- /// rt查询数据
- /// </summary>
- private Dictionary<string, object> _rtDataValueDic = new Dictionary<string, object>();
- #endregion
- #region Common
- private double _avgLevel;
- /// <summary>
- /// Module
- /// </summary>
- private string _module;
- /// <summary>
- /// Operation Mode
- /// </summary>
- private string _operatingMode;
- /// <summary>
- /// 状态
- /// </summary>
- private string _state;
- /// <summary>
- /// Reservoirs Persistent数据
- /// </summary>
- private ReservoirsPersistentValue _reservoirsPersistent;
- /// <summary>
- /// Reservoir数据
- /// </summary>
- private StandardHotReservoirData _reservoirData;
- /// <summary>
- /// Metal数据集合
- /// </summary>
- private ObservableCollection<StandardHotMetalDeviceData> _metalDataCollection = new ObservableCollection<StandardHotMetalDeviceData>();
- /// <summary>
- /// CellModuleName集合
- /// </summary>
- private ObservableCollection<string> _cellModuleNameCollection = new ObservableCollection<string>();
- /// <summary>
- /// Cells数量
- /// </summary>
- private int _cellsCount;
- /// <summary>
- /// 手动注水时长(秒)
- /// </summary>
- private int _manualFillSeconds;
- /// <summary>
- /// 是否正在手动注水
- /// </summary>
- private bool _isManualReplen;
- /// <summary>
- /// DIValveMaxOnTime
- /// </summary>
- private double _diValveMaxOnTime;
- /// <summary>
- /// 是否超过PH值下限
- /// </summary>
- private bool _isPHLowLimit;
- /// <summary>
- /// 是否超过PH值下限
- /// </summary>
- private bool _isPHHighLimit;
- /// <summary>
- /// TemperatureControl Module Name
- /// </summary>
- private TemperatureControllerData _temperatureControlData;
- /// <summary>
- /// PowerSupply Module Name
- /// </summary>
- private PowerSupplierData _cmmPowerSupplierData;
- /// <summary>
- /// 是否超过HighLevel
- /// </summary>
- private bool _isHighLevel;
- /// <summary>
- /// 是否超过LowLevel
- /// </summary>
- private bool _isLowLevel;
- /// <summary>
- /// 是否触发highsafety
- /// </summary>
- private bool _isHighSafety;
- /// <summary>
- /// HED Flow
- /// </summary>
- private bool _hedFlowIsOn;
- /// <summary>
- /// DiReplen是否报错
- /// </summary>
- private bool _isDiReplenFault;
- /// <summary>
- /// Safety Data
- /// </summary>
- private SafetyData _safetyData;
- /// <summary>
- /// 页面功能启用
- /// </summary>
- private bool _isEnabled;
- /// <summary>
- /// AutoMode页面功能启用
- /// </summary>
- private bool _isAutoEnabled;
- /// <summary>
- /// DosingSystem是否启用
- /// </summary>
- private bool _isDosingSystemEnabled;
- /// <summary>
- /// TC Enable状态
- /// </summary>
- private string _tcEnableStatus;
- /// <summary>
- /// 是否error状态
- /// </summary>
- private bool _isError;
- #endregion
- #region Recipe
- /// <summary>
- /// 当前的recipe
- /// </summary>
- private ResRecipe _currentRecipe;
- /// <summary>
- /// Recipe Mode
- /// </summary>
- private string _recipeMode;
- /// <summary>
- /// Selected Recipe Node
- /// </summary>
- private RecipeNode _selectedRecipeNode;
- /// <summary>
- /// Recipe Type
- /// </summary>
- private string _recipeType;
- /// <summary>
- /// Recipe Manager
- /// </summary>
- private UiRecipeManager _uiRecipeManager = new UiRecipeManager();
- #endregion
- #region CMM
- /// <summary>
- /// Flow High 状态(Warning:黄色,Error:红色)
- /// </summary>
- private string _flowHighStatus = "";
- /// <summary>
- /// Flow Low 状态(Warning:黄色,Error:红色)
- /// </summary>
- private string _flowLowStatus = "";
- /// <summary>
- /// PowerSupplier High电流状态
- /// </summary>
- private string _currentHighStatus = "";
- /// <summary>
- /// PowerSupplier Low电流状态
- /// </summary>
- private string _currentLowStatus = "";
- /// <summary>
- /// 是否低于最小电压
- /// </summary>
- private bool _isBelowMinVoltage = false;
- /// <summary>
- /// CMM Anode AHrs
- /// </summary>
- private double _reservoirCMMAnodeAHrs;
- /// <summary>
- /// CMM Cathode AHrs
- /// </summary>
- private double _reservoirCMMCathodeAHrs;
- /// <summary>
- /// CMM Anode用电量
- /// </summary>
- private double _cmmAnodeUsage;
- /// <summary>
- /// CMM Cathode用电量
- /// </summary>
- private double _cmmCathodeUsage;
- /// <summary>
- /// CMM Flow High Warning
- /// </summary>
- private double _reservoirCMMFlowHighWarning;
- /// <summary>
- /// CMM Flow High Error
- /// </summary>
- private double _reservoirCMMFlowHighError;
- /// <summary>
- /// CMM Flow Low Warning
- /// </summary>
- private double _reservoirCMMFlowLowWarning;
- /// <summary>
- /// CMM Flow Low Error
- /// </summary>
- private double _reservoirCMMFlowLowError;
- /// <summary>
- /// CMM Anode LifeTime AHrs
- /// </summary>
- private double _reservoirCMMAnodeLifeTimeAHrs;
- /// <summary>
- /// CMM Cathode LifeTime AHrs
- /// </summary>
- private double _reservoirCMMCathodeLifeTimeAHrs;
- /// <summary>
- /// HighLevel
- /// </summary>
- private double _reservoirHighLevel;
- /// <summary>
- /// LowLevel
- /// </summary>
- private double _reservoirLowLevel;
- /// <summary>
- /// CMM电量limit
- /// </summary>
- private double _cmmAnodeTotalAmpHoursWarningLimit;
- private double _cmmAnodeTotalAmpHoursFaultLimit;
- private double _cmmCathodeTotalAmpHoursWarningLimit;
- private double _cmmCathodeTotalAmpHoursFaultLimit;
- /// <summary>
- /// CMM电量报警灯
- /// </summary>
- 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); }
- }
- /// <summary>
- /// Module
- /// </summary>
- public string Module
- {
- get { return _module; }
- set { SetProperty(ref _module, value); }
- }
- /// <summary>
- /// Operation Mode
- /// </summary>
- public string OperatingMode
- {
- get { return _operatingMode; }
- set { SetProperty(ref _operatingMode, value); }
- }
- /// <summary>
- /// 状态
- /// </summary>
- public string State
- {
- get { return _state; }
- set { SetProperty(ref _state, value); }
- }
- /// <summary>
- /// Reservoirs Persistent数据
- /// </summary>
- public ReservoirsPersistentValue ReservoirsPersistent
- {
- get { return _reservoirsPersistent; }
- set { SetProperty(ref _reservoirsPersistent, value); }
- }
- /// <summary>
- /// Reservoir数据
- /// </summary>
- public StandardHotReservoirData ReservoirData
- {
- get { return _reservoirData; }
- set { SetProperty(ref _reservoirData, value); }
- }
- /// <summary>
- /// Metal数据集合
- /// </summary>
- public ObservableCollection<StandardHotMetalDeviceData> MetalDataCollection
- {
- get { return _metalDataCollection; }
- set { SetProperty(ref _metalDataCollection, value); }
- }
- /// <summary>
- /// CellModuleName集合
- /// </summary>
- public ObservableCollection<string> CellModuleNameCollection
- {
- get { return _cellModuleNameCollection; }
- set { SetProperty(ref _cellModuleNameCollection, value); }
- }
- /// <summary>
- /// Cells数量
- /// </summary>
- public int CellsCount
- {
- get { return _cellsCount; }
- set { SetProperty(ref _cellsCount, value); }
- }
- /// <summary>
- /// 是否超过PH值下限
- /// </summary>
- public bool IsPHLowLimit
- {
- get { return _isPHLowLimit; }
- set { SetProperty(ref _isPHLowLimit, value); }
- }
- /// <summary>
- /// 是否超过PH值下限
- /// </summary>
- public bool IsPHHighLimit
- {
- get { return _isPHHighLimit; }
- set { SetProperty(ref _isPHHighLimit, value); }
- }
- /// <summary>
- /// 手动注水时长(秒)
- /// </summary>
- public int ManualFillSeconds
- {
- get { return _manualFillSeconds; }
- set { SetProperty(ref _manualFillSeconds, value); }
- }
- /// <summary>
- /// 是否正在手动注水
- /// </summary>
- public bool IsManualReplen
- {
- get { return _isManualReplen; }
- set { SetProperty(ref _isManualReplen, value); }
- }
- /// <summary>
- /// DIValveMaxOnTime
- /// </summary>
- public double DIValveMaxOnTime
- {
- get { return _diValveMaxOnTime; }
- set { SetProperty(ref _diValveMaxOnTime, value);}
- }
- /// <summary>
- /// TemperatureControl Module Name
- /// </summary>
- public TemperatureControllerData TemperatureControlData
- {
- get { return _temperatureControlData; }
- set { SetProperty(ref _temperatureControlData, value); }
- }
- /// <summary>
- /// PowerSupply Module Name
- /// </summary>
- public PowerSupplierData CmmPowerSupplierData
- {
- get { return _cmmPowerSupplierData; }
- set { SetProperty(ref _cmmPowerSupplierData, value); }
- }
- /// <summary>
- /// 是否超过HighLevel
- /// </summary>
- public bool IsHighLevel
- {
- get { return _isHighLevel; }
- set { SetProperty(ref _isHighLevel, value); }
- }
- /// <summary>
- /// 是否超过LowLevel
- /// </summary>
- public bool IsLowLevel
- {
- get { return _isLowLevel; }
- set { SetProperty(ref _isLowLevel, value); }
- }
- /// <summary>
- /// 是否触发Highsafety
- /// </summary>
- public bool IsHighSafety
- {
- get { return _isHighSafety; }
- set { SetProperty(ref _isHighSafety, value); }
- }
- /// <summary>
- /// HED Flow
- /// </summary>
- public bool HEDFlowIsOn
- {
- get { return _hedFlowIsOn; }
- set { SetProperty(ref _hedFlowIsOn, value); }
- }
- /// <summary>
- /// DI Replen是否报错
- /// </summary>
- public bool IsDiReplenFault
- {
- get { return _isDiReplenFault; }
- set { SetProperty(ref _hedFlowIsOn, value); }
- }
- /// <summary>
- /// Safety数据
- /// </summary>
- public SafetyData CommonSafetyData
- {
- get { return _safetyData; }
- set { SetProperty(ref _safetyData, value); }
- }
- /// <summary>
- /// 页面功能启用
- /// </summary>
- public bool IsEnabled
- {
- get { return _isEnabled; }
- set { SetProperty(ref _isEnabled, value); }
- }
- /// <summary>
- /// AutoMode页面功能启用
- /// </summary>
- public bool IsAutoEnabled
- {
- get { return _isAutoEnabled; }
- set { SetProperty(ref _isAutoEnabled, value); }
- }
- /// <summary>
- /// DosingSystem是否启用
- /// </summary>
- public bool IsDosingSystemEnabled
- {
- get { return _isDosingSystemEnabled; }
- set { SetProperty(ref _isDosingSystemEnabled, value); }
- }
- /// <summary>
- /// TC Enable状态
- /// </summary>
- public string TCEnableStatus
- {
- get { return _tcEnableStatus; }
- set { SetProperty(ref _tcEnableStatus, value); }
- }
- /// <summary>
- /// 是否Error
- /// </summary>
- public bool IsError
- {
- get { return _isError; }
- set { SetProperty(ref _isError, value); }
- }
- #endregion
- #region Recipe
- /// <summary>
- /// Recipe内容
- /// </summary>
- public ResRecipe CurrentRecipe
- {
- get { return _currentRecipe; }
- set { SetProperty(ref _currentRecipe, value); }
- }
- /// <summary>
- /// Selected Recipe Node
- /// </summary>
- public RecipeNode SelectedRecipeNode
- {
- get { return _selectedRecipeNode; }
- set { SetProperty(ref _selectedRecipeNode, value); }
- }
- /// <summary>
- /// Recipe Mode
- /// </summary>
- public string RecipeMode
- {
- get { return _recipeMode; }
- set { SetProperty(ref _recipeMode, value); }
- }
- /// <summary>
- /// Recipe Type
- /// </summary>
- public string RecipeType
- {
- get { return _recipeType; }
- set { SetProperty(ref _recipeType, value); }
- }
- #endregion
-
- #region CMM
- /// <summary>
- /// Flow High 状态(Warning:黄色,Error:红色)
- /// </summary>
- public string FlowHighStatus
- {
- get { return _flowHighStatus; }
- set { SetProperty(ref _flowHighStatus, value); }
- }
- /// <summary>
- /// Flow Low 状态(Warning:黄色,Error:红色)
- /// </summary>
- public string FlowLowStatus
- {
- get { return _flowLowStatus; }
- set { SetProperty(ref _flowLowStatus, value); }
- }
- /// <summary>
- /// PowerSupplier High电流状态
- /// </summary>
- public string CurrentHighStatus
- {
- get { return _currentHighStatus; }
- set { SetProperty(ref _currentHighStatus, value); }
- }
- /// <summary>
- /// PowerSupplier Low电流状态
- /// </summary>
- public string CurrentLowStatus
- {
- get { return _currentLowStatus; }
- set { SetProperty(ref _currentLowStatus, value); }
- }
- /// <summary>
- /// 是否低于最小电压
- /// </summary>
- public bool IsBelowMinVoltage
- {
- get { return _isBelowMinVoltage; }
- set { SetProperty(ref _isBelowMinVoltage, value); }
- }
- /// <summary>
- /// CMM Anode 用电量
- /// </summary>
- public double CMMAnodeAHrs
- {
- get { return _reservoirCMMAnodeAHrs; ; }
- set { SetProperty(ref _reservoirCMMAnodeAHrs, value); }
- }
- /// <summary>
- /// CMM Cathode 用电量
- /// </summary>
- public double CMMCathodeAHrs
- {
- get { return _reservoirCMMCathodeAHrs; ; }
- set { SetProperty(ref _reservoirCMMCathodeAHrs, value); }
- }
- #endregion
- #region Config
- /// <summary>
- /// CMM Anode LifeTime用电量
- /// </summary>
- public double CMMAnodeLifeTimeAHrs
- {
- get { return _reservoirCMMAnodeLifeTimeAHrs; ; }
- set { SetProperty(ref _reservoirCMMAnodeLifeTimeAHrs, value); }
- }
- /// <summary>
- /// CMM Cathode LifeTime用电量
- /// </summary>
- public double CMMCathodeLifeTimeAHrs
- {
- get { return _reservoirCMMCathodeLifeTimeAHrs; ; }
- set { SetProperty(ref _reservoirCMMCathodeLifeTimeAHrs, value); }
- }
- /// <summary>
- /// CMM Anode用电量
- /// </summary>
- public double CMMAnodeUsage
- {
- get { return _cmmAnodeUsage; ; }
- set { SetProperty(ref _cmmAnodeUsage, value); }
- }
- /// <summary>
- /// CMM Cathode用电量
- /// </summary>
- public double CMMCathodeUsage
- {
- get { return _cmmCathodeUsage; ; }
- set { SetProperty(ref _cmmCathodeUsage, value); }
- }
- /// <summary>
- /// CMM电量报警灯
- /// </summary>
- 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
- /// <summary>
- /// 构造函数
- /// </summary>
- public StandardHotReservoirsViewModel()
- {
- InitializeCommand = new DelegateCommand<object>(InitializeAction);
- OpenDIReplenValveCommand = new DelegateCommand<object>(OnOpenDIReplenValve);
- CloseDIReplenValveCommand = new DelegateCommand<object>(OnCloseDIReplenValve);
- OpenCellFlow1Command = new DelegateCommand<object>(OnCellFlow1);
- OpenCellBypass1Command = new DelegateCommand<object>(OnCellBypass1);
- OpenCellFlow2Command = new DelegateCommand<object>(OnCellFlow2);
- OpenCellBypass2Command = new DelegateCommand<object>(OnCellBypass2);
- OpenClampValve1Command = new DelegateCommand<object>(OnOpenClampValve1);
- CloseClampValve1Command = new DelegateCommand<object>(OnCloseClampValve1);
- OpenClampValve2Command = new DelegateCommand<object>(OnOpenClampValve2);
- CloseClampValve2Command = new DelegateCommand<object>(OnCloseClampValve2);
- ManualDireplenCommand = new DelegateCommand<object>(ManualDireplenAction);
- ResetTotalCommand = new DelegateCommand(ResetTotalAction);
- GotoPMCounterCommand = new DelegateCommand<object>(GotoPMCounterAction);
- JumpDosingSystemCommand = new DelegateCommand<object>(JumpDosingSystemAction);
- }
- /// <summary>
- /// 加载数据
- /// </summary>
- public void LoadData(string systemName)
- {
- RecipeType = "res";
- Module = systemName;
- _rtDataKeys.Clear();
- _rtDataKeys.Add($"{Module}.Metals");
- _rtDataKeys.Add($"{Module}.ReplenType");
-
- Dictionary<string,object> tmpMetals = QueryDataClient.Instance.Service.PollData(_rtDataKeys);
- if (tmpMetals != null)
- {
- string replenType = CommonFunction.GetValue<string>(tmpMetals, $"{Module}.ReplenType");
- IsDosingSystemEnabled = replenType != "" ? true : false;
- List<string> strMetals = CommonFunction.GetValue<List<string>>(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 命令方法
- /// <summary>
- /// 初始化
- /// </summary>
- /// <param name="param"></param>
- private void InitializeAction(object param)
- {
- InvokeClient.Instance.Service.DoOperation($"{Module}.InitializeAll");
- }
- /// <summary>
- /// 重置TotalTime
- /// </summary>
- private void ResetTotalAction()
- {
- InvokeClient.Instance.Service.DoOperation($"{Module}.ResetTotalTime");
- }
- /// <summary>
- /// Cell1三向阀开启CellFlow
- /// </summary>
- /// <param name="obj"></param>
- private void OnCellFlow1(object param)
- {
- if(CellModuleNameCollection[0] != "")
- {
- InvokeClient.Instance.Service.DoOperation($"{CellModuleNameCollection[0]}.CellSwitchToFlow");
- }
- }
- /// <summary>
- /// Cell1三向阀开启CellBypass
- /// </summary>
- private void OnCellBypass1(object param)
- {
- if(CellModuleNameCollection[0] != "")
- {
- InvokeClient.Instance.Service.DoOperation($"{CellModuleNameCollection[0]}.CellSwitchToBypass");
- }
- }
- /// <summary>
- /// Cell2三向阀开启CellFlow
- /// </summary>
- /// <param name="obj"></param>
- private void OnCellFlow2(object param)
- {
- if(CellModuleNameCollection[1] != "")
- {
- InvokeClient.Instance.Service.DoOperation($"{CellModuleNameCollection[1]}.CellSwitchToFlow");
- }
-
- }
- /// <summary>
- /// Cell2三向阀开启CellBypass
- /// </summary>
- private void OnCellBypass2(object param)
- {
- if (CellModuleNameCollection[1] != "")
- {
- InvokeClient.Instance.Service.DoOperation($"{CellModuleNameCollection[1]}.CellSwitchToBypass");
- }
-
- }
- /// <summary>
- /// Cell1 Open Clamp Valve
- /// </summary>
- private void OnOpenClampValve1(object param)
- {
- if (CellModuleNameCollection[0] != "")
- {
- InvokeClient.Instance.Service.DoOperation($"{CellModuleNameCollection[0]}.ClampOn");
- }
-
- }
- /// <summary>
- /// Cell1 Close Clamp Valve
- /// </summary>
- private void OnCloseClampValve1(object param)
- {
- if (CellModuleNameCollection[0] != "")
- {
- InvokeClient.Instance.Service.DoOperation($"{CellModuleNameCollection[0]}.ClampOff");
- }
-
- }
- /// <summary>
- /// Cell2 Open Clamp Valve
- /// </summary>
- private void OnOpenClampValve2(object param)
- {
- if (CellModuleNameCollection[1] != "")
- {
- InvokeClient.Instance.Service.DoOperation($"{CellModuleNameCollection[1]}.ClampOn");
- }
- }
- /// <summary>
- /// Cell2 Close Clamp Valve
- /// </summary>
- private void OnCloseClampValve2(object param)
- {
- if (CellModuleNameCollection[1] != "")
- {
- InvokeClient.Instance.Service.DoOperation($"{CellModuleNameCollection[1]}.ClampOff");
- }
-
- }
- /// <summary>
- /// Open DI Replen Valve
- /// </summary>
- private void OnOpenDIReplenValve(object param)
- {
- InvokeClient.Instance.Service.DoOperation($"{Module}.DiReplenOn");
- }
- /// <summary>
- /// Close DI Replen Valve
- /// </summary>
- private void OnCloseDIReplenValve(object param)
- {
- InvokeClient.Instance.Service.DoOperation($"{Module}.DiReplenOff");
- }
- /// <summary>
- /// Manual DireplenAction
- /// </summary>
- /// <param name="param"></param>
- private void ManualDireplenAction(object param)
- {
- InvokeClient.Instance.Service.DoOperation($"{Module}.ManualDiReplen",ManualFillSeconds);
- }
- /// <summary>
- /// 进入PMCounter页面
- /// </summary>
- /// <param name="param"></param>
- private void GotoPMCounterAction(object param)
- {
- GlobalEvents.OnSwitchFixedChildSubItem(Module, $"PMCounter{Module.Substring(9, 1)}");
- }
- /// <summary>
- /// 跳转DosingSystem
- /// </summary>
- /// <param name="param"></param>
- private void JumpDosingSystemAction(object param)
- {
- GlobalEvents.OnSwitchFixedChildSubItem(Module, $"DosingSystem1");
- }
- #endregion
- /// <summary>
- /// 时钟
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void Timer_Tick(object sender, EventArgs e)
- {
- if (_rtDataKeys.Count != 0)
- {
- _rtDataValueDic = QueryDataClient.Instance.Service.PollData(_rtDataKeys);
- if (_rtDataValueDic != null)
- {
- ReservoirsPersistent = CommonFunction.GetValue<ReservoirsPersistentValue>(_rtDataValueDic, $"{Module}.PersistentValue");
- IsManualReplen = CommonFunction.GetValue<bool>(_rtDataValueDic, $"{Module}.IsManualReplen");
- DIValveMaxOnTime = CommonFunction.GetValue<double>(_rtDataValueDic, $"{Module}.DIValveMaxOnTime");
- CurrentRecipe = CommonFunction.GetValue<ResRecipe>(_rtDataValueDic, $"{Module}.CurrentRecipe");
- TemperatureControlData = CommonFunction.GetValue<TemperatureControllerData>(_rtDataValueDic, $"{Module}.TemperatureControllerData");
- TCEnableStatus = TemperatureControlData.ControlOperationModel == 0 ? "Disable" : "Enable";
- CmmPowerSupplierData = CommonFunction.GetValue<PowerSupplierData>(_rtDataValueDic, $"{Module}.CmmPowerSupplierData");
- CommonSafetyData = CommonFunction.GetValue<SafetyData>(_rtDataValueDic, $"Safety.SafetyData");
- State = CommonFunction.GetValue<string>(_rtDataValueDic, $"{Module}.FsmState");
- AvgLevel = CommonFunction.GetValue<double>(_rtDataValueDic, $"{Module}.ReservoirAverageLevel");
- ReservoirUsage reservoirUsage = CommonFunction.GetValue<ReservoirUsage>(_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<StandardHotMetalDeviceData>(_rtDataValueDic, $"{CellModuleNameCollection[i]}.MetalData");
- }
- ReservoirData = CommonFunction.GetValue<StandardHotReservoirData>(_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;
- }
-
- }
- }
- }
- /// <summary>
- /// 隐藏
- /// </summary>
- public void Hide()
- {
- if (_timer != null)
- {
- _timer.Stop();
- }
- }
- }
- }
|