Bladeren bron

Added resource links in DEVS mapping

Yentl Van Tendeloo 7 jaren geleden
bovenliggende
commit
fbe26d951c
1 gewijzigde bestanden met toevoegingen van 239 en 29 verwijderingen
  1. 239 29
      models/WSC/PM_to_DEVS.mvc

+ 239 - 29
models/WSC/PM_to_DEVS.mvc

@@ -21,13 +21,19 @@ Composite schedule {
                     $
             }
             Post_CDEVS/InputPort post_resource_2 {
+                label = "2"
                 name = "resource_in"
             }
-            Post_CDEVS/DEVSInstanceToPort (post_resource_1, post_resource_2) {}
+            Post_CDEVS/DEVSInstanceToPort (post_resource_1, post_resource_2) {
+                label = "3"
+            }
             Post_CDEVS/OutputPort post_resource_3 {
+                label = "4"
                 name = "resource_out"
             }
-            Post_CDEVS/DEVSInstanceToPort (post_resource_1, post_resource_3) {}
+            Post_CDEVS/DEVSInstanceToPort (post_resource_1, post_resource_3) {
+                label = "5"
+            }
         }
     }
     
@@ -53,12 +59,17 @@ Composite schedule {
                         return "Initial"!
                     $
             }
-            Trace (post_init_0, post_init_1) {}
+            Trace (post_init_0, post_init_1) {
+                label = "1"
+            }
 
             Post_CDEVS/OutputPort post_init_2 {
+                label = "2"
                 name = "control_out"
             }
-            Post_CDEVS/DEVSInstanceToPort (post_init_1, post_init_2) {}
+            Post_CDEVS/DEVSInstanceToPort (post_init_1, post_init_2) {
+                label = "3"
+            }
         }
     }
     
@@ -84,12 +95,17 @@ Composite schedule {
                         return "Finish"!
                     $
             }
-            Trace (post_finish_0, post_finish_1) {}
+            Trace (post_finish_0, post_finish_1) {
+                label = "2"
+            }
 
             Post_CDEVS/InputPort post_finish_2 {
+                label = "3"
                 name = "control_in"
             }
-            Post_CDEVS/DEVSInstanceToPort (post_finish_1, post_finish_2) {}
+            Post_CDEVS/DEVSInstanceToPort (post_finish_1, post_finish_2) {
+                label = "4"
+            }
         }
     }
     
@@ -119,27 +135,41 @@ 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) {}
+            Trace (post_activity_0, post_activity_1) {
+                label = "1"
+            }
 
             Post_CDEVS/InputPort post_activity_2 {
+                label = "2"
                 name = "resource_in"
             }
-            Post_CDEVS/DEVSInstanceToPort (post_activity_1, post_activity_2) {}
+            Post_CDEVS/DEVSInstanceToPort (post_activity_1, post_activity_2) {
+                label = "2"
+            }
 
             Post_CDEVS/OutputPort post_activity_3 {
+                label = "3"
                 name = "resource_out"
             }
-            Post_CDEVS/DEVSInstanceToPort (post_activity_1, post_activity_3) {}
+            Post_CDEVS/DEVSInstanceToPort (post_activity_1, post_activity_3) {
+                label = "4"
+            }
 
             Post_CDEVS/InputPort post_activity_4 {
+                label = "5"
                 name = "control_in"
             }
-            Post_CDEVS/DEVSInstanceToPort (post_activity_1, post_activity_4) {}
+            Post_CDEVS/DEVSInstanceToPort (post_activity_1, post_activity_4) {
+                label = "6"
+            }
 
             Post_CDEVS/OutputPort post_activity_5 {
+                label = "7"
                 name = "control_out"
             }
-            Post_CDEVS/DEVSInstanceToPort (post_activity_1, post_activity_5) {}
+            Post_CDEVS/DEVSInstanceToPort (post_activity_1, post_activity_5) {
+                label = "8"
+            }
         }
     }
 
@@ -165,17 +195,25 @@ Composite schedule {
                         return "ParallelSplit"!
                     $
             }
-            Trace (post_split_0, post_split_1) {}
+            Trace (post_split_0, post_split_1) {
+                label = "2"
+            }
 
             Post_CDEVS/InputPort post_split_2 {
+                label = "3"
                 name = "control_in"
             }
