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
16 changes: 15 additions & 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.202512121156"
AnyLogicVersion="8.9.7.202512010504"
AlpVersion="8.9.7">
<Model>
<Id>1658477103134</Id>
Expand Down Expand Up @@ -361,6 +361,10 @@
<Id>1770131381146</Id>
<Name><![CDATA[DIESEL_GENERATOR]]></Name>
</Option>
<Option>
<Id>1773156171459</Id>
<Name><![CDATA[AIR_CONDITIONER]]></Name>
</Option>
</OptionList>
<OptionList>
<Id>1659525715752</Id>
Expand Down Expand Up @@ -993,6 +997,10 @@
<Id>1753968826413</Id>
<Name><![CDATA[heatPumpElectricityConsumption_kW]]></Name>
</Option>
<Option>
<Id>1773140446104</Id>
<Name><![CDATA[airConditionersElectricPower_kW]]></Name>
</Option>
<Option>
<Id>1753968826414</Id>
<Name><![CDATA[evChargingPower_kW]]></Name>
Expand Down Expand Up @@ -1650,6 +1658,7 @@ EXCLUDE_PV => Use PV profile to preprocess gridnode profile to create a more acc
<JavaClass>
<Id>1749648342034</Id>
<Name><![CDATA[J_EAAirco]]></Name>
<ExcludeFromBuild>true</ExcludeFromBuild>
<Folder>1752677832758</Folder>
</JavaClass>
<JavaClass>
Expand Down Expand Up @@ -2002,6 +2011,11 @@ EXCLUDE_PV => Use PV profile to preprocess gridnode profile to create a more acc
<Name><![CDATA[I_AggregatorManagement]]></Name>
<Folder>1772100333519</Folder>
</JavaClass>
<JavaClass>
<Id>1773139549641</Id>
<Name><![CDATA[J_EAConversionAirConditioner]]></Name>
<Folder>1752677832758</Folder>
</JavaClass>
</JavaClasses>
<RequiredLibraryReference>
<LibraryName>com.anylogic.libraries.modules.markup_descriptors</LibraryName>
Expand Down
2 changes: 1 addition & 1 deletion _alp/Agents/GCHouse/Code/Functions.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
double f_operateFlexAssets_overwrite(J_TimeVariables timeVariables)
{/*ALCODESTART::1664963959146*/
f_manageCookingTracker(timeVariables);
f_manageAirco(timeVariables);
//f_manageAirco(timeVariables);
super.f_operateFlexAssets(timeVariables);
/*ALCODEEND*/}

