CBD_mapper.mvc 8.3 KB

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