| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 | using System;using System.Security.Cryptography;using System.Xml;using Aitex.Core.RT.Device;using Aitex.Core.RT.Device.Unit;using Aitex.Core.RT.OperationCenter;using Venus_RT.Devices.IODevices;namespace Venus_RT.Devices{    class IoGasStick : BaseDevice, IDevice    {        private readonly IoValve _DownValve;        private readonly IoValve _UpValve;        public readonly MfcBase1 _mfc;        // Properties        //        public double FlowSP        {            get => _mfc.SetPoint;            //set => _mfc.SetPoint = value;        }        public bool IsOutOfRange => _mfc.IsOutOfTolerance;        // Constructor        //        public IoGasStick(string module, XmlElement node, string ioModule = "")        {            base.Module   = module;            base.Name     = node.GetAttribute("id");            base.Display  = node.GetAttribute("display");            base.DeviceID = node.GetAttribute("schematicId");            _DownValve    = ParseDeviceNode<IoValve>(Module, "downvalve", node);            _UpValve = ParseDeviceNode<IoValve>(Module, "upvalve", node);            _mfc          = ParseDeviceNode<MfcBase1>(Module, "mfc", node);        }        public bool Initialize()        {            OP.Subscribe($"{Module}.{_mfc.Name}", (out string reason, int time, object[] para) =>            {                reason = "";                double sp = Convert.ToDouble((string)para[0]);                Flow(sp);                return true;            });            return true;        }        public void Flow(double setpoint)        {            if (setpoint >= 0.01)            {                _DownValve.TurnValve(true, out _);                _UpValve?.TurnValve(true, out _);            }            else            {                _DownValve.TurnValve(false, out _);                _UpValve?.TurnValve(false, out _);            }            _mfc.SetPoint = setpoint;            //_mfc.Ramp(setpoint, 1000);        }        public void Monitor()        {            _DownValve.Monitor();            _mfc.Monitor();        }        public void Terminate()        {        }        public void Reset()        {        }        public void Stop()        {            _DownValve.TurnValve(false, out _);            //_mfc.Ramp(0, 1000);            _mfc.SetPoint = 0;        }    }}
 |