pn_runtime_to_design.mvc 6.0 KB

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