123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- using System;
- using System.Xml;
- using Aitex.Core.RT.Device;
- using Aitex.Core.RT.Device.Unit;
- using Aitex.Core.RT.OperationCenter;
- using VirgoRT.Devices.IODevices;
- namespace VirgoRT.Devices
- {
- class IoGasStick : BaseDevice, IDevice
- {
- private readonly IoValve _DownValve;
- private 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);
- _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 _);
- //this.FlowSP = setpoint;
- }
- else
- {
- _DownValve.TurnValve(false, out _);
- }
- _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);
- }
- }
- }
|