combine_EPN.mvc 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440
  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_executing = $
  254. Boolean function value(model : Element, name : String, mapping : Element):
  255. return True!
  256. $
  257. value_name = $
  258. Integer function value(model : Element, name : String, mapping : Element):
  259. return read_attribute(model, mapping["0"], "name")!
  260. $
  261. }
  262. Post_EPN2PN_transition_link (ct1, ct2){
  263. label = "2"
  264. }
  265. }
  266. }
  267. {Contains} ForAll copy_places {
  268. LHS {
  269. Pre_Encapsulated_PetriNet/Place {
  270. label = "0"
  271. }
  272. }
  273. RHS {
  274. Post_Encapsulated_PetriNet/Place cp1 {
  275. label = "0"
  276. }
  277. Post_PetriNet/Place cp2 {
  278. label = "1"
  279. value_tokens = $
  280. Integer function value(model : Element, name : String, mapping : Element):
  281. return read_attribute(model, mapping["0"], "tokens")!
  282. $
  283. value_name = $
  284. Integer function value(model : Element, name : String, mapping : Element):
  285. return read_attribute(model, mapping["0"], "name")!
  286. $
  287. }
  288. Post_EPN2PN_place_link (cp1, cp2){
  289. label = "2"
  290. }
  291. }
  292. }
  293. {Contains} ForAll copy_P2T {
  294. LHS {
  295. Pre_Encapsulated_PetriNet/Place cp2t_p{
  296. label = "0"
  297. }
  298. Pre_Encapsulated_PetriNet/Transition cp2t_t{
  299. label = "1"
  300. }
  301. Pre_Encapsulated_PetriNet/P2T (cp2t_p, cp2t_t){
  302. label = "2"
  303. }
  304. Pre_PetriNet/Place cp2t_p2{
  305. label = "3"
  306. }
  307. Pre_PetriNet/Transition cp2t_t2{
  308. label = "4"
  309. }
  310. Pre_EPN2PN_place_link (cp2t_p, cp2t_p2){
  311. label = "5"
  312. }
  313. Pre_EPN2PN_transition_link (cp2t_t, cp2t_t2){
  314. label = "6"
  315. }
  316. }
  317. RHS {
  318. Post_Encapsulated_PetriNet/Place rhs_cp2t_p{
  319. label = "0"
  320. }
  321. Post_Encapsulated_PetriNet/Transition rhs_cp2t_t{
  322. label = "1"
  323. }
  324. Post_Encapsulated_PetriNet/P2T rhs_cp2t_p2t (rhs_cp2t_p, rhs_cp2t_t){
  325. label = "2"
  326. }
  327. Post_PetriNet/Place rhs_cp2t_p2 {
  328. label = "3"
  329. }
  330. Post_PetriNet/Transition rhs_cp2t_t2 {
  331. label = "4"
  332. }
  333. Post_EPN2PN_place_link (rhs_cp2t_p, rhs_cp2t_p2){
  334. label = "5"
  335. }
  336. Post_EPN2PN_transition_link (rhs_cp2t_t, rhs_cp2t_t2){
  337. label = "6"
  338. }
  339. Post_PetriNet/P2T rhs_cp2t_p2t2(rhs_cp2t_p2, rhs_cp2t_t2) {
  340. label = "7"
  341. value_weight = $
  342. Integer function value(host_model : Element, name : String, mapping : Element):
  343. return 1!
  344. $
  345. }
  346. }
  347. }
  348. {Contains} ForAll copy_T2P {
  349. LHS {
  350. Pre_Encapsulated_PetriNet/Place ct2p_p{
  351. label = "0"
  352. }
  353. Pre_Encapsulated_PetriNet/Transition ct2p_t{
  354. label = "1"
  355. }
  356. Pre_Encapsulated_PetriNet/T2P (ct2p_t, ct2p_p){
  357. label = "2"
  358. }
  359. Pre_PetriNet/Place ct2p_p2{
  360. label = "3"
  361. }
  362. Pre_PetriNet/Transition ct2p_t2{
  363. label = "4"
  364. }
  365. Pre_EPN2PN_place_link (ct2p_p, ct2p_p2){
  366. label = "5"
  367. }
  368. Pre_EPN2PN_transition_link (ct2p_t, ct2p_t2){
  369. label = "6"
  370. }
  371. }
  372. RHS {
  373. Post_Encapsulated_PetriNet/Place rhs_ct2p_p{
  374. label = "0"
  375. }
  376. Post_Encapsulated_PetriNet/Transition rhs_ct2p_t{
  377. label = "1"
  378. }
  379. Post_Encapsulated_PetriNet/T2P (rhs_ct2p_t, rhs_ct2p_p){
  380. label = "2"
  381. }
  382. Post_PetriNet/Place rhs_ct2p_p2 {
  383. label = "3"
  384. }
  385. Post_PetriNet/Transition rhs_ct2p_t2 {
  386. label = "4"
  387. }
  388. Post_EPN2PN_place_link (rhs_ct2p_p, rhs_ct2p_p2){
  389. label = "5"
  390. }
  391. Post_EPN2PN_transition_link (rhs_ct2p_t, rhs_ct2p_t2){
  392. label = "6"
  393. }
  394. Post_PetriNet/T2P (rhs_ct2p_t2, rhs_ct2p_p2) {
  395. label = "7"
  396. value_weight = $
  397. Integer function value(host_model : Element, name : String, mapping : Element):
  398. return 1!
  399. $
  400. }
  401. }
  402. }
  403. }
  404. Initial (schedule, unselect_all) {}
  405. OnSuccess (unselect_all, select) {}
  406. OnSuccess (select, merge_P2T) {}
  407. OnSuccess (merge_P2T, merge_T2P) {}
  408. OnSuccess (merge_T2P, remove_old) {}
  409. OnSuccess (remove_old, unselect) {}
  410. OnSuccess (unselect, select) {}
  411. OnFailure (select, copy_places) {}
  412. OnFailure (unselect_all, select) {}
  413. OnFailure (merge_P2T, merge_T2P) {}
  414. OnFailure (merge_T2P, remove_old) {}
  415. OnFailure (remove_old, unselect) {}
  416. OnFailure (unselect, failure) {}
  417. OnSuccess (copy_places, copy_transitions) {}
  418. OnSuccess (copy_transitions, copy_P2T) {}
  419. OnSuccess (copy_P2T, copy_T2P) {}
  420. OnSuccess (copy_T2P, success) {}
  421. OnFailure (copy_places, copy_transitions) {}
  422. OnFailure (copy_transitions, copy_P2T) {}
  423. OnFailure (copy_P2T, copy_T2P) {}
  424. OnFailure (copy_T2P, success) {}
  425. }