Merge pull request 'detect burner fault' (#17) from feature/burner-fault-detection into main
Reviewed-on: #17
This commit is contained in:
commit
8672241151
18
README.md
18
README.md
@ -131,15 +131,15 @@ wifi_rssi -63
|
||||
##### Control Loop
|
||||
- control_state
|
||||
|
||||
| Enum eControlState in [control.h](main/control.h) | Value | Description |
|
||||
|---------------------------------------------------|-------|------------------------------------|
|
||||
| CONTROL_STARTING | 0 | |
|
||||
| CONTROL_HEATING | 1 | Burner running |
|
||||
| CONTROL_OUTDOOR_TOO_WARM | 2 | Heating not needed |
|
||||
| CONTROL_RETURN_FLOW_TOO_WARM | 3 | Heating not needed |
|
||||
| CONTROL_BURNER_FAULT | 4 | Burner reported fault |
|
||||
| CONTROL_FAULT_SAFETY | 5 | Unable to control due safety fault |
|
||||
| CONTROL_FAULT_SNTP | 6 | Unable to control due SNTP fault |
|
||||
| Enum eControlState in [control.h](main/control.h) | Value | Description |
|
||||
|---------------------------------------------------|-------|--------------------------------------------------|
|
||||
| CONTROL_STARTING | 0 | |
|
||||
| CONTROL_HEATING | 1 | Burner running |
|
||||
| CONTROL_OUTDOOR_TOO_WARM | 2 | Heating not needed |
|
||||
| CONTROL_RETURN_FLOW_TOO_WARM | 3 | Heating not needed |
|
||||
| CONTROL_FAULT_BURNER | 4 | Burner reported fault after threshold is reached |
|
||||
| CONTROL_FAULT_SAFETY | 5 | Unable to control due safety fault |
|
||||
| CONTROL_FAULT_SNTP | 6 | Unable to control due SNTP fault |
|
||||
|
||||
##### SNTP Client
|
||||
- sntp_state
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#include "esp_timer.h"
|
||||
#include "esp_log.h"
|
||||
#include "control.h"
|
||||
#include "outputs.h"
|
||||
@ -12,6 +13,7 @@
|
||||
#define RETURN_FLOW_TEMPERATURE_LOWER_LIMIT_DAY 30.0
|
||||
#define RETURN_FLOW_TEMPERATURE_LOWER_LIMIT_NIGHT 25.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 eControlState sControlState = CONTROL_STARTING;
|
||||
@ -54,6 +56,9 @@ void initControl(void)
|
||||
void taskControl(void *pvParameters)
|
||||
{
|
||||
bool bHeatingInAction = false;
|
||||
bool bBurnerFaultDetected = false;
|
||||
int64_t i64BurnerEnableTimestamp = esp_timer_get_time();
|
||||
|
||||
while (1)
|
||||
{
|
||||
vTaskDelay(PERIODIC_INTERVAL * 1000U / portTICK_PERIOD_MS);
|
||||
@ -64,7 +69,7 @@ void taskControl(void *pvParameters)
|
||||
sControlState = CONTROL_FAULT_SAFETY;
|
||||
if (bHeatingInAction == true)
|
||||
{
|
||||
ESP_LOGI(TAG, "Control not possible due to safety fault: Disable burner");
|
||||
ESP_LOGW(TAG, "Control not possible due to safety fault: Disable burner");
|
||||
bHeatingInAction = false;
|
||||
setCirculationPumpState(ENABLED);
|
||||
setBurnerState(DISABLED);
|
||||
@ -79,7 +84,7 @@ void taskControl(void *pvParameters)
|
||||
sControlState = CONTROL_FAULT_SNTP;
|
||||
if (bHeatingInAction == true)
|
||||
{
|
||||
ESP_LOGI(TAG, "Control not possible due to sntp fault: Disable burner");
|
||||
ESP_LOGW(TAG, "Control not possible due to sntp fault: Disable burner");
|
||||
bHeatingInAction = false;
|
||||
setCirculationPumpState(ENABLED);
|
||||
setBurnerState(DISABLED);
|
||||
@ -105,12 +110,27 @@ void taskControl(void *pvParameters)
|
||||
{
|
||||
if (bHeatingInAction)
|
||||
{
|
||||
// TODO: Check burner fault signal here
|
||||
int64_t i64Delta = esp_timer_get_time() - i64BurnerEnableTimestamp;
|
||||
|
||||
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)
|
||||
if ((bHeatingInAction == false) && (bBurnerFaultDetected == false))
|
||||
{
|
||||
if ((getReturnFlowTemperature().average60s.fValue <= currentControlEntry.fReturnFlowTemperature) && (getChamberTemperature().fCurrentValue <= 45.0))
|
||||
{
|
||||
@ -119,6 +139,7 @@ void taskControl(void *pvParameters)
|
||||
setCirculationPumpState(ENABLED);
|
||||
setBurnerState(ENABLED);
|
||||
setSafetyControlState(ENABLED);
|
||||
i64BurnerEnableTimestamp = esp_timer_get_time();
|
||||
sControlState = CONTROL_HEATING;
|
||||
}
|
||||
else
|
||||
|
@ -9,7 +9,7 @@ typedef enum _ControlState
|
||||
CONTROL_HEATING,
|
||||
CONTROL_OUTDOOR_TOO_WARM,
|
||||
CONTROL_RETURN_FLOW_TOO_WARM,
|
||||
CONTROL_BURNER_FAULT,
|
||||
CONTROL_FAULT_BURNER,
|
||||
CONTROL_FAULT_SAFETY,
|
||||
CONTROL_FAULT_SNTP,
|
||||
} eControlState;
|
||||
|
Loading…
Reference in New Issue
Block a user