PowerSupplierSocketSimulator.cs 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573
  1. using Aitex.Common.Util;
  2. using Aitex.Core.RT.ConfigCenter;
  3. using Aitex.Core.RT.DataCenter;
  4. using Aitex.Core.RT.Log;
  5. using Aitex.Core.Util;
  6. using PunkHPX8_Core;
  7. using MECF.Framework.Common.CommonData;
  8. using MECF.Framework.Common.CommonData.PowerSupplier;
  9. using MECF.Framework.Common.Device.PowerSupplier;
  10. using MECF.Framework.Common.Device.Wago;
  11. using MECF.Framework.Common.Net;
  12. using MECF.Framework.Common.Utilities;
  13. using MECF.Framework.Simulator.Core.Driver;
  14. using System;
  15. using System.Collections.Generic;
  16. using System.IO;
  17. using System.Linq;
  18. using System.Reflection;
  19. using System.Security.Cryptography.X509Certificates;
  20. using System.Text;
  21. using System.Threading;
  22. using System.Threading.Tasks;
  23. using System.Timers;
  24. using System.Xml.Linq;
  25. namespace PunkHPX8_Simulator.Devices
  26. {
  27. public class PowerSupplierSocketSimulator : SocketDeviceSimulator
  28. {
  29. private const short POWER_CONTROL_ADDRESS = 0x0113;
  30. private const short STEP_PERIOD_ADDRESS = 0x1400;
  31. private const short STEP_PERIOD_START_ADDRESS = 0x1640;
  32. private const short GOLD_CURRENT_SETTING_ADDRESS = 0x6102;
  33. private const short GOLD_STEP_PERIOD_ADDRESS = 0x77D0;
  34. private const short GOLD_STEP_PERIOD_START_ADDRESS = 0x7C50;
  35. private const short POWER_GRADE = 0x0106;
  36. /// <summary>
  37. /// 电源状态(00-cv输出,01-cc输出)
  38. /// </summary>
  39. private const short POWER_STATUS_ADDRESS = 0x0200;
  40. Dictionary<int, PowerSupplierData> _powerSupplierDic = new Dictionary<int, PowerSupplierData>();
  41. private IByteTransform byteTransform = new BigEndianByteTransformBase();
  42. private List<PowerSupplierStepPeriodData> _powerSupplierDatas = new List<PowerSupplierStepPeriodData>();
  43. private byte _startStep = 1;
  44. private byte _endStep = 255;
  45. private byte _cycle = 1;
  46. private byte _currentStep = 0;
  47. private int _currentLength = 0;
  48. private DateTime _currentTime = DateTime.Now;
  49. private bool _isGoldPower = false;
  50. private int _currentSetScale= 1000;
  51. private int _highSetScale=1000;
  52. private int _middleSetScale=100000;
  53. private int _lowSetScale=1000000;
  54. private int _currentPowerGrade = 2;//默认是高档
  55. private System.Timers.Timer _timer;
  56. /// <summary>
  57. /// 记录每次设置的电流值
  58. /// </summary>
  59. private byte[] _powerSupplierSetPoint = new byte[4];
  60. public PowerSupplierSocketSimulator(int port):base(port)
  61. {
  62. PowerSupplierData powerSupplierData1 = new PowerSupplierData();
  63. powerSupplierData1.Current = 0;
  64. powerSupplierData1.CurrentSetting = 0;
  65. powerSupplierData1.Voltage = 560;
  66. _powerSupplierDic[1] = powerSupplierData1;
  67. PowerSupplierData powerSupplierData2 = new PowerSupplierData();
  68. powerSupplierData2.Current = 0;
  69. powerSupplierData2.Voltage = 2000;
  70. _powerSupplierDic[2] = powerSupplierData2;
  71. PowerSupplierData powerSupplierData3 = new PowerSupplierData();
  72. powerSupplierData3.Current = 0;
  73. powerSupplierData3.Voltage = 3000;
  74. _powerSupplierDic[3] = powerSupplierData3;
  75. PowerSupplierData powerSupplierData4 = new PowerSupplierData();
  76. powerSupplierData4.Current = 0;
  77. powerSupplierData4.Voltage = 4000;
  78. _powerSupplierDic[4] = powerSupplierData4;
  79. _timer = new System.Timers.Timer();
  80. _timer.Interval = 1000;
  81. _timer.Elapsed += Timer_Elapsed;
  82. InitializeParamater(port);
  83. }
  84. private void InitializeParamater(int port)
  85. {
  86. try
  87. {
  88. string oldXmlPath = PathManager.GetCfgDir();
  89. string newXmlPath = oldXmlPath.Replace("PunkHPX8_Simulator", "PunkHPX8_RT") + "Devices\\PowerSupplierCfg-Simulator.xml";
  90. PowerSupplierDeviceConfigCfg cfg = CustomXmlSerializer.Deserialize<PowerSupplierDeviceConfigCfg>(new FileInfo(newXmlPath));
  91. if (cfg != null)
  92. {
  93. foreach (PowerSupplierDeviceConfig config in cfg.PowerSupplierDeviceConfigs)
  94. {
  95. if(config.Port != port)
  96. {
  97. continue;
  98. }
  99. else
  100. {
  101. foreach (PowerSupplierDevice device in config.Devices)
  102. {
  103. if (device != null)
  104. {
  105. if (config.Type == 1) //金槽电源
  106. {
  107. _currentSetScale = 1000;
  108. }
  109. else
  110. {
  111. _highSetScale = device.HighGradeCurrentSetScale;
  112. _middleSetScale = device.MiddleGradeCurrentSetScale;
  113. _lowSetScale = device.LowGradeCurrentSetScale;
  114. }
  115. }
  116. break;
  117. }
  118. break;
  119. }
  120. }
  121. }
  122. }
  123. catch
  124. {
  125. LOG.WriteLog(eEvent.ERR_POWERSUPPLIER, "PowerSupplier", "Load power supplier xml failed");
  126. }
  127. }
  128. private void Timer_Elapsed(object sender, ElapsedEventArgs e)
  129. {
  130. if(_currentStep>=_cycle*_endStep)
  131. {
  132. _timer.Stop();
  133. }
  134. if(DateTime.Now.Subtract(_currentTime).TotalSeconds>=_currentLength)
  135. {
  136. _currentStep++;
  137. if (_currentStep >= _cycle * _endStep)
  138. {
  139. _powerSupplierDic[1].Current = 0;
  140. _timer.Stop();
  141. return;
  142. }
  143. _currentTime = DateTime.Now;
  144. _currentLength = (int)(_powerSupplierDatas[_currentStep].Hour * 3600 + _powerSupplierDatas[_currentStep].Minute * 60 +
  145. _powerSupplierDatas[_currentStep].Second);
  146. if (_isGoldPower)
  147. {
  148. _powerSupplierDic[1].Current = (int)(_powerSupplierDatas[_currentStep].Current);
  149. }
  150. else
  151. {
  152. _powerSupplierDic[1].Current = (int)(_powerSupplierDatas[_currentStep].Current);
  153. }
  154. }
  155. }
  156. protected override void ProcessUnsplitMessage(byte[] data)
  157. {
  158. short flag = byteTransform.TransInt16(data, 0);
  159. byte channel = data[6];
  160. byte command = data[7];
  161. if(!_powerSupplierDic.ContainsKey(channel))
  162. {
  163. OnWriteMessage(CreateError(flag,channel, command, 0x02));
  164. return;
  165. }
  166. if (command == 0x03)//读取
  167. {
  168. short startAddress = byteTransform.TransInt16(data, 8);
  169. short registerCount = byteTransform.TransInt16(data, 10);
  170. if (startAddress == 0x201)
  171. {
  172. byte[] bytes = new byte[2*registerCount];
  173. Array.Copy(byteTransform.GetBytes(_powerSupplierDic[channel].Voltage), 0, bytes, 0, 4);
  174. Array.Copy(byteTransform.GetBytes(_powerSupplierDic[channel].Current), 0, bytes, 4, 4);
  175. OnWriteMessage(CreateReadResponse(flag, channel, command, registerCount, bytes));
  176. return;
  177. }
  178. else if (startAddress == 0x0110)
  179. {
  180. byte[] bytes = new byte[2];
  181. bytes[0] = 0;
  182. bytes[1] = _powerSupplierDic[channel].Enabled?(byte)1:(byte)0;
  183. OnWriteMessage(CreateReadResponse(flag, channel, command, registerCount, bytes));
  184. return;
  185. }
  186. else if (startAddress == POWER_STATUS_ADDRESS)
  187. {
  188. byte[] bytes = new byte[2];
  189. bytes[0] = 0;
  190. bytes[1] = (byte)_powerSupplierDic[channel].PowerStatus;
  191. OnWriteMessage(CreateReadResponse(flag, channel, command, registerCount, bytes));
  192. return;
  193. }
  194. else if (startAddress == 0x0101)
  195. {
  196. byte[] bytes = new byte[2];
  197. Array.Copy(byteTransform.GetBytes(_powerSupplierDic[channel].CurrentSetting), 0, bytes, 0, bytes.Length);
  198. OnWriteMessage(CreateReadResponse(flag, channel, command, registerCount, bytes));
  199. return;
  200. }
  201. else if(startAddress == GOLD_CURRENT_SETTING_ADDRESS)
  202. {
  203. _isGoldPower = true;
  204. OnWriteMessage(CreateReadResponse(flag, channel, command, registerCount, _powerSupplierSetPoint));
  205. return;
  206. }
  207. else if (startAddress == 0X80)
  208. {
  209. byte[] bytes = new byte[2];
  210. bytes[0] = 0;
  211. bytes[1] = _powerSupplierDic[channel].OutputSwitchControl;
  212. OnWriteMessage(CreateReadResponse(flag, channel, command, registerCount, bytes));
  213. return;
  214. }
  215. else if (startAddress == 0x0111)
  216. {
  217. byte[] bytes = new byte[2];
  218. bytes[0] = 0;
  219. bytes[1] = (byte)_powerSupplierDic[channel].RunModel;
  220. OnWriteMessage(CreateReadResponse(flag, channel, command, registerCount, bytes));
  221. return;
  222. }
  223. else if (startAddress == POWER_CONTROL_ADDRESS)
  224. {
  225. byte[] bytes = new byte[2];
  226. bytes[0] = 0;
  227. bytes[1] = (byte)_powerSupplierDic[channel].PowerControl;
  228. OnWriteMessage(CreateReadResponse(flag, channel, command, registerCount, bytes));
  229. return;
  230. }
  231. else if(startAddress == POWER_GRADE)
  232. {
  233. byte[] bytes = new byte[2];
  234. bytes[0] = 0;
  235. bytes[1] = (byte)_powerSupplierDic[channel].PowerGrade;
  236. OnWriteMessage(CreateReadResponse(flag, channel, command, registerCount, bytes));
  237. return;
  238. }
  239. else
  240. {
  241. OnWriteMessage(CreateError(flag, channel, command, 03));
  242. }
  243. }
  244. else if (command == 0x06)//设置
  245. {
  246. short startAddress = byteTransform.TransInt16(data, 8);
  247. short value = byteTransform.TransInt16(data, 10);
  248. if(startAddress==0x0110)
  249. {
  250. UpdateChannelEnable(flag, channel, command, startAddress, data[11]);
  251. if (_powerSupplierDic[channel].Enabled)
  252. {
  253. if (_powerSupplierDic[channel].RunModel == 1)
  254. {
  255. if (_isGoldPower)
  256. {
  257. int count = byteTransform.TransInt32(_powerSupplierSetPoint, 0);
  258. _powerSupplierDic[channel].Current = count / _currentSetScale;
  259. }
  260. else
  261. {
  262. _powerSupplierDic[channel].Current = _powerSupplierDic[channel].CurrentSetting;
  263. }
  264. }
  265. }
  266. else
  267. {
  268. _powerSupplierDic[channel].Current = 0;
  269. }
  270. }
  271. else if (startAddress == 0x0101)
  272. {
  273. UpdateChannelCurrent(flag,channel, command, startAddress, (ushort)value);
  274. }
  275. else if (startAddress == POWER_CONTROL_ADDRESS)
  276. {
  277. UpdateChannelPowerControl(flag, channel, command, startAddress, data[11]);
  278. }
  279. else if(startAddress== 0x0111)
  280. {
  281. UpdateChannelRunModel(flag, channel, command, startAddress, data[11]);
  282. }
  283. else if(startAddress == POWER_GRADE)
  284. {
  285. UpdateChannelGrade(flag, channel, command, startAddress, data[11]);
  286. if (data[11] == 2)
  287. {
  288. _currentPowerGrade = 2;
  289. _currentSetScale = _highSetScale;
  290. }
  291. else if(_highSetScale == 1)
  292. {
  293. _currentPowerGrade = 1;
  294. _currentSetScale = _middleSetScale;
  295. }
  296. else
  297. {
  298. _currentPowerGrade = 0;
  299. _currentSetScale = _lowSetScale;
  300. }
  301. }
  302. else
  303. {
  304. byte[] errorByt = CreateError(flag, channel, command, 03);
  305. OnWriteMessage(errorByt);
  306. return;
  307. }
  308. }
  309. else if(command==0x10) //写多个寄存器
  310. {
  311. short startAddress = byteTransform.TransInt16(data, 8);
  312. short length = byteTransform.TransInt16(data, 10);
  313. if (startAddress == STEP_PERIOD_ADDRESS)
  314. {
  315. _powerSupplierDatas.Clear();
  316. int listCount = length / 6;
  317. for(int i=0;i<listCount;i++)
  318. {
  319. PowerSupplierStepPeriodData powerSupplierData = new PowerSupplierStepPeriodData();
  320. powerSupplierData.Voltage = byteTransform.TransInt16(data, 13 + i * 12);
  321. powerSupplierData.Current = byteTransform.TransInt16(data, 15 + i * 12);
  322. powerSupplierData.Hour = byteTransform.TransUInt16(data, 17 + i * 12);
  323. powerSupplierData.Minute = byteTransform.TransUInt16(data, 19 + i * 12);
  324. powerSupplierData.Second = byteTransform.TransUInt16(data, 21 + i * 12);
  325. powerSupplierData.Microsecond = byteTransform.TransUInt16(data, 23 + i * 12);
  326. _powerSupplierDatas.Add(powerSupplierData);
  327. }
  328. OnWriteMessage(CreateWriteResponse(flag, channel, command, startAddress, length));
  329. }
  330. else if(startAddress==STEP_PERIOD_START_ADDRESS)
  331. {
  332. _startStep = (byte)byteTransform.TransInt16(data,13);
  333. _endStep = (byte)byteTransform.TransInt16(data, 15);
  334. _cycle = (byte)byteTransform.TransInt16(data, 17);
  335. _currentLength = (_powerSupplierDatas[0].Hour * 3600 + _powerSupplierDatas[0].Minute * 60 +
  336. _powerSupplierDatas[0].Second);
  337. _powerSupplierDic[1].Current = (int)(_powerSupplierDatas[0].Current);
  338. _currentTime = DateTime.Now;
  339. _currentStep = 0;
  340. _timer.Start();
  341. OnWriteMessage(CreateWriteResponse(flag, channel, command, startAddress, length));
  342. }
  343. else if(startAddress == GOLD_CURRENT_SETTING_ADDRESS) //设置电流 32位变量
  344. {
  345. _isGoldPower = true;
  346. byte[] vauleData = new byte[4]; //0,1是高位,2,3是低位
  347. Array.Copy(data, 13, vauleData, 0, 4);
  348. _powerSupplierSetPoint = vauleData;
  349. int count = byteTransform.TransInt32(vauleData, 0);
  350. UpdateChannelGoldCurrent(flag, channel, command, (ushort)count);
  351. }
  352. else if(startAddress == GOLD_STEP_PERIOD_ADDRESS) //设置步阶数据 32位变量
  353. {
  354. _powerSupplierDatas.Clear();
  355. int listCount = length / 12;
  356. for (int i = 0; i < listCount; i++)
  357. {
  358. PowerSupplierStepPeriodData powerSupplierData = new PowerSupplierStepPeriodData();
  359. powerSupplierData.Voltage = byteTransform.TransInt32(data, 13 + i * 24);
  360. powerSupplierData.Current = byteTransform.TransInt32(data, 17 + i * 24) / _currentSetScale;
  361. powerSupplierData.Hour = byteTransform.TransUInt16(data, 23 + i * 24);
  362. powerSupplierData.Minute = byteTransform.TransUInt16(data, 27 + i * 24);
  363. powerSupplierData.Second = byteTransform.TransUInt16(data, 31 + i * 24);
  364. powerSupplierData.Microsecond = byteTransform.TransUInt16(data, 35 + i * 24);
  365. _powerSupplierDatas.Add(powerSupplierData);
  366. }
  367. OnWriteMessage(CreateWriteResponse(flag, channel, command, startAddress, length));
  368. }
  369. else if (startAddress == GOLD_STEP_PERIOD_START_ADDRESS) //启动步阶数据 32位变量
  370. {
  371. _startStep = (byte)byteTransform.TransInt32(data, 13);
  372. _endStep = (byte)byteTransform.TransInt32(data, 17);
  373. _cycle = (byte)byteTransform.TransInt32(data, 21);
  374. _currentLength = (_powerSupplierDatas[0].Hour * 3600 + _powerSupplierDatas[0].Minute * 60 +
  375. _powerSupplierDatas[0].Second);
  376. _powerSupplierDic[1].Current = (int)(_powerSupplierDatas[0].Current);
  377. _currentTime = DateTime.Now;
  378. _currentStep = 0;
  379. _timer.Start();
  380. OnWriteMessage(CreateWriteResponse(flag, channel, command, startAddress, length));
  381. }
  382. }
  383. else
  384. {
  385. OnWriteMessage(CreateError(flag, channel, command, 0x01));
  386. }
  387. }
  388. private byte[] CreateReadResponse(short flag,byte channel,byte command,short registerCount, byte[] values)
  389. {
  390. byte[] bytes = new byte[3 + values.Length + 6];
  391. Array.Copy(byteTransform.GetBytes(flag), 0, bytes, 0, 2);
  392. bytes[2] = 0x00;
  393. bytes[3] = 0x00;
  394. short dataLength=(short)(3+ values.Length);
  395. Array.Copy(byteTransform.GetBytes(dataLength), 0, bytes, 4, 2);
  396. bytes[6] = channel;
  397. bytes[7] = command;
  398. bytes[8] = (byte)(2 * registerCount);
  399. Array.Copy(values,0,bytes, 9, values.Length);
  400. return bytes;
  401. }
  402. private void UpdateChannelCurrent(short flag,byte channel, byte command, short startAddress, ushort value)
  403. {
  404. _powerSupplierDic[channel].CurrentSetting = value;
  405. OnWriteMessage(CreateWriteResponse(flag, channel, command, startAddress, (short)value));
  406. }
  407. private void UpdateChannelGoldCurrent(short flag, byte channel, byte command, ushort count)
  408. {
  409. _powerSupplierDic[channel].CurrentSetting = count;
  410. OnWriteMessage(CreateMultiWriteResponse(flag, channel, command, 2));
  411. }
  412. private void UpdateChannelEnabled(short flag,byte channel, byte command, short startAddress, short value)
  413. {
  414. _powerSupplierDic[channel].OutputSwitchControl = (byte)value;
  415. OnWriteMessage(CreateWriteResponse(flag,channel, command, startAddress, value));
  416. }
  417. private void UpdateChannelPowerControl(short flag, byte channel, byte command, short startAddress, short value)
  418. {
  419. _powerSupplierDic[channel].PowerControl = (byte)value;
  420. OnWriteMessage(CreateWriteResponse(flag, channel, command, startAddress, value));
  421. }
  422. private void UpdateChannelRunModel(short flag, byte channel, byte command, short startAddress, short value)
  423. {
  424. _powerSupplierDic[channel].RunModel = (byte)value;
  425. OnWriteMessage(CreateWriteResponse(flag, channel, command, startAddress, value));
  426. }
  427. private void UpdateChannelGrade(short flag, byte channel, byte command, short startAddress, short value)
  428. {
  429. _powerSupplierDic[channel].PowerGrade = (byte)value;
  430. OnWriteMessage(CreateWriteResponse(flag, channel, command, startAddress, value));
  431. }
  432. private void UpdateChannelEnable(short flag, byte channel, byte command, short startAddress, short value)
  433. {
  434. _powerSupplierDic[channel].Enabled = value == 1;
  435. OnWriteMessage(CreateWriteResponse(flag, channel, command, startAddress, value));
  436. }
  437. private byte[] CreateWriteResponse(short flag,byte channel,byte command, short startAddress,short value)
  438. {
  439. byte[] byt = new byte[12];
  440. Array.Copy(byteTransform.GetBytes(flag), 0, byt, 0, 2);
  441. byt[2] = 0x00;
  442. byt[3] = 0x00;
  443. byt[4] = 0x00;
  444. byt[5] = 0x06;
  445. byt[6] = channel;
  446. byt[7] = command;
  447. byte[] addressByt= byteTransform.GetBytes(startAddress);
  448. Array.Copy(addressByt, 0, byt, 8, 2);
  449. byte[] valueByt=byteTransform.GetBytes(value);
  450. Array.Copy(valueByt, 0, byt, 10, 2);
  451. return byt;
  452. }
  453. private byte[] CreateMultiWriteResponse(short flag, byte channel, byte command,byte registerCount)
  454. {
  455. byte[] byt = new byte[12];
  456. Array.Copy(byteTransform.GetBytes(flag), 0, byt, 0, 2);
  457. byt[2] = 0x00;
  458. byt[3] = 0x00;
  459. byt[4] = 0x00;
  460. byt[5] = 0x06;
  461. byt[6] = channel;
  462. byt[7] = command;
  463. byt[8] = 0x00;
  464. byt[9] = registerCount;
  465. //byte[] addressByt = byteTransform.GetBytes(startAddress);
  466. //Array.Copy(addressByt, 0, byt, 8, 2);
  467. //byte[] valueByt = byteTransform.GetBytes(count);
  468. //Array.Copy(valueByt, 0, byt, 10, 2);
  469. return byt;
  470. }
  471. private byte[] CreateError(short flag,byte channel,byte command,byte error)
  472. {
  473. byte[] byt = new byte[9];
  474. Array.Copy(byteTransform.GetBytes(flag), 0, byt, 0, 2);
  475. byt[2] = 0x00;
  476. byt[3] = 0x00;
  477. byt[4] = 0x00;
  478. byt[5] = 0x03;
  479. byt[6]=channel;
  480. byt[7]=(byte)(command|0x80);
  481. byt[8] = error;
  482. return byt;
  483. }
  484. }
  485. internal class PowerSupplierData
  486. {
  487. private short _voltageSetting;
  488. private ushort _currentSetting;
  489. private byte _outputSwitchControl;
  490. private int _voltage;
  491. private int _current;
  492. private short _powerStatus = (int)PowerStatusEnum.CC;
  493. private short _powerControl=(int)PowerControlEnum.Remote;
  494. private short _runModel = (int)PowerRunModelEnum.Normal;
  495. private short _powerGrade = (int)PowerGradeEnum.High;
  496. /// <summary>
  497. /// 可用性
  498. /// </summary>
  499. private bool _enabled;
  500. public short VoltageSetting { get { return _voltageSetting; } set { _voltageSetting = value; } }
  501. public ushort CurrentSetting { get { return _currentSetting; } set { _currentSetting = value; } }
  502. public byte OutputSwitchControl { get { return _outputSwitchControl; } set { _outputSwitchControl = value; } }
  503. public int Voltage { get { return _voltage; } set { _voltage = value; } }
  504. public int Current { get { return _current; } set { _current = value; } }
  505. public short PowerStatus { get { return _powerStatus; } set { _powerStatus = value; } }
  506. public short PowerControl { get { return _powerControl; } set { _powerControl = value; } }
  507. public short RunModel { get { return _runModel; } set { _runModel = value; } }
  508. public short PowerGrade { get { return _powerGrade; } set { _powerGrade = value; } }
  509. public bool Enabled { get { return _enabled; } set { _enabled = value; } }
  510. }
  511. public class PowerSupplierStepPeriodData
  512. {
  513. #region 内部变量
  514. private double _voltage;
  515. private double _current;
  516. private ushort _hour;
  517. private ushort _minute;
  518. private ushort _second;
  519. private ushort _microsecond;
  520. #endregion
  521. #region 属性
  522. public double Voltage { get { return _voltage; } set { _voltage = value; } }
  523. public double Current { get { return _current; } set { _current = value; } }
  524. public ushort Hour { get { return _hour; } set { _hour = value; } }
  525. public ushort Minute { get { return _minute; } set { _minute = value; } }
  526. public ushort Second { get { return _second; } set { _second = value; } }
  527. public ushort Microsecond { get { return _microsecond; } set { _microsecond = value; } }
  528. #endregion
  529. }
  530. }