Procházet zdrojové kódy

Possibly fixed the DEVS model (runs in ~50 minutes)

Yentl Van Tendeloo před 7 roky
rodič
revize
e88f2dbbf5
4 změnil soubory, kde provedl 13 přidání a 11 odebrání
  1. binární
      bootstrap/bootstrap.m.gz
  2. 4 4
      bootstrap/transform.alc
  3. 8 6
      model/model.py
  4. 1 1
      model/operations

binární
bootstrap/bootstrap.m.gz


+ 4 - 4
bootstrap/transform.alc

@@ -299,7 +299,7 @@ Element function match(host_model : Element, schedule_model : Element, LHS : Str
 	set_add_node(mappings, initial_mapping)
 	while (list_len(schedule) > 0):
 		current_element = list_pop(schedule, list_len(schedule) - 1)
-		//log("Binding element with label " + cast_value(read_attribute(schedule_model, current_element, "label")))
+		log("Binding element with label " + cast_value(read_attribute(schedule_model, current_element, "label")))
 		new_mappings = dict_create()
 
 		while (set_len(mappings) > 0):
@@ -313,7 +313,7 @@ Element function match(host_model : Element, schedule_model : Element, LHS : Str
 				set_add_node(new_mappings, new_map)
 
 		mappings = new_mappings
-		//log("Remaining options: " + cast_value(set_len(mappings)))
+		log("Remaining options: " + cast_value(set_len(mappings)))
 
 		if (set_len(mappings) == 0):
 			// Stop because we have no more options remaining!
@@ -554,7 +554,7 @@ Boolean function transform_forall(host_model : Element, schedule_model : Element
 	Element mapping
 	Boolean result
 
-	//log("Executing rule: " + current)
+	log("Executing rule: " + current)
 
 	mappings = full_match(host_model, schedule_model, current, False)
 
@@ -563,7 +563,7 @@ Boolean function transform_forall(host_model : Element, schedule_model : Element
 	else:
 		result = False
 
-	//log("Matches in forall: " + cast_string(set_len(mappings)))
+	log("Matches in forall: " + cast_string(set_len(mappings)))
 	while (set_len(mappings) > 0):
 		mapping = set_pop(mappings)
 		RHS = set_pop(allAssociationDestinations(schedule_model, current, "RHSLink"))

+ 8 - 6
model/model.py

@@ -432,7 +432,6 @@ class ModelverseInterface(AtomicDEVS):
                     print("Adding 3 empty lists")
                     self.state.operations.insert(0, None)
                     self.state.operations.insert(0, None)
-                    self.state.operations.insert(0, None)
                 elif prev_output.startswith("Finished task: "):
                     self.state.blocked = True
                 elif " : " in prev_output:
@@ -444,7 +443,10 @@ class ModelverseInterface(AtomicDEVS):
                     # NOTE We now know that there is something to do on an other task, so we just wait for that event to come in
                     self.state.operations.insert(0, None)
                     self.state.operations.insert(0, None)
-                    self.state.operations.insert(0, None)
+                elif prev_output == "Success":
+                    print("Remaining operations: " + str(self.state.operations))
+                    self.state.operations.pop(0)
+                    self.state.blocked = False
                 else:
                     print("UNKNOWN: " + str(prev_output))
 
@@ -526,7 +528,7 @@ class Network(AtomicDEVS):
     def intTransition(self):
         self.state.processing.pop(0)
         if self.state.processing:
-            self.state.timer = (len(self.state.processing[0]) * 8 / float(self.bandwidth) + self.latency)
+            self.state.timer = (len(json.dumps(self.state.processing[0])) * 8 / float(self.bandwidth) + self.latency)
         else:
             self.state.timer = float("inf")
         return self.state
@@ -536,14 +538,14 @@ class Network(AtomicDEVS):
         if self.state.timer == float("inf"):
             self.state.timer = 0
         for v in inputs[self.input_port]:
-            self.state.processing.append(json.dumps(v))
+            self.state.processing.append(v)
             # NOTE data is in bytes, while bandwidth is in bits, so multiply by 8
         if len(self.state.processing) > 0:
-            self.state.timer = (len(self.state.processing[0]) * 8 / float(self.bandwidth) + self.latency)
+            self.state.timer = (len(json.dumps(self.state.processing[0])) * 8 / float(self.bandwidth) + self.latency)
         return self.state
 
     def outputFnc(self):
-        return {self.output_port: [json.loads(self.state.processing[0])]}
+        return {self.output_port: [self.state.processing[0]]}
 
     def timeAdvance(self):
         #print("Timer: " + str(self.state.timer))

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 1 - 1
model/operations