pn_design_to_runtime.mvc 6.2 KB

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