|
@@ -3,8 +3,10 @@ using Aitex.Core.RT.DataCenter;
|
|
|
using Aitex.Core.RT.Device;
|
|
|
using Aitex.Core.RT.IOCore;
|
|
|
using Aitex.Core.RT.Log;
|
|
|
+using Aitex.Core.RT.OperationCenter;
|
|
|
using Aitex.Core.RT.SCCore;
|
|
|
using Aitex.Core.RT.Tolerance;
|
|
|
+using Aitex.Core.UI.Control;
|
|
|
using Aitex.Core.UI.View.Common;
|
|
|
using Aitex.Core.Util;
|
|
|
using CdioCs;
|
|
@@ -31,7 +33,7 @@ namespace Venus_RT.Devices.IODevices
|
|
|
ON,
|
|
|
ERROR
|
|
|
}
|
|
|
- public IoMagnet(string module, XmlElement node, string ioModule = "")
|
|
|
+ public IoMagnet(string module, XmlElement node, string ioModule = "")
|
|
|
{
|
|
|
base.Module = module;
|
|
|
Name = "AIoMagnet";
|
|
@@ -47,18 +49,18 @@ namespace Venus_RT.Devices.IODevices
|
|
|
_aiMagnet2U = ParseAiNode("aiMagnet2U", node, ioModule);
|
|
|
_aiMagnet2W = ParseAiNode("aiMagnet2W", node, ioModule);
|
|
|
_diMagnetOn = ParseDiNode("diPowerOn", node, ioModule);
|
|
|
- _aoMagnetintensity= ParseAoNode("aoSetPoint", node, ioModule);
|
|
|
+ _aoMagnetintensity = ParseAoNode("aoSetPoint", node, ioModule);
|
|
|
_aoMagnetWaveForm = ParseAoNode("aoWaveSsquare", node, ioModule);
|
|
|
_aoMagnetFieldRadio = ParseAoNode("aoMagnetFieldRadio", node, ioModule);
|
|
|
_aoMagnetCycle = ParseAoNode("aoCycletime", node, ioModule);
|
|
|
_aoMinMagnet = ParseAoNode("aoCurrentLimit", node, ioModule);
|
|
|
- _ao1Aoutput= ParseAoNode("ao1Aoutput", node, ioModule);
|
|
|
+ _ao1Aoutput = ParseAoNode("ao1Aoutput", node, ioModule);
|
|
|
_ao1Boutput = ParseAoNode("ao1Boutput", node, ioModule);
|
|
|
_ao2Aoutput = ParseAoNode("ao2Aoutput", node, ioModule);
|
|
|
_ao2Boutput = ParseAoNode("ao2Boutput", node, ioModule);
|
|
|
}
|
|
|
public MagnetStatus Status { get; set; }
|
|
|
- private readonly AIAccessor _aiMagnet1U;
|
|
|
+ private readonly AIAccessor _aiMagnet1U;
|
|
|
private readonly AIAccessor _aiMagnet1V;
|
|
|
private readonly AIAccessor _aiMagnet1W;
|
|
|
private readonly AIAccessor _aiMagnet2U;
|
|
@@ -79,8 +81,8 @@ namespace Venus_RT.Devices.IODevices
|
|
|
public bool Initialize()
|
|
|
{
|
|
|
DATA.Subscribe($"{Module}.AIoMagnet.DeviceData", () => DeviceData, SubscriptionAttribute.FLAG.IgnoreSaveDB);
|
|
|
-
|
|
|
- _SetRealFloat(_aoMagnetWaveForm, Convert.ToSingle(SC.GetConfigItem($"{Module}.Magnet.Magnetwareform").Value));
|
|
|
+ OP.Subscribe("System.SetMagnet", Setmagnet);
|
|
|
+ _SetRealFloat(_aoMagnetWaveForm, Convert.ToSingle(SC.GetConfigItem($"{Module}.Magnet.Magnetwaveform").Value));
|
|
|
_SetRealFloat(_aoMagnetCycle, Convert.ToSingle(SC.GetConfigItem($"{Module}.Magnet.Magnetcycleperiod").Value));
|
|
|
_SetRealFloat(_aoMinMagnet, Convert.ToSingle(SC.GetConfigItem($"{Module}.Magnet.Min_Magnet_Coil_Current").Value));
|
|
|
_SetRealFloat(_aoMagnetFieldRadio, Convert.ToSingle(SC.GetConfigItem($"{Module}.Magnet.MagnetFieldRatio").Value));
|
|
@@ -90,7 +92,22 @@ namespace Venus_RT.Devices.IODevices
|
|
|
_SetRealFloat(_ao2Boutput, Convert.ToSingle(SC.GetConfigItem($"{Module}.Magnet.Magnet_2B_output_full_scale").Value));
|
|
|
return true;
|
|
|
}
|
|
|
-
|
|
|
+ private bool Setmagnet(string cmd, object[] parameters)
|
|
|
+ {
|
|
|
+ if (parameters[0].ToString().Contains("Magnetwaveform"))
|
|
|
+ {
|
|
|
+ Setpoint(_aoMagnetWaveForm, Convert.ToSingle(parameters[1]));
|
|
|
+ }
|
|
|
+ else if (parameters[0].ToString().Contains("MagnetFieldRatio"))
|
|
|
+ {
|
|
|
+ _SetRealFloat(_aoMagnetFieldRadio, Convert.ToSingle(parameters[1]));
|
|
|
+ }
|
|
|
+ else if (parameters[0].ToString().Contains("Magnetcycleperiod"))
|
|
|
+ {
|
|
|
+ _SetRealFloat(_aoMagnetCycle, Convert.ToSingle(parameters[1]));
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
public AITMagnetData DeviceData
|
|
|
{
|
|
|
get
|
|
@@ -104,14 +121,14 @@ namespace Venus_RT.Devices.IODevices
|
|
|
Magnet2VFeedBack = Magent2V,
|
|
|
Magnet2WFeedBack = Magent2W,
|
|
|
IsMagnetOn = MagnetOn,
|
|
|
- MagnetIntensity= MagnetPowerIntensity
|
|
|
+ MagnetIntensity = MagnetPowerIntensity
|
|
|
|
|
|
};
|
|
|
|
|
|
return deviceData;
|
|
|
}
|
|
|
}
|
|
|
- public void Setpoint(AOAccessor ao,float config)
|
|
|
+ public void Setpoint(AOAccessor ao, float config)
|
|
|
{
|
|
|
if (_GetRealFloat(ao) != config)
|
|
|
{
|
|
@@ -125,10 +142,10 @@ namespace Venus_RT.Devices.IODevices
|
|
|
Setpoint(_ao1Boutput, Convert.ToSingle(SC.GetConfigItem($"{Module}.Magnet.Magnet_1B_output_full_scale").Value));
|
|
|
Setpoint(_ao2Aoutput, Convert.ToSingle(SC.GetConfigItem($"{Module}.Magnet.Magnet_2A_output_full_scale").Value));
|
|
|
Setpoint(_ao2Boutput, Convert.ToSingle(SC.GetConfigItem($"{Module}.Magnet.Magnet_2B_output_full_scale").Value));
|
|
|
- Setpoint(_aoMagnetCycle, Convert.ToSingle(SC.GetConfigItem($"{Module}.Magnet.Magnetcycleperiod").Value));
|
|
|
+ //Setpoint(_aoMagnetCycle, Convert.ToSingle(SC.GetConfigItem($"{Module}.Magnet.Magnetcycleperiod").Value));
|
|
|
//Setpoint(_aoMagnetWaveForm, Convert.ToSingle(SC.GetConfigItem($"{Module}.Magnet.Magnetwareform").Value));
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public float Magent1V
|
|
|
{
|
|
|
get
|
|
@@ -181,7 +198,7 @@ namespace Venus_RT.Devices.IODevices
|
|
|
public bool SetMagnetPower(float val)
|
|
|
{
|
|
|
_SetRealFloat(_aoMagnetintensity, val);
|
|
|
- return true;
|
|
|
+ return true;
|
|
|
}
|
|
|
public bool SetFieldRatio(float val)
|
|
|
{
|