pn_runtime_to_design.mvc 6.3 KB

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