CBD_mapper.mvc 9.1 KB

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