environment_to_EPN.mvc 4.6 KB

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