Initial Commit
[HECS.git] / FuelCosts.cpp
blob60e249d310454fb3ba2abfb9b7ebbfb9b4d057c7
3 #include "FuelCosts.h"
6 FuelCosts::FuelCosts (const ConfigParser& config,
7 DwellingDimensions *dims,
8 SpaceHeating *sheat,
9 WaterHeatingEnergy *wheat,
10 Gains *gains)
13 cf = config;
14 ptrSpaceHeating = sheat;
15 ptrWaterHeatingEnergy = wheat;
16 ptrDims = dims;
17 ptrGains= gains;
18 initVars();
21 FuelCosts::~FuelCosts () { }
23 void FuelCosts::setSpaceHeatFuelPricePri ( double val_in ) {
24 m_spaceHeatFuelPricePri = val_in;
28 double FuelCosts::getSpaceHeatFuelPricePri ( ) {
29 return m_spaceHeatFuelPricePri;
33 void FuelCosts::setSpaceHeatFuelCostPri ( double val_in ) {
34 m_spaceHeatFuelCostPri = val_in;
37 double FuelCosts::getSpaceHeatFuelCostPri ( ) {
38 return m_spaceHeatFuelCostPri;
41 void FuelCosts::setSpaceHeatFuelPriceSec ( double val_in ) {
42 m_spaceHeatFuelPriceSec = val_in;
46 double FuelCosts::getSpaceHeatFuelPriceSec ( ) {
47 return m_spaceHeatFuelPriceSec;
51 void FuelCosts::setSpaceHeatFuelCostSec ( double val_in ) {
52 m_spaceHeatFuelCostSec = val_in;
56 double FuelCosts::getSpaceHeatFuelCostSec ( ) {
57 return m_spaceHeatFuelCostSec;
61 void FuelCosts::setWaterHeatOnPeakFrac ( double val_in ) {
62 m_waterHeatOnPeakFracCost = val_in;
65 double FuelCosts::getWaterHeatOnPeakFrac ( ) {
66 return m_waterHeatOnPeakFracCost;
69 void FuelCosts::setWaterHeatOffPeakFrac ( double val_in ) {
70 m_waterHeatOffPeakFracCost = val_in;
73 double FuelCosts::getWaterHeatOffPeakFrac ( ) {
74 return m_waterHeatOffPeakFracCost;
77 void FuelCosts::setWaterHeatOnPeakFuelPrice ( double val_in ) {
78 m_waterHeatOnPeakFuelPrice = val_in;
81 double FuelCosts::getWaterHeatOnPeakFuelPrice ( ) {
82 return m_waterHeatOnPeakFuelPrice;
85 void FuelCosts::setWaterHeatOnPeakCost ( double val_in ) {
86 m_waterHeatOnPeakCost = val_in;
89 double FuelCosts::getWaterHeatOnPeakCost ( ) {
90 return m_waterHeatOnPeakCost;
94 void FuelCosts::setWaterHeatOffPeakCost ( double val_in ) {
95 m_waterHeatOffPeakCost = val_in;
98 double FuelCosts::getWaterHeatOffPeakCost ( ) {
99 return m_waterHeatOffPeakCost;
102 void FuelCosts::setWaterHeatOffPeakFuelPrice ( double val_in ) {
103 m_waterHeatOffPeakFuelPrice = val_in;
106 double FuelCosts::getWaterHeatOffPeakFuelPrice ( ) {
107 return m_waterHeatOffPeakFuelPrice;
110 void FuelCosts::setWaterHeatingOtherFuelPrice ( double val_in ) {
111 m_waterHeatingOtherFuelPrice = val_in;
114 double FuelCosts::getWaterHeatingOtherFuelPrice ( ) {
115 return m_waterHeatingOtherFuelPrice;
118 void FuelCosts::setWaterHeatingOtherFuelCost ( double val_in ) {
119 m_waterHeatingOtherFuelCost = val_in;
122 double FuelCosts::getWaterHeatingOtherFuelCost ( ) {
123 return m_waterHeatingOtherFuelCost;
126 void FuelCosts::setPumpFanEnergyPrice ( double val_in ) {
127 m_pumpFanEnergyPrice = val_in;
130 double FuelCosts::getPumpFanEnergyPrice ( ) {
131 return m_pumpFanEnergyPrice;
134 void FuelCosts::setPumpFanEnergyCost ( double val_in ) {
135 m_pumpFanEnergyCost = val_in;
138 double FuelCosts::getPumpFanEnergyCost ( ) {
139 return m_pumpFanEnergyCost;
142 /*void FuelCosts::setEnergyLightingReq ( double val_in ) {
143 m_EnergyLightingReq = val_in;
146 double FuelCosts::getEnergyLightingReq ( ) {
147 return m_EnergyLightingReq;
150 void FuelCosts::setEnergyLightingPrice ( double val_in ) {
151 m_EnergyLightingPrice = val_in;
154 double FuelCosts::getEnergyLightingPrice ( ) {
155 return m_EnergyLightingPrice;
158 void FuelCosts::setEnergyLightingCost ( double val_in ) {
159 m_EnergyLightingCost = val_in;
162 double FuelCosts::getEnergyLightingCost ( ) {
163 return m_EnergyLightingCost;
166 void FuelCosts::setAddtnStandingCharges ( double val_in ) {
167 m_addtnStandingCharges = val_in;
170 double FuelCosts::getAddtnStandingCharges ( ) {
171 return m_addtnStandingCharges;
174 void FuelCosts::setREenergyProducedSavedYear ( double val_in ) {
175 m_REenergyProducedSavedYear = val_in;
178 double FuelCosts::getREenergyProducedSavedYear ( ) {
179 return m_REenergyProducedSavedYear;
182 void FuelCosts::setREenergyProducedPrice ( double val_in ) {
183 m_REenergyProducedPrice = val_in;
186 double FuelCosts::getREenergyProducedPrice ( ) {
187 return m_REenergyProducedPrice;
190 void FuelCosts::setREenergyProducedCost ( double val_in ) {
191 m_REenergyProducedCost = val_in;
194 double FuelCosts::getREenergyProducedCost ( ) {
195 return m_REenergyProducedCost;
198 void FuelCosts::setREenergyConsumedTechReq ( double val_in ) {
199 m_REenergyConsumedTechReq = val_in;
202 double FuelCosts::getREenergyConsumedTechReq ( ) {
203 return m_REenergyConsumedTechReq;
206 void FuelCosts::setREcostConsumedPrice ( double val_in ) {
207 m_REcostConsumedPrice = val_in;
210 double FuelCosts::getREcostConsumedPrice ( ) {
211 return m_REcostConsumedPrice;
214 void FuelCosts::setREcostConsumedCost ( double val_in ) {
215 m_REcostConsumedCost = val_in;
218 int FuelCosts::getFuelType ( ) {
219 return m_fuelType;
222 void FuelCosts::setFuelType ( int val_in ) {
223 m_fuelType = val_in;
226 double FuelCosts::getREcostConsumedCost ( ) {
227 return m_REcostConsumedCost;
230 void FuelCosts::setTotalEnergyCost ( double val_in ) {
231 m_totalEnergyCost = val_in;
234 double FuelCosts::getTotalEnergyCost ( ) {
235 return m_totalEnergyCost;
238 void FuelCosts::setSAPenergyCostDeflator (double val_in ) {
239 m_SAPenergyCostDeflator = val_in;
242 double FuelCosts::getSAPenergyCostDeflator ( ) {
243 return m_SAPenergyCostDeflator;
246 void FuelCosts::setSAPEnergyCostFactor ( double val_in ) {
247 m_SAPEnergyCostFactor = val_in;
250 double FuelCosts::getSAPEnergyCostFactor ( ) {
251 return m_SAPEnergyCostFactor;
254 void FuelCosts::setSAPrating ( double val_in ) {
255 m_SAPrating = val_in;
258 double FuelCosts::getSAPrating ( ) {
259 return m_SAPrating;
263 QMap <int, QList <double> > FuelCosts::getTable12()
265 return table12;
268 void FuelCosts::initVars()
270 buildLT();
272 m_spaceHeatFuelPricePri = cf.getValueDouble("FuelCosts:spaceHeatFuelPricePri");
273 m_spaceHeatFuelCostPri = cf.getValueDouble("FuelCosts:spaceHeatFuelCostPri");
275 m_spaceHeatFuelPriceSec = cf.getValueDouble("FuelCosts:spaceHeatFuelPriceSec");
276 m_spaceHeatFuelCostSec = cf.getValueDouble("FuelCosts:spaceHeatFuelCostSec");
277 m_waterHeatOnPeakFracCost = cf.getValueDouble("FuelCosts:waterHeatOnPeakFracCost");
278 m_waterHeatOnPeakFuelPrice = cf.getValueDouble("FuelCosts:waterHeatOnPeakFuelPrice");
279 m_waterHeatOnPeakCost = cf.getValueDouble("FuelCosts:waterHeatOnPeakCost");
280 m_waterHeatOnPeakFracCost = cf.getValueDouble("FuelCosts:waterHeatOnPeakFracCost");
281 m_waterHeatOffPeakCost = cf.getValueDouble("FuelCosts:waterHeatOffPeakCost");
282 m_waterHeatingOtherFuelPrice = cf.getValueDouble("FuelCosts:waterHeatingOtherFuelPrice");
283 m_waterHeatingOtherFuelCost = cf.getValueDouble("FuelCosts:waterHeatingOtherFuelCost");
284 m_pumpFanEnergyPrice = cf.getValueDouble("FuelCosts:pumpFanEnergyPrice");
285 m_pumpFanEnergyCost = cf.getValueDouble("FuelCosts:pumpFanEnergyCost");
286 //m_EnergyLightingReq = cf.getValueDouble("FuelCosts:EnergyLightingReq");
287 m_EnergyLightingPrice = cf.getValueDouble("FuelCosts:EnergyLightingPrice");
288 m_EnergyLightingCost = cf.getValueDouble("FuelCosts:EnergyLightingCost");
289 m_addtnStandingCharges = cf.getValueDouble("FuelCosts:addtnStandingCharges");
290 m_REenergyProducedSavedYear = cf.getValueDouble("FuelCosts:REenergyProducedSavedYear");
291 m_REenergyProducedPrice = cf.getValueDouble("FuelCosts:REenergyProducedPrice");
292 m_REenergyProducedCost = cf.getValueDouble("FuelCosts:REenergyProducedCost");
293 m_REenergyConsumedTechReq = cf.getValueDouble("FuelCosts:REenergyConsumedTechReq");
294 m_REcostConsumedPrice = cf.getValueDouble("FuelCosts:REcostConsumedPrice");
295 m_REcostConsumedCost = cf.getValueDouble("FuelCosts:REcostConsumedCost");
296 m_totalEnergyCost = cf.getValueDouble("FuelCosts:totalEnergyCost");
297 m_SAPenergyCostDeflator = 0.91;
298 m_SAPEnergyCostFactor = cf.getValueDouble("FuelCosts:SAPEnergyCostFactor");
299 m_SAPrating = cf.getValueDouble("FuelCosts:SAPrating");
300 m_fuelType = cf.getValueDouble("FuelCosts:fuelType");
303 void FuelCosts::calcAll()
306 calcTotalFuelCost();
307 calcSapRating();
310 void FuelCosts::buildLT()
312 TableReader tr ("table12");
313 table12 = tr.getTableMap();
314 tr.readFile("table13");
315 table13 = tr.getTableMap();
319 void FuelCosts::calcTotalFuelCost()
321 m_spaceHeatFuelPricePri = table12.value(m_fuelType).at(1);
322 m_spaceHeatFuelPriceSec = table12.value(m_fuelType).at(1);
324 m_spaceHeatFuelCostPri = ptrSpaceHeating->getSpaceHeatingFuelMainReq() *
325 0.01 *
326 m_spaceHeatFuelPricePri;
329 m_spaceHeatFuelCostSec= ptrSpaceHeating->getSpaceHeatingFuelSecondary() *
330 0.01 *
331 m_spaceHeatFuelPriceSec;
333 //Lookup Table13 Value
334 //m_waterHeatOnPeakFracCost = table12.value(m_fuelType).at(1);
335 m_addtnStandingCharges = table12.value(m_fuelType).at(0);
338 m_waterHeatOffPeakFracCost= 1.00 - m_waterHeatOnPeakFracCost;
341 m_waterHeatOnPeakCost = ptrWaterHeatingEnergy->getEnergyReqdForWaterHeat() *
342 m_waterHeatOffPeakFracCost *
343 0.01 *
344 m_waterHeatOnPeakFuelPrice;
346 m_waterHeatOffPeakCost = ptrWaterHeatingEnergy->getEnergyReqdForWaterHeat() *
347 0.01 *
348 m_waterHeatOnPeakFuelPrice;
350 m_waterHeatingOtherFuelPrice = table12.value(m_fuelType).at(1);
351 m_waterHeatingOtherFuelCost =
352 ptrWaterHeatingEnergy->getEnergyReqdForWaterHeat() *
353 0.01 *
354 m_waterHeatingOtherFuelPrice;
355 m_pumpFanEnergyCost = ptrWaterHeatingEnergy->getTotalForAboveElec() * m_pumpFanEnergyCost;
357 m_EnergyLightingPrice = table12.value(13).at(1);
358 m_EnergyLightingCost = ptrGains->getAnnualLightEnergy() * m_EnergyLightingPrice * 0.01;
361 //Renewable Stuff to go in here...
364 m_totalEnergyCost = m_spaceHeatFuelCostPri +
365 m_spaceHeatFuelPriceSec +
366 m_waterHeatOnPeakCost +
367 m_waterHeatOffPeakCost +
368 m_waterHeatingOtherFuelCost +
369 m_pumpFanEnergyCost +
370 m_EnergyLightingCost +
371 m_addtnStandingCharges -
372 m_REenergyProducedCost +
373 m_REcostConsumedCost;
377 void FuelCosts::calcSapRating()
379 m_SAPEnergyCostFactor = ((m_totalEnergyCost *
380 m_SAPenergyCostDeflator) - 30.00) /
381 (ptrDims->get_totalFloorArea() + 45.00);
383 if (m_SAPEnergyCostFactor >= 3.5)
384 m_SAPrating = 111 - 110 * log10(m_SAPEnergyCostFactor);
385 else
386 m_SAPrating = 100 - 13.96 * m_SAPEnergyCostFactor;