-
Notifications
You must be signed in to change notification settings - Fork 1
/
state.h
68 lines (60 loc) · 2.13 KB
/
state.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#ifndef STATE_H
#define STATE_H
struct BoilerState {
bool fault = false;
bool chOn = false;
bool dhwOn = false;
bool flameOn = false;
float modulationLvl = 0;
float feedTemp = 0;
float returnTemp = 0;
unsigned long dhwTotalMs = 0; // how long DWH pump was running in total
unsigned long chTotalMs = 0; // how long CH pump was running in total
};
struct ThermostatState {
bool chOn = false;
bool dhwOn = false;
float outsideTemp = 0;
float roomTemp = 0;
float dhwTemp = 0;
float chSetpoint = 0;
float dhwSetpoint = 0;
byte online = 0; // OT online counter (0 = offline)
};
struct Accumulator {
bool chOn = false;
bool dhwOn = false;
float topTemp = 0;
float bottomTemp = 0;
float chTemp = 0;
float returnTemp = 0;
float valveAngle = 0;
float pressure = 0;
byte mode = 0;
unsigned long dhwTotalMs = 0; // how long DWH pump was running in total
unsigned long chTotalMs = 0; // how long CH pump was running in total
unsigned long dhwNotRunMs = 0; // how long DHW pump was not running - used for anti-stop alogrithm
unsigned long chNotRunMs = 0; // how long CH pump was not running - used for anti-stop alogrithm
};
struct Config {
byte dhwFeedingTempExcess; // minimalni nadbytek napajeci teploty pro zapnuti TUV cerpadla z AKU nadrze (v AKU musi byt vyssi teplota pro natopeni TUV)
byte hysteresis; // o kolik vic musi mit zdroj tepla aby se zapnulo natapeni TUV/CH
byte dhwHysteresis; // kdy prestaneme natapet nadrz na teplou vodu
long antiStopMs; // max time pumps are not run
};
class STATE {
public:
STATE() {
config.dhwFeedingTempExcess = 7; // at leat 7°C above DHW setpoint to run feeding from AKU
config.hysteresis = 5; // at least 5°C above CH/DHW setpoint to start feeding from AKU (in case of DHW + dhwFeedingTempExcess)
config.dhwHysteresis = 2; // stop when 2°C above DHW setpoint
config.antiStopMs = 432000000; // run each pump at least every 5days
}
void store();
bool load();
BoilerState boiler; // read-only
ThermostatState thermostat; // read-only
Accumulator accumulator; // read-write
Config config; // consts
};
#endif