Expand Down
1 change: 1 addition & 0 deletions _alp/Agents/GCHouse/Code/Functions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
<ReturnType>double</ReturnType>
<Id>1749648447119</Id>
<Name><![CDATA[f_manageAirco]]></Name>
<ExcludeFromBuild>true</ExcludeFromBuild>
<X>1160</X>
<Y>240</Y>
<Label>
Expand Down
19 changes: 12 additions & 7 deletions _alp/Agents/GridConnection/Code/Functions.java
Original file line number Diff line number Diff line change
Expand Up @@ -1042,9 +1042,14 @@ else if ( conversionAsset.energyAssetType == OL_EnergyAssetType.GAS_PIT || j_ea.
p_cookingTracker.HOB = (J_EAConversion)j_ea;
}
}
else if (j_ea instanceof J_EAConversionAirConditioner aircoAsset) {
traceln("Connecting airco to GC!");
p_airco = aircoAsset;
energyModel.c_ambientDependentAssets.add(aircoAsset);
}

}
else if (j_ea instanceof J_EAStorage storageAsset) {
else if (j_ea instanceof J_EAStorage storageAsset) {
c_storageAssets.add(storageAsset);
energyModel.c_storageAssets.add(storageAsset);
if (j_ea instanceof J_EAStorageHeat) {
Expand All @@ -1066,11 +1071,7 @@ else if (j_ea instanceof J_EAStorageElectric battery) {
c_parentCoops.forEach( coop -> coop.v_liveAssetsMetaData.totalInstalledBatteryStorageCapacity_MWh += capacity_MWh);
energyModel.v_liveAssetsMetaData.totalInstalledBatteryStorageCapacity_MWh += capacity_MWh;
}
}
else if (j_ea instanceof J_EAAirco aircoAsset) {
p_airco = aircoAsset;
}
else{
} else {
throw new RuntimeException("Trying to connect GC with unrecognized J_EAFlex asset!");
}
/*ALCODEEND*/}
Expand Down Expand Up @@ -1281,6 +1282,10 @@ else if ( j_ea.energyAssetType == OL_EnergyAssetType.GAS_PIT || j_ea.energyAsset
else if (j_ea instanceof J_EAConversionElectrolyser) {

}
else if (j_ea instanceof J_EAConversionAirConditioner) {
p_airco = null;
energyModel.c_ambientDependentAssets.remove(j_ea);
}
}
else if (j_ea instanceof J_EAStorage) {
c_storageAssets.remove((J_EAStorage)j_ea);
Expand All @@ -1303,7 +1308,7 @@ else if (j_ea instanceof J_EAStorageElectric) {
energyModel.v_liveAssetsMetaData.totalInstalledBatteryStorageCapacity_MWh -= ((J_EAStorageElectric)j_ea).getStorageCapacity_kWh()/1000;
}
}
else if (j_ea instanceof J_EAAirco) {
else if (j_ea instanceof J_EAConversionAirConditioner) {
p_airco = null;
}
/*ALCODEEND*/}
Expand Down
2 changes: 1 addition & 1 deletion _alp/Agents/GridConnection/Variables.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1239,7 +1239,7 @@
<PresentationFlag>true</PresentationFlag>
<ShowLabel>true</ShowLabel>
<Properties SaveInSnapshot="true" ModificatorType="STATIC">
<Type><![CDATA[J_EAAirco]]></Type>
<Type><![CDATA[J_EAConversionAirConditioner]]></Type>
<UnitType>NONE</UnitType>
<SdArray>false</SdArray>
<ParameterEditor>
Expand Down
4 changes: 2 additions & 2 deletions _alp/Classes/Class.I_EnergyManagement.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,14 @@ default public void checkConfiguration(List<J_EAFlex> flexAssetsGCList) {
flexAssets.removeAll(findAll(flexAssets, vehicle -> vehicle instanceof J_EAEV || vehicle instanceof J_EAChargingSession));
break;
}
else if(asset instanceof I_HeatingAsset || asset instanceof J_EAStorageHeat){
else if(asset instanceof I_HeatingAsset || asset instanceof J_EAStorageHeat || asset instanceof J_EAConversionAirConditioner){
if(!isAssetManagementActive(I_HeatingManagement.class)) {
throw new RuntimeException("A heating asset is found at GC that has an EMS that does not have active heating management.");
}
if(getExternalAssetManagement(I_HeatingManagement.class) != null) {
getExternalAssetManagement(I_HeatingManagement.class).initializeAssets();
}
flexAssets.removeAll(findAll(flexAssets, heatAsset -> heatAsset instanceof I_HeatingAsset || heatAsset instanceof J_EAStorageHeat));
flexAssets.removeAll(findAll(flexAssets, heatAsset -> heatAsset instanceof I_HeatingAsset || heatAsset instanceof J_EAStorageHeat || heatAsset instanceof J_EAConversionAirConditioner));
break;
}
else if(asset instanceof J_EAStorageElectric){
Expand Down
9 changes: 5 additions & 4 deletions _alp/Classes/Class.J_EABuilding.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public class J_EABuilding extends zero_engine.J_EAStorageHeat implements Seriali
private double solarAbsorptionFactor_m2;
private double solarRadiation_Wpm2 = 0;
private double additionalVentilationLosses_fr = 0;

private double coldExtracted_kWh = 0;
//Slider scaling factor
private double lossScalingFactor_fr = 1;

Expand Down Expand Up @@ -80,9 +80,9 @@ public J_FlowPacket f_updateAllFlows(double powerFraction_fr, J_TimeVariables ti
@Override
public void operate(double powerFraction_fr, J_TimeVariables timeVariables) {

if (DoubleCompare.lessThanZero(powerFraction_fr)) {
/*if (DoubleCompare.lessThanZero(powerFraction_fr)) {
throw new RuntimeException("Cooling of the J_EABuilding is not yet supported.");
}
}*/
double lossPower_kW = calculateLoss_kW(); // Heat exchange with environment through convection
double additionalVentilationLoss_kW = calculateAdditionalVentilationLoss_kW();
double solarHeating_kW = solarHeating_kW(); // Heat influx from sunlight
Expand All @@ -101,7 +101,8 @@ public void operate(double powerFraction_fr, J_TimeVariables timeVariables) {
}
updateStateOfCharge( deltaEnergy_kWh );

this.heatCharged_kWh += inputPower_kW * this.timeParameters.getTimeStep_h();
this.heatCharged_kWh += max(0,inputPower_kW * this.timeParameters.getTimeStep_h());
this.coldExtracted_kWh +=max(0,-inputPower_kW * this.timeParameters.getTimeStep_h());

this.flowsMap.put(OL_EnergyCarriers.HEAT, inputPower_kW);

Expand Down
90 changes: 90 additions & 0 deletions _alp/Classes/Class.J_EAConversionAirConditioner.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
/**
* J_EAConversionAirConditioner
*/
public class J_EAConversionAirConditioner extends J_EAConversion {

private double COP_r;
protected OL_AmbientTempType ambientTempType;
public double totalElectricityConsumed_kWh =0;
public J_EABuilding building;
//public double p_baseTemperatureReference;

/**
* Default constructor
*/
public J_EAConversionAirConditioner() {
}

//Only supports cooling functionality (extracting heat from building). In reality ACs can also be used for heating, in which case it's basically operating as a heatpump. This code is an adapted form of the J_EAConversionHeatPump.

/**
* Constructor initializing the fields
*/
public J_EAConversionAirConditioner(I_AssetOwner owner, double inputElectricCapacity_kW, J_TimeParameters timeParameters, J_EABuilding building) {
this.energyAssetType = OL_EnergyAssetType.AIR_CONDITIONER;

this.setOwner(owner);
this.timeParameters = timeParameters;
this.inputCapacity_kW = inputElectricCapacity_kW;
//this.eta_r = eta_r;
this.building = building;
this.ambientTempType = OL_AmbientTempType.AMBIENT_AIR;
this.updateAmbientTemperature( building.getAmbientTemperature_degC() ); // also updates COP

this.energyCarrierProduced = OL_EnergyCarriers.HEAT; // Heat is actually 'consumed', but this is the 'useful energy' of the AC; heat is extracted from the building and exhausted outside. In terms of 'final energy consumption' however, this is counted as energy consumption.
this.energyCarrierConsumed= OL_EnergyCarriers.ELECTRICITY;

this.activeProductionEnergyCarriers.add(this.energyCarrierProduced);
this.activeConsumptionEnergyCarriers.add(this.energyCarrierConsumed);
this.assetFlowCategory = OL_AssetFlowCategories.airConditionersElectricPower_kW;
registerEnergyAsset(timeParameters);
}

public void updateAmbientTemperature(double ambientTemperature_degC) {
double buildingTemp_degC = building.getCurrentTemperature();
this.COP_r = calculateCOP(ambientTemperature_degC, buildingTemp_degC); //this.eta_r * ( 273.15 + this.outputTemperature_degC ) / ( this.outputTemperature_degC - this.baseTemperature_degC );
this.outputCapacity_kW = this.inputCapacity_kW * this.COP_r; // this represents the current maximum cooling power (heat extracted from building!)
}

public double getCOP() {
//traceln("Heatpump output temperature: " + this.outputTemperature_degC);
return this.COP_r;
}

@Override
public void operate(double powerFraction_fr, J_TimeVariables timeVariables) {

double electricityConsumption_kW = powerFraction_fr * this.inputCapacity_kW;
this.totalElectricityConsumed_kWh += electricityConsumption_kW * this.timeParameters.getTimeStep_h();

double coldProduction_kW = electricityConsumption_kW * this.COP_r;

this.energyUse_kW = electricityConsumption_kW + coldProduction_kW;
flowsMap.put(OL_EnergyCarriers.HEAT, coldProduction_kW); // coldProduction can be seen as the heat flowing into the asset (from the building), so from the GC-perspective it looks like heat consumption.
flowsMap.put(OL_EnergyCarriers.ELECTRICITY, electricityConsumption_kW);

this.assetFlowsMap.addFlow(OL_AssetFlowCategories.airConditionersElectricPower_kW, electricityConsumption_kW);
this.energyUsed_kWh += energyUse_kW * this.timeParameters.getTimeStep_h();
}

public OL_AmbientTempType getAmbientTempType() {
return this.ambientTempType;
}

private double calculateCOP(double ambientTemperature_degC, double buildingTemperature_degC) { // This is the cooling COP, defined as the extracted heat power divided by the input electric power.
double deltaT = max(0,ambientTemperature_degC - buildingTemperature_degC); // Limit deltaT to 0-or-higher, meaning outside temp is equal or higher than inside temp. In reality, it can happen that an AC runs with a lower outside temp, but we 'cap' the COP this way.
double COP_r = 5 - 0.10 * deltaT + 0.00126 * deltaT*deltaT; // 'expert judgement'-curve, not based on manufacturer or measurement data but on 'typical' efficiencies found online.
return COP_r; // Ratio of cooling power (extracted heat) to input electric power.
}

@Override
public String toString() {
return this.energyAssetType + ", "
//+ this.energyCarrierConsumed + " -> " + this.energyCarrierProduced + ", "
+ "Electric capacity: " + this.inputCapacity_kW + " kW, "
+ "with efficiency: " + this.getCOP() + ", "
+ "Energy used: " + this.energyUsed_kWh + ", "
+ "Current output: " + -this.getLastFlows().get(this.energyCarrierProduced) + " kW";
}

}
13 changes: 1 addition & 12 deletions _alp/Classes/Class.J_EAConversionHeatPump.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,22 +132,10 @@ public void setSourceAssetHeatPower(double sourceAssetHeatPower_kW) {
//traceln("sourceAssetHeatPower_kW is set to: "+sourceAssetHeatPower_kW);
}

/*@Override
public double getCurrentTemperature() {
return outputTemperature_degC;
}*/

public void setBaseTemperature_degC( double baseTemperature_degC) {
this.baseTemperature_degC = baseTemperature_degC;
this.updateParameters( this.baseTemperature_degC, this.outputTemperature_degC);
}

/*@Override
public void setEta_r( double efficiency_r) {
this.eta_r = efficiency_r;
this.COP_r = this.eta_r * ( 273.15 + this.outputTemperature_degC ) / ( this.outputTemperature_degC - this.baseTemperature_degC );
this.outputCapacity_kW = this.inputCapacity_kW * this.COP_r;
}*/

public OL_AmbientTempType getAmbientTempType() {
return this.ambientTempType;
Expand All @@ -158,6 +146,7 @@ private double calculateCOP(double outputTemperature_degC, double baseTemperatur
double COP_r = 8.74 - 0.190 * deltaT + 0.00126 * deltaT*deltaT;
return COP_r;
}

/*
@Override
public String toString() {
Expand Down
Loading
Loading