pn_runtime_to_design.mvc 5.4 KB

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