pn_design_to_runtime.mvc 6.4 KB

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