|
@@ -51,9 +51,10 @@ Element function sanitize(new_runtime_model : Element, old_runtime_model : Eleme
|
|
|
String cstate_obj
|
|
|
log("Start sanitize")
|
|
|
|
|
|
- if (read_nr_out(allInstances(old_runtime_model, "CurrentState")) > 0):
|
|
|
+ cstate_obj = instantiate_node(new_runtime_model, "CurrentState", "")
|
|
|
+
|
|
|
+ if (read_nr_out(allInstances(old_runtime_model, "CurrentStateLink")) > 0):
|
|
|
cstate = readAssociationDestination(old_runtime_model, set_pop(allInstances(old_runtime_model, "CurrentStateLink")))
|
|
|
- cstate_obj = instantiate_node(new_runtime_model, "CurrentState", "")
|
|
|
if (bool_not(dict_in(new_runtime_model["model"], cstate))):
|
|
|
// Current state removed, so fix
|
|
|
if (auto):
|
|
@@ -124,6 +125,7 @@ Void function execute_fsa(design_model : Element):
|
|
|
Float start_time
|
|
|
Boolean automatic_sanitization
|
|
|
|
|
|
+ automatic_sanitization = True
|
|
|
start_time = time()
|
|
|
simulation_time = 0.0
|
|
|
old_runtime_model = instantiate_model(import_node("models/FiniteStateAutomata_Runtime"))
|
|
@@ -137,7 +139,6 @@ Void function execute_fsa(design_model : Element):
|
|
|
output("CONFORMANCE_FAIL")
|
|
|
|
|
|
while (True):
|
|
|
- log("Check input")
|
|
|
if (has_input()):
|
|
|
cmd = input()
|
|
|
else:
|
|
@@ -188,9 +189,7 @@ Void function execute_fsa(design_model : Element):
|
|
|
|
|
|
elif (cmd == "read_attribute"):
|
|
|
// Returns the value of an attribute
|
|
|
- log("Sending attribute value for")
|
|
|
output("ATTR_VALUE " + cast_v2s(read_attribute(design_model, input(), input())))
|
|
|
- log("Sending OK")
|
|
|
|
|
|
elif (bool_or(cmd == "switch_initial", bool_or(bool_or(cmd == "set_attribute", cmd == "instantiate_node"), bool_or(cmd == "delete_element", cmd == "instantiate_association")))):
|
|
|
// Modify the structure
|
|
@@ -239,6 +238,7 @@ Void function execute_fsa(design_model : Element):
|
|
|
old_runtime_model = runtime_model
|
|
|
start_time = time() - simulation_time
|
|
|
output("CONFORMANCE_OK")
|
|
|
+ log("Conformance became OK")
|
|
|
else:
|
|
|
// Not conforming, so stop simulation and block for input (preferably a modify to make everything consistent again)
|
|
|
output("CONFORMANCE_FAIL " + conforming)
|