终端一体化运控平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

560 lines
17 KiB

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace FryPot_DosingSystem.Control
  7. {
  8. /// <summary>
  9. /// plc变量
  10. /// </summary>
  11. internal class GlobalVariable
  12. {
  13. /// <summary>
  14. /// 滚筒线1
  15. /// </summary>
  16. public RollerLineOne rollerLineOne = new RollerLineOne();
  17. /// <summary>
  18. /// 滚筒线2
  19. /// </summary>
  20. public RollerLineTwo rollerLineTwo = new RollerLineTwo();
  21. /// <summary>
  22. /// 滚筒线3
  23. /// </summary>
  24. public RollerLineThree rollerLineThree = new RollerLineThree();
  25. /// <summary>
  26. /// 炒锅1
  27. /// </summary>
  28. public FryPotOne fryPotOne= new FryPotOne();
  29. /// <summary>
  30. /// 炒锅2
  31. /// </summary>
  32. public FryPotTwo fryPotTwo= new FryPotTwo();
  33. /// <summary>
  34. /// 炒锅3
  35. /// </summary>
  36. public FryPotThree fryPotThree= new FryPotThree();
  37. /// <summary>
  38. /// 炒锅4
  39. /// </summary>
  40. public FryPotFour fryPotFour= new FryPotFour();
  41. /// <summary>
  42. /// 炒锅5
  43. /// </summary>
  44. public FryPotFive fryPotFive= new FryPotFive();
  45. /// <summary>
  46. /// 洗桶进桶滚筒运行信号
  47. /// </summary>
  48. public ushort CleadBarrelEnterSingle { get; set; }
  49. /// <summary>
  50. /// 洗桶出桶滚筒运行信号
  51. /// </summary>
  52. public ushort CleadBarrelExitSingle { get; set; }
  53. /// <summary>
  54. /// PLC初始化状态
  55. /// </summary>
  56. public ushort PlcInite { get; set; }
  57. #region 上位机内部逻辑条件
  58. /// <summary>
  59. /// 退出线体1任务
  60. /// </summary>
  61. public bool ExitLineOneTask { get; set; }
  62. /// <summary>
  63. /// 退出线体2任务
  64. /// </summary>
  65. public bool ExitLineTwoTask { get; set; }
  66. /// <summary>
  67. /// 退出线体3任务
  68. /// </summary>
  69. public bool ExitLineThreeTask { get; set; }
  70. /// <summary>
  71. /// 允许AGV去线体1装桶条件
  72. /// </summary>
  73. public bool AllowAgvToLineLoadRoller { get; set; } = true;
  74. /// <summary>
  75. /// 允许AGV去线体2装桶条件
  76. /// </summary>
  77. public bool AllowAgvToLineTwoLoadRoller { get; set; } = true;
  78. /// <summary>
  79. /// 允许AGV去线体3装桶条件
  80. /// </summary>
  81. public bool AllowAgvToLineThreeLoadRoller { get; set; } = true;
  82. ///// <summary>
  83. ///// 配方唯一ID
  84. ///// </summary>
  85. //public string RecipeId { get; set; }
  86. /// <summary>
  87. /// 线体1对应的进桶出桶互锁
  88. /// </summary>
  89. public bool InOrOutputLock { get; set; }
  90. /// <summary>
  91. /// 线体2对应的进桶出桶互锁
  92. /// </summary>
  93. public bool LTwoInOrOutputLock { get; set; }
  94. /// <summary>
  95. /// 线体3对应的进桶出桶互锁
  96. /// </summary>
  97. public bool LThreeInOrOutputLock { get; set; }
  98. ///// <summary>
  99. ///// 线体1任务执行锁
  100. ///// </summary>
  101. //public bool LOneTaskLock { get; set; }
  102. ///// <summary>
  103. ///// 线体2任务执行锁
  104. ///// </summary>
  105. //public bool LTwoTaskLock { get; set; }
  106. ///// <summary>
  107. ///// 线体3任务执行锁
  108. ///// </summary>
  109. //public bool LThreeTaskLock { get; set; }
  110. /// <summary>
  111. /// 线体1当前正在制作的配方名称
  112. /// </summary>
  113. public string LOneCurrentRecipeName { get; set; } = string.Empty;
  114. /// <summary>
  115. /// 线体2当前正在制作的配方名称
  116. /// </summary>
  117. public string LTwoCurrentRecipeName { get; set; } = string.Empty;
  118. /// <summary>
  119. /// 线体3当前正在制作的配方名称
  120. /// </summary>
  121. public string LThreeCurrentRecipeName { get; set; } = string.Empty;
  122. #endregion
  123. #region 线体1流程互锁变量
  124. public bool LoadRoller { get; set; }
  125. public bool AgvToFryPot { get; set; }
  126. public bool PotOneInputMaterialArrive { get; set; }
  127. public bool PotOneOutputRollerArrive { get; set; }
  128. public bool AgvArrivePot { get; set; }
  129. #endregion
  130. #region 线体2流程互锁变量
  131. public bool LTwoLoadRoller { get; set; }
  132. public bool LTwoAgvToFryPot { get; set; }
  133. public bool LTwoPotInputMaterialArrive { get; set; }
  134. public bool LTwoPotOutputRollerArrive { get; set; }
  135. public bool LTwoAgvArrivePot { get; set; }
  136. #endregion
  137. #region 线体3流程互锁变量
  138. public bool LThreeLoadRoller { get; set; }
  139. public bool LThreeAgvToFryPot { get; set; }
  140. public bool LThreePotInputMaterialArrive { get; set; }
  141. public bool LThreePotOutputRollerArrive { get; set; }
  142. public bool LThreeAgvArrivePot { get; set; }
  143. #endregion
  144. #region AGV视图显示变量
  145. public int LOneMaterialNum { get; set; } = 0;
  146. public int LOneFryPotSerial { get; set; } = 1;
  147. public int LOneCurrentCookingStep { get; set; } = 0;
  148. public bool agvArriveUpLoad { get; set; }
  149. public bool agvArriveUnLoad { get; set; }
  150. public bool agvFryPotEmptyRollerArrive { get; set; }
  151. public bool EmptyRollerUnLoadcCom { get; set; }//AGV空桶4号线体下料完成
  152. public int LTwoMaterialNum { get; set; } = 0;
  153. public int LTwoFryPotSerial { get; set; } = 2;
  154. public int LTwoCurrentCookingStep { get; set; } = 0;
  155. public bool agvArriveLTwoUpLoad { get; set; }
  156. public bool LTwoagvArriveUnLoad { get; set; }
  157. public bool LTwoagvFryPotEmptyRollerArrive { get; set; }
  158. public bool LTwoEmptyRollerUnLoadcCom { get; set; }//AGV空桶4号线体下料完成
  159. public int LThreeMaterialNum { get; set; } = 0;
  160. public int LThreeFryPotSerial { get; set; } = 3;
  161. public int LThreeCurrentCookingStep { get; set; } = 0;
  162. public bool agvArriveLThreeUpLoad { get; set; }
  163. public bool LThreeagvArriveUnLoad { get; set; }
  164. public bool LThreeagvFryPotEmptyRollerArrive { get; set; }
  165. public bool LThreeEmptyRollerUnLoadcCom { get; set; }//AGV空桶4号线体下料完成
  166. public int LFourRollerNum { get; set; } = 0;
  167. #endregion
  168. }
  169. /// <summary>
  170. /// 滚筒线1相关变量
  171. /// </summary>
  172. public class RollerLineOne
  173. {
  174. /// <summary>
  175. /// 工位号1
  176. /// </summary>
  177. public ushort StationOne { get; set; }
  178. /// <summary>
  179. /// 工位号2
  180. /// </summary>
  181. public ushort StationTwo { get; set; }
  182. /// <summary>
  183. /// 工位号3
  184. /// </summary>
  185. public ushort StationThree { get; set; }
  186. /// <summary>
  187. /// 工位号4
  188. /// </summary>
  189. public ushort StationFour { get; set; }
  190. /// <summary>
  191. /// 工位号5
  192. /// </summary>
  193. public ushort StationFive { get; set; }
  194. /// <summary>
  195. /// 工位号6
  196. /// </summary>
  197. public ushort StationSix { get; set; }
  198. /// <summary>
  199. /// 工位号7
  200. /// </summary>
  201. public ushort StationSeven { get; set; }
  202. /// <summary>
  203. /// 工位号8
  204. /// </summary>
  205. public ushort StationEight { get; set; }
  206. /// <summary>
  207. /// 输送出料滚筒运行信号
  208. /// </summary>
  209. public ushort OutMaterialingSingle { get; set; }
  210. /// <summary>
  211. /// 输送出料滚筒运行故障信号
  212. /// </summary>
  213. public ushort OutMaterialingTroubleSingle { get; set; }
  214. /// <summary>
  215. /// 当前线体配方完成信号
  216. /// </summary>
  217. public ushort RecipeCompleteSingle { get; set; }
  218. }
  219. /// <summary>
  220. /// 滚筒线2相关变量
  221. /// </summary>
  222. public class RollerLineTwo
  223. {
  224. /// <summary>
  225. /// 工位号1
  226. /// </summary>
  227. public ushort StationOne { get; set; }
  228. /// <summary>
  229. /// 工位号2
  230. /// </summary>
  231. public ushort StationTwo { get; set; }
  232. /// <summary>
  233. /// 工位号3
  234. /// </summary>
  235. public ushort StationThree { get; set; }
  236. /// <summary>
  237. /// 工位号4
  238. /// </summary>
  239. public ushort StationFour { get; set; }
  240. /// <summary>
  241. /// 工位号5
  242. /// </summary>
  243. public ushort StationFive { get; set; }
  244. /// <summary>
  245. /// 工位号6
  246. /// </summary>
  247. public ushort StationSix { get; set; }
  248. /// <summary>
  249. /// 工位号7
  250. /// </summary>
  251. public ushort StationSeven { get; set; }
  252. /// <summary>
  253. /// 工位号8
  254. /// </summary>
  255. public ushort StationEight { get; set; }
  256. /// <summary>
  257. /// 输送出料滚筒运行信号
  258. /// </summary>
  259. public ushort OutMaterialingSingle { get; set; }
  260. /// <summary>
  261. /// 输送出料滚筒运行故障信号
  262. /// </summary>
  263. public ushort OutMaterialingTroubleSingle { get; set; }
  264. /// <summary>
  265. /// 当前线体配方完成信号
  266. /// </summary>
  267. public ushort RecipeCompleteSingle { get; set; }
  268. }
  269. /// <summary>
  270. /// 滚筒线3相关变量
  271. /// </summary>
  272. public class RollerLineThree
  273. {
  274. /// <summary>
  275. /// 工位号1
  276. /// </summary>
  277. public ushort StationOne { get; set; }
  278. /// <summary>
  279. /// 工位号2
  280. /// </summary>
  281. public ushort StationTwo { get; set; }
  282. /// <summary>
  283. /// 工位号3
  284. /// </summary>
  285. public ushort StationThree { get; set; }
  286. /// <summary>
  287. /// 工位号4
  288. /// </summary>
  289. public ushort StationFour { get; set; }
  290. /// <summary>
  291. /// 工位号5
  292. /// </summary>
  293. public ushort StationFive { get; set; }
  294. /// <summary>
  295. /// 工位号6
  296. /// </summary>
  297. public ushort StationSix { get; set; }
  298. /// <summary>
  299. /// 工位号7
  300. /// </summary>
  301. public ushort StationSeven { get; set; }
  302. /// <summary>
  303. /// 工位号8
  304. /// </summary>
  305. public ushort StationEight { get; set; }
  306. /// <summary>
  307. /// 输送出料滚筒运行信号
  308. /// </summary>
  309. public ushort OutMaterialingSingle { get; set; }
  310. /// <summary>
  311. /// 输送出料滚筒运行故障信号
  312. /// </summary>
  313. public ushort OutMaterialingTroubleSingle { get; set; }
  314. /// <summary>
  315. /// 当前线体配方完成信号
  316. /// </summary>
  317. public ushort RecipeCompleteSingle { get; set; }
  318. }
  319. /// <summary>
  320. /// 滚筒线4相关变量
  321. /// </summary>
  322. public class RollerLineFour
  323. {
  324. /// <summary>
  325. /// 工位号1
  326. /// </summary>
  327. public ushort StationOne { get; set; }
  328. /// <summary>
  329. /// 工位号2
  330. /// </summary>
  331. public ushort StationTwo { get; set; }
  332. /// <summary>
  333. /// 工位号3
  334. /// </summary>
  335. public ushort StationThree { get; set; }
  336. /// <summary>
  337. /// 工位号4
  338. /// </summary>
  339. public ushort StationFour { get; set; }
  340. /// <summary>
  341. /// 工位号5
  342. /// </summary>
  343. public ushort StationFive { get; set; }
  344. /// <summary>
  345. /// 工位号6
  346. /// </summary>
  347. public ushort StationSix { get; set; }
  348. /// <summary>
  349. /// 工位号7
  350. /// </summary>
  351. public ushort StationSeven { get; set; }
  352. /// <summary>
  353. /// 工位号8
  354. /// </summary>
  355. public ushort StationEight { get; set; }
  356. /// <summary>
  357. /// 输送出料滚筒运行信号
  358. /// </summary>
  359. public ushort OutMaterialingSingle { get; set; }
  360. /// <summary>
  361. /// 输送出料滚筒运行故障信号
  362. /// </summary>
  363. public ushort OutMaterialingTroubleSingle { get; set; }
  364. /// <summary>
  365. /// 当前线体配方完成信号
  366. /// </summary>
  367. public ushort RecipeCompleteSingle { get; set; }
  368. }
  369. /// <summary>
  370. /// 炒锅1相关变量
  371. /// </summary>
  372. public class FryPotOne
  373. {
  374. /// <summary>
  375. /// 进料滚筒运行信号
  376. /// </summary>
  377. public ushort InputMaterialRollerRunningSingle { get; set; }
  378. /// <summary>
  379. /// 进料到位信号
  380. /// </summary>
  381. public ushort InputMaterialArrivedSingle { get; set; }
  382. /// <summary>
  383. /// 空桶到位信号
  384. /// </summary>
  385. public ushort EmptyBarrelArrivedSingle { get; set; }
  386. /// <summary>
  387. /// 空桶滚筒运行信号
  388. /// </summary>
  389. public ushort EmptyBarrelRollerRunningSingle { get; set; }
  390. /// <summary>
  391. /// 滚筒故障信号
  392. /// </summary>
  393. public ushort RollerTroubleSingle { get; set; }
  394. /// <summary>
  395. /// 用油量确认信号
  396. /// </summary>
  397. public ushort OilConfirm { get; set; }
  398. /// <summary>
  399. /// 当前配方用油量
  400. /// </summary>
  401. public double OilCapacity { get; set; }
  402. }
  403. /// <summary>
  404. /// 炒锅2相关变量
  405. /// </summary>
  406. public class FryPotTwo
  407. {
  408. /// <summary>
  409. /// 进料滚筒运行信号
  410. /// </summary>
  411. public ushort InputMaterialRollerRunningSingle { get; set; }
  412. /// <summary>
  413. /// 进料到位信号
  414. /// </summary>
  415. public ushort InputMaterialArrivedSingle { get; set; }
  416. /// <summary>
  417. /// 空桶到位信号
  418. /// </summary>
  419. public ushort EmptyBarrelArrivedSingle { get; set; }
  420. /// <summary>
  421. /// 空桶滚筒运行信号
  422. /// </summary>
  423. public ushort EmptyBarrelRollerRunningSingle { get; set; }
  424. /// <summary>
  425. /// 滚筒故障信号
  426. /// </summary>
  427. public ushort RollerTroubleSingle { get; set; }
  428. /// <summary>
  429. /// 用油量确认信号
  430. /// </summary>
  431. public ushort OilConfirm { get; set; }
  432. /// <summary>
  433. /// 当前配方用油量
  434. /// </summary>
  435. public double OilCapacity { get; set; }
  436. }
  437. /// <summary>
  438. /// 炒锅3相关变量
  439. /// </summary>
  440. public class FryPotThree
  441. {
  442. /// <summary>
  443. /// 进料滚筒运行信号
  444. /// </summary>
  445. public ushort InputMaterialRollerRunningSingle { get; set; }
  446. /// <summary>
  447. /// 进料到位信号
  448. /// </summary>
  449. public ushort InputMaterialArrivedSingle { get; set; }
  450. /// <summary>
  451. /// 空桶到位信号
  452. /// </summary>
  453. public ushort EmptyBarrelArrivedSingle { get; set; }
  454. /// <summary>
  455. /// 空桶滚筒运行信号
  456. /// </summary>
  457. public ushort EmptyBarrelRollerRunningSingle { get; set; }
  458. /// <summary>
  459. /// 滚筒故障信号
  460. /// </summary>
  461. public ushort RollerTroubleSingle { get; set; }
  462. /// <summary>
  463. /// 用油量确认信号
  464. /// </summary>
  465. public ushort OilConfirm { get; set; }
  466. /// <summary>
  467. /// 当前配方用油量
  468. /// </summary>
  469. public double OilCapacity { get; set; }
  470. }
  471. /// <summary>
  472. /// 炒锅4相关变量
  473. /// </summary>
  474. public class FryPotFour
  475. {
  476. /// <summary>
  477. /// 进料滚筒运行信号
  478. /// </summary>
  479. public ushort InputMaterialRollerRunningSingle { get; set; }
  480. /// <summary>
  481. /// 进料到位信号
  482. /// </summary>
  483. public ushort InputMaterialArrivedSingle { get; set; }
  484. /// <summary>
  485. /// 空桶到位信号
  486. /// </summary>
  487. public ushort EmptyBarrelArrivedSingle { get; set; }
  488. /// <summary>
  489. /// 空桶滚筒运行信号
  490. /// </summary>
  491. public ushort EmptyBarrelRollerRunningSingle { get; set; }
  492. /// <summary>
  493. /// 滚筒故障信号
  494. /// </summary>
  495. public ushort RollerTroubleSingle { get; set; }
  496. /// <summary>
  497. /// 用油量确认信号
  498. /// </summary>
  499. public ushort OilConfirm { get; set; }
  500. /// <summary>
  501. /// 当前配方用油量
  502. /// </summary>
  503. public double OilCapacity { get; set; }
  504. }
  505. /// <summary>
  506. /// 炒锅5相关变量
  507. /// </summary>
  508. public class FryPotFive
  509. {
  510. /// <summary>
  511. /// 进料滚筒运行信号
  512. /// </summary>
  513. public ushort InputMaterialRollerRunningSingle { get; set; }
  514. /// <summary>
  515. /// 进料到位信号
  516. /// </summary>
  517. public ushort InputMaterialArrivedSingle { get; set; }
  518. /// <summary>
  519. /// 空桶到位信号
  520. /// </summary>
  521. public ushort EmptyBarrelArrivedSingle { get; set; }
  522. /// <summary>
  523. /// 空桶滚筒运行信号
  524. /// </summary>
  525. public ushort EmptyBarrelRollerRunningSingle { get; set; }
  526. /// <summary>
  527. /// 滚筒故障信号
  528. /// </summary>
  529. public ushort RollerTroubleSingle { get; set; }
  530. /// <summary>
  531. /// 用油量确认信号
  532. /// </summary>
  533. public ushort OilConfirm { get; set; }
  534. /// <summary>
  535. /// 当前配方用油量
  536. /// </summary>
  537. public double OilCapacity { get; set; }
  538. }
  539. }