combine_EPN.mvc 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  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. }
  60. Pre_Encapsulated_PetriNet/PortPlace (pre_p2t_2, pre_p2t_1){
  61. label = "3"
  62. constraint_selected = $
  63. Boolean function constraint(value : Boolean):
  64. return value!
  65. $
  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. }
  125. Pre_Encapsulated_PetriNet/PortPlace (pre_p2t_2, pre_p2t_1){
  126. label = "3"
  127. constraint_selected = $
  128. Boolean function constraint(value : Boolean):
  129. return value!
  130. $
  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. }
  190. Pre_Encapsulated_PetriNet/PortPlace (pre_rem_2, pre_rem_1){
  191. label = "3"
  192. constraint_selected = $
  193. Boolean function constraint(value : Boolean):
  194. return value!
  195. $
  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. }
  227. Pre_Encapsulated_PetriNet/PortPlace (pre_uns_2, pre_uns_1){
  228. label = "3"
  229. constraint_selected = $
  230. Boolean function constraint(value : Boolean):
  231. return value!
  232. $
  233. }
  234. }
  235. RHS {
  236. Post_Encapsulated_PetriNet/Place post_uns_1 {
  237. label = "1"
  238. }
  239. }
  240. }
  241. }
  242. Initial (schedule, unselect_all) {}
  243. OnSuccess (unselect_all, select) {}
  244. OnSuccess (select, merge_P2T) {}
  245. OnSuccess (merge_P2T, merge_T2P) {}
  246. OnSuccess (merge_T2P, remove_old) {}
  247. OnSuccess (remove_old, unselect) {}
  248. OnSuccess (unselect, select) {}
  249. OnFailure (select, finish) {}
  250. OnFailure (unselect_all, select) {}
  251. OnFailure (merge_P2T, merge_T2P) {}
  252. OnFailure (merge_T2P, remove_old) {}
  253. OnFailure (remove_old, unselect) {}
  254. OnFailure (unselect, failure) {}
  255. }