Commit 0a24e789549be408fe5be464432f3af6c9c56669
1 parent
1afa113c
Added Energy saving mode and optimised heating
Showing
1 changed file
with
135 additions
and
71 deletions
Show diff stats
@@ -10,11 +10,12 @@ | @@ -10,11 +10,12 @@ | ||
10 | #define TASK_NUMBER 32 | 10 | #define TASK_NUMBER 32 |
11 | #define T_INIT_THRESH 40 | 11 | #define T_INIT_THRESH 40 |
12 | #define T_STEP_THRESH 80 | 12 | #define T_STEP_THRESH 80 |
13 | -#define T_HOLD_THRESH 85 //OP is 88 | 13 | +#define T_HOLD_THRESH 88 |
14 | +#define T_ECO_MODE_THRESH 50 | ||
14 | #define INIT_HEAT_TIME 15 | 15 | #define INIT_HEAT_TIME 15 |
15 | -#define INIT_WAIT_TIME 15 | 16 | +#define INIT_WAIT_TIME 12 |
16 | #define STEP_HEAT_TIME 2 | 17 | #define STEP_HEAT_TIME 2 |
17 | -#define STEP_WAIT_TIME 8 //OP is 5 | 18 | +#define STEP_WAIT_TIME 6 |
18 | #define HOLD_HEAT_TIME 1 | 19 | #define HOLD_HEAT_TIME 1 |
19 | #define HOLD_WAIT_TIME 8 | 20 | #define HOLD_WAIT_TIME 8 |
20 | #define HOLD_PUMP_HEAT_TIME 3 | 21 | #define HOLD_PUMP_HEAT_TIME 3 |
@@ -70,28 +71,28 @@ void* processHeat(void* arg) | @@ -70,28 +71,28 @@ void* processHeat(void* arg) | ||
70 | while(!stopHeat) | 71 | while(!stopHeat) |
71 | { | 72 | { |
72 | tNow = clock(); | 73 | tNow = clock(); |
73 | - | 74 | + |
74 | //Chaufffe initiale | 75 | //Chaufffe initiale |
75 | if (task[0]) | 76 | if (task[0]) |
76 | { | 77 | { |
77 | printx(INFO, HEAT, "Entering in task 0\n"); | 78 | printx(INFO, HEAT, "Entering in task 0\n"); |
78 | tTask = clock(); | 79 | tTask = clock(); |
79 | - | 80 | + |
80 | if (tAct < T_INIT_THRESH) | 81 | if (tAct < T_INIT_THRESH) |
81 | { | 82 | { |
82 | setHeatOn(); | 83 | setHeatOn(); |
83 | - printx(INFO, HEAT, "Début chauffe initiale 0\n"); | 84 | + printx(INFO, HEAT, "Début chauffe initiale 0\n"); |
84 | task[0] = false; | 85 | task[0] = false; |
85 | task[1] = true; | 86 | task[1] = true; |
86 | } | 87 | } |
87 | - | 88 | + |
88 | else | 89 | else |
89 | { | 90 | { |
90 | task[0] = false; | 91 | task[0] = false; |
91 | task[6] = true; | 92 | task[6] = true; |
92 | } | 93 | } |
93 | } | 94 | } |
94 | - | 95 | + |
95 | else if (task[1]) | 96 | else if (task[1]) |
96 | { | 97 | { |
97 | printx(INFO, HEAT, "Entering in task 1\n"); | 98 | printx(INFO, HEAT, "Entering in task 1\n"); |
@@ -99,7 +100,7 @@ void* processHeat(void* arg) | @@ -99,7 +100,7 @@ void* processHeat(void* arg) | ||
99 | task[1] = false; | 100 | task[1] = false; |
100 | task[2] = true; | 101 | task[2] = true; |
101 | } | 102 | } |
102 | - | 103 | + |
103 | else if (task[2]) | 104 | else if (task[2]) |
104 | { | 105 | { |
105 | printx(INFO, HEAT, "Entering in task 2\n"); | 106 | printx(INFO, HEAT, "Entering in task 2\n"); |
@@ -112,7 +113,7 @@ void* processHeat(void* arg) | @@ -112,7 +113,7 @@ void* processHeat(void* arg) | ||
112 | task[3] = true; | 113 | task[3] = true; |
113 | } | 114 | } |
114 | } | 115 | } |
115 | - | 116 | + |
116 | else if (task[3]) | 117 | else if (task[3]) |
117 | { | 118 | { |
118 | printx(INFO, HEAT, "Entering in task 3\n"); | 119 | printx(INFO, HEAT, "Entering in task 3\n"); |
@@ -120,7 +121,7 @@ void* processHeat(void* arg) | @@ -120,7 +121,7 @@ void* processHeat(void* arg) | ||
120 | task[3] = false; | 121 | task[3] = false; |
121 | task[4] = true; | 122 | task[4] = true; |
122 | } | 123 | } |
123 | - | 124 | + |
124 | else if (task[4]) | 125 | else if (task[4]) |
125 | { | 126 | { |
126 | printx(INFO, HEAT, "Entering in task 4\n"); | 127 | printx(INFO, HEAT, "Entering in task 4\n"); |
@@ -131,8 +132,8 @@ void* processHeat(void* arg) | @@ -131,8 +132,8 @@ void* processHeat(void* arg) | ||
131 | task[5] = true; | 132 | task[5] = true; |
132 | } | 133 | } |
133 | } | 134 | } |
134 | - | ||
135 | - | 135 | + |
136 | + | ||
136 | //Chauffe par palier | 137 | //Chauffe par palier |
137 | else if (task[5]) | 138 | else if (task[5]) |
138 | { | 139 | { |
@@ -141,26 +142,26 @@ void* processHeat(void* arg) | @@ -141,26 +142,26 @@ void* processHeat(void* arg) | ||
141 | task[5] = false; | 142 | task[5] = false; |
142 | task[6] = true; | 143 | task[6] = true; |
143 | } | 144 | } |
144 | - | ||
145 | - | 145 | + |
146 | + | ||
146 | else if (task[6]) | 147 | else if (task[6]) |
147 | { | 148 | { |
148 | printx(INFO, HEAT, "Entering in task 6\n"); | 149 | printx(INFO, HEAT, "Entering in task 6\n"); |
149 | if (tAct < T_STEP_THRESH) | 150 | if (tAct < T_STEP_THRESH) |
150 | { | 151 | { |
151 | - printx(INFO, HEAT, "Début Chauffe par palier 3\n"); | 152 | + printx(INFO, HEAT, "Début Chauffe par palier 3\n"); |
152 | setHeatOn(); | 153 | setHeatOn(); |
153 | task[6] = false; | 154 | task[6] = false; |
154 | task[7] = true; | 155 | task[7] = true; |
155 | } | 156 | } |
156 | - | 157 | + |
157 | else | 158 | else |
158 | { | 159 | { |
159 | task[6] = false; | 160 | task[6] = false; |
160 | - task[11] = true; //Numéro de tache début "Maintien au chaud" | 161 | + task[11] = true; //Numéro de tache début "Maintien au chaud" |
161 | } | 162 | } |
162 | } | 163 | } |
163 | - | 164 | + |
164 | else if (task[7]) | 165 | else if (task[7]) |
165 | { | 166 | { |
166 | printx(INFO, HEAT, "Entering in task 7\n"); | 167 | printx(INFO, HEAT, "Entering in task 7\n"); |
@@ -168,19 +169,19 @@ void* processHeat(void* arg) | @@ -168,19 +169,19 @@ void* processHeat(void* arg) | ||
168 | task[7] = false; | 169 | task[7] = false; |
169 | task[8] = true; | 170 | task[8] = true; |
170 | } | 171 | } |
171 | - | 172 | + |
172 | else if (task[8]) | 173 | else if (task[8]) |
173 | { | 174 | { |
174 | printx(INFO, HEAT, "Entering in task 8\n"); | 175 | printx(INFO, HEAT, "Entering in task 8\n"); |
175 | if( ((tNow - tTask) / CLOCKS_PER_SEC) > STEP_HEAT_TIME ) | 176 | if( ((tNow - tTask) / CLOCKS_PER_SEC) > STEP_HEAT_TIME ) |
176 | { | 177 | { |
177 | - printx(INFO, HEAT, "Fin de chauffe palier intermédiaire 4\n"); | 178 | + printx(INFO, HEAT, "Fin de chauffe palier intermédiaire 4\n"); |
178 | setHeatOff(); | 179 | setHeatOff(); |
179 | task[8] = false; | 180 | task[8] = false; |
180 | task[9] = true; | 181 | task[9] = true; |
181 | } | 182 | } |
182 | } | 183 | } |
183 | - | 184 | + |
184 | else if (task[9]) | 185 | else if (task[9]) |
185 | { | 186 | { |
186 | printx(INFO, HEAT, "Entering in task 9\n"); | 187 | printx(INFO, HEAT, "Entering in task 9\n"); |
@@ -188,20 +189,20 @@ void* processHeat(void* arg) | @@ -188,20 +189,20 @@ void* processHeat(void* arg) | ||
188 | task[9] = false; | 189 | task[9] = false; |
189 | task[10] = true; | 190 | task[10] = true; |
190 | } | 191 | } |
191 | - | 192 | + |
192 | else if (task[10]) | 193 | else if (task[10]) |
193 | { | 194 | { |
194 | printx(INFO, HEAT, "Entering in task 10\n"); | 195 | printx(INFO, HEAT, "Entering in task 10\n"); |
195 | if( ((tNow - tTask) / CLOCKS_PER_SEC) > STEP_WAIT_TIME ) | 196 | if( ((tNow - tTask) / CLOCKS_PER_SEC) > STEP_WAIT_TIME ) |
196 | { | 197 | { |
197 | - printx(INFO, HEAT, "Fin d'attente palier intermédiaire 5\n"); | ||
198 | - | 198 | + printx(INFO, HEAT, "Fin d'attente palier intermédiaire 5\n"); |
199 | + | ||
199 | if ( tAct < T_STEP_THRESH ) | 200 | if ( tAct < T_STEP_THRESH ) |
200 | { | 201 | { |
201 | task[10] = false; | 202 | task[10] = false; |
202 | task[5] = true; | 203 | task[5] = true; |
203 | } | 204 | } |
204 | - | 205 | + |
205 | else | 206 | else |
206 | { | 207 | { |
207 | task[10] = false; | 208 | task[10] = false; |
@@ -209,26 +210,36 @@ void* processHeat(void* arg) | @@ -209,26 +210,36 @@ void* processHeat(void* arg) | ||
209 | } | 210 | } |
210 | } | 211 | } |
211 | } | 212 | } |
212 | - | ||
213 | - | 213 | + |
214 | + | ||
214 | // Maintien au chaud | 215 | // Maintien au chaud |
215 | else if (task[11]) | 216 | else if (task[11]) |
216 | { | 217 | { |
217 | printx(INFO, HEAT, "Entering in task 11\n"); | 218 | printx(INFO, HEAT, "Entering in task 11\n"); |
218 | tTask = clock(); | 219 | tTask = clock(); |
219 | - task[11] = false; | ||
220 | - task[12] = true; | 220 | + |
221 | + if (eco_mode) | ||
222 | + { | ||
223 | + task[11] = false; | ||
224 | + task[24] = true; //Numéro tache Mode éco | ||
225 | + } | ||
226 | + | ||
227 | + else | ||
228 | + { | ||
229 | + task[11] = false; | ||
230 | + task[12] = true; | ||
231 | + } | ||
221 | } | 232 | } |
222 | - | 233 | + |
223 | else if (task[12]) | 234 | else if (task[12]) |
224 | { | 235 | { |
225 | printx(INFO, HEAT, "Entering in task 12\n"); | 236 | printx(INFO, HEAT, "Entering in task 12\n"); |
226 | - printx(INFO, HEAT, "Début Maintien au chaud 6\n"); | 237 | + printx(INFO, HEAT, "Début Maintien au chaud 6\n"); |
227 | setHeatOk(); | 238 | setHeatOk(); |
228 | task[12]=false; | 239 | task[12]=false; |
229 | task[13]=true; | 240 | task[13]=true; |
230 | } | 241 | } |
231 | - | 242 | + |
232 | else if (task[13]) | 243 | else if (task[13]) |
233 | { | 244 | { |
234 | printx(INFO, HEAT, "Entering in task 13\n"); | 245 | printx(INFO, HEAT, "Entering in task 13\n"); |
@@ -236,41 +247,41 @@ void* processHeat(void* arg) | @@ -236,41 +247,41 @@ void* processHeat(void* arg) | ||
236 | task[13] = false; | 247 | task[13] = false; |
237 | task[14] = true; | 248 | task[14] = true; |
238 | } | 249 | } |
239 | - | 250 | + |
240 | else if (task[14]) | 251 | else if (task[14]) |
241 | { | 252 | { |
242 | printx(INFO, HEAT, "Entering in task 14\n"); | 253 | printx(INFO, HEAT, "Entering in task 14\n"); |
243 | if(hold_heat) | 254 | if(hold_heat) |
244 | { | 255 | { |
245 | if( (tAct < T_HOLD_THRESH)) | 256 | if( (tAct < T_HOLD_THRESH)) |
246 | - { | 257 | + { |
247 | if (!isPumpOn()) | 258 | if (!isPumpOn()) |
248 | { | 259 | { |
249 | - printx(INFO, HEAT, "Début Chauffe maintien sans pompe 7\n"); | 260 | + printx(INFO, HEAT, "Début Chauffe maintien sans pompe 7\n"); |
250 | setHeatOn(); | 261 | setHeatOn(); |
251 | task[14] = false; | 262 | task[14] = false; |
252 | task[15] = true; | 263 | task[15] = true; |
253 | } | 264 | } |
254 | - | ||
255 | - else | 265 | + |
266 | + else | ||
256 | { | 267 | { |
257 | - printx(INFO, HEAT, "Début Chauffe maintien avec pompe 7'\n"); | 268 | + printx(INFO, HEAT, "Début Chauffe maintien avec pompe 7'\n"); |
258 | setHeatOn(); | 269 | setHeatOn(); |
259 | task[14]=false; | 270 | task[14]=false; |
260 | - task[19]=true; //Numéro de tache "T<Thold && pumpitup" | 271 | + task[19]=true; //Numéro de tache "T<Thold && pumpitup" |
261 | } | 272 | } |
262 | } | 273 | } |
263 | - | 274 | + |
264 | } | 275 | } |
265 | - | 276 | + |
266 | else | 277 | else |
267 | { | 278 | { |
268 | - printx(INFO, HEAT, "Maintien au chaud annulé 7 ' ' Go etape de fin\n"); | 279 | + printx(INFO, HEAT, "Maintien au chaud annulé 7 ' ' Go etape de fin\n"); |
269 | task[14]=false; | 280 | task[14]=false; |
270 | - task[23]=true; //Sinon go étape d'attente fin | 281 | + task[23]=true; //Sinon go étape d'attente fin |
271 | } | 282 | } |
272 | } | 283 | } |
273 | - | 284 | + |
274 | else if (task[15]) | 285 | else if (task[15]) |
275 | { | 286 | { |
276 | printx(INFO, HEAT, "Entering in task 15\n"); | 287 | printx(INFO, HEAT, "Entering in task 15\n"); |
@@ -278,7 +289,7 @@ void* processHeat(void* arg) | @@ -278,7 +289,7 @@ void* processHeat(void* arg) | ||
278 | task[15] = false; | 289 | task[15] = false; |
279 | task[16] = true; | 290 | task[16] = true; |
280 | } | 291 | } |
281 | - | 292 | + |
282 | //Maintien au chaud sans pompage | 293 | //Maintien au chaud sans pompage |
283 | else if (task[16]) | 294 | else if (task[16]) |
284 | { | 295 | { |
@@ -291,7 +302,7 @@ void* processHeat(void* arg) | @@ -291,7 +302,7 @@ void* processHeat(void* arg) | ||
291 | task[17] = true; | 302 | task[17] = true; |
292 | } | 303 | } |
293 | } | 304 | } |
294 | - | 305 | + |
295 | else if (task[17]) | 306 | else if (task[17]) |
296 | { | 307 | { |
297 | printx(INFO, HEAT, "Entering in task 17\n"); | 308 | printx(INFO, HEAT, "Entering in task 17\n"); |
@@ -299,7 +310,7 @@ void* processHeat(void* arg) | @@ -299,7 +310,7 @@ void* processHeat(void* arg) | ||
299 | task[17] = false; | 310 | task[17] = false; |
300 | task[18] = true; | 311 | task[18] = true; |
301 | } | 312 | } |
302 | - | 313 | + |
303 | else if (task[18]) | 314 | else if (task[18]) |
304 | { | 315 | { |
305 | printx(INFO, HEAT, "Entering in task 18\n"); | 316 | printx(INFO, HEAT, "Entering in task 18\n"); |
@@ -307,13 +318,13 @@ void* processHeat(void* arg) | @@ -307,13 +318,13 @@ void* processHeat(void* arg) | ||
307 | { | 318 | { |
308 | if ( tAct < T_HOLD_THRESH) | 319 | if ( tAct < T_HOLD_THRESH) |
309 | { | 320 | { |
310 | - printx(INFO, HEAT, "Fin d'attente chauffe intermédiaire maintien 9\n"); | ||
311 | - task[18] = false; | ||
312 | - task[11] = true; //Retour au début de "Maintien au chaud" | 321 | + printx(INFO, HEAT, "Fin d'attente chauffe intermédiaire maintien 9\n"); |
322 | + task[18] = false; | ||
323 | + task[11] = true; //Retour au début de "Maintien au chaud" | ||
313 | } | 324 | } |
314 | } | 325 | } |
315 | } | 326 | } |
316 | - | 327 | + |
317 | //Maintien au chaud avec pompage | 328 | //Maintien au chaud avec pompage |
318 | else if (task[19]) | 329 | else if (task[19]) |
319 | { | 330 | { |
@@ -321,8 +332,8 @@ void* processHeat(void* arg) | @@ -321,8 +332,8 @@ void* processHeat(void* arg) | ||
321 | tTask = clock(); | 332 | tTask = clock(); |
322 | task[19] = false; | 333 | task[19] = false; |
323 | task[20] = true; | 334 | task[20] = true; |
324 | - } | ||
325 | - | 335 | + } |
336 | + | ||
326 | else if (task[20]) | 337 | else if (task[20]) |
327 | { | 338 | { |
328 | printx(INFO, HEAT, "Entering in task 20\n"); | 339 | printx(INFO, HEAT, "Entering in task 20\n"); |
@@ -334,7 +345,7 @@ void* processHeat(void* arg) | @@ -334,7 +345,7 @@ void* processHeat(void* arg) | ||
334 | task[21] = true; | 345 | task[21] = true; |
335 | } | 346 | } |
336 | } | 347 | } |
337 | - | 348 | + |
338 | else if (task[21]) | 349 | else if (task[21]) |
339 | { | 350 | { |
340 | printx(INFO, HEAT, "Entering in task 21\n"); | 351 | printx(INFO, HEAT, "Entering in task 21\n"); |
@@ -342,7 +353,7 @@ void* processHeat(void* arg) | @@ -342,7 +353,7 @@ void* processHeat(void* arg) | ||
342 | task[21] = false; | 353 | task[21] = false; |
343 | task[22] = true; | 354 | task[22] = true; |
344 | } | 355 | } |
345 | - | 356 | + |
346 | else if (task[22]) | 357 | else if (task[22]) |
347 | { | 358 | { |
348 | printx(INFO, HEAT, "Entering in task 22\n"); | 359 | printx(INFO, HEAT, "Entering in task 22\n"); |
@@ -350,37 +361,90 @@ void* processHeat(void* arg) | @@ -350,37 +361,90 @@ void* processHeat(void* arg) | ||
350 | { | 361 | { |
351 | if ( tAct < T_HOLD_THRESH) | 362 | if ( tAct < T_HOLD_THRESH) |
352 | { | 363 | { |
353 | - printx(INFO, HEAT, "Fin d'attente chauffe intermédiaire maintien avec pompe 11\n"); | 364 | + printx(INFO, HEAT, "Fin d'attente chauffe intermédiaire maintien avec pompe 11\n"); |
354 | task[22] = false; | 365 | task[22] = false; |
355 | - task[11] = true; //Retour au début de "Maintien au chaud" | ||
356 | - } | 366 | + task[5] = true; //Retour au début de "Chauffe par palier" (shuntera si temperature OK (t>T_HOLD_THRESH)) |
367 | + } | ||
357 | } | 368 | } |
358 | } | 369 | } |
359 | 370 | ||
360 | - //Fin de maintien au chaud (demandé par l'extérieur) et reboucle quand hold_heat est remis | 371 | + //Fin de maintien au chaud (demandé par l'extérieur) et reboucle quand hold_heat est remis |
361 | else if(task[23]) | 372 | else if(task[23]) |
362 | { | 373 | { |
363 | printx(INFO, HEAT, "Entering in task 23\n"); | 374 | printx(INFO, HEAT, "Entering in task 23\n"); |
364 | setHeatOff(); | 375 | setHeatOff(); |
365 | - heat_ok=false; | ||
366 | - | 376 | + resetHeatOk(); |
377 | + | ||
367 | if(hold_heat) | 378 | if(hold_heat) |
368 | { | 379 | { |
369 | task[23]=false; | 380 | task[23]=false; |
370 | - task[0]=true; //Retour au début | 381 | + task[0]=true; //Retour au début |
371 | } | 382 | } |
372 | } | 383 | } |
373 | - | ||
374 | - | ||
375 | - //Mode économie d'énergie | 384 | + |
385 | + | ||
386 | + //Mode économie d'énergie | ||
376 | else if(task[24]) | 387 | else if(task[24]) |
377 | { | 388 | { |
378 | - //task[]=false; | ||
379 | - //task[]=true; | 389 | + printx(INFO, HEAT, "Entering in task 24\n"); |
390 | + printx(INFO, HEAT, "Début Mode Eco maintien 24\n"); | ||
391 | + | ||
392 | + if (eco_mode) | ||
393 | + { | ||
394 | + if (tAct < T_ECO_MODE_THRESH) | ||
395 | + { | ||
396 | + printx(INFO, HEAT, "Debut chauffe maintien Eco Mode 25\n"); | ||
397 | + setHeatOn(); | ||
398 | + task[24] = false; | ||
399 | + task[25] = true; | ||
400 | + } | ||
401 | + } | ||
402 | + | ||
403 | + else | ||
404 | + { | ||
405 | + task[24] = false; | ||
406 | + task[5] = true; //Retour "Chauffe par palier" | ||
407 | + } | ||
408 | + } | ||
409 | + | ||
410 | + else if (task[25]) | ||
411 | + { | ||
412 | + tTask = clock(); | ||
413 | + task[25] = false; | ||
414 | + task[26] = true; | ||
380 | } | 415 | } |
416 | + | ||
417 | + else if (task[26]) | ||
418 | + { | ||
419 | + if( ((tNow - tTask) / CLOCKS_PER_SEC) > HOLD_HEAT_TIME ) | ||
420 | + { | ||
421 | + printx(INFO, HEAT, "Fin chauffe maintien Eco mode 27\n"); | ||
422 | + setHeatOff(); | ||
423 | + task[26] = false; | ||
424 | + task[27] = true; | ||
425 | + } | ||
426 | + } | ||
427 | + | ||
428 | + else if (task[27]) | ||
429 | + { | ||
430 | + tTask = clock(); | ||
431 | + task[27] = false; | ||
432 | + task[28] = true; | ||
433 | + } | ||
434 | + | ||
435 | + else if (task[28]) | ||
436 | + { | ||
437 | + if( ((tNow - tTask) / CLOCKS_PER_SEC) > HOLD_WAIT_TIME ) | ||
438 | + { | ||
439 | + printx(INFO, HEAT, "Fin d'attente maintien Eco mode 29\n"); | ||
440 | + task[28] = false; | ||
441 | + task[24] = true; | ||
442 | + } | ||
443 | + } | ||
444 | + | ||
381 | usleep(20000); | 445 | usleep(20000); |
382 | - } | ||
383 | - | ||
384 | - | 446 | + } |
447 | + | ||
448 | + | ||
385 | return NULL; | 449 | return NULL; |
386 | } | 450 | } |