Browse Source

Add some more notebooks and some bugs as well...

Yentl Van Tendeloo 3 years ago
parent
commit
dabcac9e4b

+ 6 - 0
bootstrap/core_algorithm.alc

@@ -235,6 +235,7 @@ String function get_entry_id(name : String):
 		name = string_substr(name, 0, string_len(name) - 1)
 
 	name = string_replace(name, "~", "users/" + cast_string(read_attribute(core, current_user_id, "name")))
+	log("Expanded name to " + name)
 
 	if (dict_in(caches["models"], name)):
 		if (dict_in(core, caches["models"])):
@@ -377,8 +378,10 @@ String function export_typing(model : Element, name : String):
 
 Void function model_create(model : Element, name : String, type_id : String, kind : String):
 	if (get_entry_id(name) != ""):
+		log("Exists, so overwrite...")
 		model_overwrite(model, get_entry_id(name), type_id)
 	else:
+		log("New, so create")
 		String location
 		String model_id
 		String instance_of
@@ -399,6 +402,8 @@ Void function model_create(model : Element, name : String, type_id : String, kin
 		// Create type mapping model
 		instantiate_link(core, "typing", "", instance_of, export_typing(model, name))
 
+		log("Stored with name: " + cast_string(read_attribute(core, model_id, "name")))
+
 	return!
 
 Void function model_overwrite(model : Element, model_id : String, metamodel_id : String):
@@ -808,6 +813,7 @@ Boolean function enact_action(pm : Element, element : String, mapping : Element)
 		keys = dict_keys(outputs)
 		while (set_len(keys) > 0):
 			key = set_pop(keys)
+			log("Create model " + cast_string(output_map[key]))
 			model_create(result[key], output_map[key], get_entry_id(outputs[key]), "Model")
 		output("Success")
 		return True!

File diff suppressed because it is too large
+ 565 - 0
examples/analyze_LoLA.ipynb


File diff suppressed because it is too large
+ 373 - 0
examples/pm_simulation.ipynb


+ 4 - 4
models/ClassicDEVS/transformations/simulate.alc

@@ -115,9 +115,6 @@ Boolean function main(model : Element):
                         model_rep = model_rep + "\t\tself.connectPorts(self.submodels[" + curr_submodel_name + "].my_ports[" + cast_value(read_attribute(model, curr_port, "name")) + "], self.submodels[" + cast_value(read_attribute(model, parent, "name")) + "].my_ports[" + cast_value(read_attribute(model, curr_channel, "name")) + "])\n"
         model_rep = model_rep + "\n"
 
-    log("Printing model_rep...")
-    log("\n" + model_rep)
-
 	String port
     String the_input
     String devs_model
@@ -130,6 +127,9 @@ Boolean function main(model : Element):
 	comm_set(port, experiment)
     
 	the_input = comm_get(port)
-	log(the_input)
+
+	String str
+	str = instantiate_node(model, "result/String", "")
+	instantiate_attribute(model, str, "value", the_input)
 
 	return True!