浏览代码

Model works and seems decently calibrated

Yentl Van Tendeloo 7 年之前
父节点
当前提交
01576190f1
共有 3 个文件被更改,包括 17 次插入11 次删除
  1. 15 9
      model/model.py
  2. 1 1
      model/operations
  3. 1 1
      wrappers/modelverse_SCCD.py

+ 15 - 9
model/model.py

@@ -723,12 +723,18 @@ with open("calibration/averages", 'r') as param_file:
         op = op.strip()
         args[op] = float(t)
 
-model = System(**args)
-sim = Simulator(model)
-sim.setTerminationCondition(lambda t, m: m.mvi.state.finished)
-#sim.setVerbose()
-start = time.time()
-tn = sim.simulate()
-
-print("Simulation time %s" % tn)
-print("Execution time %s" % (time.time() - start))
+def simulate(supplied_args):
+    local_args = dict(args)
+    local_args.update(supplied_args)
+    model = System(**local_args)
+    sim = Simulator(model)
+    sim.setTerminationCondition(lambda t, m: m.mvi.state.finished)
+    #sim.setVerbose()
+    start = time.time()
+    tn = sim.simulate()
+    return (tn, time.time() - start)
+
+if __name__ == "__main__":
+    ts, te = simulate({})
+    print("Simulation time %s" % ts)
+    print("Execution time %s" % te)

文件差异内容过多而无法显示
+ 1 - 1
model/operations


+ 1 - 1
wrappers/modelverse_SCCD.py

@@ -1,7 +1,7 @@
 """
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Jan  4 15:09:18 2018
+Date:   Thu Jan  4 15:47:25 2018
 
 Model author: Yentl Van Tendeloo
 Model name:   MvK Server