Initial Commit
[HECS.git] / DwellingEmissionRate.cpp
blob0fd18238687d623bfdfc79c45921de5163df96cd
1 /***************************************************************************
2 * *
3 * DwellingEmissionRate.cpp Copyright (C) 2008 by Jon Rumble *
4 * j.w.rumble@reading.ac.uk *
5 * *
6 * This file is part of HECS, *
7 * *
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. *
12 * *
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. *
17 * *
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 "DwellingEmissionRate.h"
24 // Constructors/Destructors
25 //
27 DwellingEmissionRate::DwellingEmissionRate() {}
29 DwellingEmissionRate::DwellingEmissionRate (const ConfigParser& config,
30 DwellingDimensions *dims,
31 SpaceHeating *spaceheat,
32 WaterHeatingEnergy *waterheat,
33 Gains *gains,
34 FuelCosts *fcosts)
37 cf = config;
38 ptrDims = dims;
39 ptrSpaceHeat = spaceheat;
40 ptrWaterHeatEnergy = waterheat;
41 ptrGains = gains;
42 ptrFuelCosts = fcosts;
43 initVars();
46 DwellingEmissionRate::~DwellingEmissionRate ( ) { }
48 //
49 // Methods
50 //
53 // Accessor methods
54 //
55 void DwellingEmissionRate::setSpaceHeatingEnergy ( double val_in ) {
56 m_spaceHeatingEnergy = val_in;
60 double DwellingEmissionRate::getSpaceHeatingEnergy ( ) {
61 return m_spaceHeatingEnergy;
65 void DwellingEmissionRate::setSpaceHeatingEmisFactor ( double val_in ) {
66 m_spaceHeatingEmisFactor = val_in;
70 double DwellingEmissionRate::getSpaceHeatingEmisFactor ( ) {
71 return m_spaceHeatingEmisFactor;
75 void DwellingEmissionRate::setSpaceHeatingEmissionsYear ( double val_in ) {
76 m_spaceHeatingEmissionsYear = val_in;
80 double DwellingEmissionRate::getSpaceHeatingEmissionsYear ( ) {
81 return m_spaceHeatingEmissionsYear;
85 void DwellingEmissionRate::setSecondarySpaceHeating ( double val_in ) {
86 m_secondarySpaceHeating = val_in;
90 double DwellingEmissionRate::getSecondarySpaceHeating ( ) {
91 return m_secondarySpaceHeating;
95 void DwellingEmissionRate::setSecondarySpaceHeatEmisFactor ( double val_in ) {
96 m_secondarySpaceHeatEmisFactor = val_in;
100 double DwellingEmissionRate::getSecondarySpaceHeatEmisFactor ( ) {
101 return m_secondarySpaceHeatEmisFactor;
105 void DwellingEmissionRate::setSecondarySpaceHeatingEmissionsYear ( double val_in ) {
106 m_secondarySpaceHeatingEmissionsYear = val_in;
110 double DwellingEmissionRate::getSecondarySpaceHeatingEmissionsYear ( ) {
111 return m_secondarySpaceHeatingEmissionsYear;
115 void DwellingEmissionRate::setEnergyForWaterHeating ( double val_in ) {
116 m_energyForWaterHeating = val_in;
120 double DwellingEmissionRate::getEnergyForWaterHeating ( ) {
121 return m_energyForWaterHeating;
125 void DwellingEmissionRate::setWaterHeatingEmissionsFactor ( double val_in ) {
126 m_waterHeatingEmissionsFactor = val_in;
130 double DwellingEmissionRate::getWaterHeatingEmissionsFactor ( ) {
131 return m_waterHeatingEmissionsFactor;
135 void DwellingEmissionRate::setWaterHeatingEmissionsYear ( double val_in ) {
136 m_waterHeatingEmissionsYear = val_in;
140 double DwellingEmissionRate::getWaterHeatingEmissionsYear ( ) {
141 return m_waterHeatingEmissionsYear;
145 void DwellingEmissionRate::setSpaceWaterHeating ( double val_in ) {
146 m_spaceWaterHeating = val_in;
150 double DwellingEmissionRate::getSpaceWaterHeating ( ) {
151 return m_spaceWaterHeating;
155 void DwellingEmissionRate::setElecForPumpsFansEmisFactor ( double val_in ) {
156 m_elecForPumpsFansEmisFactor = val_in;
160 double DwellingEmissionRate::getElecForPumpsFansEmisFactor ( ) {
161 return m_elecForPumpsFansEmisFactor;
165 void DwellingEmissionRate::setElecForPumpsFansEmissionsYear ( double val_in ) {
166 m_elecForPumpsFansEmissionsYear = val_in;
170 double DwellingEmissionRate::getElecForPumpsFansEmissionsYear ( ) {
171 return m_elecForPumpsFansEmissionsYear;
175 void DwellingEmissionRate::setEnergyProdOrSavedFactor ( double val_in ) {
176 m_energyProdOrSavedFactor = val_in;
180 double DwellingEmissionRate::getEnergyProdOrSavedFactor ( ) {
181 return m_energyProdOrSavedFactor;
185 void DwellingEmissionRate::setEnergyConsumed ( double val_in ) {
186 m_energyConsumedYear = val_in;
190 double DwellingEmissionRate::getEnergyConsumed ( ) {
191 return m_energyConsumedYear;
195 void DwellingEmissionRate::setTotalCO2KgYear ( double val_in ) {
196 m_totalCO2KgYear = val_in;
200 double DwellingEmissionRate::getTotalCO2KgYear ( ) {
201 return m_totalCO2KgYear;
205 void DwellingEmissionRate::setDwelCO2EmmRate ( double val_in ) {
206 m_dwelCO2EmmRate = val_in;
210 double DwellingEmissionRate::getDwelCO2EmmRate ( ) {
211 return m_dwelCO2EmmRate;
215 void DwellingEmissionRate::setLightingEmisFactor ( double val_in ) {
216 m_lightingEmisFactor = val_in;
219 double DwellingEmissionRate::getLightingEmisFactor ( ) {
220 return m_lightingEmisFactor;
224 void DwellingEmissionRate::setLightingEmissionsYear ( double val_in ) {
225 m_lightingEmissionsYear = val_in;
229 double DwellingEmissionRate::getLightingEmissionsYear ( ) {
230 return m_lightingEmissionsYear;
234 void DwellingEmissionRate::setSpaceAndWaterHeating ( double val_in ) {
235 m_spaceAndWaterHeating = val_in;
239 double DwellingEmissionRate::getSpaceAndWaterHeating ( ) {
240 return m_spaceAndWaterHeating;
244 void DwellingEmissionRate::setEnergyProdOrSavedEmissionsYear ( double val_in ) {
245 m_energyProdOrSavedEmissionsYear = val_in;
249 double DwellingEmissionRate::getEnergyProdOrSavedEmissionsYear ( ) {
250 return m_energyProdOrSavedEmissionsYear;
254 void DwellingEmissionRate::setEnergyConsumeTechnologyEmisFactor ( double val_in ) {
255 m_energyConsumeTechnologyEmisFactor = val_in;
259 double DwellingEmissionRate::getEnergyConsumeTechnologyEmisFactor ( ) {
260 return m_energyConsumeTechnologyEmisFactor;
263 void DwellingEmissionRate::setEIrating ( double val_in ) {
264 m_EIrating = val_in;
267 double DwellingEmissionRate::getEIrating ( ) {
268 return m_EIrating;
271 void DwellingEmissionRate::calcEIRating()
273 double CF = 0.00;
275 CF = (m_totalCO2KgYear)/(ptrDims->get_totalFloorArea()+45.00);
277 if (CF >= 28.3)
279 m_EIrating = 200 - 95 * log10(CF);
281 else
283 m_EIrating = 100 - 1.34 * CF;
287 // Other methods
291 void DwellingEmissionRate::calcDwellingCO2EmisRate()
293 //Make a local Copy of Table12 for use here
294 QMap <int, QList <double> > emisList = ptrFuelCosts->getTable12();
296 //Fuel For Main Heating System
297 int fuelType = ptrFuelCosts->getFuelType();
299 m_spaceHeatingEmisFactor = emisList.value(fuelType).at(2);
301 m_spaceHeatingEmissionsYear = m_spaceHeatingEmisFactor *
302 ptrSpaceHeat->getSpaceHeatingFuelMainReq();
305 //m_secondarySpaceHeatingEmissionsYear = m_secondarySpaceHeatEmisFactor *
306 // ptrSpaceHeat->getSpaceHeatingFuelSecondary();
308 m_waterHeatingEmissionsFactor = emisList.value(fuelType).at(2);
310 m_waterHeatingEmissionsYear = m_waterHeatingEmissionsFactor *
311 ptrWaterHeatEnergy->getEnergyReqdForWaterHeat();
313 m_spaceAndWaterHeating = m_spaceHeatingEmissionsYear +
314 m_secondarySpaceHeatingEmissionsYear +
315 m_waterHeatingEmissionsYear;
317 m_elecForPumpsFansEmissionsYear = m_elecForPumpsFansEmisFactor *
318 ptrWaterHeatEnergy->getTotalForAboveElec();
321 m_lightingEmisFactor = emisList.value(13).at(2);
324 m_lightingEmissionsYear =
325 m_lightingEmisFactor *
326 //Quick Hack divide by 0.15 to inverse val in gains
327 (ptrGains->getLowEnergyLightRed() / 0.15);
329 m_energyProdOrSavedEmissionsYear = m_energyProdOrSavedFactor *
330 ptrFuelCosts->getREenergyProducedSavedYear();
332 //Assuming Electricity Here ?
333 m_energyConsumeTechnologyEmisFactor = emisList.value(13).at(2);
335 m_energyConsumedYear = m_energyConsumeTechnologyEmisFactor *
336 ptrFuelCosts->getREenergyConsumedTechReq();
338 m_totalCO2KgYear = m_spaceAndWaterHeating +
339 m_elecForPumpsFansEmissionsYear +
340 m_lightingEmissionsYear -
341 m_energyProdOrSavedEmissionsYear +
342 m_energyConsumedYear;
344 m_dwelCO2EmmRate = m_totalCO2KgYear / ptrDims->get_dwellingVolume();
347 void DwellingEmissionRate::calcAll()
349 calcDwellingCO2EmisRate();
350 calcEIRating();
353 void DwellingEmissionRate::initVars ( ) {
355 m_spaceHeatingEnergy = cf.getValueDouble("DER:spaceHeatingEnergy");
356 m_spaceHeatingEmisFactor = cf.getValueDouble("DER:spaceHeatingEmisFactor");
357 m_spaceHeatingEmissionsYear = cf.getValueDouble("DER:spaceHeatingEmisFactor");
358 m_secondarySpaceHeating = cf.getValueDouble("DER:secondarySpaceHeating");
359 m_secondarySpaceHeatEmisFactor = cf.getValueDouble("DER:secondarySpaceHeatEmisFactor");
360 m_secondarySpaceHeatingEmissionsYear = cf.getValueDouble("DER:secondarySpaceHeatingEmissionsYear");
361 m_energyForWaterHeating = cf.getValueDouble("DER:energyForWaterHeating");
362 m_waterHeatingEmissionsFactor = cf.getValueDouble("DER:waterHeatingEmissionsFactor");
363 m_waterHeatingEmissionsYear = cf.getValueDouble("DER:waterHeatingEmissionsYear");
364 m_spaceWaterHeating = cf.getValueDouble("DER:spaceWaterHeating");
365 m_elecForPumpsFansEmisFactor = cf.getValueDouble("DER:elecForPumpsFansEmisFactor");
366 m_elecForPumpsFansEmissionsYear = cf.getValueDouble("DER:elecForPumpsFansEmissionsFactor");
367 m_energyProdOrSavedFactor = cf.getValueDouble("DER:energyProdOrSavedFactor");
368 m_energyConsumedYear = cf.getValueDouble("DER:energyConsumedYear");
369 m_totalCO2KgYear = cf.getValueDouble("DER:totalCO2KgYear");
370 m_dwelCO2EmmRate = cf.getValueDouble("DER:dwelCO2EmmRate");
371 m_lightingEmisFactor = cf.getValueDouble("DER:lightingEmisFactor");
372 m_lightingEmissionsYear = cf.getValueDouble("DER:lightingEmissionsYear");
373 m_spaceAndWaterHeating = cf.getValueDouble("DER:spaceAndWaterHeating");
374 m_energyProdOrSavedEmissionsYear = cf.getValueDouble("DER:energyProdOrSavedEmissionsYear");
375 m_energyConsumeTechnologyEmisFactor = cf.getValueDouble("DER:energyConsumeTechnologyEmisFactor");
376 m_EIrating = cf.getValueDouble("DER:EIrating");