Compare commits
No commits in common. "e790660c36e2092ad7d5eba08d25b4f1bf2a8b5e413aa587b4b8aec2e27710f6" and "b21dc720ed6de9dfb134cf73f95a4b999c4168ecb345b3f0d8590958e0887091" have entirely different histories.
e790660c36
...
b21dc720ed
46
README.md
46
README.md
@ -77,35 +77,31 @@ Sntp <|-- Metrics
|
|||||||
#### Example
|
#### Example
|
||||||
```
|
```
|
||||||
burner_fault_pending 1
|
burner_fault_pending 1
|
||||||
circulation_pump_enabled 1
|
circulation_pump_enabled 0
|
||||||
burner_enabled 0
|
burner_enabled 1
|
||||||
safety_contact_enabled 0
|
safety_contact_enabled 1
|
||||||
chamber_temperature 58.750000
|
chamber_temperature 21.812500
|
||||||
chamber_temperature_avg10 58.931252
|
chamber_temperature_avg10 21.837500
|
||||||
chamber_temperature_avg60 59.190475
|
chamber_temperature_avg60 21.825521
|
||||||
chamber_temperature_pred60 55.870998
|
inlet_flow_temperature 22.437500
|
||||||
inlet_flow_temperature 53.875000
|
inlet_flow_temperature_avg10 22.437500
|
||||||
inlet_flow_temperature_avg10 53.900002
|
inlet_flow_temperature_avg60 22.434896
|
||||||
inlet_flow_temperature_avg60 53.994320
|
outdoor_temperature 21.937500
|
||||||
inlet_flow_temperature_pred60 52.848743
|
outdoor_temperature_avg10 21.937500
|
||||||
outdoor_temperature 18.000000
|
outdoor_temperature_avg60 21.933594
|
||||||
outdoor_temperature_avg10 18.006250
|
return_flow_temperature 22.375000
|
||||||
outdoor_temperature_avg60 18.002840
|
return_flow_temperature_avg10 22.375000
|
||||||
outdoor_temperature_pred60 18.050785
|
return_flow_temperature_avg60 22.375000
|
||||||
return_flow_temperature 48.625000
|
|
||||||
return_flow_temperature_avg10 48.718750
|
|
||||||
return_flow_temperature_avg60 48.846592
|
|
||||||
return_flow_temperature_pred60 47.383083
|
|
||||||
chamber_temperature_state 0
|
chamber_temperature_state 0
|
||||||
outdoor_temperature_state 0
|
outdoor_temperature_state 0
|
||||||
inlet_flow_temperature_state 0
|
inlet_flow_temperature_state 0
|
||||||
return_flow_temperature_state 0
|
return_flow_temperature_state 0
|
||||||
safety_state 0
|
safety_state 0
|
||||||
control_state 3
|
control_state 5
|
||||||
sntp_state 0
|
sntp_state 0
|
||||||
system_unixtime 1735242392
|
system_unixtime 1734814285
|
||||||
uptime_seconds 40
|
uptime_seconds 90
|
||||||
wifi_rssi -74
|
wifi_rssi -63
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Status Encoding
|
#### Status Encoding
|
||||||
@ -136,12 +132,12 @@ wifi_rssi -74
|
|||||||
- control_state
|
- control_state
|
||||||
|
|
||||||
| Enum eControlState in [control.h](main/control.h) | Value | Description |
|
| Enum eControlState in [control.h](main/control.h) | Value | Description |
|
||||||
|---------------------------------------------------|-------|--------------------------------------------------|
|
|---------------------------------------------------|-------|------------------------------------|
|
||||||
| CONTROL_STARTING | 0 | |
|
| CONTROL_STARTING | 0 | |
|
||||||
| CONTROL_HEATING | 1 | Burner running |
|
| CONTROL_HEATING | 1 | Burner running |
|
||||||
| CONTROL_OUTDOOR_TOO_WARM | 2 | Heating not needed |
|
| CONTROL_OUTDOOR_TOO_WARM | 2 | Heating not needed |
|
||||||
| CONTROL_RETURN_FLOW_TOO_WARM | 3 | Heating not needed |
|
| CONTROL_RETURN_FLOW_TOO_WARM | 3 | Heating not needed |
|
||||||
| CONTROL_FAULT_BURNER | 4 | Burner reported fault after threshold is reached |
|
| CONTROL_BURNER_FAULT | 4 | Burner reported fault |
|
||||||
| CONTROL_FAULT_SAFETY | 5 | Unable to control due safety fault |
|
| CONTROL_FAULT_SAFETY | 5 | Unable to control due safety fault |
|
||||||
| CONTROL_FAULT_SNTP | 6 | Unable to control due SNTP fault |
|
| CONTROL_FAULT_SNTP | 6 | Unable to control due SNTP fault |
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
#include "freertos/FreeRTOS.h"
|
#include "freertos/FreeRTOS.h"
|
||||||
#include "freertos/task.h"
|
#include "freertos/task.h"
|
||||||
#include "esp_timer.h"
|
|
||||||
#include "esp_log.h"
|
#include "esp_log.h"
|
||||||
#include "control.h"
|
#include "control.h"
|
||||||
#include "outputs.h"
|
#include "outputs.h"
|
||||||
@ -13,7 +12,6 @@
|
|||||||
#define RETURN_FLOW_TEMPERATURE_LOWER_LIMIT_DAY 30.0
|
#define RETURN_FLOW_TEMPERATURE_LOWER_LIMIT_DAY 30.0
|
||||||
#define RETURN_FLOW_TEMPERATURE_LOWER_LIMIT_NIGHT 25.0
|
#define RETURN_FLOW_TEMPERATURE_LOWER_LIMIT_NIGHT 25.0
|
||||||
#define CHAMPER_TEMPERATURE_TARGET 70.0
|
#define CHAMPER_TEMPERATURE_TARGET 70.0
|
||||||
#define BURNER_FAULT_DETECTION_THRESHOLD (60U * 3U) // Detect burner fault if after 3 minutes no burner start detected
|
|
||||||
|
|
||||||
static const char *TAG = "smart-oil-heater-control-system-control";
|
static const char *TAG = "smart-oil-heater-control-system-control";
|
||||||
static eControlState sControlState = CONTROL_STARTING;
|
static eControlState sControlState = CONTROL_STARTING;
|
||||||
@ -56,9 +54,6 @@ void initControl(void)
|
|||||||
void taskControl(void *pvParameters)
|
void taskControl(void *pvParameters)
|
||||||
{
|
{
|
||||||
bool bHeatingInAction = false;
|
bool bHeatingInAction = false;
|
||||||
bool bBurnerFaultDetected = false;
|
|
||||||
int64_t i64BurnerEnableTimestamp = esp_timer_get_time();
|
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
vTaskDelay(PERIODIC_INTERVAL * 1000U / portTICK_PERIOD_MS);
|
vTaskDelay(PERIODIC_INTERVAL * 1000U / portTICK_PERIOD_MS);
|
||||||
@ -69,7 +64,7 @@ void taskControl(void *pvParameters)
|
|||||||
sControlState = CONTROL_FAULT_SAFETY;
|
sControlState = CONTROL_FAULT_SAFETY;
|
||||||
if (bHeatingInAction == true)
|
if (bHeatingInAction == true)
|
||||||
{
|
{
|
||||||
ESP_LOGW(TAG, "Control not possible due to safety fault: Disable burner");
|
ESP_LOGI(TAG, "Control not possible due to safety fault: Disable burner");
|
||||||
bHeatingInAction = false;
|
bHeatingInAction = false;
|
||||||
setCirculationPumpState(ENABLED);
|
setCirculationPumpState(ENABLED);
|
||||||
setBurnerState(DISABLED);
|
setBurnerState(DISABLED);
|
||||||
@ -84,7 +79,7 @@ void taskControl(void *pvParameters)
|
|||||||
sControlState = CONTROL_FAULT_SNTP;
|
sControlState = CONTROL_FAULT_SNTP;
|
||||||
if (bHeatingInAction == true)
|
if (bHeatingInAction == true)
|
||||||
{
|
{
|
||||||
ESP_LOGW(TAG, "Control not possible due to sntp fault: Disable burner");
|
ESP_LOGI(TAG, "Control not possible due to sntp fault: Disable burner");
|
||||||
bHeatingInAction = false;
|
bHeatingInAction = false;
|
||||||
setCirculationPumpState(ENABLED);
|
setCirculationPumpState(ENABLED);
|
||||||
setBurnerState(DISABLED);
|
setBurnerState(DISABLED);
|
||||||
@ -110,27 +105,12 @@ void taskControl(void *pvParameters)
|
|||||||
{
|
{
|
||||||
if (bHeatingInAction)
|
if (bHeatingInAction)
|
||||||
{
|
{
|
||||||
int64_t i64Delta = esp_timer_get_time() - i64BurnerEnableTimestamp;
|
// TODO: Check burner fault signal here
|
||||||
|
|
||||||
if ((i64Delta / 1000000U) >= BURNER_FAULT_DETECTION_THRESHOLD)
|
|
||||||
{
|
|
||||||
if (getBurnerError() == FAULT)
|
|
||||||
{
|
|
||||||
ESP_LOGW(TAG, "Detected burner fault after %lli seconds!", (i64Delta / 1000000U));
|
|
||||||
ESP_LOGW(TAG, "Control not possible due to burner fault: Disable burner");
|
|
||||||
sControlState = CONTROL_FAULT_BURNER;
|
|
||||||
bHeatingInAction = false;
|
|
||||||
bBurnerFaultDetected = true;
|
|
||||||
setCirculationPumpState(ENABLED);
|
|
||||||
setBurnerState(DISABLED);
|
|
||||||
setSafetyControlState(ENABLED);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((bHeatingInAction == false) && (bBurnerFaultDetected == false))
|
if (bHeatingInAction == false)
|
||||||
{
|
{
|
||||||
if ((getReturnFlowTemperature().average60s.fValue <= currentControlEntry.fReturnFlowTemperature) && (getChamberTemperature().fCurrentValue <= 45.0))
|
if ((getReturnFlowTemperature().average60s.fValue <= currentControlEntry.fReturnFlowTemperature) && (getChamberTemperature().fCurrentValue <= 45.0))
|
||||||
{
|
{
|
||||||
@ -139,7 +119,6 @@ void taskControl(void *pvParameters)
|
|||||||
setCirculationPumpState(ENABLED);
|
setCirculationPumpState(ENABLED);
|
||||||
setBurnerState(ENABLED);
|
setBurnerState(ENABLED);
|
||||||
setSafetyControlState(ENABLED);
|
setSafetyControlState(ENABLED);
|
||||||
i64BurnerEnableTimestamp = esp_timer_get_time();
|
|
||||||
sControlState = CONTROL_HEATING;
|
sControlState = CONTROL_HEATING;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -9,7 +9,7 @@ typedef enum _ControlState
|
|||||||
CONTROL_HEATING,
|
CONTROL_HEATING,
|
||||||
CONTROL_OUTDOOR_TOO_WARM,
|
CONTROL_OUTDOOR_TOO_WARM,
|
||||||
CONTROL_RETURN_FLOW_TOO_WARM,
|
CONTROL_RETURN_FLOW_TOO_WARM,
|
||||||
CONTROL_FAULT_BURNER,
|
CONTROL_BURNER_FAULT,
|
||||||
CONTROL_FAULT_SAFETY,
|
CONTROL_FAULT_SAFETY,
|
||||||
CONTROL_FAULT_SNTP,
|
CONTROL_FAULT_SNTP,
|
||||||
} eControlState;
|
} eControlState;
|
||||||
|
Loading…
Reference in New Issue
Block a user