Selaa lähdekoodia

Added basis for control_to_EPN (which is now just a copy of
pn_design_to_runtime)

Yentl Van Tendeloo 8 vuotta sitten
vanhempi
commit
7c8ab47990
2 muutettua tiedostoa jossa 188 lisäystä ja 0 poistoa
  1. 182 0
      models/control_to_EPN.mvc
  2. 6 0
      models/initialize.mvc

+ 182 - 0
models/control_to_EPN.mvc

@@ -0,0 +1,182 @@
+include "primitives.alh"
+include "modelling.alh"
+
+All_RAM Control2EPN {
+    Composite schedule {
+        {Contains} Failure failure {}
+        {Contains} Success success {}
+        {Contains} ForAll copy_events {
+            LHS {
+                Pre_Control_PW/Transition {
+                    label = "0"
+                }
+            }
+            RHS {
+                Post_Control_PW/Transition ct1 {
+                    label = "0"
+                }
+                Post_PetriNets_Runtime/Transition ct2 {
+                    label = "1"
+                    value_executing = $
+                        Boolean function value(model : Element, name : String, mapping : Element):
+                            return True!
+                        $
+                    value_name = $
+                        Integer function value(model : Element, name : String, mapping : Element):
+                            return read_attribute(model, mapping["0"], "name")!
+                        $
+                }
+                Post_D2R_TransitionLink (ct1, ct2){
+                    label = "2"
+                }
+            }
+        }
+        {Contains} ForAll copy_places {
+            LHS {
+                Pre_PetriNets/Place {
+                    label = "0"
+                }
+            }
+            RHS {
+                Post_PetriNets/Place cp1 {
+                    label = "0"
+                }
+                Post_PetriNets_Runtime/Place cp2 {
+                    label = "1"
+                    value_tokens = $
+                        Integer function value(model : Element, name : String, mapping : Element):
+                            return read_attribute(model, mapping["0"], "tokens")!
+                        $
+                    value_name = $
+                        Integer function value(model : Element, name : String, mapping : Element):
+                            return read_attribute(model, mapping["0"], "name")!
+                        $
+                }
+                Post_D2R_PlaceLink (cp1, cp2){
+                    label = "2"
+                }
+            }
+        }
+        {Contains} ForAll copy_P2T {
+            LHS {
+                Pre_PetriNets/Place cp2t_p{
+                    label = "0"
+                }
+                Pre_PetriNets/Transition cp2t_t{
+                    label = "1"
+                }
+                Pre_PetriNets/P2T (cp2t_p, cp2t_t){
+                    label = "2"
+                }
+                Pre_PetriNets_Runtime/Place cp2t_p2{
+                    label = "3"
+                }
+                Pre_PetriNets_Runtime/Transition cp2t_t2{
+                    label = "4"
+                }
+                Pre_D2R_PlaceLink (cp2t_p, cp2t_p2){
+                    label = "5"
+                }
+                Pre_D2R_TransitionLink (cp2t_t, cp2t_t2){
+                    label = "6"
+                }
+            }
+            RHS {
+                Post_PetriNets/Place rhs_cp2t_p{
+                    label = "0"
+                }
+                Post_PetriNets/Transition rhs_cp2t_t{
+                    label = "1"
+                }
+                Post_PetriNets/P2T rhs_cp2t_p2t (rhs_cp2t_p, rhs_cp2t_t){
+                    label = "2"
+                }
+                Post_PetriNets_Runtime/Place rhs_cp2t_p2 {
+                    label = "3"
+                }
+                Post_PetriNets_Runtime/Transition rhs_cp2t_t2 {
+                    label = "4"
+                }
+                Post_D2R_PlaceLink (rhs_cp2t_p, rhs_cp2t_p2){
+                    label = "5"
+                }
+                Post_D2R_TransitionLink (rhs_cp2t_t, rhs_cp2t_t2){
+                    label = "6"
+                }
+                Post_PetriNets_Runtime/P2T rhs_cp2t_p2t2(rhs_cp2t_p2, rhs_cp2t_t2) {
+                    label = "7"
+                    value_weight = $
+                        Integer function value(host_model : Element, name : String, mapping : Element):
+                            return read_attribute(host_model, mapping["2"], "weight")!
+                        $
+                }
+            }
+        }
+        {Contains} ForAll copy_T2P {
+            LHS {
+                Pre_PetriNets/Place ct2p_p{
+                    label = "0"
+                }
+                Pre_PetriNets/Transition ct2p_t{
+                    label = "1"
+                }
+                Pre_PetriNets/T2P (ct2p_t, ct2p_p){
+                    label = "2"
+                }
+                Pre_PetriNets_Runtime/Place ct2p_p2{
+                    label = "3"
+                }
+                Pre_PetriNets_Runtime/Transition ct2p_t2{
+                    label = "4"
+                }
+                Pre_D2R_PlaceLink (ct2p_p, ct2p_p2){
+                    label = "5"
+                }
+                Pre_D2R_TransitionLink (ct2p_t, ct2p_t2){
+                    label = "6"
+                }
+            }
+            RHS {
+                Post_PetriNets/Place rhs_ct2p_p{
+                    label = "0"
+                }
+                Post_PetriNets/Transition rhs_ct2p_t{
+                    label = "1"
+                }
+                Post_PetriNets/T2P (rhs_ct2p_t, rhs_ct2p_p){
+                    label = "2"
+                }
+                Post_PetriNets_Runtime/Place rhs_ct2p_p2 {
+                    label = "3"
+                }
+                Post_PetriNets_Runtime/Transition rhs_ct2p_t2 {
+                    label = "4"
+                }
+                Post_D2R_PlaceLink (rhs_ct2p_p, rhs_ct2p_p2){
+                    label = "5"
+                }
+                Post_D2R_TransitionLink (rhs_ct2p_t, rhs_ct2p_t2){
+                    label = "6"
+                }
+                Post_PetriNets_Runtime/T2P (rhs_ct2p_t2, rhs_ct2p_p2) {
+                    label = "7"
+                    value_weight = $
+                        Integer function value(host_model : Element, name : String, mapping : Element):
+                            return read_attribute(host_model, mapping["2"], "weight")!
+                        $
+                }
+            }
+        }
+    }
+    OnSuccess (copy_places, copy_transitions) {}
+    OnSuccess (copy_transitions, copy_P2T) {}
+    OnSuccess (copy_P2T, copy_T2P) {}
+    OnSuccess (copy_T2P, success) {}
+    OnFailure (copy_places, copy_transitions) {}
+    OnFailure (copy_transitions, copy_P2T) {}
+    OnFailure (copy_P2T, copy_T2P) {}
+    OnFailure (copy_T2P, success) {}
+    Initial (schedule, copy_places) {}
+}
+
+export annotate to models/pn_annotate

+ 6 - 0
models/initialize.mvc

@@ -0,0 +1,6 @@
+PetriNets_RAM initialize {
+    Composite schedule {
+        {Contains} Success success {}
+    }
+    Initial (schedule, success) {}
+}