首次上传

This commit is contained in:
hanqiangqiang
2026-06-15 10:56:30 +08:00
commit b0213b94d6
4160 changed files with 736101 additions and 0 deletions
@@ -0,0 +1,515 @@
using System;
using System.Collections.Generic;
using System.IO.Ports;
using Aitex.Core.Common.DeviceData;
using Aitex.Core.RT.Event;
using Aitex.Core.RT.Log;
using Aitex.Core.RT.OperationCenter;
using Aitex.Core.RT.SCCore;
using Aitex.Core.Util;
using MECF.Framework.Common.Communications;
using MECF.Framework.Common.Device.Bases;
namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.RFMatchs.AE
{
public class AeRfMatch : RfMatchBase
{
public override EnumRfMatchTuneMode TuneMode1
{
get
{
return _statusData.Status2.Net1AutoMode ? EnumRfMatchTuneMode.Auto : EnumRfMatchTuneMode.Manual;
}
}
public override EnumRfMatchTuneMode TuneMode2
{
get
{
return _statusData.Status2.Net2AutoMode ? EnumRfMatchTuneMode.Auto : EnumRfMatchTuneMode.Manual;
}
}
public override float LoadPosition1
{
get { return _statusData.LoadPosi1; }
}
public override float LoadPosition2
{
get { return _statusData.LoadPosi2; }
}
public override float TunePosition1
{
get { return _statusData.TunePosi1; }
}
public override float TunePosition2
{
get { return _statusData.TunePosi2; }
}
public override float BiasPeak
{
get { return _statusData.BiasPeak; }
}
public override float DCBias
{
get { return _statusData.DCBias; }
}
public override AITRfMatchData DeviceData
{
get
{
AITRfMatchData data = new AITRfMatchData()
{
DeviceName = Name,
DeviceSchematicId = DeviceID,
DisplayName = Display,
LoadPosition1 = LoadPosition1,
LoadPosition2 = LoadPosition2,
TunePosition1 = TunePosition1,
TunePosition2 = TunePosition2,
TuneMode1 = TuneMode1,
TuneMode2 = TuneMode2,
BiasPeak = BiasPeak,
DCBias = DCBias,
};
return data;
}
}
public AeRfMatchConnection Connection
{
get { return _connection; }
}
private AeRfMatchConnection _connection;
private byte _deviceAddress ;
private EnumRfMatchTuneMode _tuneMode1;
private EnumRfMatchTuneMode _tuneMode2;
private RD_TRIG _trigRfOnOff = new RD_TRIG();
private int _presetNumber;
private R_TRIG _trigError = new R_TRIG();
private R_TRIG _trigWarningMessage = new R_TRIG();
private R_TRIG _trigCommunicationError = new R_TRIG();
private R_TRIG _trigRetryConnect = new R_TRIG();
private PeriodicJob _thread;
private LinkedList<HandlerBase> _lstHandler = new LinkedList<HandlerBase>();
private object _locker = new object();
private bool _enableLog = true;
private AEStatusData _statusData;
public AeRfMatch(string module, string name) : base(module, name)
{
}
public override bool Initialize()
{
base.Initialize();
string portName = SC.GetStringValue($"{ScBasePath}.{Name}.Address");
int bautRate = SC.GetValue<int>($"{ScBasePath}.{Name}.BaudRate");
int dataBits = SC.GetValue<int>($"{ScBasePath}.{Name}.DataBits");
Enum.TryParse(SC.GetStringValue($"{ScBasePath}.{Name}.Parity"), out Parity parity);
Enum.TryParse(SC.GetStringValue($"{ScBasePath}.{Name}.StopBits"), out StopBits stopBits);
_deviceAddress = (byte)SC.GetValue<int>($"{ScBasePath}.{Name}.DeviceAddress");
_enableLog = SC.GetValue<bool>($"{ScBasePath}.{Name}.EnableLogMessage");
_connection = new AeRfMatchConnection(portName, bautRate, dataBits, parity, stopBits);
_connection.EnableLog(_enableLog);
if (_connection.Connect())
{
EV.PostInfoLog(Module, $"{Module}.{Name} connected");
}
_thread = new PeriodicJob(100, OnTimer, $"{Module}.{Name} MonitorHandler", true);
OP.Subscribe($"{Module}.{Name}.MatchMode1", (out string reason, int time, object[] args) =>
{
reason = "";
if (!Enum.TryParse((string)args[0], out EnumRfMatchTuneMode mode))
{
EV.PostAlarmLog(Module, $"{Module}.{Name} Can not mode, {args[0]} is not a valid mode value");
return false;
}
if (!PerformMatchMode1(out reason, time, mode))
{
EV.PostAlarmLog(Module, $"{Module}.{Name} Can not set mode, {reason}");
return false;
}
EV.PostInfoLog(Module, $"{Module}.{Name} set match mode1 to {mode}");
return true;
});
OP.Subscribe($"{Module}.{Name}.SetMatchLoad1", (out string reason, int time, object[] args) =>
{
reason = "";
float value = Convert.ToSingle((string)args[0]);
if (!PerformSetMatchLoad1(out reason, time, value))
{
EV.PostAlarmLog(Module, $"{Module}.{Name} Can not set mode, {reason}");
return false;
}
EV.PostInfoLog(Module, $"{Module}.{Name} set match load1 to {value}");
return true;
});
OP.Subscribe($"{Module}.{Name}.SetMatchTune1", (out string reason, int time, object[] args) =>
{
reason = "";
float value = Convert.ToSingle((string)args[0]);
if (!PerformSetMatchTune1(out reason, time, value))
{
EV.PostAlarmLog(Module, $"{Module}.{Name} Can not set mode, {reason}");
return false;
}
EV.PostInfoLog(Module, $"{Module}.{Name} set match tune1 to {value}");
return true;
});
OP.Subscribe($"{Module}.{Name}.MatchMode2", (out string reason, int time, object[] args) =>
{
reason = "";
if (!Enum.TryParse((string)args[0], out EnumRfMatchTuneMode mode))
{
EV.PostAlarmLog(Module, $"{Module}.{Name} Can not mode, {args[0]} is not a valid mode value");
return false;
}
if (!PerformMatchMode2(out reason, time, mode))
{
EV.PostAlarmLog(Module, $"{Module}.{Name} Can not set mode, {reason}");
return false;
}
EV.PostInfoLog(Module, $"{Module}.{Name} set match mode2 to {mode}");
return true;
});
OP.Subscribe($"{Module}.{Name}.SetMatchLoad2", (out string reason, int time, object[] args) =>
{
reason = "";
float value = Convert.ToSingle((string)args[0]);
if (!PerformSetMatchLoad2(out reason, time, value))
{
EV.PostAlarmLog(Module, $"{Module}.{Name} Can not set mode, {reason}");
return false;
}
EV.PostInfoLog(Module, $"{Module}.{Name} set match load2 to {value}");
return true;
});
OP.Subscribe($"{Module}.{Name}.SetMatchTune2", (out string reason, int time, object[] args) =>
{
reason = "";
float value = Convert.ToSingle((string)args[0]);
if (!PerformSetMatchTune2(out reason, time, value))
{
EV.PostAlarmLog(Module, $"{Module}.{Name} Can not set mode, {reason}");
return false;
}
EV.PostInfoLog(Module, $"{Module}.{Name} set match tune2 to {value}");
return true;
});
return true;
}
private bool PerformSetMatchTune1(out string reason, int time, float value)
{
reason = string.Empty;
return true;
}
private bool PerformSetMatchLoad1(out string reason, int time, float value)
{
reason = string.Empty;
return true;
}
private bool PerformMatchMode1(out string reason, int time, EnumRfMatchTuneMode mode)
{
reason = string.Empty;
return true;
}
private bool PerformMatchMode2(out string reason, int time, EnumRfMatchTuneMode mode)
{
reason = string.Empty;
return true;
}
private bool PerformSetMatchLoad2(out string reason, int time, float value)
{
reason = string.Empty;
return true;
}
private bool PerformSetMatchTune2(out string reason, int time, float value)
{
reason = string.Empty;
return true;
}
private bool OnTimer()
{
try
{
_connection.MonitorTimeout();
if (!_connection.IsConnected || _connection.IsCommunicationError)
{
lock (_locker)
{
_lstHandler.Clear();
}
_trigRetryConnect.CLK = !_connection.IsConnected;
if (_trigRetryConnect.Q)
{
_connection.SetPortAddress(SC.GetStringValue($"{ScBasePath}.{Name}.Address"));
if (!_connection.Connect())
{
EV.PostAlarmLog(Module, $"Can not connect with {_connection.Address}, {Module}.{Name}");
}
}
return true;
}
HandlerBase handler = null;
if (!_connection.IsBusy)
{
lock (_locker)
{
if (_lstHandler.Count == 0)
{
_lstHandler.AddLast(new AeRfMatchQueryStatusHandler(this, _deviceAddress));
}
if (_lstHandler.Count > 0)
{
handler = _lstHandler.First.Value;
_lstHandler.RemoveFirst();
}
}
if (handler != null)
{
_connection.Execute(handler);
}
}
}
catch (Exception ex)
{
LOG.Write(ex);
}
return true;
}
public override void Monitor()
{
try
{
_connection.EnableLog(_enableLog);
_trigCommunicationError.CLK = _connection.IsCommunicationError;
if (_trigCommunicationError.Q)
{
EV.PostAlarmLog(Module, $"{Module}.{Name} communication error, {_connection.LastCommunicationError}");
}
}
catch (Exception ex)
{
LOG.Write(ex);
}
}
internal void NotePresetNumber(int presetNumber)
{
_presetNumber = presetNumber;
}
internal void NoteStatus(AEStatusData data)
{
_statusData = data;
}
public override void Reset()
{
_trigError.RST = true;
_trigWarningMessage.RST = true;
_connection.SetCommunicationError(false, "");
_trigCommunicationError.RST = true;
_enableLog = SC.GetValue<bool>($"{ScBasePath}.{Name}.EnableLogMessage");
_trigRetryConnect.RST = true;
base.Reset();
}
internal void NoteError(string reason)
{
_trigWarningMessage.CLK = true;
if (_trigWarningMessage.Q)
{
EV.PostWarningLog(Module, $"{Module}.{Name} error, {reason}");
}
}
public override void SetPreSetsAndTrajectories1(Presets presets)
{
lock (_locker)
{
_lstHandler.AddLast(new AeRfMatchSetPresetHandler(this, _deviceAddress, 1, presets));
}
}
public override void SetPreSetsAndTrajectories2(Presets presets)
{
lock (_locker)
{
_lstHandler.AddLast(new AeRfMatchSetPresetHandler(this, _deviceAddress, 2, presets));
}
}
public override void SetActivePresetNo1(int presetNumber)
{
lock (_locker)
{
_lstHandler.AddLast(new AeRfMatchSetActivePresetHandler(this, _deviceAddress, 1, presetNumber));
}
}
public override void SetActivePresetNo2(int presetNumber)
{
lock (_locker)
{
_lstHandler.AddLast(new AeRfMatchSetActivePresetHandler(this, _deviceAddress, 2, presetNumber));
}
}
public override void EnablePreset1(bool enable)
{
lock (_locker)
{
_lstHandler.AddLast(new AeRfMatchEnablePresetHandler(this, _deviceAddress, 1, enable));
}
}
public override void EnablePreset2(bool enable)
{
lock (_locker)
{
_lstHandler.AddLast(new AeRfMatchEnablePresetHandler(this, _deviceAddress, 2, enable));
}
}
public override void EnableCapacitorMove1(bool enable)
{
lock (_locker)
{
_lstHandler.AddLast(new AeRfMatchEnableCapMoveHandler(this, _deviceAddress, 1, enable));
}
}
public override void EnableCapacitorMove2(bool enable)
{
lock (_locker)
{
_lstHandler.AddLast(new AeRfMatchEnableCapMoveHandler(this, _deviceAddress, 2, enable));
}
}
public override void SetTuneMode1(EnumRfMatchTuneMode mode)
{
lock (_locker)
{
_lstHandler.AddLast(new AeRfMatchSetControlModeHandler(this, _deviceAddress, 1, mode));
}
}
public override void SetTuneMode2(EnumRfMatchTuneMode mode)
{
lock (_locker)
{
_lstHandler.AddLast(new AeRfMatchSetControlModeHandler(this, _deviceAddress, 2, mode));
}
}
public override void SetLoad1(float position)
{
lock (_locker)
{
_lstHandler.AddLast(new AeRfMatchSetLoadPositionHandler(this, _deviceAddress, 1, position));
}
}
public override void SetLoad2(float position)
{
lock (_locker)
{
_lstHandler.AddLast(new AeRfMatchSetLoadPositionHandler(this, _deviceAddress, 2, position));
}
}
public override void SetTune1(float position)
{
lock (_locker)
{
_lstHandler.AddLast(new AeRfMatchSetTunePositionHandler(this, _deviceAddress, 1, position));
}
}
public override void SetTune2(float position)
{
lock (_locker)
{
_lstHandler.AddLast(new AeRfMatchSetTunePositionHandler(this, _deviceAddress, 2, position));
}
}
}
}
@@ -0,0 +1,95 @@
using System.Collections.Generic;
using System.IO.Ports;
using Aitex.Core.RT.Log;
using MECF.Framework.Common.Communications;
namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.RFMatchs.AE
{
public class AeRfMatchMessage : BinaryMessage
{
public byte Header { get; set; }
public byte CommandNumber { get; set; }
public byte OptionLength { get; set; }
public byte[] Data { get; set; }
public byte CheckSum { get; set; }
public int Address { get; set; }
public int DataLength { get; set; }
public int MessageLength { get; set; }
}
public class AeRfMatchConnection : SerialPortConnectionBase
{
private List<byte> _lstCacheBuffer = new List<byte>();
public AeRfMatchConnection(string portName, int baudRate = 9600, int dataBits = 8, Parity parity = Parity.None, StopBits stopBits = StopBits.One)
: base(portName, baudRate, dataBits, parity, stopBits, "\r", false)
{
}
public override bool SendMessage(byte[] message)
{
_lstCacheBuffer.Clear();
return base.SendMessage(message);
}
protected override MessageBase ParseResponse(byte[] rawBuffer)
{
_lstCacheBuffer.AddRange(rawBuffer);
AeRfMatchMessage msg = new AeRfMatchMessage();
msg.RawMessage = rawBuffer;
if (_lstCacheBuffer.Count >= 1 && _lstCacheBuffer[0] == 0x06)
{
msg.IsAck = true;
_lstCacheBuffer.RemoveAt(0);
}
if (_lstCacheBuffer.Count < 4)
{
return msg;
}
msg.Header = _lstCacheBuffer[0];
msg.CommandNumber = _lstCacheBuffer[1];
msg.OptionLength = _lstCacheBuffer[2];
msg.Address = _lstCacheBuffer[0] >> 3;
msg.DataLength = (byte)(0x07 & _lstCacheBuffer[0]);
msg.MessageLength = 3 + msg.DataLength ;//3=包头+Cmd+校验
if (msg.DataLength >= 7)
{
msg.DataLength = _lstCacheBuffer[2];
msg.MessageLength = 4 + msg.DataLength ;//4=包头+Cmd+length+校验
}
if (_lstCacheBuffer.Count < msg.MessageLength)
return msg;
msg.Data = _lstCacheBuffer.GetRange(msg.DataLength >= 7 ? 3 : 2, msg.DataLength).ToArray();
byte sum = 0x00;
for (var i = 0; i < msg.MessageLength - 1; i++)
{
sum ^= _lstCacheBuffer[i];
}
if (_lstCacheBuffer[msg.MessageLength - 1] != sum)
{
LOG.Error($"check sum failed, ");
msg.IsFormatError = true;
_lstCacheBuffer.Clear();
return msg;
}
msg.IsResponse = true;
_lstCacheBuffer.RemoveRange(0, msg.MessageLength);
return msg;
}
}
}
@@ -0,0 +1,384 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Aitex.Core.Common.DeviceData;
using MECF.Framework.Common.Communications;
namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.RFMatchs.AE
{
public abstract class AeRfMatchHandler : HandlerBase
{
public AeRfMatch Device { get; }
private byte _address;
private byte _command;
protected AeRfMatchHandler(AeRfMatch device, byte address, byte command, byte[] data)
: base(BuildMessage(address, command, data))
{
Device = device;
_address = address;
_command = command;
}
private static byte[] BuildMessage(byte address, byte command, byte[] data)
{
List<byte> buffer = new List<byte>();
buffer.Add((byte)((address << 3) + (data == null ? 0 : data.Length)));
buffer.Add(command);
if (data != null && data.Length > 0)
{
buffer.AddRange(data);
}
buffer.Add(CalcSum(buffer, buffer.Count));
return buffer.ToArray();
}
//host->unit, unit->host(ack), unit->host(csr), host->unit(ack)
public override bool HandleMessage(MessageBase msg, out bool transactionComplete)
{
AeRfMatchMessage response = msg as AeRfMatchMessage;
ResponseMessage = msg;
if (response.IsAck)
{
SetState(EnumHandlerState.Acked);
}
if (response.Address != _address || response.CommandNumber != _command)
{
transactionComplete = false;
return false;
}
if (response.IsResponse)
{
if (response.DataLength >= 1)
{
ParseData(response);
}
SendAck();
SetState(EnumHandlerState.Completed);
transactionComplete = true;
return true;
}
transactionComplete = false;
return false;
}
protected virtual void ParseData(AeRfMatchMessage msg)
{
if (msg.Data[0] != 0)
{
var reason = TranslateCsrCode(msg.Data[0]);
Device.NoteError(reason);
}
}
public void SendAck()
{
Device.Connection.SendMessage(new byte[] { 0x06 });
}
private static byte CalcSum(List<byte> data, int length)
{
byte ret = 0x00;
for (var i = 0; i < length; i++)
{
ret ^= data[i];
}
return ret;
}
protected string TranslateCsrCode(int csrCode)
{
string ret = csrCode.ToString();
switch (csrCode)
{
case 0:
ret = null;//"Command accepted";
break;
case 1:
ret = "Control Code Is Incorrect";
break;
case 2:
ret = "Output Is On(Change Not Allowed)";
break;
case 4:
ret = "Data Is Out Of Range";
break;
case 7:
ret = "Active Fault(s) Exist";
break;
case 9:
ret = "Data Byte Count Is Incorrect";
break;
case 19:
ret = "Recipe Is Active(Change Not Allowed)";
break;
case 50:
ret = "The Frequency Is Out Of Range";
break;
case 51:
ret = "The Duty Cycle Is Out Of Range";
break;
case 53:
ret = "The Device Controlled By The Command Is Not Detected";
break;
case 99:
ret = "Command Not Accepted(There Is No Such Command)";
break;
default:
break;
}
return ret;
}
}
//91 set active preset number
public class AeRfMatchSetActivePresetHandler : AeRfMatchHandler
{
public AeRfMatchSetActivePresetHandler(AeRfMatch device, byte address, byte network, int number)
: base(device, address, 91, BuildData(network, number))
{
Name = "set active preset number";
}
private static byte[] BuildData(byte network, int number)
{
return new byte[] { network, 0, (byte)number, 0 };
}
}
//92 set preset
public class AeRfMatchSetPresetHandler : AeRfMatchHandler
{
public AeRfMatchSetPresetHandler(AeRfMatch device, byte address, byte network, Presets data)
: base(device, address, 92, BuildData(network, data))
{
Name = "set active preset number";
}
private static byte[] BuildData(byte network, Presets data)
{
List<byte> lstData = new List<byte>();
lstData.AddRange(new byte[]{ network, 0, data.PreNo, data.TraSum });
int tempdata = (int)(data.LoadData * 100);
lstData.Add((byte)tempdata);
lstData.Add((byte)(tempdata >> 8));
tempdata = (int)(data.TuneData * 100);
lstData.Add((byte)tempdata);
lstData.Add((byte)(tempdata >> 8));
for (int i = 0; i < data.TraSum; i++)
{
tempdata = (int)(data.TraData[i, 0] * 100);
lstData.Add((byte)tempdata);
lstData.Add((byte)(tempdata >> 8));
tempdata = (int)(data.TraData[i, 1] * 100);
lstData.Add((byte)tempdata);
lstData.Add((byte)(tempdata >> 8));
}
return lstData.ToArray();
}
}
//93 control mode
public class AeRfMatchSetControlModeHandler : AeRfMatchHandler
{
public AeRfMatchSetControlModeHandler(AeRfMatch device, byte address, byte network, EnumRfMatchTuneMode mode)
: base(device, address, 93, BuildData(network, mode))
{
Name = "Set control mode";
}
private static byte[] BuildData(byte network, EnumRfMatchTuneMode mode)
{
byte setpoint = 0;
switch (mode)
{
case EnumRfMatchTuneMode.Auto:
setpoint = 1;
break;
case EnumRfMatchTuneMode.Manual:
setpoint = 2;
break;
}
return new byte[]{network, 0, setpoint, 0};
}
}
//94 enable presets
public class AeRfMatchEnablePresetHandler : AeRfMatchHandler
{
public AeRfMatchEnablePresetHandler(AeRfMatch device, byte address, byte network, bool enable)
: base(device, address, 94, BuildData(network, enable))
{
Name = "enable preset";
}
private static byte[] BuildData(byte network, bool enable)
{
return new byte[] { network, 0, enable?(byte)0x1: (byte)0x0, 0 };
}
}
//98 enable motor move
public class AeRfMatchEnableCapMoveHandler : AeRfMatchHandler
{
public AeRfMatchEnableCapMoveHandler(AeRfMatch device, byte address, byte network, bool enable)
: base(device, address, 98, BuildData(network, enable))
{
Name = "enable motor move";
}
private static byte[] BuildData(byte network, bool enable)
{
return new byte[] { network, 0, enable ? (byte)0x1 : (byte)0x0, 0 };
}
}
//112 set load position
public class AeRfMatchSetLoadPositionHandler : AeRfMatchHandler
{
public AeRfMatchSetLoadPositionHandler(AeRfMatch device, byte address, byte network, float position)
: base(device, address, 112, BuildData(network, position))
{
Name = "set load position";
}
private static byte[] BuildData(byte network, float position)
{
int iposi = (int)(position * 100);
return new byte[] { network, 0, (byte)iposi, (byte)(iposi >> 8) };
}
}
//122 set tune position
public class AeRfMatchSetTunePositionHandler : AeRfMatchHandler
{
public AeRfMatchSetTunePositionHandler(AeRfMatch device, byte address, byte network, float position)
: base(device, address, 122, BuildData(network, position))
{
Name = "set tune position";
}
private static byte[] BuildData(byte network, float position)
{
int iposi = (int)(position * 100);
return new byte[] { network, 0, (byte)iposi, (byte)(iposi >> 8) };
}
}
//161 query preset no
public class AeRfMatchQueryPresetNumberHandler : AeRfMatchHandler
{
public AeRfMatchQueryPresetNumberHandler(AeRfMatch device, byte address)
: base(device, address, 161, null)
{
Name = "query preset mode";
}
protected override void ParseData(AeRfMatchMessage response)
{
if (response.DataLength != 4)
{
Device.NoteError($"{Name}, return data length {response.DataLength}");
}
else
{
Device.NotePresetNumber(response.Data[2] + (response.Data[3] << 8));
}
}
}
//219 query status
public class AeRfMatchQueryStatusHandler : AeRfMatchHandler
{
private AEStatusData _statusData;
public AeRfMatchQueryStatusHandler(AeRfMatch device, byte address)
: base(device, address, 219, null)
{
Name = "query status";
}
protected override void ParseData(AeRfMatchMessage response)
{
if (response.DataLength != 88)
{
Device.NoteError($"{Name}, return data length {response.DataLength}");
}
else
{
var retData = response.Data;
_statusData = new AEStatusData();
_statusData.LoadPosi1 = (retData[4] + (retData[5] << 8)) / 100f;
_statusData.TunePosi1 = (retData[6] + (retData[7] << 8)) / 100f;
_statusData.LoadPosi2 = (retData[12] + (retData[13] << 8)) / 100f;
_statusData.TunePosi2 = (retData[14] + (retData[15] << 8)) / 100f;
_statusData.BiasPeak = (retData[20] + (retData[21] << 8)) / 100f;
_statusData.DCBias = (retData[22] + (retData[23] << 8)) / 100f;
_statusData.ZScanII.R1 = BitConverter.ToSingle(retData.ToArray(), 40);
_statusData.ZScanII.X1 = BitConverter.ToSingle(retData.ToArray(), 44);
_statusData.ZScanII.Voltage1 = BitConverter.ToSingle(retData.ToArray(), 48) * 1.41421f;
_statusData.ZScanII.Current1 = BitConverter.ToSingle(retData.ToArray(), 52);
_statusData.ZScanII.Phase1 = BitConverter.ToSingle(retData.ToArray(), 56);
_statusData.ZScanII.Power1 = BitConverter.ToSingle(retData.ToArray(), 60);
_statusData.ZScanII.R2 = BitConverter.ToSingle(retData.ToArray(), 64);
_statusData.ZScanII.X2 = BitConverter.ToSingle(retData.ToArray(), 68);
_statusData.ZScanII.Voltage2 = BitConverter.ToSingle(retData.ToArray(), 72);
_statusData.ZScanII.Current2 = BitConverter.ToSingle(retData.ToArray(), 76);
_statusData.ZScanII.Phase2 = BitConverter.ToSingle(retData.ToArray(), 80);
_statusData.ZScanII.Power2 = BitConverter.ToSingle(retData.ToArray(), 84);
AnalysisAEMatchStatus(retData);
Device.NoteStatus(_statusData);
}
}
private void AnalysisAEMatchStatus(byte[] sts)
{
_statusData.Status2.Net1OutPutOn = ((sts[0] >> 0) & 0x01) == 0x01 ? true : false;
_statusData.Status2.Net1OutPutTuned = ((sts[0] >> 1) & 0x01) == 0x01 ? true : false;
_statusData.Status2.Net2OutPutOn = ((sts[0] >> 2) & 0x01) == 0x01 ? true : false;
_statusData.Status2.Net2OutPutTuned = ((sts[0] >> 3) & 0x01) == 0x01 ? true : false;
//RecvData.Status2.Net2OutPutOn = ((sts[0] >> 4) & 0x01) == 0x01 ? true : false;
//RecvData.Status2.Net2OutPutTuned = ((sts[0] >> 5) & 0x01) == 0x01 ? true : false;
_statusData.Status2.Net1PresetsActive = ((sts[0] >> 6) & 0x01) == 0x01 ? true : false;
_statusData.Status2.Net1ExtPresetsSelected = ((sts[0] >> 7) & 0x01) == 0x01 ? true : false;
_statusData.Status2.Low24VDetected = ((sts[1] >> 0) & 0x01) == 0x01 ? true : false;
_statusData.Status2.OverTempDetected = ((sts[1] >> 1) & 0x01) == 0x01 ? true : false;
_statusData.Status2.InterlockOpen = ((sts[1] >> 2) & 0x01) == 0x01 ? true : false;
_statusData.Status2.FanFault = ((sts[1] >> 3) & 0x01) == 0x01 ? true : false;
_statusData.Status2.Net1AutoMode = ((sts[1] >> 4) & 0x01) == 0x01 ? true : false;
_statusData.Status2.Net1HostCtrlMode = ((sts[1] >> 5) & 0x01) == 0x01 ? true : false;
_statusData.Status2.Net2AutoMode = ((sts[1] >> 6) & 0x01) == 0x01 ? true : false;
_statusData.Status2.Net2HostCtrlMode = ((sts[1] >> 7) & 0x01) == 0x01 ? true : false;
_statusData.Status2.AuxCapOutputTuned = ((sts[2] >> 0) & 0x01) == 0x01 ? true : false;
_statusData.Status2.AuxCapAutoModed = ((sts[2] >> 1) & 0x01) == 0x01 ? true : false;
_statusData.Status2.AuxCapPresetsActive = ((sts[2] >> 2) & 0x01) == 0x01 ? true : false;
//RecvData.Status2.FanFault = ((sts[1] >> 3) & 0x01) == 0x01 ? true : false;
//RecvData.Status2.Net1AutoMode = ((sts[1] >> 4) & 0x01) == 0x01 ? true : false;
_statusData.Status2.Net1UserCtrlMode = ((sts[2] >> 5) & 0x01) == 0x01 ? true : false;
_statusData.Status2.Net2UserCtrlMode = ((sts[2] >> 6) & 0x01) == 0x01 ? true : false;
//RecvData.Status2.Net2HostCtrlMode = ((sts[2] >> 7) & 0x01) == 0x01 ? true : false;
_statusData.Status2.Faults = ((sts[3] >> 0) & 0x01) == 0x01 ? true : false;
_statusData.Status2.Warning = ((sts[3] >> 1) & 0x01) == 0x01 ? true : false;
_statusData.Status2.InitMotorFailed = ((sts[3] >> 2) & 0x01) == 0x01 ? true : false;
_statusData.Status2.Net2PresetsActive = ((sts[3] >> 3) & 0x01) == 0x01 ? true : false;
_statusData.Status2.Net2ExtPresetsSelected = ((sts[3] >> 4) & 0x01) == 0x01 ? true : false;
_statusData.Status2.VoltageOverLimitFault = ((sts[3] >> 5) & 0x01) == 0x01 ? true : false;
//RecvData.Status2.Net2AutoMode = ((sts[3] >> 6) & 0x01) == 0x01 ? true : false;
//RecvData.Status2.Net2HostCtrlMode = ((sts[3] >> 7) & 0x01) == 0x01 ? true : false;
}
}
}
@@ -0,0 +1,83 @@
namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.RFMatchs.AE
{
public struct AENavigatorMatchSts
{
public bool Net1OutPutOn;
public bool Net1OutPutTuned;
public bool Net2OutPutOn;
public bool Net2OutPutTuned;
public bool Net1PresetsActive;
public bool Net1ExtPresetsSelected;
public bool Low24VDetected;
public bool OverTempDetected;
public bool InterlockOpen;
public bool FanFault;
public bool Net1AutoMode;
public bool Net1HostCtrlMode;
public bool Net2AutoMode;
public bool Net2HostCtrlMode;
public bool AuxCapOutputTuned;
public bool AuxCapAutoModed;
public bool AuxCapPresetsActive;
public bool Net1UserCtrlMode;
public bool Net2UserCtrlMode;
public bool Faults;
public bool Warning;
public bool InitMotorFailed;
public bool Net2PresetsActive;
public bool Net2ExtPresetsSelected;
public bool VoltageOverLimitFault;
}
public struct AENavioMatchSts
{
public bool RF_On;
public bool Tuned;
public bool AutoMode;
public bool SerialMode;
public bool AnalogMode;
public bool EnPresets;
public bool GenFaultSts;
public bool PresetAct;
public bool EnMotorMove;
public bool Low24VFault;
public bool NOVRAMFault;
public bool OverTFault;
public bool TuneVFault;
public bool OutputIFault;
public bool MotorInitFault;
}
public struct AEMatchZScanII
{
public float R1;
public float X1;
public float Voltage1;
public float Current1;
public float Phase1;
public float Power1;
public float R2;
public float X2;
public float Voltage2;
public float Current2;
public float Phase2;
public float Power2;
}
public struct AEStatusData
{
public float BiasPeak; //RF峰值
public float DCBias; //偏压值
public float LoadPosi1; //Load电容位置
public float TunePosi1; //Tune电容位置
public float LoadPosi2; //Load电容位置
public float TunePosi2; //Tune电容位置
public float PreLoad1; //Load电容位置
public float PreTune1; //Tune电容位置
public AENavioMatchSts Status1; //当前状态
public AENavigatorMatchSts Status2; //当前状态
public AEMatchZScanII ZScanII;
public bool Online; //设备在线
}
}