combine_EPN.mvc 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436
  1. include "primitives.alh"
  2. include "modelling.alh"
  3. include "object_operations.alh"
  4. A B {
  5. Composite schedule {
  6. {Contains} Success success {}
  7. {Contains} Failure failure {}
  8. {Contains} Atomic unselect_all {
  9. LHS {
  10. Pre_Encapsulated_PetriNet/Port pre_ua_1 {
  11. label = "1"
  12. }
  13. }
  14. RHS {
  15. Post_Encapsulated_PetriNet/Port post_ua_1 {
  16. label = "1"
  17. value_selected = $
  18. Boolean function value(model : Element, name : String, mapping : Element):
  19. return False!
  20. $
  21. }
  22. }
  23. }
  24. {Contains} Atomic select {
  25. LHS {
  26. Pre_Encapsulated_PetriNet/Place pre_s_1 {
  27. label = "1"
  28. }
  29. Pre_Encapsulated_PetriNet/Port pre_s_2 {
  30. label = "2"
  31. }
  32. Pre_Encapsulated_PetriNet/PortPlace (pre_s_2, pre_s_1){
  33. label = "3"
  34. }
  35. }
  36. RHS {
  37. Post_Encapsulated_PetriNet/Place post_s_1 {
  38. label = "1"
  39. }
  40. Post_Encapsulated_PetriNet/Port post_s_2 {
  41. label = "2"
  42. value_selected = $
  43. Boolean function value(model : Element, name : String, mapping : Element):
  44. return True!
  45. $
  46. }
  47. Post_Encapsulated_PetriNet/PortPlace (post_s_2, post_s_1){
  48. label = "3"
  49. }
  50. }
  51. }
  52. {Contains} ForAll merge_P2T {
  53. LHS {
  54. Pre_Encapsulated_PetriNet/Place pre_p2t_1 {
  55. label = "1"
  56. }
  57. Pre_Encapsulated_PetriNet/Port pre_p2t_2 {
  58. label = "2"
  59. constraint_selected = $
  60. Boolean function constraint(value : Boolean):
  61. return value!
  62. $
  63. }
  64. Pre_Encapsulated_PetriNet/PortPlace (pre_p2t_2, pre_p2t_1){
  65. label = "3"
  66. }
  67. Pre_Encapsulated_PetriNet/Place pre_p2t_4 {
  68. label = "4"
  69. }
  70. Pre_Encapsulated_PetriNet/Port pre_p2t_5 {
  71. label = "5"
  72. }
  73. Pre_Encapsulated_PetriNet/PortPlace (pre_p2t_5, pre_p2t_4){
  74. label = "6"
  75. }
  76. Pre_Encapsulated_PetriNet/Transition pre_p2t_7 {
  77. label = "7"
  78. }
  79. Pre_Encapsulated_PetriNet/P2T (pre_p2t_4, pre_p2t_7) {
  80. label = "8"
  81. }
  82. constraint = $
  83. Boolean function constraint(model : Element, mapping : Element):
  84. return value_eq(read_attribute(model, mapping["2"], "name"), read_attribute(model, mapping["5"], "name"))!
  85. $
  86. }
  87. RHS {
  88. Post_Encapsulated_PetriNet/Place post_p2t_1 {
  89. label = "1"
  90. }
  91. Post_Encapsulated_PetriNet/Port post_p2t_2 {
  92. label = "2"
  93. }
  94. Post_Encapsulated_PetriNet/PortPlace (post_p2t_2, post_p2t_1){
  95. label = "3"
  96. }
  97. Post_Encapsulated_PetriNet/Place post_p2t_4 {
  98. label = "4"
  99. }
  100. Post_Encapsulated_PetriNet/Port post_p2t_5 {
  101. label = "5"
  102. }
  103. Post_Encapsulated_PetriNet/PortPlace (post_p2t_5, post_p2t_4){
  104. label = "6"
  105. }
  106. Post_Encapsulated_PetriNet/Transition post_p2t_7 {
  107. label = "7"
  108. }
  109. Post_Encapsulated_PetriNet/P2T (post_p2t_4, post_p2t_7) {
  110. label = "8"
  111. }
  112. Post_Encapsulated_PetriNet/P2T (post_p2t_1, post_p2t_7) {
  113. label = "9"
  114. }
  115. }
  116. }
  117. {Contains} ForAll merge_T2P {
  118. LHS {
  119. Pre_Encapsulated_PetriNet/Place pre_p2t_1 {
  120. label = "1"
  121. }
  122. Pre_Encapsulated_PetriNet/Port pre_p2t_2 {
  123. label = "2"
  124. constraint_selected = $
  125. Boolean function constraint(value : Boolean):
  126. return value!
  127. $
  128. }
  129. Pre_Encapsulated_PetriNet/PortPlace (pre_p2t_2, pre_p2t_1){
  130. label = "3"
  131. }
  132. Pre_Encapsulated_PetriNet/Place pre_p2t_4 {
  133. label = "4"
  134. }
  135. Pre_Encapsulated_PetriNet/Port pre_p2t_5 {
  136. label = "5"
  137. }
  138. Pre_Encapsulated_PetriNet/PortPlace (pre_p2t_5, pre_p2t_4){
  139. label = "6"
  140. }
  141. Pre_Encapsulated_PetriNet/Transition pre_p2t_7 {
  142. label = "7"
  143. }
  144. Pre_Encapsulated_PetriNet/T2P (pre_p2t_7, pre_p2t_4) {
  145. label = "8"
  146. }
  147. constraint = $
  148. Boolean function constraint(model : Element, mapping : Element):
  149. return value_eq(read_attribute(model, mapping["2"], "name"), read_attribute(model, mapping["5"], "name"))!
  150. $
  151. }
  152. RHS {
  153. Post_Encapsulated_PetriNet/Place post_p2t_1 {
  154. label = "1"
  155. }
  156. Post_Encapsulated_PetriNet/Port post_p2t_2 {
  157. label = "2"
  158. }
  159. Post_Encapsulated_PetriNet/PortPlace (post_p2t_2, post_p2t_1){
  160. label = "3"
  161. }
  162. Post_Encapsulated_PetriNet/Place post_p2t_4 {
  163. label = "4"
  164. }
  165. Post_Encapsulated_PetriNet/Port post_p2t_5 {
  166. label = "5"
  167. }
  168. Post_Encapsulated_PetriNet/PortPlace (post_p2t_5, post_p2t_4){
  169. label = "6"
  170. }
  171. Post_Encapsulated_PetriNet/Transition post_p2t_7 {
  172. label = "7"
  173. }
  174. Post_Encapsulated_PetriNet/T2P (post_p2t_7, post_p2t_4) {
  175. label = "8"
  176. }
  177. Post_Encapsulated_PetriNet/T2P (post_p2t_7, post_p2t_1) {
  178. label = "9"
  179. }
  180. }
  181. }
  182. {Contains} ForAll remove_old {
  183. LHS {
  184. Pre_Encapsulated_PetriNet/Place pre_rem_1 {
  185. label = "1"
  186. }
  187. Pre_Encapsulated_PetriNet/Port pre_rem_2 {
  188. label = "2"
  189. constraint_selected = $
  190. Boolean function constraint(value : Boolean):
  191. return value!
  192. $
  193. }
  194. Pre_Encapsulated_PetriNet/PortPlace (pre_rem_2, pre_rem_1){
  195. label = "3"
  196. }
  197. Pre_Encapsulated_PetriNet/Place pre_rem_4 {
  198. label = "4"
  199. }
  200. Pre_Encapsulated_PetriNet/Port pre_rem_5 {
  201. label = "5"
  202. }
  203. Pre_Encapsulated_PetriNet/PortPlace (pre_rem_5, pre_rem_4){
  204. label = "6"
  205. }
  206. }
  207. RHS {
  208. Post_Encapsulated_PetriNet/Place post_rem_1 {
  209. label = "1"
  210. }
  211. Post_Encapsulated_PetriNet/Port post_rem_2 {
  212. label = "2"
  213. }
  214. Post_Encapsulated_PetriNet/PortPlace (post_rem_2, post_rem_1){
  215. label = "3"
  216. }
  217. }
  218. }
  219. {Contains} Atomic unselect {
  220. LHS {
  221. Pre_Encapsulated_PetriNet/Place pre_uns_1 {
  222. label = "1"
  223. }
  224. Pre_Encapsulated_PetriNet/Port pre_uns_2 {
  225. label = "2"
  226. constraint_selected = $
  227. Boolean function constraint(value : Boolean):
  228. return value!
  229. $
  230. }
  231. Pre_Encapsulated_PetriNet/PortPlace (pre_uns_2, pre_uns_1){
  232. label = "3"
  233. }
  234. }
  235. RHS {
  236. Post_Encapsulated_PetriNet/Place post_uns_1 {
  237. label = "1"
  238. }
  239. }
  240. }
  241. {Contains} ForAll copy_transitions {
  242. LHS {
  243. Pre_Encapsulated_PetriNet/Transition {
  244. label = "0"
  245. }
  246. }
  247. RHS {
  248. Post_Encapsulated_PetriNet/Transition ct1 {
  249. label = "0"
  250. }
  251. Post_PetriNet/Transition ct2 {
  252. label = "1"
  253. value_name = $
  254. Integer function value(model : Element, name : String, mapping : Element):
  255. return read_attribute(model, mapping["0"], "name")!
  256. $
  257. }
  258. Post_EPN2PN_transition_link (ct1, ct2){
  259. label = "2"
  260. }
  261. }
  262. }
  263. {Contains} ForAll copy_places {
  264. LHS {
  265. Pre_Encapsulated_PetriNet/Place {
  266. label = "0"
  267. }
  268. }
  269. RHS {
  270. Post_Encapsulated_PetriNet/Place cp1 {
  271. label = "0"
  272. }
  273. Post_PetriNet/Place cp2 {
  274. label = "1"
  275. value_tokens = $
  276. Integer function value(model : Element, name : String, mapping : Element):
  277. return read_attribute(model, mapping["0"], "tokens")!
  278. $
  279. value_name = $
  280. Integer function value(model : Element, name : String, mapping : Element):
  281. return read_attribute(model, mapping["0"], "name")!
  282. $
  283. }
  284. Post_EPN2PN_place_link (cp1, cp2){
  285. label = "2"
  286. }
  287. }
  288. }
  289. {Contains} ForAll copy_P2T {
  290. LHS {
  291. Pre_Encapsulated_PetriNet/Place cp2t_p{
  292. label = "0"
  293. }
  294. Pre_Encapsulated_PetriNet/Transition cp2t_t{
  295. label = "1"
  296. }
  297. Pre_Encapsulated_PetriNet/P2T (cp2t_p, cp2t_t){
  298. label = "2"
  299. }
  300. Pre_PetriNet/Place cp2t_p2{
  301. label = "3"
  302. }
  303. Pre_PetriNet/Transition cp2t_t2{
  304. label = "4"
  305. }
  306. Pre_EPN2PN_place_link (cp2t_p, cp2t_p2){
  307. label = "5"
  308. }
  309. Pre_EPN2PN_transition_link (cp2t_t, cp2t_t2){
  310. label = "6"
  311. }
  312. }
  313. RHS {
  314. Post_Encapsulated_PetriNet/Place rhs_cp2t_p{
  315. label = "0"
  316. }
  317. Post_Encapsulated_PetriNet/Transition rhs_cp2t_t{
  318. label = "1"
  319. }
  320. Post_Encapsulated_PetriNet/P2T rhs_cp2t_p2t (rhs_cp2t_p, rhs_cp2t_t){
  321. label = "2"
  322. }
  323. Post_PetriNet/Place rhs_cp2t_p2 {
  324. label = "3"
  325. }
  326. Post_PetriNet/Transition rhs_cp2t_t2 {
  327. label = "4"
  328. }
  329. Post_EPN2PN_place_link (rhs_cp2t_p, rhs_cp2t_p2){
  330. label = "5"
  331. }
  332. Post_EPN2PN_transition_link (rhs_cp2t_t, rhs_cp2t_t2){
  333. label = "6"
  334. }
  335. Post_PetriNet/P2T rhs_cp2t_p2t2(rhs_cp2t_p2, rhs_cp2t_t2) {
  336. label = "7"
  337. value_weight = $
  338. Integer function value(host_model : Element, name : String, mapping : Element):
  339. return 1!
  340. $
  341. }
  342. }
  343. }
  344. {Contains} ForAll copy_T2P {
  345. LHS {
  346. Pre_Encapsulated_PetriNet/Place ct2p_p{
  347. label = "0"
  348. }
  349. Pre_Encapsulated_PetriNet/Transition ct2p_t{
  350. label = "1"
  351. }
  352. Pre_Encapsulated_PetriNet/T2P (ct2p_t, ct2p_p){
  353. label = "2"
  354. }
  355. Pre_PetriNet/Place ct2p_p2{
  356. label = "3"
  357. }
  358. Pre_PetriNet/Transition ct2p_t2{
  359. label = "4"
  360. }
  361. Pre_EPN2PN_place_link (ct2p_p, ct2p_p2){
  362. label = "5"
  363. }
  364. Pre_EPN2PN_transition_link (ct2p_t, ct2p_t2){
  365. label = "6"
  366. }
  367. }
  368. RHS {
  369. Post_Encapsulated_PetriNet/Place rhs_ct2p_p{
  370. label = "0"
  371. }
  372. Post_Encapsulated_PetriNet/Transition rhs_ct2p_t{
  373. label = "1"
  374. }
  375. Post_Encapsulated_PetriNet/T2P (rhs_ct2p_t, rhs_ct2p_p){
  376. label = "2"
  377. }
  378. Post_PetriNet/Place rhs_ct2p_p2 {
  379. label = "3"
  380. }
  381. Post_PetriNet/Transition rhs_ct2p_t2 {
  382. label = "4"
  383. }
  384. Post_EPN2PN_place_link (rhs_ct2p_p, rhs_ct2p_p2){
  385. label = "5"
  386. }
  387. Post_EPN2PN_transition_link (rhs_ct2p_t, rhs_ct2p_t2){
  388. label = "6"
  389. }
  390. Post_PetriNet/T2P (rhs_ct2p_t2, rhs_ct2p_p2) {
  391. label = "7"
  392. value_weight = $
  393. Integer function value(host_model : Element, name : String, mapping : Element):
  394. return 1!
  395. $
  396. }
  397. }
  398. }
  399. }
  400. Initial (schedule, unselect_all) {}
  401. OnSuccess (unselect_all, select) {}
  402. OnSuccess (select, merge_P2T) {}
  403. OnSuccess (merge_P2T, merge_T2P) {}
  404. OnSuccess (merge_T2P, remove_old) {}
  405. OnSuccess (remove_old, unselect) {}
  406. OnSuccess (unselect, select) {}
  407. OnFailure (select, copy_places) {}
  408. OnFailure (unselect_all, select) {}
  409. OnFailure (merge_P2T, merge_T2P) {}
  410. OnFailure (merge_T2P, remove_old) {}
  411. OnFailure (remove_old, unselect) {}
  412. OnFailure (unselect, failure) {}
  413. OnSuccess (copy_places, copy_transitions) {}
  414. OnSuccess (copy_transitions, copy_P2T) {}
  415. OnSuccess (copy_P2T, copy_T2P) {}
  416. OnSuccess (copy_T2P, success) {}
  417. OnFailure (copy_places, copy_transitions) {}
  418. OnFailure (copy_transitions, copy_P2T) {}
  419. OnFailure (copy_P2T, copy_T2P) {}
  420. OnFailure (copy_T2P, success) {}
  421. }