123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248 |
- include "primitives.alh"
- include "modelling.alh"
- include "object_operations.alh"
- A B {
- Composite schedule {
- {Contains} Success success {}
- {Contains} ForAll render_blocks {
- LHS {
- Pre_CausalBlockDiagrams/Block pre_block_0 {
- label = "0"
- }
- constraint = $
- Boolean function constraint(model : Element, mapping : Element):
- Element trace_links
- trace_links = allOutgoingAssociationInstances(model, mapping["0"], "TracabilityGraphical")
- log("Found tracability links: " + cast_v2s(read_nr_out(trace_links)))
- if (read_nr_out(trace_links) > 0):
- log("Block already connected; ignoring!")
- return False!
- else:
- return True!
- $
- }
- RHS {
- Post_CausalBlockDiagrams/Block post_block_0 {
- label = "0"
- }
- Post_MM_rendered_graphical/Group post_block_1 {
- label = "1"
- value___asid = $
- String function value(model : Element, name : String, mapping : Element):
- return mapping["0"]!
- $
- value_x = $
- Integer function value(model : Element, name : String, mapping : Element):
- return 0!
- $
- value_y = $
- Integer function value(model : Element, name : String, mapping : Element):
- return 0!
- $
- }
- Post_MM_rendered_graphical/Rectangle post_block_2 {
- label = "2"
- value_x = $
- Integer function value(model : Element, name : String, mapping : Element):
- return 0!
- $
- value_y = $
- Integer function value(model : Element, name : String, mapping : Element):
- return 0!
- $
- value_width = $
- Integer function value(model : Element, name : String, mapping : Element):
- return 30!
- $
- value_height = $
- Integer function value(model : Element, name : String, mapping : Element):
- return 30!
- $
- value_lineWidth = $
- Integer function value(model : Element, name : String, mapping : Element):
- return 2!
- $
- value_lineColour = $
- String function value(model : Element, name : String, mapping : Element):
- return "black"!
- $
- value_fillColour = $
- String function value(model : Element, name : String, mapping : Element):
- return "white"!
- $
- }
- Post_MM_rendered_graphical/Text post_block_3 {
- label = "3"
- value_x = $
- Integer function value(model : Element, name : String, mapping : Element):
- return 10!
- $
- value_y = $
- Integer function value(model : Element, name : String, mapping : Element):
- return 10!
- $
- value_lineWidth = $
- Integer function value(model : Element, name : String, mapping : Element):
- return 1!
- $
- value_lineColour = $
- String function value(model : Element, name : String, mapping : Element):
- return "black"!
- $
- value_text = $
- String function value(model : Element, name : String, mapping : Element):
- String type
- type = read_type(model, mapping["0"])
- if (type == "CausalBlockDiagrams/AdditionBlock"):
- return "+"!
- elif (type == "CausalBlockDiagrams/NegatorBlock"):
- return "-"!
- elif (type == "CausalBlockDiagrams/ConstantBlock"):
- return "c"!
- elif (type == "CausalBlockDiagrams/MultiplyBlock"):
- return "*"!
- elif (type == "CausalBlockDiagrams/InverseBlock"):
- return "/"!
- elif (type == "CausalBlockDiagrams/DerivatorBlock"):
- return "d/dx"!
- elif (type == "CausalBlockDiagrams/IntegratorBlock"):
- return "1/s"!
- elif (type == "CausalBlockDiagrams/DelayBlock"):
- return "DELAY"!
- elif (type == "CausalBlockDiagrams/ProbeBlock"):
- return "PROBE"!
- else:
- return ("Unknown type: " + type)!
- $
- }
- Post_MM_rendered_graphical/contains (post_block_1, post_block_2) {
- label = "4"
- }
- Post_MM_rendered_graphical/contains (post_block_1, post_block_3) {
- label = "5"
- }
- Post_TracabilityGraphical (post_block_0, post_block_1) {
- label = "6"
- }
- }
- }
- {Contains} ForAll render_connections {
- LHS {
- Pre_CausalBlockDiagrams/Block pre_conn_0 {
- label = "0"
- }
- Pre_CausalBlockDiagrams/Block pre_conn_1 {
- label = "1"
- }
- Pre_CausalBlockDiagrams/Link (pre_conn_0, pre_conn_1){
- label = "2"
- }
- Pre_MM_rendered_graphical/Group pre_conn_3 {
- label = "3"
- }
- Pre_MM_rendered_graphical/Group pre_conn_4 {
- label = "4"
- }
- Pre_TracabilityGraphical (pre_conn_0, pre_conn_3) {
- label = "5"
- }
- Pre_TracabilityGraphical (pre_conn_1, pre_conn_4) {
- label = "6"
- }
- constraint = $
- Boolean function constraint(model : Element, mapping : Element):
- Element trace_links
- trace_links = allOutgoingAssociationInstances(model, mapping["2"], "TracabilityGraphical")
- if (read_nr_out(trace_links) > 0):
- log("Block already connected; ignoring!")
- return False!
- else:
- return True!
- $
- }
- RHS {
- Post_CausalBlockDiagrams/Block post_conn_0 {
- label = "0"
- }
- Post_CausalBlockDiagrams/Block post_conn_1 {
- label = "1"
- }
- Post_CausalBlockDiagrams/Link (post_conn_0, post_conn_1){
- label = "2"
- }
- Post_MM_rendered_graphical/Group post_conn_3 {
- label = "3"
- }
- Post_MM_rendered_graphical/Group post_conn_4 {
- label = "4"
- }
- Post_TracabilityGraphical (post_conn_0, post_conn_3) {
- label = "5"
- }
- Post_TracabilityGraphical (post_conn_1, post_conn_4) {
- label = "6"
- }
- Post_MM_rendered_graphical/Line {
- label = "7"
- value___asid = $
- String function value(model : Element, name : String, mapping : Element):
- return mapping["2"]!
- $
- value_x = $
- Integer function value(model : Element, name : String, mapping : Element):
- return read_attribute(model, mapping["3"], "x")!
- $
- value_y = $
- Integer function value(model : Element, name : String, mapping : Element):
- return read_attribute(model, mapping["3"], "y")!
- $
- value_lineWidth = $
- Integer function value(model : Element, name : String, mapping : Element):
- return 1!
- $
- value_lineColour = $
- String function value(model : Element, name : String, mapping : Element):
- if (read_type(model, name) == "ICLink"):
- return "red"!
- else:
- return "black"!
- $
- value_targetX = $
- Integer function value(model : Element, name : String, mapping : Element):
- return read_attribute(model, mapping["4"], "x")!
- $
- value_targetY = $
- Integer function value(model : Element, name : String, mapping : Element):
- return read_attribute(model, mapping["4"], "y")!
- $
- }
- }
- }
- }
- Initial (schedule, render_blocks) {}
- OnSuccess (render_blocks, render_connections) {}
- OnFailure (render_blocks, render_connections) {}
- OnSuccess (render_connections, success) {}
- OnFailure (render_connections, success) {}
- }
|