Ver código fonte

Added fix_interrupt_self rule and fixed some problems

Yentl Van Tendeloo 8 anos atrás
pai
commit
d6916d48ab
1 arquivos alterados com 121 adições e 14 exclusões
  1. 121 14
      models/control_to_EPN.mvc

+ 121 - 14
models/control_to_EPN.mvc

@@ -428,10 +428,8 @@ All_RAM Control2EPN {
                 Pre_Control_PW/Transition (pre_co_0, pre_co_1) {
                     label = "2"
                     constraint_objDetected = $
-                        Boolean constraint(host_model : Element, name : String):
-                            String t
-                            t = read_attribute(host_model, name, "objDetected")
-                            return (bool_or(t == "Y", t == "N"))!
+                        Boolean constraint(value : String):
+                            return (bool_or(value == "Y", value == "N"))!
                         $
                 }
                 Pre_Encapsulated_PetriNet/Place pre_co_3 {
@@ -452,10 +450,8 @@ All_RAM Control2EPN {
                 Pre_Encapsulated_PetriNet/Port pre_co_11 {
                     label = "11"
                     constraint_name = $
-                        Boolean constraint(host_model : Element, name : String):
-                            String t
-                            t = read_attribute(host_model, name, "name")
-                            return (bool_or(t == "objDetected", t == "no_objDetected"))!
+                        Boolean constraint(value : String):
+                            return (bool_or(value == "objDetected", value == "no_objDetected"))!
                         $
                 }
                 Pre_Encapsulated_PetriNet/PortPlace (pre_co_11, pre_co_8) {
@@ -542,8 +538,12 @@ All_RAM Control2EPN {
                 Pre_Control_PW/State pre_fi_0 {
                     label = "0"
                 }
-                Pre_Control_PW/ErrorState pre_fi_1 {
+                Pre_Control_PW/State pre_fi_1 {
                     label = "1"
+                    constraint_isError = $
+                        Boolean constraint(value : Boolean):
+                            return value!
+                        $
                 }
                 Pre_Encapsulated_PetriNet/Place pre_fi_2 {
                     label = "2"
@@ -572,10 +572,8 @@ All_RAM Control2EPN {
                 Pre_Encapsulated_PetriNet/Port pre_fi_15 {
                     label = "15"
                     constraint_name = $
-                        Boolean constraint(host_model : Element, name : String):
-                            String t
-                            t = read_attribute(host_model, name, "name")
-                            return (t == "interrupt")!
+                        Boolean constraint(value : String):
+                            return (value == "interrupt")!
                         $
                 }
                 Pre_Encapsulated_PetriNet/PortPlace (pre_fi_15, pre_fi_6) {
@@ -604,8 +602,12 @@ All_RAM Control2EPN {
                 Post_Control_PW/State post_fi_0 {
                     label = "0"
                 }
-                Post_Control_PW/ErrorState post_fi_1 {
+                Post_Control_PW/State post_fi_1 {
                     label = "1"
+                    constraint_isError = $
+                        Boolean constraint(value : Boolean):
+                            return value!
+                        $
                 }
                 Post_Encapsulated_PetriNet/Place post_fi_2 {
                     label = "2"
@@ -653,6 +655,111 @@ All_RAM Control2EPN {
                     label = "11"
                 }
 
+        {Contains} ForAll fix_interrupt_self {
+            LHS {
+                Pre_Control_PW/State pre_fis_0 {
+                    label = "0"
+                    constraint_isError = $
+                        Boolean constraint(value : Boolean):
+                            return value!
+                        $
+                }
+                Pre_Encapsulated_PetriNet/Place pre_fis_1 {
+                    label = "1"
+                }
+                Pre_CTRL2EPN_link (pre_fis_0, pre_fis_1) {
+                    label = "2"
+                }
+
+                Pre_Encapsulated_PetriNet/Place pre_fis_3 {
+                    label = "3"
+                }
+                Pre_Encapsulated_PetriNet/Port pre_fis_4 {
+                    label = "4"
+                    constraint_name = $
+                        Boolean constraint(value : String):
+                            return (value == "interrupt")!
+                        $
+                }
+                Pre_Encapsulated_PetriNet/PortPlace (pre_fis_4, pre_fis_3) {
+                    label = "5"
+                }
+
+                Pre_Encapsulated_PetriNet/Place pre_fis_6 {
+                    label = "6"
+                }
+                Pre_Encapsulated_PetriNet/Port pre_fis_7 {
+                    label = "7"
+                }
+                Pre_Encapsulated_PetriNet/PortPlace (pre_fis_7, pre_fis_6) {
+                    label = "8"
+                }
+
+                constraint = $
+                    Boolean constraint (host_model : Element, mapping : Element):
+                        // Check whether the bound primary places match with the state
+                        String s_err_type
+                        String p_name
+                        s_err_type = read_type(host_model, mapping["0"])
+                        p_name = read_attribute(host_model, mapping["7"], "name")
+
+                        if (s_err_type == "Up"):
+                            return (p_name == "up")!
+                        elif (s_err_type == "Neutral"):
+                            return (p_name == "neutral")!
+                        elif (s_err_type == "Down"):
+                            return (p_name == "down")!
+                        else:
+                            return False!
+                    $
+            }
+            RHS {
+                Post_Control_PW/State post_fis_0 {
+                    label = "0"
+                }
+                Post_Encapsulated_PetriNet/Place post_fis_1 {
+                    label = "1"
+                }
+                Post_CTRL2EPN_link (post_fis_0, post_fis_1) {
+                    label = "2"
+                }
+
+                Post_Encapsulated_PetriNet/Place post_fis_3 {
+                    label = "3"
+                }
+                Post_Encapsulated_PetriNet/Port post_fis_4 {
+                    label = "4"
+                }
+                Post_Encapsulated_PetriNet/PortPlace (post_fis_4, post_fis_3) {
+                    label = "5"
+                }
+
+                Post_Encapsulated_PetriNet/Place post_fis_6 {
+                    label = "6"
+                }
+                Post_Encapsulated_PetriNet/Port post_fis_7 {
+                    label = "7"
+                }
+                Post_Encapsulated_PetriNet/PortPlace (post_fis_7, post_fis_6) {
+                    label = "8"
+                }
+
+                Post_Encapsulated_PetriNet/Transition post_fis_9 {
+                    label = "9"
+                }
+                Post_Encapsulated_PetriNet/P2T (post_fis_3, post_fis_9) {
+                    label = "10"
+                }
+                Post_Encapsulated_PetriNet/T2P (post_fis_9, post_fis_6) {
+                    label = "11"
+                }
+                Post_Encapsulated_PetriNet/P2T (post_fis_1, post_fis_9) {
+                    label = "12"
+                }
+                Post_Encapsulated_PetriNet/T2P (post_fis_9, post_fis_1) {
+                    label = "13"
+                }
+
             }
         }
     }