diff --git a/Zero_engine.alpx b/Zero_engine.alpx index 6128d1d..9d1fd7e 100644 --- a/Zero_engine.alpx +++ b/Zero_engine.alpx @@ -1,7 +1,7 @@ 1658477103134 diff --git a/_alp/Agents/EnergyModel/Code/Functions.java b/_alp/Agents/EnergyModel/Code/Functions.java index d7e5cd9..ae5bdda 100644 --- a/_alp/Agents/EnergyModel/Code/Functions.java +++ b/_alp/Agents/EnergyModel/Code/Functions.java @@ -205,7 +205,7 @@ double f_initializeForecasts() {/*ALCODESTART::1671636439933*/ -pf_ambientTemperature_degC = new J_ProfileForecaster(null, pp_ambientTemperature_degC, p_forecastTime_h, p_timeVariables.getT_h(), p_timeParameters.getTimeStep_h()); +pf_ambientTemperature_degC = new J_ProfileForecaster(null, pp_ambientTemperature_degC, 24, p_timeVariables.getT_h(), p_timeParameters.getTimeStep_h()); c_forecasts.add(pf_ambientTemperature_degC); pf_PVProduction35DegSouth_fr = new J_ProfileForecaster(null, pp_PVProduction35DegSouth_fr, p_forecastTime_h, p_timeVariables.getT_h(), p_timeParameters.getTimeStep_h()); diff --git a/_alp/Agents/GCHouse/Levels/Level.level.xml b/_alp/Agents/GCHouse/Levels/Level.level.xml index df8d4be..81de126 100644 --- a/_alp/Agents/GCHouse/Levels/Level.level.xml +++ b/_alp/Agents/GCHouse/Levels/Level.level.xml @@ -188,7 +188,7 @@ true LINEAR - Min + Building temp 1765380741625 my_dataset -2448096 @@ -197,6 +197,16 @@ NONE 1.0 + + Amb temp + 1770221619232 + my_dataset1 + -9728477 + energyModel.pp_ambientTemperature_degC.getCurrentValue() + true + NONE + 1.0 + 288 3 false diff --git a/_alp/Classes/Class.J_EAStorageHeat.java b/_alp/Classes/Class.J_EAStorageHeat.java index e5b5d97..3b3e364 100644 --- a/_alp/Classes/Class.J_EAStorageHeat.java +++ b/_alp/Classes/Class.J_EAStorageHeat.java @@ -195,6 +195,10 @@ public double getLossFactor_WpK() { return lossFactor_WpK; } + public double getAmbientTemperature_degC() { + return ambientTemperature_degC; + } + public OL_AmbientTempType getAmbientTempType() { return this.ambientTempType; } diff --git a/_alp/Classes/Class.J_HeatingFunctionLibrary.java b/_alp/Classes/Class.J_HeatingFunctionLibrary.java index 7fb9b71..7cb9deb 100644 --- a/_alp/Classes/Class.J_HeatingFunctionLibrary.java +++ b/_alp/Classes/Class.J_HeatingFunctionLibrary.java @@ -2,7 +2,16 @@ * J_HeatingFunctionLibrary */ public abstract class J_HeatingFunctionLibrary { - + public static double heatingDaysSetpoint_degC = 18; + public static double heatLossByWindowVentilationMultiplier = 5; + /* + public void setHeatingDaysSetpoint_degC(double value) { + this.heatingDaysSetpoint_degC = value; + } + public double getHeatingDaysSetpoint_degC() { + return this.heatingDaysSetpoint_degC; + }*/ + public static double managePTAndHotWaterHeatBuffer(J_EAStorageHeat hotWaterBuffer, List ptAssets, double hotWaterDemand_kW, J_TimeVariables timeVariables, GridConnection gc){ //Calculate the pt production double ptProduction_kW = 0; @@ -67,6 +76,15 @@ public static double manageHotWaterHeatBuffer(J_EAStorageHeat hotWaterBuffer, d return hotWaterDemandFromHeatingAsset_kW; } + + public static void setWindowVentilation_fr( J_EABuilding dwelling, double windowOpenSetpoint_degc) { + double windowVentilation_fr = 0; + + if( dwelling.getCurrentTemperature() > windowOpenSetpoint_degc && dwelling.getAmbientTemperature_degC() < dwelling.getCurrentTemperature() ) { + windowVentilation_fr = heatLossByWindowVentilationMultiplier; + } + dwelling.setWindowVentilation_fr(windowVentilation_fr); + } } diff --git a/_alp/Classes/Class.J_HeatingManagementSimple.java b/_alp/Classes/Class.J_HeatingManagementSimple.java index 40f5cc5..1f23358 100644 --- a/_alp/Classes/Class.J_HeatingManagementSimple.java +++ b/_alp/Classes/Class.J_HeatingManagementSimple.java @@ -62,29 +62,39 @@ public void manageHeating(J_TimeVariables timeVariables) { double heatingAssetPower_kW = 0; - if(this.building != null) { - double buildingHeatingDemand_kW = 0; + if(this.building != null) { + double buildingHeatingDemand_kW = 0; double buildingTemp_degC = building.getCurrentTemperature(); double timeOfDay_h = timeVariables.getTimeOfDay_h(); - if (timeOfDay_h < heatingPreferences.getStartOfDayTime_h() || timeOfDay_h >= heatingPreferences.getStartOfNightTime_h()) { - if (buildingTemp_degC < heatingPreferences.getNightTimeSetPoint_degC()) { - // Nighttime and building temperature too low - buildingHeatingDemand_kW = (heatingPreferences.getNightTimeSetPoint_degC() - buildingTemp_degC) * this.building.heatCapacity_JpK / 3.6e6 / timeParameters.getTimeStep_h(); - } - else { - // Nighttime and building temperature acceptable - } + J_HeatingFunctionLibrary.setWindowVentilation_fr(this.building, heatingPreferences.getWindowOpenSetpoint_degc() ); + + //Stookdagen approximation > boven 18 graden is niet verwarmen + double avgTemp24h_degC = gc.energyModel.pf_ambientTemperature_degC.getForecast(); + if(avgTemp24h_degC > J_HeatingFunctionLibrary.heatingDaysSetpoint_degC) { + buildingHeatingDemand_kW = max(0,J_HeatingFunctionLibrary.heatingDaysSetpoint_degC - buildingTemp_degC) * this.building.heatCapacity_JpK / 3.6e6 / timeParameters.getTimeStep_h(); } + ///On heating days else { - if (buildingTemp_degC < heatingPreferences.getDayTimeSetPoint_degC()) { - // Daytime and building temperature too low - buildingHeatingDemand_kW = (heatingPreferences.getDayTimeSetPoint_degC() - buildingTemp_degC) * this.building.heatCapacity_JpK / 3.6e6 / timeParameters.getTimeStep_h(); - } - else { - // Daytime and building temperature acceptable - } + if (timeOfDay_h < heatingPreferences.getStartOfDayTime_h() || timeOfDay_h >= heatingPreferences.getStartOfNightTime_h()) { + + if (buildingTemp_degC < heatingPreferences.getNightTimeSetPoint_degC()) { + // Nighttime and building temperature too low + buildingHeatingDemand_kW = (heatingPreferences.getNightTimeSetPoint_degC() - buildingTemp_degC) * this.building.heatCapacity_JpK / 3.6e6 / timeParameters.getTimeStep_h(); + } + else { + // Nighttime and building temperature acceptable + } + } + else { + if (buildingTemp_degC < heatingPreferences.getDayTimeSetPoint_degC()) { + // Daytime and building temperature too low + buildingHeatingDemand_kW = (heatingPreferences.getDayTimeSetPoint_degC() - buildingTemp_degC) * this.building.heatCapacity_JpK / 3.6e6 / timeParameters.getTimeStep_h(); + } + else { + // Daytime and building temperature acceptable + } + } } - heatingAssetPower_kW = min(heatingAsset.getOutputCapacity_kW(),buildingHeatingDemand_kW + heatDemand_kW); // minimum not strictly needed as asset will limit power by itself. Could be used later if we notice demand is higher than capacity of heating asset. double heatIntoBuilding_kW = max(0, heatingAssetPower_kW - heatDemand_kW); // Will lead to energy(heat) imbalance when heatDemand_kW is larger than heating asset capacity. gc.f_updateFlexAssetFlows(building, heatIntoBuilding_kW / building.getCapacityHeat_kW(), timeVariables); diff --git a/_alp/Classes/Class.J_HeatingPreferences.java b/_alp/Classes/Class.J_HeatingPreferences.java index 74b0105..0be5fc7 100644 --- a/_alp/Classes/Class.J_HeatingPreferences.java +++ b/_alp/Classes/Class.J_HeatingPreferences.java @@ -10,6 +10,7 @@ public class J_HeatingPreferences { private double startOfNightTime_h = 23; private double dayTimeSetPoint_degC = 20; private double nightTimeSetPoint_degC = 18; + private double windowOpenSetpoint_degC = 25; private double maxComfortTemperature_degC = dayTimeSetPoint_degC + 3; private double minComfortTemperature_degC = dayTimeSetPoint_degC - 2; @@ -17,7 +18,7 @@ public class J_HeatingPreferences { public J_HeatingPreferences() { } - public J_HeatingPreferences(double startOfDayTime_h, double startOfNightTime_h, double dayTimeSetPoint_degC, double nightTimeSetPoint_degC, double maxComfortTemperature_degC, double minComfortTemperature_degC) { + public J_HeatingPreferences(double startOfDayTime_h, double startOfNightTime_h, double dayTimeSetPoint_degC, double nightTimeSetPoint_degC, double maxComfortTemperature_degC, double minComfortTemperature_degC, double windowOpenSetpoint_degC) { this.startOfDayTime_h = startOfDayTime_h; this.startOfNightTime_h = startOfNightTime_h; @@ -25,6 +26,7 @@ public J_HeatingPreferences(double startOfDayTime_h, double startOfNightTime_h, this.nightTimeSetPoint_degC = nightTimeSetPoint_degC; this.maxComfortTemperature_degC = maxComfortTemperature_degC; this.minComfortTemperature_degC = minComfortTemperature_degC; + this.windowOpenSetpoint_degC = windowOpenSetpoint_degC; } //Setters @@ -66,6 +68,9 @@ public double getMaxComfortTemperature_degC() { public double getMinComfortTemperature_degC() { return this.minComfortTemperature_degC; } + public double getWindowOpenSetpoint_degc() { + return this.windowOpenSetpoint_degC; + } public double getCurrentPreferedTemperatureSetpoint_degC(double timeOfDay_h) { if (timeOfDay_h < getStartOfDayTime_h() || timeOfDay_h >= getStartOfNightTime_h()) { @@ -84,7 +89,8 @@ public String toString() { ", DayTimeSetPoint_degC = " + this.dayTimeSetPoint_degC + ", NightTimeSetPoint_degC = " + this.nightTimeSetPoint_degC + ", MaxComfortTemperature_degC = " + this.maxComfortTemperature_degC + - ", MinComfortTemperature_degC = " + this.minComfortTemperature_degC; + ", MinComfortTemperature_degC = " + this.minComfortTemperature_degC + + ", WindowOpenSetpoint_degC = " + this.windowOpenSetpoint_degC; } } \ No newline at end of file diff --git a/_alp/Classes/Class.J_EABuilding.java b/_alp/Classes/J_EABuilding.java similarity index 94% rename from _alp/Classes/Class.J_EABuilding.java rename to _alp/Classes/J_EABuilding.java index 61a3df5..c0fb90e 100644 --- a/_alp/Classes/Class.J_EABuilding.java +++ b/_alp/Classes/J_EABuilding.java @@ -7,6 +7,7 @@ public class J_EABuilding extends zero_engine.J_EAStorageHeat implements Seriali private double solarAbsorptionFactor_m2; private double solarRadiation_Wpm2 = 0; + private double windowVentilation_fr; //Slider scaling factor private double lossScalingFactor_fr = 1; @@ -30,7 +31,7 @@ public J_EABuilding() { /** * Constructor initializing the fields */ - public J_EABuilding(I_AssetOwner owner, double capacityHeat_kW, double lossFactor_WpK, J_TimeParameters timeParameters, double initialTemperature_degC, double heatCapacity_JpK, double solarAbsorptionFactor_m2 ) { + public J_EABuilding(I_AssetOwner owner, double capacityHeat_kW, double lossFactor_WpK, J_TimeParameters timeParameters, double initialTemperature_degC, double heatCapacity_JpK, double solarAbsorptionFactor_m2) { this.setOwner(owner); this.timeParameters = timeParameters; this.capacityHeat_kW = capacityHeat_kW; @@ -63,7 +64,12 @@ public double solarHeating() { } - @Override + public double ventilationLoss( double lossPower_kW) { + double ventilationLoss_kW = this.windowVentilation_fr * lossPower_kW; + return ventilationLoss_kW; + } + + @Override public J_FlowPacket f_updateAllFlows(double powerFraction_fr, J_TimeVariables timeVariables) { if (powerFraction_fr > 1) { traceln("JEABuilding capacityHeat_kW is too low! "+ capacityHeat_kW); @@ -78,14 +84,15 @@ public void operate(double powerFraction_fr, J_TimeVariables timeVariables) { throw new RuntimeException("Cooling of the J_EABuilding is not yet supported."); } double lossPower_kW = calculateLoss(); // Heat exchange with environment through convection + double ventilationLoss_kW = ventilationLoss(lossPower_kW); double solarHeating_kW = solarHeating(); // Heat influx from sunlight - this.energyUse_kW = lossPower_kW - solarHeating_kW; + this.energyUse_kW = lossPower_kW + ventilationLoss_kW - solarHeating_kW; this.energyUsed_kWh += max(0, this.energyUse_kW * this.timeParameters.getTimeStep_h()); // Only heat loss! Not heat gain when outside is hotter than inside! this.ambientEnergyAbsorbed_kWh += max(0, -this.energyUse_kW * this.timeParameters.getTimeStep_h()); // Only heat gain from outside air and/or solar irradiance! double inputPower_kW = powerFraction_fr * this.capacityHeat_kW; // positive power means lowering the buffer temperature! - double deltaEnergy_kWh = (solarHeating_kW - lossPower_kW)* this.timeParameters.getTimeStep_h(); + double deltaEnergy_kWh = (solarHeating_kW - (lossPower_kW + ventilationLoss_kW))* this.timeParameters.getTimeStep_h(); if (this.interiorDelayTime_h != 0.0) { deltaEnergy_kWh += getInteriorHeatRelease( inputPower_kW * this.timeParameters.getTimeStep_h() ); } @@ -133,6 +140,10 @@ public void setLossFactor_WpK( double lossFactor_WpK) { this.lossFactor_WpK = lossFactor_WpK; } + public void setWindowVentilation_fr( double ventilation_fr) { + this.windowVentilation_fr = ventilation_fr; + } + public void setLossScalingFactor_fr( double lossScalingFactor_fr) { this.lossScalingFactor_fr = lossScalingFactor_fr; }