-            Post_CDEVS/DEVSInstanceToPort (post_split_1, post_split_2) {}
+            Post_CDEVS/DEVSInstanceToPort (post_split_1, post_split_2) {
+                label = "4"
+            }
 
             Post_CDEVS/OutputPort post_split_3 {
+                label = "5"
                 name = "control_out"
             }
-            Post_CDEVS/DEVSInstanceToPort (post_split_1, post_split_3) {}
+            Post_CDEVS/DEVSInstanceToPort (post_split_1, post_split_3) {
+                label = "6"
+            }
         }
     }
 
@@ -201,17 +239,25 @@ Composite schedule {
                         return "Synchronization"!
                     $
             }
-            Trace (post_sync_0, post_sync_1) {}
+            Trace (post_sync_0, post_sync_1) {
+                label = "2"
+            }
 
             Post_CDEVS/InputPort post_sync_2 {
+                label = "3"
                 name = "control_in"
             }
-            Post_CDEVS/DEVSInstanceToPort (post_sync_1, post_sync_2) {}
+            Post_CDEVS/DEVSInstanceToPort (post_sync_1, post_sync_2) {
+                label = "4"
+            }
 
             Post_CDEVS/OutputPort post_sync_3 {
+                label = "5"
                 name = "control_out"
             }
-            Post_CDEVS/DEVSInstanceToPort (post_sync_1, post_sync_3) {}
+            Post_CDEVS/DEVSInstanceToPort (post_sync_1, post_sync_3) {
+                label = "6"
+            }
         }
     }
 
@@ -237,21 +283,32 @@ Composite schedule {
                         return "ExclusiveChoice"!
                     $
             }
-            Trace (post_xor_0, post_xor_1) {}
+            Trace (post_xor_0, post_xor_1) {
+                label = "2"
+            }
 
             Post_CDEVS/InputPort post_xor_2 {
+                label = "3"
                 name = "control_in"
             }
-            Post_CDEVS/DEVSInstanceToPort (post_xor_1, post_xor_2) {}
+            Post_CDEVS/DEVSInstanceToPort (post_xor_1, post_xor_2) {
+                label = "4"
+            }
 
             Post_CDEVS/OutputPort post_xor_3 {
+                label = "5"
                 name = "control_out1"
             }
-            Post_CDEVS/DEVSInstanceToPort (post_xor_1, post_xor_3) {}
+            Post_CDEVS/DEVSInstanceToPort (post_xor_1, post_xor_3) {
+                label = "6"
+            }
             Post_CDEVS/OutputPort post_xor_4 {
+                label = "7"
                 name = "control_out2"
             }
-            Post_CDEVS/DEVSInstanceToPort (post_xor_1, post_xor_4) {}
+            Post_CDEVS/DEVSInstanceToPort (post_xor_1, post_xor_4) {
+                label = "8"
+            }
         }
     }
 
@@ -277,17 +334,25 @@ Composite schedule {
                         return "SimpleMerge"!
                     $
             }
-            Trace (post_merge_0, post_merge_1) {}
+            Trace (post_merge_0, post_merge_1) {
+                label = "2"
+            }
 
             Post_CDEVS/InputPort post_merge_2 {
+                label = "3"
                 name = "control_in"
             }
-            Post_CDEVS/DEVSInstanceToPort (post_merge_1, post_merge_2) {}
+            Post_CDEVS/DEVSInstanceToPort (post_merge_1, post_merge_2) {
+                label = "4"
+            }
 
             Post_CDEVS/OutputPort post_merge_3 {
+                label = "5"
                 name = "control_out"
             }
-            Post_CDEVS/DEVSInstanceToPort (post_merge_1, post_merge_3) {}
+            Post_CDEVS/DEVSInstanceToPort (post_merge_1, post_merge_3) {
+                label = "6"
+            }
         }
     }
 
@@ -317,28 +382,173 @@ 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) {}
+            Trace (post_multi_0, post_multi_1) {
+                label = "2"
+            }
 
             Post_CDEVS/InputPort post_multi_2 {
+                label = "3"
                 name = "resource_in"
             }
