123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166 |
- using System;
- using System.Xml;
- using Aitex.Core.Common.DeviceData;
- using Aitex.Core.RT.DataCenter;
- using Aitex.Core.RT.Device;
- using Aitex.Core.RT.Event;
- using Aitex.Core.RT.IOCore;
- using Aitex.Core.RT.Log;
- using Aitex.Core.RT.OperationCenter;
- using Aitex.Core.Util;
- using MECF.Framework.Common.Event;
- using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Pumps;
- namespace FurnaceRT.Equipments.Systems
- {
- public class IoPump3 : BaseDevice, IDevice
- {
-
-
-
- private DIAccessor _diPowerOn;
- private DOAccessor _doPowerOn;
- public IoPump3(string module, XmlElement node, string ioModule = "")
- {
- var attrModule = node.GetAttribute("module");
- base.Module = string.IsNullOrEmpty(attrModule) ? module : attrModule;
- base.Name = node.GetAttribute("id");
- base.Display = node.GetAttribute("display");
- base.DeviceID = node.GetAttribute("schematicId");
-
- _diPowerOn = ParseDiNode("diPowerOn", node, ioModule);
-
- _doPowerOn = ParseDoNode("doPowerOn", node, ioModule);
- }
- public bool Initialize()
- {
- DATA.Subscribe($"{Module}.{Name}.IsPumpRunning", () => _diPowerOn.Value);
- OP.Subscribe($"{Module}.{Name}.{AITPumpOperation.SetOnOff}" , SetPumpOnOff);
- OP.Subscribe($"{Module}.{Name}.{AITPumpOperation.PumpOn}", SetPumpOn);
- OP.Subscribe($"{Module}.{Name}.{AITPumpOperation.PumpOff}", SetPumpOff);
-
- return true;
- }
- private bool SetPumpOn(out string reason, int time, object[] param)
- {
- return SetPump(out reason, time, true);
- }
- private bool SetPumpOff(out string reason, int time, object[] param)
- {
- return SetPump(out reason, time, false);
- }
- private bool SetPumpOnOff(out string reason, int time, object[] param)
- {
- return SetPump(out reason, time, Convert.ToBoolean((string)param[0]));
- }
- public bool SetPump(out string reason, int time, bool isOn)
- {
- reason = "";
- if (isOn)
- {
-
- }
- _doPowerOn.Value = isOn;
- return true;
- }
- public bool SetMainPowerOnOff(bool isOn, out string reason)
- {
- reason = string.Empty;
- return true;
- }
- public void Terminate()
- {
- }
-
- public void Monitor()
- {
- try
- {
- //_trigWarning.CLK = IsWarning;
- //if (_trigWarning.Q)
- //{
- // PumpWarning.Set();
- //}
- //_trigError.CLK = IsError;
- //if (_trigError.Q)
- //{
- // PumpError.Set();
- // if (_doPowerOn != null && _doPowerOn.Value)
- // {
- // _doPowerOn.Value = false;
- // EV.PostInfoLog(Module, $"set {Name} power off");
- // }
- // if (_doStart != null && _doStart.Value)
- // {
- // _doStart.Value = false;
- // EV.PostInfoLog(Module, $"set {Name} off");
- // }
- //}
- //_trigOverload.CLK = IsPumpOverloadAlarm;
- //if (_trigOverload.Q)
- //{
- // PumpOverload.Set();
- // if (_doPowerOn != null && _doPowerOn.Value)
- // {
- // _doPowerOn.Value = false;
- // EV.PostInfoLog(Module, $"set {Name} power off");
- // }
- // if (_doStart != null && _doStart.Value)
- // {
- // _doStart.Value = false;
- // EV.PostInfoLog(Module, $"set {Name} off");
- // }
- //}
- //_trigN2OK.CLK = !IsN2OK;
- //if (_trigN2OK.Q)
- //{
- // PumpN2NotOK.Set();
- //}
- //_trigExhaustPressureOK.CLK = !IsExhaustPressureOK;
- //if (_trigExhaustPressureOK.Q)
- //{
- // PumpExhaustPressureNotOK.Set();
- //}
- }
- catch (Exception ex)
- {
- LOG.Write(ex);
- }
- }
- public void Reset()
- {
-
- }
- }
- }
|