CBD_mapper.mvc 9.0 KB

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