CBD_mapper.mvc 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  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} ForAll render_blocks {
  8. LHS {
  9. Pre_CausalBlockDiagrams/Block pre_block_0 {
  10. label = "0"
  11. }
  12. }
  13. RHS {
  14. Post_CausalBlockDiagrams/Block post_block_0 {
  15. label = "0"
  16. }
  17. Post_MM_rendered_graphical/Group post_block_1 {
  18. label = "1"
  19. value___asid = $
  20. String function value(model : Element, name : String, mapping : Element):
  21. return mapping["0"]!
  22. $
  23. value_x = $
  24. Integer function value(model : Element, name : String, mapping : Element):
  25. return 0!
  26. $
  27. value_y = $
  28. Integer function value(model : Element, name : String, mapping : Element):
  29. return 0!
  30. $
  31. }
  32. Post_MM_rendered_graphical/Rectangle post_block_2 {
  33. label = "2"
  34. value_x = $
  35. Integer function value(model : Element, name : String, mapping : Element):
  36. return 0!
  37. $
  38. value_y = $
  39. Integer function value(model : Element, name : String, mapping : Element):
  40. return 0!
  41. $
  42. value_width = $
  43. Integer function value(model : Element, name : String, mapping : Element):
  44. return 10!
  45. $
  46. value_height = $
  47. Integer function value(model : Element, name : String, mapping : Element):
  48. return 10!
  49. $
  50. value_lineWidth = $
  51. Integer function value(model : Element, name : String, mapping : Element):
  52. return 2!
  53. $
  54. value_lineColour = $
  55. String function value(model : Element, name : String, mapping : Element):
  56. return "black"!
  57. $
  58. value_fillColour = $
  59. String function value(model : Element, name : String, mapping : Element):
  60. return "white"!
  61. $
  62. }
  63. Post_MM_rendered_graphical/Text post_block_3 {
  64. label = "3"
  65. value_x = $
  66. Integer function value(model : Element, name : String, mapping : Element):
  67. return 10!
  68. $
  69. value_y = $
  70. Integer function value(model : Element, name : String, mapping : Element):
  71. return 10!
  72. $
  73. value_lineWidth = $
  74. Integer function value(model : Element, name : String, mapping : Element):
  75. return 1!
  76. $
  77. value_lineColour = $
  78. String function value(model : Element, name : String, mapping : Element):
  79. return "black"!
  80. $
  81. value_text = $
  82. String function value(model : Element, name : String, mapping : Element):
  83. String type
  84. type = read_type(model, mapping["0"])
  85. if (type == "CausalBlockDiagrams/AdditionBlock"):
  86. return "+"!
  87. elif (type == "CausalBlockDiagrams/NegatorBlock"):
  88. return "-"!
  89. elif (type == "CausalBlockDiagrams/ConstantBlock"):
  90. return "c"!
  91. elif (type == "CausalBlockDiagrams/MultiplyBlock"):
  92. return "*"!
  93. elif (type == "CausalBlockDiagrams/InverseBlock"):
  94. return "/"!
  95. elif (type == "CausalBlockDiagrams/DerivatorBlock"):
  96. return "d/dx"!
  97. elif (type == "CausalBlockDiagrams/IntegratorBlock"):
  98. return "1/s"!
  99. elif (type == "CausalBlockDiagrams/DelayBlock"):
  100. return "DELAY"!
  101. elif (type == "CausalBlockDiagrams/ProbeBlock"):
  102. return "PROBE"!
  103. else:
  104. return ("Unknown type: " + type)!
  105. $
  106. }
  107. Post_MM_rendered_graphical/contains (post_block_1, post_block_2) {
  108. label = "4"
  109. }
  110. Post_MM_rendered_graphical/contains (post_block_1, post_block_3) {
  111. label = "5"
  112. }
  113. Post_TracabilityLink (post_block_0, post_block_1) {
  114. label = "6"
  115. }
  116. }
  117. }
  118. {Contains} ForAll render_connections {
  119. LHS {
  120. Pre_CausalBlockDiagrams/Block pre_conn_0 {
  121. label = "0"
  122. }
  123. Pre_CausalBlockDiagrams/Block pre_conn_1 {
  124. label = "1"
  125. }
  126. Pre_CausalBlockDiagrams/Link (pre_conn_0, pre_conn_1){
  127. label = "2"
  128. }
  129. Pre_MM_rendered_graphical/Group pre_conn_3 {
  130. label = "3"
  131. }
  132. Pre_MM_rendered_graphical/Group pre_conn_4 {
  133. label = "4"
  134. }
  135. Pre_TracabilityLink (pre_conn_0, pre_conn_3) {
  136. label = "5"
  137. }
  138. Pre_TracabilityLink (pre_conn_1, pre_conn_4) {
  139. label = "6"
  140. }
  141. }
  142. RHS {
  143. Post_CausalBlockDiagrams/Block post_conn_0 {
  144. label = "0"
  145. }
  146. Post_CausalBlockDiagrams/Block post_conn_1 {
  147. label = "1"
  148. }
  149. Post_CausalBlockDiagrams/Link (post_conn_0, post_conn_1){
  150. label = "2"
  151. }
  152. Post_MM_rendered_graphical/Group post_conn_3 {
  153. label = "3"
  154. }
  155. Post_MM_rendered_graphical/Group post_conn_4 {
  156. label = "4"
  157. }
  158. Post_TracabilityLink (post_conn_0, post_conn_3) {
  159. label = "5"
  160. }
  161. Post_TracabilityLink (post_conn_1, post_conn_4) {
  162. label = "6"
  163. }
  164. Post_MM_rendered_graphical/Line {
  165. label = "7"
  166. value___asid = $
  167. String function value(model : Element, name : String, mapping : Element):
  168. return mapping["2"]!
  169. $
  170. value_x = $
  171. Integer function value(model : Element, name : String, mapping : Element):
  172. return read_attribute(model, mapping["3"], "x")!
  173. $
  174. value_y = $
  175. Integer function value(model : Element, name : String, mapping : Element):
  176. return read_attribute(model, mapping["3"], "y")!
  177. $
  178. value_lineWidth = $
  179. Integer function value(model : Element, name : String, mapping : Element):
  180. return 1!
  181. $
  182. value_lineColour = $
  183. String function value(model : Element, name : String, mapping : Element):
  184. if (read_type(model, name) == "ICLink"):
  185. return "red"!
  186. else:
  187. return "black"!
  188. $
  189. value_targetX = $
  190. Integer function value(model : Element, name : String, mapping : Element):
  191. return read_attribute(model, mapping["4"], "x")!
  192. $
  193. value_targetY = $
  194. Integer function value(model : Element, name : String, mapping : Element):
  195. return read_attribute(model, mapping["4"], "y")!
  196. $
  197. }
  198. }
  199. }
  200. }
  201. Initial (schedule, render_blocks) {}
  202. OnSuccess (render_blocks, render_connections) {}
  203. OnFailure (render_blocks, render_connections) {}
  204. OnSuccess (render_connections, success) {}
  205. OnFailure (render_connections, success) {}
  206. }