Skip to content
Merged
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
1 change: 0 additions & 1 deletion _alp/Agents/EnergyModel/Code/Functions.java
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,6 @@ ArrayList<GridConnection> f_getActiveGridConnections()
b_parallelizeConnectionOwners = true;
}


// set initial values
f_setInitialValues();

Expand Down
30 changes: 20 additions & 10 deletions _alp/Agents/GCHouse/Code/Functions.java
Original file line number Diff line number Diff line change
Expand Up @@ -512,12 +512,12 @@ else if (energyModel.t_h*60 < chargeDeadline_min ){
double f_heatWithHeatpump()
{/*ALCODESTART::1676477303264*/
double powerFraction_heatBuffer_fr = 0;
double powerFraction_heatPump_fr = 0;
//double powerFraction_heatPump_fr = 0;
double avgElectricityPrice_eurpkWh = 10;
J_EAConversionHeatPump hp = (J_EAConversionHeatPump)p_primaryHeatingAsset;
v_copHeatpump = hp.getCOP();


/*
if ( p_smartHeatingEnabled ) {
if ( p_owner != null) {
avgElectricityPrice_eurpkWh = p_owner.f_getAveragedElectricityPrice( (fm_currentConsumptionFlows_kW.get(OL_EnergyCarriers.ELECTRICITY) - fm_currentProductionFlows_kW.get(OL_EnergyCarriers.ELECTRICITY)), hp.getInputCapacity_kW() );
Expand Down Expand Up @@ -547,13 +547,18 @@ else if (energyModel.t_h*60 < chargeDeadline_min ){
//reduce the powerfraction in the buffer with the hot water demand.
powerFraction_heatBuffer_fr += -v_hotwaterDemand_kW / p_heatBuffer.getCapacityHeat_kW();
}
*/

//heat the house
if( powerFraction_heatPump_fr == 0 ){ // Why this check? <- to make sure the heatpump is only used for househeating if it is not ALREADY heating the buffer (Peter)
//if( powerFraction_heatPump_fr == 0 ){ // Why this check? <- to make sure the heatpump is only used for househeating if it is not ALREADY heating the buffer (Peter)
if (p_BuildingThermalAsset.getCurrentTemperature() < v_tempSetpoint_degC - p_heatingKickinTreshold_degC ) {
powerFraction_heatPump_fr = 1;
p_BuildingThermalAsset.v_powerFraction_fr = hp.getOutputCapacity_kW() / p_BuildingThermalAsset.getCapacityHeat_kW();
hp.v_powerFraction_fr = 1;
p_BuildingThermalAsset.v_powerFraction_fr = (hp.getOutputCapacity_kW() - v_hotwaterDemand_kW) / p_BuildingThermalAsset.getCapacityHeat_kW();
}
if (v_hotwaterDemand_kW > p_primaryHeatingAsset.getOutputCapacity_kW() ) {
traceln("Warning! Hotwaterdemand exceeds available heating power of house! Will lead to shortage of heat on GC!");
}
/*
else if( p_smartHeatingEnabled && avgElectricityPrice_eurpkWh < v_electricityPriceLowPassed_eurpkWh - p_pricelevelLowDifFromAvg_eurpkWh
&& p_BuildingThermalAsset.getCurrentTemperature() < v_tempSetpoint_degC + 1) {
//also heat the house if the price is cheap, the the house is colder than desired + 1 and the vehicle does not need charging
Expand All @@ -566,20 +571,22 @@ else if (p_householdEV.chargingNeed != OL_EVChargingNeed.HIGH){ // only use heat
//traceln("heat house cus of cheap");
p_BuildingThermalAsset.v_powerFraction_fr = hp.getOutputCapacity_kW() / p_BuildingThermalAsset.getCapacityHeat_kW();
}
}
}*/
else {
hp.v_powerFraction_fr = v_hotwaterDemand_kW/hp.getOutputCapacity_kW();
p_BuildingThermalAsset.v_powerFraction_fr = 0;
}
}
//}
/*
else {
p_BuildingThermalAsset.v_powerFraction_fr = 0; // Whut?
}
if ( p_heatBuffer != null ){
p_heatBuffer.v_powerFraction_fr = powerFraction_heatBuffer_fr;
p_heatBuffer.f_updateAllFlows(powerFraction_heatBuffer_fr);
}
p_primaryHeatingAsset.v_powerFraction_fr = powerFraction_heatPump_fr;
//traceln( "heatpumpt power fraction: " + powerFraction_heatPump_fr);
}*/
//p_primaryHeatingAsset.v_powerFraction_fr = powerFraction_heatPump_fr;
//traceln( "heatpump power fraction: " + hp.v_powerFraction_fr );

/*ALCODEEND*/}

Expand Down Expand Up @@ -891,6 +898,9 @@ boolean f_calcCheapestHeatingPrice()
double powerDemand_kW = v_hotwaterDemand_kW + (v_tempSetpoint_degC - p_BuildingThermalAsset.getCurrentTemperature()) * p_BuildingThermalAsset.getHeatCapacity_JpK() / 3.6e6;
p_primaryHeatingAsset.v_powerFraction_fr = min(1, powerDemand_kW / p_primaryHeatingAsset.getOutputCapacity_kW() );
p_BuildingThermalAsset.v_powerFraction_fr = max(0, (p_primaryHeatingAsset.v_powerFraction_fr * p_primaryHeatingAsset.getOutputCapacity_kW() - v_hotwaterDemand_kW) / p_BuildingThermalAsset.getCapacityHeat_kW() );
if (v_hotwaterDemand_kW > p_primaryHeatingAsset.getOutputCapacity_kW() ) {
traceln("Warning! Hotwaterdemand exceeds available heating power of house! Will lead to shortage of heat on GC!");
}
}
else { // Just supply DHW
p_primaryHeatingAsset.v_powerFraction_fr = v_hotwaterDemand_kW / p_primaryHeatingAsset.getOutputCapacity_kW();
Expand Down
7 changes: 4 additions & 3 deletions _alp/Agents/GridConnection/Code/Functions.java
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,12 @@ else if (j_ea instanceof J_EAConversionCurtailer || j_ea instanceof J_EAConversi
double f_connectionMetering()
{/*ALCODESTART::1660212665961*/
if ( abs(fm_currentConsumptionFlows_kW.get(OL_EnergyCarriers.HEAT) - fm_currentProductionFlows_kW.get(OL_EnergyCarriers.HEAT)) > 0.1 && p_parentNodeHeat == null ) {
if (p_BuildingThermalAsset == null || !p_BuildingThermalAsset.hasHeatBuffer()) {
traceln((fm_currentConsumptionFlows_kW.get(OL_EnergyCarriers.HEAT) - fm_currentProductionFlows_kW.get(OL_EnergyCarriers.HEAT)));
//if (p_BuildingThermalAsset == null || !p_BuildingThermalAsset.hasHeatBuffer()) {
traceln("heat consumption: %s kW", fm_currentConsumptionFlows_kW.get(OL_EnergyCarriers.HEAT));
traceln("heat production: %s kW", fm_currentProductionFlows_kW.get(OL_EnergyCarriers.HEAT));
traceln("Heat unbalance in gridConnection: " + p_gridConnectionID);
pauseSimulation();
}
//}
}

if (energyModel.v_isRapidRun){
Expand Down
9 changes: 9 additions & 0 deletions _alp/Classes/Class.J_EABuilding.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,14 @@ public void solarHeating() {
//traceln("temperature_degC %s", this.temperature_degC);

}

@Override
public void f_updateAllFlows(double powerFraction_fr) {
if (powerFraction_fr > 1) {
traceln("JEABuilding capacityHeat_kW is too low! "+ capacityHeat_kW);
}
super.f_updateAllFlows(powerFraction_fr);
}

@Override
public void operate(double ratioOfChargeCapacity_r) {
Expand All @@ -111,6 +119,7 @@ public void operate(double ratioOfChargeCapacity_r) {
if (ratioOfChargeCapacity_r < 0) {
throw new RuntimeException("Cooling of the J_EABuilding is not yet supported.");
}


calculateLoss(); // Heat exchange with environment through convection
solarHeating(); // Heat influx from sunlight
Expand Down