浏览代码

Fixed typos in transformation

Yentl Van Tendeloo 7 年之前
父节点
当前提交
b7d3950bfa
共有 5 个文件被更改,包括 110 次插入109 次删除
  1. 105 106
      models/WSC/PM_to_DEVS.mvc
  2. 1 1
      models/WSC/pm_library.mvc
  3. 1 1
      models/pm_translate.py
  4. 1 0
      wrappers/classes/modelverse.xml
  5. 2 1
      wrappers/modelverse_SCCD.py

+ 105 - 106
models/WSC/PM_to_DEVS.mvc

@@ -1,6 +1,6 @@
 include "primitives.alh"
 include "modelling.alh"
-include "object_oeprations.alh"
+include "object_operations.alh"
 
 Composite schedule {
     {Contains} Success success {}
@@ -58,7 +58,7 @@ Composite schedule {
                         return "Initial"!
                     $
             }
-            Trace (post_init_0, post_init_1) {
+            Post_Trace (post_init_0, post_init_1) {
                 label = "1"
             }
 
@@ -94,7 +94,7 @@ Composite schedule {
                         return "Finish"!
                     $
             }
-            Trace (post_finish_0, post_finish_1) {
+            Post_Trace (post_finish_0, post_finish_1) {
                 label = "2"
             }
 
@@ -134,7 +134,7 @@ Composite schedule {
                         return "[" + cast_value(read_attribute(model, mapping["0"], "name")) + ", " + cast_string(read_attribute(model, mapping["0"], "distribution")) + "]"!
                     $
             }
-            Trace (post_activity_0, post_activity_1) {
+            Post_Trace (post_activity_0, post_activity_1) {
                 label = "1"
             }
 
@@ -194,7 +194,7 @@ Composite schedule {
                         return "ParallelSplit"!
                     $
             }
-            Trace (post_split_0, post_split_1) {
+            Post_Trace (post_split_0, post_split_1) {
                 label = "2"
             }
 
@@ -238,7 +238,7 @@ Composite schedule {
                         return "Synchronization"!
                     $
             }
-            Trace (post_sync_0, post_sync_1) {
+            Post_Trace (post_sync_0, post_sync_1) {
                 label = "2"
             }
 
@@ -282,7 +282,7 @@ Composite schedule {
                         return "ExclusiveChoice"!
                     $
             }
-            Trace (post_xor_0, post_xor_1) {
+            Post_Trace (post_xor_0, post_xor_1) {
                 label = "2"
             }
 
@@ -333,7 +333,7 @@ Composite schedule {
                         return "SimpleMerge"!
                     $
             }
-            Trace (post_merge_0, post_merge_1) {
+            Post_Trace (post_merge_0, post_merge_1) {
                 label = "2"
             }
 
@@ -381,7 +381,7 @@ Composite schedule {
                         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")) + "]"!
                     $
             }
-            Trace (post_multi_0, post_multi_1) {
+            Post_Trace (post_multi_0, post_multi_1) {
                 label = "2"
             }
 
@@ -487,65 +487,65 @@ Composite schedule {
 
     {Contains} ForAll map_resources_from {
         LHS {
-            Pre_CDEVS/DEVSInstance pre_mrt_0 {
+            Pre_CDEVS/DEVSInstance pre_mrf_0 {
                 label = "0"
                 constraint_name = $
                     Boolean function constraint(model : Element, name : String):
                         return (cast_string(read_attribute(model, name, "type")) == "ResourceHandler")!
                     $
             }
-            Pre_CDEVS/Port pre_mrt_1 {
+            Pre_CDEVS/Port pre_mrf_1 {
                 label = "1"
                 constraint_name = $
                     Boolean function constraint(model : Element, name : String):
                         return (cast_string(read_attribute(model, name, "type")) == "resource_out")!
                     $
             }
-            Pre_CDEVS/DEVSInstanceToPort (pre_mrt_0, pre_mrt_1) {
+            Pre_CDEVS/DEVSInstanceToPort (pre_mrf_0, pre_mrf_1) {
                 label = "2"
             }
 
-            Pre_CDEVS/DEVSInstance pre_mrt_2 {
+            Pre_CDEVS/DEVSInstance pre_mrf_2 {
                 label = "3"
                 constraint_name = $
                     Boolean function constraint(model : Element, name : String):
                         return (cast_string(read_attribute(model, name, "type")) != "ResourceHandler")!
                     $
             }
-            Pre_CDEVS/Port pre_mrt_3 {
+            Pre_CDEVS/Port pre_mrf_3 {
                 label = "4"
                 constraint_name = $
                     Boolean function constraint(model : Element, name : String):
                         return (cast_string(read_attribute(model, name, "type")) == "resource_in")!
                     $
             }
-            Pre_CDEVS/DEVSInstanceToPort (pre_mrt_2, pre_mrt_3) {
+            Pre_CDEVS/DEVSInstanceToPort (pre_mrf_2, pre_mrf_3) {
                 label = "5"
             }
         }
     
         RHS {
-            Post_CDEVS/DEVSInstance post_mrt_0 {
+            Post_CDEVS/DEVSInstance post_mrf_0 {
                 label = "0"
             }
-            Post_CDEVS/Port post_mrt_1 {
+            Post_CDEVS/Port post_mrf_1 {
                 label = "1"
             }
-            Post_CDEVS/DEVSInstanceToPort (post_mrt_0, post_mrt_1) {
+            Post_CDEVS/DEVSInstanceToPort (post_mrf_0, post_mrf_1) {
                 label = "2"
             }
 
-            Post_CDEVS/DEVSInstance post_mrt_2 {
+            Post_CDEVS/DEVSInstance post_mrf_2 {
                 label = "3"
             }
-            Post_CDEVS/Port post_mrt_3 {
+            Post_CDEVS/Port post_mrf_3 {
                 label = "4"
             }
-            Post_CDEVS/DEVSInstanceToPort (post_mrt_2, post_mrt_3) {
+            Post_CDEVS/DEVSInstanceToPort (post_mrf_2, post_mrf_3) {
                 label = "5"
             }
 
-            Post_CDEVS/Channel (post_mrt_1, post_mrt_3) {
+            Post_CDEVS/Channel (post_mrf_1, post_mrf_3) {
                 label = "6"
             }
         }
@@ -553,22 +553,6 @@ Composite schedule {
 
     {Contains} ForAll map_control {
         LHS {
-            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_1) {
-                label = "9"
-            }
-            Pre_PM/Next (pre_map_4, pre_map_5) {
-                label = "10"
-            }
-
             Pre_CDEVS/DEVSInstance pre_map_0 {
                 label = "0"
             }
@@ -596,6 +580,22 @@ Composite schedule {
             Pre_CDEVS/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_1) {
+                label = "9"
+            }
+            Pre_PM/Next (pre_map_4, pre_map_5) {
+                label = "10"
+            }
+
         }
     
         RHS {
@@ -642,88 +642,88 @@ Composite schedule {
 
     {Contains} ForAll map_control_decision_true {
         LHS {
-            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_1) {
-                label = "9"
-            }
-            Pre_PM/DecisionTrue (pre_map_4, pre_map_5) {
-                label = "10"
-            }
-
-            Pre_CDEVS/DEVSInstance pre_map_0 {
+            Pre_CDEVS/DEVSInstance pre_mdt_0 {
                 label = "0"
             }
-            Pre_CDEVS/Port pre_map_1 {
+            Pre_CDEVS/Port pre_mdt_1 {
                 label = "1"
                 constraint_name = $
                     Boolean function constraint(model : Element, name : String):
                         return (cast_string(read_attribute(model, name, "type")) == "control_out1")!
                     $
             }
-            Pre_CDEVS/DEVSInstanceToPort (pre_map_0, pre_map_1) {
+            Pre_CDEVS/DEVSInstanceToPort (pre_mdt_0, pre_mdt_1) {
                 label = "2"
             }
 
-            Pre_CDEVS/DEVSInstance pre_map_2 {
+            Pre_CDEVS/DEVSInstance pre_mdt_2 {
                 label = "3"
             }
-            Pre_CDEVS/Port pre_map_3 {
+            Pre_CDEVS/Port pre_mdt_3 {
                 label = "4"
                 constraint_name = $
                     Boolean function constraint(model : Element, name : String):
                         return (cast_string(read_attribute(model, name, "type")) == "control_in")!
                     $
             }
-            Pre_CDEVS/DEVSInstanceToPort (pre_map_2, pre_map_3) {
+            Pre_CDEVS/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_1) {
+                label = "9"
+            }
+            Pre_PM/DecisionTrue (pre_mdt_4, pre_mdt_5) {
+                label = "10"
+            }
+
         }
     
         RHS {
-            Post_CDEVS/DEVSInstance post_map_0 {
+            Post_CDEVS/DEVSInstance post_mdt_0 {
                 label = "0"
             }
-            Post_CDEVS/Port post_map_1 {
+            Post_CDEVS/Port post_mdt_1 {
                 label = "1"
             }
-            Post_CDEVS/DEVSInstanceToPort (post_map_0, post_map_1) {
+            Post_CDEVS/DEVSInstanceToPort (post_mdt_0, post_mdt_1) {
                 label = "2"
             }
 
-            Post_CDEVS/DEVSInstance post_map_2 {
+            Post_CDEVS/DEVSInstance post_mdt_2 {
                 label = "3"
             }
-            Post_CDEVS/Port post_map_3 {
+            Post_CDEVS/Port post_mdt_3 {
                 label = "4"
             }
-            Post_CDEVS/DEVSInstanceToPort (post_map_2, post_map_3) {
+            Post_CDEVS/DEVSInstanceToPort (post_mdt_2, post_mdt_3) {
                 label = "5"
             }
 
-            Post_PM/ProcessNode post_map_4 {
+            Post_PM/ProcessNode post_mdt_4 {
                 label = "6"
             }
-            Post_Trace (post_map_4, post_map_0) {
+            Post_Trace (post_mdt_4, post_mdt_0) {
                 label = "7"
             }
-            Post_PM/ProcessNode post_map_5 {
+            Post_PM/ProcessNode post_mdt_5 {
                 label = "8"
             }
-            Post_Trace (post_map_5, post_map_1) {
+            Post_Trace (post_mdt_5, post_mdt_1) {
                 label = "9"
             }
-            Post_PM/DecisionTrue (post_map_4, post_map_5) {
+            Post_PM/DecisionTrue (post_mdt_4, post_mdt_5) {
                 label = "10"
             }
-            Post_CDEVS/Channel (post_map_1, post_map_3) {
+            Post_CDEVS/Channel (post_mdt_1, post_mdt_3) {
                 label = "11"
             }
         }
@@ -731,88 +731,87 @@ Composite schedule {
 
     {Contains} ForAll map_control_decision_false {
         LHS {
-            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_1) {
-                label = "9"
-            }
-            Pre_PM/DecisionFalse (pre_map_4, pre_map_5) {
-                label = "10"
-            }
-
-            Pre_CDEVS/DEVSInstance pre_map_0 {
+            Pre_CDEVS/DEVSInstance pre_mdf_0 {
                 label = "0"
             }
-            Pre_CDEVS/Port pre_map_1 {
+            Pre_CDEVS/Port pre_mdf_1 {
                 label = "1"
                 constraint_name = $
                     Boolean function constraint(model : Element, name : String):
                         return (cast_string(read_attribute(model, name, "type")) == "control_out2")!
                     $
             }
-            Pre_CDEVS/DEVSInstanceToPort (pre_map_0, pre_map_1) {
+            Pre_CDEVS/DEVSInstanceToPort (pre_mdf_0, pre_mdf_1) {
                 label = "2"
             }
 
-            Pre_CDEVS/DEVSInstance pre_map_2 {
+            Pre_CDEVS/DEVSInstance pre_mdf_2 {
                 label = "3"
             }
-            Pre_CDEVS/Port pre_map_3 {
+            Pre_CDEVS/Port pre_mdf_3 {
                 label = "4"
                 constraint_name = $
                     Boolean function constraint(model : Element, name : String):
                         return (cast_string(read_attribute(model, name, "type")) == "control_in")!
                     $
             }
-            Pre_CDEVS/DEVSInstanceToPort (pre_map_2, pre_map_3) {
+            Pre_CDEVS/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_1) {
+                label = "9"
+            }
+            Pre_PM/DecisionFalse (pre_mdf_4, pre_mdf_5) {
+                label = "10"
+            }
         }
     
         RHS {
-            Post_CDEVS/DEVSInstance post_map_0 {
+            Post_CDEVS/DEVSInstance post_mdf_0 {
                 label = "0"
             }
-            Post_CDEVS/Port post_map_1 {
+            Post_CDEVS/Port post_mdf_1 {
                 label = "1"
             }
-            Post_CDEVS/DEVSInstanceToPort (post_map_0, post_map_1) {
+            Post_CDEVS/DEVSInstanceToPort (post_mdf_0, post_mdf_1) {
                 label = "2"
             }
 
-            Post_CDEVS/DEVSInstance post_map_2 {
+            Post_CDEVS/DEVSInstance post_mdf_2 {
                 label = "3"
             }
-            Post_CDEVS/Port post_map_3 {
+            Post_CDEVS/Port post_mdf_3 {
                 label = "4"
             }
-            Post_CDEVS/DEVSInstanceToPort (post_map_2, post_map_3) {
+            Post_CDEVS/DEVSInstanceToPort (post_mdf_2, post_mdf_3) {
                 label = "5"
             }
 
-            Post_PM/ProcessNode post_map_4 {
+            Post_PM/ProcessNode post_mdf_4 {
                 label = "6"
             }
-            Post_Trace (post_map_4, post_map_0) {
+            Post_Trace (post_mdf_4, post_mdf_0) {
                 label = "7"
             }
-            Post_PM/ProcessNode post_map_5 {
+            Post_PM/ProcessNode post_mdf_5 {
                 label = "8"
             }
-            Post_Trace (post_map_5, post_map_1) {
+            Post_Trace (post_mdf_5, post_mdf_1) {
                 label = "9"
             }
-            Post_PM/DecisionFalse (post_map_4, post_map_5) {
+            Post_PM/DecisionFalse (post_mdf_4, post_mdf_5) {
                 label = "10"
             }
-            Post_CDEVS/Channel (post_map_1, post_map_3) {
+            Post_CDEVS/Channel (post_mdf_1, post_mdf_3) {
                 label = "11"
             }
         }

+ 1 - 1
models/WSC/pm_library.mvc

@@ -405,7 +405,7 @@ InputPort mi_ri {
     name = "resource_in"
 }
 
-OutputPort mu_ro {
+OutputPort mi_ro {
     name = "resource_out"
 }
 

+ 1 - 1
models/pm_translate.py

@@ -20,7 +20,7 @@ model_add("models/PM/example_PM", "formalisms/PM/PM_Extended_MM", open("models/W
 def traceability_pm_devs(model):
     instantiate(model, "Association", ("PM/ProcessNode", "CDEVS/DEVSInstance"), ID="Trace")
     
-transformation_add_MT("formalisms/PM/to_DEVS", {"PM": "formalisms/PM/PM_Extended_MM"}, {"CDEVS": "formalisms/DEVS/CDEVS_MM"}, open("models/WSC/PM_to_DEVS.mvc", 'r').read(), traceability_pm_devs)
+transformation_add_MT({"PM": "formalisms/PM/PM_Extended_MM"}, {"CDEVS": "formalisms/DEVS/CDEVS_MM"}, "formalisms/PM/to_DEVS", open("models/WSC/PM_to_DEVS.mvc", 'r').read(), traceability_pm_devs)
 
 """
 transformation_add_AL("formalisms/DEVS/merge", {"ADEVS": "formalisms/DEVS/ADEVS_MM", "CDEVS": "formalisms/DEVS/CDEVS_MM"}, {"DEVS": "formalisms/DEVS/DEVS_MM"}, open("models/WSC/DEVS_merge.alc", 'r').read())

+ 1 - 0
wrappers/classes/modelverse.xml

@@ -16,6 +16,7 @@
     <method name="dict_to_list">
         <parameter name="d"/>
         <body>
+            print("Making list out of " + str(d))
             l = []
             for k, v in d.items():
                 l.append(k)

+ 2 - 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)
 
-Date:   Mon May 14 16:45:16 2018
+Date:   Tue May 15 08:40:42 2018
 
 Model author: Yentl Van Tendeloo
 Model name:   MvK Server
@@ -67,6 +67,7 @@ class Modelverse(RuntimeClassBase):
     
     # user defined method
     def dict_to_list(self, d):
+        print("Making list out of " + str(d))
         l = []
         for k, v in d.items():
             l.append(k)