Browse Source

Added all code for the PM part again

Yentl Van Tendeloo 3 years ago
parent
commit
1ea4fda63b

+ 27 - 0
examples/pm_simulation.py

@@ -0,0 +1,27 @@
+import sys
+sys.path.append("wrappers/")
+
+from modelverse import *
+
+init()
+login("admin", "admin")
+
+model_add("formalisms/DEVS/DEVS_MM", "formalisms/SimpleClassDiagrams", open("models/ClassicDEVS/metamodels/DEVS.mvc", 'r').read())
+model_add("formalisms/PM/PM_Extended_MM", "formalisms/SimpleClassDiagrams", open("models/FTGPM/metamodels/control_patterns.mvc", 'r').read())
+model_add("formalisms/Experiment/Experiment_MM", "formalisms/SimpleClassDiagrams", open("models/PythonPDEVS_Experiment/metamodels/experiment.mvc", 'r').read())
+
+model_add("models/PM/to_DEVS", "formalisms/ProcessModel", open("models/FTGPM/PM_patterns_simulation.mvc").read())
+
+model_add("models/DEVS/PM_library", "formalisms/DEVS/DEVS_MM", open("models/ClassicDEVS/models/process_patterns_library.mvc", 'r').read())
+model_add("models/PM/example_PM", "formalisms/PM/PM_Extended_MM", open("models/FTGPM/models/example_patterns.mvc", 'r').read())
+model_add("models/Experiment/example_experiment", "formalisms/Experiment/Experiment_MM", open("models/PythonPDEVS_Experiment/models/optimize_PM_resources.mvc", 'r').read())
+
+def traceability_pm_devs(model):
+    instantiate(model, "Association", ("PM/ProcessNode", "DEVS/DEVSInstance"), ID="Trace")
+
+transformation_add_MT({"PM": "formalisms/PM/PM_Extended_MM"}, {"DEVS": "formalisms/DEVS/DEVS_MM"}, "formalisms/PM/to_DEVS", open("models/FTGPM/transformations/patterns_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/ClassicDEVS/transformations/merge.alc", 'r').read())
+transformation_add_AL({"DEVS": "formalisms/DEVS/DEVS_MM", "Experiment": "formalisms/Experiment/Experiment_MM"}, {}, "formalisms/DEVS/simulate", open("models/ClassicDEVS/transformations/simulate.alc", 'r').read())
+
+process_execute("models/PM/to_DEVS", {"PM": "models/PM/example_PM", "DEVS library": "models/DEVS/PM_library", "Experiment": "models/Experiment/example_experiment"}, {})

+ 0 - 8
models/FTGPM/PM_patterns_simulation.mvc

@@ -44,11 +44,6 @@ Data experiment_model {
     type = "formalisms/Experiment/Experiment_MM"
 }
 
-Data metrics_model {
-    name = "Metrics"
-    type = "formalisms/Metrics/Metrics_MM"
-}
-
 Consumes (translate, pm_model) {
     name = "PM"
 }
@@ -72,6 +67,3 @@ Consumes (simulate, devs_model) {
 Consumes (simulate, experiment_model) {
     name = "Experiment"
 }
-Produces (simulate, metrics_model) {
-    name = "metrics"
-}

+ 0 - 11
test_printer.py

@@ -1,11 +0,0 @@
-import sys
-sys.path.append("wrappers/")
-from modelverse import *
-
-init()
-login("admin", "admin")
-
-model_add("formalisms/String", "formalisms/SimpleClassDiagrams", open("models/String.mvc", 'r').read())
-transformation_add_AL({}, {}, "models/test", open("models/test.alc", 'r').read())
-transformation_add_AL({"AL": "formalisms/ActionLanguage"}, {"String": "formalisms/String"}, "models/AL_to_Py", open("models/AL_to_py.alc", 'r').read())
-transformation_execute_AL("models/AL_to_Py", {"AL": "models/test"}, {"String": "models/printed_string"})

+ 0 - 6
wrappers/classes/modelverse.xml

@@ -716,15 +716,9 @@
                                 </transition>
 
                                 <transition cond="self.expect_response('Success', pop=True)" target="../../../../wait_for_action/megamodelling">
-                                    <script>
-                                        print("FINISH in SC")
-                                    </script>
                                     <raise event="result">
                                         <parameter expr="'Success'"/>
                                     </raise>
-                                    <script>
-                                        print("RAISED")
-                                    </script>
                                 </transition>
                             </state>
                         </state>

+ 1 - 3
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)
 
-Date:   Tue May 15 16:45:47 2018
+Date:   Thu May 17 10:06:19 2018
 
 Model author: Yentl Van Tendeloo
 Model name:   MvK Server
@@ -2757,9 +2757,7 @@ class Modelverse(RuntimeClassBase):
         return self.responses and ' : ' in self.responses[0]
     
     def _initialized_behaviour_operations_store_on_scripted_process_execute_executing_1_exec(self, parameters):
-        print("FINISH in SC")
         self.raiseInternalEvent(Event("result", None, ['Success']))
-        print("RAISED")
     
     def _initialized_behaviour_operations_store_on_scripted_process_execute_executing_1_guard(self, parameters):
         return self.expect_response('Success', pop=True)