| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148 | 
							- using System;
 
- using System.Xml;
 
- using Aitex.Core.Common.DeviceData;
 
- using Aitex.Core.RT.DataCenter;
 
- using Aitex.Core.RT.Device;
 
- using Aitex.Core.RT.IOCore;
 
- using Aitex.Core.RT.OperationCenter;
 
- using Aitex.Core.RT.SCCore;
 
- using Aitex.Core.Util;
 
- using MECF.Framework.Common.Device.Bases;
 
- namespace VirgoRT.Devices.IODevices
 
- {
 
-     class IoMatch : RfMatchBase
 
-     {
 
-         // ----------------------------Fields--------------------------
 
-         //
 
-         //private AOAccessor              _aoMatchMode;
 
-         private readonly AOAccessor       _aoMatchPositionC1;
 
-         private readonly AOAccessor       _aoMatchPositionC2;
 
-         private AIAccessor                _aiMatchPresetMode;
 
-         private AIAccessor                _aiMatchMode;
 
-         private readonly AIAccessor       _aiMatchPositionC1;
 
-         private readonly AIAccessor       _aiMatchPositionC2;
 
-         private AOAccessor                _aoMatchPresetMode;
 
-         //SC
 
-         private int                       _scMatchPresetMode;
 
-         private int                       _scMatchMode;
 
-         private readonly SCConfigItem     _scMatchPositionC1;
 
-         private readonly SCConfigItem     _scMatchPositionC2;
 
-         private readonly bool             _scEnableC1C2Position;
 
-         // --------------------------Properties------------------------
 
-         //
 
-         public bool EnableC1C2Position => _scEnableC1C2Position;
 
-         public override AITRfMatchData DeviceData { get {
 
-             return new AITRfMatchData
 
-             {
 
-                 //EnableC1C2Position = EnableC1C2Position,
 
-                 //WorkMode = (int)WorkMode,
 
-                 //MatchPositionC1 = MatchPositionC1,
 
-                 //MatchPositionC2 = MatchPositionC2,
 
-                 //MatchPositionC1SetPoint = MatchPositionC1,
 
-                 //MatchPositionC2SetPoint = MatchPositionC2,
 
-             };
 
-             }
 
-         }
 
-         // --------------------------Constructor-----------------------
 
-         //
 
-         public IoMatch(string module, XmlElement node, string ioModule = "")
 
-         {
 
-             _aiMatchPresetMode        = ParseAiNode("aiMatchPresetMode", node, ioModule);
 
-             _aiMatchMode              = ParseAiNode("aiMatchMode", node, ioModule);
 
-             _aiMatchPositionC1        = ParseAiNode("aiMatchPositionC1", node, ioModule);
 
-             _aiMatchPositionC2        = ParseAiNode("aiMatchPositionC2", node, ioModule);
 
-             _aoMatchPresetMode        = ParseAoNode("aoMatchPresetMode", node, ioModule);
 
-             //_aoMatchMode            = ParseAoNode("aoMatchMode", node);
 
-             _aoMatchPositionC1        = ParseAoNode("aoMatchPositionC1", node);
 
-             _aoMatchPositionC2        = ParseAoNode("aoMatchPositionC2", node);
 
-             _scMatchPresetMode = ParseScNode("scMatchPresetMode", node).IntValue;
 
-             _scMatchMode              = SC.GetValue<int>($"{Module}.{Name}.MatchMode");
 
-             _scMatchPositionC1        = SC.GetConfigItem($"{Module}.{Name}.MatchPositionC1");
 
-             _scMatchPositionC2        = SC.GetConfigItem($"{Module}.{Name}.MatchPositionC2");
 
-             _scEnableC1C2Position     = SC.GetValue<bool>($"{Module}.{Name}.EnableC1C2Position");
 
-         }
 
-         // -----------------------------Method-------------------------
 
-         //
 
-         public override bool Initialize()
 
-         {
 
-             DEVICE.Register($"{Module}.{Name}.{AITRfMatchOperation.SetMatchPositionC1}", _setMatchC1);
 
-             DEVICE.Register($"{Module}.{Name}.{AITRfMatchOperation.SetMatchPositionC2}", _setMatchC2);
 
-             OP.Subscribe($"{Module}.{Name}.{AITRfMatchOperation.SetMatchPositionC1}", (out string reason, int time, object[] param) =>
 
-             {
 
-                 _setMatchC1(out reason, 0, param);
 
-                 return true;
 
-             });
 
-             OP.Subscribe($"{Module}.{Name}.{AITRfMatchOperation.SetMatchPositionC2}", (out string reason, int time, object[] param) =>
 
-             {
 
-                 _setMatchC2(out reason, 0, param);
 
-                 return true;
 
-             });
 
-             return true;
 
-         }
 
-         public override void Monitor()
 
-         {
 
-             throw new NotImplementedException();
 
-         }
 
-         public override void Terminate()
 
-         {
 
-             throw new NotImplementedException();
 
-         }
 
-         public override void Reset()
 
-         {
 
-             throw new NotImplementedException();
 
-         }
 
-         private bool? _setMatchC1(out string reason, int time, object[] param)
 
-         {
 
-             if (null == _aoMatchPositionC1)
 
-             {
 
-                 reason = "No Match C1 IO setting";
 
-                 return false;
 
-             }
 
-             else
 
-             {
 
-                 double c1 = Convert.ToDouble((string)param[0]);
 
-                 c1 = Math.Max(double.Parse(_scMatchPositionC1.Min), c1);
 
-                 c1 = Math.Min(double.Parse(_scMatchPositionC1.Max), c1);
 
-                 _aoMatchPositionC1.Value = (short)c1;
 
-                 reason = $"Set RF match position c1 :{c1}";
 
-                 return true;
 
-             }
 
-         }
 
-         private bool? _setMatchC2(out string reason, int time, object[] param)
 
-         {
 
-             if (null == _aoMatchPositionC1)
 
-             {
 
-                 reason = "No Match C2 IO setting";
 
-                 return false;
 
-             }
 
-             else
 
-             {
 
-                 double c2 = Convert.ToDouble((string)param[0]);
 
-                 c2 = Math.Max(double.Parse(_scMatchPositionC2.Min), c2);
 
-                 c2 = Math.Min(double.Parse(_scMatchPositionC2.Max), c2);
 
-                 _aoMatchPositionC2.Value = (short)c2;
 
-                 reason = $"Set RF match position c2 :{c2}";
 
-                 return true;
 
-             }
 
-         }
 
-     }
 
- }
 
 
  |