135 lines
3.4 KiB
Markdown
135 lines
3.4 KiB
Markdown
# smart-oil-heating-control-system
|
|
|
|
## Software
|
|
### Design
|
|
|
|
```mermaid
|
|
classDiagram
|
|
Inputs <|-- Control
|
|
Outputs <|-- Control
|
|
Sntp <|-- Control
|
|
Inputs <|-- Safety
|
|
Outputs <|--|> Safety
|
|
|
|
Inputs <|-- Metrics
|
|
Outputs <|-- Metrics
|
|
Control <|-- Metrics
|
|
Safety <|-- Metrics
|
|
Sntp <|-- Metrics
|
|
|
|
class Inputs{
|
|
+initInputs()
|
|
-taskInput()
|
|
+getChamberTemperature()
|
|
+getOutdoorTemperature()
|
|
+getInletFlowTemperature()
|
|
+getReturnFlowTemperature()
|
|
+getBurnerError()
|
|
}
|
|
|
|
class Outputs{
|
|
+initOutputs()
|
|
+getCirculationPumpState()
|
|
+setCirculationPumpState()
|
|
+getBurnerState()
|
|
+setBurnerState()
|
|
+getSafetyControlState()
|
|
+setSafetyControlState()
|
|
}
|
|
|
|
class Control{
|
|
+taskControl()
|
|
-timetable
|
|
+getControlState()
|
|
}
|
|
|
|
class Safety{
|
|
+initSafety()
|
|
-taskSafety()
|
|
-setSafeState()
|
|
-checkSensorSanity()
|
|
+getSensorSanityStates()
|
|
+getSafetyState()
|
|
}
|
|
|
|
|
|
class Wifi{
|
|
+initWifi()
|
|
}
|
|
|
|
class Sntp{
|
|
+initSntp()
|
|
+getSntpState()
|
|
}
|
|
|
|
class Metrics{
|
|
+initMetrics()
|
|
-taskMetrics()
|
|
-metrics
|
|
+event_handler()
|
|
+connect_wifi()
|
|
+setMetrics()
|
|
}
|
|
```
|
|
|
|
### Prometheus Metrics
|
|
`curl http://X.X.X.X:9100/metrics`
|
|
#### Example
|
|
```
|
|
burner_fault_pending 1
|
|
circulation_pump_enabled 0
|
|
burner_enabled 1
|
|
safety_contact_enabled 1
|
|
chamber_temperature 21.812500
|
|
chamber_temperature_avg10 21.837500
|
|
chamber_temperature_avg60 21.825521
|
|
inlet_flow_temperature 22.437500
|
|
inlet_flow_temperature_avg10 22.437500
|
|
inlet_flow_temperature_avg60 22.434896
|
|
outdoor_temperature 21.937500
|
|
outdoor_temperature_avg10 21.937500
|
|
outdoor_temperature_avg60 21.933594
|
|
return_flow_temperature 22.375000
|
|
return_flow_temperature_avg10 22.375000
|
|
return_flow_temperature_avg60 22.375000
|
|
chamber_temperature_state 0
|
|
outdoor_temperature_state 0
|
|
inlet_flow_temperature_state 0
|
|
return_flow_temperature_state 0
|
|
safety_state 0
|
|
control_state 5
|
|
sntp_state 0
|
|
system_unixtime 1734814285
|
|
uptime_seconds 90
|
|
wifi_rssi -63
|
|
```
|
|
|
|
#### Status Encoding
|
|
##### Digital Themperatur Sensor DS10B20
|
|
- chamber_temperature_state
|
|
- outdoor_temperature_state
|
|
- inlet_flow_temperature_state
|
|
- return_flow_temperature_state
|
|
|
|
| Enum eSensorErrorState in [safety.h](main/safety.h) | Value | Description |
|
|
|------------------------------------------------------|--------|----------------------|
|
|
| SENSOR_NO_ERROR | 0 | |
|
|
| SENSOR_TOO_HIGH | 1 | Sanity check failed |
|
|
| SENSOR_TOO_LOW | 2 | Sanity check failed |
|
|
| SENSOR_UNCHANGED | 3 | Sanity check failed |
|
|
| SENSOR_NOT_FOUND | 4 | No Communication |
|
|
|
|
|
|
|
|
## Hardware
|
|
|
|
| Function | ESP32 | PLC ES32C14 |
|
|
|---------------------------------------|-------|---------------------------|
|
|
| Output CirculationPump | IO27 | Relay 1 NC1 |
|
|
| Output Burner Fire Signal | IO14 | Relay 2 NC2 |
|
|
| Output Safety Contact (powers Burner) | IO12 | Relay 3 NC2 |
|
|
| Input Burner Fault | IO19 | Digital Input IN1 |
|
|
| Input Temperature DS10B20 | IO04 | 1-Wire |
|
|
|
|
|