diff --git a/_alp/Agents/A_SubTenant/AOC.A_SubTenant.xml b/_alp/Agents/A_SubTenant/AOC.A_SubTenant.xml
index 1732d0ff..bdbb282c 100644
--- a/_alp/Agents/A_SubTenant/AOC.A_SubTenant.xml
+++ b/_alp/Agents/A_SubTenant/AOC.A_SubTenant.xml
@@ -156,8 +156,7 @@
false
SINGLE_LINK
1660224852394
- true
- 1703256762219
+ false
Object
SOLID
1
diff --git a/_alp/Agents/Actor/AOC.Actor.xml b/_alp/Agents/Actor/AOC.Actor.xml
index 1a8610a5..d030ebf1 100644
--- a/_alp/Agents/Actor/AOC.Actor.xml
+++ b/_alp/Agents/Actor/AOC.Actor.xml
@@ -118,31 +118,6 @@
NONE
END
-
- 1704289471860
-
- 60
- -20
-
- false
- true
- true
- false
- COLLECTION_OF_LINKS
- 1658499438203
- true
- 1671020599243
- Object
- SOLID
- 1
- -16777216
- UNDER_AGENTS
- NONE
- END
-
diff --git a/_alp/Agents/ConnectionOwner/AOC.ConnectionOwner.xml b/_alp/Agents/ConnectionOwner/AOC.ConnectionOwner.xml
index fe077c75..9ab9cc25 100644
--- a/_alp/Agents/ConnectionOwner/AOC.ConnectionOwner.xml
+++ b/_alp/Agents/ConnectionOwner/AOC.ConnectionOwner.xml
@@ -168,57 +168,6 @@ energyModel.c_connectionOwners.add(this);]]>
NONE
END
-
- 1703256762219
-
- true
- 200
- -20
-
- false
- true
- true
- false
- COLLECTION_OF_LINKS
- 1658752695711
- true
- 1703256686877
- Object
- SOLID
- 1
- -16777216
- UNDER_AGENTS
- NONE
- END
-
-
- 1704895007444
-
- true
- 310
- -20
-
- false
- true
- true
- false
- COLLECTION_OF_LINKS
- 1676382560905
- false
- Object
- SOLID
- 1
- -16777216
- UNDER_AGENTS
- NONE
- END
-
diff --git a/_alp/Agents/ConnectionOwner/Code/Functions.java b/_alp/Agents/ConnectionOwner/Code/Functions.java
index 3269a8f1..d4763509 100644
--- a/_alp/Agents/ConnectionOwner/Code/Functions.java
+++ b/_alp/Agents/ConnectionOwner/Code/Functions.java
@@ -1,6 +1,5 @@
double f_connectToChild(GridConnection ConnectingChildNode)
{/*ALCODESTART::1660230297342*/
-gridConnections.connectTo(ConnectingChildNode);
c_ownedGridConnections.add(ConnectingChildNode);
//v_ownedGridConnection = ConnectingChildNode;
//traceln("f_connectToChild in connectionOwner agent, connection contract type: " + v_contractConnection.connectionContractType);
diff --git a/_alp/Agents/EnergyModel/EmbeddedObjects.xml b/_alp/Agents/EnergyModel/EmbeddedObjects.xml
index 68211ba8..a8cd3531 100644
--- a/_alp/Agents/EnergyModel/EmbeddedObjects.xml
+++ b/_alp/Agents/EnergyModel/EmbeddedObjects.xml
@@ -237,6 +237,12 @@
+
+
+
+
+
+
true
@@ -1129,6 +1135,12 @@
+
+
+
+
+
+
true
@@ -1284,6 +1296,12 @@
+
+
+
+
+
+
true
@@ -1436,6 +1454,12 @@
+
+
+
+
+
+
true
@@ -1627,6 +1651,12 @@
+
+
+
+
+
+
true
@@ -1776,6 +1806,12 @@
+
+
+
+
+
+
true
@@ -1925,6 +1961,12 @@
+
+
+
+
+
+
true
@@ -2077,6 +2119,12 @@
+
+
+
+
+
+
true
@@ -2556,6 +2604,12 @@
+
+
+
+
+
+
true
@@ -2739,6 +2793,12 @@
+
+
+
+
+
+
true
diff --git a/_alp/Agents/GCDistrictHeating/AOC.GCDistrictHeating.xml b/_alp/Agents/GCDistrictHeating/AOC.GCDistrictHeating.xml
index 7691faa6..af287861 100644
--- a/_alp/Agents/GCDistrictHeating/AOC.GCDistrictHeating.xml
+++ b/_alp/Agents/GCDistrictHeating/AOC.GCDistrictHeating.xml
@@ -101,6 +101,12 @@
+
+
+
+
+
+
false
diff --git a/_alp/Agents/GCDistrictHeating/Code/Functions.java b/_alp/Agents/GCDistrictHeating/Code/Functions.java
index 7066228b..0220f17f 100644
--- a/_alp/Agents/GCDistrictHeating/Code/Functions.java
+++ b/_alp/Agents/GCDistrictHeating/Code/Functions.java
@@ -14,14 +14,15 @@
double storageTemp_degC = 0;
//double DHnetworkTemp_degC = 0;
//v_currentElectricityPriceConsumption_eurpkWh = ((ConnectionOwner)l_ownerActor.getConnectedAgent()).f_getElectricityPrice( v_currentPowerElectricity_kW );
-v_currentElectricityPriceConsumption_eurpkWh = l_parentNodeElectric.getConnectedAgent().v_currentTotalNodalPrice_eurpkWh;
+v_currentElectricityPriceConsumption_eurpkWh = p_parentNodeElectric.v_currentTotalNodalPrice_eurpkWh;
-if (l_ownerActor.getConnectedAgent() instanceof EnergyCoop){
+//if (l_ownerActor.getConnectedAgent() instanceof EnergyCoop){
//electricitySurplussCoop_kW = ((EnergyCoop)l_ownerActor.getConnectedAgent()).v_electricitySurplus_kW + v_previousPowerElectricity_kW; // From last timestep! So compensate for own electric power
//traceln("DH function! Electricity surpluss in Coop: " + electricitySurplussCoop_kW + ", own power " + v_previousPowerElectricity_kW,1 );
-}
+//}
// ((J_EAConversionHeatPump)e.j_ea).updateParameters(main.p_undergroundTemperature_degC, storageTemp_degC); // update heatpump temp levels!
-double heatTransferToNetwork_kW = max(0,l_parentNodeHeat.getConnectedAgent().v_currentLoad_kW - v_previousPowerHeat_kW);// max( storageTemp_degC - DHnetworkTemp_degC, 0 ) * heatTransferToNetworkCoefficient_kWpK;
+double heatTransferToNetwork_kW = max(0, p_parentNodeHeat.v_currentLoad_kW - v_previousPowerHeat_kW);// max( storageTemp_degC - DHnetworkTemp_degC, 0 ) * heatTransferToNetworkCoefficient_kWpK;
+
if( b_validLocalBuffer ) {
tempSetpoint_degC = p_DHheatStorage.getSetTemperature_degC();
diff --git a/_alp/Agents/GCEnergyConversion/AOC.GCEnergyConversion.xml b/_alp/Agents/GCEnergyConversion/AOC.GCEnergyConversion.xml
index 9dc26bba..9d021323 100644
--- a/_alp/Agents/GCEnergyConversion/AOC.GCEnergyConversion.xml
+++ b/_alp/Agents/GCEnergyConversion/AOC.GCEnergyConversion.xml
@@ -102,6 +102,12 @@
+
+
+
+
+
+
false
diff --git a/_alp/Agents/GCEnergyConversion/Code/Functions.java b/_alp/Agents/GCEnergyConversion/Code/Functions.java
index 96e01ccc..bd2f4866 100644
--- a/_alp/Agents/GCEnergyConversion/Code/Functions.java
+++ b/_alp/Agents/GCEnergyConversion/Code/Functions.java
@@ -89,16 +89,16 @@
double f_batteryManagementBalanceCoop(double batterySOC)
{/*ALCODESTART::1707149801187*/
if ((p_batteryAsset).getStorageCapacity_kWh() != 0){
- if(l_ownerActor.getConnectedAgent() instanceof ConnectionOwner) {
- if(((ConnectionOwner)l_ownerActor.getConnectedAgent()).p_coopParent instanceof EnergyCoop ) {
+ if( p_owner != null ) {
+ if( p_owner.p_coopParent instanceof EnergyCoop ) {
//traceln("Hello?");
// v_previousPowerElectricity_kW = p_batteryAsset.v_powerFraction_fr * p_batteryAsset.j_ea.getElectricCapacity_kW();
v_previousPowerElectricity_kW = p_batteryAsset.getLastFlows().get(OL_EnergyCarriers.ELECTRICITY);
//traceln("Previous battery power: " + v_previousPowerElectricity_kW);
- double currentCoopElectricitySurplus_kW = ((ConnectionOwner)l_ownerActor.getConnectedAgent()).p_coopParent.v_electricitySurplus_kW + v_previousPowerElectricity_kW;
+ double currentCoopElectricitySurplus_kW = p_owner.p_coopParent.v_electricitySurplus_kW + v_previousPowerElectricity_kW;
//v_electricityPriceLowPassed_eurpkWh += v_lowPassFactor_fr * ( currentCoopElectricitySurplus_kW - v_electricityPriceLowPassed_eurpkWh );
- double CoopConnectionCapacity_kW = 0.9*((ConnectionOwner)l_ownerActor.getConnectedAgent()).p_coopParent.v_allowedCapacity_kW; // Use only 90% of capacity for robustness against delay
+ double CoopConnectionCapacity_kW = 0.9*p_owner.p_coopParent.v_allowedCapacity_kW; // Use only 90% of capacity for robustness against delay
double availableChargePower_kW = CoopConnectionCapacity_kW + currentCoopElectricitySurplus_kW; // Max battery charging power within grid capacity
double availableDischargePower_kW = currentCoopElectricitySurplus_kW - CoopConnectionCapacity_kW; // Max discharging power within grid capacity
double SOC_setp_fr = 0.5;
@@ -261,8 +261,8 @@
//Pair flowsPair = ElectrolyserAsset.getLastFlows();
J_FlowsMap flowsMap = ElectrolyserAsset.getLastFlows();
double previousElectrolyserConsumption_kW = max(0,flowsMap.get(OL_EnergyCarriers.ELECTRICITY));
-double currentGridNodePowerFlow_kW = this.l_parentNodeElectric.getConnectedAgent().v_currentLoad_kW - previousElectrolyserConsumption_kW;
-data_liveWeekGridNoderPowerFlow_kW.add(energyModel.t_h, this.l_parentNodeElectric.getConnectedAgent().v_currentLoad_kW);
+double currentGridNodePowerFlow_kW = this.p_parentNodeElectric.v_currentLoad_kW - previousElectrolyserConsumption_kW;
+data_liveWeekGridNoderPowerFlow_kW.add(energyModel.t_h, this.p_parentNodeElectric.v_currentLoad_kW);
switch (p_electrolyserOperationMode){
@@ -344,7 +344,7 @@
double f_electrolyserRegimeControl_Price(double excessElectricPower_kW,J_EAConversionElectrolyser ElectrolyserAsset)
{/*ALCODESTART::1708448673879*/
-ConnectionOwner ownerActor = (ConnectionOwner)l_ownerActor.getConnectedAgent();
+ConnectionOwner ownerActor = p_owner;
//double currentElectricityPriceCharge_eurpkWh = ownerActor.f_getElectricityPrice(-excessElectricPower_kW); // query price at 1kW
double currentElectricityPriceEPEX_eurpkWh = energyModel.v_epexForecast_eurpkWh;
diff --git a/_alp/Agents/GCEnergyProduction/AOC.GCEnergyProduction.xml b/_alp/Agents/GCEnergyProduction/AOC.GCEnergyProduction.xml
index 641fafd7..72712445 100644
--- a/_alp/Agents/GCEnergyProduction/AOC.GCEnergyProduction.xml
+++ b/_alp/Agents/GCEnergyProduction/AOC.GCEnergyProduction.xml
@@ -101,6 +101,12 @@
+
+
+
+
+
+
false
diff --git a/_alp/Agents/GCEnergyProduction/Code/Functions.java b/_alp/Agents/GCEnergyProduction/Code/Functions.java
index cb7176af..f3c04d13 100644
--- a/_alp/Agents/GCEnergyProduction/Code/Functions.java
+++ b/_alp/Agents/GCEnergyProduction/Code/Functions.java
@@ -72,9 +72,8 @@
//traceln("Elektrolyser power fraction: " + elektrolyserSetpointElectric_kW/ElektrolyserAsset.j_ea.getElectricCapacity_kW());
} else if (p_electrolyserOperationMode==OL_ElectrolyserOperationMode.PRICE) {
//if(l_ownerActor.getConnectedAgent() instanceof ConnectionOwner) {
- ConnectionOwner ownerActor = (ConnectionOwner)l_ownerActor.getConnectedAgent();
//double currentElectricityPriceCharge_eurpkWh = ownerActor.v_priceBandsDelivery.ceilingEntry(100.0).getValue(); // query price at 1kW
- double currentElectricityPriceCharge_eurpkWh = ownerActor.f_getElectricityPrice(-excessElectricPower_kW); // query price at 1kW
+ double currentElectricityPriceCharge_eurpkWh = p_owner.f_getElectricityPrice(-excessElectricPower_kW); // query price at 1kW
//traceln("Current electricity price for electrolyser: " + currentElectricityPriceCharge_eurpkWh);
v_electricityPriceLowPassed_eurpkWh += v_lowPassFactor_fr * ( currentElectricityPriceCharge_eurpkWh - v_electricityPriceLowPassed_eurpkWh );
double deficitGain_eurpkWh = 1.0/1000000; // When SOC-error is 100%, adjust WTP price by 1 eurpkWh
@@ -96,16 +95,16 @@
double f_batteryManagementBalanceCoop(double batterySOC)
{/*ALCODESTART::1677836046815*/
if ((p_batteryAsset).getStorageCapacity_kWh() != 0){
- if(l_ownerActor.getConnectedAgent() instanceof ConnectionOwner) {
- if(((ConnectionOwner)l_ownerActor.getConnectedAgent()).p_coopParent instanceof EnergyCoop ) {
+ if( p_owner != null) {
+ if( p_owner.p_coopParent instanceof EnergyCoop ) {
//traceln("Hello?");
// v_previousPowerElectricity_kW = p_batteryAsset.v_powerFraction_fr * p_batteryAsset.j_ea.getElectricCapacity_kW();
v_previousPowerElectricity_kW = p_batteryAsset.getLastFlows().get(OL_EnergyCarriers.ELECTRICITY);
//traceln("Previous battery power: " + v_previousPowerElectricity_kW);
- double currentCoopElectricitySurplus_kW = ((ConnectionOwner)l_ownerActor.getConnectedAgent()).p_coopParent.v_electricitySurplus_kW + v_previousPowerElectricity_kW;
+ double currentCoopElectricitySurplus_kW = p_owner.p_coopParent.v_electricitySurplus_kW + v_previousPowerElectricity_kW;
//v_electricityPriceLowPassed_eurpkWh += v_lowPassFactor_fr * ( currentCoopElectricitySurplus_kW - v_electricityPriceLowPassed_eurpkWh );
- double CoopConnectionCapacity_kW = 0.9*((ConnectionOwner)l_ownerActor.getConnectedAgent()).p_coopParent.v_allowedCapacity_kW; // Use only 90% of capacity for robustness against delay
+ double CoopConnectionCapacity_kW = 0.9*p_owner.p_coopParent.v_allowedCapacity_kW; // Use only 90% of capacity for robustness against delay
double availableChargePower_kW = CoopConnectionCapacity_kW + currentCoopElectricitySurplus_kW; // Max battery charging power within grid capacity
double availableDischargePower_kW = currentCoopElectricitySurplus_kW - CoopConnectionCapacity_kW; // Max discharging power within grid capacity
double SOC_setp_fr = 0.5;
diff --git a/_alp/Agents/GCGridBattery/AOC.GCGridBattery.xml b/_alp/Agents/GCGridBattery/AOC.GCGridBattery.xml
index fbaaf96a..f816ed62 100644
--- a/_alp/Agents/GCGridBattery/AOC.GCGridBattery.xml
+++ b/_alp/Agents/GCGridBattery/AOC.GCGridBattery.xml
@@ -101,6 +101,12 @@
+
+
+
+
+
+
false
diff --git a/_alp/Agents/GCGridBattery/Code/Functions.java b/_alp/Agents/GCGridBattery/Code/Functions.java
index 0a37750f..483c2114 100644
--- a/_alp/Agents/GCGridBattery/Code/Functions.java
+++ b/_alp/Agents/GCGridBattery/Code/Functions.java
@@ -109,7 +109,6 @@ else if(EA.j_ea instanceof J_EAStorageElectric && ((J_EAStorageElectric)EA.j_ea)
double chargeSetpoint_kW = 0;
double currentElectricityPriceCharge_eurpkWh;
- GridNode GN = l_parentNodeElectric.getConnectedAgent();
//double currentElectricityPriceDischarge_eurpkWh;
/*if(l_ownerActor.getConnectedAgent() instanceof ConnectionOwner) {
ConnectionOwner ownerActor = (ConnectionOwner)l_ownerActor.getConnectedAgent();
@@ -118,13 +117,13 @@ else if(EA.j_ea instanceof J_EAStorageElectric && ((J_EAStorageElectric)EA.j_ea)
} else { // Get EPEX price plus nodal price of GridNode
*/
//currentElectricityPriceCharge_eurpkWh = energyModel.nationalEnergyMarket.f_getNationalElectricityPrice_eurpMWh()/1000 + GN.v_currentTotalNodalPrice_eurpkWh;
- currentElectricityPriceCharge_eurpkWh = GN.v_currentTotalNodalPrice_eurpkWh;
+ currentElectricityPriceCharge_eurpkWh = p_parentNodeElectric.v_currentTotalNodalPrice_eurpkWh;
//currentElectricityPriceCharge_eurpkWh = l_parentNodeElectric.getConnectedAgent().v_currentTotalNodalPrice_eurpkWh;
//}
v_electricityPriceLowPassed_eurpkWh += v_lowPassFactor_fr * ( currentElectricityPriceCharge_eurpkWh - v_electricityPriceLowPassed_eurpkWh );
- double currentCoopElectricitySurplus_kW = -GN.v_currentLoad_kW + v_previousPowerElectricity_kW;
- double CoopConnectionCapacity_kW = 0.95*GN.p_capacity_kW; // Use only 90% of capacity for robustness against delay
+ double currentCoopElectricitySurplus_kW = -p_parentNodeElectric.v_currentLoad_kW + v_previousPowerElectricity_kW;
+ double CoopConnectionCapacity_kW = 0.95*p_parentNodeElectric.p_capacity_kW; // Use only 90% of capacity for robustness against delay
//traceln("Operating buurtbatterij, current local surplus is %s kW.", currentCoopElectricitySurplus_kW);
@@ -132,7 +131,7 @@ else if(EA.j_ea instanceof J_EAStorageElectric && ((J_EAStorageElectric)EA.j_ea)
double availableDischargePower_kW = currentCoopElectricitySurplus_kW - CoopConnectionCapacity_kW; // Max discharging power within grid capacity
- double SOC_setp_fr = 0.9 - 2*GN.v_electricityYieldForecast_fr;
+ double SOC_setp_fr = 0.9 - 2*p_parentNodeElectric.v_electricityYieldForecast_fr;
//SOC_setp_fr = (0.5 + 0.4 * Math.cos(2*Math.PI*(energyModel.t_h-18)/24))*(1-3*GN.v_electricityYieldForecast_fr); // Sinusoidal setpoint: aim for high SOC at 18:00h
//SOC_setp_fr = 0.6 + 0.25 * Math.sin(2*Math.PI*(main.t_h-12)/24); // Sinusoidal setpoint: aim for low SOC at 6:00h, high SOC at 18:00h.
@@ -163,24 +162,22 @@ else if (WTP_discharge_eurpkWh < currentElectricityPriceCharge_eurpkWh) {
double f_batteryManagementBalanceGrid(double batterySOC)
{/*ALCODESTART::1678114662587*/
-GridNode node = l_parentNodeElectric.getConnectedAgent();
if (p_batteryAsset.getStorageCapacity_kWh() != 0){
double currentCoopElectricitySurplus_kW = 0;
double CoopConnectionCapacity_kW = 0;
double v_previousPowerBattery_kW = v_previousPowerElectricity_kW;// Assumes battery is only asset on gridconnection!! p_batteryAsset.electricityConsumption_kW-p_batteryAsset.electricityProduction_kW;
//traceln("Previous battery power: " + v_previousPowerElectricity_kW);
- GridNode GN = l_parentNodeElectric.getConnectedAgent();
- if(l_ownerActor.getConnectedAgent() instanceof ConnectionOwner) {
+ if( p_owner != null ) {
/*if(((ConnectionOwner)l_ownerActor.getConnectedAgent()).p_coopParent instanceof EnergyCoop ) { // get electricity balance from Coop
currentCoopElectricitySurplus_kW = ((ConnectionOwner)l_ownerActor.getConnectedAgent()).p_coopParent.v_electricitySurplus_kW + v_previousPowerBattery_kW;
CoopConnectionCapacity_kW = 0.9*((ConnectionOwner)l_ownerActor.getConnectedAgent()).p_coopParent.v_allowedCapacity_kW; // Use only 90% of capacity for robustness against delay
} else { // Get gridload directly from node*/
- currentCoopElectricitySurplus_kW = -GN.v_currentLoad_kW + v_previousPowerBattery_kW;
- CoopConnectionCapacity_kW = 0.9*GN.p_capacity_kW; // Use only 90% of capacity for robustness against delay
+ currentCoopElectricitySurplus_kW = -p_parentNodeElectric.v_currentLoad_kW + v_previousPowerBattery_kW;
+ CoopConnectionCapacity_kW = 0.9*p_parentNodeElectric.p_capacity_kW; // Use only 90% of capacity for robustness against delay
//}
} else { // Get gridload directly from node
- currentCoopElectricitySurplus_kW = -node.v_currentLoad_kW + v_previousPowerBattery_kW;
- CoopConnectionCapacity_kW = 0.95*node.p_capacity_kW; // Use only 90% of capacity for robustness against delay
+ currentCoopElectricitySurplus_kW = -p_parentNodeElectric.v_currentLoad_kW + v_previousPowerBattery_kW;
+ CoopConnectionCapacity_kW = 0.95*p_parentNodeElectric.p_capacity_kW; // Use only 90% of capacity for robustness against delay
}
//traceln("Operating buurtbatterij, current local surplus is %s kW.", currentCoopElectricitySurplus_kW);
@@ -215,13 +212,13 @@ else if (WTP_discharge_eurpkWh < currentElectricityPriceCharge_eurpkWh) {
return;
}
if (energyModel.v_currentSolarPowerNormalized_r > 0.1) {
- if (GN.v_currentLoad_kW < 0) {
- p_batteryAsset.v_powerFraction_fr = max(-1, min(1, -GN.v_currentLoad_kW / p_batteryAsset.getCapacityElectric_kW()));
+ if (p_parentNodeElectric.v_currentLoad_kW < 0) {
+ p_batteryAsset.v_powerFraction_fr = max(-1, min(1, -p_parentNodeElectric.v_currentLoad_kW / p_batteryAsset.getCapacityElectric_kW()));
}
}
else {
- double expectedWind_kWh = node.v_totalInstalledWindPower_kW * energyModel.v_WindYieldForecast_fr * energyModel.p_forecastTime_h;
- double expectedSolar_kWh = node.v_totalInstalledPVPower_kW * energyModel.v_SolarYieldForecast_fr * energyModel.p_forecastTime_h;
+ double expectedWind_kWh = p_parentNodeElectric.v_totalInstalledWindPower_kW * energyModel.v_WindYieldForecast_fr * energyModel.p_forecastTime_h;
+ double expectedSolar_kWh = p_parentNodeElectric.v_totalInstalledPVPower_kW * energyModel.v_SolarYieldForecast_fr * energyModel.p_forecastTime_h;
double incomingPower_fr = (expectedSolar_kWh + expectedWind_kWh) / p_batteryAsset.getStorageCapacity_kWh();
double SOC_setp_fr = 1 - incomingPower_fr;
@@ -312,19 +309,17 @@ else if (WTP_discharge_eurpkWh < currentElectricityPriceCharge_eurpkWh) {
double CoopConnectionCapacity_kW = 0;
double v_previousPowerBattery_kW = v_previousPowerElectricity_kW;// Assumes battery is only asset on gridconnection!! p_batteryAsset.electricityConsumption_kW-p_batteryAsset.electricityProduction_kW;
//traceln("Previous battery power: " + v_previousPowerElectricity_kW);
- if(l_ownerActor.getConnectedAgent() instanceof ConnectionOwner) {
- if(((ConnectionOwner)l_ownerActor.getConnectedAgent()).p_coopParent instanceof EnergyCoop ) { // get electricity balance from Coop
- currentCoopElectricitySurplus_kW = ((ConnectionOwner)l_ownerActor.getConnectedAgent()).p_coopParent.v_electricitySurplus_kW + v_previousPowerBattery_kW;
- CoopConnectionCapacity_kW = 0.9*((ConnectionOwner)l_ownerActor.getConnectedAgent()).p_coopParent.v_allowedCapacity_kW; // Use only 90% of capacity for robustness against delay
+ if( p_owner != null ) {
+ if( p_owner.p_coopParent instanceof EnergyCoop ) { // get electricity balance from Coop
+ currentCoopElectricitySurplus_kW = p_owner.p_coopParent.v_electricitySurplus_kW + v_previousPowerBattery_kW;
+ CoopConnectionCapacity_kW = 0.9*p_owner.p_coopParent.v_allowedCapacity_kW; // Use only 90% of capacity for robustness against delay
} else { // Get gridload directly from node
- GridNode node = l_parentNodeElectric.getConnectedAgent();
- currentCoopElectricitySurplus_kW = -node.v_currentLoad_kW + v_previousPowerBattery_kW;
- CoopConnectionCapacity_kW = 0.95*node.p_capacity_kW; // Use only 90% of capacity for robustness against delay
+ currentCoopElectricitySurplus_kW = -p_parentNodeElectric.v_currentLoad_kW + v_previousPowerBattery_kW;
+ CoopConnectionCapacity_kW = 0.95*p_parentNodeElectric.p_capacity_kW; // Use only 90% of capacity for robustness against delay
}
} else { // Get gridload directly from node
- GridNode node = l_parentNodeElectric.getConnectedAgent();
- currentCoopElectricitySurplus_kW = -node.v_currentLoad_kW + v_previousPowerBattery_kW;
- CoopConnectionCapacity_kW = 0.95*node.p_capacity_kW; // Use only 90% of capacity for robustness against delay
+ currentCoopElectricitySurplus_kW = -p_parentNodeElectric.v_currentLoad_kW + v_previousPowerBattery_kW;
+ CoopConnectionCapacity_kW = 0.95*p_parentNodeElectric.p_capacity_kW; // Use only 90% of capacity for robustness against delay
}
//traceln("Operating buurtbatterij, current local surplus is %s kW.", currentCoopElectricitySurplus_kW);
diff --git a/_alp/Agents/GCHouse/AOC.GCHouse.xml b/_alp/Agents/GCHouse/AOC.GCHouse.xml
index f5a4e1e0..cd91971e 100644
--- a/_alp/Agents/GCHouse/AOC.GCHouse.xml
+++ b/_alp/Agents/GCHouse/AOC.GCHouse.xml
@@ -101,6 +101,12 @@
+
+
+
+
+
+
false
diff --git a/_alp/Agents/GCHouse/Code/Functions.java b/_alp/Agents/GCHouse/Code/Functions.java
index 138044fd..e149f2b5 100644
--- a/_alp/Agents/GCHouse/Code/Functions.java
+++ b/_alp/Agents/GCHouse/Code/Functions.java
@@ -40,9 +40,9 @@
double f_operateFlexAssets_overwrite()
{/*ALCODESTART::1664963959146*/
double availablePowerAtPrice_kW = v_liveConnectionMetaData.contractedDeliveryCapacity_kW;
-if (l_ownerActor.getConnectedAgent()!=null){
- v_currentElectricityPriceConsumption_eurpkWh = ((ConnectionOwner)l_ownerActor.getConnectedAgent()).f_getElectricityPrice( fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.ELECTRICITY));
- availablePowerAtPrice_kW = ((ConnectionOwner)l_ownerActor.getConnectedAgent()).f_getAvailablePowerAtPrice( fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.ELECTRICITY) );
+if (p_owner != null){
+ v_currentElectricityPriceConsumption_eurpkWh = p_owner.f_getElectricityPrice( fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.ELECTRICITY));
+ availablePowerAtPrice_kW = p_owner.f_getAvailablePowerAtPrice( fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.ELECTRICITY) );
v_electricityPriceLowPassed_eurpkWh += v_lowPassFactor_fr * ( v_currentElectricityPriceConsumption_eurpkWh - v_electricityPriceLowPassed_eurpkWh );
} else {
//v_currentElectricityPriceConsumption_eurpkWh = 0.3;
@@ -516,8 +516,10 @@ else if (energyModel.t_h*60 < chargeDeadline_min ){
if ( p_smartHeatingEnabled ) {
- avgElectricityPrice_eurpkWh = ((ConnectionOwner)l_ownerActor.getConnectedAgent()).f_getAveragedElectricityPrice( (fm_currentConsumptionFlows_kW.get(OL_EnergyCarriers.ELECTRICITY) - fm_currentProductionFlows_kW.get(OL_EnergyCarriers.ELECTRICITY)), hp.getInputCapacity_kW() );
- //traceln("avg electircity rprice for HP: " + avgElectricityPrice_eurpkWh);
+ 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() );
+ //traceln("avg electircity rprice for HP: " + avgElectricityPrice_eurpkWh);
+ }
}
//heat the buffer if it requires heat
@@ -722,11 +724,10 @@ else if ( v_batterySOC_fr < 0.6 && v_currentPowerElectricity_kW < 1 && v_current
double chargeSetpoint_kW = 0;
- if(l_ownerActor.getConnectedAgent() instanceof ConnectionOwner) {
- ConnectionOwner ownerActor = (ConnectionOwner)l_ownerActor.getConnectedAgent();
+ if(p_owner != null) {
//traceln("Initial Mappings are: " + ((ConnectionOwner)p_ownerActor).v_currentPriceBands);
- double currentElectricityPriceCharge_eurpkWh = ownerActor.f_getElectricityPrice(fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.ELECTRICITY) + 10.0); // query price at 100kW charging
- double currentElectricityPriceDischarge_eurpkWh = ownerActor.f_getElectricityPrice(fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.ELECTRICITY) - 10.0); // query price at -100kW charging
+ double currentElectricityPriceCharge_eurpkWh = p_owner.f_getElectricityPrice(fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.ELECTRICITY) + 10.0); // query price at 100kW charging
+ double currentElectricityPriceDischarge_eurpkWh = p_owner.f_getElectricityPrice(fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.ELECTRICITY) - 10.0); // query price at -100kW charging
//double lowPassFraction = min(1,1*1.2*energyModel.p_timeStep_h); // smaller value results in more filtering
//v_electricityPriceLowPassed_eurpkWh += v_lowPassFactor_fr * ( currentElectricityPriceCharge_eurpkWh - v_electricityPriceLowPassed_eurpkWh );
@@ -853,9 +854,9 @@ boolean f_calcCheapestHeatingPrice()
double HP_COP = ((J_EAConversionHeatPump)p_primaryHeatingAsset).getCOP();
boolean isGasCheaper = false;
-if(l_ownerActor.getConnectedAgent() instanceof ConnectionOwner) {
- v_gasHeatingCost_eurpkWh_TEMPORARY = ((ConnectionOwner)l_ownerActor.getConnectedAgent()).f_getMethanePrice();
- v_eHeatingCost_eurpkWh_TEMPORARY = ((ConnectionOwner)l_ownerActor.getConnectedAgent()).f_getAveragedElectricityPrice( fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.ELECTRICITY), p_primaryHeatingAsset.getInputCapacity_kW() ) / HP_COP;
+if( p_owner != null ) {
+ v_gasHeatingCost_eurpkWh_TEMPORARY = p_owner.f_getMethanePrice();
+ v_eHeatingCost_eurpkWh_TEMPORARY = p_owner.f_getAveragedElectricityPrice( fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.ELECTRICITY), p_primaryHeatingAsset.getInputCapacity_kW() ) / HP_COP;
isGasCheaper = v_gasHeatingCost_eurpkWh_TEMPORARY < v_eHeatingCost_eurpkWh_TEMPORARY ? true:false;
}
diff --git a/_alp/Agents/GCIndustry/AOC.GCIndustry.xml b/_alp/Agents/GCIndustry/AOC.GCIndustry.xml
index 453abadd..d321ef73 100644
--- a/_alp/Agents/GCIndustry/AOC.GCIndustry.xml
+++ b/_alp/Agents/GCIndustry/AOC.GCIndustry.xml
@@ -101,6 +101,12 @@
+
+
+
+
+
+
false
diff --git a/_alp/Agents/GCIndustry/Code/Functions.java b/_alp/Agents/GCIndustry/Code/Functions.java
index ff9e338a..898e3765 100644
--- a/_alp/Agents/GCIndustry/Code/Functions.java
+++ b/_alp/Agents/GCIndustry/Code/Functions.java
@@ -153,9 +153,9 @@ else if( ea.p_energyAssetType == OL_EnergyAssetType.HEAT_DEMAND ) {
{/*ALCODESTART::1684397492292*/
double heatDemand_kW = (fm_currentConsumptionFlows_kW.get(OL_EnergyCarriers.HEAT) - fm_currentProductionFlows_kW.get(OL_EnergyCarriers.HEAT));
double biogasSupply_kW = 0;
-if(l_ownerActor.getConnectedAgent() instanceof ConnectionOwner) {
- if(((ConnectionOwner)l_ownerActor.getConnectedAgent()).p_methaneSupplier instanceof EnergyCoop ) {
- EnergyCoop CoopParent = (EnergyCoop)(((ConnectionOwner)l_ownerActor.getConnectedAgent()).p_methaneSupplier);
+if( p_owner != null ) {
+ if( p_owner.p_methaneSupplier instanceof EnergyCoop ) {
+ EnergyCoop CoopParent = (EnergyCoop)p_owner.p_methaneSupplier;
//biogasSupply_kW = -CoopParent.v_methaneVolume_kWh/energyModel.p_timeStep_h + v_previousPowerMethane_kW;
biogasSupply_kW = -CoopParent.fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.METHANE) + v_previousPowerMethane_kW;
}
diff --git a/_alp/Agents/GCNeighborhood/AOC.GCNeighborhood.xml b/_alp/Agents/GCNeighborhood/AOC.GCNeighborhood.xml
index 6b19dab1..66fb1ee7 100644
--- a/_alp/Agents/GCNeighborhood/AOC.GCNeighborhood.xml
+++ b/_alp/Agents/GCNeighborhood/AOC.GCNeighborhood.xml
@@ -101,6 +101,12 @@
+
+
+
+
+
+
false
diff --git a/_alp/Agents/GCNeighborhood/Code/Functions.java b/_alp/Agents/GCNeighborhood/Code/Functions.java
index 0f825edf..65ffc109 100644
--- a/_alp/Agents/GCNeighborhood/Code/Functions.java
+++ b/_alp/Agents/GCNeighborhood/Code/Functions.java
@@ -386,16 +386,16 @@ else if (j_ea.energyAssetType == OL_EnergyAssetType.WINDMILL) {
if (j_ea.energyAssetType == OL_EnergyAssetType.PHOTOVOLTAIC) {
v_hasPV = true;
v_liveAssetsMetaData.totalInstalledPVPower_kW += ((J_EAProduction)j_ea).getCapacityElectric_kW();
- if (l_parentNodeElectric.getConnectedAgent() != null) {
- l_parentNodeElectric.getConnectedAgent().f_updateTotalInstalledProductionAssets(OL_EnergyAssetType.PHOTOVOLTAIC, ((J_EAProduction)j_ea).getCapacityElectric_kW(), true);
+ if ( p_parentNodeElectric != null ) {
+ p_parentNodeElectric.f_updateTotalInstalledProductionAssets(OL_EnergyAssetType.PHOTOVOLTAIC, ((J_EAProduction)j_ea).getCapacityElectric_kW(), true);
}
energyModel.v_liveAssetsMetaData.totalInstalledPVPower_kW += ((J_EAProduction)j_ea).getCapacityElectric_kW();
c_pvAssets.add(j_ea);
}
else if (j_ea.energyAssetType == OL_EnergyAssetType.WINDMILL) {
v_liveAssetsMetaData.totalInstalledWindPower_kW += ((J_EAProduction)j_ea).getCapacityElectric_kW();
- if (l_parentNodeElectric.getConnectedAgent() != null) {
- l_parentNodeElectric.getConnectedAgent().f_updateTotalInstalledProductionAssets(OL_EnergyAssetType.WINDMILL, ((J_EAProduction)j_ea).getCapacityElectric_kW(), true);
+ if ( p_parentNodeElectric != null ) {
+ p_parentNodeElectric.f_updateTotalInstalledProductionAssets(OL_EnergyAssetType.WINDMILL, ((J_EAProduction)j_ea).getCapacityElectric_kW(), true);
}
energyModel.v_liveAssetsMetaData.totalInstalledWindPower_kW += ((J_EAProduction)j_ea).getCapacityElectric_kW();
c_windAssets.add(j_ea);
diff --git a/_alp/Agents/GCPublicCharger/AOC.GCPublicCharger.xml b/_alp/Agents/GCPublicCharger/AOC.GCPublicCharger.xml
index ca01249a..914b70d7 100644
--- a/_alp/Agents/GCPublicCharger/AOC.GCPublicCharger.xml
+++ b/_alp/Agents/GCPublicCharger/AOC.GCPublicCharger.xml
@@ -101,6 +101,12 @@
+
+
+
+
+
+
false
diff --git a/_alp/Agents/GCUtility/AOC.GCUtility.xml b/_alp/Agents/GCUtility/AOC.GCUtility.xml
index c5052700..b4dfd071 100644
--- a/_alp/Agents/GCUtility/AOC.GCUtility.xml
+++ b/_alp/Agents/GCUtility/AOC.GCUtility.xml
@@ -101,6 +101,12 @@
+
+
+
+
+
+
false
diff --git a/_alp/Agents/GCUtility/Code/Functions.java b/_alp/Agents/GCUtility/Code/Functions.java
index 4689376d..2d70c49e 100644
--- a/_alp/Agents/GCUtility/Code/Functions.java
+++ b/_alp/Agents/GCUtility/Code/Functions.java
@@ -63,13 +63,13 @@
{/*ALCODESTART::1721138603366*/
// Arbitrarely i'm deciding not to use more than 95% of the GC & GN capacity.
double capacityLimit_fr = 0.95;
-if (fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.ELECTRICITY) > v_liveConnectionMetaData.contractedDeliveryCapacity_kW * capacityLimit_fr || fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.ELECTRICITY) > l_parentNodeElectric.getConnectedAgent().p_capacity_kW * capacityLimit_fr) {
+if (fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.ELECTRICITY) > v_liveConnectionMetaData.contractedDeliveryCapacity_kW * capacityLimit_fr || fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.ELECTRICITY) > p_parentNodeElectric.p_capacity_kW * capacityLimit_fr) {
J_EAConversionFuelCell fuelCellAsset = (J_EAConversionFuelCell) findFirst(c_conversionAssets, j_ea -> j_ea.getEAType() == OL_EnergyAssetType.FUEL_CELL);
if (fuelCellAsset == null) {
traceln("No fuel cell asset found");
}
else {
- double powerNeeded_kW = max(fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.ELECTRICITY) - v_liveConnectionMetaData.contractedDeliveryCapacity_kW * capacityLimit_fr, fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.ELECTRICITY) - l_parentNodeElectric.getConnectedAgent().p_capacity_kW * capacityLimit_fr);
+ double powerNeeded_kW = max(fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.ELECTRICITY) - v_liveConnectionMetaData.contractedDeliveryCapacity_kW * capacityLimit_fr, fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.ELECTRICITY) - p_parentNodeElectric.p_capacity_kW * capacityLimit_fr);
// For now i've assumed the only fuel cells being used are with a capacity of 1 MW and efficieny of 50%.
double efficiency = fuelCellAsset.getEta_r();
double ratioOfCapacity = powerNeeded_kW / (fuelCellAsset.getOutputCapacity_kW()*efficiency);
diff --git a/_alp/Agents/GridConnection/AOC.GridConnection.xml b/_alp/Agents/GridConnection/AOC.GridConnection.xml
index 7474d663..7bb2fb98 100644
--- a/_alp/Agents/GridConnection/AOC.GridConnection.xml
+++ b/_alp/Agents/GridConnection/AOC.GridConnection.xml
@@ -195,79 +195,6 @@ v_liveData.assetsMetaData = v_liveAssetsMetaData;
NONE
END
-
- 1671020599243
-
- 56
- 110
-
- false
- true
- true
- false
- SINGLE_LINK
- 1674662535386
- true
- 1704289471860
- Object
- SOLID
- 1
- -16777216
- UNDER_AGENTS
- NONE
- END
-
-
- 1671020640665
-
- 57
- 140
-
- false
- true
- true
- false
- SINGLE_LINK
- 1658477288308
- false
- Object
- SOLID
- 1
- -16777216
- UNDER_AGENTS
- NONE
- END
-
-
- 1671020671349
-
- 58
- 168
-
- false
- true
- true
- false
- SINGLE_LINK
- 1658477288308
- false
- Object
- SOLID
- 1
- -16777216
- UNDER_AGENTS
- NONE
- END
-
1704894941623
diff --git a/_alp/Agents/GridConnection/Code/Functions.java b/_alp/Agents/GridConnection/Code/Functions.java
index 7f53e6fa..6f864029 100644
--- a/_alp/Agents/GridConnection/Code/Functions.java
+++ b/_alp/Agents/GridConnection/Code/Functions.java
@@ -1,30 +1,23 @@
double f_connectToParents()
{/*ALCODESTART::1658500398176*/
GridNode myParentNodeElectric = findFirst(energyModel.pop_gridNodes, p->p.p_gridNodeID.equals(p_parentNodeElectricID)) ;
-if( myParentNodeElectric instanceof GridNode ) {
- l_parentNodeElectric.connectTo(myParentNodeElectric);
+if( myParentNodeElectric != null ) {
+ p_parentNodeElectric = myParentNodeElectric;
myParentNodeElectric.f_connectToChild(this);
- //p_parentNodeElectric = myParentNodeElectric;
}
GridNode myParentNodeHeat = findFirst(energyModel.pop_gridNodes, p->p.p_gridNodeID.equals(p_parentNodeHeatID)) ;
-if( myParentNodeHeat instanceof GridNode ) {
- l_parentNodeHeat.connectTo(myParentNodeHeat);
+if( myParentNodeHeat != null ) {
+ p_parentNodeHeat = myParentNodeHeat;
myParentNodeHeat.f_connectToChild(this);
- //p_parentNodeHeat = myParentNodeHeat;
}
-if (p_owner==null){
+if ( p_owner == null ){
p_owner = findFirst(energyModel.pop_connectionOwners, p->p.p_actorID.equals(p_ownerID));
}
-if (p_owner!=null){
- ConnectionOwner myParentConnectionOwner = p_owner; //findFirst(energyModel.pop_connectionOwners, p->p.p_actorID.equals(p_ownerID)) ;
- if( myParentConnectionOwner instanceof ConnectionOwner) {
- //p_ownerActor = myParentConnectionOwner;
- l_ownerActor.connectTo(myParentConnectionOwner);
- myParentConnectionOwner.f_connectToChild(this);
- }
+if ( p_owner != null ){
+ p_owner.f_connectToChild(this);
}
/*EnergySupplier myParentEnergySupplier = findFirst(main.pop_energySuppliers, p->p.p_actorID.equals(p_ownerID)) ;
if( myParentEnergySupplier instanceof EnergySupplier) {
@@ -130,7 +123,7 @@ 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 && l_parentNodeHeat == null ) {
+if ( abs(fm_currentConsumptionFlows_kW.get(OL_EnergyCarriers.HEAT) - fm_currentProductionFlows_kW.get(OL_EnergyCarriers.HEAT)) > 0.1 && p_parentNodeHeat == null ) {
traceln((fm_currentConsumptionFlows_kW.get(OL_EnergyCarriers.HEAT) - fm_currentProductionFlows_kW.get(OL_EnergyCarriers.HEAT)));
traceln("Heat unbalance in gridConnection: " + p_gridConnectionID);
pauseSimulation();
@@ -704,11 +697,10 @@ else if (j_ea instanceof J_EAConversionCurtailer || j_ea instanceof J_EAConversi
double chargeSetpoint_kW = 0;
- if(l_ownerActor.getConnectedAgent() instanceof ConnectionOwner) {
- ConnectionOwner ownerActor = (ConnectionOwner)l_ownerActor.getConnectedAgent();
+ if( p_owner != null) {
//traceln("Initial Mappings are: " + ((ConnectionOwner)p_ownerActor).v_currentPriceBands);
- double currentElectricityPriceCharge_eurpkWh = ownerActor.f_getElectricityPrice(fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.ELECTRICITY)+100.0); // query price at 100kW charging
- double currentElectricityPriceDischarge_eurpkWh = ownerActor.f_getElectricityPrice(fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.ELECTRICITY)-100.0); // query price at -100kW charging
+ double currentElectricityPriceCharge_eurpkWh = p_owner.f_getElectricityPrice(fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.ELECTRICITY)+100.0); // query price at 100kW charging
+ double currentElectricityPriceDischarge_eurpkWh = p_owner.f_getElectricityPrice(fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.ELECTRICITY)-100.0); // query price at -100kW charging
//double lowPassFraction = min(1,1*1.2*energyModel.p_timeStep_h); // smaller value results in more filtering
v_electricityPriceLowPassed_eurpkWh += v_lowPassFactor_fr * ( currentElectricityPriceCharge_eurpkWh - v_electricityPriceLowPassed_eurpkWh );
@@ -868,12 +860,12 @@ else if (p_primaryHeatingAsset== null && p_secondaryHeatingAsset != null && v_ha
f_maxPowerCharging( max(0, availableChargingCapacity));
break;
case CHEAP:
- v_currentElectricityPriceConsumption_eurpkWh = ((ConnectionOwner)l_ownerActor.getConnectedAgent()).f_getElectricityPrice(v_liveConnectionMetaData.contractedDeliveryCapacity_kW);
+ v_currentElectricityPriceConsumption_eurpkWh = p_owner.f_getElectricityPrice(v_liveConnectionMetaData.contractedDeliveryCapacity_kW);
v_electricityPriceLowPassed_eurpkWh += v_lowPassFactor_fr * ( v_currentElectricityPriceConsumption_eurpkWh - v_electricityPriceLowPassed_eurpkWh );
f_chargeOnPrice( v_currentElectricityPriceConsumption_eurpkWh, max(0, availableChargingCapacity));
break;
case V2G:
- v_currentElectricityPriceConsumption_eurpkWh = ((ConnectionOwner)l_ownerActor.getConnectedAgent()).f_getElectricityPrice(v_liveConnectionMetaData.contractedDeliveryCapacity_kW);
+ v_currentElectricityPriceConsumption_eurpkWh = p_owner.f_getElectricityPrice(v_liveConnectionMetaData.contractedDeliveryCapacity_kW);
v_electricityPriceLowPassed_eurpkWh += v_lowPassFactor_fr * ( v_currentElectricityPriceConsumption_eurpkWh - v_electricityPriceLowPassed_eurpkWh );
f_chargeOnPrice_V2G( v_currentElectricityPriceConsumption_eurpkWh, max(0, availableChargingCapacity));
break;
@@ -1177,8 +1169,8 @@ else if (p_primaryHeatingAsset== null && p_secondaryHeatingAsset != null && v_ha
v_hasPV = true;
double capacity_kW = ((J_EAProduction)j_ea).getCapacityElectric_kW();
v_liveAssetsMetaData.totalInstalledPVPower_kW += capacity_kW;
- if (l_parentNodeElectric.getConnectedAgent() != null) {
- l_parentNodeElectric.getConnectedAgent().f_updateTotalInstalledProductionAssets(OL_EnergyAssetType.PHOTOVOLTAIC, capacity_kW, true);
+ if ( p_parentNodeElectric != null ) {
+ p_parentNodeElectric.f_updateTotalInstalledProductionAssets(OL_EnergyAssetType.PHOTOVOLTAIC, capacity_kW, true);
}
c_parentCoops.forEach( coop -> coop.v_liveAssetsMetaData.totalInstalledPVPower_kW += capacity_kW);
energyModel.v_liveAssetsMetaData.totalInstalledPVPower_kW += capacity_kW;
@@ -1187,8 +1179,8 @@ else if (p_primaryHeatingAsset== null && p_secondaryHeatingAsset != null && v_ha
else if (j_ea.energyAssetType == OL_EnergyAssetType.WINDMILL) {
double capacity_kW = ((J_EAProduction)j_ea).getCapacityElectric_kW();
v_liveAssetsMetaData.totalInstalledWindPower_kW += capacity_kW;
- if (l_parentNodeElectric.getConnectedAgent() != null) {
- l_parentNodeElectric.getConnectedAgent().f_updateTotalInstalledProductionAssets(OL_EnergyAssetType.WINDMILL, capacity_kW, true);
+ if ( p_parentNodeElectric != null ) {
+ p_parentNodeElectric.f_updateTotalInstalledProductionAssets(OL_EnergyAssetType.WINDMILL, capacity_kW, true);
}
c_parentCoops.forEach( coop -> coop.v_liveAssetsMetaData.totalInstalledWindPower_kW += capacity_kW);
energyModel.v_liveAssetsMetaData.totalInstalledWindPower_kW += capacity_kW;
@@ -1418,7 +1410,7 @@ else if (j_ea.energyAssetType == OL_EnergyAssetType.WINDMILL) {
}
f_connectToParents();
-if (!l_parentNodeElectric.isConnected()) {
+if ( p_parentNodeElectric == null ) {
traceln("GC: %s with id %s and name %s", this, p_gridConnectionID, p_name);
traceln("GN id %s", p_parentNodeElectricID);
throw new RuntimeException("Exception: GridConnection not connected to GridNodeElectric!");
@@ -1435,8 +1427,8 @@ else if (j_ea.getEAType() == OL_EnergyAssetType.WINDMILL) {
Wind_kW += ((J_EAProduction)j_ea).getCapacityElectric_kW();
}
}
- l_parentNodeElectric.getConnectedAgent().v_totalInstalledPVPower_kW += PV_kW;
- l_parentNodeElectric.getConnectedAgent().v_totalInstalledWindPower_kW += Wind_kW;
+ p_parentNodeElectric.v_totalInstalledPVPower_kW += PV_kW;
+ p_parentNodeElectric.v_totalInstalledWindPower_kW += Wind_kW;
}
f_setOperatingSwitches();
@@ -1714,8 +1706,8 @@ else if(electricityBalance_kW < - v_maxPeakFeedin_kW){
}
double capacity_kW = ((J_EAProduction)j_ea).getCapacityElectric_kW();
v_liveAssetsMetaData.totalInstalledPVPower_kW -= capacity_kW;
- if (l_parentNodeElectric.getConnectedAgent() != null) {
- l_parentNodeElectric.getConnectedAgent().f_updateTotalInstalledProductionAssets(OL_EnergyAssetType.PHOTOVOLTAIC, capacity_kW, false);
+ if ( p_parentNodeElectric != null ) {
+ p_parentNodeElectric.f_updateTotalInstalledProductionAssets(OL_EnergyAssetType.PHOTOVOLTAIC, capacity_kW, false);
}
c_parentCoops.forEach( coop -> coop.v_liveAssetsMetaData.totalInstalledPVPower_kW -= capacity_kW);
energyModel.v_liveAssetsMetaData.totalInstalledPVPower_kW -= capacity_kW;
@@ -1724,8 +1716,8 @@ else if(electricityBalance_kW < - v_maxPeakFeedin_kW){
else if (j_ea.energyAssetType == OL_EnergyAssetType.WINDMILL) {
double capacity_kW = ((J_EAProduction)j_ea).getCapacityElectric_kW();
v_liveAssetsMetaData.totalInstalledWindPower_kW -= capacity_kW;
- if (l_parentNodeElectric.getConnectedAgent() != null) {
- l_parentNodeElectric.getConnectedAgent().f_updateTotalInstalledProductionAssets(OL_EnergyAssetType.WINDMILL, capacity_kW, false);
+ if ( p_parentNodeElectric != null ) {
+ p_parentNodeElectric.f_updateTotalInstalledProductionAssets(OL_EnergyAssetType.WINDMILL, capacity_kW, false);
}
c_parentCoops.forEach( coop -> coop.v_liveAssetsMetaData.totalInstalledPVPower_kW -= capacity_kW);
energyModel.v_liveAssetsMetaData.totalInstalledWindPower_kW -= capacity_kW;
@@ -1951,9 +1943,9 @@ else if (j_ea.energyAssetType == OL_EnergyAssetType.WINDMILL) {
case NODALPRICING:
// Prevent feedin when nodal price is negative
double priceTreshold_eur = -0.0;
- if(l_parentNodeElectric.getConnectedAgent().v_currentTotalNodalPrice_eurpkWh < priceTreshold_eur) {
+ if( p_parentNodeElectric.v_currentTotalNodalPrice_eurpkWh < priceTreshold_eur) {
- double v_currentPowerElectricitySetpoint_kW = fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.ELECTRICITY) * max(0,1+(l_parentNodeElectric.getConnectedAgent().v_currentTotalNodalPrice_eurpkWh-priceTreshold_eur)*5);
+ double v_currentPowerElectricitySetpoint_kW = fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.ELECTRICITY) * max(0,1+(p_parentNodeElectric.v_currentTotalNodalPrice_eurpkWh-priceTreshold_eur)*5);
for (J_EAProduction j_ea : c_productionAssets) {
j_ea.curtailElectricityProduction(v_currentPowerElectricitySetpoint_kW - fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.ELECTRICITY));
if (!(fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.ELECTRICITY) < v_currentPowerElectricitySetpoint_kW)) {
@@ -2038,15 +2030,14 @@ else if (j_ea.energyAssetType == OL_EnergyAssetType.WINDMILL) {
double chargeSetpoint_kW = 0;
double currentElectricityPriceCharge_eurpkWh;
- GridNode GN = l_parentNodeElectric.getConnectedAgent();
//double currentElectricityPriceDischarge_eurpkWh;
//currentElectricityPriceCharge_eurpkWh = energyModel.nationalEnergyMarket.f_getNationalElectricityPrice_eurpMWh()/1000 + GN.v_currentTotalNodalPrice_eurpkWh;
- currentElectricityPriceCharge_eurpkWh = GN.v_currentTotalNodalPrice_eurpkWh;
+ currentElectricityPriceCharge_eurpkWh = p_parentNodeElectric.v_currentTotalNodalPrice_eurpkWh;
v_electricityPriceLowPassed_eurpkWh += v_lowPassFactor_fr * ( currentElectricityPriceCharge_eurpkWh - v_electricityPriceLowPassed_eurpkWh );
- double SOC_setp_fr = 0.9 + (GN.v_totalInstalledPVPower_kW/50_000+GN.v_totalInstalledWindPower_kW/20_000)*(0.2 - 3*GN.v_electricityYieldForecast_fr);
+ double SOC_setp_fr = 0.9 + (p_parentNodeElectric.v_totalInstalledPVPower_kW/50_000+p_parentNodeElectric.v_totalInstalledWindPower_kW/20_000)*(0.2 - 3*p_parentNodeElectric.v_electricityYieldForecast_fr);
//double SOC_setp_fr = 0.9 - 2*energyModel.v_WindYieldForecast_fr;
//SOC_setp_fr = (0.5 + 0.4 * Math.cos(2*Math.PI*(energyModel.t_h-18)/24))*(1-3*GN.v_electricityYieldForecast_fr); // Sinusoidal setpoint: aim for high SOC at 18:00h
//SOC_setp_fr = 0.6 + 0.25 * Math.sin(2*Math.PI*(energyModel.t_h-12)/24); // Sinusoidal setpoint: aim for low SOC at 6:00h, high SOC at 18:00h.
@@ -2485,8 +2476,8 @@ else if (flowsMap.get(EC) > 0){
// update GN parents' wind / solar totals
- l_parentNodeElectric.getConnectedAgent().f_updateTotalInstalledProductionAssets(OL_EnergyAssetType.PHOTOVOLTAIC, v_liveAssetsMetaData.totalInstalledPVPower_kW, false);
- l_parentNodeElectric.getConnectedAgent().f_updateTotalInstalledProductionAssets(OL_EnergyAssetType.WINDMILL, v_liveAssetsMetaData.totalInstalledWindPower_kW, false);
+ p_parentNodeElectric.f_updateTotalInstalledProductionAssets(OL_EnergyAssetType.PHOTOVOLTAIC, v_liveAssetsMetaData.totalInstalledPVPower_kW, false);
+ p_parentNodeElectric.f_updateTotalInstalledProductionAssets(OL_EnergyAssetType.WINDMILL, v_liveAssetsMetaData.totalInstalledWindPower_kW, false);
energyModel.v_liveAssetsMetaData.totalInstalledPVPower_kW -= v_liveAssetsMetaData.totalInstalledPVPower_kW;
energyModel.v_liveAssetsMetaData.totalInstalledWindPower_kW -= v_liveAssetsMetaData.totalInstalledWindPower_kW;
energyModel.v_liveAssetsMetaData.totalInstalledBatteryStorageCapacity_MWh -= v_liveAssetsMetaData.totalInstalledBatteryStorageCapacity_MWh;
@@ -2545,8 +2536,8 @@ else if (flowsMap.get(EC) > 0){
v_liveAssetsMetaData.updateActiveAssetData(new ArrayList<>(List.of(this)));
// update GN parents' wind / solar totals (will be wrong if you changed your totals while paused)
- l_parentNodeElectric.getConnectedAgent().f_updateTotalInstalledProductionAssets(OL_EnergyAssetType.PHOTOVOLTAIC, v_liveAssetsMetaData.totalInstalledPVPower_kW, true);
- l_parentNodeElectric.getConnectedAgent().f_updateTotalInstalledProductionAssets(OL_EnergyAssetType.WINDMILL, v_liveAssetsMetaData.totalInstalledWindPower_kW, true);
+ p_parentNodeElectric.f_updateTotalInstalledProductionAssets(OL_EnergyAssetType.PHOTOVOLTAIC, v_liveAssetsMetaData.totalInstalledPVPower_kW, true);
+ p_parentNodeElectric.f_updateTotalInstalledProductionAssets(OL_EnergyAssetType.WINDMILL, v_liveAssetsMetaData.totalInstalledWindPower_kW, true);
energyModel.v_liveAssetsMetaData.totalInstalledPVPower_kW += v_liveAssetsMetaData.totalInstalledPVPower_kW;
energyModel.v_liveAssetsMetaData.totalInstalledWindPower_kW += v_liveAssetsMetaData.totalInstalledWindPower_kW;
energyModel.v_liveAssetsMetaData.totalInstalledBatteryStorageCapacity_MWh += v_liveAssetsMetaData.totalInstalledBatteryStorageCapacity_MWh;
diff --git a/_alp/Agents/GridConnection/Variables.xml b/_alp/Agents/GridConnection/Variables.xml
index 7088294a..6a5c4c3c 100644
--- a/_alp/Agents/GridConnection/Variables.xml
+++ b/_alp/Agents/GridConnection/Variables.xml
@@ -1589,7 +1589,7 @@
1658500465208
50
- 235
+ 160
-
- 1658495297995
-
- true
- 200
- -50
-
- 15
- 0
-
- false
- true
- true
- false
- SINGLE_LINK
- 1658477288308
- false
- Object
- SOLID
- 1
- -16777216
- UNDER_AGENTS
- NONE
- END
-
-
- 1658495597148
-
- true
- 200
- -20
-
- 15
- 0
-
- false
- true
- true
- false
- COLLECTION_OF_LINKS
- false
- Object
- SOLID
- 1
- -16777216
- UNDER_AGENTS
- NONE
- END
-
diff --git a/_alp/Agents/GridNode/Code/Functions.java b/_alp/Agents/GridNode/Code/Functions.java
index e751d27e..25dba726 100644
--- a/_alp/Agents/GridNode/Code/Functions.java
+++ b/_alp/Agents/GridNode/Code/Functions.java
@@ -155,8 +155,7 @@
{/*ALCODESTART::1666556555538*/
for (GridConnection gc: c_connectedGridConnections){
//traceln("Gc "+ gc.toString() + ", price "+ price_eurpkWh + ", allowance "+ allowance_kW +".");
- ConnectionOwner owner = ((ConnectionOwner)gc.l_ownerActor.getConnectedAgent());
- owner.v_currentNodalPrice_eurpkWh = price_eurpkWh;
+ gc.p_owner.v_currentNodalPrice_eurpkWh = price_eurpkWh;
}
for (EnergyCoop e: c_energyCoops){
e.v_currentNodalPrice_eurpkWh = price_eurpkWh;
diff --git a/_alp/Agents/GridOperator/AOC.GridOperator.xml b/_alp/Agents/GridOperator/AOC.GridOperator.xml
index 6594be51..a0595aa5 100644
--- a/_alp/Agents/GridOperator/AOC.GridOperator.xml
+++ b/_alp/Agents/GridOperator/AOC.GridOperator.xml
@@ -137,60 +137,6 @@
NONE
END
-
- 1660736398362
-
-
- 280
- -80
-
- 15
- 0
-
- false
- true
- true
- false
- COLLECTION_OF_LINKS
- false
- Object
- SOLID
- 1
- -16777216
- UNDER_AGENTS
- NONE
- END
-
-
- 1660736398364
-
-
- 280
- -50
-
- 15
- 0
-
- false
- true
- true
- false
- COLLECTION_OF_LINKS
- false
- Object
- SOLID
- 1
- -16777216
- UNDER_AGENTS
- NONE
- END
-
diff --git a/_alp/Agents/GridOperator/Code/Functions.java b/_alp/Agents/GridOperator/Code/Functions.java
index 9613a543..0b649910 100644
--- a/_alp/Agents/GridOperator/Code/Functions.java
+++ b/_alp/Agents/GridOperator/Code/Functions.java
@@ -1,9 +1,11 @@
double f_connectToChild(GridNode ConnectingChildNode,OL_EnergyCarriers energyType)
{/*ALCODESTART::1660736411309*/
-subConnections.connectTo( ConnectingChildNode );
if (energyType == OL_EnergyCarriers.ELECTRICITY) {
c_electricityGridNodes.add( ConnectingChildNode );
}
+else if (energyType == OL_EnergyCarriers.HEAT) {
+ c_heatGridNodes.add( ConnectingChildNode );
+}
else {
traceln( "f_connectToChild vanuit GridOperator voegt een type Node toe wat geen ELECTRICITY gridNOde is");
}
diff --git a/_alp/Agents/GridOperator/Variables.xml b/_alp/Agents/GridOperator/Variables.xml
index 1343ea3c..1e5fc77d 100644
--- a/_alp/Agents/GridOperator/Variables.xml
+++ b/_alp/Agents/GridOperator/Variables.xml
@@ -458,4 +458,22 @@
String
+
+ 1747304533257
+
+ 700
+ 140
+
+ 10
+ 0
+
+ false
+ true
+ true
+
+ ArrayList
+ GridNode
+ String
+
+
diff --git a/_alp/Classes/Class.J_AssetsMetaData.java b/_alp/Classes/Class.J_AssetsMetaData.java
index 0c4e29cd..3cd4c67b 100644
--- a/_alp/Classes/Class.J_AssetsMetaData.java
+++ b/_alp/Classes/Class.J_AssetsMetaData.java
@@ -82,7 +82,7 @@ public void updateActiveAssetData(ArrayList gcList) {
}
//Heat grid
for(GridConnection GC : gcList){
- if(GC.l_parentNodeHeat.getConnectedAgent() != null && GC.v_isActive){
+ if(GC.p_parentNodeHeat != null && GC.v_isActive){
this.hasHeatGridConnection = true;
break;
}
diff --git a/_alp/Classes/Class.J_BatteryAlgorithmBas.java b/_alp/Classes/Class.J_BatteryAlgorithmBas.java
index 1875c9d0..9c2e6895 100644
--- a/_alp/Classes/Class.J_BatteryAlgorithmBas.java
+++ b/_alp/Classes/Class.J_BatteryAlgorithmBas.java
@@ -20,19 +20,17 @@ public double calculateChargeSetpoint_kW(double SOC){
//double currentElectricityPriceEPEX_eurpkWh = energyModel.v_epexForecast_eurpkWh;
- GridNode node = parentGC.l_parentNodeElectric.getConnectedAgent();
if (parentGC.p_batteryAsset.getStorageCapacity_kWh() != 0){
double currentCoopElectricitySurplus_kW = 0;
double CoopConnectionCapacity_kW = 0;
double v_previousPowerBattery_kW = parentGC.v_previousPowerElectricity_kW;// Assumes battery is only asset on gridconnection!! p_batteryAsset.electricityConsumption_kW-p_batteryAsset.electricityProduction_kW;
- GridNode GN = parentGC.l_parentNodeElectric.getConnectedAgent();
- if(parentGC.l_ownerActor.getConnectedAgent() instanceof ConnectionOwner) {
- currentCoopElectricitySurplus_kW = -GN.v_currentLoad_kW + v_previousPowerBattery_kW;
- CoopConnectionCapacity_kW = 0.9*GN.p_capacity_kW; // Use only 90% of capacity for robustness against delay
+ if(parentGC.p_owner != null) {
+ currentCoopElectricitySurplus_kW = -parentGC.p_parentNodeElectric.v_currentLoad_kW + v_previousPowerBattery_kW;
+ CoopConnectionCapacity_kW = 0.9*parentGC.p_parentNodeElectric.p_capacity_kW; // Use only 90% of capacity for robustness against delay
//}
} else { // Get gridload directly from node
- currentCoopElectricitySurplus_kW = -node.v_currentLoad_kW + v_previousPowerBattery_kW;
- CoopConnectionCapacity_kW = 0.95*node.p_capacity_kW; // Use only 90% of capacity for robustness against delay
+ currentCoopElectricitySurplus_kW = -parentGC.p_parentNodeElectric.v_currentLoad_kW + v_previousPowerBattery_kW;
+ CoopConnectionCapacity_kW = 0.95*parentGC.p_parentNodeElectric.p_capacity_kW; // Use only 90% of capacity for robustness against delay
}
double availableChargePower_kW = CoopConnectionCapacity_kW + currentCoopElectricitySurplus_kW; // Max battery charging power within grid capacity
@@ -47,14 +45,14 @@ public double calculateChargeSetpoint_kW(double SOC){
return batteryChargeSetpoint_kW;
}
if (parentGC.energyModel.v_currentSolarPowerNormalized_r > 0.1) {
- if (GN.v_currentLoad_kW < 0) {
+ if (parentGC.p_parentNodeElectric.v_currentLoad_kW < 0) {
batteryChargeSetpoint_kW = availableChargePower_kW;
return batteryChargeSetpoint_kW;
}
}
else {
- double expectedWind_kWh = node.v_totalInstalledWindPower_kW * parentGC.energyModel.v_WindYieldForecast_fr * parentGC.energyModel.p_forecastTime_h;
- double expectedSolar_kWh = node.v_totalInstalledPVPower_kW * parentGC.energyModel.v_SolarYieldForecast_fr * parentGC.energyModel.p_forecastTime_h;
+ double expectedWind_kWh = parentGC.p_parentNodeElectric.v_totalInstalledWindPower_kW * parentGC.energyModel.v_WindYieldForecast_fr * parentGC.energyModel.p_forecastTime_h;
+ double expectedSolar_kWh = parentGC.p_parentNodeElectric.v_totalInstalledPVPower_kW * parentGC.energyModel.v_SolarYieldForecast_fr * parentGC.energyModel.p_forecastTime_h;
double incomingPower_fr = (expectedSolar_kWh + expectedWind_kWh) / parentGC.p_batteryAsset.getStorageCapacity_kWh();
double SOC_setp_fr = 1 - incomingPower_fr;
diff --git a/_alp/Classes/Class.J_EAProduction.java b/_alp/Classes/Class.J_EAProduction.java
index 619ca80c..6e5dba07 100644
--- a/_alp/Classes/Class.J_EAProduction.java
+++ b/_alp/Classes/Class.J_EAProduction.java
@@ -50,16 +50,16 @@ public void setCapacityElectric_kW(double capacityElectric_kW) {
double difference_kW = capacityElectric_kW - this.capacity_kW;
if (this.energyAssetType == OL_EnergyAssetType.WINDMILL && this.parentAgent instanceof GridConnection) {
((GridConnection) this.parentAgent).v_liveAssetsMetaData.totalInstalledWindPower_kW += difference_kW;
- if (((GridConnection) this.parentAgent).l_parentNodeElectric.getConnectedAgent() != null) {
- ((GridConnection) this.parentAgent).l_parentNodeElectric.getConnectedAgent().f_updateTotalInstalledProductionAssets(OL_EnergyAssetType.WINDMILL, difference_kW, true);
+ if (((GridConnection) this.parentAgent).p_parentNodeElectric != null) {
+ ((GridConnection) this.parentAgent).p_parentNodeElectric.f_updateTotalInstalledProductionAssets(OL_EnergyAssetType.WINDMILL, difference_kW, true);
}
((GridConnection) this.parentAgent).c_parentCoops.forEach( coop -> coop.v_liveAssetsMetaData.totalInstalledWindPower_kW += difference_kW);
((GridConnection) this.parentAgent).energyModel.v_liveAssetsMetaData.totalInstalledWindPower_kW += difference_kW;
}
else if (this.energyAssetType == OL_EnergyAssetType.PHOTOVOLTAIC && this.parentAgent instanceof GridConnection) {
((GridConnection) this.parentAgent).v_liveAssetsMetaData.totalInstalledPVPower_kW += difference_kW;
- if (((GridConnection) this.parentAgent).l_parentNodeElectric.getConnectedAgent() != null) {
- ((GridConnection) this.parentAgent).l_parentNodeElectric.getConnectedAgent().f_updateTotalInstalledProductionAssets(OL_EnergyAssetType.PHOTOVOLTAIC, difference_kW, true);
+ if (((GridConnection) this.parentAgent).p_parentNodeElectric != null) {
+ ((GridConnection) this.parentAgent).p_parentNodeElectric.f_updateTotalInstalledProductionAssets(OL_EnergyAssetType.PHOTOVOLTAIC, difference_kW, true);
}
((GridConnection) this.parentAgent).c_parentCoops.forEach( coop -> coop.v_liveAssetsMetaData.totalInstalledPVPower_kW += difference_kW);
((GridConnection) this.parentAgent).energyModel.v_liveAssetsMetaData.totalInstalledPVPower_kW += difference_kW;