State before integration of new models
This commit is contained in:
parent
93637463aa
commit
23554113c5
2
model.py
2
model.py
@ -10,7 +10,7 @@ from sensor import Sensor
|
|||||||
|
|
||||||
class Model:
|
class Model:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.sensors = {"temp": Sensor()}
|
self.sensors = {"temp": Sensor(), "keks": Sensor()}
|
||||||
self.drivers = []
|
self.drivers = []
|
||||||
self.measurement = None
|
self.measurement = None
|
||||||
self.plot_data = None
|
self.plot_data = None
|
||||||
|
19
plot_data.py
19
plot_data.py
@ -19,9 +19,24 @@ class PlotData():
|
|||||||
self.queues[sensor_name] = []
|
self.queues[sensor_name] = []
|
||||||
self.data[sensor_name] = np.full_like(self.data["time"], np.nan)
|
self.data[sensor_name] = np.full_like(self.data["time"], np.nan)
|
||||||
|
|
||||||
for data_tuple in data:
|
for data_tuple in data.values():
|
||||||
self.queues[sensor_name].append(data_tuple)
|
self.queues[sensor_name].append(data_tuple)
|
||||||
|
|
||||||
|
running = True
|
||||||
|
while running:
|
||||||
|
#TODO timeout clean
|
||||||
|
for que in self.queues.values():
|
||||||
|
if len(que) == 0:
|
||||||
|
running = False
|
||||||
|
break
|
||||||
|
|
||||||
|
for sensor,que in self.queues.items():
|
||||||
|
self.data[sensor] = np.append(self.data[sensor], que[0])
|
||||||
|
que = que[1:]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
TODO
|
TODO
|
||||||
while true
|
while true
|
||||||
@ -29,6 +44,6 @@ class PlotData():
|
|||||||
for q in que:
|
for q in que:
|
||||||
if q is empty
|
if q is empty
|
||||||
return
|
return
|
||||||
update np array
|
update np array
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
5
view.py
5
view.py
@ -32,7 +32,7 @@ class PlotPanel(wx.Panel):
|
|||||||
def __init__(self, parent, model):
|
def __init__(self, parent, model):
|
||||||
super().__init__(parent, -1)
|
super().__init__(parent, -1)
|
||||||
self.model = model
|
self.model = model
|
||||||
self.fig = Figure((3, 3), 75)
|
self.fig = Figure((15, 10), 75)
|
||||||
self.canvas = FigureCanvas(self, -1, self.fig)
|
self.canvas = FigureCanvas(self, -1, self.fig)
|
||||||
self.toolbar = NavigationToolbar(self.canvas) # matplotlib toolbar
|
self.toolbar = NavigationToolbar(self.canvas) # matplotlib toolbar
|
||||||
self.toolbar.Realize()
|
self.toolbar.Realize()
|
||||||
@ -52,8 +52,9 @@ class PlotPanel(wx.Panel):
|
|||||||
|
|
||||||
def init_plot_data(self):
|
def init_plot_data(self):
|
||||||
self.ax = self.fig.add_subplot()
|
self.ax = self.fig.add_subplot()
|
||||||
|
self.fig.legend()
|
||||||
self.x, self.y = self.model.sensors["temp"].get_data
|
self.x, self.y = self.model.sensors["temp"].get_data
|
||||||
(self.im,) = self.ax.plot(self.x, self.y, "-.")
|
(self.im,) = self.ax.plot(self.x, self.y, "-.",label="temp")
|
||||||
self.toolbar.update() # Not sure why this is needed - ADS
|
self.toolbar.update() # Not sure why this is needed - ADS
|
||||||
|
|
||||||
def get_toolbar(self):
|
def get_toolbar(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user