SerenRfMatch.cs 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO.Ports;
  4. using Aitex.Core.Common.DeviceData;
  5. using Aitex.Core.RT.DataCenter;
  6. using Aitex.Core.RT.Event;
  7. using Aitex.Core.RT.Log;
  8. using Aitex.Core.RT.OperationCenter;
  9. using Aitex.Core.RT.SCCore;
  10. using Aitex.Core.Util;
  11. using MECF.Framework.Common.Communications;
  12. using MECF.Framework.Common.Device.Bases;
  13. namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.RFMatchs.Serens
  14. {
  15. public class SerenRfMatch : RfMatchBase
  16. {
  17. public override EnumRfMatchTuneMode TuneMode1
  18. {
  19. get;
  20. set;
  21. }
  22. public override EnumRfMatchTuneMode TuneMode2
  23. {
  24. get;
  25. set;
  26. }
  27. public EnumRfMatchTuneMode LoadMode1
  28. {
  29. get;
  30. set;
  31. }
  32. public EnumRfMatchTuneMode LoadMode2
  33. {
  34. get;
  35. set;
  36. }
  37. public override float LoadPosition1
  38. {
  39. get;
  40. set;
  41. }
  42. public override float LoadPosition2
  43. {
  44. get;
  45. set;
  46. }
  47. public override float TunePosition1
  48. {
  49. get;
  50. set;
  51. }
  52. public bool Connect()
  53. {
  54. return _connection.Connect();
  55. }
  56. public bool Disconnect()
  57. {
  58. return _connection.Disconnect();
  59. }
  60. public override bool IsConnected => Connection != null && Connection.IsConnected && !_connection.IsCommunicationError;
  61. public override AITRfMatchData DeviceData
  62. {
  63. get
  64. {
  65. AITRfMatchData data = new AITRfMatchData()
  66. {
  67. DeviceName = Name,
  68. DeviceSchematicId = DeviceID,
  69. DisplayName = Display,
  70. LoadPosition1 = LoadPosition1,
  71. LoadPosition2 = LoadPosition2,
  72. LoadPosition1SetPoint = LoadPosition1Setpoint,
  73. TunePosition1 = TunePosition1,
  74. TunePosition2 = TunePosition2,
  75. TunePosition1SetPoint = TunePosition1Setpoint,
  76. TuneMode1 = TuneMode1,
  77. TuneMode2 = TuneMode2,
  78. BiasPeak = BiasPeak,
  79. DCBias = DCBias,
  80. };
  81. return data;
  82. }
  83. }
  84. public override bool IsStable
  85. {
  86. get
  87. {
  88. if (_scStableCriteria == null || _scStableCriteria.DoubleValue == 0)
  89. return false;
  90. if (LoadPosition1Setpoint == 0 || TunePosition1Setpoint == 0)
  91. return true;
  92. if (100 * LoadPosition1 / LoadPosition1Setpoint < _scStableCriteria.DoubleValue)
  93. _stableTimer.Stop();
  94. if (100 * TunePosition1 / TunePosition1Setpoint < _scStableCriteria.DoubleValue)
  95. _stableTimer.Stop();
  96. if (_stableTimer.IsIdle() && 100 * TunePosition1 / TunePosition1Setpoint >= _scStableCriteria.DoubleValue &&
  97. 100 * LoadPosition1 / LoadPosition1Setpoint >= _scStableCriteria.DoubleValue)
  98. _stableTimer.Start(_stableTime * 1000);
  99. return _stableTimer.IsTimeout();
  100. }
  101. }
  102. public SerenRfMatchConnection Connection
  103. {
  104. get { return _connection; }
  105. }
  106. private SerenRfMatchConnection _connection;
  107. private EnumRfMatchTuneMode _tuneMode1;
  108. private EnumRfMatchTuneMode _tuneMode2;
  109. private RD_TRIG _trigRfOnOff = new RD_TRIG();
  110. private R_TRIG _trigError = new R_TRIG();
  111. private R_TRIG _trigWarningMessage = new R_TRIG();
  112. private R_TRIG _trigCommunicationError = new R_TRIG();
  113. private R_TRIG _trigRetryConnect = new R_TRIG();
  114. private PeriodicJob _thread;
  115. private LinkedList<HandlerBase> _executionHandler = new LinkedList<HandlerBase>();
  116. private LinkedList<HandlerBase> _idleHandler = new LinkedList<HandlerBase>();
  117. private object _locker = new object();
  118. private bool _enableLog = true;
  119. public int MagnitudeError { get; set; }
  120. public int PhaseError { get; set; }
  121. public int DCVoltage { get; set; }
  122. public int RFVoltage { get; set; }
  123. public string MatchType { get; set; } //ATS or MC2
  124. private string _scRoot;
  125. private bool _isPresetEnabled;
  126. private float _loadPresetPosition;
  127. private float _tunePresetPosition;
  128. public SerenRfMatch(string module, string name, string scRoot, string type = "ATS") : base(module, name)
  129. {
  130. MatchType = type;
  131. _scRoot = scRoot;
  132. }
  133. public bool Initialize(string portName, int baudRate = 9600, int dataBits = 8, Parity parity = Parity.None, StopBits stopBits = StopBits.One)
  134. {
  135. base.Initialize();
  136. _enableLog = true;
  137. _connection = new SerenRfMatchConnection(portName, baudRate, dataBits, parity, stopBits);
  138. _connection.EnableLog(_enableLog);
  139. if (_connection.Connect())
  140. {
  141. EV.PostInfoLog(Module, $"{Module}.{Name} connected");
  142. InitStatus();
  143. }
  144. _thread = new PeriodicJob(100, OnTimer, $"{Module}.{Name} MonitorHandler", true);
  145. return true;
  146. }
  147. public override bool Initialize()
  148. {
  149. base.Initialize();
  150. string portName = SC.GetStringValue($"{_scRoot}.Address");
  151. int bautRate = SC.GetValue<int>($"{_scRoot}.BaudRate");
  152. int dataBits = SC.GetValue<int>($"{_scRoot}.DataBits");
  153. Enum.TryParse(SC.GetStringValue($"{_scRoot}.Parity"), out Parity parity);
  154. Enum.TryParse(SC.GetStringValue($"{_scRoot}.StopBits"), out StopBits stopBits);
  155. _enableLog = SC.GetValue<bool>($"{_scRoot}.EnableLogMessage");
  156. _connection = new SerenRfMatchConnection(portName, bautRate, dataBits, parity, stopBits);
  157. _connection.EnableLog(_enableLog);
  158. if (_connection.Connect())
  159. {
  160. EV.PostInfoLog(Module, $"{Module}.{Name} connected");
  161. InitStatus();
  162. }
  163. DATA.Subscribe($"{Module}.{Name}.IsConnected", () => IsConnected);
  164. DATA.Subscribe($"{Module}.{Name}.Address", () => SC.GetStringValue($"{_scRoot}.Address"));
  165. DATA.Subscribe($"{Module}.{Name}.MagnitudeError", () => MagnitudeError);
  166. DATA.Subscribe($"{Module}.{Name}.PhaseError", () => PhaseError);
  167. DATA.Subscribe($"{Module}.{Name}.DCVoltage", () => DCVoltage);
  168. DATA.Subscribe($"{Module}.{Name}.RFVoltage", () => RFVoltage);
  169. DATA.Subscribe($"{Module}.{Name}.IsPresetEnable", () => _isPresetEnabled);
  170. DATA.Subscribe($"{Module}.{Name}.LoadPresetPosition", () => _loadPresetPosition);
  171. DATA.Subscribe($"{Module}.{Name}.TunePresetPosition", () => _tunePresetPosition);
  172. OP.Subscribe($"{Module}.{Name}.MatchEnablePreset", (out string reason, int time, object[] args) =>
  173. {
  174. reason = "";
  175. bool enable = Convert.ToBoolean(args[0]);
  176. string text = enable ? "enable" : "disable";
  177. if (!PerformMatchMode1EnablePreset(out reason, time, enable))
  178. {
  179. EV.PostAlarmLog(Module, $"{Module}.{Name} Can not {text} preset mode, {reason}");
  180. return false;
  181. }
  182. EV.PostInfoLog(Module, $"{Module}.{Name} {text} match preset mode");
  183. return true;
  184. });
  185. OP.Subscribe($"{Module}.{Name}.MatchMode1", (out string reason, int time, object[] args) =>
  186. {
  187. reason = "";
  188. if (!Enum.TryParse((string)args[0], out EnumRfMatchTuneMode mode))
  189. {
  190. EV.PostAlarmLog(Module, $"{Module}.{Name} Can not mode, {args[0]} is not a valid mode value");
  191. return false;
  192. }
  193. if (!PerformMatchMode1(out reason, time, mode))
  194. {
  195. EV.PostAlarmLog(Module, $"{Module}.{Name} Can not set mode, {reason}");
  196. return false;
  197. }
  198. EV.PostInfoLog(Module, $"{Module}.{Name} set match mode1 to {mode}");
  199. return true;
  200. });
  201. OP.Subscribe($"{Module}.{Name}.SetMatchLoad1", (out string reason, int time, object[] args) =>
  202. {
  203. reason = "";
  204. float value = Convert.ToSingle((string)args[0]);
  205. if (!PerformSetMatchLoad1(out reason, time, value))
  206. {
  207. EV.PostAlarmLog(Module, $"{Module}.{Name} Can not set mode, {reason}");
  208. return false;
  209. }
  210. EV.PostInfoLog(Module, $"{Module}.{Name} set match load1 to {value}");
  211. return true;
  212. });
  213. OP.Subscribe($"{Module}.{Name}.SetMatchLoadPresetPosition", (out string reason, int time, object[] args) =>
  214. {
  215. reason = "";
  216. float value = Convert.ToSingle((string)args[0]);
  217. SC.SetItemValue($"{Module}.{Name}.MatchLoadPresetPosition", value);
  218. if (!PerformSetMatchLoadPresetPosition(out reason, time, value))
  219. {
  220. EV.PostAlarmLog(Module, $"{Module}.{Name} Can not set preset load position, {reason}");
  221. return false;
  222. }
  223. EV.PostInfoLog(Module, $"{Module}.{Name} set match load preset position to {value}");
  224. return true;
  225. });
  226. OP.Subscribe($"{Module}.{Name}.SetMatchTunePresetPosition", (out string reason, int time, object[] args) =>
  227. {
  228. reason = "";
  229. float value = Convert.ToSingle((string)args[0]);
  230. SC.SetItemValue($"{Module}.{Name}.MatchTunePresetPosition", value);
  231. if (!PerformSetMatchTunePresetPosition(out reason, time, value))
  232. {
  233. EV.PostAlarmLog(Module, $"{Module}.{Name} Can not set preset tune position, {reason}");
  234. return false;
  235. }
  236. EV.PostInfoLog(Module, $"{Module}.{Name} set match tune preset position to {value}");
  237. return true;
  238. });
  239. OP.Subscribe($"{Module}.{Name}.SetMatchTune1", (out string reason, int time, object[] args) =>
  240. {
  241. reason = "";
  242. float value = Convert.ToSingle((string)args[0]);
  243. if (!PerformSetMatchTune1(out reason, time, value))
  244. {
  245. EV.PostAlarmLog(Module, $"{Module}.{Name} Can not set mode, {reason}");
  246. return false;
  247. }
  248. EV.PostInfoLog(Module, $"{Module}.{Name} set match tune1 to {value}");
  249. return true;
  250. });
  251. OP.Subscribe($"{Module}.{Name}.MatchMode2", (out string reason, int time, object[] args) =>
  252. {
  253. reason = "";
  254. if (!Enum.TryParse((string)args[0], out EnumRfMatchTuneMode mode))
  255. {
  256. EV.PostAlarmLog(Module, $"{Module}.{Name} Can not mode, {args[0]} is not a valid mode value");
  257. return false;
  258. }
  259. if (!PerformMatchMode2(out reason, time, mode))
  260. {
  261. EV.PostAlarmLog(Module, $"{Module}.{Name} Can not set mode, {reason}");
  262. return false;
  263. }
  264. EV.PostInfoLog(Module, $"{Module}.{Name} set match mode2 to {mode}");
  265. return true;
  266. });
  267. OP.Subscribe($"{Module}.{Name}.SetMatchLoad2", (out string reason, int time, object[] args) =>
  268. {
  269. reason = "";
  270. float value = Convert.ToSingle((string)args[0]);
  271. if (!PerformSetMatchLoad2(out reason, time, value))
  272. {
  273. EV.PostAlarmLog(Module, $"{Module}.{Name} Can not set mode, {reason}");
  274. return false;
  275. }
  276. EV.PostInfoLog(Module, $"{Module}.{Name} set match load2 to {value}");
  277. return true;
  278. });
  279. OP.Subscribe($"{Module}.{Name}.SetMatchTune2", (out string reason, int time, object[] args) =>
  280. {
  281. reason = "";
  282. float value = Convert.ToSingle((string)args[0]);
  283. if (!PerformSetMatchTune2(out reason, time, value))
  284. {
  285. EV.PostAlarmLog(Module, $"{Module}.{Name} Can not set mode, {reason}");
  286. return false;
  287. }
  288. EV.PostInfoLog(Module, $"{Module}.{Name} set match tune2 to {value}");
  289. return true;
  290. });
  291. OP.Subscribe($"{Module}.{Name}.Reconnect", (string cmd, object[] args) =>
  292. {
  293. Disconnect();
  294. Reset();
  295. Connect();
  296. return true;
  297. });
  298. _thread = new PeriodicJob(300, OnTimer, $"{Module}.{Name} MonitorHandler", true);
  299. return true;
  300. }
  301. private bool OnTimer()
  302. {
  303. try
  304. {
  305. _connection.MonitorTimeout();
  306. if (!_connection.IsConnected || _connection.IsCommunicationError)
  307. {
  308. lock (_locker)
  309. {
  310. _executionHandler.Clear();
  311. _idleHandler.Clear();
  312. }
  313. _trigRetryConnect.CLK = !_connection.IsConnected;
  314. if (_trigRetryConnect.Q)
  315. {
  316. _connection.SetPortAddress(SC.GetStringValue($"{ScBasePath}.{Name}.Address"));
  317. if (!_connection.Connect())
  318. {
  319. EV.PostAlarmLog(Module, $"Can not connect with {_connection.Address}, {Module}.{Name}");
  320. }
  321. }
  322. return true;
  323. }
  324. HandlerBase handler = null;
  325. if (!_connection.IsBusy)
  326. {
  327. lock (_locker)
  328. {
  329. if (_executionHandler.Count == 0)
  330. {
  331. if (_idleHandler.Count == 0)
  332. {
  333. _idleHandler.AddLast(new SerenRfMatchGetMagnitudeErrorHandler(this));
  334. _idleHandler.AddLast(new SerenRfMatchGetPhaseErrorHandler(this));
  335. _idleHandler.AddLast(new SerenRfMatchGetDCVoltageHandler(this));
  336. _idleHandler.AddLast(new SerenRfMatchGetRFVoltageHandler(this));
  337. _idleHandler.AddLast(new SerenRfMatchGetTunePositionHandler(this));
  338. _idleHandler.AddLast(new SerenRfMatchGetLoadPositionHandler(this));
  339. _idleHandler.AddLast(new SerenRfMatchGetTuneControlModeHandler(this));
  340. }
  341. else
  342. {
  343. handler = _idleHandler.First.Value;
  344. _idleHandler.RemoveFirst();
  345. }
  346. }
  347. else
  348. {
  349. handler = _executionHandler.First.Value;
  350. _executionHandler.RemoveFirst();
  351. }
  352. }
  353. if (handler != null)
  354. {
  355. _connection.Execute(handler);
  356. }
  357. }
  358. }
  359. catch (Exception ex)
  360. {
  361. LOG.Write(ex);
  362. }
  363. return true;
  364. }
  365. public override void Monitor()
  366. {
  367. try
  368. {
  369. _connection.EnableLog(_enableLog);
  370. _trigCommunicationError.CLK = _connection.IsCommunicationError;
  371. if (_trigCommunicationError.Q)
  372. {
  373. EV.PostAlarmLog(Module, $"{Module}.{Name} communication error, {_connection.LastCommunicationError}");
  374. }
  375. }
  376. catch (Exception ex)
  377. {
  378. LOG.Write(ex);
  379. }
  380. }
  381. public override void Reset()
  382. {
  383. _trigError.RST = true;
  384. _trigWarningMessage.RST = true;
  385. _connection.SetCommunicationError(false, "");
  386. _trigCommunicationError.RST = true;
  387. _enableLog = SC.GetValue<bool>($"{_scRoot}.EnableLogMessage");
  388. _trigRetryConnect.RST = true;
  389. base.Reset();
  390. }
  391. internal void NoteError(string reason)
  392. {
  393. _trigWarningMessage.CLK = true;
  394. if (_trigWarningMessage.Q)
  395. {
  396. EV.PostWarningLog(Module, $"{Module}.{Name} error, {reason}");
  397. }
  398. }
  399. internal void NoteLoadControlMode(bool isAuto)
  400. {
  401. LoadMode1 = isAuto ? EnumRfMatchTuneMode.Auto : EnumRfMatchTuneMode.Manual;
  402. }
  403. internal void NotePresetMode(string mode)
  404. {
  405. _isPresetEnabled = mode == "1";
  406. }
  407. internal void NoteTuneControlMode(bool isAuto)
  408. {
  409. TuneMode1 = isAuto ? EnumRfMatchTuneMode.Auto : EnumRfMatchTuneMode.Manual;
  410. }
  411. internal void NoteLoadPosition(float position)
  412. {
  413. LoadPosition1 = position;
  414. }
  415. internal void NoteTunePosition(float position)
  416. {
  417. TunePosition1 = position;
  418. }
  419. internal void NoteLoadPresetPosition(float position)
  420. {
  421. _loadPresetPosition = position;
  422. }
  423. internal void NoteTunePresetPosition(float position)
  424. {
  425. _tunePresetPosition = position;
  426. }
  427. internal void NoteMagnitudeError(int error)
  428. {
  429. MagnitudeError = error;
  430. }
  431. internal void NotePhaseError(int error)
  432. {
  433. PhaseError = error;
  434. }
  435. internal void NoteDCVoltage(int voltage)
  436. {
  437. DCVoltage = voltage;
  438. }
  439. internal void NoteRFVoltage(int voltage)
  440. {
  441. RFVoltage = voltage;
  442. }
  443. private bool PerformSetMatchTune1(out string reason, int time, float value)
  444. {
  445. reason = string.Empty;
  446. return true;
  447. }
  448. private bool PerformSetMatchLoad1(out string reason, int time, float value)
  449. {
  450. reason = string.Empty;
  451. return true;
  452. }
  453. private bool PerformSetMatchLoadPresetPosition(out string reason, int time, float value)
  454. {
  455. reason = string.Empty;
  456. lock (_locker)
  457. {
  458. _executionHandler.AddLast(new SerenRfMatchSetLoadPreset1PositionHandler(this, value));
  459. _executionHandler.AddLast(new SerenRfMatchGetLoadPreset1PositionHandler(this));
  460. }
  461. return true;
  462. }
  463. private bool PerformSetMatchTunePresetPosition(out string reason, int time, float value)
  464. {
  465. reason = string.Empty;
  466. lock (_locker)
  467. {
  468. _executionHandler.AddLast(new SerenRfMatchSetTunePreset1PositionHandler(this, value));
  469. _executionHandler.AddLast(new SerenRfMatchGetTunePreset1PositionHandler(this));
  470. }
  471. return true;
  472. }
  473. private bool PerformMatchMode1(out string reason, int time, EnumRfMatchTuneMode mode)
  474. {
  475. SetLoadMode1(mode);
  476. SetTuneMode1(mode);
  477. reason = string.Empty;
  478. return true;
  479. }
  480. private bool PerformMatchMode1EnablePreset(out string reason, int time, bool enable)
  481. {
  482. reason = string.Empty;
  483. lock (_locker)
  484. {
  485. _executionHandler.AddLast(new SerenRfMatchEnablePresetHandler(this, enable));
  486. _executionHandler.AddLast(new SerenRfMatchGetPresetHandler(this));
  487. }
  488. return true;
  489. }
  490. private bool PerformMatchMode2(out string reason, int time, EnumRfMatchTuneMode mode)
  491. {
  492. reason = string.Empty;
  493. return true;
  494. }
  495. private bool PerformSetMatchLoad2(out string reason, int time, float value)
  496. {
  497. reason = string.Empty;
  498. return true;
  499. }
  500. private bool PerformSetMatchTune2(out string reason, int time, float value)
  501. {
  502. reason = string.Empty;
  503. return true;
  504. }
  505. public void InitStatus()
  506. {
  507. lock (_locker)
  508. {
  509. _executionHandler.AddLast(new SerenRfMatchGetPresetHandler(this));
  510. _executionHandler.AddLast(new SerenRfMatchGetTuneControlModeHandler(this));
  511. _executionHandler.AddLast(new SerenRfMatchGetTunePreset1PositionHandler(this));
  512. _executionHandler.AddLast(new SerenRfMatchGetLoadPreset1PositionHandler(this));
  513. }
  514. }
  515. public override void EnablePreset1(bool enable)
  516. {
  517. PerformMatchMode1EnablePreset(out _, 0, enable);
  518. }
  519. public override void SetLoadMode1(EnumRfMatchTuneMode mode)
  520. {
  521. lock (_locker)
  522. {
  523. _executionHandler.AddLast(new SerenRfMatchSetLoadControlModeHandler(this, mode == EnumRfMatchTuneMode.Auto));
  524. }
  525. }
  526. public override void SetTuneMode1(EnumRfMatchTuneMode mode)
  527. {
  528. lock (_locker)
  529. {
  530. _executionHandler.AddLast(new SerenRfMatchSetTuneControlModeHandler(this, mode == EnumRfMatchTuneMode.Auto));
  531. _executionHandler.AddLast(new SerenRfMatchGetTuneControlModeHandler(this));
  532. }
  533. }
  534. public override void SetLoadPresetPosition(float position)
  535. {
  536. PerformSetMatchLoadPresetPosition(out _, 0, position);
  537. }
  538. public override void SetTunePresetPosition(float position)
  539. {
  540. PerformSetMatchTunePresetPosition(out _, 0, position);
  541. }
  542. public override void SetLoad1(float position)
  543. {
  544. LoadPosition1Setpoint = position;
  545. lock (_locker)
  546. {
  547. if (MatchType == "ATS")
  548. {
  549. //_lstHandler.AddLast(new SerenRfMatchSetLoadControlModeHandler(this, false));
  550. _executionHandler.AddLast(new SerenRfMatchSetLoadPositionHandler(this, position));
  551. }
  552. else
  553. {
  554. // _lstHandler.AddLast(new SerenRfMatchSetLoadControlModeHandler(this, false));
  555. _executionHandler.AddLast(new SerenRfMatchSetLoadPreset1PositionHandler(this, position));
  556. _executionHandler.AddLast(new SerenRfMatchGotoHandler(this));
  557. }
  558. }
  559. }
  560. public override void SetTune1(float position)
  561. {
  562. TunePosition1Setpoint = position;
  563. lock (_locker)
  564. {
  565. if (MatchType == "ATS")
  566. {
  567. // _lstHandler.AddLast(new SerenRfMatchSetTuneControlModeHandler(this, false));
  568. _executionHandler.AddLast(new SerenRfMatchSetTunePositionHandler(this, position));
  569. }
  570. else
  571. {
  572. // _lstHandler.AddLast(new SerenRfMatchSetTuneControlModeHandler(this, false));
  573. _executionHandler.AddLast(new SerenRfMatchSetTunePreset1PositionHandler(this, position));
  574. _executionHandler.AddLast(new SerenRfMatchGotoHandler(this));
  575. }
  576. }
  577. }
  578. public void GetTune1()
  579. {
  580. lock (_locker)
  581. {
  582. _executionHandler.AddLast(new SerenRfMatchGetTunePositionHandler(this));
  583. }
  584. }
  585. public void GetLoad1()
  586. {
  587. lock (_locker)
  588. {
  589. _executionHandler.AddLast(new SerenRfMatchGetLoadPositionHandler(this));
  590. }
  591. }
  592. public void GetLoad1Mode()
  593. {
  594. lock (_locker)
  595. {
  596. _executionHandler.AddLast(new SerenRfMatchGetLoadControlModeHandler(this));
  597. }
  598. }
  599. }
  600. }