瀏覽代碼

Make the rules_per_phase work, in combination with stopping on failure

Yentl Van Tendeloo 9 年之前
父節點
當前提交
823a943fc9
共有 1 個文件被更改,包括 5 次插入1 次删除
  1. 5 1
      model/model.py

+ 5 - 1
model/model.py

@@ -246,7 +246,11 @@ class ModelverseKernel(AtomicDEVS):
                 elif self.state.phase == "input":
                     self.state.phase = "computation"
                 elif self.state.phase == "computation":
-                    self.state.phase = "output"
+                    if not self.state.mvk.success or (self.state.execution_counter > self.rules_per_phase):
+                        self.state.phase = "output"
+                        self.state.execution_counter = 0
+                    else:
+                        self.state.execution_counter += 1
                 elif self.state.phase == "output":
                     self.state.users.pop(0)
                     self.state.phase = "init_user"