终端一体化运控平台
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

672 lines
22 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. /// <summary>
  58. /// 清洗台清洗完成信号/洗桶出桶AGV呼叫信号
  59. /// </summary>
  60. public ushort CleanComplete { get; set; }
  61. #region 上位机内部逻辑条件
  62. /// <summary>
  63. /// 退出线体1任务
  64. /// </summary>
  65. public bool ExitLineOneTask { get; set; }
  66. /// <summary>
  67. /// 退出线体2任务
  68. /// </summary>
  69. public bool ExitLineTwoTask { get; set; }
  70. /// <summary>
  71. /// 退出线体3任务
  72. /// </summary>
  73. public bool ExitLineThreeTask { get; set; }
  74. /// <summary>
  75. /// 允许AGV去线体1装桶条件
  76. /// </summary>
  77. public bool AllowAgvToLineLoadRoller { get; set; } = true;
  78. /// <summary>
  79. /// 允许AGV去线体2装桶条件
  80. /// </summary>
  81. public bool AllowAgvToLineTwoLoadRoller { get; set; } = true;
  82. /// <summary>
  83. /// 允许AGV去线体3装桶条件
  84. /// </summary>
  85. public bool AllowAgvToLineThreeLoadRoller { get; set; } = true;
  86. ///// <summary>
  87. ///// 配方唯一ID
  88. ///// </summary>
  89. //public string RecipeId { get; set; }
  90. /// <summary>
  91. /// 线体1对应的进桶出桶互锁
  92. /// </summary>
  93. public bool InOrOutputLock { get; set; }
  94. /// <summary>
  95. /// 线体2对应的进桶出桶互锁
  96. /// </summary>
  97. public bool LTwoInOrOutputLock { get; set; }
  98. /// <summary>
  99. /// 线体3对应的进桶出桶互锁
  100. /// </summary>
  101. public bool LThreeInOrOutputLock { get; set; }
  102. ///// <summary>
  103. ///// 线体1任务执行锁
  104. ///// </summary>
  105. //public bool LOneTaskLock { get; set; }
  106. ///// <summary>
  107. ///// 线体2任务执行锁
  108. ///// </summary>
  109. //public bool LTwoTaskLock { get; set; }
  110. ///// <summary>
  111. ///// 线体3任务执行锁
  112. ///// </summary>
  113. //public bool LThreeTaskLock { get; set; }
  114. /// <summary>
  115. /// 线体1当前正在制作的配方名称
  116. /// </summary>
  117. public string LOneCurrentRecipeName { get; set; } = string.Empty;
  118. /// <summary>
  119. /// 线体2当前正在制作的配方名称
  120. /// </summary>
  121. public string LTwoCurrentRecipeName { get; set; } = string.Empty;
  122. /// <summary>
  123. /// 线体3当前正在制作的配方名称
  124. /// </summary>
  125. public string LThreeCurrentRecipeName { get; set; } = string.Empty;
  126. #endregion
  127. #region 线体1流程互锁变量
  128. public bool LoadRoller { get; set; }
  129. public bool AgvToFryPot { get; set; }
  130. public bool PotOneInputMaterialArrive { get; set; }
  131. public bool PotOneOutputRollerArrive { get; set; }
  132. public bool AgvArrivePot { get; set; }
  133. #endregion
  134. #region 线体2流程互锁变量
  135. public bool LTwoLoadRoller { get; set; }
  136. public bool LTwoAgvToFryPot { get; set; }
  137. public bool LTwoPotInputMaterialArrive { get; set; }
  138. public bool LTwoPotOutputRollerArrive { get; set; }
  139. public bool LTwoAgvArrivePot { get; set; }
  140. #endregion
  141. #region 线体3流程互锁变量
  142. public bool LThreeLoadRoller { get; set; }
  143. public bool LThreeAgvToFryPot { get; set; }
  144. public bool LThreePotInputMaterialArrive { get; set; }
  145. public bool LThreePotOutputRollerArrive { get; set; }
  146. public bool LThreeAgvArrivePot { get; set; }
  147. #endregion
  148. #region AGV视图显示变量
  149. public int LOneMaterialNum { get; set; } = 0;
  150. public int LOneFryPotSerial { get; set; } = 1;
  151. public int LOneCurrentCookingStep { get; set; } = 0;
  152. public bool agvArriveUpLoad { get; set; }
  153. public bool agvArriveUnLoad { get; set; }
  154. public bool agvFryPotEmptyRollerArrive { get; set; }
  155. public bool EmptyRollerUnLoadcCom { get; set; }//AGV空桶4号线体下料完成
  156. public bool agvLineOneLoadCom { get; set; }//线体1上料完成
  157. public int LTwoMaterialNum { get; set; } = 0;
  158. public int LTwoFryPotSerial { get; set; } = 2;
  159. public int LTwoCurrentCookingStep { get; set; } = 0;
  160. public bool agvArriveLTwoUpLoad { get; set; }
  161. public bool LTwoagvArriveUnLoad { get; set; }
  162. public bool LTwoagvFryPotEmptyRollerArrive { get; set; }
  163. public bool agvLineTwoLoadCom { get; set; }//线体2上料完成
  164. public int LThreeMaterialNum { get; set; } = 0;
  165. public int LThreeFryPotSerial { get; set; } = 3;
  166. public int LThreeCurrentCookingStep { get; set; } = 0;
  167. public bool agvArriveLThreeUpLoad { get; set; }
  168. public bool LThreeagvArriveUnLoad { get; set; }
  169. public bool LThreeagvFryPotEmptyRollerArrive { get; set; }
  170. public bool agvLineThreeLoadCom { get; set; }//线体1上料完成
  171. public int LFourRollerNum { get; set; } = 0;//4号线体空桶数量
  172. //新增空桶清洗系列变量
  173. public bool agvArriveLineFour { get; set; }//agv从清洗台到达线体4下料位置
  174. //public bool agvArriveCleanUnLoad { get; set; }//agv到达清洗台下料位置
  175. public bool agvArriveCleanLoad { get; set; }//agv到达清洗台上料位置
  176. public bool agvArriveLineOneLoadEmptyRoller { get; set; }//agv到达线体1空桶上料位置
  177. public bool agvArriveLineTwoLoadEmptyRoller { get; set; }//agv到达线体2空桶上料位置
  178. public bool agvArriveLineThreeLoadEmptyRoller { get; set; }//agv到达线体3空桶上料位置
  179. public bool agvArriveLineOneLoadCom { get; set; } //agv线体1空桶上料完成
  180. public bool agvArriveLineTwoLoadCom { get; set; } //agv线体2空桶上料完成
  181. public bool agvArriveLineThreeLoadCom { get; set; }//agv线体3空桶上料完成
  182. //空桶清洗流程锁
  183. #endregion
  184. }
  185. /// <summary>
  186. /// 滚筒线1相关变量
  187. /// </summary>
  188. public class RollerLineOne
  189. {
  190. /// <summary>
  191. /// 工位号1
  192. /// </summary>
  193. public ushort StationOne { get; set; }
  194. /// <summary>
  195. /// 工位号2
  196. /// </summary>
  197. public ushort StationTwo { get; set; }
  198. /// <summary>
  199. /// 工位号3
  200. /// </summary>
  201. public ushort StationThree { get; set; }
  202. /// <summary>
  203. /// 工位号4
  204. /// </summary>
  205. public ushort StationFour { get; set; }
  206. /// <summary>
  207. /// 工位号5
  208. /// </summary>
  209. public ushort StationFive { get; set; }
  210. /// <summary>
  211. /// 工位号6
  212. /// </summary>
  213. public ushort StationSix { get; set; }
  214. /// <summary>
  215. /// 工位号7
  216. /// </summary>
  217. public ushort StationSeven { get; set; }
  218. /// <summary>
  219. /// 工位号8
  220. /// </summary>
  221. public ushort StationEight { get; set; }
  222. /// <summary>
  223. /// 输送出料滚筒运行信号
  224. /// </summary>
  225. public ushort OutMaterialingSingle { get; set; }
  226. /// <summary>
  227. /// 输送出料滚筒运行故障信号
  228. /// </summary>
  229. public ushort OutMaterialingTroubleSingle { get; set; }
  230. /// <summary>
  231. /// 当前线体配方完成信号
  232. /// </summary>
  233. public ushort RecipeCompleteSingle { get; set; }
  234. /// <summary>
  235. /// 当前配方完成的中转信号
  236. /// </summary>
  237. public ushort RecipeComMidSingle { get; set; } = 1;
  238. /// <summary>
  239. /// 线体1上空桶确认信号
  240. /// </summary>
  241. public ushort EmptyRollerConfirmSingle { get; set; }
  242. /// <summary>
  243. /// 线体1上单个空桶编号
  244. /// </summary>
  245. public ushort EmptyRollerNum { get; set; }
  246. /// <summary>
  247. /// 上一个桶是否是空桶
  248. /// </summary>
  249. public bool IsEpmtyBefore { get; set; } //空桶上料结束后,配方料桶AGV才能去1号线装桶
  250. public bool CanRun { get; set; } = true; //配方料桶上料结束后,线体空桶AGV才能1号线装桶
  251. /// <summary>
  252. /// 线体1上所有空桶的编号集合
  253. /// </summary>
  254. public List<ushort> EmptyRollerNums { get; set; } = new List<ushort>();
  255. /// <summary>
  256. /// AGV从炒锅到达线体4空桶下料位置
  257. /// </summary>
  258. public bool agvArriveLineFour { get; set; }
  259. /// <summary>
  260. /// AGV从线体1到达清洗台
  261. /// </summary>
  262. public bool agvArriveCleanUnLoad { get; set; }
  263. }
  264. /// <summary>
  265. /// 滚筒线2相关变量
  266. /// </summary>
  267. public class RollerLineTwo
  268. {
  269. /// <summary>
  270. /// 工位号1
  271. /// </summary>
  272. public ushort StationOne { get; set; }
  273. /// <summary>
  274. /// 工位号2
  275. /// </summary>
  276. public ushort StationTwo { get; set; }
  277. /// <summary>
  278. /// 工位号3
  279. /// </summary>
  280. public ushort StationThree { get; set; }
  281. /// <summary>
  282. /// 工位号4
  283. /// </summary>
  284. public ushort StationFour { get; set; }
  285. /// <summary>
  286. /// 工位号5
  287. /// </summary>
  288. public ushort StationFive { get; set; }
  289. /// <summary>
  290. /// 工位号6
  291. /// </summary>
  292. public ushort StationSix { get; set; }
  293. /// <summary>
  294. /// 工位号7
  295. /// </summary>
  296. public ushort StationSeven { get; set; }
  297. /// <summary>
  298. /// 工位号8
  299. /// </summary>
  300. public ushort StationEight { get; set; }
  301. /// <summary>
  302. /// 输送出料滚筒运行信号
  303. /// </summary>
  304. public ushort OutMaterialingSingle { get; set; }
  305. /// <summary>
  306. /// 输送出料滚筒运行故障信号
  307. /// </summary>
  308. public ushort OutMaterialingTroubleSingle { get; set; }
  309. /// <summary>
  310. /// 当前线体配方完成信号
  311. /// </summary>
  312. public ushort RecipeCompleteSingle { get; set; }
  313. /// <summary>
  314. /// 当前配方完成的中转信号
  315. /// </summary>
  316. public ushort RecipeComMidSingle { get; set; } = 1;
  317. /// <summary>
  318. /// 线体1上空桶确认信号
  319. /// </summary>
  320. public ushort EmptyRollerConfirmSingle { get; set; }
  321. /// <summary>
  322. /// 线体1上单个空桶编号
  323. /// </summary>
  324. public ushort EmptyRollerNum { get; set; }
  325. /// <summary>
  326. /// 上一个同时否是空桶
  327. /// </summary>
  328. public bool IsEpmtyBefore { get; set; }
  329. public bool CanRun { get; set; } = true; //配方料桶上料结束后,线体空桶AGV才能1号线装桶
  330. /// <summary>
  331. /// 线体2上所有空桶的编号集合
  332. /// </summary>
  333. public List<ushort> EmptyRollerNums { get; set; } = new List<ushort>();
  334. /// <summary>
  335. /// AGV从炒锅到达线体4空桶下料位置
  336. /// </summary>
  337. public bool agvArriveLineFour { get; set; }
  338. /// <summary>
  339. /// AGV从线体2到达清洗台
  340. /// </summary>
  341. public bool agvArriveCleanUnLoad { get; set; }
  342. }
  343. /// <summary>
  344. /// 滚筒线3相关变量
  345. /// </summary>
  346. public class RollerLineThree
  347. {
  348. /// <summary>
  349. /// 工位号1
  350. /// </summary>
  351. public ushort StationOne { get; set; }
  352. /// <summary>
  353. /// 工位号2
  354. /// </summary>
  355. public ushort StationTwo { get; set; }
  356. /// <summary>
  357. /// 工位号3
  358. /// </summary>
  359. public ushort StationThree { get; set; }
  360. /// <summary>
  361. /// 工位号4
  362. /// </summary>
  363. public ushort StationFour { get; set; }
  364. /// <summary>
  365. /// 工位号5
  366. /// </summary>
  367. public ushort StationFive { get; set; }
  368. /// <summary>
  369. /// 工位号6
  370. /// </summary>
  371. public ushort StationSix { get; set; }
  372. /// <summary>
  373. /// 工位号7
  374. /// </summary>
  375. public ushort StationSeven { get; set; }
  376. /// <summary>
  377. /// 工位号8
  378. /// </summary>
  379. public ushort StationEight { get; set; }
  380. /// <summary>
  381. /// 输送出料滚筒运行信号
  382. /// </summary>
  383. public ushort OutMaterialingSingle { get; set; }
  384. /// <summary>
  385. /// 输送出料滚筒运行故障信号
  386. /// </summary>
  387. public ushort OutMaterialingTroubleSingle { get; set; }
  388. /// <summary>
  389. /// 当前线体配方完成信号
  390. /// </summary>
  391. public ushort RecipeCompleteSingle { get; set; }
  392. /// <summary>
  393. /// 当前配方完成的中转信号
  394. /// </summary>
  395. public ushort RecipeComMidSingle { get; set; } = 1;
  396. /// <summary>
  397. /// 线体1上空桶确认信号
  398. /// </summary>
  399. public ushort EmptyRollerConfirmSingle { get; set; }
  400. /// <summary>
  401. /// 线体1上单个空桶编号
  402. /// </summary>
  403. public ushort EmptyRollerNum { get; set; }
  404. /// <summary>
  405. /// 上一个同时否是空桶
  406. /// </summary>
  407. public bool IsEpmtyBefore { get; set; }
  408. public bool CanRun { get; set; } = true;//配方料桶上料结束后,线体空桶AGV才能1号线装桶
  409. /// <summary>
  410. /// 线体3上所有空桶的编号集合
  411. /// </summary>
  412. public List<ushort> EmptyRollerNums { get; set; } = new List<ushort>();
  413. /// <summary>
  414. /// AGV从炒锅到达线体4空桶下料位置
  415. /// </summary>
  416. public bool agvArriveLineFour { get; set; }
  417. /// <summary>
  418. /// AGV从线体3到达清洗台
  419. /// </summary>
  420. public bool agvArriveCleanUnLoad { get; set; }
  421. }
  422. /// <summary>
  423. /// 滚筒线4相关变量
  424. /// </summary>
  425. public class RollerLineFour
  426. {
  427. /// <summary>
  428. /// 工位号1
  429. /// </summary>
  430. public ushort StationOne { get; set; }
  431. /// <summary>
  432. /// 工位号2
  433. /// </summary>
  434. public ushort StationTwo { get; set; }
  435. /// <summary>
  436. /// 工位号3
  437. /// </summary>
  438. public ushort StationThree { get; set; }
  439. /// <summary>
  440. /// 工位号4
  441. /// </summary>
  442. public ushort StationFour { get; set; }
  443. /// <summary>
  444. /// 工位号5
  445. /// </summary>
  446. public ushort StationFive { get; set; }
  447. /// <summary>
  448. /// 工位号6
  449. /// </summary>
  450. public ushort StationSix { get; set; }
  451. /// <summary>
  452. /// 工位号7
  453. /// </summary>
  454. public ushort StationSeven { get; set; }
  455. /// <summary>
  456. /// 工位号8
  457. /// </summary>
  458. public ushort StationEight { get; set; }
  459. /// <summary>
  460. /// 输送出料滚筒运行信号
  461. /// </summary>
  462. public ushort OutMaterialingSingle { get; set; }
  463. /// <summary>
  464. /// 输送出料滚筒运行故障信号
  465. /// </summary>
  466. public ushort OutMaterialingTroubleSingle { get; set; }
  467. /// <summary>
  468. /// 当前线体配方完成信号
  469. /// </summary>
  470. public ushort RecipeCompleteSingle { get; set; }
  471. /// <summary>
  472. /// 当前配方完成的中转信号
  473. /// </summary>
  474. public ushort RecipeComMidSingle { get; set; } = 1;
  475. }
  476. /// <summary>
  477. /// 炒锅1相关变量
  478. /// </summary>
  479. public class FryPotOne
  480. {
  481. /// <summary>
  482. /// 进料滚筒运行信号
  483. /// </summary>
  484. public ushort InputMaterialRollerRunningSingle { get; set; }
  485. /// <summary>
  486. /// 进料到位信号
  487. /// </summary>
  488. public ushort InputMaterialArrivedSingle { get; set; }
  489. /// <summary>
  490. /// 空桶到位信号
  491. /// </summary>
  492. public ushort EmptyBarrelArrivedSingle { get; set; }
  493. /// <summary>
  494. /// 空桶滚筒运行信号
  495. /// </summary>
  496. public ushort EmptyBarrelRollerRunningSingle { get; set; }
  497. /// <summary>
  498. /// 滚筒故障信号
  499. /// </summary>
  500. public ushort RollerTroubleSingle { get; set; }
  501. /// <summary>
  502. /// 用油量确认信号
  503. /// </summary>
  504. public ushort OilConfirm { get; set; }
  505. /// <summary>
  506. /// 当前配方用油量
  507. /// </summary>
  508. public double OilCapacity { get; set; }
  509. }
  510. /// <summary>
  511. /// 炒锅2相关变量
  512. /// </summary>
  513. public class FryPotTwo
  514. {
  515. /// <summary>
  516. /// 进料滚筒运行信号
  517. /// </summary>
  518. public ushort InputMaterialRollerRunningSingle { get; set; }
  519. /// <summary>
  520. /// 进料到位信号
  521. /// </summary>
  522. public ushort InputMaterialArrivedSingle { get; set; }
  523. /// <summary>
  524. /// 空桶到位信号
  525. /// </summary>
  526. public ushort EmptyBarrelArrivedSingle { get; set; }
  527. /// <summary>
  528. /// 空桶滚筒运行信号
  529. /// </summary>
  530. public ushort EmptyBarrelRollerRunningSingle { get; set; }
  531. /// <summary>
  532. /// 滚筒故障信号
  533. /// </summary>
  534. public ushort RollerTroubleSingle { get; set; }
  535. /// <summary>
  536. /// 用油量确认信号
  537. /// </summary>
  538. public ushort OilConfirm { get; set; }
  539. /// <summary>
  540. /// 当前配方用油量
  541. /// </summary>
  542. public double OilCapacity { get; set; }
  543. }
  544. /// <summary>
  545. /// 炒锅3相关变量
  546. /// </summary>
  547. public class FryPotThree
  548. {
  549. /// <summary>
  550. /// 进料滚筒运行信号
  551. /// </summary>
  552. public ushort InputMaterialRollerRunningSingle { get; set; }
  553. /// <summary>
  554. /// 进料到位信号
  555. /// </summary>
  556. public ushort InputMaterialArrivedSingle { get; set; }
  557. /// <summary>
  558. /// 空桶到位信号
  559. /// </summary>
  560. public ushort EmptyBarrelArrivedSingle { get; set; }
  561. /// <summary>
  562. /// 空桶滚筒运行信号
  563. /// </summary>
  564. public ushort EmptyBarrelRollerRunningSingle { get; set; }
  565. /// <summary>
  566. /// 滚筒故障信号
  567. /// </summary>
  568. public ushort RollerTroubleSingle { get; set; }
  569. /// <summary>
  570. /// 用油量确认信号
  571. /// </summary>
  572. public ushort OilConfirm { get; set; }
  573. /// <summary>
  574. /// 当前配方用油量
  575. /// </summary>
  576. public double OilCapacity { get; set; }
  577. }
  578. /// <summary>
  579. /// 炒锅4相关变量
  580. /// </summary>
  581. public class FryPotFour
  582. {
  583. /// <summary>
  584. /// 进料滚筒运行信号
  585. /// </summary>
  586. public ushort InputMaterialRollerRunningSingle { get; set; }
  587. /// <summary>
  588. /// 进料到位信号
  589. /// </summary>
  590. public ushort InputMaterialArrivedSingle { get; set; }
  591. /// <summary>
  592. /// 空桶到位信号
  593. /// </summary>
  594. public ushort EmptyBarrelArrivedSingle { get; set; }
  595. /// <summary>
  596. /// 空桶滚筒运行信号
  597. /// </summary>
  598. public ushort EmptyBarrelRollerRunningSingle { get; set; }
  599. /// <summary>
  600. /// 滚筒故障信号
  601. /// </summary>
  602. public ushort RollerTroubleSingle { get; set; }
  603. /// <summary>
  604. /// 用油量确认信号
  605. /// </summary>
  606. public ushort OilConfirm { get; set; }
  607. /// <summary>
  608. /// 当前配方用油量
  609. /// </summary>
  610. public double OilCapacity { get; set; }
  611. }
  612. /// <summary>
  613. /// 炒锅5相关变量
  614. /// </summary>
  615. public class FryPotFive
  616. {
  617. /// <summary>
  618. /// 进料滚筒运行信号
  619. /// </summary>
  620. public ushort InputMaterialRollerRunningSingle { get; set; }
  621. /// <summary>
  622. /// 进料到位信号
  623. /// </summary>
  624. public ushort InputMaterialArrivedSingle { get; set; }
  625. /// <summary>
  626. /// 空桶到位信号
  627. /// </summary>
  628. public ushort EmptyBarrelArrivedSingle { get; set; }
  629. /// <summary>
  630. /// 空桶滚筒运行信号
  631. /// </summary>
  632. public ushort EmptyBarrelRollerRunningSingle { get; set; }
  633. /// <summary>
  634. /// 滚筒故障信号
  635. /// </summary>
  636. public ushort RollerTroubleSingle { get; set; }
  637. /// <summary>
  638. /// 用油量确认信号
  639. /// </summary>
  640. public ushort OilConfirm { get; set; }
  641. /// <summary>
  642. /// 当前配方用油量
  643. /// </summary>
  644. public double OilCapacity { get; set; }
  645. }
  646. }