Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Zero_engine.alpx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<AnyLogicWorkspace splitVersion="1"
WorkspaceVersion="1.9"
AnyLogicVersion="8.9.7.202512010504"
AnyLogicVersion="8.9.7.202512010500"
AlpVersion="8.9.7">
<Model>
<Id>1658477103134</Id>
Expand Down
2 changes: 1 addition & 1 deletion _alp/Agents/EnergyModel/Code/Functions.java
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
12 changes: 11 additions & 1 deletion _alp/Agents/GCHouse/Levels/Level.level.xml
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@
<DrawLine>true</DrawLine>
<Interpolation>LINEAR</Interpolation>
<DatasetExpression>
<Title>Min</Title>
<Title>Building temp</Title>
<Id>1765380741625</Id>
<Expression>my_dataset</Expression>
<Color>-2448096</Color>
Expand All @@ -197,6 +197,16 @@
<PointStyle>NONE</PointStyle>
<LineWidth>1.0</LineWidth>
</DatasetExpression>
<DatasetExpression>
<Title>Amb temp</Title>
<Id>1770221619232</Id>
<Expression>my_dataset1</Expression>
<Color>-9728477</Color>
<Expression2>energyModel.pp_ambientTemperature_degC.getCurrentValue()</Expression2>
<Expression2Flag>true</Expression2Flag>
<PointStyle>NONE</PointStyle>
<LineWidth>1.0</LineWidth>
</DatasetExpression>
<SamplesToKeep>288</SamplesToKeep>
<TimeWindowExpression>3</TimeWindowExpression>
<FillAreaUnderLine>false</FillAreaUnderLine>
Expand Down
4 changes: 4 additions & 0 deletions _alp/Classes/Class.J_EAStorageHeat.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
20 changes: 19 additions & 1 deletion _alp/Classes/Class.J_HeatingFunctionLibrary.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<J_EAProduction> ptAssets, double hotWaterDemand_kW, J_TimeVariables timeVariables, GridConnection gc){
//Calculate the pt production
double ptProduction_kW = 0;
Expand Down Expand Up @@ -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);
}
}


Expand Down
46 changes: 28 additions & 18 deletions _alp/Classes/Class.J_HeatingManagementSimple.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
10 changes: 8 additions & 2 deletions _alp/Classes/Class.J_HeatingPreferences.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,23 @@ 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;

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;
this.dayTimeSetPoint_degC = dayTimeSetPoint_degC;
this.nightTimeSetPoint_degC = nightTimeSetPoint_degC;
this.maxComfortTemperature_degC = maxComfortTemperature_degC;
this.minComfortTemperature_degC = minComfortTemperature_degC;
this.windowOpenSetpoint_degC = windowOpenSetpoint_degC;
}

//Setters
Expand Down Expand Up @@ -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()) {
Expand All @@ -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;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -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() );
}
Expand Down Expand Up @@ -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;
}
Expand Down