Browse Source

Several minor changes to include all parts of the mapping

Yentl Van Tendeloo 7 years ago
parent
commit
79604e6c1a

+ 7 - 4
bootstrap/transform.alc

@@ -299,7 +299,7 @@ Element function match(host_model : Element, schedule_model : Element, LHS : Str
 	set_add_node(mappings, initial_mapping)
 	set_add_node(mappings, initial_mapping)
 	while (list_len(schedule) > 0):
 	while (list_len(schedule) > 0):
 		current_element = list_pop(schedule, list_len(schedule) - 1)
 		current_element = list_pop(schedule, list_len(schedule) - 1)
-		//log("Binding element with label " + cast_value(read_attribute(schedule_model, current_element, "label")))
+		log("Binding element with label " + cast_value(read_attribute(schedule_model, current_element, "label")))
 		new_mappings = dict_create()
 		new_mappings = dict_create()
 
 
 		while (set_len(mappings) > 0):
 		while (set_len(mappings) > 0):
@@ -313,7 +313,7 @@ Element function match(host_model : Element, schedule_model : Element, LHS : Str
 				set_add_node(new_mappings, new_map)
 				set_add_node(new_mappings, new_map)
 
 
 		mappings = new_mappings
 		mappings = new_mappings
-		//log("Remaining options: " + cast_value(set_len(mappings)))
+		log("Remaining options: " + cast_value(set_len(mappings)))
 
 
 		if (set_len(mappings) == 0):
 		if (set_len(mappings) == 0):
 			// Stop because we have no more options remaining!
 			// Stop because we have no more options remaining!
@@ -537,6 +537,8 @@ Boolean function transform_atomic(host_model : Element, schedule_model : Element
 	Element mapping
 	Element mapping
 	mappings = full_match(host_model, schedule_model, current, True)
 	mappings = full_match(host_model, schedule_model, current, True)
 
 
+	log("Executing rule: " + current)
+
 	if (set_len(mappings) > 0):
 	if (set_len(mappings) > 0):
 		// Pick one!
 		// Pick one!
 		mapping = random_choice(set_to_list(mappings))
 		mapping = random_choice(set_to_list(mappings))
@@ -554,7 +556,7 @@ Boolean function transform_forall(host_model : Element, schedule_model : Element
 	Element mapping
 	Element mapping
 	Boolean result
 	Boolean result
 
 
-	//log("Executing rule: " + current)
+	log("Executing rule: " + current)
 
 
 	mappings = full_match(host_model, schedule_model, current, False)
 	mappings = full_match(host_model, schedule_model, current, False)
 
 
@@ -563,11 +565,12 @@ Boolean function transform_forall(host_model : Element, schedule_model : Element
 	else:
 	else:
 		result = False
 		result = False
 
 
-	//log("Matches in forall: " + cast_string(set_len(mappings)))
+	log("Matches in forall: " + cast_string(set_len(mappings)))
 	while (set_len(mappings) > 0):
 	while (set_len(mappings) > 0):
 		mapping = set_pop(mappings)
 		mapping = set_pop(mappings)
 		RHS = set_pop(allAssociationDestinations(schedule_model, current, "RHSLink"))
 		RHS = set_pop(allAssociationDestinations(schedule_model, current, "RHSLink"))
 		rewrite(host_model, schedule_model, RHS, mapping)
 		rewrite(host_model, schedule_model, RHS, mapping)
+	log("Rewrite OK")
 
 
 	return result!
 	return result!
 
 

+ 0 - 1
interface/HUTN/hutn_compiler/model_visitor.py

@@ -138,7 +138,6 @@ class ModelVisitor(Visitor):
                 attr_value = attr_value.get_text()[1:-1]
                 attr_value = attr_value.get_text()[1:-1]
             elif attr_value.head == "LONG_STR":
             elif attr_value.head == "LONG_STR":
                 attr_value = attr_value.get_text()[3:-3]
                 attr_value = attr_value.get_text()[3:-3]
-                print("Got value: " + str(attr_value))
             elif attr_value.head == "TRUE":
             elif attr_value.head == "TRUE":
                 attr_value = True
                 attr_value = True
             elif attr_value.head == "FALSE":
             elif attr_value.head == "FALSE":

+ 0 - 1
models/WSC/DEVS.mvc

@@ -4,7 +4,6 @@ SimpleAttribute Natural {}
 
 
 Class BaseDEVSBlock {
 Class BaseDEVSBlock {
     name: String
     name: String
-    parameters : Natural
 }
 }
 
 
 Class AtomicDEVSBlock: BaseDEVSBlock {
 Class AtomicDEVSBlock: BaseDEVSBlock {

+ 1 - 8
models/WSC/DEVS_merge.alc

@@ -17,14 +17,6 @@ Boolean function main(model : Element):
 
 
 	while (set_len(all_elements) > 0):
 	while (set_len(all_elements) > 0):
 		key = set_pop(all_elements)
 		key = set_pop(all_elements)
-		// key now contains an element, which we must retype
-		split = string_split(key, "/")
-		if (list_len(split) > 1):
-			new_key = list_read(split, 1)
-			dict_add(model["model"], new_key, model["model"][key])
-			dict_delete(model["model"], key)
-			key = new_key
-
 		type = read_type(model, key)
 		type = read_type(model, key)
 		split = string_split(type, "/")
 		split = string_split(type, "/")
 		// Got the type, which might contain a /
 		// Got the type, which might contain a /
@@ -32,5 +24,6 @@ Boolean function main(model : Element):
 			type = list_read(split, 1)
 			type = list_read(split, 1)
 			// Strip of the part before the / and make it into "DEVS"
 			// Strip of the part before the / and make it into "DEVS"
 			retype(model, key, "result/" + type)
 			retype(model, key, "result/" + type)
+			log("Retype!")
 
 
 	return True!
 	return True!

+ 143 - 0
models/WSC/DEVS_simulate.alc

@@ -0,0 +1,143 @@
+include "primitives.alh"
+include "services.alh"
+include "modelling.alh"
+include "object_operations.alh"
+include "utils.alh"
+include "io.alh"
+include "typing.alh"
+
+Boolean function main(model : Element):
+    log("Translating DEVS to string representation!")
+
+    String model_rep
+    Element all_atomics
+    Element curr_atomic
+    Element all_coupleds
+    Element curr_coupled
+    Element string_element
+    Element all_ports
+    Element all_submodels
+    Element curr_port
+    Element curr_submodel
+    Element out_channels
+    Element curr_channel
+    Element possible_parent
+    Element parent
+    String curr_port_name
+    String curr_port_type
+    String curr_submodel_name
+    String curr_submodel_type
+	String curr_submodel_parameters
+
+    model_rep = "\nfrom DEVS import *\nfrom infinity import INFINITY\n\n"
+
+    all_atomics = allInstances(model, "DEVS/AtomicDEVSBlock")
+    while (read_nr_out(all_atomics) > 0):
+        curr_atomic = set_pop(all_atomics)
+        model_rep = model_rep + "class " + cast_string(read_attribute(model, curr_atomic, "name")) + "(AtomicDEVS):\n"
+        model_rep = model_rep + "\tdef __init__(self, name=" + cast_value(read_attribute(model, curr_atomic, "name")) + ", parameters):\n"
+		model_rep = model_rep + "\t\tself.parameters = parameters\n"
+        model_rep = model_rep + "\t\tAtomicDEVS.__init__(self, name)\n"
+		model_rep = model_rep + "\t\tself.initialState()\n"
+        model_rep = model_rep + "\t\tself.my_ports = {"
+        all_ports = allAssociationDestinations(model, curr_atomic, "DEVS/DEVSBlockToPort")
+        while (read_nr_out(all_ports) > 0):
+            curr_port = set_pop(all_ports)
+            curr_port_name = cast_value(read_attribute(model, curr_port, "name"))
+            curr_port_type = read_type(model, curr_port)
+            if (curr_port_type == "DEVS/InputPort"):
+                model_rep = model_rep + curr_port_name + ": self.addInPort(" + curr_port_name + ")"
+            if (curr_port_type == "DEVS/OutputPort"):
+                model_rep = model_rep + curr_port_name + ": self.addOutPort(" + curr_port_name + ")"
+            if (read_nr_out(all_ports) > 0):
+                model_rep = model_rep + ", "
+        model_rep = model_rep + "}\n"
+        model_rep = model_rep + "\tdef initialState(self):\n" + cast_string(read_attribute(model, curr_atomic, "initialState")) + "\n"
+        model_rep = model_rep + "\tdef timeAdvance(self):\n" + cast_string(read_attribute(model, curr_atomic, "timeAdvance")) + "\n"
+        model_rep = model_rep + "\tdef outputFnc(self):\n" + cast_string(read_attribute(model, curr_atomic, "outputFnc")) + "\n"
+        model_rep = model_rep + "\tdef intTransition(self):\n" + cast_string(read_attribute(model, curr_atomic, "intTransition")) + "\n"
+        model_rep = model_rep + "\tdef extTransition(self, my_inputs):\n" + cast_string(read_attribute(model, curr_atomic, "extTransition")) + "\n"
+
+    all_coupleds = allInstances(model, "DEVS/CoupledDEVSBlock")
+    while (read_nr_out(all_coupleds) > 0):
+        curr_coupled = set_pop(all_coupleds)
+        model_rep = model_rep + "class " + cast_string(read_attribute(model, curr_coupled, "name")) + "(CoupledDEVS):\n"
+        model_rep = model_rep + "\tdef __init__(self, name=" + cast_value(read_attribute(model, curr_coupled, "name")) + "):\n"
+        model_rep = model_rep + "\t\tCoupledDEVS.__init__(self, name)\n"
+        model_rep = model_rep + "\t\tself.my_ports = {"
+        all_ports = allAssociationDestinations(model, curr_coupled, "DEVS/DEVSBlockToPort")
+        while (read_nr_out(all_ports) > 0):
+            curr_port = set_pop(all_ports)
+            curr_port_name = cast_value(read_attribute(model, curr_port, "name"))
+            curr_port_type = read_type(model, curr_port)
+            log(curr_port_type)
+            if (curr_port_type == "DEVS/InputPort"):
+                model_rep = model_rep + curr_port_name + ": self.addInPort(" + curr_port_name + ")"
+            if (curr_port_type == "DEVS/OutputPort"):
+                model_rep = model_rep + curr_port_name + ": self.addOutPort(" + curr_port_name + ")"
+            if (read_nr_out(all_ports) > 0):
+                model_rep = model_rep + ", "
+        model_rep = model_rep + "}\n"
+        model_rep = model_rep + "\t\tself.submodels = {"
+        all_submodels = allAssociationDestinations(model, curr_coupled, "DEVS/SubModel")
+        while (read_nr_out(all_submodels) > 0):
+            curr_submodel = set_pop(all_submodels)
+            curr_submodel_name = cast_value(read_attribute(model, curr_submodel, "name"))
+            curr_submodel_type = cast_string(read_attribute(model, curr_submodel, "type"))
+			curr_submodel_parameters = cast_string(read_attribute(model, curr_submodel, "parameters"))
+            model_rep = model_rep + curr_submodel_name + ": self.addSubModel(" + curr_submodel_type + "(" + curr_submodel_name + ", " + curr_submodel_parameters + ")" + ")"
+            if (read_nr_out(all_submodels) > 0):
+                model_rep = model_rep + ", "
+        model_rep = model_rep + "}\n"
+        all_ports = allAssociationDestinations(model, curr_coupled, "DEVS/DEVSBlockToPort")
+        while (read_nr_out(all_ports) > 0):
+            curr_port = set_pop(all_ports)
+            out_channels = allAssociationDestinations(model, curr_port, "DEVS/Channel")
+            while (read_nr_out(out_channels) > 0):
+                curr_channel = set_pop(out_channels)
+                parent = set_pop(allAssociationOrigins(model, curr_channel, "DEVS/DEVSInstanceToPort"))
+                model_rep = model_rep + "\t\tself.connectPorts(self.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"
+        all_submodels = allAssociationDestinations(model, curr_coupled, "DEVS/SubModel")
+        while (read_nr_out(all_submodels) > 0):
+            curr_submodel = set_pop(all_submodels)
+            curr_submodel_name = cast_value(read_attribute(model, curr_submodel, "name"))
+            log(curr_submodel_name)
+            all_ports = allAssociationDestinations(model, curr_submodel, "DEVS/DEVSInstanceToPort")
+            while (read_nr_out(all_ports) > 0):
+                curr_port = set_pop(all_ports)
+                out_channels = allAssociationDestinations(model, curr_port, "DEVS/Channel")
+                log(cast_value(read_nr_out(out_channels)))
+                while (read_nr_out(out_channels) > 0):
+                    curr_channel = set_pop(out_channels)
+                    possible_parent = allAssociationOrigins(model, curr_channel, "DEVS/DEVSInstanceToPort")
+                    if (read_nr_out(possible_parent) == 0):
+                        model_rep = model_rep + "\t\tself.connectPorts(self.submodels[" + curr_submodel_name + "].my_ports[" + cast_value(read_attribute(model, curr_port, "name")) + "], self.my_ports[" + cast_value(read_attribute(model, curr_channel, "name")) + "])\n"
+                    else:
+                        parent = set_pop(possible_parent)
+                        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
+	port = comm_connect("pypdevs_simulator")
+        
+    log("(PDEVS) task name = " + get_taskname())
+    log("(PDEVS) Sending model...")
+    comm_set(port, model_rep)
+    log("(PDEVS) " + port)
+
+	comm_set(port, "[\"simulate\"]")
+    
+    while (True):
+        if (comm_hasInput(port)):
+            log(cast_value(has_input()))
+            the_input = comm_get(port)
+            log("(PDEVS) Got input from simulator!")
+            log("(PDEVS) " + the_input)
+        sleep(0.05)
+
+	return True!

+ 181 - 88
models/WSC/PM_to_DEVS.mvc

@@ -18,17 +18,27 @@ Composite schedule {
                     String function value(model : Element, name : String, mapping : Element):
                     String function value(model : Element, name : String, mapping : Element):
                         return "ResourceHandler"!
                         return "ResourceHandler"!
                     $
                     $
+                value_parameters = $
+                    String function value(model : Element, name : String, mapping : Element):
+                        return "[]"!
+                    $
             }
             }
             Post_DEVS/InputPort post_resource_2 {
             Post_DEVS/InputPort post_resource_2 {
                 label = "2"
                 label = "2"
-                name = "resource_in"
+                value_name = $
+                    String function value(model : Element, name : String, mapping : Element):
+                        return "resource_in"!
+                    $
             }
             }
             Post_DEVS/DEVSInstanceToPort (post_resource_1, post_resource_2) {
             Post_DEVS/DEVSInstanceToPort (post_resource_1, post_resource_2) {
                 label = "3"
                 label = "3"
             }
             }
             Post_DEVS/OutputPort post_resource_3 {
             Post_DEVS/OutputPort post_resource_3 {
                 label = "4"
                 label = "4"
-                name = "resource_out"
+                value_name = $
+                    String function value(model : Element, name : String, mapping : Element):
+                        return "resource_out"!
+                    $
             }
             }
             Post_DEVS/DEVSInstanceToPort (post_resource_1, post_resource_3) {
             Post_DEVS/DEVSInstanceToPort (post_resource_1, post_resource_3) {
                 label = "5"
                 label = "5"
@@ -57,30 +67,37 @@ Composite schedule {
                     String function value(model : Element, name : String, mapping : Element):
                     String function value(model : Element, name : String, mapping : Element):
                         return "Initial"!
                         return "Initial"!
                     $
                     $
+                value_parameters = $
+                    String function value(model : Element, name : String, mapping : Element):
+                        return "[]"!
+                    $
             }
             }
             Post_Trace (post_init_0, post_init_1) {
             Post_Trace (post_init_0, post_init_1) {
-                label = "1"
+                label = "2"
             }
             }
 
 
             Post_DEVS/OutputPort post_init_2 {
             Post_DEVS/OutputPort post_init_2 {
-                label = "2"
-                name = "control_out"
+                label = "3"
+                value_name = $
+                    String function value(model : Element, name : String, mapping : Element):
+                        return "control_out"!
+                    $
             }
             }
             Post_DEVS/DEVSInstanceToPort (post_init_1, post_init_2) {
             Post_DEVS/DEVSInstanceToPort (post_init_1, post_init_2) {
-                label = "3"
+                label = "4"
             }
             }
         }
         }
     }
     }
     
     
     {Contains} ForAll finish {
     {Contains} ForAll finish {
         LHS {
         LHS {
-            Pre_PM/Initial pre_finish_0 {
+            Pre_PM/Finish pre_finish_0 {
                 label = "0"
                 label = "0"
             }
             }
         }
         }
 
 
         RHS {
         RHS {
-            Post_PM/Initial post_finish_0 {
+            Post_PM/Finish post_finish_0 {
                 label = "0"
                 label = "0"
             }
             }
             Post_DEVS/DEVSInstance post_finish_1 {
             Post_DEVS/DEVSInstance post_finish_1 {
@@ -93,6 +110,10 @@ Composite schedule {
                     String function value(model : Element, name : String, mapping : Element):
                     String function value(model : Element, name : String, mapping : Element):
                         return "Finish"!
                         return "Finish"!
                     $
                     $
+                value_parameters = $
+                    String function value(model : Element, name : String, mapping : Element):
+                        return "[]"!
+                    $
             }
             }
             Post_Trace (post_finish_0, post_finish_1) {
             Post_Trace (post_finish_0, post_finish_1) {
                 label = "2"
                 label = "2"
@@ -100,7 +121,10 @@ Composite schedule {
 
 
             Post_DEVS/InputPort post_finish_2 {
             Post_DEVS/InputPort post_finish_2 {
                 label = "3"
                 label = "3"
-                name = "control_in"
+                value_name = $
+                    String function value(model : Element, name : String, mapping : Element):
+                        return "control_in"!
+                    $
             }
             }
             Post_DEVS/DEVSInstanceToPort (post_finish_1, post_finish_2) {
             Post_DEVS/DEVSInstanceToPort (post_finish_1, post_finish_2) {
                 label = "4"
                 label = "4"
@@ -110,13 +134,13 @@ Composite schedule {
     
     
     {Contains} ForAll activity {
     {Contains} ForAll activity {
         LHS {
         LHS {
-            Pre_PM/Initial pre_activity_0 {
+            Pre_PM/Activity pre_activity_0 {
                 label = "0"
                 label = "0"
             }
             }
         }
         }
 
 
         RHS {
         RHS {
-            Post_PM/Initial post_activity_0 {
+            Post_PM/Activity post_activity_0 {
                 label = "0"
                 label = "0"
             }
             }
             Post_DEVS/DEVSInstance post_activity_1 {
             Post_DEVS/DEVSInstance post_activity_1 {
@@ -135,52 +159,64 @@ Composite schedule {
                     $
                     $
             }
             }
             Post_Trace (post_activity_0, post_activity_1) {
             Post_Trace (post_activity_0, post_activity_1) {
-                label = "1"
+                label = "2"
             }
             }
 
 
             Post_DEVS/InputPort post_activity_2 {
             Post_DEVS/InputPort post_activity_2 {
-                label = "2"
-                name = "resource_in"
+                label = "3"
+                value_name = $
+                    String function value(model : Element, name : String, mapping : Element):
+                        return "resource_in"!
+                    $
             }
             }
             Post_DEVS/DEVSInstanceToPort (post_activity_1, post_activity_2) {
             Post_DEVS/DEVSInstanceToPort (post_activity_1, post_activity_2) {
-                label = "2"
+                label = "4"
             }
             }
 
 
             Post_DEVS/OutputPort post_activity_3 {
             Post_DEVS/OutputPort post_activity_3 {
-                label = "3"
-                name = "resource_out"
+                label = "5"
+                value_name = $
+                    String function value(model : Element, name : String, mapping : Element):
+                        return "resource_out"!
+                    $
             }
             }
             Post_DEVS/DEVSInstanceToPort (post_activity_1, post_activity_3) {
             Post_DEVS/DEVSInstanceToPort (post_activity_1, post_activity_3) {
-                label = "4"
+                label = "6"
             }
             }
 
 
             Post_DEVS/InputPort post_activity_4 {
             Post_DEVS/InputPort post_activity_4 {
-                label = "5"
-                name = "control_in"
+                label = "7"
+                value_name = $
+                    String function value(model : Element, name : String, mapping : Element):
+                        return "control_in"!
+                    $
             }
             }
             Post_DEVS/DEVSInstanceToPort (post_activity_1, post_activity_4) {
             Post_DEVS/DEVSInstanceToPort (post_activity_1, post_activity_4) {
-                label = "6"
+                label = "8"
             }
             }
 
 
             Post_DEVS/OutputPort post_activity_5 {
             Post_DEVS/OutputPort post_activity_5 {
-                label = "7"
-                name = "control_out"
+                label = "9"
+                value_name = $
+                    String function value(model : Element, name : String, mapping : Element):
+                        return "control_out"!
+                    $
             }
             }
             Post_DEVS/DEVSInstanceToPort (post_activity_1, post_activity_5) {
             Post_DEVS/DEVSInstanceToPort (post_activity_1, post_activity_5) {
-                label = "8"
+                label = "10"
             }
             }
         }
         }
     }
     }
 
 
     {Contains} ForAll parallelsplit {
     {Contains} ForAll parallelsplit {
         LHS {
         LHS {
-            Pre_PM/Initial pre_split_0 {
+            Pre_PM/ParallelSplit pre_split_0 {
                 label = "0"
                 label = "0"
             }
             }
         }
         }
 
 
         RHS {
         RHS {
-            Post_PM/Initial post_split_0 {
+            Post_PM/ParallelSplit post_split_0 {
                 label = "0"
                 label = "0"
             }
             }
             Post_DEVS/DEVSInstance post_split_1 {
             Post_DEVS/DEVSInstance post_split_1 {
@@ -193,6 +229,10 @@ Composite schedule {
                     String function value(model : Element, name : String, mapping : Element):
                     String function value(model : Element, name : String, mapping : Element):
                         return "ParallelSplit"!
                         return "ParallelSplit"!
                     $
                     $
+                value_parameters = $
+                    String function value(model : Element, name : String, mapping : Element):
+                        return "[]"!
+                    $
             }
             }
             Post_Trace (post_split_0, post_split_1) {
             Post_Trace (post_split_0, post_split_1) {
                 label = "2"
                 label = "2"
@@ -200,7 +240,10 @@ Composite schedule {
 
 
             Post_DEVS/InputPort post_split_2 {
             Post_DEVS/InputPort post_split_2 {
                 label = "3"
                 label = "3"
-                name = "control_in"
+                value_name = $
+                    String function value(model : Element, name : String, mapping : Element):
+                        return "control_in"!
+                    $
             }
             }
             Post_DEVS/DEVSInstanceToPort (post_split_1, post_split_2) {
             Post_DEVS/DEVSInstanceToPort (post_split_1, post_split_2) {
                 label = "4"
                 label = "4"
@@ -208,7 +251,10 @@ Composite schedule {
 
 
             Post_DEVS/OutputPort post_split_3 {
             Post_DEVS/OutputPort post_split_3 {
                 label = "5"
                 label = "5"
-                name = "control_out"
+                value_name = $
+                    String function value(model : Element, name : String, mapping : Element):
+                        return "control_out"!
+                    $
             }
             }
             Post_DEVS/DEVSInstanceToPort (post_split_1, post_split_3) {
             Post_DEVS/DEVSInstanceToPort (post_split_1, post_split_3) {
                 label = "6"
                 label = "6"
@@ -218,13 +264,13 @@ Composite schedule {
 
 
     {Contains} ForAll synchronization {
     {Contains} ForAll synchronization {
         LHS {
         LHS {
-            Pre_PM/Initial pre_sync_0 {
+            Pre_PM/Synchronization pre_sync_0 {
                 label = "0"
                 label = "0"
             }
             }
         }
         }
 
 
         RHS {
         RHS {
-            Post_PM/Initial post_sync_0 {
+            Post_PM/Synchronization post_sync_0 {
                 label = "0"
                 label = "0"
             }
             }
             Post_DEVS/DEVSInstance post_sync_1 {
             Post_DEVS/DEVSInstance post_sync_1 {
@@ -237,6 +283,10 @@ Composite schedule {
                     String function value(model : Element, name : String, mapping : Element):
                     String function value(model : Element, name : String, mapping : Element):
                         return "Synchronization"!
                         return "Synchronization"!
                     $
                     $
+                value_parameters = $
+                    String function value(model : Element, name : String, mapping : Element):
+                        return "[]"!
+                    $
             }
             }
             Post_Trace (post_sync_0, post_sync_1) {
             Post_Trace (post_sync_0, post_sync_1) {
                 label = "2"
                 label = "2"
@@ -244,7 +294,10 @@ Composite schedule {
 
 
             Post_DEVS/InputPort post_sync_2 {
             Post_DEVS/InputPort post_sync_2 {
                 label = "3"
                 label = "3"
-                name = "control_in"
+                value_name = $
+                    String function value(model : Element, name : String, mapping : Element):
+                        return "control_in"!
+                    $
             }
             }
             Post_DEVS/DEVSInstanceToPort (post_sync_1, post_sync_2) {
             Post_DEVS/DEVSInstanceToPort (post_sync_1, post_sync_2) {
                 label = "4"
                 label = "4"
@@ -252,7 +305,10 @@ Composite schedule {
 
 
             Post_DEVS/OutputPort post_sync_3 {
             Post_DEVS/OutputPort post_sync_3 {
                 label = "5"
                 label = "5"
-                name = "control_out"
+                value_name = $
+                    String function value(model : Element, name : String, mapping : Element):
+                        return "control_out"!
+                    $
             }
             }
             Post_DEVS/DEVSInstanceToPort (post_sync_1, post_sync_3) {
             Post_DEVS/DEVSInstanceToPort (post_sync_1, post_sync_3) {
                 label = "6"
                 label = "6"
@@ -262,13 +318,13 @@ Composite schedule {
 
 
     {Contains} ForAll xor {
     {Contains} ForAll xor {
         LHS {
         LHS {
-            Pre_PM/Initial pre_xor_0 {
+            Pre_PM/ExclusiveChoice pre_xor_0 {
                 label = "0"
                 label = "0"
             }
             }
         }
         }
 
 
         RHS {
         RHS {
-            Post_PM/Initial post_xor_0 {
+            Post_PM/ExclusiveChoice post_xor_0 {
                 label = "0"
                 label = "0"
             }
             }
             Post_DEVS/DEVSInstance post_xor_1 {
             Post_DEVS/DEVSInstance post_xor_1 {
@@ -281,6 +337,10 @@ Composite schedule {
                     String function value(model : Element, name : String, mapping : Element):
                     String function value(model : Element, name : String, mapping : Element):
                         return "ExclusiveChoice"!
                         return "ExclusiveChoice"!
                     $
                     $
+                value_parameters = $
+                    String function value(model : Element, name : String, mapping : Element):
+                        return "[]"!
+                    $
             }
             }
             Post_Trace (post_xor_0, post_xor_1) {
             Post_Trace (post_xor_0, post_xor_1) {
                 label = "2"
                 label = "2"
@@ -288,7 +348,10 @@ Composite schedule {
 
 
             Post_DEVS/InputPort post_xor_2 {
             Post_DEVS/InputPort post_xor_2 {
                 label = "3"
                 label = "3"
-                name = "control_in"
+                value_name = $
+                    String function value(model : Element, name : String, mapping : Element):
+                        return "control_in"!
+                    $
             }
             }
             Post_DEVS/DEVSInstanceToPort (post_xor_1, post_xor_2) {
             Post_DEVS/DEVSInstanceToPort (post_xor_1, post_xor_2) {
                 label = "4"
                 label = "4"
@@ -296,14 +359,20 @@ Composite schedule {
 
 
             Post_DEVS/OutputPort post_xor_3 {
             Post_DEVS/OutputPort post_xor_3 {
                 label = "5"
                 label = "5"
-                name = "control_out1"
+                value_name = $
+                    String function value(model : Element, name : String, mapping : Element):
+                        return "control_out1"!
+                    $
             }
             }
             Post_DEVS/DEVSInstanceToPort (post_xor_1, post_xor_3) {
             Post_DEVS/DEVSInstanceToPort (post_xor_1, post_xor_3) {
                 label = "6"
                 label = "6"
             }
             }
             Post_DEVS/OutputPort post_xor_4 {
             Post_DEVS/OutputPort post_xor_4 {
                 label = "7"
                 label = "7"
-                name = "control_out2"
+                value_name = $
+                    String function value(model : Element, name : String, mapping : Element):
+                        return "control_out2"!
+                    $
             }
             }
             Post_DEVS/DEVSInstanceToPort (post_xor_1, post_xor_4) {
             Post_DEVS/DEVSInstanceToPort (post_xor_1, post_xor_4) {
                 label = "8"
                 label = "8"
@@ -313,13 +382,13 @@ Composite schedule {
 
 
     {Contains} ForAll merge {
     {Contains} ForAll merge {
         LHS {
         LHS {
-            Pre_PM/Initial pre_merge_0 {
+            Pre_PM/SimpleMerge pre_merge_0 {
                 label = "0"
                 label = "0"
             }
             }
         }
         }
 
 
         RHS {
         RHS {
-            Post_PM/Initial post_merge_0 {
+            Post_PM/SimpleMerge post_merge_0 {
                 label = "0"
                 label = "0"
             }
             }
             Post_DEVS/DEVSInstance post_merge_1 {
             Post_DEVS/DEVSInstance post_merge_1 {
@@ -332,6 +401,10 @@ Composite schedule {
                     String function value(model : Element, name : String, mapping : Element):
                     String function value(model : Element, name : String, mapping : Element):
                         return "SimpleMerge"!
                         return "SimpleMerge"!
                     $
                     $
+                value_parameters = $
+                    String function value(model : Element, name : String, mapping : Element):
+                        return "[]"!
+                    $
             }
             }
             Post_Trace (post_merge_0, post_merge_1) {
             Post_Trace (post_merge_0, post_merge_1) {
                 label = "2"
                 label = "2"
@@ -339,7 +412,10 @@ Composite schedule {
 
 
             Post_DEVS/InputPort post_merge_2 {
             Post_DEVS/InputPort post_merge_2 {
                 label = "3"
                 label = "3"
-                name = "control_in"
+                value_name = $
+                    String function value(model : Element, name : String, mapping : Element):
+                        return "control_in"!
+                    $
             }
             }
             Post_DEVS/DEVSInstanceToPort (post_merge_1, post_merge_2) {
             Post_DEVS/DEVSInstanceToPort (post_merge_1, post_merge_2) {
                 label = "4"
                 label = "4"
@@ -347,7 +423,10 @@ Composite schedule {
 
 
             Post_DEVS/OutputPort post_merge_3 {
             Post_DEVS/OutputPort post_merge_3 {
                 label = "5"
                 label = "5"
-                name = "control_out"
+                value_name = $
+                    String function value(model : Element, name : String, mapping : Element):
+                        return "control_out"!
+                    $
             }
             }
             Post_DEVS/DEVSInstanceToPort (post_merge_1, post_merge_3) {
             Post_DEVS/DEVSInstanceToPort (post_merge_1, post_merge_3) {
                 label = "6"
                 label = "6"
@@ -357,13 +436,13 @@ Composite schedule {
 
 
     {Contains} ForAll multi {
     {Contains} ForAll multi {
         LHS {
         LHS {
-            Pre_PM/Initial pre_multi_0 {
+            Pre_PM/MultiInstance pre_multi_0 {
                 label = "0"
                 label = "0"
             }
             }
         }
         }
 
 
         RHS {
         RHS {
-            Post_PM/Initial post_multi_0 {
+            Post_PM/MultiInstance post_multi_0 {
                 label = "0"
                 label = "0"
             }
             }
             Post_DEVS/DEVSInstance post_multi_1 {
             Post_DEVS/DEVSInstance post_multi_1 {
@@ -387,7 +466,10 @@ Composite schedule {
 
 
             Post_DEVS/InputPort post_multi_2 {
             Post_DEVS/InputPort post_multi_2 {
                 label = "3"
                 label = "3"
-                name = "resource_in"
+                value_name = $
+                    String function value(model : Element, name : String, mapping : Element):
+                        return "resource_in"!
+                    $
             }
             }
             Post_DEVS/DEVSInstanceToPort (post_multi_1, post_multi_2) {
             Post_DEVS/DEVSInstanceToPort (post_multi_1, post_multi_2) {
                 label = "4"
                 label = "4"
@@ -395,7 +477,10 @@ Composite schedule {
 
 
             Post_DEVS/OutputPort post_multi_3 {
             Post_DEVS/OutputPort post_multi_3 {
                 label = "5"
                 label = "5"
-                name = "resource_out"
+                value_name = $
+                    String function value(model : Element, name : String, mapping : Element):
+                        return "resource_out"!
+                    $
             }
             }
             Post_DEVS/DEVSInstanceToPort (post_multi_1, post_multi_3) {
             Post_DEVS/DEVSInstanceToPort (post_multi_1, post_multi_3) {
                 label = "6"
                 label = "6"
@@ -403,7 +488,10 @@ Composite schedule {
 
 
             Post_DEVS/InputPort post_multi_4 {
             Post_DEVS/InputPort post_multi_4 {
                 label = "7"
                 label = "7"
-                name = "control_in"
+                value_name = $
+                    String function value(model : Element, name : String, mapping : Element):
+                        return "control_in"!
+                    $
             }
             }
             Post_DEVS/DEVSInstanceToPort (post_multi_1, post_multi_4) {
             Post_DEVS/DEVSInstanceToPort (post_multi_1, post_multi_4) {
                 label = "8"
                 label = "8"
@@ -411,7 +499,10 @@ Composite schedule {
 
 
             Post_DEVS/OutputPort post_multi_5 {
             Post_DEVS/OutputPort post_multi_5 {
                 label = "9"
                 label = "9"
-                name = "control_out"
+                value_name = $
+                    String function value(model : Element, name : String, mapping : Element):
+                        return "control_out"!
+                    $
             }
             }
             Post_DEVS/DEVSInstanceToPort (post_multi_1, post_multi_5) {
             Post_DEVS/DEVSInstanceToPort (post_multi_1, post_multi_5) {
                 label = "10"
                 label = "10"
@@ -423,16 +514,16 @@ Composite schedule {
         LHS {
         LHS {
             Pre_DEVS/DEVSInstance pre_mrt_0 {
             Pre_DEVS/DEVSInstance pre_mrt_0 {
                 label = "0"
                 label = "0"
-                constraint_name = $
-                    Boolean function constraint(model : Element, name : String):
-                        return (cast_string(read_attribute(model, name, "type")) == "ResourceHandler")!
+                constraint_type = $
+                    Boolean function constraint(value : String):
+                        return value == "ResourceHandler"!
                     $
                     $
             }
             }
             Pre_DEVS/Port pre_mrt_1 {
             Pre_DEVS/Port pre_mrt_1 {
                 label = "1"
                 label = "1"
                 constraint_name = $
                 constraint_name = $
-                    Boolean function constraint(model : Element, name : String):
-                        return (cast_string(read_attribute(model, name, "type")) == "resource_in")!
+                    Boolean function constraint(value : String):
+                        return value == "resource_in"!
                     $
                     $
             }
             }
             Pre_DEVS/DEVSInstanceToPort (pre_mrt_0, pre_mrt_1) {
             Pre_DEVS/DEVSInstanceToPort (pre_mrt_0, pre_mrt_1) {
@@ -441,16 +532,16 @@ Composite schedule {
 
 
             Pre_DEVS/DEVSInstance pre_mrt_2 {
             Pre_DEVS/DEVSInstance pre_mrt_2 {
                 label = "3"
                 label = "3"
-                constraint_name = $
-                    Boolean function constraint(model : Element, name : String):
-                        return (cast_string(read_attribute(model, name, "type")) != "ResourceHandler")!
+                constraint_type = $
+                    Boolean function constraint(value : String):
+                        return value != "ResourceHandler"!
                     $
                     $
             }
             }
             Pre_DEVS/Port pre_mrt_3 {
             Pre_DEVS/Port pre_mrt_3 {
                 label = "4"
                 label = "4"
                 constraint_name = $
                 constraint_name = $
-                    Boolean function constraint(model : Element, name : String):
-                        return (cast_string(read_attribute(model, name, "type")) == "resource_out")!
+                    Boolean function constraint(value : String):
+                        return value == "resource_out"!
                     $
                     $
             }
             }
             Pre_DEVS/DEVSInstanceToPort (pre_mrt_2, pre_mrt_3) {
             Pre_DEVS/DEVSInstanceToPort (pre_mrt_2, pre_mrt_3) {
@@ -489,16 +580,16 @@ Composite schedule {
         LHS {
         LHS {
             Pre_DEVS/DEVSInstance pre_mrf_0 {
             Pre_DEVS/DEVSInstance pre_mrf_0 {
                 label = "0"
                 label = "0"
-                constraint_name = $
-                    Boolean function constraint(model : Element, name : String):
-                        return (cast_string(read_attribute(model, name, "type")) == "ResourceHandler")!
+                constraint_type = $
+                    Boolean function constraint(value : String):
+                        return value == "ResourceHandler"!
                     $
                     $
             }
             }
             Pre_DEVS/Port pre_mrf_1 {
             Pre_DEVS/Port pre_mrf_1 {
                 label = "1"
                 label = "1"
                 constraint_name = $
                 constraint_name = $
-                    Boolean function constraint(model : Element, name : String):
-                        return (cast_string(read_attribute(model, name, "type")) == "resource_out")!
+                    Boolean function constraint(value : String):
+                        return value == "resource_out"!
                     $
                     $
             }
             }
             Pre_DEVS/DEVSInstanceToPort (pre_mrf_0, pre_mrf_1) {
             Pre_DEVS/DEVSInstanceToPort (pre_mrf_0, pre_mrf_1) {
@@ -507,16 +598,16 @@ Composite schedule {
 
 
             Pre_DEVS/DEVSInstance pre_mrf_2 {
             Pre_DEVS/DEVSInstance pre_mrf_2 {
                 label = "3"
                 label = "3"
-                constraint_name = $
-                    Boolean function constraint(model : Element, name : String):
-                        return (cast_string(read_attribute(model, name, "type")) != "ResourceHandler")!
+                constraint_type = $
+                    Boolean function constraint(value : String):
+                        return value != "ResourceHandler"!
                     $
                     $
             }
             }
             Pre_DEVS/Port pre_mrf_3 {
             Pre_DEVS/Port pre_mrf_3 {
                 label = "4"
                 label = "4"
                 constraint_name = $
                 constraint_name = $
-                    Boolean function constraint(model : Element, name : String):
-                        return (cast_string(read_attribute(model, name, "type")) == "resource_in")!
+                    Boolean function constraint(value : String):
+                        return value == "resource_in"!
                     $
                     $
             }
             }
             Pre_DEVS/DEVSInstanceToPort (pre_mrf_2, pre_mrf_3) {
             Pre_DEVS/DEVSInstanceToPort (pre_mrf_2, pre_mrf_3) {
@@ -559,8 +650,8 @@ Composite schedule {
             Pre_DEVS/Port pre_map_1 {
             Pre_DEVS/Port pre_map_1 {
                 label = "1"
                 label = "1"
                 constraint_name = $
                 constraint_name = $
-                    Boolean function constraint(model : Element, name : String):
-                        return (cast_string(read_attribute(model, name, "type")) == "control_out")!
+                    Boolean function constraint(value : String):
+                        return value == "control_out"!
                     $
                     $
             }
             }
             Pre_DEVS/DEVSInstanceToPort (pre_map_0, pre_map_1) {
             Pre_DEVS/DEVSInstanceToPort (pre_map_0, pre_map_1) {
@@ -573,8 +664,8 @@ Composite schedule {
             Pre_DEVS/Port pre_map_3 {
             Pre_DEVS/Port pre_map_3 {
                 label = "4"
                 label = "4"
                 constraint_name = $
                 constraint_name = $
-                    Boolean function constraint(model : Element, name : String):
-                        return (cast_string(read_attribute(model, name, "type")) == "control_in")!
+                    Boolean function constraint(value : String):
+                        return value == "control_in"!
                     $
                     $
             }
             }
             Pre_DEVS/DEVSInstanceToPort (pre_map_2, pre_map_3) {
             Pre_DEVS/DEVSInstanceToPort (pre_map_2, pre_map_3) {
@@ -589,13 +680,12 @@ Composite schedule {
             Pre_PM/ProcessNode pre_map_5 {
             Pre_PM/ProcessNode pre_map_5 {
                 label = "8"
                 label = "8"
             }
             }
-            Pre_Trace (pre_map_5, pre_map_1) {
+            Pre_Trace (pre_map_5, pre_map_2) {
                 label = "9"
                 label = "9"
             }
             }
             Pre_PM/Next (pre_map_4, pre_map_5) {
             Pre_PM/Next (pre_map_4, pre_map_5) {
                 label = "10"
                 label = "10"
             }
             }
-
         }
         }
     
     
         RHS {
         RHS {
@@ -628,7 +718,7 @@ Composite schedule {
             Post_PM/ProcessNode post_map_5 {
             Post_PM/ProcessNode post_map_5 {
                 label = "8"
                 label = "8"
             }
             }
-            Post_Trace (post_map_5, post_map_1) {
+            Post_Trace (post_map_5, post_map_2) {
                 label = "9"
                 label = "9"
             }
             }
             Post_PM/Next (post_map_4, post_map_5) {
             Post_PM/Next (post_map_4, post_map_5) {
@@ -648,8 +738,8 @@ Composite schedule {
             Pre_DEVS/Port pre_mdt_1 {
             Pre_DEVS/Port pre_mdt_1 {
                 label = "1"
                 label = "1"
                 constraint_name = $
                 constraint_name = $
-                    Boolean function constraint(model : Element, name : String):
-                        return (cast_string(read_attribute(model, name, "type")) == "control_out1")!
+                    Boolean function constraint(value : String):
+                        return value == "control_out1"!
                     $
                     $
             }
             }
             Pre_DEVS/DEVSInstanceToPort (pre_mdt_0, pre_mdt_1) {
             Pre_DEVS/DEVSInstanceToPort (pre_mdt_0, pre_mdt_1) {
@@ -662,8 +752,8 @@ Composite schedule {
             Pre_DEVS/Port pre_mdt_3 {
             Pre_DEVS/Port pre_mdt_3 {
                 label = "4"
                 label = "4"
                 constraint_name = $
                 constraint_name = $
-                    Boolean function constraint(model : Element, name : String):
-                        return (cast_string(read_attribute(model, name, "type")) == "control_in")!
+                    Boolean function constraint(value : String):
+                        return value == "control_in"!
                     $
                     $
             }
             }
             Pre_DEVS/DEVSInstanceToPort (pre_mdt_2, pre_mdt_3) {
             Pre_DEVS/DEVSInstanceToPort (pre_mdt_2, pre_mdt_3) {
@@ -678,7 +768,7 @@ Composite schedule {
             Pre_PM/ProcessNode pre_mdt_5 {
             Pre_PM/ProcessNode pre_mdt_5 {
                 label = "8"
                 label = "8"
             }
             }
-            Pre_Trace (pre_mdt_5, pre_mdt_1) {
+            Pre_Trace (pre_mdt_5, pre_mdt_2) {
                 label = "9"
                 label = "9"
             }
             }
             Pre_PM/DecisionTrue (pre_mdt_4, pre_mdt_5) {
             Pre_PM/DecisionTrue (pre_mdt_4, pre_mdt_5) {
@@ -717,7 +807,7 @@ Composite schedule {
             Post_PM/ProcessNode post_mdt_5 {
             Post_PM/ProcessNode post_mdt_5 {
                 label = "8"
                 label = "8"
             }
             }
-            Post_Trace (post_mdt_5, post_mdt_1) {
+            Post_Trace (post_mdt_5, post_mdt_2) {
                 label = "9"
                 label = "9"
             }
             }
             Post_PM/DecisionTrue (post_mdt_4, post_mdt_5) {
             Post_PM/DecisionTrue (post_mdt_4, post_mdt_5) {
@@ -737,8 +827,8 @@ Composite schedule {
             Pre_DEVS/Port pre_mdf_1 {
             Pre_DEVS/Port pre_mdf_1 {
                 label = "1"
                 label = "1"
                 constraint_name = $
                 constraint_name = $
-                    Boolean function constraint(model : Element, name : String):
-                        return (cast_string(read_attribute(model, name, "type")) == "control_out2")!
+                    Boolean function constraint(value : String):
+                        return value == "control_out2"!
                     $
                     $
             }
             }
             Pre_DEVS/DEVSInstanceToPort (pre_mdf_0, pre_mdf_1) {
             Pre_DEVS/DEVSInstanceToPort (pre_mdf_0, pre_mdf_1) {
@@ -751,8 +841,8 @@ Composite schedule {
             Pre_DEVS/Port pre_mdf_3 {
             Pre_DEVS/Port pre_mdf_3 {
                 label = "4"
                 label = "4"
                 constraint_name = $
                 constraint_name = $
-                    Boolean function constraint(model : Element, name : String):
-                        return (cast_string(read_attribute(model, name, "type")) == "control_in")!
+                    Boolean function constraint(value : String):
+                        return value == "control_in"!
                     $
                     $
             }
             }
             Pre_DEVS/DEVSInstanceToPort (pre_mdf_2, pre_mdf_3) {
             Pre_DEVS/DEVSInstanceToPort (pre_mdf_2, pre_mdf_3) {
@@ -767,7 +857,7 @@ Composite schedule {
             Pre_PM/ProcessNode pre_mdf_5 {
             Pre_PM/ProcessNode pre_mdf_5 {
                 label = "8"
                 label = "8"
             }
             }
-            Pre_Trace (pre_mdf_5, pre_mdf_1) {
+            Pre_Trace (pre_mdf_5, pre_mdf_2) {
                 label = "9"
                 label = "9"
             }
             }
             Pre_PM/DecisionFalse (pre_mdf_4, pre_mdf_5) {
             Pre_PM/DecisionFalse (pre_mdf_4, pre_mdf_5) {
@@ -805,7 +895,7 @@ Composite schedule {
             Post_PM/ProcessNode post_mdf_5 {
             Post_PM/ProcessNode post_mdf_5 {
                 label = "8"
                 label = "8"
             }
             }
-            Post_Trace (post_mdf_5, post_mdf_1) {
+            Post_Trace (post_mdf_5, post_mdf_2) {
                 label = "9"
                 label = "9"
             }
             }
             Post_PM/DecisionFalse (post_mdf_4, post_mdf_5) {
             Post_PM/DecisionFalse (post_mdf_4, post_mdf_5) {
@@ -820,8 +910,11 @@ Composite schedule {
 
 
 Initial (schedule, initial) {}
 Initial (schedule, initial) {}
 
 
-OnSuccess (initial, finish) {}
-OnFailure (initial, finish) {}
+OnSuccess (initial, add_resource_handler) {}
+OnFailure (initial, add_resource_handler) {}
+
+OnSuccess (add_resource_handler, finish) {}
+OnFailure (add_resource_handler, finish) {}
 
 
 OnSuccess (finish, activity) {}
 OnSuccess (finish, activity) {}
 OnFailure (finish, activity) {}
 OnFailure (finish, activity) {}

+ 2 - 2
models/WSC/pm.mvc

@@ -4,9 +4,9 @@ SimpleAttribute PythonCode {}
 
 
 Class ProcessNode {}
 Class ProcessNode {}
 
 
-Class Initial {}
+Class Initial : ProcessNode {}
 
 
-Class Finish {}
+Class Finish : ProcessNode {}
 
 
 Class Activity : ProcessNode {
 Class Activity : ProcessNode {
     distribution : PythonCode
     distribution : PythonCode

+ 1 - 1
models/WSC/pm_PM_to_DEVS.mvc

@@ -40,7 +40,7 @@ Data devs_model {
 }
 }
 
 
 Data metrics_model {
 Data metrics_model {
-    name = ""
+    name = "Metrics"
     type = "formalisms/Metrics/Metrics_MM"
     type = "formalisms/Metrics/Metrics_MM"
 }
 }
 
 

+ 2 - 2
models/WSC/pm_example.mvc

@@ -51,5 +51,5 @@ Next (simulate, sync) {}
 Next (check, sync) {}
 Next (check, sync) {}
 Next (sync, evaluate) {}
 Next (sync, evaluate) {}
 Next (evaluate, choice) {}
 Next (evaluate, choice) {}
-Next (choice, finish) {}
-Next (choice, merge) {}
+DecisionTrue (choice, finish) {}
+DecisionFalse (choice, merge) {}

+ 15 - 14
models/WSC/pm_library.mvc

@@ -1,8 +1,9 @@
 AtomicDEVSBlock ResourceHandler {
 AtomicDEVSBlock ResourceHandler {
     name = "ResourceHandler"
     name = "ResourceHandler"
 
 
-    parameters = 1
-    initialState = "self.state, self.elapsed = {'resources': parameters[0], 'queue': []}, 0.0"
+    initialState = """
+        self.state, self.elapsed = {'resources': self.parameters[0], 'queue': []}, 0.0
+    """
 
 
     timeAdvance = """
     timeAdvance = """
         if self.state['queue'] and self.state['resources']:
         if self.state['queue'] and self.state['resources']:
@@ -50,7 +51,6 @@ DEVSBlockToPort (ResourceHandler, rh_ro) {}
 
 
 AtomicDEVSBlock Activity {
 AtomicDEVSBlock Activity {
     name = "Activity"
     name = "Activity"
-    parameters = 2
     initialState = """
     initialState = """
         class ActivityState(object):
         class ActivityState(object):
             def __init__(self, name, distribution):
             def __init__(self, name, distribution):
@@ -66,7 +66,7 @@ AtomicDEVSBlock Activity {
             def random_sample(self):
             def random_sample(self):
                 return self.distribution(self.counter)
                 return self.distribution(self.counter)
 
 
-        self.state, self.elapsed = ActivityState(parameters[0], parameters[1]), 0.0
+        self.state, self.elapsed = ActivityState(self.parameters[0], self.parameters[1]), 0.0
         """
         """
     
     
     timeAdvance = """
     timeAdvance = """
@@ -128,9 +128,10 @@ DEVSBlockToPort (Activity, act_ro) {}
 
 
 AtomicDEVSBlock ParallelSplit {
 AtomicDEVSBlock ParallelSplit {
     name = "ParallelSplit"
     name = "ParallelSplit"
-    parameters = 0
 
 
-    initialState = "self.state, self.elapsed = False, 0.0"
+    initialState = """
+        self.state, self.elapsed = False, 0.0
+    """
 
 
     timeAdvance = """
     timeAdvance = """
         if self.state:
         if self.state:
@@ -165,9 +166,10 @@ DEVSBlockToPort (ParallelSplit, split_co) {}
 
 
 AtomicDEVSBlock Synchronization {
 AtomicDEVSBlock Synchronization {
     name = "Synchronization"
     name = "Synchronization"
-    parameters = 1
 
 
-    initialState = "self.state, self.elapsed = {'current': parameters[0], 'max': parameters[0]}, 0.0"
+    initialState = """
+        self.state, self.elapsed = {'current': self.parameters[0], 'max': self.parameters[0]}, 0.0
+    """
 
 
     timeAdvance = """
     timeAdvance = """
         if self.state['current'] == 0:
         if self.state['current'] == 0:
@@ -204,7 +206,6 @@ DEVSBlockToPort (Synchronization, syn_co) {}
 
 
 AtomicDEVSBlock ExclusiveChoice {
 AtomicDEVSBlock ExclusiveChoice {
     name = "ExclusiveChoice"
     name = "ExclusiveChoice"
-    parameters = 1
 
 
     initialState = """
     initialState = """
         class ExclusiveChoiceState(object):
         class ExclusiveChoiceState(object):
@@ -219,7 +220,7 @@ AtomicDEVSBlock ExclusiveChoice {
             def make_choice(self):
             def make_choice(self):
                 return self.distribution(self.counter)
                 return self.distribution(self.counter)
 
 
-        self.state, self.elapsed = ExclusiveChoiceState(parameters[0]), 0.0
+        self.state, self.elapsed = ExclusiveChoiceState(self.parameters[0]), 0.0
         """
         """
 
 
     timeAdvance = """
     timeAdvance = """
@@ -267,9 +268,10 @@ DEVSBlockToPort (ExclusiveChoice, xor_co2) {}
 
 
 AtomicDEVSBlock SimpleMerge {
 AtomicDEVSBlock SimpleMerge {
     name = "SimpleMerge"
     name = "SimpleMerge"
-    parameters = 0
 
 
-    initialState = "self.state, self.elapsed = False, 0.0"
+    initialState = """
+        self.state, self.elapsed = False, 0.0
+    """
 
 
     timeAdvance = """
     timeAdvance = """
         if self.state:
         if self.state:
@@ -304,7 +306,6 @@ DEVSBlockToPort (SimpleMerge, or_co) {}
 
 
 AtomicDEVSBlock MultiInstance {
 AtomicDEVSBlock MultiInstance {
     name = "MultiInstance"
     name = "MultiInstance"
-    parameters = 2
 
 
     initialState = """
     initialState = """
         class MultiInstanceState(object):
         class MultiInstanceState(object):
@@ -324,7 +325,7 @@ AtomicDEVSBlock MultiInstance {
             def task_time(self):
             def task_time(self):
                 return self.distribution(self.counter)
                 return self.distribution(self.counter)
 
 
-        self.state, self.elapsed = MultiInstanceState(parameters[0], parameters[1], parameters[2])
+        self.state, self.elapsed = MultiInstanceState(self.parameters[0], self.parameters[1], self.parameters[2])
         """
         """
 
 
     timeAdvance = """
     timeAdvance = """

+ 1 - 3
models/pm_translate.py

@@ -21,8 +21,6 @@ def traceability_pm_devs(model):
 transformation_add_MT({"PM": "formalisms/PM/PM_Extended_MM"}, {"DEVS": "formalisms/DEVS/DEVS_MM"}, "formalisms/PM/to_DEVS", open("models/WSC/PM_to_DEVS.mvc", 'r').read(), traceability_pm_devs)
 transformation_add_MT({"PM": "formalisms/PM/PM_Extended_MM"}, {"DEVS": "formalisms/DEVS/DEVS_MM"}, "formalisms/PM/to_DEVS", open("models/WSC/PM_to_DEVS.mvc", 'r').read(), traceability_pm_devs)
 
 
 transformation_add_AL({"model1": "formalisms/DEVS/DEVS_MM", "model2": "formalisms/DEVS/DEVS_MM"}, {"result": "formalisms/DEVS/DEVS_MM"}, "formalisms/DEVS/merge", open("models/WSC/DEVS_merge.alc", 'r').read())
 transformation_add_AL({"model1": "formalisms/DEVS/DEVS_MM", "model2": "formalisms/DEVS/DEVS_MM"}, {"result": "formalisms/DEVS/DEVS_MM"}, "formalisms/DEVS/merge", open("models/WSC/DEVS_merge.alc", 'r').read())
-"""
 transformation_add_AL({"DEVS": "formalisms/DEVS/DEVS_MM"}, {"metrics": "formalisms/Metrics/Metrics_MM"}, "formalisms/DEVS/simulate", open("models/WSC/DEVS_simulate.alc", 'r').read())
 transformation_add_AL({"DEVS": "formalisms/DEVS/DEVS_MM"}, {"metrics": "formalisms/Metrics/Metrics_MM"}, "formalisms/DEVS/simulate", open("models/WSC/DEVS_simulate.alc", 'r').read())
 
 
-pm_execute("models/PM/to_DEVS", {"PM": "models/PM/example_PM", "DEVS library": "models/DEVS/PM_library", "Graph": "models/Graph/graph"}, {})
-"""
+process_execute("models/PM/to_DEVS", {"PM": "models/PM/example_PM", "DEVS library": "models/DEVS/PM_library", "Metrics": "models/Metrics/metric"}, {})

+ 1 - 1
wrappers/modelverse_SCCD.py

@@ -1,7 +1,7 @@
 """
 """
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
 
-Date:   Tue May 15 09:18:35 2018
+Date:   Tue May 15 11:14:00 2018
 
 
 Model author: Yentl Van Tendeloo
 Model author: Yentl Van Tendeloo
 Model name:   MvK Server
 Model name:   MvK Server