include "primitives.alh" include "modelling.alh" include "object_operations.alh" Composite schedule { {Contains} Success success {} {Contains} Atomic add_resource_handler { LHS { Pre_DEVS/CoupledDEVSBlock pre_resource_999 { label = "root" } } RHS { Post_DEVS/DEVSInstance post_resource_1 { label = "1" value_name = $ String function value(model : Element, name : String, mapping : Element): return "resource_handler"! $ value_type = $ String function value(model : Element, name : String, mapping : Element): return "ResourceHandler"! $ value_parameters = $ String function value(model : Element, name : String, mapping : Element): return "[self.parameters[0]]"! $ } Post_DEVS/InputPort post_resource_2 { label = "2" value_name = $ String function value(model : Element, name : String, mapping : Element): return "resource_in"! $ } Post_DEVS/DEVSInstanceToPort (post_resource_1, post_resource_2) { label = "3" } Post_DEVS/OutputPort post_resource_3 { label = "4" value_name = $ String function value(model : Element, name : String, mapping : Element): return "resource_out"! $ } Post_DEVS/DEVSInstanceToPort (post_resource_1, post_resource_3) { label = "5" } Post_DEVS/CoupledDEVSBlock post_resource_999 { label = "root" } Post_DEVS/SubModel (post_resource_999, post_resource_1) { label = "submodel" } } } {Contains} Atomic root_model { LHS {} RHS { Post_DEVS/CoupledDEVSBlock post_root_0 { label = "0" value_name = $ String function value(model : Element, name : String, mapping : Element): return "Root"! $ } } } {Contains} ForAll initial { LHS { Pre_PM/Initial pre_init_0 { label = "0" } Pre_DEVS/CoupledDEVSBlock pre_init_999 { label = "root" } } RHS { Post_PM/Initial post_init_0 { label = "0" } Post_DEVS/DEVSInstance post_init_1 { label = "1" value_name = $ String function value(model : Element, name : String, mapping : Element): return read_attribute(model, mapping["0"], "name")! $ value_type = $ String function value(model : Element, name : String, mapping : Element): return "Initial"! $ value_parameters = $ String function value(model : Element, name : String, mapping : Element): return "[]"! $ } Post_Trace (post_init_0, post_init_1) { label = "2" } Post_DEVS/OutputPort post_init_2 { 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) { label = "4" } Post_DEVS/CoupledDEVSBlock post_init_999 { label = "root" } Post_DEVS/SubModel (post_init_999, post_init_1) { label = "submodel" } } } {Contains} ForAll finish { LHS { Pre_PM/Finish pre_finish_0 { label = "0" } Pre_DEVS/CoupledDEVSBlock pre_finish_999 { label = "root" } } RHS { Post_PM/Finish post_finish_0 { label = "0" } Post_DEVS/DEVSInstance post_finish_1 { label = "1" value_name = $ String function value(model : Element, name : String, mapping : Element): return read_attribute(model, mapping["0"], "name")! $ value_type = $ String function value(model : Element, name : String, mapping : Element): return "Finish"! $ value_parameters = $ String function value(model : Element, name : String, mapping : Element): return "[]"! $ } Post_Trace (post_finish_0, post_finish_1) { label = "2" } Post_DEVS/InputPort post_finish_2 { label = "3" value_name = $ String function value(model : Element, name : String, mapping : Element): return "control_in"! $ } Post_DEVS/DEVSInstanceToPort (post_finish_1, post_finish_2) { label = "4" } Post_DEVS/CoupledDEVSBlock post_finish_999 { label = "root" } Post_DEVS/SubModel (post_finish_999, post_finish_1) { label = "submodel" } } } {Contains} ForAll activity { LHS { Pre_PM/Activity pre_activity_0 { label = "0" } Pre_DEVS/CoupledDEVSBlock pre_activity_999 { label = "root" } } RHS { Post_PM/Activity post_activity_0 { label = "0" } Post_DEVS/DEVSInstance post_activity_1 { label = "1" value_name = $ String function value(model : Element, name : String, mapping : Element): return read_attribute(model, mapping["0"], "name")! $ value_type = $ String function value(model : Element, name : String, mapping : Element): return "Activity"! $ value_parameters = $ String function value(model : Element, name : String, mapping : Element): return "[" + cast_value(read_attribute(model, mapping["0"], "name")) + ", " + cast_string(read_attribute(model, mapping["0"], "distribution")) + "]"! $ } Post_Trace (post_activity_0, post_activity_1) { label = "2" } Post_DEVS/InputPort post_activity_2 { 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) { label = "4" } Post_DEVS/OutputPort post_activity_3 { 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) { label = "6" } Post_DEVS/InputPort post_activity_4 { 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) { label = "8" } Post_DEVS/OutputPort post_activity_5 { 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) { label = "10" } Post_DEVS/CoupledDEVSBlock post_activity_999 { label = "root" } Post_DEVS/SubModel (post_activity_999, post_activity_1) { label = "submodel" } } } {Contains} ForAll parallelsplit { LHS { Pre_PM/ParallelSplit pre_split_0 { label = "0" } Pre_DEVS/CoupledDEVSBlock pre_split_999 { label = "root" } } RHS { Post_PM/ParallelSplit post_split_0 { label = "0" } Post_DEVS/DEVSInstance post_split_1 { label = "1" value_name = $ String function value(model : Element, name : String, mapping : Element): return read_attribute(model, mapping["0"], "name")! $ value_type = $ String function value(model : Element, name : String, mapping : Element): return "ParallelSplit"! $ value_parameters = $ String function value(model : Element, name : String, mapping : Element): return "[]"! $ } Post_Trace (post_split_0, post_split_1) { label = "2" } Post_DEVS/InputPort post_split_2 { label = "3" value_name = $ String function value(model : Element, name : String, mapping : Element): return "control_in"! $ } Post_DEVS/DEVSInstanceToPort (post_split_1, post_split_2) { label = "4" } Post_DEVS/OutputPort post_split_3 { label = "5" value_name = $ String function value(model : Element, name : String, mapping : Element): return "control_out"! $ } Post_DEVS/DEVSInstanceToPort (post_split_1, post_split_3) { label = "6" } Post_DEVS/CoupledDEVSBlock post_split_999 { label = "root" } Post_DEVS/SubModel (post_split_999, post_split_1) { label = "submodel" } } } {Contains} ForAll synchronization { LHS { Pre_PM/Synchronization pre_sync_0 { label = "0" } Pre_DEVS/CoupledDEVSBlock pre_sync_999 { label = "root" } } RHS { Post_PM/Synchronization post_sync_0 { label = "0" } Post_DEVS/DEVSInstance post_sync_1 { label = "1" value_name = $ String function value(model : Element, name : String, mapping : Element): return read_attribute(model, mapping["0"], "name")! $ value_type = $ String function value(model : Element, name : String, mapping : Element): return "Synchronization"! $ value_parameters = $ String function value(model : Element, name : String, mapping : Element): return "[" + cast_string(set_len(allIncomingAssociationInstances(model, mapping["0"], "PM/Next"))) + "]"! $ } Post_Trace (post_sync_0, post_sync_1) { label = "2" } Post_DEVS/InputPort post_sync_2 { label = "3" value_name = $ String function value(model : Element, name : String, mapping : Element): return "control_in"! $ } Post_DEVS/DEVSInstanceToPort (post_sync_1, post_sync_2) { label = "4" } Post_DEVS/OutputPort post_sync_3 { label = "5" value_name = $ String function value(model : Element, name : String, mapping : Element): return "control_out"! $ } Post_DEVS/DEVSInstanceToPort (post_sync_1, post_sync_3) { label = "6" } Post_DEVS/CoupledDEVSBlock post_sync_999 { label = "root" } Post_DEVS/SubModel (post_sync_999, post_sync_1) { label = "submodel" } } } {Contains} ForAll xor { LHS { Pre_PM/ExclusiveChoice pre_xor_0 { label = "0" } Pre_DEVS/CoupledDEVSBlock pre_xor_999 { label = "root" } } RHS { Post_PM/ExclusiveChoice post_xor_0 { label = "0" } Post_DEVS/DEVSInstance post_xor_1 { label = "1" value_name = $ String function value(model : Element, name : String, mapping : Element): return read_attribute(model, mapping["0"], "name")! $ value_type = $ String function value(model : Element, name : String, mapping : Element): return "ExclusiveChoice"! $ value_parameters = $ String function value(model : Element, name : String, mapping : Element): return "[" + cast_string(read_attribute(model, mapping["0"], "distribution")) + "]"! $ } Post_Trace (post_xor_0, post_xor_1) { label = "2" } Post_DEVS/InputPort post_xor_2 { label = "3" value_name = $ String function value(model : Element, name : String, mapping : Element): return "control_in"! $ } Post_DEVS/DEVSInstanceToPort (post_xor_1, post_xor_2) { label = "4" } Post_DEVS/OutputPort post_xor_3 { label = "5" value_name = $ String function value(model : Element, name : String, mapping : Element): return "control_out1"! $ } Post_DEVS/DEVSInstanceToPort (post_xor_1, post_xor_3) { label = "6" } Post_DEVS/OutputPort post_xor_4 { label = "7" value_name = $ String function value(model : Element, name : String, mapping : Element): return "control_out2"! $ } Post_DEVS/DEVSInstanceToPort (post_xor_1, post_xor_4) { label = "8" } Post_DEVS/CoupledDEVSBlock post_xor_999 { label = "root" } Post_DEVS/SubModel (post_xor_999, post_xor_1) { label = "submodel" } } } {Contains} ForAll merge { LHS { Pre_PM/SimpleMerge pre_merge_0 { label = "0" } Pre_DEVS/CoupledDEVSBlock pre_merge_999 { label = "root" } } RHS { Post_PM/SimpleMerge post_merge_0 { label = "0" } Post_DEVS/DEVSInstance post_merge_1 { label = "1" value_name = $ String function value(model : Element, name : String, mapping : Element): return read_attribute(model, mapping["0"], "name")! $ value_type = $ String function value(model : Element, name : String, mapping : Element): return "SimpleMerge"! $ value_parameters = $ String function value(model : Element, name : String, mapping : Element): return "[]"! $ } Post_Trace (post_merge_0, post_merge_1) { label = "2" } Post_DEVS/InputPort post_merge_2 { label = "3" value_name = $ String function value(model : Element, name : String, mapping : Element): return "control_in"! $ } Post_DEVS/DEVSInstanceToPort (post_merge_1, post_merge_2) { label = "4" } Post_DEVS/OutputPort post_merge_3 { label = "5" value_name = $ String function value(model : Element, name : String, mapping : Element): return "control_out"! $ } Post_DEVS/DEVSInstanceToPort (post_merge_1, post_merge_3) { label = "6" } Post_DEVS/CoupledDEVSBlock post_merge_999 { label = "root" } Post_DEVS/SubModel (post_merge_999, post_merge_1) { label = "submodel" } } } {Contains} ForAll multi { LHS { Pre_PM/MultiInstance pre_multi_0 { label = "0" } Pre_DEVS/CoupledDEVSBlock pre_multi_999 { label = "root" } } RHS { Post_PM/MultiInstance post_multi_0 { label = "0" } Post_DEVS/DEVSInstance post_multi_1 { label = "1" value_name = $ String function value(model : Element, name : String, mapping : Element): return read_attribute(model, mapping["0"], "name")! $ value_type = $ String function value(model : Element, name : String, mapping : Element): return "MultiInstance"! $ value_parameters = $ String function value(model : Element, name : String, mapping : Element): return "[" + cast_value(read_attribute(model, mapping["0"], "name")) + ", " + cast_string(read_attribute(model, mapping["0"], "nr_instances")) + ", " + cast_string(read_attribute(model, mapping["0"], "distribution")) + "]"! $ } Post_Trace (post_multi_0, post_multi_1) { label = "2" } Post_DEVS/InputPort post_multi_2 { label = "3" value_name = $ String function value(model : Element, name : String, mapping : Element): return "resource_in"! $ } Post_DEVS/DEVSInstanceToPort (post_multi_1, post_multi_2) { label = "4" } Post_DEVS/OutputPort post_multi_3 { label = "5" value_name = $ String function value(model : Element, name : String, mapping : Element): return "resource_out"! $ } Post_DEVS/DEVSInstanceToPort (post_multi_1, post_multi_3) { label = "6" } Post_DEVS/InputPort post_multi_4 { label = "7" value_name = $ String function value(model : Element, name : String, mapping : Element): return "control_in"! $ } Post_DEVS/DEVSInstanceToPort (post_multi_1, post_multi_4) { label = "8" } Post_DEVS/OutputPort post_multi_5 { label = "9" value_name = $ String function value(model : Element, name : String, mapping : Element): return "control_out"! $ } Post_DEVS/DEVSInstanceToPort (post_multi_1, post_multi_5) { label = "10" } Post_DEVS/CoupledDEVSBlock post_multi_999 { label = "root" } Post_DEVS/SubModel (post_multi_999, post_multi_1) { label = "submodel" } } } {Contains} ForAll map_resources_to { LHS { Pre_DEVS/DEVSInstance pre_mrt_0 { label = "0" constraint_type = $ Boolean function constraint(value : String): return value == "ResourceHandler"! $ } Pre_DEVS/Port pre_mrt_1 { label = "1" constraint_name = $ Boolean function constraint(value : String): return value == "resource_in"! $ } Pre_DEVS/DEVSInstanceToPort (pre_mrt_0, pre_mrt_1) { label = "2" } Pre_DEVS/DEVSInstance pre_mrt_2 { label = "3" constraint_type = $ Boolean function constraint(value : String): return value != "ResourceHandler"! $ } Pre_DEVS/Port pre_mrt_3 { label = "4" constraint_name = $ Boolean function constraint(value : String): return value == "resource_out"! $ } Pre_DEVS/DEVSInstanceToPort (pre_mrt_2, pre_mrt_3) { label = "5" } } RHS { Post_DEVS/DEVSInstance post_mrt_0 { label = "0" } Post_DEVS/Port post_mrt_1 { label = "1" } Post_DEVS/DEVSInstanceToPort (post_mrt_0, post_mrt_1) { label = "2" } Post_DEVS/DEVSInstance post_mrt_2 { label = "3" } Post_DEVS/Port post_mrt_3 { label = "4" } Post_DEVS/DEVSInstanceToPort (post_mrt_2, post_mrt_3) { label = "5" } Post_DEVS/Channel (post_mrt_3, post_mrt_1) { label = "6" } } } {Contains} ForAll map_resources_from { LHS { Pre_DEVS/DEVSInstance pre_mrf_0 { label = "0" constraint_type = $ Boolean function constraint(value : String): return value == "ResourceHandler"! $ } Pre_DEVS/Port pre_mrf_1 { label = "1" constraint_name = $ Boolean function constraint(value : String): return value == "resource_out"! $ } Pre_DEVS/DEVSInstanceToPort (pre_mrf_0, pre_mrf_1) { label = "2" } Pre_DEVS/DEVSInstance pre_mrf_2 { label = "3" constraint_type = $ Boolean function constraint(value : String): return value != "ResourceHandler"! $ } Pre_DEVS/Port pre_mrf_3 { label = "4" constraint_name = $ Boolean function constraint(value : String): return value == "resource_in"! $ } Pre_DEVS/DEVSInstanceToPort (pre_mrf_2, pre_mrf_3) { label = "5" } } RHS { Post_DEVS/DEVSInstance post_mrf_0 { label = "0" } Post_DEVS/Port post_mrf_1 { label = "1" } Post_DEVS/DEVSInstanceToPort (post_mrf_0, post_mrf_1) { label = "2" } Post_DEVS/DEVSInstance post_mrf_2 { label = "3" } Post_DEVS/Port post_mrf_3 { label = "4" } Post_DEVS/DEVSInstanceToPort (post_mrf_2, post_mrf_3) { label = "5" } Post_DEVS/Channel (post_mrf_1, post_mrf_3) { label = "6" } } } {Contains} ForAll map_control { LHS { Pre_DEVS/DEVSInstance pre_map_0 { label = "0" } Pre_DEVS/Port pre_map_1 { label = "1" constraint_name = $ Boolean function constraint(value : String): return value == "control_out"! $ } Pre_DEVS/DEVSInstanceToPort (pre_map_0, pre_map_1) { label = "2" } Pre_DEVS/DEVSInstance pre_map_2 { label = "3" } Pre_DEVS/Port pre_map_3 { label = "4" constraint_name = $ Boolean function constraint(value : String): return value == "control_in"! $ } Pre_DEVS/DEVSInstanceToPort (pre_map_2, pre_map_3) { label = "5" } Pre_PM/ProcessNode pre_map_4 { label = "6" } Pre_Trace (pre_map_4, pre_map_0) { label = "7" } Pre_PM/ProcessNode pre_map_5 { label = "8" } Pre_Trace (pre_map_5, pre_map_2) { label = "9" } Pre_PM/Next (pre_map_4, pre_map_5) { label = "10" } } RHS { Post_DEVS/DEVSInstance post_map_0 { label = "0" } Post_DEVS/Port post_map_1 { label = "1" } Post_DEVS/DEVSInstanceToPort (post_map_0, post_map_1) { label = "2" } Post_DEVS/DEVSInstance post_map_2 { label = "3" } Post_DEVS/Port post_map_3 { label = "4" } Post_DEVS/DEVSInstanceToPort (post_map_2, post_map_3) { label = "5" } Post_PM/ProcessNode post_map_4 { label = "6" } Post_Trace (post_map_4, post_map_0) { label = "7" } Post_PM/ProcessNode post_map_5 { label = "8" } Post_Trace (post_map_5, post_map_2) { label = "9" } Post_PM/Next (post_map_4, post_map_5) { label = "10" } Post_DEVS/Channel (post_map_1, post_map_3) { label = "11" } } } {Contains} ForAll map_control_decision_true { LHS { Pre_DEVS/DEVSInstance pre_mdt_0 { label = "0" } Pre_DEVS/Port pre_mdt_1 { label = "1" constraint_name = $ Boolean function constraint(value : String): return value == "control_out1"! $ } Pre_DEVS/DEVSInstanceToPort (pre_mdt_0, pre_mdt_1) { label = "2" } Pre_DEVS/DEVSInstance pre_mdt_2 { label = "3" } Pre_DEVS/Port pre_mdt_3 { label = "4" constraint_name = $ Boolean function constraint(value : String): return value == "control_in"! $ } Pre_DEVS/DEVSInstanceToPort (pre_mdt_2, pre_mdt_3) { label = "5" } Pre_PM/ProcessNode pre_mdt_4 { label = "6" } Pre_Trace (pre_mdt_4, pre_mdt_0) { label = "7" } Pre_PM/ProcessNode pre_mdt_5 { label = "8" } Pre_Trace (pre_mdt_5, pre_mdt_2) { label = "9" } Pre_PM/DecisionTrue (pre_mdt_4, pre_mdt_5) { label = "10" } } RHS { Post_DEVS/DEVSInstance post_mdt_0 { label = "0" } Post_DEVS/Port post_mdt_1 { label = "1" } Post_DEVS/DEVSInstanceToPort (post_mdt_0, post_mdt_1) { label = "2" } Post_DEVS/DEVSInstance post_mdt_2 { label = "3" } Post_DEVS/Port post_mdt_3 { label = "4" } Post_DEVS/DEVSInstanceToPort (post_mdt_2, post_mdt_3) { label = "5" } Post_PM/ProcessNode post_mdt_4 { label = "6" } Post_Trace (post_mdt_4, post_mdt_0) { label = "7" } Post_PM/ProcessNode post_mdt_5 { label = "8" } Post_Trace (post_mdt_5, post_mdt_2) { label = "9" } Post_PM/DecisionTrue (post_mdt_4, post_mdt_5) { label = "10" } Post_DEVS/Channel (post_mdt_1, post_mdt_3) { label = "11" } } } {Contains} ForAll map_control_decision_false { LHS { Pre_DEVS/DEVSInstance pre_mdf_0 { label = "0" } Pre_DEVS/Port pre_mdf_1 { label = "1" constraint_name = $ Boolean function constraint(value : String): return value == "control_out2"! $ } Pre_DEVS/DEVSInstanceToPort (pre_mdf_0, pre_mdf_1) { label = "2" } Pre_DEVS/DEVSInstance pre_mdf_2 { label = "3" } Pre_DEVS/Port pre_mdf_3 { label = "4" constraint_name = $ Boolean function constraint(value : String): return value == "control_in"! $ } Pre_DEVS/DEVSInstanceToPort (pre_mdf_2, pre_mdf_3) { label = "5" } Pre_PM/ProcessNode pre_mdf_4 { label = "6" } Pre_Trace (pre_mdf_4, pre_mdf_0) { label = "7" } Pre_PM/ProcessNode pre_mdf_5 { label = "8" } Pre_Trace (pre_mdf_5, pre_mdf_2) { label = "9" } Pre_PM/DecisionFalse (pre_mdf_4, pre_mdf_5) { label = "10" } } RHS { Post_DEVS/DEVSInstance post_mdf_0 { label = "0" } Post_DEVS/Port post_mdf_1 { label = "1" } Post_DEVS/DEVSInstanceToPort (post_mdf_0, post_mdf_1) { label = "2" } Post_DEVS/DEVSInstance post_mdf_2 { label = "3" } Post_DEVS/Port post_mdf_3 { label = "4" } Post_DEVS/DEVSInstanceToPort (post_mdf_2, post_mdf_3) { label = "5" } Post_PM/ProcessNode post_mdf_4 { label = "6" } Post_Trace (post_mdf_4, post_mdf_0) { label = "7" } Post_PM/ProcessNode post_mdf_5 { label = "8" } Post_Trace (post_mdf_5, post_mdf_2) { label = "9" } Post_PM/DecisionFalse (post_mdf_4, post_mdf_5) { label = "10" } Post_DEVS/Channel (post_mdf_1, post_mdf_3) { label = "11" } } } } Initial (schedule, root_model) {} OnSuccess (root_model, initial) {} OnFailure (root_model, initial) {} OnSuccess (initial, add_resource_handler) {} OnFailure (initial, add_resource_handler) {} OnSuccess (add_resource_handler, finish) {} OnFailure (add_resource_handler, finish) {} OnSuccess (finish, activity) {} OnFailure (finish, activity) {} OnSuccess (activity, parallelsplit) {} OnFailure (activity, parallelsplit) {} OnSuccess (parallelsplit, synchronization) {} OnFailure (parallelsplit, synchronization) {} OnSuccess (synchronization, xor) {} OnFailure (synchronization, xor) {} OnSuccess (xor, merge) {} OnFailure (xor, merge) {} OnSuccess (merge, multi) {} OnFailure (merge, multi) {} OnSuccess (multi, map_resources_to) {} OnFailure (multi, map_resources_to) {} OnSuccess (map_resources_to, map_resources_from) {} OnFailure (map_resources_to, map_resources_from) {} OnSuccess (map_resources_from, map_control) {} OnFailure (map_resources_from, map_control) {} OnSuccess (map_control, map_control_decision_true) {} OnFailure (map_control, map_control_decision_true) {} OnSuccess (map_control_decision_true, map_control_decision_false) {} OnFailure (map_control_decision_true, map_control_decision_false) {} OnSuccess (map_control_decision_false, success) {} OnFailure (map_control_decision_false, success) {}