control_to_EPN.mvc 31 KB

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