|
@@ -24,7 +24,7 @@ Void function main():
|
|
|
else:
|
|
|
output("Non-conforming model: " + verify_result)
|
|
|
|
|
|
-Void function translate_to_runtime(design_model : Element):
|
|
|
+Element function translate_to_runtime(design_model : Element):
|
|
|
Element runtime_model
|
|
|
Element all_blocks
|
|
|
Element all_links
|
|
@@ -83,7 +83,7 @@ Void function translate_to_runtime(design_model : Element):
|
|
|
log("Solving loops (TODO)")
|
|
|
|
|
|
log("DONE!")
|
|
|
- return !
|
|
|
+ return runtime_model!
|
|
|
|
|
|
Void function create_schedule(model : Element, is_time_zero : Boolean):
|
|
|
Element all_blocks
|
|
@@ -101,13 +101,10 @@ Void function create_schedule(model : Element, is_time_zero : Boolean):
|
|
|
visited = create_node()
|
|
|
to_visit = create_node()
|
|
|
if (is_time_zero):
|
|
|
- log("Make initial schedule!")
|
|
|
schedule = instantiate_node(model, "Schedule", "schedule_init")
|
|
|
else:
|
|
|
- log("Make normal schedule!")
|
|
|
schedule = instantiate_node(model, "Schedule", "schedule_run")
|
|
|
instantiate_attribute(model, schedule, "active", True)
|
|
|
- log("Instantiated attribute")
|
|
|
|
|
|
while (read_nr_out(all_blocks) > 0):
|
|
|
element_name = set_pop(all_blocks)
|
|
@@ -134,10 +131,7 @@ Void function create_schedule(model : Element, is_time_zero : Boolean):
|
|
|
|
|
|
if (ready):
|
|
|
new_schedule = instantiate_node(model, "Schedule", "")
|
|
|
- log("Instantiate active")
|
|
|
- log(cast_e2s(new_schedule))
|
|
|
instantiate_attribute(model, new_schedule, "active", False)
|
|
|
- log("ACTIVE OK")
|
|
|
instantiate_link(model, "LinkedBlock", "", schedule, element_name)
|
|
|
instantiate_link(model, "NextSchedule", "", schedule, new_schedule)
|
|
|
schedule = new_schedule
|
|
@@ -174,22 +168,20 @@ Void function list_CBD(model : Element):
|
|
|
|
|
|
output("Schedule @ 0:")
|
|
|
elem = "schedule_init"
|
|
|
- while (allOutgoingAssociationInstances(model, elem, "LinkedBlock")):
|
|
|
- block = set_pop(readAssociationSource(model, set_pop(allOutgoingAssociationInstances(model, elem, "LinkedBlock"))))
|
|
|
- output(" " + block)
|
|
|
- elem = set_pop(readAssociationSource(model, set_pop(allOutgoingAssociationInstances(model, elem, "LinkedBlock"))))
|
|
|
-
|
|
|
- output("Schedule @ 0:")
|
|
|
- elem = "schedule_run"
|
|
|
- while (allOutgoingAssociationInstances(model, elem, "LinkedBlock")):
|
|
|
- block = set_pop(readAssociationSource(model, set_pop(allOutgoingAssociationInstances(model, elem, "LinkedBlock"))))
|
|
|
+ log("READ 1")
|
|
|
+ log("Model " + cast_e2s(model["model"][elem]))
|
|
|
+ while (read_nr_out(allOutgoingAssociationInstances(model, elem, "LinkedBlock")) > 0):
|
|
|
+ log("READ NEXT")
|
|
|
+ block = readAssociationDestination(model, set_pop(allOutgoingAssociationInstances(model, elem, "LinkedBlock")))
|
|
|
output(" " + block)
|
|
|
- elem = set_pop(readAssociationSource(model, set_pop(allOutgoingAssociationInstances(model, elem, "LinkedBlock"))))
|
|
|
+ log("FOUND BLOCK : " + block)
|
|
|
+ elem = readAssociationDestination(model, set_pop(allOutgoingAssociationInstances(model, elem, "NextSchedule")))
|
|
|
+ log("Next schedule")
|
|
|
|
|
|
return !
|
|
|
|
|
|
Void function execute_cbd(model : Element):
|
|
|
- translate_to_runtime(model)
|
|
|
+ model = translate_to_runtime(model)
|
|
|
|
|
|
String cmd
|
|
|
while (True):
|