-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #183 from RobertGawron/feature/storage_implementation
Feature/storage implementation
- Loading branch information
Showing
84 changed files
with
1,359 additions
and
465 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
Documentation/Diagrams/PCSimulationComponentDiagram.plantuml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
@startuml | ||
!pragma layout smetana | ||
|
||
package "Simulation (located in Simulation/FirmwarePCSimulator)" { | ||
[GUI] --> [Simulation Engine (simulation.py)] | ||
[Simulation Engine (simulation.py)] --> [Python Wrapper (device_under_test.py)] | ||
[Python Wrapper (device_under_test.py)] --> ["DLL (libFirmwarePCSimulator.so)"] | ||
[Simulation Engine (simulation.py)] --> [Mocks] | ||
[Mocks] -up-> ["DLL (libFirmwarePCSimulator.so)"] | ||
} | ||
|
||
package "Firmware (located in Software/STM32F103RBTx)" { | ||
component "Application" { | ||
package "Business Logic" as BL { | ||
folder "Headers" as BusinessLogic_Headers | ||
folder "Interfaces" as BusinessLogic_Interfaces | ||
folder "Sources" as BusinessLogic_Sources | ||
} | ||
|
||
package "Device" as Dev { | ||
folder "Headers" as Device_Headers | ||
folder "Interfaces" as Device_Interfaces | ||
folder "Sources" as Device_Sources | ||
} | ||
' Dummy relation to group blocks vertically | ||
package "Driver" as Drv { | ||
folder "Headers" as Driver_Headers | ||
folder "Interfaces" as Driver_Interfaces | ||
folder "Sources" as Driver_Sources | ||
} | ||
|
||
BL -[hidden]down--- Dev | ||
Dev -[hidden]down--- Drv | ||
} | ||
|
||
component "Libraries \n(located in Middlewares/Third_Party)" { | ||
package "STM32-ST7735" { | ||
folder "Headers (*.h)" as STM32_ST7735_Headers | ||
} | ||
} | ||
|
||
component "Core (located in Core)" { | ||
folder "Headers (*.h)" as Core_Headers | ||
} | ||
|
||
"Application" -[hidden]down-------- "Libraries \n(located in Middlewares/Third_Party)" | ||
"Application" -[hidden]down-------- "Core (located in Core)" | ||
} | ||
|
||
|
||
' Connections between DLL and Firmware components | ||
["DLL (libFirmwarePCSimulator.so)"] -down--> BL | ||
["DLL (libFirmwarePCSimulator.so)"] -down--> Dev | ||
[Mocks] -down----> Driver_Interfaces | ||
[Mocks] -down----> Core_Headers | ||
[Mocks] -down---> STM32_ST7735_Headers | ||
|
||
' Add a note for Mocks | ||
note left of [GUI] | ||
Uses PyQt6. Only this component uses it | ||
to avoid tightly coupling with the framework. | ||
end note | ||
|
||
|
||
' Add a note for Mocks | ||
note top of [Mocks] | ||
These replace the hardware-specific code | ||
from the firmware directory because | ||
the source code from: | ||
* Application/Driver | ||
* Middlewares/Third_Party | ||
* Core | ||
is not included in the compilation. | ||
end note | ||
@enduml |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions
27
Documentation/Diagrams/RemoteHostMeasurementDataFlow.plantuml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
@startuml | ||
title Deploy Diagram | ||
|
||
actor "Measurement Devices" | ||
|
||
box "HardwareDataLogger" #LightYellow | ||
participant "STM32F103RBTx chip" | ||
participant "ESP8266MOD chip" | ||
end box | ||
|
||
box "Docker Image" #LightBlue | ||
database "InfluxDB" | ||
participant "Grafana" | ||
end box | ||
|
||
note over "InfluxDB", "Grafana" | ||
"Either run locally (for debug) on PC or remotely on RaspberryPi" | ||
end note | ||
|
||
actor "End User" | ||
|
||
"Measurement Devices" -> "STM32F103RBTx chip" : Sends Raw Data | ||
"STM32F103RBTx chip" -> "ESP8266MOD chip" : Processes and Transfers Data | ||
"ESP8266MOD chip" --> "InfluxDB" : Stores Data\n(via MQTT or HTTP) | ||
"InfluxDB" -> "Grafana" : Fetches and Serves Data | ||
"End User" -> "Grafana" : Accesses Data Visualization | ||
@enduml |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
Simulation/FirmwarePCSimulator/data_visualization_widget.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
from PyQt6.QtWidgets import QWidget, QVBoxLayout | ||
from PyQt6.QtCore import Qt | ||
import matplotlib.pyplot as plt | ||
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas | ||
|
||
class DataVisualizationWidget(QWidget): | ||
def __init__(self): | ||
super().__init__() | ||
|
||
# Main layout for the Data Visualization Widget | ||
self.layout = QVBoxLayout() | ||
self.layout.setAlignment(Qt.AlignmentFlag.AlignTop) | ||
|
||
# Create a Matplotlib figure and canvas | ||
self.figure, self.ax = plt.subplots() | ||
self.canvas = FigureCanvas(self.figure) | ||
|
||
# Add the canvas to the layout | ||
self.layout.addWidget(self.canvas) | ||
|
||
# Initialize data storage for pulse counters | ||
self.time_stamps = [] | ||
self.pulse_counters = {i: [] for i in range(4)} # 4 pulse counters | ||
|
||
self.setLayout(self.layout) | ||
|
||
def update_pulse_counters(self, timestamp, values): | ||
""" | ||
Update the graph with new pulse counter values. | ||
:param timestamp: The timestamp of the update. | ||
:param values: A list of pulse counter values. | ||
""" | ||
# Append new data to the storage | ||
self.time_stamps.append(timestamp) | ||
for i, value in enumerate(values): | ||
self.pulse_counters[i].append(value) | ||
|
||
# Ensure the time series does not grow indefinitely (optional) | ||
MAX_POINTS = 100 | ||
if len(self.time_stamps) > MAX_POINTS: | ||
self.time_stamps.pop(0) | ||
for key in self.pulse_counters: | ||
self.pulse_counters[key].pop(0) | ||
|
||
# Clear and plot new data | ||
self.ax.clear() | ||
for i, values in self.pulse_counters.items(): | ||
self.ax.plot(self.time_stamps, values, label=f"Pulse Counter {i + 1}") | ||
|
||
self.ax.set_title("Pulse Counter Values Over Time") | ||
self.ax.set_xlabel("Time") | ||
self.ax.set_ylabel("Value") | ||
self.ax.legend() | ||
|
||
# Redraw the canvas | ||
self.canvas.draw() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.