Browse Source

Fix live modelling GUI for CBDs

Yentl Van Tendeloo 8 years ago
parent
commit
8d7e56b846
3 changed files with 7 additions and 7 deletions
  1. 5 5
      interface/simple_plot/main.py
  2. 1 1
      models/upload_models.py
  3. 1 1
      wrappers/modelverse_SCCD.py

+ 5 - 5
interface/simple_plot/main.py

@@ -1,6 +1,6 @@
+import sys
 import matplotlib.pyplot as plt
 import matplotlib.pyplot as plt
 import json
 import json
-from matplotlib.animation import FuncAnimation
 import threading
 import threading
 
 
 def read_data():
 def read_data():
@@ -16,7 +16,8 @@ plt.ion()
 plt.figure()
 plt.figure()
 
 
 old_time, d = read_data()
 old_time, d = read_data()
-l = raw_input()
+plt.pause(0.01)
+l = sys.stdin.readline()
 time, _ = l.split(" ", 1)
 time, _ = l.split(" ", 1)
 time = float(time)
 time = float(time)
 
 
@@ -38,13 +39,12 @@ while 1:
         l = first
         l = first
         first = None
         first = None
     else:
     else:
-        l = raw_input()
+        l = sys.stdin.readline()
 
 
     if l == "CLOSE":
     if l == "CLOSE":
         import sys
         import sys
         sys.exit(0)
         sys.exit(0)
     elif l == "ALGEBRAIC_LOOP":
     elif l == "ALGEBRAIC_LOOP":
-        print("Algebraic loop discovered...")
         continue
         continue
     time, key, value = l.split(" ")
     time, key, value = l.split(" ")
     time = float(time)
     time = float(time)
@@ -63,5 +63,5 @@ while 1:
     maps[key].set_xdata(d[key][0])
     maps[key].set_xdata(d[key][0])
     maps[key].set_ydata(d[key][1])
     maps[key].set_ydata(d[key][1])
     plt.gca().set_xlim([min(d[key][0]), max(d[key][0])])
     plt.gca().set_xlim([min(d[key][0]), max(d[key][0])])
-    plt.draw()
+    plt.pause(0.01)
     write_data((0.0, d))
     write_data((0.0, d))

+ 1 - 1
models/upload_models.py

@@ -42,7 +42,7 @@ def modify_model(model):
     attr_assign(model, new_block, "name", "MyProbeBlock")
     attr_assign(model, new_block, "name", "MyProbeBlock")
     print("Added new probeblock: " + new_block)
     print("Added new probeblock: " + new_block)
 
 
-process_execute("models/live_modelling_CBD", {"design_model": "models/CBD_spring", "partial_runtime_model": "models/cbd_empty_partial", "full_runtime_model": "models/cbd_empty_full"}, {"models/CBD/edit": modify_model})
+#process_execute("models/live_modelling_CBD", {"design_model": "models/CBD_spring", "partial_runtime_model": "models/cbd_empty_partial", "full_runtime_model": "models/cbd_empty_full"}, {"models/CBD/edit": modify_model})
 
 
 """
 """
 model_add("formalisms/PW_Plant", "formalisms/SimpleClassDiagrams", open("models/plant_PW.mvc", 'r').read())
 model_add("formalisms/PW_Plant", "formalisms/SimpleClassDiagrams", open("models/plant_PW.mvc", 'r').read())

+ 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)
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
 
-Date:   Fri Nov 17 09:42:18 2017
+Date:   Fri Nov 17 11:34:41 2017
 
 
 Model author: Yentl Van Tendeloo
 Model author: Yentl Van Tendeloo
 Model name:   MvK Server
 Model name:   MvK Server