pn_design_to_runtime.mvc 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. include "primitives.alh"
  2. include "modelling.alh"
  3. Composite schedule {
  4. {Contains} Failure failure {}
  5. {Contains} Success success {}
  6. {Contains} ForAll copy_transitions {
  7. LHS {
  8. Pre_PetriNet/Transition {
  9. label = "0"
  10. }
  11. }
  12. RHS {
  13. Post_PetriNet/Transition ct1 {
  14. label = "0"
  15. }
  16. Post_PetriNet_Runtime/Transition ct2 {
  17. label = "1"
  18. value_executing = $
  19. Boolean function value(model : Element, name : String, mapping : Element):
  20. return True!
  21. $
  22. value_name = $
  23. Integer function value(model : Element, name : String, mapping : Element):
  24. return read_attribute(model, mapping["0"], "name")!
  25. $
  26. }
  27. Post_D2R_TransitionLink (ct1, ct2){
  28. label = "2"
  29. }
  30. }
  31. }
  32. {Contains} ForAll copy_places {
  33. LHS {
  34. Pre_PetriNet/Place {
  35. label = "0"
  36. }
  37. }
  38. RHS {
  39. Post_PetriNet/Place cp1 {
  40. label = "0"
  41. }
  42. Post_PetriNet_Runtime/Place cp2 {
  43. label = "1"
  44. value_tokens = $
  45. Integer function value(model : Element, name : String, mapping : Element):
  46. return read_attribute(model, mapping["0"], "tokens")!
  47. $
  48. value_name = $
  49. Integer function value(model : Element, name : String, mapping : Element):
  50. return read_attribute(model, mapping["0"], "name")!
  51. $
  52. }
  53. Post_D2R_PlaceLink (cp1, cp2){
  54. label = "2"
  55. }
  56. }
  57. }
  58. {Contains} ForAll copy_P2T {
  59. LHS {
  60. Pre_PetriNet/Place cp2t_p{
  61. label = "0"
  62. }
  63. Pre_PetriNet/Transition cp2t_t{
  64. label = "1"
  65. }
  66. Pre_PetriNet/P2T (cp2t_p, cp2t_t){
  67. label = "2"
  68. }
  69. Pre_PetriNet_Runtime/Place cp2t_p2{
  70. label = "3"
  71. }
  72. Pre_PetriNet_Runtime/Transition cp2t_t2{
  73. label = "4"
  74. }
  75. Pre_D2R_PlaceLink (cp2t_p, cp2t_p2){
  76. label = "5"
  77. }
  78. Pre_D2R_TransitionLink (cp2t_t, cp2t_t2){
  79. label = "6"
  80. }
  81. }
  82. RHS {
  83. Post_PetriNet/Place rhs_cp2t_p{
  84. label = "0"
  85. }
  86. Post_PetriNet/Transition rhs_cp2t_t{
  87. label = "1"
  88. }
  89. Post_PetriNet/P2T rhs_cp2t_p2t (rhs_cp2t_p, rhs_cp2t_t){
  90. label = "2"
  91. }
  92. Post_PetriNet_Runtime/Place rhs_cp2t_p2 {
  93. label = "3"
  94. }
  95. Post_PetriNet_Runtime/Transition rhs_cp2t_t2 {
  96. label = "4"
  97. }
  98. Post_D2R_PlaceLink (rhs_cp2t_p, rhs_cp2t_p2){
  99. label = "5"
  100. }
  101. Post_D2R_TransitionLink (rhs_cp2t_t, rhs_cp2t_t2){
  102. label = "6"
  103. }
  104. Post_PetriNet_Runtime/P2T rhs_cp2t_p2t2(rhs_cp2t_p2, rhs_cp2t_t2) {
  105. label = "7"
  106. value_weight = $
  107. Integer function value(host_model : Element, name : String, mapping : Element):
  108. return read_attribute(host_model, mapping["2"], "weight")!
  109. $
  110. }
  111. }
  112. }
  113. {Contains} ForAll copy_T2P {
  114. LHS {
  115. Pre_PetriNet/Place ct2p_p{
  116. label = "0"
  117. }
  118. Pre_PetriNet/Transition ct2p_t{
  119. label = "1"
  120. }
  121. Pre_PetriNet/T2P (ct2p_t, ct2p_p){
  122. label = "2"
  123. }
  124. Pre_PetriNet_Runtime/Place ct2p_p2{
  125. label = "3"
  126. }
  127. Pre_PetriNet_Runtime/Transition ct2p_t2{
  128. label = "4"
  129. }
  130. Pre_D2R_PlaceLink (ct2p_p, ct2p_p2){
  131. label = "5"
  132. }
  133. Pre_D2R_TransitionLink (ct2p_t, ct2p_t2){
  134. label = "6"
  135. }
  136. }
  137. RHS {
  138. Post_PetriNet/Place rhs_ct2p_p{
  139. label = "0"
  140. }
  141. Post_PetriNet/Transition rhs_ct2p_t{
  142. label = "1"
  143. }
  144. Post_PetriNet/T2P (rhs_ct2p_t, rhs_ct2p_p){
  145. label = "2"
  146. }
  147. Post_PetriNet_Runtime/Place rhs_ct2p_p2 {
  148. label = "3"
  149. }
  150. Post_PetriNet_Runtime/Transition rhs_ct2p_t2 {
  151. label = "4"
  152. }
  153. Post_D2R_PlaceLink (rhs_ct2p_p, rhs_ct2p_p2){
  154. label = "5"
  155. }
  156. Post_D2R_TransitionLink (rhs_ct2p_t, rhs_ct2p_t2){
  157. label = "6"
  158. }
  159. Post_PetriNet_Runtime/T2P (rhs_ct2p_t2, rhs_ct2p_p2) {
  160. label = "7"
  161. value_weight = $
  162. Integer function value(host_model : Element, name : String, mapping : Element):
  163. return read_attribute(host_model, mapping["2"], "weight")!
  164. $
  165. }
  166. }
  167. }
  168. }
  169. OnSuccess (copy_places, copy_transitions) {}
  170. OnSuccess (copy_transitions, copy_P2T) {}
  171. OnSuccess (copy_P2T, copy_T2P) {}
  172. OnSuccess (copy_T2P, success) {}
  173. OnFailure (copy_places, copy_transitions) {}
  174. OnFailure (copy_transitions, copy_P2T) {}
  175. OnFailure (copy_P2T, copy_T2P) {}
  176. OnFailure (copy_T2P, success) {}
  177. Initial (schedule, copy_places) {}