终端一体化运控平台
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.
 
 
 

648 lines
21 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. }
  256. /// <summary>
  257. /// 滚筒线2相关变量
  258. /// </summary>
  259. public class RollerLineTwo
  260. {
  261. /// <summary>
  262. /// 工位号1
  263. /// </summary>
  264. public ushort StationOne { get; set; }
  265. /// <summary>
  266. /// 工位号2
  267. /// </summary>
  268. public ushort StationTwo { get; set; }
  269. /// <summary>
  270. /// 工位号3
  271. /// </summary>
  272. public ushort StationThree { get; set; }
  273. /// <summary>
  274. /// 工位号4
  275. /// </summary>
  276. public ushort StationFour { get; set; }
  277. /// <summary>
  278. /// 工位号5
  279. /// </summary>
  280. public ushort StationFive { get; set; }
  281. /// <summary>
  282. /// 工位号6
  283. /// </summary>
  284. public ushort StationSix { get; set; }
  285. /// <summary>
  286. /// 工位号7
  287. /// </summary>
  288. public ushort StationSeven { get; set; }
  289. /// <summary>
  290. /// 工位号8
  291. /// </summary>
  292. public ushort StationEight { get; set; }
  293. /// <summary>
  294. /// 输送出料滚筒运行信号
  295. /// </summary>
  296. public ushort OutMaterialingSingle { get; set; }
  297. /// <summary>
  298. /// 输送出料滚筒运行故障信号
  299. /// </summary>
  300. public ushort OutMaterialingTroubleSingle { get; set; }
  301. /// <summary>
  302. /// 当前线体配方完成信号
  303. /// </summary>
  304. public ushort RecipeCompleteSingle { get; set; }
  305. /// <summary>
  306. /// 当前配方完成的中转信号
  307. /// </summary>
  308. public ushort RecipeComMidSingle { get; set; } = 1;
  309. /// <summary>
  310. /// 线体1上空桶确认信号
  311. /// </summary>
  312. public ushort EmptyRollerConfirmSingle { get; set; }
  313. /// <summary>
  314. /// 线体1上单个空桶编号
  315. /// </summary>
  316. public ushort EmptyRollerNum { get; set; }
  317. /// <summary>
  318. /// 上一个同时否是空桶
  319. /// </summary>
  320. public bool IsEpmtyBefore { get; set; }
  321. public bool CanRun { get; set; } = true; //配方料桶上料结束后,线体空桶AGV才能1号线装桶
  322. /// <summary>
  323. /// 线体2上所有空桶的编号集合
  324. /// </summary>
  325. public List<ushort> EmptyRollerNums { get; set; } = new List<ushort>();
  326. }
  327. /// <summary>
  328. /// 滚筒线3相关变量
  329. /// </summary>
  330. public class RollerLineThree
  331. {
  332. /// <summary>
  333. /// 工位号1
  334. /// </summary>
  335. public ushort StationOne { get; set; }
  336. /// <summary>
  337. /// 工位号2
  338. /// </summary>
  339. public ushort StationTwo { get; set; }
  340. /// <summary>
  341. /// 工位号3
  342. /// </summary>
  343. public ushort StationThree { get; set; }
  344. /// <summary>
  345. /// 工位号4
  346. /// </summary>
  347. public ushort StationFour { get; set; }
  348. /// <summary>
  349. /// 工位号5
  350. /// </summary>
  351. public ushort StationFive { get; set; }
  352. /// <summary>
  353. /// 工位号6
  354. /// </summary>
  355. public ushort StationSix { get; set; }
  356. /// <summary>
  357. /// 工位号7
  358. /// </summary>
  359. public ushort StationSeven { get; set; }
  360. /// <summary>
  361. /// 工位号8
  362. /// </summary>
  363. public ushort StationEight { get; set; }
  364. /// <summary>
  365. /// 输送出料滚筒运行信号
  366. /// </summary>
  367. public ushort OutMaterialingSingle { get; set; }
  368. /// <summary>
  369. /// 输送出料滚筒运行故障信号
  370. /// </summary>
  371. public ushort OutMaterialingTroubleSingle { get; set; }
  372. /// <summary>
  373. /// 当前线体配方完成信号
  374. /// </summary>
  375. public ushort RecipeCompleteSingle { get; set; }
  376. /// <summary>
  377. /// 当前配方完成的中转信号
  378. /// </summary>
  379. public ushort RecipeComMidSingle { get; set; } = 1;
  380. /// <summary>
  381. /// 线体1上空桶确认信号
  382. /// </summary>
  383. public ushort EmptyRollerConfirmSingle { get; set; }
  384. /// <summary>
  385. /// 线体1上单个空桶编号
  386. /// </summary>
  387. public ushort EmptyRollerNum { get; set; }
  388. /// <summary>
  389. /// 上一个同时否是空桶
  390. /// </summary>
  391. public bool IsEpmtyBefore { get; set; }
  392. public bool CanRun { get; set; } = true;//配方料桶上料结束后,线体空桶AGV才能1号线装桶
  393. /// <summary>
  394. /// 线体3上所有空桶的编号集合
  395. /// </summary>
  396. public List<ushort> EmptyRollerNums { get; set; } = new List<ushort>();
  397. }
  398. /// <summary>
  399. /// 滚筒线4相关变量
  400. /// </summary>
  401. public class RollerLineFour
  402. {
  403. /// <summary>
  404. /// 工位号1
  405. /// </summary>
  406. public ushort StationOne { get; set; }
  407. /// <summary>
  408. /// 工位号2
  409. /// </summary>
  410. public ushort StationTwo { get; set; }
  411. /// <summary>
  412. /// 工位号3
  413. /// </summary>
  414. public ushort StationThree { get; set; }
  415. /// <summary>
  416. /// 工位号4
  417. /// </summary>
  418. public ushort StationFour { get; set; }
  419. /// <summary>
  420. /// 工位号5
  421. /// </summary>
  422. public ushort StationFive { get; set; }
  423. /// <summary>
  424. /// 工位号6
  425. /// </summary>
  426. public ushort StationSix { get; set; }
  427. /// <summary>
  428. /// 工位号7
  429. /// </summary>
  430. public ushort StationSeven { get; set; }
  431. /// <summary>
  432. /// 工位号8
  433. /// </summary>
  434. public ushort StationEight { get; set; }
  435. /// <summary>
  436. /// 输送出料滚筒运行信号
  437. /// </summary>
  438. public ushort OutMaterialingSingle { get; set; }
  439. /// <summary>
  440. /// 输送出料滚筒运行故障信号
  441. /// </summary>
  442. public ushort OutMaterialingTroubleSingle { get; set; }
  443. /// <summary>
  444. /// 当前线体配方完成信号
  445. /// </summary>
  446. public ushort RecipeCompleteSingle { get; set; }
  447. /// <summary>
  448. /// 当前配方完成的中转信号
  449. /// </summary>
  450. public ushort RecipeComMidSingle { get; set; } = 1;
  451. }
  452. /// <summary>
  453. /// 炒锅1相关变量
  454. /// </summary>
  455. public class FryPotOne
  456. {
  457. /// <summary>
  458. /// 进料滚筒运行信号
  459. /// </summary>
  460. public ushort InputMaterialRollerRunningSingle { get; set; }
  461. /// <summary>
  462. /// 进料到位信号
  463. /// </summary>
  464. public ushort InputMaterialArrivedSingle { get; set; }
  465. /// <summary>
  466. /// 空桶到位信号
  467. /// </summary>
  468. public ushort EmptyBarrelArrivedSingle { get; set; }
  469. /// <summary>
  470. /// 空桶滚筒运行信号
  471. /// </summary>
  472. public ushort EmptyBarrelRollerRunningSingle { get; set; }
  473. /// <summary>
  474. /// 滚筒故障信号
  475. /// </summary>
  476. public ushort RollerTroubleSingle { get; set; }
  477. /// <summary>
  478. /// 用油量确认信号
  479. /// </summary>
  480. public ushort OilConfirm { get; set; }
  481. /// <summary>
  482. /// 当前配方用油量
  483. /// </summary>
  484. public double OilCapacity { get; set; }
  485. }
  486. /// <summary>
  487. /// 炒锅2相关变量
  488. /// </summary>
  489. public class FryPotTwo
  490. {
  491. /// <summary>
  492. /// 进料滚筒运行信号
  493. /// </summary>
  494. public ushort InputMaterialRollerRunningSingle { get; set; }
  495. /// <summary>
  496. /// 进料到位信号
  497. /// </summary>
  498. public ushort InputMaterialArrivedSingle { get; set; }
  499. /// <summary>
  500. /// 空桶到位信号
  501. /// </summary>
  502. public ushort EmptyBarrelArrivedSingle { get; set; }
  503. /// <summary>
  504. /// 空桶滚筒运行信号
  505. /// </summary>
  506. public ushort EmptyBarrelRollerRunningSingle { get; set; }
  507. /// <summary>
  508. /// 滚筒故障信号
  509. /// </summary>
  510. public ushort RollerTroubleSingle { get; set; }
  511. /// <summary>
  512. /// 用油量确认信号
  513. /// </summary>
  514. public ushort OilConfirm { get; set; }
  515. /// <summary>
  516. /// 当前配方用油量
  517. /// </summary>
  518. public double OilCapacity { get; set; }
  519. }
  520. /// <summary>
  521. /// 炒锅3相关变量
  522. /// </summary>
  523. public class FryPotThree
  524. {
  525. /// <summary>
  526. /// 进料滚筒运行信号
  527. /// </summary>
  528. public ushort InputMaterialRollerRunningSingle { get; set; }
  529. /// <summary>
  530. /// 进料到位信号
  531. /// </summary>
  532. public ushort InputMaterialArrivedSingle { get; set; }
  533. /// <summary>
  534. /// 空桶到位信号
  535. /// </summary>
  536. public ushort EmptyBarrelArrivedSingle { get; set; }
  537. /// <summary>
  538. /// 空桶滚筒运行信号
  539. /// </summary>
  540. public ushort EmptyBarrelRollerRunningSingle { get; set; }
  541. /// <summary>
  542. /// 滚筒故障信号
  543. /// </summary>
  544. public ushort RollerTroubleSingle { get; set; }
  545. /// <summary>
  546. /// 用油量确认信号
  547. /// </summary>
  548. public ushort OilConfirm { get; set; }
  549. /// <summary>
  550. /// 当前配方用油量
  551. /// </summary>
  552. public double OilCapacity { get; set; }
  553. }
  554. /// <summary>
  555. /// 炒锅4相关变量
  556. /// </summary>
  557. public class FryPotFour
  558. {
  559. /// <summary>
  560. /// 进料滚筒运行信号
  561. /// </summary>
  562. public ushort InputMaterialRollerRunningSingle { get; set; }
  563. /// <summary>
  564. /// 进料到位信号
  565. /// </summary>
  566. public ushort InputMaterialArrivedSingle { get; set; }
  567. /// <summary>
  568. /// 空桶到位信号
  569. /// </summary>
  570. public ushort EmptyBarrelArrivedSingle { get; set; }
  571. /// <summary>
  572. /// 空桶滚筒运行信号
  573. /// </summary>
  574. public ushort EmptyBarrelRollerRunningSingle { get; set; }
  575. /// <summary>
  576. /// 滚筒故障信号
  577. /// </summary>
  578. public ushort RollerTroubleSingle { get; set; }
  579. /// <summary>
  580. /// 用油量确认信号
  581. /// </summary>
  582. public ushort OilConfirm { get; set; }
  583. /// <summary>
  584. /// 当前配方用油量
  585. /// </summary>
  586. public double OilCapacity { get; set; }
  587. }
  588. /// <summary>
  589. /// 炒锅5相关变量
  590. /// </summary>
  591. public class FryPotFive
  592. {
  593. /// <summary>
  594. /// 进料滚筒运行信号
  595. /// </summary>
  596. public ushort InputMaterialRollerRunningSingle { get; set; }
  597. /// <summary>
  598. /// 进料到位信号
  599. /// </summary>
  600. public ushort InputMaterialArrivedSingle { get; set; }
  601. /// <summary>
  602. /// 空桶到位信号
  603. /// </summary>
  604. public ushort EmptyBarrelArrivedSingle { get; set; }
  605. /// <summary>
  606. /// 空桶滚筒运行信号
  607. /// </summary>
  608. public ushort EmptyBarrelRollerRunningSingle { get; set; }
  609. /// <summary>
  610. /// 滚筒故障信号
  611. /// </summary>
  612. public ushort RollerTroubleSingle { get; set; }
  613. /// <summary>
  614. /// 用油量确认信号
  615. /// </summary>
  616. public ushort OilConfirm { get; set; }
  617. /// <summary>
  618. /// 当前配方用油量
  619. /// </summary>
  620. public double OilCapacity { get; set; }
  621. }
  622. }