environment_to_EPN.mvc 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. include "primitives.alh"
  2. include "modelling.alh"
  3. include "object_operations.alh"
  4. Composite schedule {
  5. {Contains} Success success {}
  6. {Contains} Failure failure {}
  7. {Contains} ForAll create_ports {
  8. LHS {
  9. Pre_PW_Environment/Event {
  10. label = "1"
  11. }
  12. }
  13. RHS {
  14. Post_PW_Environment/Event cp_evt {
  15. label = "1"
  16. }
  17. Post_Encapsulated_PetriNet/Place cp_place {
  18. label = "2"
  19. value_name = $
  20. String function value(model : Element, name : String, mapping : Element):
  21. return read_attribute(model, mapping["1"], "name")!
  22. $
  23. value_tokens = $
  24. Integer function value(model : Element, name : String, mapping : Element):
  25. Boolean initial
  26. initial = read_attribute(model, mapping["1"], "initial")
  27. if (initial):
  28. return 1!
  29. else:
  30. return 0!
  31. $
  32. }
  33. Post_Encapsulated_PetriNet/Port cp_port {
  34. label = "3"
  35. value_name = $
  36. String function value(model : Element, name : String, mapping : Element):
  37. return string_join("environment/", read_attribute(model, mapping["1"], "name"))!
  38. $
  39. }
  40. Post_ENV2EPN_link (cp_evt, cp_place) {
  41. label = "4"
  42. }
  43. Post_Encapsulated_PetriNet/PortPlace (cp_port, cp_place) {
  44. label = "5"
  45. }
  46. }
  47. }
  48. {Contains} ForAll create_switches {
  49. LHS {
  50. Pre_PW_Environment/Group pre_grp {
  51. label = "1"
  52. }
  53. Pre_PW_Environment/Event pre_evt_a {
  54. label = "2"
  55. }
  56. Pre_PW_Environment/Event pre_evt_b {
  57. label = "3"
  58. }
  59. Pre_PW_Environment/Contains (pre_grp, pre_evt_a) {
  60. label = "4"
  61. }
  62. Pre_PW_Environment/Contains (pre_grp, pre_evt_b) {
  63. label = "5"
  64. }
  65. Pre_Encapsulated_PetriNet/Place pre_place_a {
  66. label = "8"
  67. }
  68. Pre_Encapsulated_PetriNet/Place pre_place_b {
  69. label = "9"
  70. }
  71. Pre_ENV2EPN_link (pre_evt_a, pre_place_a) {
  72. label = "6"
  73. }
  74. Pre_ENV2EPN_link (pre_evt_b, pre_place_b) {
  75. label = "7"
  76. }
  77. }
  78. RHS {
  79. Post_PW_Environment/Group post_grp {
  80. label = "1"
  81. }
  82. Post_PW_Environment/Event post_evt_a {
  83. label = "2"
  84. }
  85. Post_PW_Environment/Event post_evt_b {
  86. label = "3"
  87. }
  88. Post_PW_Environment/Contains (post_grp, post_evt_a) {
  89. label = "4"
  90. }
  91. Post_PW_Environment/Contains (post_grp, post_evt_b) {
  92. label = "5"
  93. }
  94. Post_Encapsulated_PetriNet/Place post_place_a {
  95. label = "8"
  96. }
  97. Post_Encapsulated_PetriNet/Place post_place_b {
  98. label = "9"
  99. }
  100. Post_Encapsulated_PetriNet/Transition post_transition {
  101. label = "12"
  102. value_name = $
  103. String function value(model : Element, name : String, mapping : Element):
  104. return string_join(string_join(read_attribute(model, mapping["2"], "name"), " -> "), read_attribute(model, mapping["3"], "name"))!
  105. $
  106. }
  107. Post_Encapsulated_PetriNet/P2T (post_place_a, post_transition) {
  108. label = "10"
  109. }
  110. Post_Encapsulated_PetriNet/T2P (post_transition, post_place_b) {
  111. label = "11"
  112. }
  113. Post_ENV2EPN_link (post_evt_a, post_place_a) {
  114. label = "6"
  115. }
  116. Post_ENV2EPN_link (post_evt_b, post_place_b) {
  117. label = "7"
  118. }
  119. }
  120. }
  121. }
  122. Initial (schedule, create_ports) {}
  123. OnSuccess (create_ports, create_switches) {}
  124. OnSuccess (create_switches, success) {}
  125. OnFailure (create_ports, failure) {}
  126. OnFailure (create_switches, failure) {}