SystemFacilities.cs 46 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086
  1. using Aitex.Core.RT.DataCenter;
  2. using Aitex.Core.RT.Device;
  3. using Aitex.Core.RT.Log;
  4. using Aitex.Core.RT.OperationCenter;
  5. using Aitex.Core.RT.SCCore;
  6. using Aitex.Core.Util;
  7. using MECF.Framework.Common.Alarm;
  8. using MECF.Framework.Common.Beckhoff.ModuleIO;
  9. using MECF.Framework.Common.CommonData;
  10. using MECF.Framework.Common.IOCore;
  11. using MECF.Framework.Common.TwinCat;
  12. using System;
  13. using System.Collections.Generic;
  14. namespace CyberX8_RT.Devices.Facilities
  15. {
  16. public class SystemFacilities : BaseDevice, IDevice
  17. {
  18. #region 常量
  19. private const string FACILITIES = "Facilities";
  20. private const string FACILITIES_DATA = "Facilities_Data";
  21. private const string CDA_1_PRESSURE = "CDA_1_Pressure";
  22. private const string CDA_2_PRESSURE = "CDA_2_Pressure";
  23. private const string N2_1A_PRESSURE = "N2_1A_Pressure";
  24. private const string N2_1B_PRESSURE = "N2_1B_Pressure";
  25. private const string N2_2A_PRESSURE = "N2_2A_Pressure";
  26. private const string N2_2B_PRESSURE = "N2_2B_Pressure";
  27. private const string DI_WATER_PRESSURE = "DIWater_Pressure";
  28. private const string HOUSE_CHILLED_WATER_FLOW = "HouseChilledWater_Flow";
  29. private const string CDA_EXTERNAL_PRESSURE = "CDA_External_Pressure";
  30. private const string VACUUM_PRESSURE = "Vacuum_Pressure";
  31. private const string EXHAUST_PRESSURE = "Exhaust_Pressure";
  32. private const string ERROR_MAX = "Error_Max";
  33. private const string ERROR_MIN = "Error_Min";
  34. private const string WARNING_MAX = "Warning_Max";
  35. private const string WARNING_MIN = "Warning_Min";
  36. private const string N2_ENABLE = "N2Enable";
  37. private const string CDA_ENABLE = "CDAEnable";
  38. private const string EXTERNAL_CDA_ENABLE = "ExternalCDAEnable";
  39. private const string DI_WATER_ENABLE = "DiWaterEnable";
  40. private const string HOUSE_CHILLED_WATER_ENABLE = "HouseChilledWaterEnable";
  41. private const string DI_REPLEN_ENABLE = "DiReplenEnable";
  42. private const string DI_FILL_ENABLE = "DiFillEnable";
  43. private const string LOADER_DI_ENABLE = "LoaderDiEnable";
  44. private const string FILTER_PURGE_ENABLE = "FilterPurgeEnable";
  45. private const string N2_1A_PRESSURE_VALUE = "Nitrogen1APressure";
  46. private const string N2_1B_PRESSURE_VALUE = "Nitrogen1BPressure";
  47. private const string N2_2A_PRESSURE_VALUE = "Nitrogen2APressure";
  48. private const string N2_2B_PRESSURE_VALUE = "Nitrogen2BPressure";
  49. private const string CDA_1_PRESSURE_VALUE = "CDA1Pressure";
  50. private const string CDA_2_PRESSURE_VALUE = "CDA2Pressure";
  51. private const string CDA_EXTERNAL_PRESSURE_VALUE = "ExternalCDAPressure";
  52. private const string DI_WATER_PRESSURE_VALUE = "DiWaterPressure";
  53. private const string HOUSE_CHILLED_WATER_PRESSURE_VALUE = "HouseChilledWaterPressure";
  54. private const string EXHAUST_PRESSURE_VALUE = "ExhaustPressure";
  55. private const string VACUUM_PRESSURE_VALUE = "VacuumPressure";
  56. private const string N2_BLANKET_PRESSURE_VALUE = "N2BlanketPressure";
  57. private const string SAMPLE_ENABLE = "SampleEnable";
  58. private const string SAMPLE_FLOW_1_ENABLE = "SampleFlow1Enable";
  59. private const string SAMPLE_FLOW_2_ENABLE = "SampleFlow2Enable";
  60. private const string SAMPLE_FLOW_3_ENABLE = "SampleFlow3Enable";
  61. private const string SAMPLE_FLOW_4_ENABLE = "SampleFlow4Enable";
  62. private const string FFU_LOADER_ERROR = "FFULoaderError";
  63. private const string FFU_PROCESS_ERROR = "FFUProcessError";
  64. private const string FFU_LOADER_PRESSURE = "FFULoaderPressure";
  65. private const string FFU_PROCESS_PRESSURE = "FFUProcessPressure";
  66. private const string ARS_FLUID_DETECT = "ArsFluidDetect";
  67. private const string PROCESS_FLUID_DETECT = "ProcessFluidDetect";
  68. private const string SAMPLE_FLUID_DETECT = "SampleFluidDetect";
  69. #endregion
  70. #region 内部常量
  71. /// </summary>
  72. /// 定时器Job
  73. /// </summary>
  74. PeriodicJob _periodicJob = null;
  75. /// <summary>
  76. /// 数据集合
  77. /// </summary>
  78. private List<CommonLimitData> _facilitiesDataList = new List<CommonLimitData>();
  79. /// <summary>
  80. /// 数据字典
  81. /// </summary>
  82. private Dictionary<string, CommonLimitData> _facilitiesDataDic = new Dictionary<string, CommonLimitData>();
  83. /// <summary>
  84. /// N2可用性
  85. /// </summary>
  86. private bool _n2Enabled = false;
  87. /// <summary>
  88. /// CDA可用性
  89. /// </summary>
  90. private bool _cdaEnable = false;
  91. /// <summary>
  92. /// External CDA可用性
  93. /// </summary>
  94. private bool _externalCDAEnable = false;
  95. /// <summary>
  96. /// DI Water 可用性
  97. /// </summary>
  98. private bool _diWaterEnable = false;
  99. /// <summary>
  100. /// House Chilled Water可用性
  101. /// </summary>
  102. private bool _houseChilledWaterEnable = false;
  103. /// <summary>
  104. /// DI Replen可用性
  105. /// </summary>
  106. private bool _diReplenEnable = false;
  107. /// <summary>
  108. /// DI Fill可用性
  109. /// </summary>
  110. private bool _diFillEnable = false;
  111. /// <summary>
  112. /// Loader Di可用性
  113. /// </summary>
  114. private bool _loaderDiEnable = false;
  115. /// <summary>
  116. /// Filter Purge可用性
  117. /// </summary>
  118. private bool _filterPurgeEnable = false;
  119. /// <summary>
  120. /// N2 Blanket 压力
  121. /// </summary>
  122. private double _n2BlaketPressure = 0;
  123. /// <summary>
  124. /// 变量是否初始化字典
  125. /// </summary>
  126. private Dictionary<string, bool> _variableInitializeDic = new Dictionary<string, bool>();
  127. #region Sample
  128. /// <summary>
  129. /// Sample Enable
  130. /// </summary>
  131. private bool _sampleEnable = false;
  132. /// <summary>
  133. /// Sample Flow 1 Enable
  134. /// </summary>
  135. private bool _sampleFlow1Enable = false;
  136. /// <summary>
  137. /// Sample Flow 2 Enable
  138. /// </summary>
  139. private bool _sampleFlow2Enable = false;
  140. /// <summary>
  141. /// Sample Flow 3 Enable
  142. /// </summary>
  143. private bool _sampleFlow3Enable = false;
  144. /// <summary>
  145. /// Sample Flow 4 Enable
  146. /// </summary>
  147. private bool _sampleFlow4Enable = false;
  148. /// <summary>
  149. /// 开始采样时间
  150. /// </summary>
  151. private DateTime _sampleStartime;
  152. /// <summary>
  153. /// 是否正在采样
  154. /// </summary>
  155. private bool _isSammpleing = false;
  156. #endregion
  157. #region FFU
  158. /// <summary>
  159. /// Loader FFU Error
  160. /// </summary>
  161. private bool _ffuLoaderError = false;
  162. /// <summary>
  163. /// Process FFU Error
  164. /// </summary>
  165. private bool _ffuProcessError = false;
  166. /// <summary>
  167. /// Loader FFU Pressure
  168. /// </summary>
  169. private double _ffuLoaderPressure;
  170. /// <summary>
  171. /// Process FFU Pressure
  172. /// </summary>
  173. private double _ffuProcessPressure;
  174. #endregion
  175. #region Fluid
  176. /// <summary>
  177. /// ARS Fluid Detect
  178. /// </summary>
  179. private bool _arsFluidDetect;
  180. /// <summary>
  181. /// Process Fluid Detect
  182. /// </summary>
  183. private bool _processFluidDetect;
  184. /// <summary>
  185. /// Sample Fluid Detect
  186. /// </summary>
  187. private bool _sampleFluidDetect;
  188. #endregion
  189. #region Counter
  190. /// <summary>
  191. ///
  192. /// </summary>
  193. private CounterFlowData _diReplenFlowCounterData = new CounterFlowData();
  194. #endregion
  195. #endregion
  196. #region 属性
  197. /// <summary>
  198. /// 冰却水可用性
  199. /// </summary>
  200. public bool HouseChilledWaterEnable { get { return _houseChilledWaterEnable; } }
  201. /// <summary>
  202. /// N2可用性
  203. /// </summary>
  204. public bool N2Enable { get { return _n2Enabled; } }
  205. /// <summary>
  206. /// CDA可用性
  207. /// </summary>
  208. public bool CDAEnable { get { return _cdaEnable; } }
  209. /// <summary>
  210. /// Loader DI 可用性
  211. /// </summary>
  212. public bool LoaderDiEnable { get { return _loaderDiEnable; } }
  213. /// <summary>
  214. /// DI Replen Enable
  215. /// </summary>
  216. public bool DIReplenEnable { get { return _diReplenEnable; } }
  217. /// <summary>
  218. /// 所有io变量是否初始化
  219. /// </summary>
  220. public bool IOInitialized { get { return AllIoVariableInitialized(); } }
  221. /// <summary>
  222. /// SampleFluidDetect
  223. /// </summary>
  224. public bool SampleFluidDetect { get { return _sampleFluidDetect; } }
  225. /// <summary>
  226. /// Di Fill Enable
  227. /// </summary>
  228. public bool DIFillEnable { get { return _diFillEnable; } }
  229. #endregion
  230. /// <summary>
  231. /// 构造函数
  232. /// </summary>
  233. public SystemFacilities() : base("System", FACILITIES, FACILITIES, FACILITIES)
  234. {
  235. }
  236. /// <summary>
  237. /// 定时器
  238. /// </summary>
  239. /// <returns></returns>
  240. private bool OnTimer()
  241. {
  242. //if (_isSammpleing)
  243. //{
  244. // int sampleAutoDisableTime = SC.GetValue<int>("Facilities.SampleAutoDisableTime");
  245. // if ((DateTime.Now - _sampleStartime).TotalSeconds >= sampleAutoDisableTime)
  246. // {
  247. // SampleDisableOperation("", null);
  248. // }
  249. //}
  250. return true;
  251. }
  252. /// <summary>
  253. /// 初始化
  254. /// </summary>
  255. /// <returns></returns>
  256. public bool Initialize()
  257. {
  258. InitialData();
  259. SubscribeValueAction();
  260. InitializeOperation();
  261. //_periodicJob = new PeriodicJob(200, OnTimer, $"{Module}.OnTimer", true);
  262. return true;
  263. }
  264. /// <summary>
  265. /// 初始化数据
  266. /// </summary>
  267. private void InitialData()
  268. {
  269. _facilitiesDataList.Add(InitialFacilitiesData(CDA_1_PRESSURE));
  270. _facilitiesDataDic[CDA_1_PRESSURE_VALUE] = _facilitiesDataList[0];
  271. _facilitiesDataList.Add(InitialFacilitiesData(CDA_2_PRESSURE));
  272. _facilitiesDataDic[CDA_2_PRESSURE_VALUE] = _facilitiesDataList[1];
  273. _facilitiesDataList.Add(InitialFacilitiesData(N2_1A_PRESSURE));
  274. _facilitiesDataDic[N2_1A_PRESSURE_VALUE] = _facilitiesDataList[2];
  275. _facilitiesDataList.Add(InitialFacilitiesData(N2_1B_PRESSURE));
  276. _facilitiesDataDic[N2_1B_PRESSURE_VALUE] = _facilitiesDataList[3];
  277. _facilitiesDataList.Add(InitialFacilitiesData(N2_2A_PRESSURE));
  278. _facilitiesDataDic[N2_2A_PRESSURE_VALUE] = _facilitiesDataList[4];
  279. _facilitiesDataList.Add(InitialFacilitiesData(N2_2B_PRESSURE));
  280. _facilitiesDataDic[N2_2B_PRESSURE_VALUE] = _facilitiesDataList[5];
  281. _facilitiesDataList.Add(InitialFacilitiesData(DI_WATER_PRESSURE));
  282. _facilitiesDataDic[DI_WATER_PRESSURE_VALUE] = _facilitiesDataList[6];
  283. _facilitiesDataList.Add(InitialFacilitiesData(HOUSE_CHILLED_WATER_FLOW));
  284. _facilitiesDataDic[HOUSE_CHILLED_WATER_PRESSURE_VALUE] = _facilitiesDataList[7];
  285. _facilitiesDataList.Add(InitialFacilitiesData(CDA_EXTERNAL_PRESSURE));
  286. _facilitiesDataDic[CDA_EXTERNAL_PRESSURE_VALUE] = _facilitiesDataList[8];
  287. _facilitiesDataList.Add(InitialFacilitiesData(VACUUM_PRESSURE));
  288. _facilitiesDataDic[VACUUM_PRESSURE_VALUE] = _facilitiesDataList[9];
  289. _facilitiesDataList.Add(InitialFacilitiesData(EXHAUST_PRESSURE));
  290. _facilitiesDataDic[EXHAUST_PRESSURE_VALUE] = _facilitiesDataList[10];
  291. DATA.Subscribe($"{Module}.{Name}.{FACILITIES_DATA}", () => _facilitiesDataList, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  292. DATA.Subscribe($"{Module}.{Name}.{N2_ENABLE}", () => _n2Enabled, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  293. DATA.Subscribe($"{Module}.{Name}.{CDA_ENABLE}", () => _cdaEnable, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  294. DATA.Subscribe($"{Module}.{Name}.{EXTERNAL_CDA_ENABLE}", () => _externalCDAEnable, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  295. DATA.Subscribe($"{Module}.{Name}.{DI_WATER_ENABLE}", () => _diWaterEnable, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  296. DATA.Subscribe($"{Module}.{Name}.{HOUSE_CHILLED_WATER_ENABLE}", () => _houseChilledWaterEnable, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  297. DATA.Subscribe($"{Module}.{Name}.{DI_FILL_ENABLE}", () => _diFillEnable, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  298. DATA.Subscribe($"{Module}.{Name}.{DI_REPLEN_ENABLE}", () => _diReplenEnable, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  299. DATA.Subscribe($"{Module}.{Name}.{LOADER_DI_ENABLE}", () => _loaderDiEnable, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  300. DATA.Subscribe($"{Module}.{Name}.{FILTER_PURGE_ENABLE}", () => _filterPurgeEnable, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  301. DATA.Subscribe($"{Module}.{Name}.{N2_BLANKET_PRESSURE_VALUE}", () => _n2BlaketPressure, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  302. DATA.Subscribe($"{Module}.{Name}.{SAMPLE_ENABLE}", () => _sampleEnable, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  303. DATA.Subscribe($"{Module}.{Name}.{SAMPLE_FLOW_1_ENABLE}", () => _sampleFlow1Enable, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  304. DATA.Subscribe($"{Module}.{Name}.{SAMPLE_FLOW_2_ENABLE}", () => _sampleFlow2Enable, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  305. DATA.Subscribe($"{Module}.{Name}.{SAMPLE_FLOW_3_ENABLE}", () => _sampleFlow3Enable, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  306. DATA.Subscribe($"{Module}.{Name}.{SAMPLE_FLOW_4_ENABLE}", () => _sampleFlow4Enable, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  307. DATA.Subscribe($"{Module}.{Name}.{FFU_LOADER_ERROR}", () => _ffuLoaderError, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  308. DATA.Subscribe($"{Module}.{Name}.{FFU_PROCESS_ERROR}", () => _ffuProcessError, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  309. DATA.Subscribe($"{Module}.{Name}.{FFU_LOADER_PRESSURE}", () => _ffuLoaderPressure, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  310. DATA.Subscribe($"{Module}.{Name}.{FFU_PROCESS_PRESSURE}", () => _ffuProcessPressure, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  311. DATA.Subscribe($"{Module}.{Name}.{ARS_FLUID_DETECT}", () => _arsFluidDetect, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  312. DATA.Subscribe($"{Module}.{Name}.{PROCESS_FLUID_DETECT}", () => _processFluidDetect, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  313. DATA.Subscribe($"{Module}.{Name}.{SAMPLE_FLUID_DETECT}", () => _sampleFluidDetect, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  314. DATA.Subscribe($"{Module}.{Name}.{CDA_1_PRESSURE_VALUE}", () => _facilitiesDataDic[CDA_1_PRESSURE_VALUE].Value, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  315. DATA.Subscribe($"{Module}.{Name}.{CDA_2_PRESSURE_VALUE}", () => _facilitiesDataDic[CDA_2_PRESSURE_VALUE].Value, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  316. DATA.Subscribe($"{Module}.{Name}.{N2_1A_PRESSURE_VALUE}", () => _facilitiesDataDic[N2_1A_PRESSURE_VALUE].Value, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  317. DATA.Subscribe($"{Module}.{Name}.{N2_1B_PRESSURE_VALUE}", () => _facilitiesDataDic[N2_1B_PRESSURE_VALUE].Value, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  318. DATA.Subscribe($"{Module}.{Name}.{N2_2A_PRESSURE_VALUE}", () => _facilitiesDataDic[N2_2A_PRESSURE_VALUE].Value, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  319. DATA.Subscribe($"{Module}.{Name}.{N2_2B_PRESSURE_VALUE}", () => _facilitiesDataDic[N2_2B_PRESSURE_VALUE].Value, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  320. DATA.Subscribe($"{Module}.{Name}.{DI_WATER_PRESSURE_VALUE}", () => _facilitiesDataDic[DI_WATER_PRESSURE_VALUE].Value, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  321. DATA.Subscribe($"{Module}.{Name}.{HOUSE_CHILLED_WATER_PRESSURE_VALUE}", () => _facilitiesDataDic[HOUSE_CHILLED_WATER_PRESSURE_VALUE].Value, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  322. DATA.Subscribe($"{Module}.{Name}.{CDA_EXTERNAL_PRESSURE_VALUE}", () => _facilitiesDataDic[CDA_EXTERNAL_PRESSURE_VALUE].Value, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  323. DATA.Subscribe($"{Module}.{Name}.{VACUUM_PRESSURE_VALUE}", () => _facilitiesDataDic[VACUUM_PRESSURE_VALUE].Value, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  324. DATA.Subscribe($"{Module}.{Name}.{EXHAUST_PRESSURE_VALUE}", () => _facilitiesDataDic[EXHAUST_PRESSURE_VALUE].Value, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  325. }
  326. /// <summary>
  327. /// 初始化Facilities数据对象
  328. /// </summary>
  329. /// <param name="name"></param>
  330. /// <returns></returns>
  331. private CommonLimitData InitialFacilitiesData(string name)
  332. {
  333. CommonLimitData facilitiesData = new CommonLimitData();
  334. facilitiesData.MaxError = SC.GetValue<double>($"{FACILITIES}.{name}.{ERROR_MAX}");
  335. facilitiesData.MinError = SC.GetValue<double>($"{FACILITIES}.{name}.{ERROR_MIN}");
  336. facilitiesData.MaxWarning = SC.GetValue<double>($"{FACILITIES}.{name}.{WARNING_MAX}");
  337. facilitiesData.MinWarning = SC.GetValue<double>($"{FACILITIES}.{name}.{WARNING_MIN}");
  338. return facilitiesData;
  339. }
  340. /// <summary>
  341. /// 订阅变量数值发生变化
  342. /// </summary>
  343. private void SubscribeValueAction()
  344. {
  345. BeckhoffIoSubscribeUpdateVariable(N2_ENABLE);
  346. BeckhoffIoSubscribeUpdateVariable(CDA_ENABLE);
  347. BeckhoffIoSubscribeUpdateVariable(EXTERNAL_CDA_ENABLE);
  348. BeckhoffIoSubscribeUpdateVariable(DI_WATER_ENABLE);
  349. BeckhoffIoSubscribeUpdateVariable(HOUSE_CHILLED_WATER_ENABLE);
  350. BeckhoffIoSubscribeUpdateVariable(DI_REPLEN_ENABLE);
  351. BeckhoffIoSubscribeUpdateVariable(DI_FILL_ENABLE);
  352. BeckhoffIoSubscribeUpdateVariable(LOADER_DI_ENABLE);
  353. BeckhoffIoSubscribeUpdateVariable(FILTER_PURGE_ENABLE);
  354. BeckhoffIoSubscribeUpdateVariable(N2_1A_PRESSURE_VALUE);
  355. BeckhoffIoSubscribeUpdateVariable(N2_1B_PRESSURE_VALUE);
  356. BeckhoffIoSubscribeUpdateVariable(N2_2A_PRESSURE_VALUE);
  357. BeckhoffIoSubscribeUpdateVariable(N2_2B_PRESSURE_VALUE);
  358. BeckhoffIoSubscribeUpdateVariable(CDA_1_PRESSURE_VALUE);
  359. BeckhoffIoSubscribeUpdateVariable(CDA_2_PRESSURE_VALUE);
  360. BeckhoffIoSubscribeUpdateVariable(CDA_EXTERNAL_PRESSURE_VALUE);
  361. BeckhoffIoSubscribeUpdateVariable(DI_WATER_PRESSURE_VALUE);
  362. BeckhoffIoSubscribeUpdateVariable(HOUSE_CHILLED_WATER_PRESSURE_VALUE);
  363. BeckhoffIoSubscribeUpdateVariable(EXHAUST_PRESSURE_VALUE);
  364. BeckhoffIoSubscribeUpdateVariable(VACUUM_PRESSURE_VALUE);
  365. BeckhoffIoSubscribeUpdateVariable(N2_BLANKET_PRESSURE_VALUE);
  366. BeckhoffIoSubscribeUpdateVariable(SAMPLE_ENABLE);
  367. BeckhoffIoSubscribeUpdateVariable(SAMPLE_FLOW_1_ENABLE);
  368. BeckhoffIoSubscribeUpdateVariable(SAMPLE_FLOW_2_ENABLE);
  369. BeckhoffIoSubscribeUpdateVariable(SAMPLE_FLOW_3_ENABLE);
  370. BeckhoffIoSubscribeUpdateVariable(SAMPLE_FLOW_4_ENABLE);
  371. BeckhoffIoSubscribeUpdateVariable(FFU_LOADER_ERROR);
  372. BeckhoffIoSubscribeUpdateVariable(FFU_PROCESS_ERROR);
  373. BeckhoffIoSubscribeUpdateVariable(FFU_LOADER_PRESSURE);
  374. BeckhoffIoSubscribeUpdateVariable(FFU_PROCESS_PRESSURE);
  375. BeckhoffIoSubscribeUpdateVariable(ARS_FLUID_DETECT);
  376. BeckhoffIoSubscribeUpdateVariable(PROCESS_FLUID_DETECT);
  377. BeckhoffIoSubscribeUpdateVariable(SAMPLE_FLUID_DETECT);
  378. }
  379. /// <summary>
  380. /// 订阅IO变量
  381. /// </summary>
  382. /// <param name="variable"></param>
  383. private void BeckhoffIoSubscribeUpdateVariable(string variable)
  384. {
  385. _variableInitializeDic[variable] = false;
  386. IOModuleManager.Instance.SubscribeModuleVariable(Name, variable, UpdateVariableValue);
  387. }
  388. /// <summary>
  389. /// 初始化操作
  390. /// </summary>
  391. private void InitializeOperation()
  392. {
  393. OP.Subscribe($"{Module}.{Name}.N2Enable", N2EnableOperation);
  394. OP.Subscribe($"{Module}.{Name}.N2Disable", N2DisableOperation);
  395. OP.Subscribe($"{Module}.{Name}.CDAEnable", CDAEnableOperation);
  396. OP.Subscribe($"{Module}.{Name}.CDADisable", CDADisableOperation);
  397. OP.Subscribe($"{Module}.{Name}.ExternalCDAEnable", ExternalCDAEnableOperation);
  398. OP.Subscribe($"{Module}.{Name}.ExternalCDADisable", ExternalCDADisableOperation);
  399. OP.Subscribe($"{Module}.{Name}.DiWaterEnable", DiWaterEnableOperation);
  400. OP.Subscribe($"{Module}.{Name}.DiWaterDisable", DiWaterDisableOperation);
  401. OP.Subscribe($"{Module}.{Name}.HouseChilledWaterEnable", HouseChilledWaterEnableOperation);
  402. OP.Subscribe($"{Module}.{Name}.HouseChilledWaterDisable", HouseChilledWaterDisableOperation);
  403. OP.Subscribe($"{Module}.{Name}.DiFillEnable", DiFillEnableOperation);
  404. OP.Subscribe($"{Module}.{Name}.DiFillDisable", DiFillDisableOperation);
  405. OP.Subscribe($"{Module}.{Name}.DiReplenEnable", DiReplenEnableOperation);
  406. OP.Subscribe($"{Module}.{Name}.DiReplenDisable", DiReplenDisableOperation);
  407. OP.Subscribe($"{Module}.{Name}.LoaderDiEnable", LoaderDiEnableOperation);
  408. OP.Subscribe($"{Module}.{Name}.LoaderDiDisable", LoaderDiDisableOperation);
  409. OP.Subscribe($"{Module}.{Name}.FilterPurgeEnable", FilterPurgeEnableOperation);
  410. OP.Subscribe($"{Module}.{Name}.FilterPurgeDisable", FilterPurgeDisableOperation);
  411. OP.Subscribe($"{Module}.{Name}.SampleEnable", SampleEnableOperation);
  412. OP.Subscribe($"{Module}.{Name}.SampleDisable", SampleDisableOperation);
  413. }
  414. /// 更新变量数值
  415. /// </summary>
  416. /// <param name="variable"></param>
  417. /// <param name="value"></param>
  418. private void UpdateVariableValue(string variable, object value)
  419. {
  420. if (_variableInitializeDic.ContainsKey(variable) && !_variableInitializeDic[variable])
  421. {
  422. _variableInitializeDic[variable] = true;
  423. }
  424. switch (variable)
  425. {
  426. case N2_ENABLE:
  427. _n2Enabled = (bool)value;
  428. break;
  429. case CDA_ENABLE:
  430. _cdaEnable = (bool)value;
  431. break;
  432. case EXTERNAL_CDA_ENABLE:
  433. _externalCDAEnable = (bool)value;
  434. break;
  435. case DI_WATER_ENABLE:
  436. _diWaterEnable = (bool)value;
  437. break;
  438. case HOUSE_CHILLED_WATER_ENABLE:
  439. _houseChilledWaterEnable = (bool)value;
  440. break;
  441. case DI_FILL_ENABLE:
  442. _diFillEnable = (bool)value;
  443. break;
  444. case DI_REPLEN_ENABLE:
  445. _diReplenEnable = (bool)value;
  446. break;
  447. case LOADER_DI_ENABLE:
  448. _loaderDiEnable = (bool)value;
  449. break;
  450. case FILTER_PURGE_ENABLE:
  451. _filterPurgeEnable = (bool)value;
  452. break;
  453. case N2_1A_PRESSURE_VALUE:
  454. case N2_2A_PRESSURE_VALUE:
  455. case N2_1B_PRESSURE_VALUE:
  456. case N2_2B_PRESSURE_VALUE:
  457. case CDA_1_PRESSURE_VALUE:
  458. case CDA_2_PRESSURE_VALUE:
  459. case CDA_EXTERNAL_PRESSURE_VALUE:
  460. case DI_WATER_PRESSURE_VALUE:
  461. case HOUSE_CHILLED_WATER_PRESSURE_VALUE:
  462. case EXHAUST_PRESSURE_VALUE:
  463. case VACUUM_PRESSURE_VALUE:
  464. _facilitiesDataDic[variable].Value = (double)value;
  465. break;
  466. case N2_BLANKET_PRESSURE_VALUE:
  467. _n2BlaketPressure = (double)value;
  468. break;
  469. case SAMPLE_ENABLE:
  470. _sampleEnable = (bool)value;
  471. break;
  472. case SAMPLE_FLOW_1_ENABLE:
  473. _sampleFlow1Enable = (bool)value;
  474. break;
  475. case SAMPLE_FLOW_2_ENABLE:
  476. _sampleFlow2Enable = (bool)value;
  477. break;
  478. case SAMPLE_FLOW_3_ENABLE:
  479. _sampleFlow3Enable = (bool)value;
  480. break;
  481. case SAMPLE_FLOW_4_ENABLE:
  482. _sampleFlow4Enable = (bool)value;
  483. break;
  484. case FFU_LOADER_ERROR:
  485. _ffuLoaderError = (bool)value;
  486. break;
  487. case FFU_PROCESS_ERROR:
  488. _ffuProcessError = (bool)value;
  489. break;
  490. case FFU_LOADER_PRESSURE:
  491. _ffuLoaderPressure = (double)value;
  492. break;
  493. case FFU_PROCESS_PRESSURE:
  494. _ffuProcessPressure = (double)value;
  495. break;
  496. case ARS_FLUID_DETECT:
  497. _arsFluidDetect = (bool)value;
  498. break;
  499. case SAMPLE_FLUID_DETECT:
  500. _sampleFluidDetect = (bool)value;
  501. if (!_sampleFluidDetect)
  502. {
  503. LOG.WriteLog(eEvent.WARN_Sensor, Module, "SampleFluidDetect is Activate");
  504. if (_sampleEnable) SampleDisableOperation("", null);
  505. if (_filterPurgeEnable) FilterPurgeDisableOperation("", null);
  506. }
  507. break;
  508. case PROCESS_FLUID_DETECT:
  509. _processFluidDetect = (bool)value;
  510. if (!_processFluidDetect)
  511. {
  512. LOG.WriteLog(eEvent.WARN_Sensor, Module, "ProcessFluidDetect is Activate");
  513. AlarmListManager.Instance.AddWarn(Module, "ProcessFluidDetect", $"ProcessFluidDetect is Activate");
  514. }
  515. break;
  516. }
  517. }
  518. /// <summary>
  519. /// 是否所有IO变量初始化完成
  520. /// </summary>
  521. /// <returns></returns>
  522. private bool AllIoVariableInitialized()
  523. {
  524. foreach (string item in _variableInitializeDic.Keys)
  525. {
  526. if (!_variableInitializeDic[item])
  527. {
  528. //LOG.WriteLog(eEvent.ERR_DRYER, Module, $"{item} is not initialized");
  529. return false;
  530. }
  531. }
  532. return true;
  533. }
  534. #region 指令
  535. /// <summary>
  536. /// N2 Enable
  537. /// </summary>
  538. /// <param name="cmd"></param>
  539. /// <param name="param"></param>
  540. /// <returns></returns>
  541. public bool N2EnableOperation(string cmd, object param)
  542. {
  543. string ioName = BeckhoffModuleIOManager.Instance.GetIoNameByInnerModuleName($"{Name}.{N2_ENABLE}");
  544. if (!string.IsNullOrEmpty(ioName))
  545. {
  546. IOModuleManager.Instance.WriteIoValue(ioName, true);
  547. }
  548. return true;
  549. }
  550. /// <summary>
  551. /// N2 Disable
  552. /// </summary>
  553. /// <param name="cmd"></param>
  554. /// <param name="param"></param>
  555. /// <returns></returns>
  556. private bool N2DisableOperation(string cmd, object param)
  557. {
  558. string ioName = BeckhoffModuleIOManager.Instance.GetIoNameByInnerModuleName($"{Name}.{N2_ENABLE}");
  559. if (!string.IsNullOrEmpty(ioName))
  560. {
  561. IOModuleManager.Instance.WriteIoValue(ioName, false);
  562. }
  563. return true;
  564. }
  565. /// <summary>
  566. /// CDA Enable
  567. /// </summary>
  568. /// <param name="cmd"></param>
  569. /// <param name="param"></param>
  570. /// <returns></returns>
  571. public bool CDAEnableOperation(string cmd, object param)
  572. {
  573. string ioName = BeckhoffModuleIOManager.Instance.GetIoNameByInnerModuleName($"{Name}.{CDA_ENABLE}");
  574. if (!string.IsNullOrEmpty(ioName))
  575. {
  576. IOModuleManager.Instance.WriteIoValue(ioName, true);
  577. }
  578. return true;
  579. }
  580. /// <summary>
  581. /// CDA Disable
  582. /// </summary>
  583. /// <param name="cmd"></param>
  584. /// <param name="param"></param>
  585. /// <returns></returns>
  586. private bool CDADisableOperation(string cmd, object param)
  587. {
  588. string ioName = BeckhoffModuleIOManager.Instance.GetIoNameByInnerModuleName($"{Name}.{CDA_ENABLE}");
  589. if (!string.IsNullOrEmpty(ioName))
  590. {
  591. IOModuleManager.Instance.WriteIoValue(ioName, false);
  592. }
  593. return true;
  594. }
  595. /// <summary>
  596. /// External CDA Enable
  597. /// </summary>
  598. /// <param name="cmd"></param>
  599. /// <param name="param"></param>
  600. /// <returns></returns>
  601. private bool ExternalCDAEnableOperation(string cmd, object param)
  602. {
  603. string ioName = BeckhoffModuleIOManager.Instance.GetIoNameByInnerModuleName($"{Name}.{EXTERNAL_CDA_ENABLE}");
  604. if (!string.IsNullOrEmpty(ioName))
  605. {
  606. IOModuleManager.Instance.WriteIoValue(ioName, true);
  607. }
  608. return true;
  609. }
  610. /// <summary>
  611. /// External CDA Disable
  612. /// </summary>
  613. /// <param name="cmd"></param>
  614. /// <param name="param"></param>
  615. /// <returns></returns>
  616. private bool ExternalCDADisableOperation(string cmd, object param)
  617. {
  618. string ioName = BeckhoffModuleIOManager.Instance.GetIoNameByInnerModuleName($"{Name}.{EXTERNAL_CDA_ENABLE}");
  619. if (!string.IsNullOrEmpty(ioName))
  620. {
  621. IOModuleManager.Instance.WriteIoValue(ioName, false);
  622. }
  623. return true;
  624. }
  625. /// <summary>
  626. /// DI Water Enable
  627. /// </summary>
  628. /// <param name="cmd"></param>
  629. /// <param name="param"></param>
  630. /// <returns></returns>
  631. private bool DiWaterEnableOperation(string cmd, object param)
  632. {
  633. string ioName = BeckhoffModuleIOManager.Instance.GetIoNameByInnerModuleName($"{Name}.{DI_WATER_ENABLE}");
  634. if (!string.IsNullOrEmpty(ioName))
  635. {
  636. IOModuleManager.Instance.WriteIoValue(ioName, true);
  637. }
  638. return true;
  639. }
  640. /// <summary>
  641. /// DI Water Disable
  642. /// </summary>
  643. /// <param name="cmd"></param>
  644. /// <param name="param"></param>
  645. /// <returns></returns>
  646. private bool DiWaterDisableOperation(string cmd, object param)
  647. {
  648. string ioName = BeckhoffModuleIOManager.Instance.GetIoNameByInnerModuleName($"{Name}.{DI_WATER_ENABLE}");
  649. if (!string.IsNullOrEmpty(ioName))
  650. {
  651. IOModuleManager.Instance.WriteIoValue(ioName, false);
  652. }
  653. return true;
  654. }
  655. /// <summary>
  656. /// House Chilled Water Enable
  657. /// </summary>
  658. /// <param name="cmd"></param>
  659. /// <param name="param"></param>
  660. /// <returns></returns>
  661. private bool HouseChilledWaterEnableOperation(string cmd, object param)
  662. {
  663. string ioName = BeckhoffModuleIOManager.Instance.GetIoNameByInnerModuleName($"{Name}.{HOUSE_CHILLED_WATER_ENABLE}");
  664. if (!string.IsNullOrEmpty(ioName))
  665. {
  666. IOModuleManager.Instance.WriteIoValue(ioName, true);
  667. }
  668. return true;
  669. }
  670. /// <summary>
  671. /// House Chilled Water Disable
  672. /// </summary>
  673. /// <param name="cmd"></param>
  674. /// <param name="param"></param>
  675. /// <returns></returns>
  676. private bool HouseChilledWaterDisableOperation(string cmd, object param)
  677. {
  678. string ioName = BeckhoffModuleIOManager.Instance.GetIoNameByInnerModuleName($"{Name}.{HOUSE_CHILLED_WATER_ENABLE}");
  679. if (!string.IsNullOrEmpty(ioName))
  680. {
  681. IOModuleManager.Instance.WriteIoValue(ioName, false);
  682. }
  683. return true;
  684. }
  685. /// <summary>
  686. /// DI Fill Enable
  687. /// </summary>
  688. /// <param name="cmd"></param>
  689. /// <param name="param"></param>
  690. /// <returns></returns>
  691. private bool DiFillEnableOperation(string cmd, object param)
  692. {
  693. string ioName = BeckhoffModuleIOManager.Instance.GetIoNameByInnerModuleName($"{Name}.{DI_FILL_ENABLE}");
  694. if (!string.IsNullOrEmpty(ioName))
  695. {
  696. IOModuleManager.Instance.WriteIoValue(ioName, true);
  697. }
  698. return true;
  699. }
  700. /// <summary>
  701. /// Di Fill Disable
  702. /// </summary>
  703. /// <param name="cmd"></param>
  704. /// <param name="param"></param>
  705. /// <returns></returns>
  706. public bool DiFillDisableOperation(string cmd, object param)
  707. {
  708. string ioName = BeckhoffModuleIOManager.Instance.GetIoNameByInnerModuleName($"{Name}.{DI_FILL_ENABLE}");
  709. if (!string.IsNullOrEmpty(ioName))
  710. {
  711. IOModuleManager.Instance.WriteIoValue(ioName, false);
  712. }
  713. return true;
  714. }
  715. /// <summary>
  716. /// DI Replen Enable
  717. /// </summary>
  718. /// <param name="cmd"></param>
  719. /// <param name="param"></param>
  720. /// <returns></returns>
  721. private bool DiReplenEnableOperation(string cmd, object param)
  722. {
  723. string ioName = BeckhoffModuleIOManager.Instance.GetIoNameByInnerModuleName($"{Name}.{DI_REPLEN_ENABLE}");
  724. if (!string.IsNullOrEmpty(ioName))
  725. {
  726. IOModuleManager.Instance.WriteIoValue(ioName, true);
  727. }
  728. return true;
  729. }
  730. /// <summary>
  731. /// DI Replen Disable
  732. /// </summary>
  733. /// <param name="cmd"></param>
  734. /// <param name="param"></param>
  735. /// <returns></returns>
  736. public bool DiReplenDisableOperation(string cmd, object param)
  737. {
  738. string ioName = BeckhoffModuleIOManager.Instance.GetIoNameByInnerModuleName($"{Name}.{DI_REPLEN_ENABLE}");
  739. if (!string.IsNullOrEmpty(ioName))
  740. {
  741. IOModuleManager.Instance.WriteIoValue(ioName, false);
  742. }
  743. return true;
  744. }
  745. /// <summary>
  746. /// Loader DI Enable
  747. /// </summary>
  748. /// <param name="cmd"></param>
  749. /// <param name="param"></param>
  750. /// <returns></returns>
  751. private bool LoaderDiEnableOperation(string cmd, object param)
  752. {
  753. string ioName = BeckhoffModuleIOManager.Instance.GetIoNameByInnerModuleName($"{Name}.{LOADER_DI_ENABLE}");
  754. if (!string.IsNullOrEmpty(ioName))
  755. {
  756. IOModuleManager.Instance.WriteIoValue(ioName, true);
  757. }
  758. return true;
  759. }
  760. /// <summary>
  761. /// Loader DI Disable
  762. /// </summary>
  763. /// <param name="cmd"></param>
  764. /// <param name="param"></param>
  765. /// <returns></returns>
  766. private bool LoaderDiDisableOperation(string cmd, object param)
  767. {
  768. string ioName = BeckhoffModuleIOManager.Instance.GetIoNameByInnerModuleName($"{Name}.{LOADER_DI_ENABLE}");
  769. if (!string.IsNullOrEmpty(ioName))
  770. {
  771. IOModuleManager.Instance.WriteIoValue(ioName, false);
  772. }
  773. return true;
  774. }
  775. /// <summary>
  776. /// Filter Purge Enable
  777. /// </summary>
  778. /// <param name="cmd"></param>
  779. /// <param name="param"></param>
  780. /// <returns></returns>
  781. private bool FilterPurgeEnableOperation(string cmd, object param)
  782. {
  783. string ioName = BeckhoffModuleIOManager.Instance.GetIoNameByInnerModuleName($"{Name}.{FILTER_PURGE_ENABLE}");
  784. if (!string.IsNullOrEmpty(ioName))
  785. {
  786. IOModuleManager.Instance.WriteIoValue(ioName, true);
  787. }
  788. return true;
  789. }
  790. /// <summary>
  791. /// Filter Purge Disable
  792. /// </summary>
  793. /// <param name="cmd"></param>
  794. /// <param name="param"></param>
  795. /// <returns></returns>
  796. private bool FilterPurgeDisableOperation(string cmd, object param)
  797. {
  798. string ioName = BeckhoffModuleIOManager.Instance.GetIoNameByInnerModuleName($"{Name}.{FILTER_PURGE_ENABLE}");
  799. if (!string.IsNullOrEmpty(ioName))
  800. {
  801. IOModuleManager.Instance.WriteIoValue(ioName, false);
  802. }
  803. return true;
  804. }
  805. /// <summary>
  806. /// Sample Enable
  807. /// </summary>
  808. /// <param name="cmd"></param>
  809. /// <param name="param"></param>
  810. /// <returns></returns>
  811. private bool SampleEnableOperation(string cmd, object param)
  812. {
  813. _isSammpleing = true;
  814. _sampleStartime = DateTime.Now;
  815. SampeOperation(true);
  816. return true;
  817. }
  818. /// <summary>
  819. /// Sample Disable
  820. /// </summary>
  821. /// <param name="cmd"></param>
  822. /// <param name="param"></param>
  823. /// <returns></returns>
  824. public bool SampleDisableOperation(string cmd, object param)
  825. {
  826. _isSammpleing = false;
  827. SampeOperation(false);
  828. return true;
  829. }
  830. /// <summary>
  831. /// Sample操作
  832. /// </summary>
  833. /// <param name="enable"></param>
  834. private void SampeOperation(bool enable)
  835. {
  836. string ioName = BeckhoffModuleIOManager.Instance.GetIoNameByInnerModuleName($"{Name}.{SAMPLE_ENABLE}");
  837. if (!string.IsNullOrEmpty(ioName))
  838. {
  839. IOModuleManager.Instance.WriteIoValue(ioName, enable);
  840. }
  841. string sampleFlow1Name = BeckhoffModuleIOManager.Instance.GetIoNameByInnerModuleName($"{Name}.{SAMPLE_FLOW_1_ENABLE}");
  842. if (!string.IsNullOrEmpty(sampleFlow1Name))
  843. {
  844. IOModuleManager.Instance.WriteIoValue(sampleFlow1Name, enable);
  845. }
  846. string sampleFlow2Name = BeckhoffModuleIOManager.Instance.GetIoNameByInnerModuleName($"{Name}.{SAMPLE_FLOW_2_ENABLE}");
  847. if (!string.IsNullOrEmpty(sampleFlow2Name))
  848. {
  849. IOModuleManager.Instance.WriteIoValue(sampleFlow2Name, enable);
  850. }
  851. string sampleFlow3Name = BeckhoffModuleIOManager.Instance.GetIoNameByInnerModuleName($"{Name}.{SAMPLE_FLOW_3_ENABLE}");
  852. if (!string.IsNullOrEmpty(sampleFlow3Name))
  853. {
  854. IOModuleManager.Instance.WriteIoValue(sampleFlow3Name, enable);
  855. }
  856. string sampleFlow4Name = BeckhoffModuleIOManager.Instance.GetIoNameByInnerModuleName($"{Name}.{SAMPLE_FLOW_4_ENABLE}");
  857. if (!string.IsNullOrEmpty(sampleFlow4Name))
  858. {
  859. IOModuleManager.Instance.WriteIoValue(sampleFlow4Name, enable);
  860. }
  861. }
  862. #endregion
  863. /// <summary>
  864. /// 检验Exhaust
  865. /// </summary>
  866. /// <returns></returns>
  867. public (bool result, string reason) CheckExhaustResult()
  868. {
  869. return CheckPressureData(EXHAUST_PRESSURE_VALUE);
  870. }
  871. /// <summary>
  872. /// 检验Exhaust
  873. /// </summary>
  874. /// <returns></returns>
  875. public (bool result, string reason) CheckHouseChilledWaterResult()
  876. {
  877. return CheckPressureData(HOUSE_CHILLED_WATER_PRESSURE_VALUE);
  878. }
  879. /// <summary>
  880. /// 检验CDA
  881. /// </summary>
  882. /// <returns></returns>
  883. public (bool result, string reason) CheckCDA()
  884. {
  885. if (!CDAEnable)
  886. {
  887. return (false, "CDA is disable");
  888. }
  889. else
  890. {
  891. var cda1Result = CheckPressureData(CDA_1_PRESSURE_VALUE);
  892. if (!cda1Result.result)
  893. {
  894. return cda1Result;
  895. }
  896. var cda2Result = CheckPressureData(CDA_2_PRESSURE_VALUE);
  897. if (!cda2Result.result)
  898. {
  899. return cda2Result;
  900. }
  901. }
  902. return (true, "");
  903. }
  904. /// <summary>
  905. /// 检验CDA和N2
  906. /// </summary>
  907. /// <returns></returns>
  908. public (bool result, string reason) CheckCDAN2()
  909. {
  910. if (!CDAEnable)
  911. {
  912. return (false, "CDA is disable");
  913. }
  914. else
  915. {
  916. var cda1Result = CheckPressureData(CDA_1_PRESSURE_VALUE);
  917. if (!cda1Result.result)
  918. {
  919. return cda1Result;
  920. }
  921. var cda2Result = CheckPressureData(CDA_2_PRESSURE_VALUE);
  922. if (!cda2Result.result)
  923. {
  924. return cda2Result;
  925. }
  926. }
  927. if (!N2Enable)
  928. {
  929. return (false, "N2 is disable");
  930. }
  931. else
  932. {
  933. var n21AResult = CheckPressureData(N2_1A_PRESSURE_VALUE);
  934. if (!n21AResult.result)
  935. {
  936. return n21AResult;
  937. }
  938. var n21BResult = CheckPressureData(N2_1B_PRESSURE_VALUE);
  939. if (!n21BResult.result)
  940. {
  941. return n21BResult;
  942. }
  943. var n22AResult = CheckPressureData(N2_2A_PRESSURE_VALUE);
  944. if (!n22AResult.result)
  945. {
  946. return n22AResult;
  947. }
  948. var n22BResult = CheckPressureData(N2_2B_PRESSURE_VALUE);
  949. if (!n22BResult.result)
  950. {
  951. return n22BResult;
  952. }
  953. }
  954. return (true, "");
  955. }
  956. /// <summary>
  957. /// 检验CDA N2以及Vacuum状态
  958. /// </summary>
  959. /// <returns></returns>
  960. public (bool result, string reason) CheckCDAN2AndVacuum()
  961. {
  962. if (!CDAEnable)
  963. {
  964. return (false, "CDA is disable");
  965. }
  966. else
  967. {
  968. var cda1Result = CheckPressureData(CDA_1_PRESSURE_VALUE);
  969. if (!cda1Result.result)
  970. {
  971. return cda1Result;
  972. }
  973. var cda2Result = CheckPressureData(CDA_2_PRESSURE_VALUE);
  974. if (!cda2Result.result)
  975. {
  976. return cda2Result;
  977. }
  978. }
  979. if (!N2Enable)
  980. {
  981. return (false, "N2 is disable");
  982. }
  983. else
  984. {
  985. var n21AResult = CheckPressureData(N2_1A_PRESSURE_VALUE);
  986. if (!n21AResult.result)
  987. {
  988. return n21AResult;
  989. }
  990. var n21BResult = CheckPressureData(N2_1B_PRESSURE_VALUE);
  991. if (!n21BResult.result)
  992. {
  993. return n21BResult;
  994. }
  995. var n22AResult = CheckPressureData(N2_2A_PRESSURE_VALUE);
  996. if (!n22AResult.result)
  997. {
  998. return n22AResult;
  999. }
  1000. var n22BResult = CheckPressureData(N2_2B_PRESSURE_VALUE);
  1001. if (!n22BResult.result)
  1002. {
  1003. return n22BResult;
  1004. }
  1005. var vacuumResult = CheckPressureData(VACUUM_PRESSURE_VALUE);
  1006. if (!vacuumResult.result)
  1007. {
  1008. return vacuumResult;
  1009. }
  1010. }
  1011. return (true, "");
  1012. }
  1013. /// <summary>
  1014. /// 检验压力
  1015. /// </summary>
  1016. /// <param name="pressureName"></param>
  1017. /// <returns></returns>
  1018. private (bool result, string reason) CheckPressureData(string pressureName)
  1019. {
  1020. if (_facilitiesDataDic.ContainsKey(pressureName))
  1021. {
  1022. CommonLimitData facilitiesData = _facilitiesDataDic[(pressureName)];
  1023. if (facilitiesData.IsError)
  1024. {
  1025. return (false, $"{pressureName} data {facilitiesData.Value} is error value");
  1026. }
  1027. else if (facilitiesData.IsWarning)
  1028. {
  1029. return (true, $"{pressureName} data {facilitiesData.Value} is warning");
  1030. }
  1031. else
  1032. {
  1033. return (true, "");
  1034. }
  1035. }
  1036. else
  1037. {
  1038. return (false, $"{pressureName} not in dictionary");
  1039. }
  1040. }
  1041. /// <summary>
  1042. /// 获取Common Limit 数据
  1043. /// </summary>
  1044. /// <param name="name"></param>
  1045. /// <returns></returns>
  1046. public CommonLimitData GetCommonLimitDataByName(string name)
  1047. {
  1048. return _facilitiesDataDic.ContainsKey(name) ? _facilitiesDataDic[name] : null;
  1049. }
  1050. #region IDevice接口
  1051. public void Monitor()
  1052. {
  1053. }
  1054. public void Reset()
  1055. {
  1056. }
  1057. public void Terminate()
  1058. {
  1059. }
  1060. #endregion
  1061. }
  1062. }