123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074 |
- 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>= 1)
- {
- 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($"{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.{Module}.CMMFlowHighWarning"));
- _reservoirCMMFlowHighError = Convert.ToDouble(QueryDataClient.Instance.Service.GetConfig($"Reservoir.{Module}.CMMFlowHighFault"));
- _reservoirCMMFlowLowWarning = Convert.ToDouble(QueryDataClient.Instance.Service.GetConfig($"Reservoir.{Module}.CMMFlowLowWarning"));
- _reservoirCMMFlowLowError = Convert.ToDouble(QueryDataClient.Instance.Service.GetConfig($"Reservoir.{Module}.CMMFlowLowFault"));
- CMMAnodeLifeTimeAHrs = Convert.ToDouble(QueryDataClient.Instance.Service.GetConfig($"Reservoir.{Module}.CMMAnodeLifeTimeAHrs"));
- CMMCathodeLifeTimeAHrs = Convert.ToDouble(QueryDataClient.Instance.Service.GetConfig($"Reservoir.{Module}.CMMCathodeLifeTimeAHrs"));
- _reservoirHighLevel = Convert.ToDouble(QueryDataClient.Instance.Service.GetConfig($"Reservoir.{Module}.HighLevel"));
- _cmmAnodeTotalAmpHoursWarningLimit = (double)Convert.ToDouble(QueryDataClient.Instance.Service.GetConfig($"Reservoir.{Module}.CMMAnodeTotalAmpHoursWarningLimit"));
- _cmmAnodeTotalAmpHoursFaultLimit = (double)Convert.ToDouble(QueryDataClient.Instance.Service.GetConfig($"Reservoir.{Module}.CMMAnodeTotalAmpHoursFaultLimit"));
- _cmmCathodeTotalAmpHoursWarningLimit = (double)Convert.ToDouble(QueryDataClient.Instance.Service.GetConfig($"Reservoir.{Module}.CMMCathodeTotalAmpHoursWarningLimit"));
- _cmmCathodeTotalAmpHoursFaultLimit = (double)Convert.ToDouble(QueryDataClient.Instance.Service.GetConfig($"Reservoir.{Module}.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");
- 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");
- MetalDataCollection[i].CellPump ^= MetalDataCollection[i].RegulatePumpSignalIn; //用于reservoir4 确保reservoir4 pump开关正常显示
- }
- 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
- IsHighSafety = ReservoirData.SafetyHighLevel;
- //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();
- }
- }
- }
- }
|