combine_EPN.mvc 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  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 select {
  9. LHS {
  10. Pre_Encapsulated_PetriNet/Place pre_s_1 {
  11. label = "1"
  12. }
  13. Pre_Encapsulated_PetriNet/Port pre_s_2 {
  14. label = "2"
  15. }
  16. Pre_Encapsulated_PetriNet/PortPlace (pre_s_2, pre_s_1){
  17. label = "3"
  18. }
  19. }
  20. RHS {
  21. Post_Encapsulated_PetriNet/Place post_s_1 {
  22. label = "1"
  23. }
  24. Post_Encapsulated_PetriNet/Port post_s_2 {
  25. label = "2"
  26. value_selected = $
  27. Boolean function value(model : Element, name : String, mapping : Element):
  28. return True!
  29. $
  30. }
  31. Post_Encapsulated_PetriNet/PortPlace (post_s_2, post_s_1){
  32. label = "3"
  33. }
  34. }
  35. }
  36. {Contains} ForAll merge_P2T {
  37. LHS {
  38. Pre_Encapsulated_PetriNet/Place pre_p2t_1 {
  39. label = "1"
  40. }
  41. Pre_Encapsulated_PetriNet/Port pre_p2t_2 {
  42. label = "2"
  43. }
  44. Pre_Encapsulated_PetriNet/PortPlace (pre_p2t_2, pre_p2t_1){
  45. label = "3"
  46. constraint_selected = $
  47. Boolean function constraint(value : Boolean):
  48. return value!
  49. $
  50. }
  51. Pre_Encapsulated_PetriNet/Place pre_p2t_4 {
  52. label = "4"
  53. }
  54. Pre_Encapsulated_PetriNet/Port pre_p2t_5 {
  55. label = "5"
  56. }
  57. Pre_Encapsulated_PetriNet/PortPlace (pre_p2t_5, pre_p2t_4){
  58. label = "6"
  59. }
  60. Pre_Encapsulated_PetriNet/Transition pre_p2t_7 {
  61. label = "7"
  62. }
  63. Pre_Encapsulated_PetriNet/P2T (pre_p2t_4, pre_p2t_7) {
  64. label = "8"
  65. }
  66. constraint = $
  67. Boolean function constraint(model : Element, mapping : Element):
  68. return value_eq(read_attribute(model, mapping["2"], "name"), read_attribute(model, mapping["5"], "name"))!
  69. $
  70. }
  71. RHS {
  72. Post_Encapsulated_PetriNet/Place post_p2t_1 {
  73. label = "1"
  74. }
  75. Post_Encapsulated_PetriNet/Port post_p2t_2 {
  76. label = "2"
  77. }
  78. Post_Encapsulated_PetriNet/PortPlace (post_p2t_2, post_p2t_1){
  79. label = "3"
  80. }
  81. Post_Encapsulated_PetriNet/Place post_p2t_4 {
  82. label = "4"
  83. }
  84. Post_Encapsulated_PetriNet/Port post_p2t_5 {
  85. label = "5"
  86. }
  87. Post_Encapsulated_PetriNet/PortPlace (post_p2t_5, post_p2t_4){
  88. label = "6"
  89. }
  90. Post_Encapsulated_PetriNet/Transition post_p2t_7 {
  91. label = "7"
  92. }
  93. Post_Encapsulated_PetriNet/P2T (post_p2t_4, post_p2t_7) {
  94. label = "8"
  95. }
  96. Post_Encapsulated_PetriNet/P2T (post_p2t_1, post_p2t_7) {
  97. label = "9"
  98. }
  99. }
  100. }
  101. {Contains} ForAll merge_T2P {
  102. LHS {
  103. Pre_Encapsulated_PetriNet/Place pre_p2t_1 {
  104. label = "1"
  105. }
  106. Pre_Encapsulated_PetriNet/Port pre_p2t_2 {
  107. label = "2"
  108. }
  109. Pre_Encapsulated_PetriNet/PortPlace (pre_p2t_2, pre_p2t_1){
  110. label = "3"
  111. constraint_selected = $
  112. Boolean function constraint(value : Boolean):
  113. return value!
  114. $
  115. }
  116. Pre_Encapsulated_PetriNet/Place pre_p2t_4 {
  117. label = "4"
  118. }
  119. Pre_Encapsulated_PetriNet/Port pre_p2t_5 {
  120. label = "5"
  121. }
  122. Pre_Encapsulated_PetriNet/PortPlace (pre_p2t_5, pre_p2t_4){
  123. label = "6"
  124. }
  125. Pre_Encapsulated_PetriNet/Transition pre_p2t_7 {
  126. label = "7"
  127. }
  128. Pre_Encapsulated_PetriNet/T2P (pre_p2t_7, pre_p2t_4) {
  129. label = "8"
  130. }
  131. constraint = $
  132. Boolean function constraint(model : Element, mapping : Element):
  133. return value_eq(read_attribute(model, mapping["2"], "name"), read_attribute(model, mapping["5"], "name"))!
  134. $
  135. }
  136. RHS {
  137. Post_Encapsulated_PetriNet/Place post_p2t_1 {
  138. label = "1"
  139. }
  140. Post_Encapsulated_PetriNet/Port post_p2t_2 {
  141. label = "2"
  142. }
  143. Post_Encapsulated_PetriNet/PortPlace (post_p2t_2, post_p2t_1){
  144. label = "3"
  145. }
  146. Post_Encapsulated_PetriNet/Place post_p2t_4 {
  147. label = "4"
  148. }
  149. Post_Encapsulated_PetriNet/Port post_p2t_5 {
  150. label = "5"
  151. }
  152. Post_Encapsulated_PetriNet/PortPlace (post_p2t_5, post_p2t_4){
  153. label = "6"
  154. }
  155. Post_Encapsulated_PetriNet/Transition post_p2t_7 {
  156. label = "7"
  157. }
  158. Post_Encapsulated_PetriNet/T2P (post_p2t_7, post_p2t_4) {
  159. label = "8"
  160. }
  161. Post_Encapsulated_PetriNet/T2P (post_p2t_7, post_p2t_1) {
  162. label = "9"
  163. }
  164. }
  165. }
  166. {Contains} ForAll remove_old {
  167. LHS {
  168. Pre_Encapsulated_PetriNet/Place pre_rem_1 {
  169. label = "1"
  170. }
  171. Pre_Encapsulated_PetriNet/Port pre_rem_2 {
  172. label = "2"
  173. }
  174. Pre_Encapsulated_PetriNet/PortPlace (pre_rem_2, pre_rem_1){
  175. label = "3"
  176. constraint_selected = $
  177. Boolean function constraint(value : Boolean):
  178. return value!
  179. $
  180. }
  181. Pre_Encapsulated_PetriNet/Place pre_rem_4 {
  182. label = "4"
  183. }
  184. Pre_Encapsulated_PetriNet/Port pre_rem_5 {
  185. label = "5"
  186. }
  187. Pre_Encapsulated_PetriNet/PortPlace (pre_rem_5, pre_rem_4){
  188. label = "6"
  189. }
  190. }
  191. RHS {
  192. Post_Encapsulated_PetriNet/Place post_rem_1 {
  193. label = "1"
  194. }
  195. Post_Encapsulated_PetriNet/Port post_rem_2 {
  196. label = "2"
  197. }
  198. Post_Encapsulated_PetriNet/PortPlace (post_rem_2, post_rem_1){
  199. label = "3"
  200. }
  201. }
  202. }
  203. {Contains} Atomic unselect {
  204. LHS {
  205. Pre_Encapsulated_PetriNet/Place pre_uns_1 {
  206. label = "1"
  207. }
  208. Pre_Encapsulated_PetriNet/Port pre_uns_2 {
  209. label = "2"
  210. }
  211. Pre_Encapsulated_PetriNet/PortPlace (pre_uns_2, pre_uns_1){
  212. label = "3"
  213. constraint_selected = $
  214. Boolean function constraint(value : Boolean):
  215. return value!
  216. $
  217. }
  218. }
  219. RHS {
  220. Post_Encapsulated_PetriNet/Place post_uns_1 {
  221. label = "1"
  222. }
  223. }
  224. }
  225. }
  226. Initial (schedule, select) {}
  227. OnSuccess (select, merge_P2T) {}
  228. OnSuccess (merge_P2T, merge_T2P) {}
  229. OnSuccess (merge_T2P, remove_old) {}
  230. OnSuccess (remove_old, unselect) {}
  231. OnSuccess (unselect, select) {}
  232. OnFailure (select, finish) {}
  233. OnFailure (merge_P2T, merge_T2P) {}
  234. OnFailure (merge_T2P, remove_old) {}
  235. OnFailure (remove_old, unselect) {}
  236. OnFailure (unselect, failure) {}
  237. }