123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Runtime.Serialization;
- using System.Text;
- using System.Threading.Tasks;
- using Aitex.Core.Common.DeviceData;
- using Aitex.Core.RT.DataCenter;
- using Aitex.Core.RT.Device;
- using Aitex.Core.RT.Event;
- using Aitex.Core.RT.OperationCenter;
- namespace MECF.Framework.Common.Device.Bases
- {
- public abstract class RfPowerBase : BaseDevice, IDevice
- {
- public virtual bool IsPowerOn { get; set; }
- public virtual bool IsError { get; set; }
- public virtual EnumRfPowerWorkMode WorkMode { get; set; }
- public virtual EnumRfPowerControlMode ControlMode { get; set; }
- public virtual EnumRfPowerRegulationMode RegulationMode { get; set; }
- public virtual float ForwardPower { get; set; }
- public virtual float ReflectPower { get; set; }
- public virtual float PowerSetPoint { get; set; }
- public virtual float Frequency { get; set; }
- public virtual float PulsingFrequency { get; set; }
- public virtual float PulsingDutyCycle { get; set; }
- public virtual AITRfPowerData DeviceData { get; set; }
- protected RfPowerBase( ) : base( )
- {
- }
- protected RfPowerBase(string module, string name) : base(module, name, name, name)
- {
- }
- public virtual bool Initialize()
- {
- DATA.Subscribe($"{Module}.{Name}.WorkMode", ()=>WorkMode.ToString());
- DATA.Subscribe($"{Module}.{Name}.ControlMode", ()=> ControlMode.ToString());
- DATA.Subscribe($"{Module}.{Name}.RegulationMode", () => RegulationMode.ToString());
- DATA.Subscribe($"{Module}.{Name}.ForwardPower", () => ForwardPower);
- DATA.Subscribe($"{Module}.{Name}.ReflectPower", () => ReflectPower);
- DATA.Subscribe($"{Module}.{Name}.PowerSetPoint", () => PowerSetPoint);
- DATA.Subscribe($"{Module}.{Name}.Frequency", () => Frequency);
- DATA.Subscribe($"{Module}.{Name}.PulsingFrequency", () => PulsingFrequency);
- DATA.Subscribe($"{Module}.{Name}.PulsingDutyCycle", () => PulsingDutyCycle);
- OP.Subscribe($"{Module}.{Name}.SetPowerOn", (function, args) =>
- {
- return SetPowerOnOff(true, out string reason);
- });
- OP.Subscribe($"{Module}.{Name}.SetPowerOff", (function, args) =>
- {
- return SetPowerOnOff(false, out string reason);
- });
- OP.Subscribe($"{Module}.{Name}.SetPower", (function, args) =>
- {
- SetPower((float)args[0]);
- return true;
- });
- OP.Subscribe($"{Module}.{Name}.SetRegulationMode", (function, args) =>
- {
- if (!Enum.TryParse((string) args[0], out EnumRfPowerRegulationMode mode))
- {
- EV.PostWarningLog(Module, $"Argument {args[0]}not valid");
- return false;
- }
- SetRegulationMode(mode);
- return true;
- });
- return true;
- }
- public virtual void SetRegulationMode(EnumRfPowerRegulationMode enumRfPowerControlMode)
- {
-
- }
- public virtual bool SetPowerOnOff(bool isOn, out string reason)
- {
- reason = string.Empty;
- return true;
- }
- public virtual void SetPower(float power)
- {
-
- }
- public virtual void Terminate()
- {
- }
- public virtual void Monitor()
- {
- }
- public virtual void Reset()
- {
- }
- public virtual void SetCommunicationMode(int mode) { }
- }
- }
|