From cd20fb2ca64f9c6a3b566fd5902f611379082319 Mon Sep 17 00:00:00 2001 From: DamonHD Date: Tue, 26 Sep 2023 15:27:04 +0100 Subject: [PATCH] Added testDetachedLondon2018(). --- .../hd/d/TRVmodel/hg/ShowComputations.java | 30 +++++++++---------- ...TestHGTRVHPModelDetachedParameterised.java | 29 ++++++++++++++++++ 2 files changed, 44 insertions(+), 15 deletions(-) diff --git a/javasrc/org/hd/d/TRVmodel/hg/ShowComputations.java b/javasrc/org/hd/d/TRVmodel/hg/ShowComputations.java index 36b0f12..3d30a7b 100644 --- a/javasrc/org/hd/d/TRVmodel/hg/ShowComputations.java +++ b/javasrc/org/hd/d/TRVmodel/hg/ShowComputations.java @@ -66,21 +66,21 @@ public static void showCalcs() throws IOException System.out.println(""); System.out.println("Parameterised model, fixes applied for doors and CoP temperature, external air temperature varied..."); System.out.println("London (EGLL) 2018 hourly temperatures"); -// final DDNTemperatureDataCSV temperaturesLondon2018 = -// DDNTemperatureDataCSV.loadDDNTemperatureDataCSV(DDNTemperatureDataCSV.DATA_EGLL_2018); -// final HGTRVHPMModelByHour scenarioLondon2018 = new HGTRVHPMModelByHour( -// HGTRVHPMModelParameterised.ModelParameters.FIXES_APPLIED, temperaturesLondon2018); -// final ScenarioResult resultLondon2018 = scenarioLondon2018.runScenario(false, false, null); -// System.out.println(String.format("Percentage of hours that room setback raises heat pump demand: %.0f%%", -// 100 * resultLondon2018.hoursFractionSetbackRaisesDemand())); -// final double heatNoSetbackLondon2018 = resultLondon2018.demand().noSetback().heatDemand(); -// final double heatWithSetbackLondon2018 = resultLondon2018.demand().withSetback().heatDemand(); -// System.out.println(String.format("Heat mean demand: with no setback %.0fW, with setback %.0fW; %.0f%% change with setback", -// heatNoSetbackLondon2018, heatWithSetbackLondon2018, 100*((heatWithSetbackLondon2018/heatNoSetbackLondon2018)-1))); -// final double powerNoSetbackLondon2018 = resultLondon2018.demand().noSetback().heatPumpElectricity(); -// final double powerWithSetbackLondon2018 = resultLondon2018.demand().withSetback().heatPumpElectricity(); -// System.out.println(String.format("Heat pump mean power: with no setback %.0fW, with setback %.0fW; %.0f%% change with setback", -// powerNoSetbackLondon2018, powerWithSetbackLondon2018, 100*((powerWithSetbackLondon2018/powerNoSetbackLondon2018)-1))); + final DDNTemperatureDataCSV temperaturesLondon2018 = + DDNTemperatureDataCSV.loadDDNTemperatureDataCSV(DDNTemperatureDataCSV.DATA_EGLL_2018); + final HGTRVHPMModelByHour scenarioLondon2018 = new HGTRVHPMModelByHour( + HGTRVHPMModelParameterised.ModelParameters.FIXES_APPLIED, temperaturesLondon2018); + final ScenarioResult resultLondon2018 = scenarioLondon2018.runScenario(false, false, null); + System.out.println(String.format("Percentage of hours that room setback raises heat pump demand: %.0f%%", + 100 * resultLondon2018.hoursFractionSetbackRaisesDemand())); + final double heatNoSetbackLondon2018 = resultLondon2018.demand().noSetback().heatDemand(); + final double heatWithSetbackLondon2018 = resultLondon2018.demand().withSetback().heatDemand(); + System.out.println(String.format("Heat mean demand: with no setback %.0fW, with setback %.0fW; %.0f%% change with setback", + heatNoSetbackLondon2018, heatWithSetbackLondon2018, 100*((heatWithSetbackLondon2018/heatNoSetbackLondon2018)-1))); + final double powerNoSetbackLondon2018 = resultLondon2018.demand().noSetback().heatPumpElectricity(); + final double powerWithSetbackLondon2018 = resultLondon2018.demand().withSetback().heatPumpElectricity(); + System.out.println(String.format("Heat pump mean power: with no setback %.0fW, with setback %.0fW; %.0f%% change with setback", + powerNoSetbackLondon2018, powerWithSetbackLondon2018, 100*((powerWithSetbackLondon2018/powerNoSetbackLondon2018)-1))); System.out.println(""); System.out.println("Parameterised model, fixes applied for doors and CoP temperature, external air temperature varied..."); diff --git a/test/javasrc/localtest/TestHGTRVHPModelDetachedParameterised.java b/test/javasrc/localtest/TestHGTRVHPModelDetachedParameterised.java index 9bdcbdf..82365a9 100644 --- a/test/javasrc/localtest/TestHGTRVHPModelDetachedParameterised.java +++ b/test/javasrc/localtest/TestHGTRVHPModelDetachedParameterised.java @@ -16,7 +16,12 @@ package localtest; +import java.io.IOException; + +import org.hd.d.TRVmodel.data.DDNTemperatureDataCSV; import org.hd.d.TRVmodel.hg.HGTRVHPMModel; +import org.hd.d.TRVmodel.hg.HGTRVHPMModelByHour; +import org.hd.d.TRVmodel.hg.HGTRVHPMModelByHour.ScenarioResult; import org.hd.d.TRVmodel.hg.HGTRVHPMModelParameterised; import org.hd.d.TRVmodel.hg.HGTRVHPMModelParameterised.DemandWithoutAndWithSetback; import org.hd.d.TRVmodel.hg.HGTRVHPMModelParameterised.ModelParameters; @@ -113,4 +118,28 @@ public static void testOriginalVsDetached() assertTrue(bungalowDemandW.withSetback().heatPumpElectricity() < detachedDemandW.withSetback().heatPumpElectricity()); } } + + /**Check one test scenario of number for detached (with fixes). + * @throws IOException + */ + public static void testDetachedLondon2018() throws IOException + { + final DDNTemperatureDataCSV temperaturesLondon2018 = + DDNTemperatureDataCSV.loadDDNTemperatureDataCSV(DDNTemperatureDataCSV.DATA_EGLL_2018); + final HGTRVHPMModelByHour scenarioLondon2018 = new HGTRVHPMModelByHour( + HGTRVHPMModelParameterised.ModelParameters.FIXES_APPLIED, temperaturesLondon2018); + final ScenarioResult resultLondon2018 = scenarioLondon2018.runScenario(false, false, null); +// Percentage of hours that room setback raises heat pump demand: 45% + assertEquals(0.45, resultLondon2018.hoursFractionSetbackRaisesDemand(), 0.01); +// Heat mean demand: with no setback 719W, with setback 634W; -12% change with setback + final double heatNoSetbackLondon2018 = resultLondon2018.demand().noSetback().heatDemand(); + final double heatWithSetbackLondon2018 = resultLondon2018.demand().withSetback().heatDemand(); + assertEquals(719, heatNoSetbackLondon2018, 1); + assertEquals(634, heatWithSetbackLondon2018, 1); +// Heat pump mean power: with no setback 246W, with setback 253W; 3% change with setback + final double powerNoSetbackLondon2018 = resultLondon2018.demand().noSetback().heatPumpElectricity(); + final double powerWithSetbackLondon2018 = resultLondon2018.demand().withSetback().heatPumpElectricity(); + assertEquals(246, powerNoSetbackLondon2018, 1); + assertEquals(253, powerWithSetbackLondon2018, 1); + } }