|
@@ -40,9 +40,13 @@ namespace CyberX8_Simulator.Devices
|
|
|
private byte _currentStep = 0;
|
|
|
private int _currentLength = 0;
|
|
|
private DateTime _currentTime = DateTime.Now;
|
|
|
+ private bool _isGoldPower = false;
|
|
|
|
|
|
private System.Timers.Timer _timer;
|
|
|
- private byte[] _powerSupplierSetPoint = new byte[4];//记录每次设置的电流值
|
|
|
+ /// <summary>
|
|
|
+ /// 记录每次设置的电流值
|
|
|
+ /// </summary>
|
|
|
+ private byte[] _powerSupplierSetPoint = new byte[4];
|
|
|
|
|
|
public PowerSupplierSocketSimulator(int port):base(port)
|
|
|
{
|
|
@@ -140,6 +144,7 @@ namespace CyberX8_Simulator.Devices
|
|
|
}
|
|
|
else if(startAddress == GOLD_CURRENT_SETTING_ADDRESS)
|
|
|
{
|
|
|
+ _isGoldPower = true;
|
|
|
OnWriteMessage(CreateReadResponse(flag, channel, command, registerCount, _powerSupplierSetPoint));
|
|
|
return;
|
|
|
}
|
|
@@ -183,7 +188,15 @@ namespace CyberX8_Simulator.Devices
|
|
|
{
|
|
|
if (_powerSupplierDic[channel].RunModel == 1)
|
|
|
{
|
|
|
- _powerSupplierDic[channel].Current = _powerSupplierDic[channel].CurrentSetting * 10;
|
|
|
+ if (_isGoldPower)
|
|
|
+ {
|
|
|
+ int count = byteTransform.TransInt32(_powerSupplierSetPoint, 0);
|
|
|
+ _powerSupplierDic[channel].Current = count / 100;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ _powerSupplierDic[channel].Current = _powerSupplierDic[channel].CurrentSetting * 10;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
else
|