123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- 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 Pump()
- {
- _UpValve?.TurnValve(true, out _);
- _mfc.SetPoint = _mfc.Scale;
- }
- public void Monitor()
- {
- _DownValve.Monitor();
- if (_mfc.Name == "MfcN2" && _DownValve?.Status==false)
- {
- return;
- }
- _mfc.Monitor();
- }
- public void Terminate()
- {
- }
- public void Reset()
- {
- }
- public void Stop()
- {
- _DownValve.TurnValve(false, out _);
- _UpValve?.TurnValve(false, out _);
- //_mfc.Ramp(0, 1000);
- _mfc.SetPoint = 0;
- }
- }
- }
|