|
|
@@ -52,7 +52,7 @@ namespace PunkHPX8_Simulator.Devices
|
|
|
private int _currentLength = 0;
|
|
|
private DateTime _currentTime = DateTime.Now;
|
|
|
private bool _isGoldPower = false;
|
|
|
- private int _currentSetScale;
|
|
|
+ private int _currentSetScale= 1000;
|
|
|
|
|
|
private int _highSetScale=1000;
|
|
|
private int _middleSetScale=100000;
|
|
|
@@ -69,7 +69,8 @@ namespace PunkHPX8_Simulator.Devices
|
|
|
{
|
|
|
PowerSupplierData powerSupplierData1 = new PowerSupplierData();
|
|
|
powerSupplierData1.Current = 0;
|
|
|
- powerSupplierData1.Voltage = 56000;
|
|
|
+ powerSupplierData1.CurrentSetting = 0;
|
|
|
+ powerSupplierData1.Voltage = 560;
|
|
|
_powerSupplierDic[1] = powerSupplierData1;
|
|
|
|
|
|
PowerSupplierData powerSupplierData2 = new PowerSupplierData();
|
|
|
@@ -160,7 +161,7 @@ namespace PunkHPX8_Simulator.Devices
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- _powerSupplierDic[1].Current = (int)(_powerSupplierDatas[_currentStep].Current * _currentSetScale);
|
|
|
+ _powerSupplierDic[1].Current = (int)(_powerSupplierDatas[_currentStep].Current);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -270,8 +271,8 @@ namespace PunkHPX8_Simulator.Devices
|
|
|
_powerSupplierDic[channel].Current = count / _currentSetScale;
|
|
|
}
|
|
|
else
|
|
|
- {
|
|
|
- _powerSupplierDic[channel].Current = _powerSupplierDic[channel].CurrentSetting * _currentSetScale;
|
|
|
+ {
|
|
|
+ _powerSupplierDic[channel].Current = _powerSupplierDic[channel].CurrentSetting;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -282,7 +283,7 @@ namespace PunkHPX8_Simulator.Devices
|
|
|
}
|
|
|
else if (startAddress == 0x0101)
|
|
|
{
|
|
|
- UpdateChannelCurrent(flag,channel, command, startAddress, value);
|
|
|
+ UpdateChannelCurrent(flag,channel, command, startAddress, (ushort)value);
|
|
|
}
|
|
|
else if (startAddress == POWER_CONTROL_ADDRESS)
|
|
|
{
|
|
|
@@ -349,7 +350,7 @@ namespace PunkHPX8_Simulator.Devices
|
|
|
_cycle = (byte)byteTransform.TransInt16(data, 17);
|
|
|
_currentLength = (_powerSupplierDatas[0].Hour * 3600 + _powerSupplierDatas[0].Minute * 60 +
|
|
|
_powerSupplierDatas[0].Second);
|
|
|
- _powerSupplierDic[1].Current = (int)(_powerSupplierDatas[0].Current*10);
|
|
|
+ _powerSupplierDic[1].Current = (int)(_powerSupplierDatas[0].Current);
|
|
|
_currentTime = DateTime.Now;
|
|
|
_currentStep = 0;
|
|
|
_timer.Start();
|
|
|
@@ -362,7 +363,7 @@ namespace PunkHPX8_Simulator.Devices
|
|
|
Array.Copy(data, 13, vauleData, 0, 4);
|
|
|
_powerSupplierSetPoint = vauleData;
|
|
|
int count = byteTransform.TransInt32(vauleData, 0);
|
|
|
- UpdateChannelGoldCurrent(flag, channel, command, (short)count);
|
|
|
+ UpdateChannelGoldCurrent(flag, channel, command, (ushort)count);
|
|
|
}
|
|
|
else if(startAddress == GOLD_STEP_PERIOD_ADDRESS) //设置步阶数据 32位变量
|
|
|
{
|
|
|
@@ -417,12 +418,12 @@ namespace PunkHPX8_Simulator.Devices
|
|
|
Array.Copy(values,0,bytes, 9, values.Length);
|
|
|
return bytes;
|
|
|
}
|
|
|
- private void UpdateChannelCurrent(short flag,byte channel, byte command, short startAddress, short value)
|
|
|
+ private void UpdateChannelCurrent(short flag,byte channel, byte command, short startAddress, ushort value)
|
|
|
{
|
|
|
_powerSupplierDic[channel].CurrentSetting = value;
|
|
|
- OnWriteMessage(CreateWriteResponse(flag, channel, command, startAddress, value));
|
|
|
+ OnWriteMessage(CreateWriteResponse(flag, channel, command, startAddress, (short)value));
|
|
|
}
|
|
|
- private void UpdateChannelGoldCurrent(short flag, byte channel, byte command, short count)
|
|
|
+ private void UpdateChannelGoldCurrent(short flag, byte channel, byte command, ushort count)
|
|
|
{
|
|
|
_powerSupplierDic[channel].CurrentSetting = count;
|
|
|
OnWriteMessage(CreateMultiWriteResponse(flag, channel, command, 2));
|
|
|
@@ -509,7 +510,7 @@ namespace PunkHPX8_Simulator.Devices
|
|
|
internal class PowerSupplierData
|
|
|
{
|
|
|
private short _voltageSetting;
|
|
|
- private short _currentSetting;
|
|
|
+ private ushort _currentSetting;
|
|
|
private byte _outputSwitchControl;
|
|
|
private int _voltage;
|
|
|
private int _current;
|
|
|
@@ -523,7 +524,7 @@ namespace PunkHPX8_Simulator.Devices
|
|
|
private bool _enabled;
|
|
|
public short VoltageSetting { get { return _voltageSetting; } set { _voltageSetting = value; } }
|
|
|
|
|
|
- public short CurrentSetting { get { return _currentSetting; } set { _currentSetting = value; } }
|
|
|
+ public ushort CurrentSetting { get { return _currentSetting; } set { _currentSetting = value; } }
|
|
|
|
|
|
public byte OutputSwitchControl { get { return _outputSwitchControl; } set { _outputSwitchControl = value; } }
|
|
|
|