1 /***************************************************************************
3 * WaterHeating.cpp Copyright (C) 2008 by Jon Rumble *
4 * j.w.rumble@reading.ac.uk *
6 * This file is part of HECS, *
8 * HECS is free software: you can redistribute it and/or modify *
9 * it under the terms of the GNU General Public License as published by *
10 * the Free Software Foundation, either version 2 of the License, or *
11 * (at your option) any later version. *
13 * HECS is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU General Public License for more details. *
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
19 * You should have received a copy of the GNU General Public License *
20 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
21 ***************************************************************************/
23 #include "WaterHeating.h"
25 // Constructors/Destructors
28 WaterHeating::WaterHeating (const ConfigParser
& config
, DwellingDimensions
*dims
)
36 WaterHeating::WaterHeating () { }
38 WaterHeating::~WaterHeating ( ) { }
53 void WaterHeating::setEnergyContentHotWater ( double val_in
) {
54 m_energyContentHotWater
= val_in
;
57 double WaterHeating::getEnergyContentHotWater ( ) {
58 return m_energyContentHotWater
;
62 void WaterHeating::setDistributionLoss ( double val_in
) {
63 m_distributionLoss
= val_in
;
67 double WaterHeating::getDistributionLoss ( ) {
68 return m_distributionLoss
;
72 void WaterHeating::setHotWaterUsage ( double val_in
) {
73 m_hotWaterUsage
= val_in
;
77 double WaterHeating::getHotWaterUsage ( ) {
78 return m_hotWaterUsage
;
82 void WaterHeating::setManDeclaredLoss ( double val_in
) {
83 m_manDeclaredLoss
= val_in
;
87 double WaterHeating::getManDeclaredLoss ( ) {
88 return m_manDeclaredLoss
;
92 void WaterHeating::setTempFactor ( double val_in
) {
93 m_tempFactor
= val_in
;
97 double WaterHeating::getTempFactor ( ) {
102 void WaterHeating::setEnergyLostWaterStore ( double val_in
) {
103 m_energyLostWaterStore
= val_in
;
107 double WaterHeating::getEnergyLostWaterStore ( ) {
108 return m_energyLostWaterStore
;
112 void WaterHeating::setCylinderVolume ( double val_in
) {
113 m_cylinderVolume
= val_in
;
117 double WaterHeating::getCylinderVolume ( ) {
118 return m_cylinderVolume
;
122 void WaterHeating::setHotWaterStoreLossFactor ( double val_in
) {
123 m_hotWaterStoreLossFactor
= val_in
;
127 double WaterHeating::getHotWaterStoreLossFactor ( ) {
128 return m_hotWaterStoreLossFactor
;
132 void WaterHeating::setVolumeFactor ( double val_in
) {
133 m_volumeFactor
= val_in
;
137 double WaterHeating::getVolumeFactor ( ) {
138 return m_volumeFactor
;
142 void WaterHeating::setSolarStorageVal ( double val_in
) {
143 m_solarStorageVal
= val_in
;
147 double WaterHeating::getSolarStorageVal ( ) {
148 return m_solarStorageVal
;
152 void WaterHeating::setPrimaryCircuitLoss ( double val_in
) {
153 m_primaryCircuitLoss
= val_in
;
157 double WaterHeating::getPrimaryCircuitLoss ( ) {
158 return m_primaryCircuitLoss
;
161 void WaterHeating::setCombiLoss ( double val_in
) {
162 m_combiLoss
= val_in
;
166 double WaterHeating::getCombiLoss ( ) {
171 void WaterHeating::setSolarDhw ( double val_in
) {
176 double WaterHeating::getSolarDhw ( ) {
181 void WaterHeating::setWaterHeaterOutput ( double val_in
) {
182 m_waterHeaterOutput
= val_in
;
186 double WaterHeating::getWaterHeaterOutput ( ) {
187 return m_waterHeaterOutput
;
191 void WaterHeating::setHotWaterHeatGains ( double val_in
) {
192 m_hotWaterHeatGains
= val_in
;
196 double WaterHeating::getHotWaterHeatGains ( ) {
197 return m_hotWaterHeatGains
;
200 void WaterHeating::calcAll()
206 void WaterHeating::calcHotWaterGains()
208 //Some Temp Vars for ease
209 double N
= 0.00, TFA
= 0.00;
210 TFA
= ptrDims
->get_totalFloorArea();
214 N
= 0.035 * TFA
- 0.000038 * TFA
*TFA
;
216 //Floor Area is above 420 sq Meters,
219 m_hotWaterUsage
= (25 * N
) + 38;
220 m_energyContentHotWater
= ((61 * N
)+ 92) * 0.85 * 8.76;
221 m_distributionLoss
= ((61 * N
) + 92) * 0.15 * 8.76;
225 if (m_declaredLossKnown
== 1)
227 m_tempFactor
= tempFactorLossKnown();
228 m_energyLostWaterStore
= (m_manDeclaredLoss
* m_tempFactor
)*365;
234 double L
= 0.00, VF
= 0.00;
236 if (m_looseJacket
== 1)
237 L
= 0.005 + 1.76 / (m_insultaionThickness
+ 12.80);
239 L
= 0.005 + 0.55 / (m_insultaionThickness
+ 4.00);
241 VF
= pow((120.00 / m_cylinderVolume
),0.33333333);
243 m_tempFactor
= tempFactorLossNotKnown();
244 m_energyLostWaterStore
= m_cylinderVolume
*
251 //m_solarStorageVal = m_energyLostWaterStore;
253 primaryCircuitLoss();
255 m_solarDhw
= 0.00; //FIX
257 m_waterHeaterOutput
= m_energyContentHotWater
+
260 m_primaryCircuitLoss
+
264 m_hotWaterHeatGains
= 0.25 * (m_energyContentHotWater
+ m_combiLoss
) +
266 (m_distributionLoss
+ m_solarStorageVal
+
267 m_primaryCircuitLoss
);
271 double WaterHeating::tempFactorLossKnown()
274 switch (m_storageType
)
280 //Cylinder - Cylinder Thermostat Absent.
282 m_tempFactor
= 0.60*1.3;
284 //Cylinder - Seperate time control
286 m_tempFactor
= 0.60*0.9;
296 //Hot water only thermal store
300 //Hot water only thermal store - seperate timer
302 m_tempFactor
= 0.89*0.81;
304 //Hot water only thermal store - not in airing cupboard
306 m_tempFactor
= 0.89*1.1;
308 //Integrated thermal store gasfired CPSU
312 //Integrated thermal store gasfired CPSU - seperate timer
314 m_tempFactor
= 0.89*0.81;
316 //Integrated thermal store gasfired CPSU - not in airing cupboard
318 m_tempFactor
= 0.89*1.1;
320 //Electrical CPSU winter op temp 85C
324 //Electrical CPSU winter op temp 90C
328 //Electrical CPSU winter op temp 95C
334 } /* ----- end switch ----- */
338 double WaterHeating::tempFactorLossNotKnown()
340 switch (m_storageType
)
346 //Cylinder - Cylinder Thermostat Absent.
348 m_tempFactor
= 0.60*1.3;
350 //Cylinder - Seperate time control
352 m_tempFactor
= 0.60*0.9;
356 if (m_combiStore
>= 115.00)
359 m_tempFactor
= 0.82 + 0.0022 * (115.00 - m_combiStore
);
364 if (m_combiStore
>= 115.00)
367 m_tempFactor
= 0.60 + 0.0016 * (115.00 - m_combiStore
);
369 //Hot water only thermal store
373 //Hot water only thermal store - seperate timer
375 m_tempFactor
= 1.08*0.81;
377 //Hot water only thermal store - not in airing cupboard
379 m_tempFactor
= 1.08*1.1;
381 //Integrated thermal store gasfired CPSU
385 //Integrated thermal store gasfired CPSU - seperate timer
387 m_tempFactor
= 1.08*0.81;
389 //Integrated thermal store gasfired CPSU - not in airing cupboard
391 m_tempFactor
= 1.08*1.1;
393 //Electrical CPSU winter op temp 85C
397 //Electrical CPSU winter op temp 90C
401 //Electrical CPSU winter op temp 95C
407 } /* ----- end switch ----- */
412 void WaterHeating::primaryCircuitLoss()
415 switch (m_systemType
)
417 //Electric Immersion Heater
419 m_primaryCircuitLoss
= 0.00;
421 //Boiler Uninsulated Pipework, no cyl thermostat
423 m_primaryCircuitLoss
= 1220.00;
425 //Boiler insulated Pipework, no cyl thermostat
427 m_primaryCircuitLoss
= 610.00;
429 //Boiler uninsulated Pipework, cyl thermostat
431 m_primaryCircuitLoss
= 610.00;
433 //Boiler insulated Pipework, cyl thermostat
435 m_primaryCircuitLoss
= 360.00;
439 m_primaryCircuitLoss
= 0.00;
441 //CPSU (including electric CPSU)
443 m_primaryCircuitLoss
= 0.00;
445 //Boiler and thermal store within a single casing (cyl, thermo present)
447 m_primaryCircuitLoss
= 0.00;
449 //Sep. boiler and thermal store 1.5m<= of ins pipe.
453 //Sep boiler and thermal store - uninsulated pipework
455 m_tempFactor
= 470.00;
457 //Sep boiler and thermal store - >=1.5m insulated pipework
459 m_tempFactor
= 280.00;
463 m_tempFactor
= 360.00;
467 } /* ----- end switch ----- */
471 void WaterHeating::initVars ( ) {
473 m_energyContentHotWater
= cf
.getValueDouble ("WaterHeating:energyContentHotWater");
474 m_distributionLoss
= cf
.getValueDouble ("WaterHeating:distributionLoss");
475 m_hotWaterUsage
= cf
.getValueDouble ("WaterHeating:distributionLoss");
476 m_manDeclaredLoss
= cf
.getValueDouble ("WaterHeating:manDeclaredLoss");
477 m_tempFactor
= cf
.getValueDouble ("WaterHeating:tempFactor");
478 m_energyLostWaterStore
= cf
.getValueDouble ("WaterHeating:energyLostWaterStore");
479 m_cylinderVolume
= cf
.getValueDouble ("WaterHeating:cylinderVolume");
480 m_hotWaterStoreLossFactor
= cf
.getValueDouble ("WaterHeating:hotWaterStoreLossFactor");
481 m_volumeFactor
= cf
.getValueDouble ("WaterHeating:volumeFactor");
482 m_solarStorageVal
= cf
.getValueDouble ("WaterHeating:solarStorageVal");
483 m_primaryCircuitLoss
= cf
.getValueDouble ("WaterHeating:primaryCircuitLoss");
484 m_solarDhw
= cf
.getValueDouble ("WaterHeating:solarDhw");
485 m_waterHeaterOutput
= cf
.getValueDouble ("WaterHeating:waterHeaterOutput");
486 m_hotWaterHeatGains
= cf
.getValueDouble ("WaterHeating:hotWaterHeatGains");
487 m_insultaionThickness
= cf
.getValueDouble ("WaterHeating:insulationThickness");
488 m_declaredLossKnown
= cf
.getValueInt ("WaterHeating:declaredLossKnown");
489 m_looseJacket
= cf
.getValueDouble ("WaterHeating:looseJacket");
490 m_combiStore
= cf
.getValueDouble ("WaterHeating:combiStore");
491 m_storageType
= cf
.getValueDouble ("WaterHeating:storageType");
492 m_systemType
= cf
.getValueDouble ("WaterHeating:systemType");