|
@@ -0,0 +1,218 @@
|
|
|
+using Aitex.Core.Common.DeviceData;
|
|
|
+using Aitex.Core.RT.DataCenter;
|
|
|
+using Aitex.Core.RT.Device;
|
|
|
+using Aitex.Core.RT.IOCore;
|
|
|
+using Aitex.Core.RT.Log;
|
|
|
+using Aitex.Core.RT.SCCore;
|
|
|
+using Aitex.Core.RT.Tolerance;
|
|
|
+using Aitex.Core.UI.View.Common;
|
|
|
+using Aitex.Core.Util;
|
|
|
+using MECF.Framework.Common.CommonData.DeviceData;
|
|
|
+using MECF.Framework.Common.Equipment;
|
|
|
+using System;
|
|
|
+using System.Collections.Generic;
|
|
|
+using System.Linq;
|
|
|
+using System.Security.Cryptography;
|
|
|
+using System.Text;
|
|
|
+using System.Threading.Tasks;
|
|
|
+using System.Xml;
|
|
|
+using Venus_Core;
|
|
|
+
|
|
|
+namespace Venus_RT.Devices.IODevices
|
|
|
+{
|
|
|
+ public class IoMagnet : BaseDevice, IDevice
|
|
|
+ {
|
|
|
+
|
|
|
+ public enum MagnetStatus
|
|
|
+ {
|
|
|
+ Unknown,
|
|
|
+ OFF,
|
|
|
+ ON,
|
|
|
+ ERROR
|
|
|
+ }
|
|
|
+ public IoMagnet(string module, XmlElement node, string ioModule = "")
|
|
|
+ {
|
|
|
+ base.Module = module;
|
|
|
+ Name = "AIoMagnet";
|
|
|
+ //base.Name = node.GetAttribute("id");
|
|
|
+ base.Display = node.GetAttribute("display");
|
|
|
+ base.DeviceID = node.GetAttribute("schematicId");
|
|
|
+ this.Status = MagnetStatus.Unknown;
|
|
|
+ _aiMagnet1U = ParseAiNode("aiMagnet1U", node, ioModule);
|
|
|
+ _aiMagnet1V = ParseAiNode("aiMagnet1V", node, ioModule);
|
|
|
+ _aiMagnet1W = ParseAiNode("aiMagnet1W", node, ioModule);
|
|
|
+ _aiMagnet2V = ParseAiNode("aiMagnet2V", node, ioModule);
|
|
|
+ _aiMagnet2U = ParseAiNode("aiMagnet2U", node, ioModule);
|
|
|
+ _aiMagnet2W = ParseAiNode("aiMagnet2W", node, ioModule);
|
|
|
+ _doMagnetOn = ParseDoNode("doPowerOn", node, ioModule);
|
|
|
+ _aoMagnetintensity= ParseAoNode("aoSetPoint", node, ioModule);
|
|
|
+ _aoMagnetWaveForm = ParseAoNode("aoWaveSsquare", node, ioModule);
|
|
|
+ // _aoMagnetFieldRadio = ParseAoNode("aoSetPoint", node, ioModule);
|
|
|
+ _aoMagnetCycle = ParseAoNode("aoCycletime", node, ioModule);
|
|
|
+ _aoMinMagnet = ParseAoNode("aoCurrentLimit", node, ioModule);
|
|
|
+
|
|
|
+ }
|
|
|
+ private SCConfigItem _scMagnetWaveForm;
|
|
|
+ private SCConfigItem _scMagnetFieldRadio;
|
|
|
+ private SCConfigItem _scMagnetCycle;
|
|
|
+ private SCConfigItem _scMinMagnet;
|
|
|
+ public MagnetStatus Status { get; set; }
|
|
|
+ private readonly AIAccessor _aiMagnet1U;
|
|
|
+ private readonly AIAccessor _aiMagnet1V;
|
|
|
+ private readonly AIAccessor _aiMagnet1W;
|
|
|
+ private readonly AIAccessor _aiMagnet2U;
|
|
|
+ private readonly AIAccessor _aiMagnet2V;
|
|
|
+ private readonly AIAccessor _aiMagnet2W;
|
|
|
+ private readonly DOAccessor _doMagnetOn;
|
|
|
+ private readonly AOAccessor _aoMagnetintensity;
|
|
|
+ private readonly AOAccessor _aoMagnetWaveForm;
|
|
|
+ private readonly AOAccessor _aoMagnetFieldRadio;
|
|
|
+ private readonly AOAccessor _aoMagnetCycle;
|
|
|
+ private readonly AOAccessor _aoMinMagnet;
|
|
|
+ private ToleranceChecker _toleranceChecker = new ToleranceChecker();
|
|
|
+ public bool Initialize()
|
|
|
+ {
|
|
|
+ DATA.Subscribe($"{Module}.AIoMagnet.DeviceData", () => DeviceData, SubscriptionAttribute.FLAG.IgnoreSaveDB);
|
|
|
+ _SetRealFloat(_aoMagnetWaveForm, Convert.ToSingle(SC.GetConfigItem($"{Module}.Magnet.Magnetwareform").Value));
|
|
|
+ _SetRealFloat(_aoMagnetCycle, Convert.ToSingle(SC.GetConfigItem($"{Module}.Magnet.Magnetcycleperiod").Value));
|
|
|
+ _SetRealFloat(_aoMinMagnet, Convert.ToSingle(SC.GetConfigItem($"{Module}.Magnet.Min_Magnet_Coil_Current").Value));
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ public AITMagnetData DeviceData
|
|
|
+ {
|
|
|
+ get
|
|
|
+ {
|
|
|
+ AITMagnetData deviceData = new AITMagnetData
|
|
|
+ {
|
|
|
+ Magnet1UFeedBack = Magent1U,
|
|
|
+ Magnet1VFeedBack = Magent1V,
|
|
|
+ Magnet1WFeedBack = Magent1W,
|
|
|
+ Magnet2UFeedBack = Magent2U,
|
|
|
+ Magnet2VFeedBack = Magent2V,
|
|
|
+ Magnet2WFeedBack = Magent2W,
|
|
|
+ IsMagnetOn = MagnetOn,
|
|
|
+ MagnetIntensity= MagnetPowerIntensity
|
|
|
+
|
|
|
+ };
|
|
|
+
|
|
|
+ return deviceData;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ public void Monitor()
|
|
|
+ {
|
|
|
+ //throw new NotImplementedException();
|
|
|
+ }
|
|
|
+ [Subscription(AITMfcDataPropertyName.FeedBack)]
|
|
|
+ public float Magent1V
|
|
|
+ {
|
|
|
+ get
|
|
|
+ {
|
|
|
+ if (_aiMagnet1V == null) return -1;
|
|
|
+ float real = _GetRealFloat(_aiMagnet1V);
|
|
|
+ return real;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ public float Magent1U
|
|
|
+ {
|
|
|
+ get
|
|
|
+ {
|
|
|
+ if (_aiMagnet1U == null) return -1;
|
|
|
+ float real = _GetRealFloat(_aiMagnet1U);
|
|
|
+ return real;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ public float Magent1W
|
|
|
+ {
|
|
|
+ get
|
|
|
+ {
|
|
|
+ if (_aiMagnet1W == null) return -1;
|
|
|
+ float real = _GetRealFloat(_aiMagnet1W);
|
|
|
+ return real;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ public float Magent2U
|
|
|
+ {
|
|
|
+ get
|
|
|
+ {
|
|
|
+ if (_aiMagnet2U == null) return -1;
|
|
|
+ float real = _GetRealFloat(_aiMagnet2U);
|
|
|
+ return real;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ public float Magent2V
|
|
|
+ {
|
|
|
+ get
|
|
|
+ {
|
|
|
+ if (_aiMagnet2V == null) return -1;
|
|
|
+ float real = _GetRealFloat(_aiMagnet2V);
|
|
|
+ return real;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ public bool MagnetOn
|
|
|
+ {
|
|
|
+ get => Status == MagnetStatus.ON;
|
|
|
+ set { }
|
|
|
+ }
|
|
|
+ public bool SetMagnetOnOff(bool on, out string str)
|
|
|
+ {
|
|
|
+ str = "";
|
|
|
+ var _chamber = DEVICE.GetDevice<JetPMBase>(Module);
|
|
|
+ //if (on && !_chamber.CheckGeneratorAndHVInterlock(VenusDevice.Rf))
|
|
|
+ //{
|
|
|
+ // return false;
|
|
|
+ //}
|
|
|
+
|
|
|
+
|
|
|
+ if (!_doMagnetOn.SetValue(on, out string reason))
|
|
|
+ {
|
|
|
+ LOG.Write(eEvent.INFO_DEVICE_IO_MAGNET, ModuleHelper.Converter(Module), reason);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ LOG.Write(eEvent.INFO_DEVICE_IO_MAGNET, ModuleHelper.Converter(Module), $"Set Magnet Contact {(on ? "ON" : "OFF")}");
|
|
|
+ if (on)
|
|
|
+ {
|
|
|
+ Status = MagnetStatus.ON;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ Status = MagnetStatus.OFF;
|
|
|
+ }
|
|
|
+
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ public bool SetMagnetPower(float val)
|
|
|
+ {
|
|
|
+ _SetRealFloat(_aoMagnetintensity, val);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ public float Magent2W
|
|
|
+ {
|
|
|
+ get
|
|
|
+ {
|
|
|
+ if (_aiMagnet2W == null) return -1;
|
|
|
+ float real = _GetRealFloat(_aiMagnet2W);
|
|
|
+ return real;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ public float MagnetPowerIntensity
|
|
|
+ {
|
|
|
+ get
|
|
|
+ {
|
|
|
+ if (_aoMagnetintensity == null) return -1;
|
|
|
+ float real = _GetRealFloat(_aoMagnetintensity);
|
|
|
+ return real;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ public void Reset()
|
|
|
+ {
|
|
|
+ _toleranceChecker.Reset(21);
|
|
|
+ }
|
|
|
+
|
|
|
+ public void Terminate()
|
|
|
+ {
|
|
|
+ //throw new NotImplementedException();
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|