|
@@ -648,82 +648,82 @@ class System(CoupledDEVS):
|
|
|
self.connectPorts(self.mvk.to_mvi, self.mvk2mvi.input_port)
|
|
|
self.connectPorts(self.mvk2mvi.output_port, self.mvi.from_mvk)
|
|
|
|
|
|
-taskname = "test_task"
|
|
|
-
|
|
|
-operations = json.loads(open("model/operations", 'r').read())
|
|
|
-#operations = json.loads(open("model/operations_simple", 'r').read())
|
|
|
-additional_operations = [[], # revise_req
|
|
|
- [], # revise_environment
|
|
|
- [], # revise_plant
|
|
|
- [], # revise_control
|
|
|
- [], # revise_query
|
|
|
- [], # revise_architecture
|
|
|
- [], # make_initial_models
|
|
|
- [["instantiate_edge", "Association", "PLANT2EPN_link", "PW_Plant/State", "Encapsulated_PetriNet/Place"], ["instantiate_edge", "Association", "PLANT2EPN_tlink", "PW_Plant/Transition", "Encapsulated_PetriNet/Transition"]], # plant_to_EPN
|
|
|
- [["instantiate_edge", "Association", "CTRL2EPN_link", "PW_Control/State", "Encapsulated_PetriNet/Place"], ["instantiate_edge", "Association", "CTRL2EPN_tlink", "PW_Control/Transition", "Encapsulated_PetriNet/Transition"]], # control_to_EPN
|
|
|
- [["instantiate_edge", "Association", "ENV2EPN_link", "PW_Environment/Event", "Encapsulated_PetriNet/Place"]], # environment_to_EPN
|
|
|
- [["instantiate_edge", "Association", "EPN2PN_place_link", "Encapsulated_PetriNet/Place", "PetriNet/Place"], ["instantiate_edge", "Association", "EPN2PN_transition_link", "Encapsulated_PetriNet/Transition", "PetriNet/Transition"]], # EPN_to_PN
|
|
|
- [], # match
|
|
|
- [], # reachability
|
|
|
- [], # bfs
|
|
|
- [], # merge
|
|
|
- ]
|
|
|
-
|
|
|
-#additional_operations = [[]]
|
|
|
-keyed_operations = {"models/revise_req": [["upload"], compile_model("models/requirements_model.mvc")],
|
|
|
- "models/revise_plant": [["upload"], compile_model("models/plant_model.mvc")],
|
|
|
- "models/revise_environment": [["upload"], compile_model("models/environment_model.mvc")],
|
|
|
- "models/revise_control": [["upload"], compile_model("models/control_model.mvc")],
|
|
|
- "models/revise_query": [["upload"], compile_model("models/query_model.mvc")],
|
|
|
- "models/revise_architecture": [["upload"], compile_model("models/architecture_model.mvc")],
|
|
|
- }
|
|
|
-#keyed_operations = {"models/modify_lang": [["instantiate_node", "PN/Class", ""]]}
|
|
|
-finish_on = "FINISHED"
|
|
|
-
|
|
|
-args = {
|
|
|
- "taskname": taskname,
|
|
|
- "operations": operations,
|
|
|
- "finish_on": finish_on,
|
|
|
- "mvi_additional": additional_operations,
|
|
|
- "mvi_keyed": keyed_operations,
|
|
|
- "mvi2mvk_latency": 0.0000001,
|
|
|
- "mvi2mvk_bandwidth": 50000000000,
|
|
|
- "mvk2mvs_latency": 0.0000001,
|
|
|
- "mvk2mvs_bandwidth": 50000000000,
|
|
|
- "mvs2mvk_latency": 0.0000001,
|
|
|
- "mvs2mvk_bandwidth": 50000000000,
|
|
|
- "mvk2mvi_latency": 0.0000001,
|
|
|
- "mvk2mvi_bandwidth": 50000000000,
|
|
|
- "time_per_phase": 0.05,
|
|
|
- # Automatically filled in from calibration results, just here to prevent crashes (results for my UA desktop)
|
|
|
- "read_root": 0.00001406669616699,
|
|
|
- "create_node": 0.00000379181167487,
|
|
|
- "create_edge": 0.00000601282282066,
|
|
|
- "create_nodevalue": 0.00000501364247391,
|
|
|
- "create_dict": 0.00001028065706205,
|
|
|
- "read_value": 0.00000388661630500,
|
|
|
- "read_outgoing": 0.00000520600098073,
|
|
|
- "read_incoming": 0.00000645903181994,
|
|
|
- "read_edge": 0.00000449162172644,
|
|
|
- "read_dict": 0.00000460127038355,
|
|
|
- "read_dict_keys": 0.00001678063432883,
|
|
|
- "read_dict_node": 0.00001020808859528,
|
|
|
- "read_dict_edge": 0.00000642558526942,
|
|
|
- "read_dict_node_edge": 0.0,
|
|
|
- "read_reverse_dict": 0.00002557890755790,
|
|
|
- "delete_node": 0.00004755891187096,
|
|
|
- "delete_edge": 0.00000683382081240,
|
|
|
- "rule_generation": 0.00001543215873893,
|
|
|
- "purge": 7.0,
|
|
|
- }
|
|
|
-
|
|
|
-with open("calibration/averages", 'r') as param_file:
|
|
|
- for l in param_file:
|
|
|
- op, t = l.split(": ")
|
|
|
- op = op.strip()
|
|
|
- args[op] = float(t)
|
|
|
-
|
|
|
def simulate(supplied_args):
|
|
|
+ taskname = "test_task"
|
|
|
+
|
|
|
+ operations = json.loads(open("model/operations", 'r').read())
|
|
|
+ #operations = json.loads(open("model/operations_simple", 'r').read())
|
|
|
+ additional_operations = [[], # revise_req
|
|
|
+ [], # revise_environment
|
|
|
+ [], # revise_plant
|
|
|
+ [], # revise_control
|
|
|
+ [], # revise_query
|
|
|
+ [], # revise_architecture
|
|
|
+ [], # make_initial_models
|
|
|
+ [["instantiate_edge", "Association", "PLANT2EPN_link", "PW_Plant/State", "Encapsulated_PetriNet/Place"], ["instantiate_edge", "Association", "PLANT2EPN_tlink", "PW_Plant/Transition", "Encapsulated_PetriNet/Transition"]], # plant_to_EPN
|
|
|
+ [["instantiate_edge", "Association", "CTRL2EPN_link", "PW_Control/State", "Encapsulated_PetriNet/Place"], ["instantiate_edge", "Association", "CTRL2EPN_tlink", "PW_Control/Transition", "Encapsulated_PetriNet/Transition"]], # control_to_EPN
|
|
|
+ [["instantiate_edge", "Association", "ENV2EPN_link", "PW_Environment/Event", "Encapsulated_PetriNet/Place"]], # environment_to_EPN
|
|
|
+ [["instantiate_edge", "Association", "EPN2PN_place_link", "Encapsulated_PetriNet/Place", "PetriNet/Place"], ["instantiate_edge", "Association", "EPN2PN_transition_link", "Encapsulated_PetriNet/Transition", "PetriNet/Transition"]], # EPN_to_PN
|
|
|
+ [], # match
|
|
|
+ [], # reachability
|
|
|
+ [], # bfs
|
|
|
+ [], # merge
|
|
|
+ ]
|
|
|
+
|
|
|
+ #additional_operations = [[]]
|
|
|
+ keyed_operations = {"models/revise_req": [["upload"], compile_model("models/requirements_model.mvc")],
|
|
|
+ "models/revise_plant": [["upload"], compile_model("models/plant_model.mvc")],
|
|
|
+ "models/revise_environment": [["upload"], compile_model("models/environment_model.mvc")],
|
|
|
+ "models/revise_control": [["upload"], compile_model("models/control_model.mvc")],
|
|
|
+ "models/revise_query": [["upload"], compile_model("models/query_model.mvc")],
|
|
|
+ "models/revise_architecture": [["upload"], compile_model("models/architecture_model.mvc")],
|
|
|
+ }
|
|
|
+ #keyed_operations = {"models/modify_lang": [["instantiate_node", "PN/Class", ""]]}
|
|
|
+ finish_on = "FINISHED"
|
|
|
+
|
|
|
+ args = {
|
|
|
+ "taskname": taskname,
|
|
|
+ "operations": operations,
|
|
|
+ "finish_on": finish_on,
|
|
|
+ "mvi_additional": additional_operations,
|
|
|
+ "mvi_keyed": keyed_operations,
|
|
|
+ "mvi2mvk_latency": 0.0000001,
|
|
|
+ "mvi2mvk_bandwidth": 50000000000,
|
|
|
+ "mvk2mvs_latency": 0.0000001,
|
|
|
+ "mvk2mvs_bandwidth": 50000000000,
|
|
|
+ "mvs2mvk_latency": 0.0000001,
|
|
|
+ "mvs2mvk_bandwidth": 50000000000,
|
|
|
+ "mvk2mvi_latency": 0.0000001,
|
|
|
+ "mvk2mvi_bandwidth": 50000000000,
|
|
|
+ "time_per_phase": 0.05,
|
|
|
+ # Automatically filled in from calibration results, just here to prevent crashes (results for my UA desktop)
|
|
|
+ "read_root": 0.00001406669616699,
|
|
|
+ "create_node": 0.00000379181167487,
|
|
|
+ "create_edge": 0.00000601282282066,
|
|
|
+ "create_nodevalue": 0.00000501364247391,
|
|
|
+ "create_dict": 0.00001028065706205,
|
|
|
+ "read_value": 0.00000388661630500,
|
|
|
+ "read_outgoing": 0.00000520600098073,
|
|
|
+ "read_incoming": 0.00000645903181994,
|
|
|
+ "read_edge": 0.00000449162172644,
|
|
|
+ "read_dict": 0.00000460127038355,
|
|
|
+ "read_dict_keys": 0.00001678063432883,
|
|
|
+ "read_dict_node": 0.00001020808859528,
|
|
|
+ "read_dict_edge": 0.00000642558526942,
|
|
|
+ "read_dict_node_edge": 0.0,
|
|
|
+ "read_reverse_dict": 0.00002557890755790,
|
|
|
+ "delete_node": 0.00004755891187096,
|
|
|
+ "delete_edge": 0.00000683382081240,
|
|
|
+ "rule_generation": 0.00001543215873893,
|
|
|
+ "purge": 7.0,
|
|
|
+ }
|
|
|
+
|
|
|
+ with open("calibration/averages", 'r') as param_file:
|
|
|
+ for l in param_file:
|
|
|
+ op, t = l.split(": ")
|
|
|
+ op = op.strip()
|
|
|
+ args[op] = float(t)
|
|
|
+
|
|
|
local_args = dict(args)
|
|
|
local_args.update(supplied_args)
|
|
|
model = System(**local_args)
|
|
@@ -735,6 +735,13 @@ def simulate(supplied_args):
|
|
|
return (tn, time.time() - start)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
- ts, te = simulate({})
|
|
|
+ import sys
|
|
|
+ args = {}
|
|
|
+ i = 2
|
|
|
+ while i < len(sys.argv):
|
|
|
+ args[sys.argv[i]] = float(sys.argv[i+1])
|
|
|
+ i += 2
|
|
|
+ ts, te = simulate(args)
|
|
|
+
|
|
|
print("Simulation time %s" % ts)
|
|
|
print("Execution time %s" % te)
|