Pārlūkot izejas kodu

Fixed Plant 2 EPN, which is now seemingly working

Yentl Van Tendeloo 8 gadi atpakaļ
vecāks
revīzija
9b761d6753
3 mainītis faili ar 84 papildinājumiem un 5 dzēšanām
  1. 0 4
      bootstrap/transform.alc
  2. 11 0
      models/epn_print.alc
  3. 73 1
      models/plant_model.mvc

+ 0 - 4
bootstrap/transform.alc

@@ -113,9 +113,6 @@ Element function get_possible_bindings(host_model : Element, schedule_model : El
 
 		ic = allIncomingAssociationInstances(schedule_model, current_element, "PreElement")
 		oc = allOutgoingAssociationInstances(schedule_model, current_element, "PreElement")
-		log("Finding throughout ")
-		log(set_to_string(ic))
-		log(set_to_string(oc))
 
 		String value
 		while (bool_and(read_nr_out(ic) > 0, read_nr_out(options) < 2)):
@@ -134,7 +131,6 @@ Element function get_possible_bindings(host_model : Element, schedule_model : El
 				if (bool_not(set_in(options, value))):
 					set_add(options, value)
 
-		log("Result: " + set_to_string(options))
 		if (read_nr_out(options) == 0):
 			// Is a node and no connections, so we just pick all options
 			options = allInstances(host_model, original_typename)

+ 11 - 0
models/epn_print.alc

@@ -10,6 +10,8 @@ Element function pn_print(params : Element, output_mms : Element):
 	String place
 	String name
 	Integer tokens
+	Element all_t
+	String t
 
 	log("Places:")
 	all_places = allInstances(model, "Place")
@@ -28,6 +30,15 @@ Element function pn_print(params : Element, output_mms : Element):
 
 		log("  " + name)
 
+		all_t = allIncomingAssociationInstances(model, place, "P2T")
+		while (read_nr_out(all_t) > 0):
+			t = set_pop(all_t)
+			log("    <-- " + cast_v2s(read_attribute(model, readAssociationSource(model, t), "name")))
+		all_t = allOutgoingAssociationInstances(model, place, "T2P")
+		while (read_nr_out(all_t) > 0):
+			t = set_pop(all_t)
+			log("    --> " + cast_v2s(read_attribute(model, readAssociationDestination(model, t), "name")))
+
 	log("Ports:")
 	all_places = allInstances(model, "Port")
 	while (read_nr_out(all_places) > 0):

+ 73 - 1
models/plant_model.mvc

@@ -1,7 +1,19 @@
 B C{
+    PW_Plant/NormalState lt {
+        name = "low_top"
+        isInitial = False
+    }
+    PW_Plant/NormalState mt {
+        name = "medium_top"
+        isInitial = False
+    }
+    PW_Plant/NormalState ht {
+        name = "high_top"
+        isInitial = False
+    }
     PW_Plant/NormalState lm {
         name = "low_medium"
-        isInitial = True
+        isInitial = False
     }
     PW_Plant/ErrorState mm {
         name = "medium_medium"
@@ -11,25 +23,85 @@ B C{
         name = "high_medium"
         isInitial = False
     }
+    PW_Plant/NormalState lb {
+        name = "low_bottom"
+        isInitial = False
+    }
+    PW_Plant/NormalState mb {
+        name = "medium_bottom"
+        isInitial = False
+    }
+    PW_Plant/NormalState hb {
+        name = "high_bottom"
+        isInitial = True
+    }
 
+    PW_Plant/OnUp (hb, mb) {
+        objPresent = "*"
+    }
+    PW_Plant/OnUp (mb, lb) {
+        objPresent = "*"
+    }
+    PW_Plant/OnUp (lb, lm) {
+        objPresent = "*"
+    }
+    PW_Plant/OnUp (lm, lt) {
+        objPresent = "N"
+    }
     PW_Plant/OnUp (lm, mm) {
         objPresent = "Y"
     }
     PW_Plant/OnUp (mm, hm) {
         objPresent = "Y"
     }
+    PW_Plant/OnUp (lt, mt) {
+        objPresent = "*"
+    }
+    PW_Plant/OnUp (mt, ht) {
+        objPresent = "*"
+    }
 
+    PW_Plant/OnDown (ht, mt) {
+        objPresent = "*"
+    }
+    PW_Plant/OnDown (mt, lt) {
+        objPresent = "*"
+    }
+    PW_Plant/OnDown (lt, lm) {
+        objPresent = "*"
+    }
     PW_Plant/OnDown (hm, mm) {
         objPresent = "*"
     }
     PW_Plant/OnDown (mm, lm) {
         objPresent = "*"
     }
+    PW_Plant/OnDown (lm, lb) {
+        objPresent = "*"
+    }
+    PW_Plant/OnDown (lb, mb) {
+        objPresent = "*"
+    }
+    PW_Plant/OnDown (mb, hb) {
+        objPresent = "*"
+    }
 
+    PW_Plant/OnNeutral (hb, mb) {
+        objPresent = "*"
+    }
+    PW_Plant/OnNeutral (mb, lb) {
+        objPresent = "*"
+    }
     PW_Plant/OnNeutral (mm, lm) {
         objPresent = "*"
     }
     PW_Plant/OnNeutral (hm, mm) {
         objPresent = "*"
     }
+    PW_Plant/OnNeutral (ht, mt) {
+        objPresent = "*"
+    }
+    PW_Plant/OnNeutral (mt, lt) {
+        objPresent = "*"
+    }
 }