Add Node and Graph classes for website functionality
This commit is contained in:
@@ -22,30 +22,24 @@ The nodes are the devices that are placed in the rooms. The nodes are used to co
|
|||||||
|
|
||||||
```mermaid
|
```mermaid
|
||||||
classDiagram
|
classDiagram
|
||||||
|
|
||||||
|
Node <-- SensorNode : extends
|
||||||
|
Node <-- FeedbackNode : extends
|
||||||
|
|
||||||
class Node {
|
class Node {
|
||||||
+nodeID
|
+nodeID
|
||||||
+processNodeData()
|
+processNodeData()
|
||||||
+updateNodeData()
|
+updateNodeData()
|
||||||
}
|
}
|
||||||
```
|
|
||||||
|
|
||||||
#### Sensornode
|
class SensorNode {
|
||||||
|
|
||||||
```mermaid
|
|
||||||
classDiagram
|
|
||||||
class SensorNode extends Node {
|
|
||||||
+tempArray
|
+tempArray
|
||||||
+humiArray
|
+humiArray
|
||||||
+eco2Array
|
+eco2Array
|
||||||
+tvocArray
|
+tvocArray
|
||||||
}
|
}
|
||||||
```
|
|
||||||
|
|
||||||
#### Feedbacknode
|
class FeedbackNode {
|
||||||
|
|
||||||
```mermaid
|
|
||||||
classDiagram
|
|
||||||
class FeedbackNode extends Node {
|
|
||||||
+feedbackArray
|
+feedbackArray
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@@ -70,17 +64,14 @@ The graphs are used to display the data from the sensors. The data is collected
|
|||||||
|
|
||||||
```mermaid
|
```mermaid
|
||||||
classDiagram
|
classDiagram
|
||||||
|
|
||||||
|
liveGraph --> graph: extends
|
||||||
class graph {
|
class graph {
|
||||||
+nodeId
|
+nodeId
|
||||||
makeGraph()
|
makeGraph()
|
||||||
}
|
}
|
||||||
```
|
|
||||||
|
|
||||||
### Live graphs
|
class liveGraph {
|
||||||
|
|
||||||
```mermaid
|
|
||||||
classDiagram
|
|
||||||
class liveGraph extends graph {
|
|
||||||
+cnt
|
+cnt
|
||||||
+timeArray
|
+timeArray
|
||||||
+tempArray
|
+tempArray
|
||||||
@@ -91,8 +82,8 @@ classDiagram
|
|||||||
updateGraph()
|
updateGraph()
|
||||||
updateData()
|
updateData()
|
||||||
}
|
}
|
||||||
```
|
|
||||||
|
|
||||||
|
```
|
||||||
## Order of operations
|
## Order of operations
|
||||||
|
|
||||||
### Live graphs
|
### Live graphs
|
||||||
@@ -114,4 +105,16 @@ sequenceDiagram
|
|||||||
3. The website updates the data coming from the raspberry pi on its own variables and arrays
|
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
|
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()
|
||||||
|
```
|
@@ -38,7 +38,7 @@ class feedbackNode extends node {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class liveGraph extends node {
|
class liveGraph extends graph {
|
||||||
// Constructor to initialize the graph
|
// Constructor to initialize the graph
|
||||||
constructor(id) {
|
constructor(id) {
|
||||||
super(id);
|
super(id);
|
||||||
|
Reference in New Issue
Block a user