ShakerControlModel.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace Shaker.Model
  7. {
  8. public abstract class PLCValueModel : ModelBase
  9. {
  10. [MessagePack.Key(0)]
  11. public PLCValueType ValueType = PLCValueType.Bool;
  12. [MessagePack.Key(1)]
  13. public bool IsReadOnly = false;
  14. [MessagePack.Key(2)]
  15. public ushort Address = 0;
  16. }
  17. [MessagePack.MessagePackObject]
  18. public class ShakerControlModel : TableBase
  19. {
  20. public ShakerControlModel()
  21. {
  22. IPAddress = "127.0.0.1";
  23. Port = 502;
  24. SlaveID = 1;
  25. Name = "振动台";
  26. Description = "测试用振动台";
  27. PowerAmplifier.ResetBitIndex = 2;
  28. PowerAmplifier.StartBitIndex = 0;
  29. PowerAmplifier.StopBitIndex = 1;
  30. PowerAmplifier.GainSwitchBitIndex = 4;
  31. PowerAmplifier.ResetAddress = 2501;
  32. PowerAmplifier.StartAddress = 2501;
  33. PowerAmplifier.GainSwitchAddress = 2501;
  34. PowerAmplifier.GainAddress = 2502;
  35. OperatingStatus.Address = 3012;
  36. OperatingStatus.Unit = "";
  37. OperatingStatus.IsReadOnly = true;
  38. OperatingStatus.B = 0;
  39. OperatingStatus.K = 1;
  40. OperatingStatus.Name = "系统运行状态";
  41. OutputVoltage.Address = 3014;
  42. OutputVoltage.Unit = "V";
  43. OutputVoltage.IsReadOnly = true;
  44. OutputVoltage.B = 0;
  45. OutputVoltage.K = 1;
  46. OutputVoltage.Name = "功放输出电压";
  47. OutputVoltage.MaxValue = 999;
  48. OutputVoltage.MinValue = 0;
  49. OutputCurrent.MaxValue = 9999;
  50. OutputCurrent.MinValue = 0;
  51. OutputCurrent.Address = 3013;
  52. OutputCurrent.B = 0;
  53. OutputCurrent.K = 1;
  54. OutputCurrent.Unit = "A";
  55. OutputCurrent.IsReadOnly = true;
  56. OutputCurrent.Name = "功放输出总电流";
  57. ExcitationCurrent.MaxValue = 999;
  58. ExcitationCurrent.MinValue = 0;
  59. ExcitationCurrent.Address = 3015;
  60. ExcitationCurrent.B = 0;
  61. ExcitationCurrent.K = 1;
  62. ExcitationCurrent.Unit = "A";
  63. ExcitationCurrent.IsReadOnly = true;
  64. ExcitationCurrent.Name = "励磁电流";
  65. ExcitationVoltage.MaxValue = 999;
  66. ExcitationVoltage.MinValue = 0;
  67. ExcitationVoltage.Address = 3016;
  68. ExcitationVoltage.B = 0;
  69. ExcitationVoltage.K = 1;
  70. ExcitationVoltage.Unit = "V";
  71. ExcitationVoltage.IsReadOnly = true;
  72. ExcitationVoltage.Name = "励磁电压";
  73. ThreePhaseVoltage.MaxValue = 999;
  74. ThreePhaseVoltage.MinValue = 0;
  75. ThreePhaseVoltage.Address = 3017;
  76. ThreePhaseVoltage.B = 0;
  77. ThreePhaseVoltage.K = 1;
  78. ThreePhaseVoltage.Unit = "V";
  79. ThreePhaseVoltage.IsReadOnly = true;
  80. ThreePhaseVoltage.Name = "三相电压";
  81. AbutmentTemperature0.MaxValue = 999;
  82. AbutmentTemperature0.MinValue = 0;
  83. AbutmentTemperature0.Address = 3018;
  84. AbutmentTemperature0.B = 0;
  85. AbutmentTemperature0.K = 1;
  86. AbutmentTemperature0.Unit = "℃";
  87. AbutmentTemperature0.IsReadOnly = true;
  88. AbutmentTemperature0.Name = "台体温度0";
  89. AbutmentTemperature1.MaxValue = 999;
  90. AbutmentTemperature1.MinValue = 0;
  91. AbutmentTemperature1.Address = 3019;
  92. AbutmentTemperature1.B = 0;
  93. AbutmentTemperature1.K = 1;
  94. AbutmentTemperature1.Unit = "℃";
  95. AbutmentTemperature1.IsReadOnly = true;
  96. AbutmentTemperature1.Name = "台体温度1";
  97. DCVoltage1.MaxValue = 999;
  98. DCVoltage1.MinValue = 0;
  99. DCVoltage1.Address = 3020;
  100. DCVoltage1.B = 0;
  101. DCVoltage1.K = 1;
  102. DCVoltage1.Unit = "V";
  103. DCVoltage1.IsReadOnly = true;
  104. DCVoltage1.Name = "1柜直流电压";
  105. DCVoltage2.MaxValue = 999;
  106. DCVoltage2.MinValue = 0;
  107. DCVoltage2.Address = 3021;
  108. DCVoltage2.B = 0;
  109. DCVoltage2.K = 1;
  110. DCVoltage2.Unit = "V";
  111. DCVoltage2.IsReadOnly = true;
  112. DCVoltage2.Name = "2柜直流电压";
  113. DCVoltage3.MaxValue = 999;
  114. DCVoltage3.MinValue = 0;
  115. DCVoltage3.Address = 3022;
  116. DCVoltage3.B = 0;
  117. DCVoltage3.K = 1;
  118. DCVoltage3.Unit = "V";
  119. DCVoltage3.IsReadOnly = true;
  120. DCVoltage3.Name = "3柜直流电压";
  121. DCVoltage4.MaxValue = 999;
  122. DCVoltage4.MinValue = 0;
  123. DCVoltage4.Address = 3023;
  124. DCVoltage4.B = 0;
  125. DCVoltage4.K = 1;
  126. DCVoltage4.Unit = "V";
  127. DCVoltage4.IsReadOnly = true;
  128. DCVoltage4.Name = "4柜直流电压";
  129. DigitalGroup.Address = 3051;
  130. DigitalGroup.Names = new string[32]
  131. {
  132. "门开关",
  133. "主柜热继",
  134. "冷却单元",
  135. "水平台油压",
  136. "水平台过位移",
  137. "台体导向静压轴承压力",
  138. "外部触发1",
  139. "台体过位移",
  140. "台体温度",
  141. "变压器温度",
  142. "励磁控制继电器反馈",
  143. "冷却单元控制继电器反馈",
  144. "急停",
  145. "外部触发2",
  146. "柜1模块",
  147. "柜2模块",
  148. "柜1继电器反馈",
  149. "柜2继电器反馈",
  150. "外部1",
  151. "外部变压器温度",
  152. "柜3模块",
  153. "柜4模块",
  154. "柜3继电器反馈",
  155. "柜4继电器反馈",
  156. "","","","","","","",""
  157. };
  158. DigitalGroup.ErrorMessage = new string[32]
  159. {
  160. "打开",
  161. "报警",
  162. "报警",
  163. "报警",
  164. "报警",
  165. "报警",
  166. "报警",
  167. "报警",
  168. "报警",
  169. "报警",
  170. "报警",
  171. "报警",
  172. "报警",
  173. "报警",
  174. "报警",
  175. "报警",
  176. "报警",
  177. "报警",
  178. "急停",
  179. "报警",
  180. "报警",
  181. "报警",
  182. "报警",
  183. "报警",
  184. "","","","","","","",""
  185. };
  186. DigitalGroup.NomalMessage = new string[32]
  187. {
  188. "关闭",
  189. "正常",
  190. "正常",
  191. "正常",
  192. "正常",
  193. "正常",
  194. "正常",
  195. "正常",
  196. "正常",
  197. "正常",
  198. "正常",
  199. "正常",
  200. "正常",
  201. "正常",
  202. "正常",
  203. "正常",
  204. "正常",
  205. "正常",
  206. "正常",
  207. "正常",
  208. "正常",
  209. "正常",
  210. "正常",
  211. "正常",
  212. "","","","","","","",""
  213. };
  214. DigitalGroup1.Address = 3104;
  215. DigitalGroup1.Names = new string[32]
  216. {
  217. "输出电压",
  218. "励磁欠流",
  219. "励磁过流",
  220. "励磁欠压",
  221. "励磁过压",
  222. "三相电压欠压",
  223. "三相电压过压",
  224. "柜1直流电压欠压",
  225. "柜1直流电压过压",
  226. "",
  227. "T01温度过高",
  228. "",
  229. "T00温度过高",
  230. "",
  231. "柜1输出电流过流",
  232. "柜2直流电压欠压",
  233. "柜2直流电压过压",
  234. "",
  235. "柜2输出电流过流",
  236. "",
  237. "",
  238. "",
  239. "",
  240. "柜3直流电压欠压",
  241. "柜3直流电压过压","柜4直流电压欠压","柜4直流电压过压","","柜3输出电流过流","","柜4输出电流过流",""
  242. };
  243. DigitalGroup1.ErrorMessage = new string[32]
  244. {
  245. "报警",
  246. "报警",
  247. "报警",
  248. "报警",
  249. "报警",
  250. "报警",
  251. "报警",
  252. "报警",
  253. "报警",
  254. "",
  255. "报警",
  256. "",
  257. "报警",
  258. "",
  259. "报警",
  260. "报警",
  261. "报警",
  262. "",
  263. "报警",
  264. "",
  265. "",
  266. "",
  267. "",
  268. "报警",
  269. "报警","报警","报警","","报警","","报警",""
  270. };
  271. DigitalGroup1.NomalMessage = new string[32]
  272. {
  273. "正常",
  274. "正常",
  275. "正常",
  276. "正常",
  277. "正常",
  278. "正常",
  279. "正常",
  280. "正常",
  281. "正常",
  282. "",
  283. "正常",
  284. "",
  285. "正常",
  286. "",
  287. "正常",
  288. "正常",
  289. "正常",
  290. "",
  291. "正常",
  292. "",
  293. "",
  294. "",
  295. "",
  296. "正常",
  297. "正常","正常","正常","","正常","","正常",""
  298. };
  299. }
  300. [MessagePack.Key(1)]
  301. public string Name = string.Empty;
  302. [MessagePack.Key(2)]
  303. public string Description = string.Empty;
  304. [MessagePack.Key(3)]
  305. public string IPAddress = string.Empty;
  306. [MessagePack.Key(4)]
  307. public int Port = 502;
  308. [MessagePack.Key(5)]
  309. public byte SlaveID = 1;
  310. [MessagePack.Key(6)]
  311. public string ClientID=string.Empty;
  312. [MessagePack.Key(7)]
  313. public PowerAmplifierModel PowerAmplifier = new PowerAmplifierModel();
  314. [MessagePack.Key(8)]
  315. public PLCAnlogModel OperatingStatus = new PLCAnlogModel();
  316. [MessagePack.Key(9)]
  317. public PLCAnlogModel OutputCurrent = new PLCAnlogModel();
  318. [MessagePack.Key(10)]
  319. public PLCAnlogModel OutputVoltage = new PLCAnlogModel();
  320. [MessagePack.Key(11)]
  321. public PLCAnlogModel ExcitationCurrent = new PLCAnlogModel();
  322. [MessagePack.Key(12)]
  323. public PLCAnlogModel ExcitationVoltage = new PLCAnlogModel();
  324. [MessagePack.Key(13)]
  325. public PLCAnlogModel ThreePhaseVoltage = new PLCAnlogModel();
  326. [MessagePack.Key(14)]
  327. public PLCAnlogModel AbutmentTemperature0 = new PLCAnlogModel();
  328. [MessagePack.Key(15)]
  329. public PLCAnlogModel AbutmentTemperature1 = new PLCAnlogModel();
  330. [MessagePack.Key(16)]
  331. public PLCAnlogModel DCVoltage1 = new PLCAnlogModel();
  332. [MessagePack.Key(17)]
  333. public PLCAnlogModel DCVoltage2 = new PLCAnlogModel();
  334. [MessagePack.Key(18)]
  335. public PLCAnlogModel DCVoltage3 = new PLCAnlogModel();
  336. [MessagePack.Key(19)]
  337. public PLCAnlogModel DCVoltage4 = new PLCAnlogModel();
  338. [MessagePack.Key(20)]
  339. public PLCDigitalGroupModel DigitalGroup = new PLCDigitalGroupModel();
  340. [MessagePack.Key(21)]
  341. public PLCDigitalGroupModel DigitalGroup1 = new PLCDigitalGroupModel();
  342. }
  343. public class PowerAmplifierModel : ModelBase
  344. {
  345. [MessagePack.Key(0)]
  346. public byte StartBitIndex = 0;
  347. [MessagePack.Key(1)]
  348. public byte StopBitIndex = 1;
  349. [MessagePack.Key(2)]
  350. public byte ResetBitIndex = 2;
  351. [MessagePack.Key(3)]
  352. public ushort StartAddress = 2501;
  353. [MessagePack.Key(4)]
  354. public ushort StopAddress = 2501;
  355. [MessagePack.Key(5)]
  356. public ushort ResetAddress = 2501;
  357. [MessagePack.Key(6)]
  358. public ushort GainSwitchAddress = 2501;
  359. [MessagePack.Key(7)]
  360. public byte GainSwitchBitIndex = 4;
  361. [MessagePack.Key(8)]
  362. public ushort GainAddress = 2502;
  363. }
  364. public class PLCAnlogModel : PLCValueModel
  365. {
  366. public PLCAnlogModel() => ValueType = PLCValueType.Int16;
  367. [MessagePack.Key(3)]
  368. public float K = 1;
  369. [MessagePack.Key(4)]
  370. public float B = 0;
  371. [MessagePack.Key(5)]
  372. public string Name = "";
  373. [MessagePack.Key(6)]
  374. public string Unit = "";
  375. [MessagePack.Key(10)]
  376. public short Value = 0;
  377. [MessagePack.Key(7)]
  378. public float MaxValue = float.MaxValue;
  379. [MessagePack.Key(8)]
  380. public float MinValue = float.MinValue;
  381. [MessagePack.Key(9)]
  382. public bool IsEnbled = true;
  383. }
  384. public class PLCDigitalModel : PLCValueModel
  385. {
  386. public PLCDigitalModel()
  387. {
  388. ValueType = PLCValueType.Bool;
  389. }
  390. [MessagePack.Key(5)]
  391. public bool Value = false;
  392. [MessagePack.Key(3)]
  393. public byte BitIndex = 0;
  394. [MessagePack.Key(4)]
  395. public string Name = "";
  396. }
  397. public class PLCDigitalGroupModel : PLCValueModel
  398. {
  399. public PLCDigitalGroupModel() => ValueType = PLCValueType.BoolGroup;
  400. [MessagePack.Key(3)]
  401. public string[] Names = new string[32];
  402. [MessagePack.Key(4)]
  403. public byte[] Values = new byte[4];
  404. [MessagePack.Key(5)]
  405. public byte ByteCount = 4;
  406. [MessagePack.Key(6)]
  407. public string[] ErrorMessage = new string[32];
  408. [MessagePack.Key(7)]
  409. public string[] NomalMessage = new string[32];
  410. }
  411. }