PowerSupplierSocketSimulator.cs 25 KB

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