-
Notifications
You must be signed in to change notification settings - Fork 7
/
HeatingData.cpp
145 lines (129 loc) · 5.22 KB
/
HeatingData.cpp
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
/***
* Project: DryBox Control
* File : HeatingData.h
* Author : Werner Riemann
* Created: 08.05.2024
* Board: Arduino Nano
*
* Description: Implementation of Class HeatingData
* Class for handling the values for heating power and heater fan speed
* depending on the different temperature ranges
*
*/
#include "HeatingData.h"
HeatingData::HeatingData()
{
}
/***
* Setup all values needed to controll heater power, heater fan speed and ventilation speed.
*
we are using the same variables for each temperature range. But depending which range,
they are populated with the appropriate values.
The method is initializing following member variables. All values, except compareOffset, compareOffsetTurboMode and airExtractionTime,
are percentage values for the PWM to power heater or fan. compareOffset and compareOffsetTurboMode are float temperature
value in degree celsius.
uint8_t rampUpHeatPWM[3] - ramp values will be generated by software on calling SetupHeatingValues
uint8_t defaultHeaterPWM - final value to power the heater during drying
uint8_t defaultHeaterFanPWM - final value to power the heater fan during drying
uint8_t nearDestHeaterPWM - power value for heater near before destination temperature
uint8_t lowHeaterFanPWM - heater fan power value, when destinatiion temp is reached and heater is switched off
uint8_t turboHeaterPWM - power value for heater turbo mode for quicker heat up
uint8_t turboHeaterFanPWM - power value for heater fan turbo mode for quicker heat up
float compareOffset - value below destination temperature, when heater is switched to a lower power
float compareOffsetTurboMode - value below destination temperature, when heater is switched to default power
uint8_t ventilationHeaterPWM - power value for heater during ventilation
uint8_t ventilationHeaterFanPWM - power value for heater fan during ventilation
uint8_t ventilationFanPWM - power value for ventilation fan during ventilation
uint8_t airExtractionTime; - air extraction time in seconds, done in intervalls during drying process
uint8_t finalAirExtractionTime - final air extraction time in seconds after finishing drying process
uint8_t airExchangeIntervallMinutes - air exchange intervall in minutes
*/
void HeatingData::SetupHeatingValues(int dryDestTemp)
{
ventilationFanPWM = 80; // for the ventilation fan we only need one value for all
airExtractionTime = 20;
finalAirExtractionTime = 30;
airExchangeIntervallMinutes = 5; // don't set this value less then 4
/*-- range up to 32 degree celsius -- */
if(dryDestTemp <= 32) {
defaultHeaterPWM = 72;
defaultHeaterFanPWM = 72;
nearDestHeaterPWM = 44;
lowHeaterFanPWM = 32;
turboHeaterPWM = 92;
turboHeaterFanPWM = 90;
compareOffset = 0.5;
compareOffsetTurboMode = 4.0;
ventilationHeaterPWM = 40;
ventilationHeaterFanPWM = 52;
}
/*-- range over 32 up to 35 degree celsius -- */
if(dryDestTemp > 32 && dryDestTemp <= 35) {
defaultHeaterPWM = 80;
defaultHeaterFanPWM = 76;
nearDestHeaterPWM = 58;
lowHeaterFanPWM = 34;
turboHeaterPWM = 94;
turboHeaterFanPWM = 90;
compareOffset = 0.5;
compareOffsetTurboMode = 4.0;
ventilationHeaterPWM = 46; //
ventilationHeaterFanPWM = 54;
}
/*-- range over 35 up to 40 degree celsius -- */
if(dryDestTemp > 35 && dryDestTemp <= 40) {
defaultHeaterPWM = 88;
defaultHeaterFanPWM = 78;
nearDestHeaterPWM = 62;
lowHeaterFanPWM = 40;
turboHeaterPWM = 98;
turboHeaterFanPWM = 90;
compareOffset = 0.3;
compareOffsetTurboMode = 3.0;
ventilationHeaterPWM = 54;
ventilationHeaterFanPWM = 34;
}
/*-- range over 40 up to 45 degree celsius -- */
if(dryDestTemp > 40 && dryDestTemp <= 45) {
defaultHeaterPWM = 88;
defaultHeaterFanPWM = 82;
nearDestHeaterPWM = 66;
lowHeaterFanPWM = 44;
turboHeaterPWM = 98;
turboHeaterFanPWM = 90;
compareOffset = 0.2;
compareOffsetTurboMode = 2.0;
ventilationHeaterPWM = 60; // 56
ventilationHeaterFanPWM = 40;
}
/*-- range over 45 up to 50 degree celsius -- */
if(dryDestTemp > 45 && dryDestTemp <= 50) {
defaultHeaterPWM = 96;
defaultHeaterFanPWM = 86;
nearDestHeaterPWM = 72;
lowHeaterFanPWM = 50;
turboHeaterPWM = 98;
turboHeaterFanPWM = 90;
compareOffset = 0.2;
compareOffsetTurboMode = 2.0;
ventilationHeaterPWM = 70;
ventilationHeaterFanPWM = 40;
}
/*-- range over 50 degree celsius -- */
if(dryDestTemp > 50 ) {
defaultHeaterPWM = 99; // 98
defaultHeaterFanPWM = 89; // 88
nearDestHeaterPWM = 75;
lowHeaterFanPWM = 60;
turboHeaterPWM = 99;
turboHeaterFanPWM = 90;
compareOffset = 0.2;
compareOffsetTurboMode = 2.0;
ventilationHeaterPWM = 78; // 75
ventilationHeaterFanPWM = 50;
}
// setup the ramp
rampUpHeatPWM[0] = (defaultHeaterPWM /4);
rampUpHeatPWM[1] = (defaultHeaterPWM /4) * 2;
rampUpHeatPWM[2] = (defaultHeaterPWM /4) * 3;
}