|
@@ -230,13 +230,13 @@ Void function execute_cbd(design_model : Element):
|
|
Element schedule_init
|
|
Element schedule_init
|
|
Element schedule_run
|
|
Element schedule_run
|
|
Element schedule
|
|
Element schedule
|
|
- Boolean conforming
|
|
|
|
|
|
+ String conforming
|
|
|
|
|
|
old_runtime_model = instantiate_model(import_node("models/CausalBlockDiagrams_Runtime"))
|
|
old_runtime_model = instantiate_model(import_node("models/CausalBlockDiagrams_Runtime"))
|
|
runtime_model = retype_to_runtime(design_model)
|
|
runtime_model = retype_to_runtime(design_model)
|
|
runtime_model = sanitize(runtime_model, old_runtime_model)
|
|
runtime_model = sanitize(runtime_model, old_runtime_model)
|
|
running = False
|
|
running = False
|
|
- conforming = value_eq(conformance_scd(design_model), "OK")
|
|
|
|
|
|
+ conforming = conformance_scd(design_model)
|
|
|
|
|
|
schedule_init = create_schedule(runtime_model, read_attribute(runtime_model, "time", "start_time"))
|
|
schedule_init = create_schedule(runtime_model, read_attribute(runtime_model, "time", "start_time"))
|
|
schedule_run = create_schedule(runtime_model, -1)
|
|
schedule_run = create_schedule(runtime_model, -1)
|
|
@@ -254,17 +254,21 @@ Void function execute_cbd(design_model : Element):
|
|
// Process input
|
|
// Process input
|
|
if (cmd == "simulate"):
|
|
if (cmd == "simulate"):
|
|
// Simulation should toggle running to True, but only if the model is conforming
|
|
// Simulation should toggle running to True, but only if the model is conforming
|
|
- if (conforming):
|
|
|
|
|
|
+ if (conforming == "OK"):
|
|
running = True
|
|
running = True
|
|
|
|
+ else:
|
|
|
|
+ output("FAIL_CONFORMANCE " + conforming)
|
|
|
|
|
|
elif (cmd == "step"):
|
|
elif (cmd == "step"):
|
|
// Stepping should make a single step, but first need to pick the correct schedule to use
|
|
// Stepping should make a single step, but first need to pick the correct schedule to use
|
|
- if (conforming):
|
|
|
|
|
|
+ if (conforming == "OK"):
|
|
if (read_attribute(runtime_model, "time", "start_time") == read_attribute(runtime_model, "time", "current_time")):
|
|
if (read_attribute(runtime_model, "time", "start_time") == read_attribute(runtime_model, "time", "current_time")):
|
|
schedule = schedule_init
|
|
schedule = schedule_init
|
|
else:
|
|
else:
|
|
schedule = schedule_run
|
|
schedule = schedule_run
|
|
step_simulation(runtime_model, schedule)
|
|
step_simulation(runtime_model, schedule)
|
|
|
|
+ else:
|
|
|
|
+ output("FAIL_CONFORMANCE " + conforming)
|
|
|
|
|
|
elif (cmd == "pause"):
|
|
elif (cmd == "pause"):
|
|
// Pausing merely stops a running simulation
|
|
// Pausing merely stops a running simulation
|
|
@@ -307,8 +311,8 @@ Void function execute_cbd(design_model : Element):
|
|
instantiate_link(design_model, input(), input(), input(), input())
|
|
instantiate_link(design_model, input(), input(), input(), input())
|
|
|
|
|
|
// After changes, we check whether or not the design model conforms
|
|
// After changes, we check whether or not the design model conforms
|
|
- conforming = value_eq(conformance_scd(design_model), "OK")
|
|
|
|
- if (conforming):
|
|
|
|
|
|
+ conforming = conformance_scd(design_model)
|
|
|
|
+ if (conforming == "OK"):
|
|
// Conforming, so do the retyping and sanitization step
|
|
// Conforming, so do the retyping and sanitization step
|
|
runtime_model = retype_to_runtime(design_model)
|
|
runtime_model = retype_to_runtime(design_model)
|
|
runtime_model = sanitize(runtime_model, old_runtime_model)
|
|
runtime_model = sanitize(runtime_model, old_runtime_model)
|
|
@@ -318,5 +322,6 @@ Void function execute_cbd(design_model : Element):
|
|
else:
|
|
else:
|
|
// Not conforming, so stop simulation and block for input (preferably a modify to make everything consistent again)
|
|
// Not conforming, so stop simulation and block for input (preferably a modify to make everything consistent again)
|
|
running = False
|
|
running = False
|
|
|
|
+ output("FAIL_CONFORMANCE " + conforming)
|
|
else:
|
|
else:
|
|
log("Did not understand command: " + cmd)
|
|
log("Did not understand command: " + cmd)
|