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
3 changes: 1 addition & 2 deletions _alp/Agents/A_SubTenant/AOC.A_SubTenant.xml
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,7 @@
<HandleReceiveInConnections>false</HandleReceiveInConnections>
<AgentLinkType>SINGLE_LINK</AgentLinkType>
<AgentReferenceId>1660224852394</AgentReferenceId>
<AgentLinkBidirectional>true</AgentLinkBidirectional>
<BidirectionalPeerId>1703256762219</BidirectionalPeerId>
<AgentLinkBidirectional>false</AgentLinkBidirectional>
<MessageType>Object</MessageType>
<LineStyle>SOLID</LineStyle>
<LineWidth>1</LineWidth>
Expand Down
25 changes: 0 additions & 25 deletions _alp/Agents/Actor/AOC.Actor.xml
Original file line number Diff line number Diff line change
Expand Up @@ -118,31 +118,6 @@
<LineArrow>NONE</LineArrow>
<LineArrowPosition>END</LineArrowPosition>
</AgentLink>
<AgentLink>
<Id>1704289471860</Id>
<Name><![CDATA[gridConnections]]></Name>
<X>60</X>
<Y>-20</Y>
<Label>
<X>15</X>
<Y>0</Y>
</Label>
<PublicFlag>false</PublicFlag>
<PresentationFlag>true</PresentationFlag>
<ShowLabel>true</ShowLabel>
<HandleReceiveInConnections>false</HandleReceiveInConnections>
<AgentLinkType>COLLECTION_OF_LINKS</AgentLinkType>
<AgentReferenceId>1658499438203</AgentReferenceId>
<AgentLinkBidirectional>true</AgentLinkBidirectional>
<BidirectionalPeerId>1671020599243</BidirectionalPeerId>
<MessageType>Object</MessageType>
<LineStyle>SOLID</LineStyle>
<LineWidth>1</LineWidth>
<LineColor>-16777216</LineColor>
<LineZOrder>UNDER_AGENTS</LineZOrder>
<LineArrow>NONE</LineArrow>
<LineArrowPosition>END</LineArrowPosition>
</AgentLink>
</AgentLinks>
<Presentation>
<Level>
Expand Down
51 changes: 0 additions & 51 deletions _alp/Agents/ConnectionOwner/AOC.ConnectionOwner.xml
Original file line number Diff line number Diff line change
Expand Up @@ -168,57 +168,6 @@ energyModel.c_connectionOwners.add(this);]]></StartupCode>
<LineArrow>NONE</LineArrow>
<LineArrowPosition>END</LineArrowPosition>
</AgentLink>
<AgentLink>
<Id>1703256762219</Id>
<Name><![CDATA[l_subTenant]]></Name>
<ExcludeFromBuild>true</ExcludeFromBuild>
<X>200</X>
<Y>-20</Y>
<Label>
<X>15</X>
<Y>0</Y>
</Label>
<PublicFlag>false</PublicFlag>
<PresentationFlag>true</PresentationFlag>
<ShowLabel>true</ShowLabel>
<HandleReceiveInConnections>false</HandleReceiveInConnections>
<AgentLinkType>COLLECTION_OF_LINKS</AgentLinkType>
<AgentReferenceId>1658752695711</AgentReferenceId>
<AgentLinkBidirectional>true</AgentLinkBidirectional>
<BidirectionalPeerId>1703256686877</BidirectionalPeerId>
<MessageType>Object</MessageType>
<LineStyle>SOLID</LineStyle>
<LineWidth>1</LineWidth>
<LineColor>-16777216</LineColor>
<LineZOrder>UNDER_AGENTS</LineZOrder>
<LineArrow>NONE</LineArrow>
<LineArrowPosition>END</LineArrowPosition>
</AgentLink>
<AgentLink>
<Id>1704895007444</Id>
<Name><![CDATA[l_ownedBuildings]]></Name>
<ExcludeFromBuild>true</ExcludeFromBuild>
<X>310</X>
<Y>-20</Y>
<Label>
<X>15</X>
<Y>0</Y>
</Label>
<PublicFlag>false</PublicFlag>
<PresentationFlag>true</PresentationFlag>
<ShowLabel>true</ShowLabel>
<HandleReceiveInConnections>false</HandleReceiveInConnections>
<AgentLinkType>COLLECTION_OF_LINKS</AgentLinkType>
<AgentReferenceId>1676382560905</AgentReferenceId>
<AgentLinkBidirectional>false</AgentLinkBidirectional>
<MessageType>Object</MessageType>
<LineStyle>SOLID</LineStyle>
<LineWidth>1</LineWidth>
<LineColor>-16777216</LineColor>
<LineZOrder>UNDER_AGENTS</LineZOrder>
<LineArrow>NONE</LineArrow>
<LineArrowPosition>END</LineArrowPosition>
</AgentLink>
</AgentLinks>
<ContainerLinks>
<ContainerLink>
Expand Down
1 change: 0 additions & 1 deletion _alp/Agents/ConnectionOwner/Code/Functions.java
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
60 changes: 60 additions & 0 deletions _alp/Agents/EnergyModel/EmbeddedObjects.xml
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,12 @@
<Parameter>
<Name><![CDATA[p_address]]></Name>
</Parameter>
<Parameter>
<Name><![CDATA[p_parentNodeHeat]]></Name>
</Parameter>
<Parameter>
<Name><![CDATA[p_parentNodeElectric]]></Name>
</Parameter>
</Parameters>
<ReplicationFlag>true</ReplicationFlag>
<Replication Class="CodeValue">
Expand Down Expand Up @@ -1129,6 +1135,12 @@
<Parameter>
<Name><![CDATA[p_cookingMethod]]></Name>
</Parameter>
<Parameter>
<Name><![CDATA[p_parentNodeHeat]]></Name>
</Parameter>
<Parameter>
<Name><![CDATA[p_parentNodeElectric]]></Name>
</Parameter>
</Parameters>
<ReplicationFlag>true</ReplicationFlag>
<Replication Class="CodeValue">
Expand Down Expand Up @@ -1284,6 +1296,12 @@
<Parameter>
<Name><![CDATA[p_address]]></Name>
</Parameter>
<Parameter>
<Name><![CDATA[p_parentNodeHeat]]></Name>
</Parameter>
<Parameter>
<Name><![CDATA[p_parentNodeElectric]]></Name>
</Parameter>
</Parameters>
<ReplicationFlag>true</ReplicationFlag>
<Replication Class="CodeValue">
Expand Down Expand Up @@ -1436,6 +1454,12 @@
<Parameter>
<Name><![CDATA[p_isSliderGC]]></Name>
</Parameter>
<Parameter>
<Name><![CDATA[p_parentNodeHeat]]></Name>
</Parameter>
<Parameter>
<Name><![CDATA[p_parentNodeElectric]]></Name>
</Parameter>
</Parameters>
<ReplicationFlag>true</ReplicationFlag>
<Replication Class="CodeValue">
Expand Down Expand Up @@ -1627,6 +1651,12 @@
<Parameter>
<Name><![CDATA[p_address]]></Name>
</Parameter>
<Parameter>
<Name><![CDATA[p_parentNodeHeat]]></Name>
</Parameter>
<Parameter>
<Name><![CDATA[p_parentNodeElectric]]></Name>
</Parameter>
</Parameters>
<ReplicationFlag>true</ReplicationFlag>
<Replication Class="CodeValue">
Expand Down Expand Up @@ -1776,6 +1806,12 @@
<Parameter>
<Name><![CDATA[p_address]]></Name>
</Parameter>
<Parameter>
<Name><![CDATA[p_parentNodeHeat]]></Name>
</Parameter>
<Parameter>
<Name><![CDATA[p_parentNodeElectric]]></Name>
</Parameter>
</Parameters>
<ReplicationFlag>true</ReplicationFlag>
<Replication Class="CodeValue">
Expand Down Expand Up @@ -1925,6 +1961,12 @@
<Parameter>
<Name><![CDATA[p_address]]></Name>
</Parameter>
<Parameter>
<Name><![CDATA[p_parentNodeHeat]]></Name>
</Parameter>
<Parameter>
<Name><![CDATA[p_parentNodeElectric]]></Name>
</Parameter>
</Parameters>
<ReplicationFlag>true</ReplicationFlag>
<Replication Class="CodeValue">
Expand Down Expand Up @@ -2077,6 +2119,12 @@
<Parameter>
<Name><![CDATA[p_isSliderGC]]></Name>
</Parameter>
<Parameter>
<Name><![CDATA[p_parentNodeHeat]]></Name>
</Parameter>
<Parameter>
<Name><![CDATA[p_parentNodeElectric]]></Name>
</Parameter>
</Parameters>
<ReplicationFlag>true</ReplicationFlag>
<Replication Class="CodeValue">
Expand Down Expand Up @@ -2556,6 +2604,12 @@
<Parameter>
<Name><![CDATA[p_address]]></Name>
</Parameter>
<Parameter>
<Name><![CDATA[p_parentNodeHeat]]></Name>
</Parameter>
<Parameter>
<Name><![CDATA[p_parentNodeElectric]]></Name>
</Parameter>
</Parameters>
<ReplicationFlag>true</ReplicationFlag>
<Replication Class="CodeValue">
Expand Down Expand Up @@ -2739,6 +2793,12 @@
<Parameter>
<Name><![CDATA[p_quinaryHeatingAsset]]></Name>
</Parameter>
<Parameter>
<Name><![CDATA[p_parentNodeHeat]]></Name>
</Parameter>
<Parameter>
<Name><![CDATA[p_parentNodeElectric]]></Name>
</Parameter>
</Parameters>
<ReplicationFlag>true</ReplicationFlag>
<Replication Class="CodeValue">
Expand Down
6 changes: 6 additions & 0 deletions _alp/Agents/GCDistrictHeating/AOC.GCDistrictHeating.xml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,12 @@
<Parameter>
<Name><![CDATA[p_address]]></Name>
</Parameter>
<Parameter>
<Name><![CDATA[p_parentNodeHeat]]></Name>
</Parameter>
<Parameter>
<Name><![CDATA[p_parentNodeElectric]]></Name>
</Parameter>
</Parameters>
<Generic>false</Generic>
<GenericParameter>
Expand Down
9 changes: 5 additions & 4 deletions _alp/Agents/GCDistrictHeating/Code/Functions.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
6 changes: 6 additions & 0 deletions _alp/Agents/GCEnergyConversion/AOC.GCEnergyConversion.xml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@
<Parameter>
<Name><![CDATA[p_address]]></Name>
</Parameter>
<Parameter>
<Name><![CDATA[p_parentNodeHeat]]></Name>
</Parameter>
<Parameter>
<Name><![CDATA[p_parentNodeElectric]]></Name>
</Parameter>
</Parameters>
<Generic>false</Generic>
<GenericParameter>
Expand Down
14 changes: 7 additions & 7 deletions _alp/Agents/GCEnergyConversion/Code/Functions.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -261,8 +261,8 @@
//Pair<J_FlowsMap, Double> 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){
Expand Down Expand Up @@ -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;

Expand Down
6 changes: 6 additions & 0 deletions _alp/Agents/GCEnergyProduction/AOC.GCEnergyProduction.xml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,12 @@
<Parameter>
<Name><![CDATA[p_address]]></Name>
</Parameter>
<Parameter>
<Name><![CDATA[p_parentNodeHeat]]></Name>
</Parameter>
<Parameter>
<Name><![CDATA[p_parentNodeElectric]]></Name>
</Parameter>
</Parameters>
<Generic>false</Generic>
<GenericParameter>
Expand Down
11 changes: 5 additions & 6 deletions _alp/Agents/GCEnergyProduction/Code/Functions.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
Expand Down
6 changes: 6 additions & 0 deletions _alp/Agents/GCGridBattery/AOC.GCGridBattery.xml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,12 @@
<Parameter>
<Name><![CDATA[p_address]]></Name>
</Parameter>
<Parameter>
<Name><![CDATA[p_parentNodeHeat]]></Name>
</Parameter>
<Parameter>
<Name><![CDATA[p_parentNodeElectric]]></Name>
</Parameter>
</Parameters>
<Generic>false</Generic>
<GenericParameter>
Expand Down
Loading