control_to_EPN.mvc 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831
  1. include "primitives.alh"
  2. include "modelling.alh"
  3. include "object_operations.alh"
  4. All_RAM Control2EPN {
  5. Composite schedule {
  6. {Contains} Failure failure {}
  7. {Contains} Success success {}
  8. {Contains} ForAll finish {
  9. LHS {
  10. Pre_Encapsulated_PetriNet/Port {
  11. label = "0"
  12. }
  13. }
  14. RHS {
  15. Post_Encapsulated_PetriNet/Port {
  16. label = "0"
  17. value_name = $
  18. String function value(model : Element, name : String, mapping : Element):
  19. return string_join("control/", read_attribute(model, name, "name"))!
  20. $
  21. }
  22. }
  23. }
  24. {Contains} Atomic init_ports {
  25. LHS {}
  26. RHS {
  27. Post_Encapsulated_PetriNet/Place post_ports_00 {
  28. label = "00"
  29. value_name = $
  30. String function value(model : Element, name : String, mapping : Element):
  31. return "cmdDown"!
  32. $
  33. value_tokens = $
  34. Integer function value(model : Element, name : String, mapping : Element):
  35. return 0!
  36. $
  37. }
  38. Post_Encapsulated_PetriNet/Port post_ports_10 {
  39. label = "10"
  40. value_name = $
  41. String function value(model : Element, name : String, mapping : Element):
  42. return "cmdDown"!
  43. $
  44. }
  45. Post_Encapsulated_PetriNet/PortPlace (post_ports_10, post_ports_00) {
  46. label = "20"
  47. }
  48. Post_Encapsulated_PetriNet/Place post_ports_01 {
  49. label = "01"
  50. value_name = $
  51. String function value(model : Element, name : String, mapping : Element):
  52. return "cmdNeutral"!
  53. $
  54. value_tokens = $
  55. Integer function value(model : Element, name : String, mapping : Element):
  56. return 0!
  57. $
  58. }
  59. Post_Encapsulated_PetriNet/Port post_ports_11 {
  60. label = "11"
  61. value_name = $
  62. String function value(model : Element, name : String, mapping : Element):
  63. return "cmdNeutral"!
  64. $
  65. }
  66. Post_Encapsulated_PetriNet/PortPlace (post_ports_11, post_ports_01) {
  67. label = "21"
  68. }
  69. Post_Encapsulated_PetriNet/Place post_ports_02 {
  70. label = "02"
  71. value_name = $
  72. String function value(model : Element, name : String, mapping : Element):
  73. return "cmdUp"!
  74. $
  75. value_tokens = $
  76. Integer function value(model : Element, name : String, mapping : Element):
  77. return 0!
  78. $
  79. }
  80. Post_Encapsulated_PetriNet/Port post_ports_12 {
  81. label = "12"
  82. value_name = $
  83. String function value(model : Element, name : String, mapping : Element):
  84. return "cmdUp"!
  85. $
  86. }
  87. Post_Encapsulated_PetriNet/PortPlace (post_ports_12, post_ports_02) {
  88. label = "22"
  89. }
  90. Post_Encapsulated_PetriNet/Place post_ports_03 {
  91. label = "03"
  92. value_name = $
  93. String function value(model : Element, name : String, mapping : Element):
  94. return "objDetected"!
  95. $
  96. value_tokens = $
  97. Integer function value(model : Element, name : String, mapping : Element):
  98. return 0!
  99. $
  100. }
  101. Post_Encapsulated_PetriNet/Port post_ports_13 {
  102. label = "13"
  103. value_name = $
  104. String function value(model : Element, name : String, mapping : Element):
  105. return "objDetected"!
  106. $
  107. }
  108. Post_Encapsulated_PetriNet/PortPlace (post_ports_13, post_ports_03) {
  109. label = "23"
  110. }
  111. Post_Encapsulated_PetriNet/Place post_ports_04 {
  112. label = "04"
  113. value_name = $
  114. String function value(model : Element, name : String, mapping : Element):
  115. return "no_objDetected"!
  116. $
  117. value_tokens = $
  118. Integer function value(model : Element, name : String, mapping : Element):
  119. return 0!
  120. $
  121. }
  122. Post_Encapsulated_PetriNet/Port post_ports_14 {
  123. label = "14"
  124. value_name = $
  125. String function value(model : Element, name : String, mapping : Element):
  126. return "no_objDetected"!
  127. $
  128. }
  129. Post_Encapsulated_PetriNet/PortPlace (post_ports_14, post_ports_04) {
  130. label = "24"
  131. }
  132. Post_Encapsulated_PetriNet/Place post_ports_05 {
  133. label = "05"
  134. value_name = $
  135. String function value(model : Element, name : String, mapping : Element):
  136. return "up"!
  137. $
  138. value_tokens = $
  139. Integer function value(model : Element, name : String, mapping : Element):
  140. // Set the detected output based on the initial state
  141. Element states
  142. String state
  143. states = allInstances(model, "PW_Control/State")
  144. while (read_nr_out(states) > 0):
  145. state = set_pop(states)
  146. if (value_eq(read_attribute(model, state, "isInitial"), True)):
  147. if (read_type(model, state) == "PW_Control/Up"):
  148. return 1!
  149. else:
  150. return 0!
  151. $
  152. }
  153. Post_Encapsulated_PetriNet/Port post_ports_15 {
  154. label = "15"
  155. value_name = $
  156. String function value(model : Element, name : String, mapping : Element):
  157. return "up"!
  158. $
  159. }
  160. Post_Encapsulated_PetriNet/PortPlace (post_ports_15, post_ports_05) {
  161. label = "25"
  162. }
  163. Post_Encapsulated_PetriNet/Place post_ports_06 {
  164. label = "06"
  165. value_name = $
  166. String function value(model : Element, name : String, mapping : Element):
  167. return "neutral"!
  168. $
  169. value_tokens = $
  170. Integer function value(model : Element, name : String, mapping : Element):
  171. // Set the detected output based on the initial state
  172. Element states
  173. String state
  174. states = allInstances(model, "PW_Control/State")
  175. while (read_nr_out(states) > 0):
  176. state = set_pop(states)
  177. if (value_eq(read_attribute(model, state, "isInitial"), True)):
  178. if (read_type(model, state) == "PW_Control/Neutral"):
  179. return 1!
  180. else:
  181. return 0!
  182. $
  183. }
  184. Post_Encapsulated_PetriNet/Port post_ports_16 {
  185. label = "16"
  186. value_name = $
  187. String function value(model : Element, name : String, mapping : Element):
  188. return "neutral"!
  189. $
  190. }
  191. Post_Encapsulated_PetriNet/PortPlace (post_ports_16, post_ports_06) {
  192. label = "26"
  193. }
  194. Post_Encapsulated_PetriNet/Place post_ports_07 {
  195. label = "07"
  196. value_name = $
  197. String function value(model : Element, name : String, mapping : Element):
  198. return "down"!
  199. $
  200. value_tokens = $
  201. Integer function value(model : Element, name : String, mapping : Element):
  202. // Set the detected output based on the initial state
  203. Element states
  204. String state
  205. states = allInstances(model, "PW_Control/State")
  206. while (read_nr_out(states) > 0):
  207. state = set_pop(states)
  208. if (value_eq(read_attribute(model, state, "isInitial"), True)):
  209. if (read_type(model, state) == "PW_Control/Down"):
  210. return 1!
  211. else:
  212. return 0!
  213. $
  214. }
  215. Post_Encapsulated_PetriNet/Port post_ports_17 {
  216. label = "17"
  217. value_name = $
  218. String function value(model : Element, name : String, mapping : Element):
  219. return "down"!
  220. $
  221. }
  222. Post_Encapsulated_PetriNet/PortPlace (post_ports_17, post_ports_07) {
  223. label = "27"
  224. }
  225. Post_Encapsulated_PetriNet/Place post_ports_08 {
  226. label = "08"
  227. value_name = $
  228. String function value(model : Element, name : String, mapping : Element):
  229. return "interrupt"!
  230. $
  231. value_tokens = $
  232. Integer function value(model : Element, name : String, mapping : Element):
  233. return 0!
  234. $
  235. }
  236. Post_Encapsulated_PetriNet/Port post_ports_18 {
  237. label = "18"
  238. value_name = $
  239. String function value(model : Element, name : String, mapping : Element):
  240. return "interrupt"!
  241. $
  242. }
  243. Post_Encapsulated_PetriNet/PortPlace (post_ports_18, post_ports_08) {
  244. label = "28"
  245. }
  246. }
  247. }
  248. {Contains} ForAll create_states {
  249. LHS {
  250. Pre_PW_Control/State {
  251. label = "0"
  252. }
  253. }
  254. RHS {
  255. Post_PW_Control/State post_cs_0 {
  256. label = "0"
  257. }
  258. Post_Encapsulated_PetriNet/Place post_cs_1 {
  259. label = "1"
  260. value_name = $
  261. String function value(model : Element, name : String, mapping : Element):
  262. return read_attribute(model, mapping["0"], "name")!
  263. $
  264. value_tokens = $
  265. Integer function value(model : Element, name : String, mapping : Element):
  266. if (value_eq(read_attribute(model, mapping["0"], "isInitial"), True)):
  267. return 1!
  268. else:
  269. return 0!
  270. $
  271. }
  272. Post_CTRL2EPN_link (post_cs_0, post_cs_1) {
  273. label = "2"
  274. }
  275. }
  276. }
  277. {Contains} ForAll create_transitions {
  278. LHS {
  279. Pre_PW_Control/State pre_ct_0 {
  280. label = "0"
  281. }
  282. Pre_PW_Control/State pre_ct_1 {
  283. label = "1"
  284. }
  285. Pre_PW_Control/Transition pre_ct_2 (pre_ct_0, pre_ct_1) {
  286. label = "2"
  287. }
  288. Pre_Encapsulated_PetriNet/Place pre_ct_3 {
  289. label = "3"
  290. }
  291. Pre_Encapsulated_PetriNet/Place pre_ct_4 {
  292. label = "4"
  293. }
  294. Pre_CTRL2EPN_link (pre_ct_0, pre_ct_3) {
  295. label = "5"
  296. }
  297. Pre_CTRL2EPN_link (pre_ct_1, pre_ct_4) {
  298. label = "6"
  299. }
  300. Pre_Encapsulated_PetriNet/Port pre_ct_9 {
  301. label = "9"
  302. constraint_name = $
  303. Boolean function constraint(value : String):
  304. return bool_or(bool_or(value == "up", value == "neutral"), value == "down")!
  305. $
  306. }
  307. Pre_Encapsulated_PetriNet/Place pre_ct_7 {
  308. label = "7"
  309. }
  310. Pre_Encapsulated_PetriNet/PortPlace (pre_ct_9, pre_ct_7) {
  311. label = "8"
  312. }
  313. Pre_Encapsulated_PetriNet/Port pre_ct_12 {
  314. label = "12"
  315. constraint_name = $
  316. Boolean function constraint(value : String):
  317. return bool_or(bool_or(value == "up", value == "neutral"), value == "down")!
  318. $
  319. }
  320. Pre_Encapsulated_PetriNet/Place pre_ct_10 {
  321. label = "10"
  322. }
  323. Pre_Encapsulated_PetriNet/PortPlace (pre_ct_12, pre_ct_10) {
  324. label = "11"
  325. }
  326. Pre_Encapsulated_PetriNet/Port pre_ct_15 {
  327. label = "15"
  328. constraint_name = $
  329. Boolean function constraint(value : String):
  330. return bool_or(bool_or(value == "cmdUp", value == "cmdNeutral"), value == "cmdDown")!
  331. $
  332. }
  333. Pre_Encapsulated_PetriNet/Place pre_ct_13 {
  334. label = "13"
  335. }
  336. Pre_Encapsulated_PetriNet/PortPlace (pre_ct_15, pre_ct_13) {
  337. label = "14"
  338. }
  339. constraint = $
  340. Boolean function constraint (host_model : Element, mapping : Element):
  341. // Check whether the bound primary places match with the state
  342. String type_0
  343. String type_1
  344. String type_2
  345. String name_9
  346. String name_12
  347. String name_15
  348. type_0 = read_type(host_model, mapping["0"])
  349. type_1 = read_type(host_model, mapping["1"])
  350. type_2 = read_type(host_model, mapping["2"])
  351. name_9 = read_attribute(host_model, mapping["9"], "name")
  352. name_12 = read_attribute(host_model, mapping["12"], "name")
  353. name_15 = read_attribute(host_model, mapping["15"], "name")
  354. // Source part
  355. if (type_0 == "PW_Control/Up"):
  356. if (name_9 != "up"):
  357. return False!
  358. elif (type_0 == "PW_Control/Neutral"):
  359. if (name_9 != "neutral"):
  360. return False!
  361. elif (type_0 == "PW_Control/Down"):
  362. if (name_9 != "down"):
  363. return False!
  364. // Target part
  365. if (type_1 == "PW_Control/Up"):
  366. if (name_12 != "up"):
  367. return False!
  368. elif (type_1 == "PW_Control/Neutral"):
  369. if (name_12 != "neutral"):
  370. return False!
  371. elif (type_1 == "PW_Control/Down"):
  372. if (name_12 != "down"):
  373. return False!
  374. // Link part
  375. if (type_2 == "PW_Control/UpPressed"):
  376. if (name_15 != "cmdUp"):
  377. return False!
  378. elif (type_2 == "PW_Control/NonePressed"):
  379. if (name_15 != "cmdNeutral"):
  380. return False!
  381. elif (type_2 == "PW_Control/DownPressed"):
  382. if (name_15 != "cmdDown"):
  383. return False!
  384. // All passed, so OK!
  385. return True!
  386. $
  387. }
  388. RHS {
  389. Post_PW_Control/State post_ct_0 {
  390. label = "0"
  391. }
  392. Post_PW_Control/State post_ct_1 {
  393. label = "1"
  394. }
  395. Post_PW_Control/Transition post_ct_2 (post_ct_0, post_ct_1) {
  396. label = "2"
  397. }
  398. Post_Encapsulated_PetriNet/Place post_ct_3 {
  399. label = "3"
  400. }
  401. Post_Encapsulated_PetriNet/Place post_ct_4 {
  402. label = "4"
  403. }
  404. Post_CTRL2EPN_link (post_ct_0, post_ct_3) {
  405. label = "5"
  406. }
  407. Post_CTRL2EPN_link (post_ct_1, post_ct_4) {
  408. label = "6"
  409. }
  410. Post_Encapsulated_PetriNet/Place post_ct_7 {
  411. label = "7"
  412. }
  413. Post_Encapsulated_PetriNet/Port post_ct_9 {
  414. label = "9"
  415. }
  416. Post_Encapsulated_PetriNet/PortPlace (post_ct_9, post_ct_7) {
  417. label = "8"
  418. }
  419. Post_Encapsulated_PetriNet/Place post_ct_10 {
  420. label = "10"
  421. }
  422. Post_Encapsulated_PetriNet/Port post_ct_12 {
  423. label = "12"
  424. }
  425. Post_Encapsulated_PetriNet/PortPlace (post_ct_12, post_ct_10) {
  426. label = "11"
  427. }
  428. Post_Encapsulated_PetriNet/Place post_ct_13 {
  429. label = "13"
  430. }
  431. Post_Encapsulated_PetriNet/Port post_ct_15 {
  432. label = "15"
  433. }
  434. Post_Encapsulated_PetriNet/PortPlace (post_ct_15, post_ct_13) {
  435. label = "14"
  436. }
  437. Post_Encapsulated_PetriNet/Transition post_ct_16 {
  438. label = "16"
  439. value_name = $
  440. String function value(model : Element, name : String, mapping : Element):
  441. return string_join(string_join(read_attribute(model, mapping["0"], "name"), read_type(model, mapping["2"])), read_attribute(model, mapping["2"], "objDetected"))!
  442. $
  443. }
  444. Post_Encapsulated_PetriNet/P2T (post_ct_3, post_ct_16) {
  445. label = "17"
  446. }
  447. Post_Encapsulated_PetriNet/T2P (post_ct_16, post_ct_4) {
  448. label = "18"
  449. }
  450. Post_Encapsulated_PetriNet/P2T (post_ct_7, post_ct_16) {
  451. label = "19"
  452. }
  453. Post_Encapsulated_PetriNet/T2P (post_ct_16, post_ct_10) {
  454. label = "20"
  455. }
  456. Post_Encapsulated_PetriNet/P2T (post_ct_13, post_ct_16) {
  457. label = "21"
  458. }
  459. Post_Encapsulated_PetriNet/T2P (post_ct_16, post_ct_13) {
  460. label = "22"
  461. }
  462. Post_CTRL2EPN_tlink (post_ct_2, post_ct_16) {
  463. label = "100"
  464. }
  465. }
  466. }
  467. {Contains} ForAll check_object {
  468. LHS {
  469. Pre_PW_Control/State pre_co_0 {
  470. label = "0"
  471. }
  472. Pre_PW_Control/State pre_co_1 {
  473. label = "1"
  474. }
  475. Pre_PW_Control/Transition pre_co_2 (pre_co_0, pre_co_1) {
  476. label = "2"
  477. constraint_objDetected = $
  478. Boolean function constraint(value : String):
  479. return (bool_or(value == "Y", value == "N"))!
  480. $
  481. }
  482. Pre_Encapsulated_PetriNet/Place pre_co_8 {
  483. label = "8"
  484. }
  485. Pre_Encapsulated_PetriNet/Port pre_co_11 {
  486. label = "11"
  487. constraint_name = $
  488. Boolean function constraint(value : String):
  489. return (bool_or(value == "objDetected", value == "no_objDetected"))!
  490. $
  491. }
  492. Pre_Encapsulated_PetriNet/PortPlace (pre_co_11, pre_co_8) {
  493. label = "12"
  494. }
  495. Pre_Encapsulated_PetriNet/Transition pre_co_15 {
  496. label = "15"
  497. }
  498. Pre_CTRL2EPN_tlink (pre_co_2, pre_co_15) {
  499. label = "100"
  500. }
  501. constraint = $
  502. Boolean function constraint (host_model : Element, mapping : Element):
  503. // Check whether the bound primary places match with the state
  504. String s1_value
  505. String ps1_type
  506. s1_value = read_attribute(host_model, mapping["2"], "objDetected")
  507. ps1_type = read_attribute(host_model, mapping["11"], "name")
  508. if (s1_value == "Y"):
  509. return (ps1_type == "objDetected")!
  510. elif (s1_value == "N"):
  511. return (ps1_type == "no_objDetected")!
  512. else:
  513. return False!
  514. $
  515. }
  516. RHS {
  517. Post_PW_Control/State post_co_0 {
  518. label = "0"
  519. }
  520. Post_PW_Control/State post_co_1 {
  521. label = "1"
  522. }
  523. Post_PW_Control/Transition post_co_2 (post_co_0, post_co_1) {
  524. label = "2"
  525. }
  526. Post_Encapsulated_PetriNet/Place post_co_8 {
  527. label = "8"
  528. }
  529. Post_Encapsulated_PetriNet/Port post_co_11 {
  530. label = "11"
  531. }
  532. Post_Encapsulated_PetriNet/PortPlace (post_co_11, post_co_8) {
  533. label = "12"
  534. }
  535. Post_Encapsulated_PetriNet/Transition post_co_15 {
  536. label = "15"
  537. }
  538. Post_Encapsulated_PetriNet/P2T (post_co_8, post_co_15) {
  539. label = "9"
  540. }
  541. Post_Encapsulated_PetriNet/T2P (post_co_15, post_co_8) {
  542. label = "10"
  543. }
  544. Post_CTRL2EPN_tlink (post_co_2, post_co_15) {
  545. label = "100"
  546. }
  547. }
  548. }
  549. {Contains} ForAll fix_interrupt {
  550. LHS {
  551. Pre_PW_Control/State pre_fi_0 {
  552. label = "0"
  553. }
  554. Pre_PW_Control/State pre_fi_1 {
  555. label = "1"
  556. constraint_isError = $
  557. Boolean function constraint(value : Boolean):
  558. return value!
  559. $
  560. }
  561. Pre_Encapsulated_PetriNet/Place pre_fi_2 {
  562. label = "2"
  563. }
  564. Pre_Encapsulated_PetriNet/Place pre_fi_3 {
  565. label = "3"
  566. }
  567. Pre_CTRL2EPN_link (pre_fi_0, pre_fi_2) {
  568. label = "4"
  569. }
  570. Pre_CTRL2EPN_link (pre_fi_1, pre_fi_3) {
  571. label = "5"
  572. }
  573. Pre_Encapsulated_PetriNet/Place pre_fi_6 {
  574. label = "6"
  575. }
  576. Pre_Encapsulated_PetriNet/Place pre_fi_12 {
  577. label = "12"
  578. }
  579. Pre_Encapsulated_PetriNet/Port pre_fi_13 {
  580. label = "13"
  581. }
  582. Pre_Encapsulated_PetriNet/PortPlace (pre_fi_13, pre_fi_12) {
  583. label = "14"
  584. }
  585. Pre_Encapsulated_PetriNet/Port pre_fi_15 {
  586. label = "15"
  587. constraint_name = $
  588. Boolean function constraint(value : String):
  589. return (value == "interrupt")!
  590. $
  591. }
  592. Pre_Encapsulated_PetriNet/PortPlace (pre_fi_15, pre_fi_6) {
  593. label = "16"
  594. }
  595. constraint = $
  596. Boolean function constraint (host_model : Element, mapping : Element):
  597. // Check whether the bound primary places match with the state
  598. String s_err_type
  599. String p_name
  600. s_err_type = read_type(host_model, mapping["1"])
  601. p_name = read_attribute(host_model, mapping["13"], "name")
  602. if (s_err_type == "PW_Control/Up"):
  603. return (p_name == "up")!
  604. elif (s_err_type == "PW_Control/Neutral"):
  605. return (p_name == "neutral")!
  606. elif (s_err_type == "PW_Control/Down"):
  607. return (p_name == "down")!
  608. else:
  609. return False!
  610. $
  611. }
  612. RHS {
  613. Post_PW_Control/State post_fi_0 {
  614. label = "0"
  615. }
  616. Post_PW_Control/State post_fi_1 {
  617. label = "1"
  618. }
  619. Post_Encapsulated_PetriNet/Place post_fi_2 {
  620. label = "2"
  621. }
  622. Post_Encapsulated_PetriNet/Place post_fi_3 {
  623. label = "3"
  624. }
  625. Post_CTRL2EPN_link (post_fi_0, post_fi_2) {
  626. label = "4"
  627. }
  628. Post_CTRL2EPN_link (post_fi_1, post_fi_3) {
  629. label = "5"
  630. }
  631. Post_Encapsulated_PetriNet/Place post_fi_6 {
  632. label = "6"
  633. }
  634. Post_Encapsulated_PetriNet/Place post_fi_12 {
  635. label = "12"
  636. }
  637. Post_Encapsulated_PetriNet/Port post_fi_13 {
  638. label = "13"
  639. }
  640. Post_Encapsulated_PetriNet/PortPlace (post_fi_13, post_fi_12) {
  641. label = "14"
  642. }
  643. Post_Encapsulated_PetriNet/Port post_fi_15 {
  644. label = "15"
  645. }
  646. Post_Encapsulated_PetriNet/PortPlace (post_fi_15, post_fi_6) {
  647. label = "16"
  648. }
  649. Post_Encapsulated_PetriNet/Transition post_fi_7 {
  650. label = "7"
  651. value_name = $
  652. String function value(model : Element, name : String, mapping : Element):
  653. return string_join(read_attribute(model, mapping["0"], "name"), "_onInterrupt")!
  654. $
  655. }
  656. Post_Encapsulated_PetriNet/P2T (post_fi_2, post_fi_7) {
  657. label = "8"
  658. }
  659. Post_Encapsulated_PetriNet/T2P (post_fi_7, post_fi_3) {
  660. label = "9"
  661. }
  662. Post_Encapsulated_PetriNet/P2T (post_fi_6, post_fi_7) {
  663. label = "10"
  664. }
  665. Post_Encapsulated_PetriNet/T2P (post_fi_7, post_fi_12) {
  666. label = "11"
  667. }
  668. }
  669. }
  670. {Contains} ForAll fix_interrupt_self {
  671. LHS {
  672. Pre_PW_Control/State pre_fis_0 {
  673. label = "0"
  674. constraint_isError = $
  675. Boolean function constraint(value : Boolean):
  676. return value!
  677. $
  678. }
  679. Pre_Encapsulated_PetriNet/Place pre_fis_1 {
  680. label = "1"
  681. }
  682. Pre_CTRL2EPN_link (pre_fis_0, pre_fis_1) {
  683. label = "2"
  684. }
  685. Pre_Encapsulated_PetriNet/Place pre_fis_3 {
  686. label = "3"
  687. }
  688. Pre_Encapsulated_PetriNet/Port pre_fis_4 {
  689. label = "4"
  690. constraint_name = $
  691. Boolean function constraint(value : String):
  692. return (value == "interrupt")!
  693. $
  694. }
  695. Pre_Encapsulated_PetriNet/PortPlace (pre_fis_4, pre_fis_3) {
  696. label = "5"
  697. }
  698. Pre_Encapsulated_PetriNet/Place pre_fis_6 {
  699. label = "6"
  700. }
  701. Pre_Encapsulated_PetriNet/Port pre_fis_7 {
  702. label = "7"
  703. }
  704. Pre_Encapsulated_PetriNet/PortPlace (pre_fis_7, pre_fis_6) {
  705. label = "8"
  706. }
  707. constraint = $
  708. Boolean function constraint (host_model : Element, mapping : Element):
  709. // Check whether the bound primary places match with the state
  710. String s_err_type
  711. String p_name
  712. s_err_type = read_type(host_model, mapping["0"])
  713. p_name = read_attribute(host_model, mapping["7"], "name")
  714. if (s_err_type == "PW_Control/Up"):
  715. return (p_name == "up")!
  716. elif (s_err_type == "PW_Control/Neutral"):
  717. return (p_name == "neutral")!
  718. elif (s_err_type == "PW_Control/Down"):
  719. return (p_name == "down")!
  720. else:
  721. return False!
  722. $
  723. }
  724. RHS {
  725. Post_PW_Control/State post_fis_0 {
  726. label = "0"
  727. }
  728. Post_Encapsulated_PetriNet/Place post_fis_1 {
  729. label = "1"
  730. }
  731. Post_CTRL2EPN_link (post_fis_0, post_fis_1) {
  732. label = "2"
  733. }
  734. Post_Encapsulated_PetriNet/Place post_fis_3 {
  735. label = "3"
  736. }
  737. Post_Encapsulated_PetriNet/Port post_fis_4 {
  738. label = "4"
  739. }
  740. Post_Encapsulated_PetriNet/PortPlace (post_fis_4, post_fis_3) {
  741. label = "5"
  742. }
  743. Post_Encapsulated_PetriNet/Place post_fis_6 {
  744. label = "6"
  745. }
  746. Post_Encapsulated_PetriNet/Port post_fis_7 {
  747. label = "7"
  748. }
  749. Post_Encapsulated_PetriNet/PortPlace (post_fis_7, post_fis_6) {
  750. label = "8"
  751. }
  752. Post_Encapsulated_PetriNet/Transition post_fis_9 {
  753. label = "9"
  754. value_name = $
  755. String function value(model : Element, name : String, mapping : Element):
  756. return string_join(read_attribute(model, mapping["0"], "name"), "_onInterrupt")!
  757. $
  758. }
  759. Post_Encapsulated_PetriNet/P2T (post_fis_3, post_fis_9) {
  760. label = "10"
  761. }
  762. Post_Encapsulated_PetriNet/T2P (post_fis_9, post_fis_6) {
  763. label = "11"
  764. }
  765. Post_Encapsulated_PetriNet/P2T (post_fis_1, post_fis_9) {
  766. label = "12"
  767. }
  768. Post_Encapsulated_PetriNet/T2P (post_fis_9, post_fis_1) {
  769. label = "13"
  770. }
  771. }
  772. }
  773. }
  774. Initial (schedule, init_ports) {}
  775. OnSuccess (init_ports, create_states) {}
  776. OnSuccess (create_states, create_transitions) {}
  777. OnSuccess (create_transitions, check_object) {}
  778. OnSuccess (check_object, fix_interrupt) {}
  779. OnSuccess (fix_interrupt, fix_interrupt_self) {}
  780. OnSuccess (fix_interrupt_self, finish) {}
  781. OnSuccess (finish, success) {}
  782. OnFailure (init_ports, create_states) {}
  783. OnFailure (create_states, create_transitions) {}
  784. OnFailure (create_transitions, check_object) {}
  785. OnFailure (check_object, fix_interrupt) {}
  786. OnFailure (fix_interrupt, fix_interrupt_self) {}
  787. OnFailure (fix_interrupt_self, finish) {}
  788. OnFailure (finish, failure) {}
  789. }