|
@@ -30,7 +30,7 @@ namespace Venus_RT.Devices
|
|
{
|
|
{
|
|
this.Status = GeneratorStatus.Unknown;
|
|
this.Status = GeneratorStatus.Unknown;
|
|
var portNum = SC.GetStringValue(device == VenusDevice.Rf ? $"{mod}.Rf.Port" : $"{mod}.BiasRf.Port");
|
|
var portNum = SC.GetStringValue(device == VenusDevice.Rf ? $"{mod}.Rf.Port" : $"{mod}.BiasRf.Port");
|
|
- _serial = new AsyncSerialPort(portNum, 9600, 8, System.IO.Ports.Parity.None, System.IO.Ports.StopBits.One,"/r", false);
|
|
|
|
|
|
+ _serial = new AsyncSerialPort(portNum, 9600, 8, System.IO.Ports.Parity.None, System.IO.Ports.StopBits.One, "/r", false);
|
|
}
|
|
}
|
|
public override bool Initialize()
|
|
public override bool Initialize()
|
|
{
|
|
{
|
|
@@ -49,7 +49,7 @@ namespace Venus_RT.Devices
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
return true;
|
|
-
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
public new AITRfData DeviceData =>
|
|
public new AITRfData DeviceData =>
|
|
new AITRfData
|
|
new AITRfData
|
|
@@ -67,22 +67,22 @@ namespace Venus_RT.Devices
|
|
try
|
|
try
|
|
{
|
|
{
|
|
buffer.AddRange(rawMessage);
|
|
buffer.AddRange(rawMessage);
|
|
- while (buffer.Count >= 18) //至少包含帧头(2字节)、长度(1字节)、校验位(1字节);根据设计不同而不同
|
|
|
|
|
|
+ while (buffer.Count >= 18) //至少包含ACK帧头(1字节)、长度、校验位(17或12字节)
|
|
{
|
|
{
|
|
- //2.1 查找数据头
|
|
|
|
- if (buffer[0] == 0x06) //传输数据有帧头,用于判断
|
|
|
|
- {
|
|
|
|
- //得到完整的数据,复制到ReceiveBytes中进行校验
|
|
|
|
- byte[] ReceiveBytes = new byte[13];
|
|
|
|
- byte[] ReadReceiveBytes = new byte[18];
|
|
|
|
-
|
|
|
|
- buffer.CopyTo(0, ReceiveBytes, 0, 13);
|
|
|
|
- buffer.CopyTo(0, ReadReceiveBytes, 0, 18);
|
|
|
|
- if ((ReceiveBytes[12] == 0x55)&& (ReceiveBytes[1] == 0xAA)) //校验失败,最后一个字节是校验位
|
|
|
|
|
|
+ //2.1 查找数据头
|
|
|
|
+ if (buffer[0] == 0x06) //传输数据有帧头,用于判断
|
|
|
|
+ {
|
|
|
|
+ //得到完整的数据,复制到ReceiveBytes中进行校验
|
|
|
|
+ byte[] ReceiveBytes = new byte[13];
|
|
|
|
+ byte[] ReadReceiveBytes = new byte[18];
|
|
|
|
+
|
|
|
|
+ buffer.CopyTo(0, ReceiveBytes, 0, 13);
|
|
|
|
+ buffer.CopyTo(0, ReadReceiveBytes, 0, 18);
|
|
|
|
+ if ((ReceiveBytes[12] == 0x55) && (ReceiveBytes[1] == 0xAA)) //校验,最后一个字节是校验位
|
|
{
|
|
{
|
|
parsecmd(ReceiveBytes);
|
|
parsecmd(ReceiveBytes);
|
|
buffer.RemoveRange(0, 13);
|
|
buffer.RemoveRange(0, 13);
|
|
-
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
else if ((ReadReceiveBytes[17] == 0x55) && (ReceiveBytes[1] == 0xAA))
|
|
else if ((ReadReceiveBytes[17] == 0x55) && (ReceiveBytes[1] == 0xAA))
|
|
{
|
|
{
|
|
@@ -94,21 +94,18 @@ namespace Venus_RT.Devices
|
|
buffer.Clear();
|
|
buffer.Clear();
|
|
LOG.Write(eEvent.ERR_RF, Module, $"rf通讯错误");
|
|
LOG.Write(eEvent.ERR_RF, Module, $"rf通讯错误");
|
|
}
|
|
}
|
|
-
|
|
|
|
-
|
|
|
|
- ///执行对数据进行处理操作RunReceiveDataCallback(ReceiveBytes);
|
|
|
|
- }
|
|
|
|
- else //帧头不正确时,记得清除
|
|
|
|
- {
|
|
|
|
- //buffer.RemoveAt(0);
|
|
|
|
|
|
+ }
|
|
|
|
+ else //帧头不正确时,记得清除
|
|
|
|
+ {
|
|
|
|
+ //buffer.RemoveAt(0);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- }
|
|
|
|
catch (Exception ex)
|
|
catch (Exception ex)
|
|
{
|
|
{
|
|
buffer.Clear();
|
|
buffer.Clear();
|
|
LOG.WriteExeption(ex);
|
|
LOG.WriteExeption(ex);
|
|
- }
|
|
|
|
|
|
+ }
|
|
}
|
|
}
|
|
public GeneratorStatus Status { get; set; }
|
|
public GeneratorStatus Status { get; set; }
|
|
private bool GetBitValue(byte value, int bit)
|
|
private bool GetBitValue(byte value, int bit)
|
|
@@ -122,9 +119,9 @@ namespace Venus_RT.Devices
|
|
}
|
|
}
|
|
public void parsecmd(byte[] message)
|
|
public void parsecmd(byte[] message)
|
|
{
|
|
{
|
|
- try
|
|
|
|
|
|
+ try
|
|
{
|
|
{
|
|
- IsPowerOn = GetBitValue(message[4], 4);
|
|
|
|
|
|
+ IsPowerOn = GetBitValue(message[4], 4);
|
|
if (GetBitValue(message[4], 4))
|
|
if (GetBitValue(message[4], 4))
|
|
{
|
|
{
|
|
Status = GeneratorStatus.ON;
|
|
Status = GeneratorStatus.ON;
|
|
@@ -137,11 +134,12 @@ namespace Venus_RT.Devices
|
|
switch (message[5])
|
|
switch (message[5])
|
|
{
|
|
{
|
|
case 0x01://ParamRead
|
|
case 0x01://ParamRead
|
|
- if (message.Length == 18 && message[6]==0x14)
|
|
|
|
|
|
+ if (message.Length == 18 && message[6] == 0x14)
|
|
{
|
|
{
|
|
int DataValue = BitConverter.ToInt32(new byte[] { message[11], message[12], message[13], message[14] }, 0);
|
|
int DataValue = BitConverter.ToInt32(new byte[] { message[11], message[12], message[13], message[14] }, 0);
|
|
ReflectPower = DataValue;
|
|
ReflectPower = DataValue;
|
|
- }else if (message.Length == 18 && message[6] == 0x12)
|
|
|
|
|
|
+ }
|
|
|
|
+ else if (message.Length == 18 && message[6] == 0x12)
|
|
{
|
|
{
|
|
int DataValue1 = BitConverter.ToInt32(new byte[] { message[11], message[12], message[13], message[14] }, 0);
|
|
int DataValue1 = BitConverter.ToInt32(new byte[] { message[11], message[12], message[13], message[14] }, 0);
|
|
ForwardPower = DataValue1;
|
|
ForwardPower = DataValue1;
|
|
@@ -171,7 +169,7 @@ namespace Venus_RT.Devices
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- catch (Exception ex)
|
|
|
|
|
|
+ catch (Exception ex)
|
|
{
|
|
{
|
|
LOG.WriteExeption(ex);
|
|
LOG.WriteExeption(ex);
|
|
}
|
|
}
|
|
@@ -190,7 +188,7 @@ namespace Venus_RT.Devices
|
|
byte[] valueBytes = BitConverter.GetBytes((int)val);
|
|
byte[] valueBytes = BitConverter.GetBytes((int)val);
|
|
baseBytes.AddRange(valueBytes);
|
|
baseBytes.AddRange(valueBytes);
|
|
baseBytes = CRC16(baseBytes.ToArray());
|
|
baseBytes = CRC16(baseBytes.ToArray());
|
|
- baseBytes.Add(0x55);
|
|
|
|
|
|
+ baseBytes.Add(0x55);
|
|
_serial.Write(baseBytes.ToArray());
|
|
_serial.Write(baseBytes.ToArray());
|
|
}
|
|
}
|
|
public override void Monitor()
|
|
public override void Monitor()
|
|
@@ -230,7 +228,7 @@ namespace Venus_RT.Devices
|
|
_serial.Write(getincontrol.ToArray());
|
|
_serial.Write(getincontrol.ToArray());
|
|
}
|
|
}
|
|
public override bool SetPowerOnOff(bool on, out string str)
|
|
public override bool SetPowerOnOff(bool on, out string str)
|
|
- {
|
|
|
|
|
|
+ {
|
|
str = "";
|
|
str = "";
|
|
var _chamber = DEVICE.GetDevice<JetPMBase>(Module);
|
|
var _chamber = DEVICE.GetDevice<JetPMBase>(Module);
|
|
if (on && !_chamber.CheckGeneratorAndHVInterlock(VenusDevice.Rf))
|
|
if (on && !_chamber.CheckGeneratorAndHVInterlock(VenusDevice.Rf))
|
|
@@ -240,7 +238,7 @@ namespace Venus_RT.Devices
|
|
getcontrol();
|
|
getcontrol();
|
|
List<byte> baseBytes = new List<byte>() { 0xAA, 0x02, 0x0B, 0x00, 0x02, 0x6F, 0x00, 0x01, 0x00, 0x07 };
|
|
List<byte> baseBytes = new List<byte>() { 0xAA, 0x02, 0x0B, 0x00, 0x02, 0x6F, 0x00, 0x01, 0x00, 0x07 };
|
|
if (on == true)
|
|
if (on == true)
|
|
- {
|
|
|
|
|
|
+ {
|
|
baseBytes.AddRange(new List<byte> { 0x01, 0x00, 0x00, 0x00 });
|
|
baseBytes.AddRange(new List<byte> { 0x01, 0x00, 0x00, 0x00 });
|
|
}
|
|
}
|
|
else
|
|
else
|
|
@@ -275,7 +273,7 @@ namespace Venus_RT.Devices
|
|
public override void SetPulseRateFreq(int nFreq)
|
|
public override void SetPulseRateFreq(int nFreq)
|
|
{
|
|
{
|
|
if (nFreq > 0)
|
|
if (nFreq > 0)
|
|
- {
|
|
|
|
|
|
+ {
|
|
List<byte> baseBytes = new List<byte>() { 0xAA, 0x02, 0x0B, 0x00, 0x02, 0x6C, 0x01, 0x01, 0x00, 0x04 };
|
|
List<byte> baseBytes = new List<byte>() { 0xAA, 0x02, 0x0B, 0x00, 0x02, 0x6C, 0x01, 0x01, 0x00, 0x04 };
|
|
byte[] valueBytes = BitConverter.GetBytes(nFreq);
|
|
byte[] valueBytes = BitConverter.GetBytes(nFreq);
|
|
baseBytes.AddRange(valueBytes);
|
|
baseBytes.AddRange(valueBytes);
|
|
@@ -402,7 +400,7 @@ namespace Venus_RT.Devices
|
|
public TruPlasmaMatch(ModuleName mod, VenusDevice device) : base(mod.ToString(), device.ToString())
|
|
public TruPlasmaMatch(ModuleName mod, VenusDevice device) : base(mod.ToString(), device.ToString())
|
|
{
|
|
{
|
|
var portNum = SC.GetStringValue($"{mod}.{device}.Port");
|
|
var portNum = SC.GetStringValue($"{mod}.{device}.Port");
|
|
- _serial = new AsyncSerialPort(portNum, 9600, 8, System.IO.Ports.Parity.None, System.IO.Ports.StopBits.One, "/r", false);
|
|
|
|
|
|
+ _serial = new AsyncSerialPort(portNum, 9600, 8, System.IO.Ports.Parity.None, System.IO.Ports.StopBits.One, "/r", false);
|
|
intervalTime = 100;
|
|
intervalTime = 100;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -468,7 +466,7 @@ namespace Venus_RT.Devices
|
|
|
|
|
|
public override void Monitor()
|
|
public override void Monitor()
|
|
{
|
|
{
|
|
- ReadPosition(40,20);
|
|
|
|
|
|
+ ReadPosition(40, 20);//0x10 (present mode)CMD 可实现任意模式下只读不设值,0x08(auto then manual)在auto模式下可实现相同功能
|
|
}
|
|
}
|
|
|
|
|
|
public override void Terminate()
|
|
public override void Terminate()
|
|
@@ -487,8 +485,7 @@ namespace Venus_RT.Devices
|
|
///
|
|
///
|
|
private void executeMatchPostion(float c1, float c2)
|
|
private void executeMatchPostion(float c1, float c2)
|
|
{
|
|
{
|
|
- SetPositionManual(c1, c2);
|
|
|
|
- SetPositionManualAuto(c1, c2);
|
|
|
|
|
|
+ SetPositionManualAuto(c1, c2);
|
|
}
|
|
}
|
|
public override void SetMatchPosition(float c1, float c2, out string reason)
|
|
public override void SetMatchPosition(float c1, float c2, out string reason)
|
|
{
|
|
{
|
|
@@ -505,17 +502,17 @@ namespace Venus_RT.Devices
|
|
//
|
|
//
|
|
private void SerialBinaryPortDataReceived(byte[] message)
|
|
private void SerialBinaryPortDataReceived(byte[] message)
|
|
{
|
|
{
|
|
- if (message.Count()<29)
|
|
|
|
|
|
+ if (message.Count() < 29)
|
|
{
|
|
{
|
|
LOG.Write(eEvent.ERR_RF, Module, "收到 Match 数据为空");
|
|
LOG.Write(eEvent.ERR_RF, Module, "收到 Match 数据为空");
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- else
|
|
|
|
|
|
+ else
|
|
{
|
|
{
|
|
try
|
|
try
|
|
{
|
|
{
|
|
buffer.AddRange(message);
|
|
buffer.AddRange(message);
|
|
- while (buffer.Count >= 29) //至少包含帧头(2字节)、长度(1字节)、校验位(1字节);根据设计不同而不同
|
|
|
|
|
|
+ while (buffer.Count >= 29) //至少包含帧头(1字节)、长度(1字节)、其余27字节
|
|
{
|
|
{
|
|
//2.1 查找数据头
|
|
//2.1 查找数据头
|
|
if (buffer[0] == 0x1D && buffer[1] == 0xE2) //传输数据有帧头,用于判断
|
|
if (buffer[0] == 0x1D && buffer[1] == 0xE2) //传输数据有帧头,用于判断
|
|
@@ -526,21 +523,21 @@ namespace Venus_RT.Devices
|
|
TunePosition1 = BitConverter.ToSingle(new byte[] { ReceiveBytes[10], ReceiveBytes[11], ReceiveBytes[12], ReceiveBytes[13] }, 0) * 100;
|
|
TunePosition1 = BitConverter.ToSingle(new byte[] { ReceiveBytes[10], ReceiveBytes[11], ReceiveBytes[12], ReceiveBytes[13] }, 0) * 100;
|
|
TunePosition2 = BitConverter.ToSingle(new byte[] { ReceiveBytes[14], ReceiveBytes[15], ReceiveBytes[16], ReceiveBytes[17] }, 0) * 100;
|
|
TunePosition2 = BitConverter.ToSingle(new byte[] { ReceiveBytes[14], ReceiveBytes[15], ReceiveBytes[16], ReceiveBytes[17] }, 0) * 100;
|
|
buffer.RemoveRange(0, 29);
|
|
buffer.RemoveRange(0, 29);
|
|
- switch (message[7])
|
|
|
|
- {
|
|
|
|
- case 0x01:
|
|
|
|
- this.WorkMode = EnumRfMatchTuneMode.Manual;
|
|
|
|
- break;
|
|
|
|
- case 0x02:
|
|
|
|
- this.WorkMode = EnumRfMatchTuneMode.Auto;
|
|
|
|
- break;
|
|
|
|
- case 0x20:
|
|
|
|
- this.WorkMode = EnumRfMatchTuneMode.Undefined;
|
|
|
|
- break;
|
|
|
|
- default:
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ switch (ReceiveBytes[19])
|
|
|
|
+ {
|
|
|
|
+ case 0x01:
|
|
|
|
+ this.WorkMode = EnumRfMatchTuneMode.Manual;
|
|
|
|
+ break;
|
|
|
|
+ case 0x02:
|
|
|
|
+ this.WorkMode = EnumRfMatchTuneMode.Auto;
|
|
|
|
+ break;
|
|
|
|
+ case 0x20:
|
|
|
|
+ this.WorkMode = EnumRfMatchTuneMode.Undefined;
|
|
|
|
+ break;
|
|
|
|
+ default:
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
else //帧头不正确时,记得清除
|
|
else //帧头不正确时,记得清除
|
|
{
|
|
{
|
|
buffer.Clear();
|
|
buffer.Clear();
|
|
@@ -553,7 +550,7 @@ namespace Venus_RT.Devices
|
|
buffer.Clear();
|
|
buffer.Clear();
|
|
LOG.WriteExeption(ex);
|
|
LOG.WriteExeption(ex);
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
private void SerialPortErrorOccurred(string str)
|
|
private void SerialPortErrorOccurred(string str)
|
|
@@ -569,7 +566,7 @@ namespace Venus_RT.Devices
|
|
byte[] val1Bytes = BitConverter.GetBytes(c1val / 100);
|
|
byte[] val1Bytes = BitConverter.GetBytes(c1val / 100);
|
|
byte[] val2Bytes = BitConverter.GetBytes(c2val / 100);
|
|
byte[] val2Bytes = BitConverter.GetBytes(c2val / 100);
|
|
List<byte> Act = new List<byte>() { 0x00 };
|
|
List<byte> Act = new List<byte>() { 0x00 };
|
|
- List<byte> Ctr123 = new List<byte> { 0x08, 0x00, 0x00 };
|
|
|
|
|
|
+ List<byte> Ctr123 = new List<byte> { 0x01, 0x00, 0x00 };
|
|
List<byte> baseBytes = new List<byte>() { };
|
|
List<byte> baseBytes = new List<byte>() { };
|
|
baseBytes.AddRange(Len);
|
|
baseBytes.AddRange(Len);
|
|
baseBytes.AddRange(DstSrc);
|
|
baseBytes.AddRange(DstSrc);
|
|
@@ -594,8 +591,8 @@ namespace Venus_RT.Devices
|
|
}
|
|
}
|
|
private void SetPositionManualAuto(float c1val, float c2val)
|
|
private void SetPositionManualAuto(float c1val, float c2val)
|
|
{
|
|
{
|
|
- List<byte> Len = new List<byte>() { 0x16, 0xE9};
|
|
|
|
- List<byte> DstSrc = new List<byte>() { 0x00, 0x02, 0x00, 0x01};
|
|
|
|
|
|
+ List<byte> Len = new List<byte>() { 0x16, 0xE9 };
|
|
|
|
+ List<byte> DstSrc = new List<byte>() { 0x00, 0x02, 0x00, 0x01 };
|
|
List<byte> Cmd = new List<byte> { 0x60, 0x40 };
|
|
List<byte> Cmd = new List<byte> { 0x60, 0x40 };
|
|
byte[] val1Bytes = BitConverter.GetBytes(c1val / 100);
|
|
byte[] val1Bytes = BitConverter.GetBytes(c1val / 100);
|
|
byte[] val2Bytes = BitConverter.GetBytes(c2val / 100);
|
|
byte[] val2Bytes = BitConverter.GetBytes(c2val / 100);
|
|
@@ -610,13 +607,13 @@ namespace Venus_RT.Devices
|
|
baseBytes.AddRange(Act);
|
|
baseBytes.AddRange(Act);
|
|
baseBytes.AddRange(Ctr123);
|
|
baseBytes.AddRange(Ctr123);
|
|
int a = 0;
|
|
int a = 0;
|
|
- for (int i=2; i< baseBytes.Count;i++)
|
|
|
|
|
|
+ for (int i = 2; i < baseBytes.Count; i++)
|
|
{
|
|
{
|
|
- a+=(Int16)baseBytes[i];
|
|
|
|
|
|
+ a += (Int16)baseBytes[i];
|
|
}
|
|
}
|
|
- byte []ackture= new byte[2];
|
|
|
|
-
|
|
|
|
- byte[]ackbyte= BitConverter.GetBytes(a);
|
|
|
|
|
|
+ byte[] ackture = new byte[2];
|
|
|
|
+
|
|
|
|
+ byte[] ackbyte = BitConverter.GetBytes(a);
|
|
ackture[0] = ackbyte[1];
|
|
ackture[0] = ackbyte[1];
|
|
ackture[1] = ackbyte[0];
|
|
ackture[1] = ackbyte[0];
|
|
baseBytes.AddRange(ackture);
|
|
baseBytes.AddRange(ackture);
|