Browse Source

DTCBD to CTCBD works, but live modelling broken for CTCBD

Yentl Van Tendeloo 7 years ago
parent
commit
c6591c9428
3 changed files with 1 additions and 16 deletions
  1. 0 3
      bootstrap/transform.alc
  2. 0 10
      models/ctcbd_toPartialRuntime.mvc
  3. 1 3
      models/dtcbd_simulate.alc

+ 0 - 3
bootstrap/transform.alc

@@ -455,9 +455,6 @@ Void function rewrite(host_model : Element, schedule_model : Element, RHS : Stri
 	while (set_len(labels_to_remove) > 0):
 		// Remove the elements linked to these labels
 		label = set_pop(labels_to_remove)
-		log("Remove element of type " + read_type(host_model, mapping[label]))
-		log("Identifier: " + cast_value(mapping[label]))
-		log("Label: " + cast_value(label))
 		model_delete_element(host_model, mapping[label])
 		dict_delete(new_mapping, label)
 

+ 0 - 10
models/ctcbd_toPartialRuntime.mvc

@@ -381,28 +381,23 @@ Composite schedule {
                             Element all_links
 
                             all_blocks = allInstances(model, "Design/Block")
-                            log("Translating models: " + cast_value(set_len(all_blocks)))
                             while (set_len(all_blocks) > 0):
                                 element_name = set_pop(all_blocks)
-                                log("Check " + element_name)
                                 mm_type_name = "PartialRuntime/" + cast_string(list_read(string_split(read_type(model, element_name), "/"), 1))
 
                                 if (set_len(allOutgoingAssociationInstances(model, element_name, "D2P_block")) == 0):
                                     // New design element, so create in partial runtime model as well
                                     new_element_name = instantiate_node(model, mm_type_name, "")
                                     instantiate_link(model, "D2P_block", "", element_name, new_element_name)
-                                    log("New element: " + mm_type_name)
 
                                 // Always update the value of attributes of PartialRuntime
                                 new_element_name = map_D2P(model, element_name)
                                 if (mm_type_name == "PartialRuntime/ConstantBlock"):
                                     instantiate_attribute(model, new_element_name, "value", read_attribute(model, element_name, "value"))
-                                    log("Copied value: " + cast_value(read_attribute(model, element_name, "value")))
                                 elif (mm_type_name == "PartialRuntime/ProbeBlock"):
                                     instantiate_attribute(model, new_element_name, "name", read_attribute(model, element_name, "name"))
 
                             all_blocks = allInstances(model, "PartialRuntime/Block")
-                            log("All created blocks: " + cast_value(set_len(all_blocks)))
                             while (set_len(all_blocks) > 0):
                                 element_name = set_pop(all_blocks)
                                 if (set_len(allIncomingAssociationInstances(model, element_name, "D2P_block")) == 0):
@@ -422,18 +417,13 @@ Composite schedule {
                             all_links = allInstances(model, "Design/Link")
                             while (set_len(all_links) > 0):
                                 element_name = set_pop(all_links)
-                                log("Recreate link " + element_name)
-                                log("Source type: " + read_type(model, readAssociationSource(model, element_name)))
                                 instantiate_link(model, "PartialRuntime/Link", "", map_D2P(model, readAssociationSource(model, element_name)), map_D2P(model, readAssociationDestination(model, element_name)))
 
                             all_links = allInstances(model, "Design/InitialCondition")
                             while (set_len(all_links) > 0):
                                 element_name = set_pop(all_links)
-                                log("Recreate initial condition " + element_name)
                                 instantiate_link(model, "PartialRuntime/InitialCondition", "", map_D2P(model, readAssociationSource(model, element_name)), map_D2P(model, readAssociationDestination(model, element_name)))
 
-                            log("Finished translation")
-
                             return!
 
                         String function map_D2P(model : Element, name : String):

+ 1 - 3
models/dtcbd_simulate.alc

@@ -326,7 +326,7 @@ Float function step_simulation(model : Element, schedule : Element, time : Float
 
 			// Execute "block"
 			blocktype = read_type(model, block)
-			log("Execute block " + block + " : " + blocktype)
+			//log("Execute block " + block + " : " + blocktype)
 			incoming = set_copy(inputs[block])
 			if (blocktype == "FullRuntime/ConstantBlock"):
 				signal = cast_float(read_attribute(model, block, "value"))
@@ -357,7 +357,6 @@ Float function step_simulation(model : Element, schedule : Element, time : Float
 					incoming = allAssociationOrigins(model, block, "FullRuntime/InitialCondition")
 					while (set_len(incoming) > 0):
 						selected = set_pop(incoming)
-						log("Reading signal from block: " + selected + " : " + read_type(model, selected))
 						signal = cast_float(read_attribute(model, selected, "signal"))
 				else:
 					signal = read_attribute(model, block, "last_in")
@@ -374,7 +373,6 @@ Float function step_simulation(model : Element, schedule : Element, time : Float
 		block = set_pop(memory_blocks)
 		// Update memory
 		incoming = set_copy(inputs[block])
-		log("Update memory of " + block)
 		while (set_len(incoming) > 0):
 			selected = set_pop(incoming)
 			instantiate_attribute(model, block, "last_in", cast_float(read_attribute(model, selected, "signal")))