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

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