123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Net.Configuration;
- using System.Text;
- using System.Threading.Tasks;
- 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.OperationCenter;
- using Aitex.Core.RT.SCCore;
- using Aitex.Core.Util;
- namespace MECF.Framework.Common.Device.Bases
- {
- public abstract class ThrottleValveBase : BaseDevice, IDevice
- {
- public virtual PressureCtrlMode Mode { get; set; }
-
- public virtual float PositionFeedback { get; set; }
-
- public virtual float PressureFeedback { get; set; }
-
- public virtual float PressureSetPoint { get; set; }
-
- public virtual float PositionSetPoint { get; set; }
- public virtual AITThrottleValveData DeviceData { get; set; }
- public uint MaxValuePressure = 100;
- public float PressureParam = 0.1f;
- public uint MaxValuePosi = 5000;
- public float PosiParam = 0.1f;
- protected ThrottleValveBase() : base()
- {
- }
- protected ThrottleValveBase(string module, string name) : base(module, name, name, name)
- {
- }
- public virtual bool Initialize()
- {
- DATA.Subscribe($"{Module}.{Name}.DeviceData", () => DeviceData);
- DATA.Subscribe($"{Module}.{Name}.ControlMode", () => (int)Mode);
- DATA.Subscribe($"{Module}.{Name}.PositionFeedback", () => PositionFeedback);
- DATA.Subscribe($"{Module}.{Name}.PressureFeedback", () => PressureFeedback);
- DATA.Subscribe($"{Module}.{Name}.PositionSetPoint", () => PositionSetPoint);
- DATA.Subscribe($"{Module}.{Name}.PressureSetPoint", () => PressureSetPoint);
- OP.Subscribe($"{Module}.{Name}.SetPressure", (function, args) =>
- {
- SetPressure((float)args[0]);
- return true;
- });
- OP.Subscribe($"{Module}.{Name}.SetPosition", (function, args) =>
- {
- SetPosition((float)args[0]);
- return true;
- });
- OP.Subscribe($"{Module}.{Name}.SetOpen", (function, args) =>
- {
- SetOpen( );
- return true;
- });
- OP.Subscribe($"{Module}.{Name}.SetClose", (function, args) =>
- {
- SetClose( );
- return true;
- });
- OP.Subscribe($"{Module}.{Name}.SetMode", (function, args) =>
- {
- if (!Enum.TryParse((string)args[0], out PressureCtrlMode mode))
- {
- EV.PostWarningLog(Module, $"Argument {args[0]}not valid");
- return false;
- }
- SetControlMode(mode);
- return true;
- });
-
- return true;
- }
- public virtual void SetClose()
- {
- throw new NotImplementedException();
- }
- public virtual void SetOpen()
- {
- throw new NotImplementedException();
- }
- public virtual void SetControlMode(PressureCtrlMode mode)
- {
-
- }
- public virtual void SetPressure(float isOn)
- {
-
- }
- public virtual void SetPosition(float position)
- {
- }
- public virtual void Terminate()
- {
- }
- public virtual void Monitor()
- {
- }
- public virtual void Reset()
- {
- }
- }
- }
|