Browse Source

Added "combine_EPN" transformation

Yentl Van Tendeloo 8 years ago
parent
commit
75cc3e0656
1 changed files with 246 additions and 0 deletions
  1. 246 0
      models/combine_EPN.mvc

+ 246 - 0
models/combine_EPN.mvc

@@ -0,0 +1,246 @@
+include "primitives.alh"
+include "modelling.alh"
+include "object_operations.alh"
+
+A B {
+    Composite schedule {
+        {Contains} Success success {}
+        {Contains} Failure failure {}
+        {Contains} Atomic select {
+            LHS {
+                Pre_Encapsulated_PetriNet/Place pre_s_1 {
+                    label = "1"
+                }
+                Pre_Encapsulated_PetriNet/Port pre_s_2 {
+                    label = "2"
+                }
+                Pre_Encapsulated_PetriNet/PortPlace (pre_s_2, pre_s_1){
+                    label = "3"
+                }
+            }
+            RHS {
+                Post_Encapsulated_PetriNet/Place post_s_1 {
+                    label = "1"
+                }
+                Post_Encapsulated_PetriNet/Port post_s_2 {
+                    label = "2"
+                    value_selected = $
+                        Boolean function value(model : Element, name : String, mapping : Element):
+                            return True!
+                        $
+                }
+                Post_Encapsulated_PetriNet/PortPlace (post_s_2, post_s_1){
+                    label = "3"
+                }
+            }
+        }
+
+        {Contains} ForAll merge_P2T {
+            LHS {
+                Pre_Encapsulated_PetriNet/Place pre_p2t_1 {
+                    label = "1"
+                }
+                Pre_Encapsulated_PetriNet/Port pre_p2t_2 {
+                    label = "2"
+                }
+                Pre_Encapsulated_PetriNet/PortPlace (pre_p2t_2, pre_p2t_1){
+                    label = "3"
+                    constraint_selected = $
+                        Boolean function constraint(value : Boolean):
+                            return value!
+                        $
+                }
+                Pre_Encapsulated_PetriNet/Place pre_p2t_4 {
+                    label = "4"
+                }
+                Pre_Encapsulated_PetriNet/Port pre_p2t_5 {
+                    label = "5"
+                }
+                Pre_Encapsulated_PetriNet/PortPlace (pre_p2t_5, pre_p2t_4){
+                    label = "6"
+                }
+                Pre_Encapsulated_PetriNet/Transition pre_p2t_7 {
+                    label = "7"
+                }
+                Pre_Encapsulated_PetriNet/P2T (pre_p2t_4, pre_p2t_7) {
+                    label = "8"
+                }
+
+                constraint = $
+                    Boolean function constraint(model : Element, mapping : Element):
+                        return value_eq(read_attribute(model, mapping["2"], "name"), read_attribute(model, mapping["5"], "name"))!
+                    $
+            }
+            RHS {
+                Post_Encapsulated_PetriNet/Place post_p2t_1 {
+                    label = "1"
+                }
+                Post_Encapsulated_PetriNet/Port post_p2t_2 {
+                    label = "2"
+                }
+                Post_Encapsulated_PetriNet/PortPlace (post_p2t_2, post_p2t_1){
+                    label = "3"
+                }
+                Post_Encapsulated_PetriNet/Place post_p2t_4 {
+                    label = "4"
+                }
+                Post_Encapsulated_PetriNet/Port post_p2t_5 {
+                    label = "5"
+                }
+                Post_Encapsulated_PetriNet/PortPlace (post_p2t_5, post_p2t_4){
+                    label = "6"
+                }
+                Post_Encapsulated_PetriNet/Transition post_p2t_7 {
+                    label = "7"
+                }
+                Post_Encapsulated_PetriNet/P2T (post_p2t_4, post_p2t_7) {
+                    label = "8"
+                }
+                Post_Encapsulated_PetriNet/P2T (post_p2t_1, post_p2t_7) {
+                    label = "9"
+                }
+            }
+        }
+
+        {Contains} ForAll merge_T2P {
+            LHS {
+                Pre_Encapsulated_PetriNet/Place pre_p2t_1 {
+                    label = "1"
+                }
+                Pre_Encapsulated_PetriNet/Port pre_p2t_2 {
+                    label = "2"
+                }
+                Pre_Encapsulated_PetriNet/PortPlace (pre_p2t_2, pre_p2t_1){
+                    label = "3"
+                    constraint_selected = $
+                        Boolean function constraint(value : Boolean):
+                            return value!
+                        $
+                }
+                Pre_Encapsulated_PetriNet/Place pre_p2t_4 {
+                    label = "4"
+                }
+                Pre_Encapsulated_PetriNet/Port pre_p2t_5 {
+                    label = "5"
+                }
+                Pre_Encapsulated_PetriNet/PortPlace (pre_p2t_5, pre_p2t_4){
+                    label = "6"
+                }
+                Pre_Encapsulated_PetriNet/Transition pre_p2t_7 {
+                    label = "7"
+                }
+                Pre_Encapsulated_PetriNet/T2P (pre_p2t_7, pre_p2t_4) {
+                    label = "8"
+                }
+
+                constraint = $
+                    Boolean function constraint(model : Element, mapping : Element):
+                        return value_eq(read_attribute(model, mapping["2"], "name"), read_attribute(model, mapping["5"], "name"))!
+                    $
+            }
+            RHS {
+                Post_Encapsulated_PetriNet/Place post_p2t_1 {
+                    label = "1"
+                }
+                Post_Encapsulated_PetriNet/Port post_p2t_2 {
+                    label = "2"
+                }
+                Post_Encapsulated_PetriNet/PortPlace (post_p2t_2, post_p2t_1){
+                    label = "3"
+                }
+                Post_Encapsulated_PetriNet/Place post_p2t_4 {
+                    label = "4"
+                }
+                Post_Encapsulated_PetriNet/Port post_p2t_5 {
+                    label = "5"
+                }
+                Post_Encapsulated_PetriNet/PortPlace (post_p2t_5, post_p2t_4){
+                    label = "6"
+                }
+                Post_Encapsulated_PetriNet/Transition post_p2t_7 {
+                    label = "7"
+                }
+                Post_Encapsulated_PetriNet/T2P (post_p2t_7, post_p2t_4) {
+                    label = "8"
+                }
+                Post_Encapsulated_PetriNet/T2P (post_p2t_7, post_p2t_1) {
+                    label = "9"
+                }
+            }
+        }
+
+        {Contains} ForAll remove_old {
+            LHS {
+                Pre_Encapsulated_PetriNet/Place pre_rem_1 {
+                    label = "1"
+                }
+                Pre_Encapsulated_PetriNet/Port pre_rem_2 {
+                    label = "2"
+                }
+                Pre_Encapsulated_PetriNet/PortPlace (pre_rem_2, pre_rem_1){
+                    label = "3"
+                    constraint_selected = $
+                        Boolean function constraint(value : Boolean):
+                            return value!
+                        $
+                }
+                Pre_Encapsulated_PetriNet/Place pre_rem_4 {
+                    label = "4"
+                }
+                Pre_Encapsulated_PetriNet/Port pre_rem_5 {
+                    label = "5"
+                }
+                Pre_Encapsulated_PetriNet/PortPlace (pre_rem_5, pre_rem_4){
+                    label = "6"
+                }
+            }
+            RHS {
+                Post_Encapsulated_PetriNet/Place post_rem_1 {
+                    label = "1"
+                }
+                Post_Encapsulated_PetriNet/Port post_rem_2 {
+                    label = "2"
+                }
+                Post_Encapsulated_PetriNet/PortPlace (post_rem_2, post_rem_1){
+                    label = "3"
+                }
+            }
+        }
+
+        {Contains} Atomic unselect {
+            LHS {
+                Pre_Encapsulated_PetriNet/Place pre_uns_1 {
+                    label = "1"
+                }
+                Pre_Encapsulated_PetriNet/Port pre_uns_2 {
+                    label = "2"
+                }
+                Pre_Encapsulated_PetriNet/PortPlace (pre_uns_2, pre_uns_1){
+                    label = "3"
+                    constraint_selected = $
+                        Boolean function constraint(value : Boolean):
+                            return value!
+                        $
+                }
+            }
+            RHS {
+                Post_Encapsulated_PetriNet/Place post_uns_1 {
+                    label = "1"
+                }
+            }
+        }
+    }
+    Initial (schedule, select) {}
+
+    OnSuccess (select, merge_P2T) {}
+    OnSuccess (merge_P2T, merge_T2P) {}
+    OnSuccess (merge_T2P, remove_old) {}
+    OnSuccess (remove_old, unselect) {}
+    OnSuccess (unselect, select) {}
+    OnFailure (select, finish) {}
+
+    OnFailure (merge_P2T, merge_T2P) {}
+    OnFailure (merge_T2P, remove_old) {}
+    OnFailure (remove_old, unselect) {}
+    OnFailure (unselect, failure) {}
+}