control_to_EPN.mvc 5.8 KB

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