Merge branch '44-als-gebruiker-wil-ik-dat-de-website-automatisch-het-aantal-nodes-dat-ik-heb-aangesloten-op-de'

This commit is contained in:
Dano van den Bosch
2024-04-04 22:19:44 +02:00
19 changed files with 605 additions and 169 deletions

View File

@@ -0,0 +1,120 @@
# Nodes
## Introduction
The nodes are the devices that are placed in the rooms. The nodes are used to collect the data from the sensors. Every node is connected to the websocket, and sends their data with their mac address in json format. The websocket broadcasts the node data back to all clients, and since our website functions as a client it also receives the data. Every node will, depending on what node, be made into a class.
## Requirements
### Sensornode
- Every node has to have a unique nodeID
- Every node has to have their corresponding sensorsvalues in form of arrays
### Feedbacknodes
- Every node has to have a unique nodeID
- Every node has to have their corresponding feedback in form of a 2D array
## Class diagrams
### Node
```mermaid
classDiagram
Node <-- SensorNode : extends
Node <-- FeedbackNode : extends
class Node {
+nodeID
+processNodeData()
+updateNodeData()
}
class SensorNode {
+tempArray
+humiArray
+eco2Array
+tvocArray
}
class FeedbackNode {
+feedbackArray
}
```
# Graphs
## Introduction
The graphs are used to display the data from the sensors. The data is collected by the raspberry pi and then displayed on the graphs. The graphs are made using the [plotly library](https://plotly.com/javascript/) .
## Requirements
### Live graphs
- Every node has to have a live graph
- The graphs has to be updated every 5 seconds
- All the data from one node has to fit in one graph
## Class diagrams
### Graphs
```mermaid
classDiagram
liveGraph --> graph: extends
class graph {
+nodeId
makeGraph()
}
class liveGraph {
+cnt
+timeArray
+tempArray
+humiArray
+eco2Array
+tvocArray
makeGraph()
updateGraph()
updateData()
}
```
## Order of operations
### Live graphs
```mermaid
sequenceDiagram
participant Node
participant Raspberry pi
participant Website
Node->>Raspberry pi: sensordata via websocket every 5 seconds
Raspberry pi->>Website: Node data via websocket if new data is received from the node
Website->>Website: updateGraph()
Website->>Website: updateData()
```
1. Every node sends its data to the raspberry pi via websocket every 5 seconds
2. The raspberry pi sends the data to the website via websocket if new data is received from the node
3. The website updates the data coming from the raspberry pi on its own variables and arrays
4. The website updates the live graphs every time new data is received from the websocket
### Node
```mermaid
sequenceDiagram
participant Node
participant Raspberry pi
participant Website
Node->>Raspberry pi: node data via websocket every 5 seconds
Raspberry pi->>Website: Make a new object depending on what node it is
Website->>Website: updateNodeData()
Website->>Website: processNodeData()
```

View File

@@ -0,0 +1,23 @@
# The infrastructure
###
## Three layers
###
### functional
In the top layer of the infrastructure documentation, we are showing the functional flows of the information trafic between the user and the sensor/enquete that are located in the same room. The traffic consists of enviromental sensor values like temperature, humidity etc. Also it is showing the user input at the enquete device to the database that is hosted at the brain of the operation.
[functional Infra](../assets/funcionalInfra.png)
### Technical
In the middel layer we are showing the data flow and processing of the data at component level. It consists of 2 area's with 3 parts, namelie the server room and the building as in the common area. Here we send the data in JSON form that is collected at the enquete node (this is the feedback data) and the sensor node (this is the environmental data). This is sent to the database through the websocket that is running on the raspberry pi and than via a rest api sent to the database. If one of the operational manager would log in to the website. They would see the incomming sensor node data that is comming through, but also the data that is already collected and stored in the database.
[technical Infra](../assets/technicalInfra.png)
### UML diagram of software
At the lowest level of our system we are showing how the software is designed. This is shown as a UML diagram. The diagram is made with mermaid. This shows the work flow of the different parts of the software which is running on the main server, for which we are using a Raspberry pi. The pi is located on the 6th floor of the school building in a locked server room.