-            Post_CDEVS/DEVSInstanceToPort (post_multi_1, post_multi_2) {}
+            Post_CDEVS/DEVSInstanceToPort (post_multi_1, post_multi_2) {
+                label = "4"
+            }
 
             Post_CDEVS/OutputPort post_multi_3 {
+                label = "5"
                 name = "resource_out"
             }
-            Post_CDEVS/DEVSInstanceToPort (post_multi_1, post_multi_3) {}
+            Post_CDEVS/DEVSInstanceToPort (post_multi_1, post_multi_3) {
+                label = "6"
+            }
 
             Post_CDEVS/InputPort post_multi_4 {
+                label = "7"
                 name = "control_in"
             }
-            Post_CDEVS/DEVSInstanceToPort (post_multi_1, post_multi_4) {}
+            Post_CDEVS/DEVSInstanceToPort (post_multi_1, post_multi_4) {
+                label = "8"
+            }
 
             Post_CDEVS/OutputPort post_multi_5 {
+                label = "9"
                 name = "control_out"
             }
-            Post_CDEVS/DEVSInstanceToPort (post_multi_1, post_multi_5) {}
+            Post_CDEVS/DEVSInstanceToPort (post_multi_1, post_multi_5) {
+                label = "10"
+            }
+        }
+    }
+
+    {Contains} ForAll map_resources_to {
+        LHS {
+            Pre_CDEVS/DEVSInstance pre_mrt_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 {
+                label = "1"
+                constraint_name = $
+                    Boolean function constraint(model : Element, name : String):
+                        return (cast_string(read_attribute(model, name, "type")) == "resource_in")!
+                    $
+            }
+            Pre_CDEVS/DEVSInstanceToPort (pre_mrt_0, pre_mrt_1) {
+                label = "2"
+            }
+
+            Pre_CDEVS/DEVSInstance pre_mrt_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 {
+                label = "4"
+                constraint_name = $
+                    Boolean function constraint(model : Element, name : String):
+                        return (cast_string(read_attribute(model, name, "type")) == "resource_out")!
+                    $
+            }
+            Pre_CDEVS/DEVSInstanceToPort (pre_mrt_2, pre_mrt_3) {
+                label = "5"
+            }
+        }
+    
+        RHS {
+            Post_CDEVS/DEVSInstance post_mrt_0 {
+                label = "0"
+            }
+            Post_CDEVS/Port post_mrt_1 {
+                label = "1"
+            }
+            Post_CDEVS/DEVSInstanceToPort (post_mrt_0, post_mrt_1) {
+                label = "2"
+            }
+
+            Post_CDEVS/DEVSInstance post_mrt_2 {
+                label = "3"
+            }
+            Post_CDEVS/Port post_mrt_3 {
+                label = "4"
+            }
+            Post_CDEVS/DEVSInstanceToPort (post_mrt_2, post_mrt_3) {
+                label = "5"
+            }
+
+            Post_CDEVS/Channel (post_mrt_3, post_mrt_1) {
+                label = "6"
+            }
         }
     }
 
+    {Contains} ForAll map_resources_from {
+        LHS {
+            Pre_CDEVS/DEVSInstance pre_mrt_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 {
+                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) {
+                label = "2"
+            }
+
+            Pre_CDEVS/DEVSInstance pre_mrt_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 {
+                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) {
+                label = "5"
+            }
+        }
+    
+        RHS {
+            Post_CDEVS/DEVSInstance post_mrt_0 {
+                label = "0"
+            }
+            Post_CDEVS/Port post_mrt_1 {
+                label = "1"
+            }
+            Post_CDEVS/DEVSInstanceToPort (post_mrt_0, post_mrt_1) {
+                label = "2"
+            }
+
+            Post_CDEVS/DEVSInstance post_mrt_2 {
+                label = "3"
+            }
+            Post_CDEVS/Port post_mrt_3 {
+                label = "4"
+            }
+            Post_CDEVS/DEVSInstanceToPort (post_mrt_2, post_mrt_3) {
+                label = "5"
+            }
+
+            Post_CDEVS/Channel (post_mrt_1, post_mrt_3) {
+                label = "6"
+            }
+        }
+    }
 }