CBD_mapper.mvc 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  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_CBD/Block pre_block_0 {
  10. label = "0"
  11. }
  12. }
  13. RHS {
  14. Post_CBD/Block post_block_0 {
  15. label = "0"
  16. }
  17. Post_Rendered/Group post_block_1 {
  18. label = "1"
  19. post_x = $
  20. Integer function value(model : Element, name : String, mapping : Element):
  21. return 0!
  22. $
  23. post_y = $
  24. Integer function value(model : Element, name : String, mapping : Element):
  25. return 0!
  26. $
  27. }
  28. Post_Rendered/Rectangle post_block_2 {
  29. label = "2"
  30. post_x = $
  31. Integer function value(model : Element, name : String, mapping : Element):
  32. return 0!
  33. $
  34. post_y = $
  35. Integer function value(model : Element, name : String, mapping : Element):
  36. return 0!
  37. $
  38. post_width = $
  39. Integer function value(model : Element, name : String, mapping : Element):
  40. return 10!
  41. $
  42. post_height = $
  43. Integer function value(model : Element, name : String, mapping : Element):
  44. return 10!
  45. $
  46. post_lineWidth = $
  47. Integer function value(model : Element, name : String, mapping : Element):
  48. return 2!
  49. $
  50. post_lineColour = $
  51. String function value(model : Element, name : String, mapping : Element):
  52. return "black"!
  53. $
  54. post_fillColour = $
  55. String function value(model : Element, name : String, mapping : Element):
  56. return "white"!
  57. $
  58. }
  59. Post_Rendered/Text post_block_3 {
  60. label = "3"
  61. post_x = $
  62. Integer function value(model : Element, name : String, mapping : Element):
  63. return 10!
  64. $
  65. post_y = $
  66. Integer function value(model : Element, name : String, mapping : Element):
  67. return 10!
  68. $
  69. post_lineWidth = $
  70. Integer function value(model : Element, name : String, mapping : Element):
  71. return 1!
  72. $
  73. post_lineColour = $
  74. String function value(model : Element, name : String, mapping : Element):
  75. return "black"!
  76. $
  77. post_content = $
  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_Rendered/contains (post_block_1, post_block2) {}
  100. Post_Rendered/contains (post_block_1, post_block3) {}
  101. Post_Tracability (post_block_0, post_block_1) {}
  102. }
  103. }
  104. {Contains} ForAll render_connections {
  105. LHS {
  106. Pre_CBD/Block pre_conn_0 {
  107. label = "0"
  108. }
  109. Pre_CBD/Block pre_conn_1 {
  110. label = "1"
  111. }
  112. Pre_CBD/Link (pre_conn_0, pre_conn_1){
  113. label = "2"
  114. }
  115. Pre_Rendered/Group pre_conn_3 {
  116. label = "3"
  117. }
  118. Pre_Rendered/Group pre_conn_4 {
  119. label = "4"
  120. }
  121. Pre_Tracability (pre_conn_0, pre_conn_3) {}
  122. Pre_Tracability (pre_conn_0, pre_conn_4) {}
  123. }
  124. RHS {
  125. Post_CBD/Block post_conn_0 {
  126. label = "0"
  127. }
  128. Post_CBD/Block post_conn_1 {
  129. label = "1"
  130. }
  131. Post_CBD/Link (post_conn_0, post_conn_1){
  132. label = "2"
  133. }
  134. Post_Rendered/Group post_conn_3 {
  135. label = "3"
  136. }
  137. Post_Rendered/Group post_conn_4 {
  138. label = "4"
  139. }
  140. Post_Tracability (post_conn_0, post_conn_3) {}
  141. Post_Tracability (post_conn_0, post_conn_4) {}
  142. Post_Rendered/Link {
  143. label = "5"
  144. post_x = $
  145. Integer function value(model : Element, name : String, mapping : Element):
  146. return read_attribute(model, mapping["3"], "x")!
  147. $
  148. post_y = $
  149. Integer function value(model : Element, name : String, mapping : Element):
  150. return read_attribute(model, mapping["3"], "y")!
  151. $
  152. post_lineWidth = $
  153. Integer function value(model : Element, name : String, mapping : Element):
  154. return 1!
  155. $
  156. post_lineColour = $
  157. String function value(model : Element, name : String, mapping : Element):
  158. if (read_type(model, name) == "ICLink"):
  159. return "red"!
  160. else:
  161. return "black"!
  162. $
  163. post_targetX = $
  164. Integer function value(model : Element, name : String, mapping : Element):
  165. return read_attribute(model, mapping["4"], "x")!
  166. $
  167. post_targetY = $
  168. Integer function value(model : Element, name : String, mapping : Element):
  169. return read_attribute(model, mapping["4"], "y")!
  170. $
  171. }
  172. }
  173. }
  174. }
  175. Initial (schedule, render_blocks) {}
  176. OnSuccess (render_blocks, render_connections) {}
  177. OnFailure (render_blocks, render_connections) {}
  178. OnSuccess (render_connections, success) {}
  179. OnFailure (render_connections, success) {}
  180. }