acme-004.awl 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427
  1. FUNCTION_BLOCK FB 1
  2. TITLE =
  3. VERSION : 0.0
  4. VAR_INPUT
  5. Start : BOOL ;
  6. Stop : BOOL ;
  7. Response : BOOL ;
  8. Reset_Maint : BOOL ;
  9. Timer_No : TIMER ;
  10. Response_Time : S5TIME ;
  11. END_VAR
  12. VAR_OUTPUT
  13. Fault : BOOL ;
  14. Start_Dsp : BOOL ;
  15. Stop_Dsp : BOOL ;
  16. Maint : BOOL ;
  17. END_VAR
  18. VAR_IN_OUT
  19. Motor : BOOL ;
  20. END_VAR
  21. VAR
  22. Time_bin : WORD ;
  23. Time_BCD : WORD ;
  24. Starts : INT ;
  25. Start_Edge : BOOL ;
  26. END_VAR
  27. BEGIN
  28. NETWORK
  29. TITLE =Start/Stop and Latching
  30. A( ;
  31. O #Start;
  32. O #Motor;
  33. ) ;
  34. AN #Stop;
  35. = #Motor;
  36. NETWORK
  37. TITLE =Startup Monitoring
  38. A #Motor;
  39. L #Response_Time;
  40. SD #Timer_No;
  41. AN #Motor;
  42. R #Timer_No;
  43. L #Timer_No;
  44. T #Time_bin;
  45. LC #Timer_No;
  46. T #Time_BCD;
  47. A #Timer_No;
  48. AN #Response;
  49. S #Fault;
  50. R #Motor;
  51. NETWORK
  52. TITLE =Start Lamp / Fault Reset
  53. A #Response;
  54. = #Start_Dsp;
  55. R #Fault;
  56. NETWORK
  57. TITLE =Stop Lamp
  58. AN #Response;
  59. = #Stop_Dsp;
  60. NETWORK
  61. TITLE =Count Starts
  62. A #Motor;
  63. FP #Start_Edge;
  64. JCN lab1;
  65. L #Starts;
  66. + 1;
  67. T #Starts;
  68. lab1: NOP 0;
  69. NETWORK
  70. TITLE =Maintenance
  71. L #Starts;
  72. L 50;
  73. >=I ;
  74. = #Maint;
  75. NETWORK
  76. TITLE =Reset Maintenance
  77. A #Reset_Maint;
  78. A #Maint;
  79. JCN END;
  80. L 0;
  81. T #Starts;
  82. END: NOP 0;
  83. END_FUNCTION_BLOCK
  84. DATA_BLOCK DB 1
  85. TITLE =
  86. VERSION : 0.0
  87. FB 1
  88. BEGIN
  89. Start := FALSE;
  90. Stop := FALSE;
  91. Response := FALSE;
  92. Reset_Maint := FALSE;
  93. Timer_No := T 0;
  94. Response_Time := S5T#0MS;
  95. Fault := FALSE;
  96. Start_Dsp := FALSE;
  97. Stop_Dsp := FALSE;
  98. Maint := FALSE;
  99. Motor := FALSE;
  100. Time_bin := W#16#0;
  101. Time_BCD := W#16#0;
  102. Starts := 0;
  103. Start_Edge := FALSE;
  104. END_DATA_BLOCK
  105. DATA_BLOCK DB 2
  106. TITLE =
  107. VERSION : 0.0
  108. FB 1
  109. BEGIN
  110. Start := FALSE;
  111. Stop := FALSE;
  112. Response := FALSE;
  113. Reset_Maint := FALSE;
  114. Timer_No := T 0;
  115. Response_Time := S5T#0MS;
  116. Fault := FALSE;
  117. Start_Dsp := FALSE;
  118. Stop_Dsp := FALSE;
  119. Maint := FALSE;
  120. Motor := FALSE;
  121. Time_bin := W#16#0;
  122. Time_BCD := W#16#0;
  123. Starts := 0;
  124. Start_Edge := FALSE;
  125. END_DATA_BLOCK
  126. DATA_BLOCK DB 3
  127. TITLE =
  128. VERSION : 0.0
  129. FB 1
  130. BEGIN
  131. Start := FALSE;
  132. Stop := FALSE;
  133. Response := FALSE;
  134. Reset_Maint := FALSE;
  135. Timer_No := T 0;
  136. Response_Time := S5T#0MS;
  137. Fault := FALSE;
  138. Start_Dsp := FALSE;
  139. Stop_Dsp := FALSE;
  140. Maint := FALSE;
  141. Motor := FALSE;
  142. Time_bin := W#16#0;
  143. Time_BCD := W#16#0;
  144. Starts := 0;
  145. Start_Edge := FALSE;
  146. END_DATA_BLOCK
  147. FUNCTION FC 1 : VOID
  148. TITLE =
  149. VERSION : 0.0
  150. VAR_INPUT
  151. Open : BOOL ;
  152. Close : BOOL ;
  153. END_VAR
  154. VAR_OUTPUT
  155. Dsp_Open : BOOL ;
  156. Dsp_Closed : BOOL ;
  157. END_VAR
  158. VAR_IN_OUT
  159. Valve : BOOL ;
  160. END_VAR
  161. BEGIN
  162. NETWORK
  163. TITLE =Open/Close and Latching
  164. A( ;
  165. O #Open;
  166. O #Valve;
  167. ) ;
  168. AN #Close;
  169. = #Valve;
  170. NETWORK
  171. TITLE =Display "Valve open"
  172. A #Valve;
  173. = #Dsp_Open;
  174. NETWORK
  175. TITLE =Display "Valve closed"
  176. AN #Valve;
  177. = #Dsp_Closed;
  178. END_FUNCTION
  179. ORGANIZATION_BLOCK OB 1
  180. TITLE =
  181. VERSION : 0.0
  182. VAR_TEMP
  183. OB1_EV_CLASS : BYTE ; //Bits 0-3 = 1 (Coming event), Bits 4-7 = 1 (Event class 1)
  184. OB1_SCAN_1 : BYTE ; //1 (Cold restart scan 1 of OB1), 3 (Scan 2-n of OB1)
  185. OB1_PRIORITY : BYTE ; //1 (Priority of 1 is lowest)
  186. OB1_OB_NUMBR : BYTE ; //1 (Organization block 1, OB1)
  187. OB1_RESERVED_1 : BYTE ; //Reserved for system
  188. OB1_RESERVED_2 : BYTE ; //Reserved for system
  189. OB1_PREV_CYCLE : INT ; //Cycle time of previous OB1 scan (milliseconds)
  190. OB1_MIN_CYCLE : INT ; //Minimum cycle time of OB1 (milliseconds)
  191. OB1_MAX_CYCLE : INT ; //Maximum cycle time of OB1 (milliseconds)
  192. OB1_DATE_TIME : DATE_AND_TIME ; //Date and time OB1 started
  193. Enable_Motor : BOOL ;
  194. Enable_Valve : BOOL ;
  195. Start_Fulfilled : BOOL ;
  196. Stop_Fulfilled : BOOL ;
  197. Inlet_Valve_A_Open : BOOL ;
  198. Inlet_Valve_A_Closed : BOOL ;
  199. Feed_Valve_A_Open : BOOL ;
  200. Feed_Valve_A_Closed : BOOL ;
  201. Inlet_Valve_B_Open : BOOL ;
  202. Inlet_Valve_B_Closed : BOOL ;
  203. Feed_Valve_B_Open : BOOL ;
  204. Feed_Valve_B_Closed : BOOL ;
  205. Open_Drain : BOOL ;
  206. Close_Drain : BOOL ;
  207. Close_Valve_Fulfilled : BOOL ;
  208. END_VAR
  209. BEGIN
  210. NETWORK
  211. TITLE =Interlock for Feed Pump A
  212. A I 1.6;
  213. A I 1.3;
  214. AN Q 9.5;
  215. = #Enable_Motor;
  216. NETWORK
  217. TITLE =Call FB Motor for Ingredient A
  218. A I 0.0;
  219. A #Enable_Motor;
  220. = #Start_Fulfilled;
  221. A( ;
  222. O I 0.1;
  223. ON #Enable_Motor;
  224. ) ;
  225. = #Stop_Fulfilled;
  226. CALL FB 1 , DB 1 (
  227. Start := #Start_Fulfilled,
  228. Stop := #Stop_Fulfilled,
  229. Response := I 0.2,
  230. Reset_Maint := I 1.7,
  231. Timer_No := T 12,
  232. Response_Time := S5T#7S,
  233. Fault := Q 4.5,
  234. Start_Dsp := Q 4.2,
  235. Stop_Dsp := Q 4.3,
  236. Maint := Q 4.6,
  237. Motor := Q 4.4);
  238. NETWORK
  239. TITLE =Delay Valve Enable Ingredient A
  240. A Q 4.4;
  241. L S5T#1S;
  242. SD T 13;
  243. AN Q 4.4;
  244. R T 13;
  245. A T 13;
  246. = #Enable_Valve;
  247. NETWORK
  248. TITLE =Inlet Valve Control for Ingredient A
  249. AN I 0.2;
  250. AN Q 4.4;
  251. = #Close_Valve_Fulfilled;
  252. CALL FC 1 (
  253. Open := #Enable_Valve,
  254. Close := #Close_Valve_Fulfilled,
  255. Dsp_Open := #Inlet_Valve_A_Open,
  256. Dsp_Closed := #Inlet_Valve_A_Closed,
  257. Valve := Q 4.0);
  258. NETWORK
  259. TITLE =Feed Valve Control for Ingredient A
  260. AN I 0.2;
  261. AN Q 4.4;
  262. = #Close_Valve_Fulfilled;
  263. CALL FC 1 (
  264. Open := #Enable_Valve,
  265. Close := #Close_Valve_Fulfilled,
  266. Dsp_Open := #Feed_Valve_A_Open,
  267. Dsp_Closed := #Feed_Valve_A_Closed,
  268. Valve := Q 4.1);
  269. NETWORK
  270. TITLE =Interlock for Feed Pump B
  271. A I 1.6;
  272. A I 1.3;
  273. AN Q 9.5;
  274. = #Enable_Motor;
  275. NETWORK
  276. TITLE =Call FB Motor for Ingredient B
  277. A I 0.3;
  278. A #Enable_Motor;
  279. = #Start_Fulfilled;
  280. A( ;
  281. O I 0.4;
  282. ON #Enable_Motor;
  283. ) ;
  284. = #Stop_Fulfilled;
  285. CALL FB 1 , DB 2 (
  286. Start := #Start_Fulfilled,
  287. Stop := #Stop_Fulfilled,
  288. Response := I 0.5,
  289. Reset_Maint := I 1.7,
  290. Timer_No := T 14,
  291. Response_Time := S5T#7S,
  292. Fault := Q 5.5,
  293. Start_Dsp := Q 5.2,
  294. Stop_Dsp := Q 5.3,
  295. Maint := Q 5.6,
  296. Motor := Q 5.4);
  297. NETWORK
  298. TITLE =Delay Valve Enable Ingredient B
  299. A Q 5.4;
  300. L S5T#1S;
  301. SD T 15;
  302. AN Q 5.4;
  303. R T 15;
  304. A T 15;
  305. = #Enable_Valve;
  306. NETWORK
  307. TITLE =Inlet Valve Control for Ingredient B
  308. AN I 0.5;
  309. AN Q 5.4;
  310. = #Close_Valve_Fulfilled;
  311. CALL FC 1 (
  312. Open := #Enable_Valve,
  313. Close := #Close_Valve_Fulfilled,
  314. Dsp_Open := #Inlet_Valve_B_Open,
  315. Dsp_Closed := #Inlet_Valve_B_Closed,
  316. Valve := Q 5.0);
  317. NETWORK
  318. TITLE =Feed Valve Control for Ingredient B
  319. AN I 0.5;
  320. AN Q 5.4;
  321. = #Close_Valve_Fulfilled;
  322. CALL FC 1 (
  323. Open := #Enable_Valve,
  324. Close := #Close_Valve_Fulfilled,
  325. Dsp_Open := #Feed_Valve_B_Open,
  326. Dsp_Closed := #Feed_Valve_B_Closed,
  327. Valve := Q 5.1);
  328. NETWORK
  329. TITLE =Interlock for Agitator
  330. A I 1.6;
  331. A I 1.4;
  332. AN Q 9.5;
  333. = #Enable_Motor;
  334. NETWORK
  335. TITLE =Call FB Motor for Agitator
  336. A I 1.1;
  337. A #Enable_Motor;
  338. = #Start_Fulfilled;
  339. A( ;
  340. O I 1.2;
  341. ON #Enable_Motor;
  342. ) ;
  343. = #Stop_Fulfilled;
  344. CALL FB 1 , DB 3 (
  345. Start := #Start_Fulfilled,
  346. Stop := #Stop_Fulfilled,
  347. Response := I 1.0,
  348. Reset_Maint := I 1.7,
  349. Timer_No := T 16,
  350. Response_Time := S5T#10S,
  351. Fault := Q 8.3,
  352. Start_Dsp := Q 8.1,
  353. Stop_Dsp := Q 8.2,
  354. Maint := Q 8.4,
  355. Motor := Q 8.0);
  356. NETWORK
  357. TITLE =Interlock for Drain Valve
  358. A I 1.6;
  359. A I 1.5;
  360. AN Q 8.0;
  361. = #Enable_Valve;
  362. NETWORK
  363. TITLE =Drain Valve Control
  364. A I 0.6;
  365. A #Enable_Valve;
  366. = #Open_Drain;
  367. A( ;
  368. O I 0.7;
  369. ON #Enable_Valve;
  370. ) ;
  371. = #Close_Drain;
  372. CALL FC 1 (
  373. Open := #Open_Drain,
  374. Close := #Close_Drain,
  375. Dsp_Open := Q 9.6,
  376. Dsp_Closed := Q 9.7,
  377. Valve := Q 9.5);
  378. NETWORK
  379. TITLE =Container Level Display
  380. AN I 1.3;
  381. = Q 9.0;
  382. AN I 1.4;
  383. = Q 9.1;
  384. AN I 1.5;
  385. = Q 9.2;
  386. END_ORGANIZATION_BLOCK