Bläddra i källkod

Fixed combine_EPN for the use of architecture

Yentl Van Tendeloo 8 år sedan
förälder
incheckning
e368bc2987
2 ändrade filer med 62 tillägg och 149 borttagningar
  1. 61 146
      models/combine_EPN.mvc
  2. 1 3
      models/petrinet_ports.mvc

+ 61 - 146
models/combine_EPN.mvc

@@ -6,144 +6,101 @@ A B {
     Composite schedule {
         {Contains} Success success {}
         {Contains} Failure failure {}
-        {Contains} ForAll unselect_all {
-            LHS {
-                Pre_Encapsulated_PetriNet/Port pre_ua_1 {
-                    label = "1"
-                }
-            }
-            RHS {
-                Post_Encapsulated_PetriNet/Port post_ua_1 {
-                    label = "1"
-                    value_selected = $
-                        Boolean function value(model : Element, name : String, mapping : Element):
-                            return False!
-                        $
-                }
-            }
-        }
 
-        {Contains} Atomic select {
+        {Contains} ForAll link {
             LHS {
-                Pre_Encapsulated_PetriNet/Place pre_s_1 {
+                Pre_Architecture/Group pre_0{
+                    label = "0"
+                }
+                Pre_Architecture/Port pre_1{
                     label = "1"
                 }
-                Pre_Encapsulated_PetriNet/Port pre_s_0 {
-                    label = "0"
-                    constraint_selected = $
-                        Boolean function constraint(value : Boolean):
-                            return bool_not(value)!
-                        $
+                Pre_Architecture/Contains pre_10 (pre_0, pre_1){
+                    label = "10"
                 }
-                Pre_Encapsulated_PetriNet/PortPlace (pre_s_0, pre_s_1){
+                Pre_Encapsulated_PetriNet/Port pre_2{
                     label = "2"
                 }
-            }
-            NAC {
-                Pre_Encapsulated_PetriNet/Port nac_s_0 {
-                    label = "0"
-                }
-                Pre_Encapsulated_PetriNet/Port nac_s_3 {
+                Pre_Architecture/Group pre_3{
                     label = "3"
-                    constraint_selected = $
-                        Boolean function constraint(value : Boolean):
-                            return value!
-                        $
+                }
+                Pre_Architecture/Port pre_4{
+                    label = "4"
+                }
+                Pre_Architecture/Contains pre_11 (pre_3, pre_4){
+                    label = "11"
+                }
+                Pre_Encapsulated_PetriNet/Port pre_5{
+                    label = "5"
+                }
+                Pre_Encapsulated_PetriNet/Connects (pre_1, pre_4){
+                    label = "6"
                 }
 
                 constraint = $
-                    Boolean function constraint(model : Element, mapping : Element):
-                        return value_eq(read_attribute(model, mapping["0"], "name"), read_attribute(model, mapping["3"], "name"))!
+                    Boolean constraint(model : Element, mapping : Element):
+                        if bool_not(value_eq(read_attribute(model, mapping["2"], "name"), string_join(string_join(read_attribute(model, mapping["0"], "name"), "/"), read_attribute(model, mapping["1"], "name")))):
+                            return False!
+                        if bool_not(value_eq(read_attribute(model, mapping["5"], "name"), string_join(string_join(read_attribute(model, mapping["3"], "name"), "/"), read_attribute(model, mapping["4"], "name")))):
+                            return False!
+                        return True!
                     $
             }
             RHS {
-                Post_Encapsulated_PetriNet/Place post_s_1 {
-                    label = "1"
-                }
-                Post_Encapsulated_PetriNet/Port post_s_0 {
+                Post_Architecture/Group post_0{
                     label = "0"
-                    value_selected = $
-                        Boolean function value(model : Element, name : String, mapping : Element):
-                            return True!
-                        $
-                }
-                Post_Encapsulated_PetriNet/PortPlace (post_s_0, post_s_1){
-                    label = "2"
                 }
-            }
-        }
-
-        {Contains} ForAll link {
-            LHS {
-                Pre_Encapsulated_PetriNet/Port pre_link_1 {
+                Post_Architecture/Port post_1{
                     label = "1"
-                    constraint_selected = $
-                        Boolean function constraint(value : Boolean):
-                            return value!
-                        $
-                    constraint = $
-                        Boolean function constraint(model : Element, name : String):
-                            return (read_nr_out(allOutgoingAssociationInstances(model, name, "Encapsulated_PetriNet/Related")) == 0)!
-                        $
                 }
-                Pre_Encapsulated_PetriNet/Port pre_link_2 {
+                Post_Architecture/Contains post_10 (post_0, post_1){
+                    label = "10"
+                }
+                Post_Encapsulated_PetriNet/Port post_2{
                     label = "2"
-                    constraint_selected = $
-                        Boolean function constraint(value : Boolean):
-                            return bool_not(value)!
-                        $
                 }
-                Pre_Encapsulated_PetriNet/Place pre_link_4 {
+                Post_Architecture/Group post_3{
+                    label = "3"
+                }
+                Post_Architecture/Port post_4{
                     label = "4"
                 }
-                Pre_Encapsulated_PetriNet/Place pre_link_5 {
+                Post_Architecture/Contains post_11 (post_3, post_4){
+                    label = "11"
+                }
+                Post_Encapsulated_PetriNet/Port post_5{
                     label = "5"
                 }
-                Pre_Encapsulated_PetriNet/PortPlace (pre_link_1, pre_link_4) {
+                Post_Encapsulated_PetriNet/Connects (post_1, post_4){
                     label = "6"
                 }
-                Pre_Encapsulated_PetriNet/PortPlace (pre_link_2, pre_link_5) {
+                Post_Encapsulated_PetriNet/Related (post_2, post_5){
                     label = "7"
                 }
-
-                constraint = $
-                    Boolean function constraint(model : Element, mapping : Element):
-                        return value_eq(read_attribute(model, mapping["1"], "name"), read_attribute(model, mapping["2"], "name"))!
-                    $
             }
-            RHS {
-                Post_Encapsulated_PetriNet/Port post_link_1 {
+        }
+
+        {Contains} ForAll remove_old {
+            LHS {
+                Pre_Encapsulated_PetriNet/Port pre_0 {
+                    label = "0"
+                }
+                Pre_Encapsulated_PetriNet/Port pre_1 {
                     label = "1"
                 }
-                Post_Encapsulated_PetriNet/Port post_link_2 {
+                Pre_Encapsulated_PetriNet/Place pre_2 {
                     label = "2"
                 }
-                Post_Encapsulated_PetriNet/Related (post_link_1, post_link_2) {
+                Pre_Encapsulated_PetriNet/Related (pre_0, pre_1) {
                     label = "3"
                 }
-
-                Post_Encapsulated_PetriNet/Place post_link_4 {
+                Pre_Encapsulated_PetriNet/PortPlace (pre_1, pre_2) {
                     label = "4"
-                    value_tokens = $
-                        Integer function value(model : Element, name : String, mapping : Element):
-                            Integer tokens_4
-                            Integer tokens_5
-                            tokens_4 = read_attribute(model, mapping["4"], "tokens")
-                            tokens_5 = read_attribute(model, mapping["5"], "tokens")
-                            if (bool_or(tokens_4 > 0, tokens_5 > 0)):
-                                return 1!
-                            else:
-                                return 0!
-                        $
                 }
-                Post_Encapsulated_PetriNet/Place post_link_5 {
-                    label = "5"
-                }
-                Post_Encapsulated_PetriNet/PortPlace (post_link_1, post_link_4) {
-                    label = "6"
-                }
-                Post_Encapsulated_PetriNet/PortPlace (post_link_2, post_link_5) {
-                    label = "7"
+            }
+            RHS {
+                Post_Encapsulated_PetriNet/Port {
+                    label = "0"
                 }
             }
         }
@@ -155,10 +112,6 @@ A B {
                 }
                 Pre_Encapsulated_PetriNet/Port pre_p2t_2 {
                     label = "2"
-                    constraint_selected = $
-                        Boolean function constraint(value : Boolean):
-                            return value!
-                        $
                 }
                 Pre_Encapsulated_PetriNet/PortPlace (pre_p2t_2, pre_p2t_1){
                     label = "3"
@@ -168,10 +121,6 @@ A B {
                 }
                 Pre_Encapsulated_PetriNet/Port pre_p2t_5 {
                     label = "5"
-                    constraint_selected = $
-                        Boolean function constraint(value : Boolean):
-                            return bool_not(value)!
-                        $
                 }
                 Pre_Encapsulated_PetriNet/PortPlace (pre_p2t_5, pre_p2t_4){
                     label = "6"
@@ -227,10 +176,6 @@ A B {
                 }
                 Pre_Encapsulated_PetriNet/Port pre_t2p_2 {
                     label = "2"
-                    constraint_selected = $
-                        Boolean function constraint(value : Boolean):
-                            return value!
-                        $
                 }
                 Pre_Encapsulated_PetriNet/PortPlace (pre_t2p_2, pre_t2p_1){
                     label = "3"
@@ -240,10 +185,6 @@ A B {
                 }
                 Pre_Encapsulated_PetriNet/Port pre_t2p_5 {
                     label = "5"
-                    constraint_selected = $
-                        Boolean function constraint(value : Boolean):
-                            return bool_not(value)!
-                        $
                 }
                 Pre_Encapsulated_PetriNet/PortPlace (pre_t2p_5, pre_t2p_4){
                     label = "6"
@@ -293,26 +234,6 @@ A B {
             }
         }
 
-        {Contains} ForAll remove_old {
-            LHS {
-                Pre_Encapsulated_PetriNet/Place pre_rem_1 {
-                    label = "1"
-                }
-                Pre_Encapsulated_PetriNet/Port pre_rem_2 {
-                    label = "2"
-                    constraint_selected = $
-                        Boolean function constraint(value : Boolean):
-                            return bool_not(value)!
-                        $
-                }
-                Pre_Encapsulated_PetriNet/PortPlace (pre_rem_2, pre_rem_1){
-                    label = "3"
-                }
-            }
-            RHS {
-            }
-        }
-
         {Contains} ForAll copy_transitions {
             LHS {
                 Pre_Encapsulated_PetriNet/Transition {
@@ -473,16 +394,10 @@ A B {
         }
     }
 
-    Initial (schedule, unselect_all) {}
-
-    OnSuccess (unselect_all, select) {}
-    OnFailure (unselect_all, select) {}
-
-    OnSuccess (select, link) {}
-    OnFailure (select, merge_P2T) {}
+    Initial (schedule, link) {}
 
-    OnSuccess (link, select) {}
-    OnFailure (link, select) {}
+    OnSuccess (link, merge_P2T) {}
+    OnFailure (link, merge_P2T) {}
 
     OnSuccess (merge_P2T, merge_T2P) {}
     OnFailure (merge_P2T, merge_T2P) {}

+ 1 - 3
models/petrinet_ports.mvc

@@ -30,9 +30,7 @@ SimpleClassDiagrams PetriNetsPorts {
         tokens : Natural
     }
     Class Transition : Named {}
-    Class Port : Named {
-        selected? : Boolean
-    }
+    Class Port : Named {}
 
     Association P2T (Place, Transition) {}
     Association T2P (Transition, Place) {}