diff --git a/Zero_engine.alpx b/Zero_engine.alpx
index 0e7def33..1bfdf012 100644
--- a/Zero_engine.alpx
+++ b/Zero_engine.alpx
@@ -1059,6 +1059,18 @@
1753968826422
+
+
+
1762354709855
diff --git a/Zero_engine.original.alp b/Zero_engine.original.alp
new file mode 100644
index 00000000..b94f0f0d
--- /dev/null
+++ b/Zero_engine.original.alp
@@ -0,0 +1,62645 @@
+
+
+
+ 1658477103134
+ Zero_engine
+ 6
+ zero_engine
+ Hour
+
+
+ 1658478100573
+ OL_GridNodeType
+
+
+
+
+
+
+
+
+
+
+
+ 1659117289326
+ OL_EnergyCarriers
+
+
+
+
+
+
+
+ 1659118262286
+ OL_ElectrolyserState
+
+
+
+
+
+
+
+
+ 1659118272924
+ OL_GISObjectType
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1659118426374
+ OL_EnergyAssetType
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1659525715752
+ OL_EAConversionTypes
+ true
+
+
+
+
+
+
+
+
+ 1659525726440
+ OL_EAProductionTypes
+ true
+
+
+
+
+
+ 1659701773383
+ OL_AreaType
+ true
+
+
+
+
+
+
+
+
+ 1659711659517
+ OL_BuildingType
+
+
+
+
+
+
+
+
+ 1660226249511
+ OL_ActorType
+ true
+
+
+
+
+
+
+
+
+
+
+ 1660743989498
+ OL_ContractType
+
+
+
+
+
+
+ 1660743989598
+ OL_DeliveryContractType
+
+
+
+
+
+
+
+
+ 1660743989698
+ OL_TransportContractType
+
+
+
+
+
+
+ 1660743989698
+ OL_ConnectionContractType
+
+
+
+
+ 1660743989798
+ OL_TaxContractType
+
+
+
+
+ 1665486884039
+ OL_GridConnectionHeatingType
+
+
+
+
+
+
+
+
+
+
+
+ 1665487983362
+ OL_GridConnectionIsolationLabel
+
+
+
+
+
+
+
+
+
+
+ 1667742453792
+ OL_MobilityPatternType
+
+
+
+
+
+ 1668361027279
+ OL_ChargingAttitude
+
+
+
+
+
+
+
+
+
+ 1668693527446
+ OL_BatteryOperationMode
+
+
+
+
+
+
+
+
+
+
+
+ 1668693527447
+ OL_ElectrolyserOperationMode
+
+
+
+
+
+
+ 1675025163072
+ OL_ConnectionOwnerType
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1718560423698
+ OL_ProfileAssetType
+ true
+
+
+
+
+
+
+
+
+
+ 1722411204920
+ OL_CurtailmentMode
+
+
+
+
+
+ 1726685111559
+ OL_HouseholdCookingMethod
+
+
+
+
+
+ 1729161119459
+ OL_FlowsMapKeys
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1729686050861
+ OL_EAFlowKeys
+ true
+
+
+ 1741598206262
+ OL_ResultScope
+
+
+
+
+
+
+ 1749738812988
+ OL_ParkingSpaceType
+
+
+
+
+
+
+
+ 1751886660644
+ OL_AmbientTempType
+
+
+
+
+
+
+
+ 1753968826411
+ OL_AssetFlowCategories
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1762354709855
+ OL_VehicleType
+
+
+
+
+
+
+
+
+ 1752677823817
+ GridConnections
+
+
+ 1752677829820
+ Actors
+
+
+ 1752677832758
+ EnergyAssets
+
+
+ 1752679379816
+ DataStructures
+
+
+ 1752680962144
+ DataClasses
+
+
+ 1752681631114
+ GIS
+
+
+ 1752681639768
+ ActivityTrackers
+
+
+ 1752737189062
+ Deprecated
+
+
+ 1753342021373
+ SerialisationMixins
+
+
+ 1762850551601
+ AssetManagementClasses
+
+
+ 1762850578079
+ HeatingManagement
+ 1762850551601
+
+
+ 1762850586274
+ ChargingManagement
+ 1762850551601
+
+
+ 1762850602203
+ unused
+ 1762850578079
+
+
+ 1762850659543
+ BatteryManagement
+ 1762850551601
+
+
+ 1762850958928
+ AggregatorManagement
+ 1762850551601
+
+
+ 1762850978631
+ AggregatorBatteryManagement
+ 1762850958928
+
+
+
+
+ 1674662535386
+ Actor
+ public static void forceSetOwner(Agent agent, AgentArrayList pop) throws Exception {
+ Agent owner = pop.getOwner();
+ Field f = Agent.class.getDeclaredField("d");
+ f.setAccessible(true);
+ f.set(agent, owner);
+ Field ff = Agent.class.getDeclaredField("j");
+ ff.setAccessible(true);
+ ff.set(agent, pop);
+ /*Field c = Agent.class.getDeclaredField("c");
+ traceln("Field c: %s", c);
+ c.setAccessible(true);
+ c.toString();*/
+}
+ 1752677829820
+ import java.lang.reflect.Field;
+ false
+
+ 1674662535384
+ 1674662535384
+
+ T extends Agent
+
+ Generic parameter:
+
+ ENTITY
+ 100
+ false
+ 100
+ true
+
+ -4144960
+ null
+
+ true
+ true
+ false
+
+ 10
+ MPS
+
+
+ 1
+ METER
+
+
+ 1
+ METER
+
+
+ 1
+ METER
+
+
+
+ false
+
+ 1.0
+ SECOND
+
+ CONTINUOUS
+ 500
+ 500
+ 0
+ 100
+ 100
+ MOORE
+ USER_DEF
+ USER_DEF
+ 2
+ 50
+ 0.95
+ 10
+
+
+ true
+ 1658477089996
+ true
+ 1674720000000
+
+ 0
+ HOUR
+
+
+ 1
+ HOUR
+
+
+
+ 1674662535382
+ scale
+ 0
+ -150
+ false
+ false
+ false
+ SHAPE_DRAW_2D3D
+ 100
+ 0
+ BASED_ON_LENGTH
+ 10
+ METER
+ 10
+ true
+
+ 1674662535385
+ 1674662535381
+
+
+ 1674662727346
+ p_actorID
+ Unique identifier of this actor in String format. Designated in Config-excel and used to link actors to netConnections.
+
+@since: Sprint 6
+@author: Gillis
+ 60
+ 70
+
+ false
+ true
+ true
+
+ String
+ NONE
+ false
+
+ 1674662727344
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1674662727350
+ p_actorType
+ Actor type in OL_ActorType format. Designated in Config-excel and used to determine actor-type specific functionalities later.
+
+@since: Sprint 6
+@author: Gillis
+ true
+ 60
+ 90
+
+ false
+ true
+ true
+
+ OL_ActorType
+ NONE
+ false
+
+ 1674662727348
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1692112728484
+ p_actorGroup
+ Actor type in OL_ActorType format. Designated in Config-excel and used to determine actor-type specific functionalities later.
+
+@since: Sprint 6
+@author: Gillis
+ 60
+ 110
+
+ false
+ true
+ true
+
+ String
+ NONE
+ false
+
+ 1692112728482
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1692112731344
+ p_actorSubgroup
+ Actor type in OL_ActorType format. Designated in Config-excel and used to determine actor-type specific functionalities later.
+
+@since: Sprint 6
+@author: Gillis
+ 160
+ 110
+
+ false
+ true
+ true
+
+ String
+ NONE
+ false
+
+ 1692112731342
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+
+
+ 1674662535381
+ connections
+ true
+ 60
+ -50
+
+ false
+ true
+ true
+ false
+ COLLECTION_OF_LINKS
+ true
+ Object
+ SOLID
+ 1
+ -16777216
+ UNDER_AGENTS
+ NONE
+ END
+
+
+
+
+ 1674662535385
+ level
+ 0
+ 0
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ 0
+ DIM_NON_CURRENT
+
+
+ 1674662718508
+ line
+ 20
+ 40
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ false
+ 0
+ 10
+ 1
+ -16777216
+ null
+ SOLID
+ 1
+ 0
+ 1
+ 0
+ 140
+ 0
+ 0
+
+
+ 1674662718511
+ text
+ 50
+ 20
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ ID & connections
+
+ SansSerif
+ 11
+
+
+ LEFT
+
+
+
+
+
+
+ 1658752695711
+ A_SubTenant
+ true
+ 1752737189062
+
+ zero_engine
+ Actor
+
+
+
+ p_actorID
+
+
+ p_actorType
+
+
+ p_actorGroup
+
+
+ p_actorSubgroup
+
+
+ energyModel.c_actors.add(this);
+ false
+
+ 1658752695709
+ 1658752695709
+
+ T extends Agent
+
+ Generic parameter:
+
+ ENTITY
+ 100
+ false
+ 100
+ true
+
+ -4144960
+ null
+
+ true
+ true
+ false
+
+ 10
+ MPS
+
+
+ 1
+ METER
+
+
+ 1
+ METER
+
+
+ 1
+ METER
+
+
+
+ false
+
+ 1.0
+ SECOND
+
+ CONTINUOUS
+ 500
+ 500
+ 0
+ 100
+ 100
+ MOORE
+ USER_DEF
+ USER_DEF
+ 2
+ 50
+ 0.95
+ 10
+
+
+ true
+ 1658477089995
+ true
+ 1658822400000
+
+ 0
+ HOUR
+
+
+ 1
+ HOUR
+
+
+
+ 1658752695707
+ scale
+ 0
+ -150
+ false
+ false
+ false
+ SHAPE_DRAW_2D3D
+ 100
+ 0
+ BASED_ON_LENGTH
+ 10
+ METER
+ 10
+ true
+
+ 1658752695710
+ 1658752695706
+
+
+ 1703256699222
+ p_mainTenantID
+ 60
+ 170
+
+ false
+ true
+ true
+
+ String
+ NONE
+ false
+
+ 1703256699220
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1711030779035
+ p_connectedGridConnection
+ 60
+ 190
+
+ false
+ true
+ true
+
+ GridConnection
+ NONE
+ false
+
+ 1711030779033
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1727191476488
+ p_address
+ 60
+ 140
+
+ false
+ true
+ true
+
+ J_Address
+ NONE
+ false
+
+ 1727191476486
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1703256699219
+ c_GISBuildings
+ 60
+ 210
+
+ false
+ true
+ true
+
+ ArrayList
+ Object
+ String
+
+
+
+
+
+ 1658752695706
+ connections
+ 50
+ -50
+
+ false
+ true
+ true
+ false
+ COLLECTION_OF_LINKS
+ true
+ Object
+ SOLID
+ 1
+ -16777216
+ UNDER_AGENTS
+ NONE
+ END
+
+
+ 1703256686877
+ l_mainTenant
+ Link naar onderliggende actor of netConnection. Gebruikt om actoren te linken aan netConnection objecten, of actoren aan actoren te linken (bijv. leden van de Coop)
+
+@since: Sprint 6
+@author: Gillis
+ true
+ 220
+ -50
+
+ false
+ true
+ true
+ false
+ SINGLE_LINK
+ 1660224852394
+ false
+ Object
+ SOLID
+ 1
+ -16777216
+ UNDER_AGENTS
+ NONE
+ END
+
+
+
+
+ 1658752695710
+ level
+ 0
+ 0
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ 0
+ DIM_NON_CURRENT
+
+
+
+
+ 1660224852394
+ ConnectionOwner
+ 1752677829820
+ //import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+
+//@JsonIgnoreProperties({"va_ConnectionOwner","_origin_VA"})
+
+
+ zero_engine
+ Actor
+
+
+
+ p_actorID
+
+
+ p_actorType
+
+
+ p_actorSubgroup
+
+
+ p_actorGroup
+
+
+ energyModel.c_actors.add(this);
+energyModel.c_connectionOwners.add(this);
+ false
+
+ 1660224852392
+ 1660224852392
+
+ T extends Agent
+
+ Generic parameter:
+
+ ENTITY
+ 100
+ false
+ 100
+ true
+
+ -4144960
+ null
+
+ true
+ true
+ false
+
+ 10
+ MPS
+
+
+ 1
+ METER
+
+
+ 1
+ METER
+
+
+ 1
+ METER
+
+
+
+ false
+
+ 1.0
+ SECOND
+
+ CONTINUOUS
+ 500
+ 500
+ 0
+ 100
+ 100
+ MOORE
+ USER_DEF
+ USER_DEF
+ 2
+ 50
+ 0.95
+ 10
+
+
+ true
+ 1658477089994
+ true
+ 1660291200000
+
+ 0
+ HOUR
+
+
+ 1
+ HOUR
+
+
+
+ 1660224852390
+ scale
+ 0
+ -150
+ false
+ false
+ false
+ SHAPE_DRAW_2D3D
+ 100
+ 0
+ BASED_ON_LENGTH
+ 10
+ METER
+ 10
+ true
+
+ 1660224852393
+ 1660224852389
+
+
+ 1660744173993
+ v_electricityContractType
+ true
+ -240
+ 200
+
+ false
+ true
+ true
+
+ OL_DeliveryContractType
+
+ OL_DeliveryContractType.ELECTRICITY_VARIABLE
+
+
+
+
+ 1660744181560
+ v_heatContractType
+ true
+ -240
+ 120
+
+ false
+ true
+ true
+
+ OL_ContractType
+
+ HEAT_FIXED
+
+
+
+
+ 1660744190914
+ v_methaneContractType
+ true
+ -240
+ 140
+
+ false
+ true
+ true
+
+ OL_ContractType
+
+ METHANE_FIXED
+
+
+
+
+ 1660744732007
+ v_electricityVolume_kWh
+ true
+ 740
+ 690
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1660744756249
+ v_heatVolume_kWh
+ true
+ 740
+ 710
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1660744762793
+ v_methaneVolume_kWh
+ true
+ 740
+ 730
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1660745490749
+ v_balanceElectricity_eur
+ true
+ 970
+ 690
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1660745504140
+ v_balanceHeat_eur
+ true
+ -240
+ 690
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1660745513069
+ v_balanceMethane_eur
+ true
+ -240
+ 710
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1661174627092
+ v_hydrogenContractType
+ true
+ -240
+ 160
+
+ false
+ true
+ true
+
+ OL_ContractType
+
+ HYDROGEN_FIXED
+
+
+
+
+ 1661174643058
+ v_balanceHydrogen_eur
+ true
+ -240
+ 730
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1661175214034
+ v_hydrogenVolume_kWh
+ true
+ 740
+ 750
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1661177954454
+ v_energySupplierDistrictHeat
+ 61
+ 360
+
+ false
+ true
+ true
+
+ Agent
+
+
+
+ 1661267039916
+ j_ConnectionOwnerData
+ true
+ -240
+ 340
+
+ false
+ true
+ true
+
+ J_ActorData
+
+
+
+ 1661267039917
+ j_ActorData
+ 60
+ 300
+
+ false
+ true
+ true
+
+ J_ActorData
+
+
+
+ 1663237705961
+ v_electricityVariablePrice_eurpkWh
+ 720
+ 480
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1663237725571
+ v_electricitySurpluss_kW
+ true
+ -240
+ 370
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1666529984344
+ v_priceBandsDelivery
+ true
+ 1024
+ 478
+
+ false
+ true
+ true
+
+ TreeMap<Double, Double>
+
+
+
+ 1666531542032
+ v_currentNodalPrice_eurpkWh
+ 720
+ 500
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1666531573460
+ v_congestionTariffAllowance_kW
+ true
+ -240
+ 460
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1666531581003
+ v_updatePriceBands_b
+ Not visible as it is swtiched on and of in between timesteps ( for fixed tarifs at least)
+ true
+ -240
+ 490
+
+ false
+ false
+ true
+
+ boolean
+
+ true
+
+
+
+
+ 1667401120682
+ v_currentCongestionType
+ true
+ -240
+ 440
+
+ false
+ true
+ true
+
+ String
+
+ "No congestion atm"
+
+
+
+
+ 1669024165241
+ v_dieselVolume_kWh
+ true
+ 740
+ 770
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1669024172107
+ v_balanceDiesel_eur
+ true
+ -240
+ 750
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1669036835710
+ v_contractDelivery
+ 940
+ 150
+
+ false
+ true
+ true
+
+ J_DeliveryContract
+
+
+
+ 1669036845521
+ v_contractTransport
+ 940
+ 170
+
+ false
+ true
+ true
+
+ J_TransportContract
+
+
+
+ 1669036853577
+ v_contractTax
+ 940
+ 190
+
+ false
+ true
+ true
+
+ J_TaxContract
+
+
+
+ 1673455438812
+ v_enable_nfATO_b
+ true
+ -240
+ 660
+
+ false
+ true
+ true
+
+ boolean
+
+ false
+
+
+
+
+ 1675864492131
+ v_congestionTariff_b
+ true
+ -240
+ 530
+
+ false
+ true
+ true
+
+ boolean
+
+ false
+
+
+
+
+ 1676282750780
+ v_contractConnection
+ 940
+ 210
+
+ false
+ true
+ true
+
+ J_ConnectionContract
+
+
+
+ 1676459405457
+ v_balanceElectricityDelivery_eur
+ true
+ 970
+ 710
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1676459420019
+ v_balanceElectricityTransport_eur
+ true
+ 970
+ 730
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1676459433986
+ v_balanceElectricityTax_eur
+ true
+ 970
+ 750
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1676459631796
+ v_priceBandsTransport
+ true
+ 1024
+ 498
+
+ false
+ true
+ true
+
+ TreeMap<Double, Double>
+
+
+
+ 1676459645240
+ v_priceBandsTax
+ true
+ 1024
+ 518
+
+ false
+ true
+ true
+
+ TreeMap<Double, Double>
+
+
+
+ 1676540839762
+ v_capacityTariff_b
+ true
+ -240
+ 570
+
+ false
+ true
+ true
+
+ boolean
+
+ false
+
+
+
+
+ 1676900973462
+ v_totalElectricityUsed_kWh
+ true
+ 550
+ 690
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1676900973464
+ v_totalHeatUsed_kWh
+ true
+ 550
+ 710
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1676900973466
+ v_totalMethaneUsed_kWh
+ true
+ 550
+ 730
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1676900973468
+ v_totalHydrogenUsed_kWh
+ true
+ 550
+ 750
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1676900973470
+ v_totalDieselUsed_kWh
+ true
+ 550
+ 770
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1679478047052
+ v_methanePrice_eurpkWh
+ 470
+ 480
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1679478050320
+ v_hydrogenPrice_eurpkWh
+ 470
+ 500
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1679560933209
+ v_heatPrice_eurpkWh
+ 470
+ 520
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1666976143102
+ p_coopParent
+ This 'link' is used for battery management functions that use collective (Coop) load balancing!
+ 300
+ 270
+
+ false
+ true
+ true
+
+ EnergyCoop
+ NONE
+ false
+
+ 1666976143100
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1669036749740
+ p_actorContractList
+ true
+ 940
+ 80
+
+ false
+ true
+ true
+
+ com.fasterxml.jackson.databind.node.ArrayNode
+ NONE
+ false
+
+ 1669036749738
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1674905911483
+ p_capacityTariffApplicable
+ true
+ -240
+ 260
+
+ false
+ true
+ true
+
+ boolean
+ NONE
+ false
+
+ 1674905911481
+ CHECK_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1674906947038
+ p_capacityPrice_eur
+ true
+ -240
+ 280
+
+ false
+ true
+ true
+
+ double
+ NONE
+ false
+
+ 1674906947036
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1674906962435
+ p_capacityLevel_kW
+ true
+ -240
+ 300
+
+ false
+ true
+ true
+
+ double
+ NONE
+ false
+
+ 1674906962433
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1674920557400
+ p_congestionTariffApplicable
+ true
+ -240
+ 240
+
+ false
+ true
+ true
+
+ boolean
+ NONE
+ false
+
+ 1674920557398
+ CHECK_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1672145426525
+ p_connectionCapacity_kW
+ TODO: This is still hardcoded! How should Coop know where to 'gather' this data? (Capacity of shared connection)
+ true
+ -240
+ 410
+
+ false
+ true
+ true
+
+ double
+ NONE
+ false
+
+ 2000
+
+
+ 1672145426523
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1675870562128
+ p_actorID
+ Unique identifier of this actor in String format. Designated in Config-excel and used to link actors to netConnections.
+
+@since: Sprint 6
+@author: Gillis
+ true
+ -240
+ 50
+
+ false
+ true
+ true
+
+ String
+ NONE
+ false
+
+ 1675870562126
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1675870562132
+ p_actorType
+ Actor type in OL_ActorType format. Designated in Config-excel and used to determine actor-type specific functionalities later.
+
+@since: Sprint 6
+@author: Gillis
+ true
+ -240
+ 70
+
+ false
+ true
+ true
+
+ String
+ NONE
+ false
+
+ 1675870562130
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1675870562138
+ p_electricitySupplier
+ Pointer of the designated parent actor (e.g. a Coop or energy supplier)
+
+@since: Sprint 6
+@author: Gillis
+ 300
+ 160
+
+ false
+ true
+ true
+
+ Actor
+ NONE
+ false
+
+ 1675870562136
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1675870562141
+ p_nfatoStart_h
+ true
+ -240
+ 600
+
+ false
+ true
+ true
+
+ double
+ NONE
+ false
+
+ 0
+
+
+ 1675870562139
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1675870562144
+ p_nfatoEnd_h
+ true
+ -240
+ 620
+
+ false
+ true
+ true
+
+ double
+ NONE
+ false
+
+ 0
+
+
+
+ 1675870562142
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1675870562147
+ p_nfatoLvl_kW
+ true
+ -240
+ 640
+
+ false
+ true
+ true
+
+ double
+ NONE
+ false
+
+ 0
+
+
+ 1675870562145
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1676537396743
+ p_gridOperator
+ 300
+ 250
+
+ false
+ true
+ true
+
+ Actor
+ NONE
+ false
+
+ 1676537396741
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1679492829100
+ p_methaneSupplier
+ Pointer of the designated parent actor (e.g. a Coop or energy supplier)
+
+@since: Sprint 6
+@author: Gillis
+ 300
+ 180
+
+ false
+ true
+ true
+
+ Actor
+ NONE
+ false
+
+ 1679492829098
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1679492842259
+ p_hydrogenSupplier
+ Pointer of the designated parent actor (e.g. a Coop or energy supplier)
+
+@since: Sprint 6
+@author: Gillis
+ 300
+ 200
+
+ false
+ true
+ true
+
+ Actor
+ NONE
+ false
+
+ 1679492842257
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1679492857358
+ p_heatSupplier
+ Pointer of the designated parent actor (e.g. a Coop or energy supplier)
+
+@since: Sprint 6
+@author: Gillis
+ 300
+ 220
+
+ false
+ true
+ true
+
+ Actor
+ NONE
+ false
+
+ 1679492857356
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1702915036278
+ p_connectionOwnerType
+ 60
+ 140
+
+ false
+ true
+ true
+
+ OL_ConnectionOwnerType
+ NONE
+ METER
+ false
+
+ 1702915036276
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1708595094989
+ p_connectionOwnerIndexNr
+ Used to give every actor an index number, which can be used in buttons to go to the correct private company/connection UI.
+
+@author: Ate
+ true
+ 60
+ 490
+
+ false
+ true
+ true
+
+ int
+ NONE
+ false
+
+ 1708595094987
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1709048918242
+ p_detailedCompany
+ Is it a company that filled in the survey
+ 60
+ 470
+
+ false
+ true
+ true
+
+ boolean
+ NONE
+ false
+
+ 1709048918240
+
+ CHECK_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1715715075104
+ b_hasPrivateUI
+ true
+ 60
+ 510
+
+ false
+ true
+ true
+
+ boolean
+ NONE
+ false
+
+ false
+
+
+ 1715715075102
+ CHECK_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1716901949775
+ p_energySupplierID
+ This 'link' is used for battery management functions that use collective (Coop) load balancing!
+ 60
+ 160
+
+ false
+ true
+ true
+
+ String
+ NONE
+ false
+
+ 1716901949773
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1716901977342
+ p_energyCoopID
+ This 'link' is used for battery management functions that use collective (Coop) load balancing!
+ 60
+ 270
+
+ false
+ true
+ true
+
+ String
+ NONE
+ false
+
+ 1716901977340
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1745927932568
+ b_dataSharingAgreed
+ 60
+ 530
+
+ false
+ true
+ true
+
+ boolean
+ NONE
+ false
+
+ false
+
+
+ 1745927932566
+ CHECK_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1679502158516
+ c_actorContracts
+ 940
+ 120
+
+ false
+ true
+ true
+
+ ArrayList
+ J_Contract
+ String
+
+
+
+ 1703003561048
+ c_ownedGridConnections
+ 60
+ 420
+
+ false
+ true
+ true
+
+ ArrayList
+ GridConnection
+ String
+
+
+
+ 1704895140924
+ c_ownedBuildings
+ true
+ 60
+ 400
+
+ false
+ true
+ true
+
+ ArrayList
+ GIS_Building
+ String
+
+
+
+
+
+ VOID
+ double
+ 1660230297342
+ f_connectToChild
+ 660
+ 150
+
+ false
+ true
+ true
+
+ ConnectingChildNode
+ GridConnection
+
+ c_ownedGridConnections.add(ConnectingChildNode);
+//v_ownedGridConnection = ConnectingChildNode;
+//traceln("f_connectToChild in connectionOwner agent, connection contract type: " + v_contractConnection.connectionContractType);
+/*if (v_contractConnection.connectionContractType.equals(OL_ConnectionContractType.NFATO)) {
+ ConnectingChildNode.v_enable_nfATO_b = true;
+ ConnectingChildNode.p_nfatoStart_h = v_contractConnection.nfATOstart_h;
+ ConnectingChildNode.p_nfatoEnd_h = v_contractConnection.nfATOend_h;
+ ConnectingChildNode.p_nfatoLvl_kW = v_contractConnection.nfATOpower_kW;
+ traceln("Setting nfATO TRUE for gridConnection: " + ConnectingChildNode.p_gridNodeID);
+}*/
+
+
+
+ VOID
+ double
+ 1660230784171
+ f_connectToParentActor
+ Creates an agentLink in superConnection if a parentActorID is designated in the config-excel. Called from f_configureBackBone() in main for profiling reasons, so no parameters are given.
+
+@param: none
+@return: none
+@since: Sprint 6
+@author: HOUJ
+ 670
+ 100
+
+ false
+ true
+ true
+ //f_setContractValues();
+//f_setInitPriceBands();
+// Connect to energy supplier (can be a Coop!)
+//traceln(p_actorID + " is looking for its supplier");
+if (v_contractDelivery == null) {
+ throw new RuntimeException(
+ String.format(
+ "Actor %s has no delivery contract",
+ p_actorID
+ )
+ );
+}
+Actor mySupplier = findFirst(energyModel.pop_energySuppliers, p->p.p_actorID.equals(v_contractDelivery.contractScope)) ;
+if (mySupplier != null) {
+ ((EnergySupplier)mySupplier).f_connectToChild(this);
+} else {
+ mySupplier = findFirst(energyModel.pop_energyCoops, p->p.p_actorID.equals(v_contractDelivery.contractScope)) ;
+ if (mySupplier != null) {
+ ((EnergyCoop)mySupplier).f_connectToChild(this,OL_EnergyCarriers.ELECTRICITY);
+ p_coopParent = (EnergyCoop)mySupplier;
+ }
+}
+
+if (mySupplier != null) {
+ //energySupplier.connectTo(mySupplier);
+ p_electricitySupplier = mySupplier;
+ //energySupplier.f_connectToChild(this);
+} else {
+ /*traceln(
+ "Connection owner %s --> f_connectToParentActor --> no parent actor found, this should not be happening. contract holder: %s, parent: %s",
+ this,
+ v_contractDelivery.contractHolder,
+ v_contractDelivery.contractScope
+ );*/
+}
+
+// Connect to grid operator (can be a Coop!)
+if (v_contractTransport == null) {
+ throw new RuntimeException(
+ String.format(
+ "Actor %s has no transport contract",
+ p_actorID
+ )
+ );
+}
+Actor myGridoperator = findFirst(energyModel.pop_gridOperators, p->p.p_actorID.equals(v_contractTransport.contractScope)) ;
+if (myGridoperator == null) {
+ myGridoperator = findFirst(energyModel.pop_energyCoops, p->p.p_actorID.equals(v_contractTransport.contractScope)) ;
+}
+
+if (myGridoperator != null) {
+ p_gridOperator = myGridoperator;
+} else {
+ /*traceln(
+ "Connection owner --> f_connectToParentActor --> no grid operator found, this should not be happening. contract holder: %s, operator: %s",
+ v_contractTransport.contractHolder,
+ v_contractTransport.contractScope
+ );*/
+}
+
+//traceln(p_actorID + " finished looking for supplier");
+
+
+
+ VOID
+ double
+ 1660742520265
+ f_updateFinances
+ true
+ 660
+ 190
+
+ false
+ true
+ true
+ //TODO: Diesel costs still missing!! [GH 21/11/2022] -> Won't be in anylogic model, but in postprocessing.
+
+// get current energy flows
+f_gatherEnergyFlows();
+
+//double currentPowerDrawn_kW = v_electricityVolume_kWh / energyModel.p_timeStep_h;
+double transactionCostDelivery_eur = 0;
+double transactionCostTransport_eur = 0;
+double transactionCostTax_eur = 0;
+
+if (v_electricityVolume_kWh >= 0) {
+ //transactionCostDelivery_eur = v_priceBandsDelivery.ceilingEntry( currentPowerDrawn_kW ).getValue() * v_electricityVolume_kWh;
+ transactionCostDelivery_eur = (v_contractDelivery.deliveryPrice_eurpkWh + v_electricityVariablePrice_eurpkWh) * v_electricityVolume_kWh;
+ v_balanceElectricityDelivery_eur -= transactionCostDelivery_eur;
+ v_balanceElectricity_eur -= transactionCostDelivery_eur;
+
+ //transactionCostTransport_eur = v_priceBandsTransport.ceilingEntry( currentPowerDrawn_kW ).getValue() * v_electricityVolume_kWh;
+ transactionCostTransport_eur = v_currentNodalPrice_eurpkWh * v_electricityVolume_kWh;
+ v_balanceElectricityTransport_eur -= transactionCostTransport_eur;
+ v_balanceElectricity_eur -= transactionCostTransport_eur;
+
+ //transactionCostTax_eur = v_priceBandsTax.ceilingEntry( currentPowerDrawn_kW ).getValue() * v_electricityVolume_kWh;
+ transactionCostTax_eur = v_contractTax.deliveryTax_eurpkWh * v_electricityVolume_kWh;
+ //transactionCostTax_eur = v_electricityVolume_kWh * v_contractTax.deliveryTax_eurpkWh + v_contractTax.proportionalTax_pct*(v_electricityVolume_kWh * v_contractTax.deliveryTax_eurpkWh + transactionCostDelivery_eur + transactionCostTransport_eur);
+ v_balanceElectricityTax_eur -= transactionCostTax_eur;
+ v_balanceElectricity_eur -= transactionCostTax_eur;
+} else {
+ //transactionCostDelivery_eur = v_priceBandsDelivery.floorEntry( currentPowerDrawn_kW ).getValue() * v_electricityVolume_kWh;
+ transactionCostDelivery_eur = (v_contractDelivery.feedinPrice_eurpkWh + v_electricityVariablePrice_eurpkWh) * v_electricityVolume_kWh;
+ v_balanceElectricityDelivery_eur -= transactionCostDelivery_eur;
+ v_balanceElectricity_eur -= transactionCostDelivery_eur;
+
+ //transactionCostTransport_eur = v_priceBandsTransport.floorEntry( currentPowerDrawn_kW ).getValue() * v_electricityVolume_kWh;
+ transactionCostTransport_eur = v_currentNodalPrice_eurpkWh * v_electricityVolume_kWh;
+ v_balanceElectricityTransport_eur -= transactionCostTransport_eur;
+ v_balanceElectricity_eur -= transactionCostTransport_eur;
+
+ //transactionCostTax_eur = v_priceBandsTax.floorEntry( currentPowerDrawn_kW ).getValue() * v_electricityVolume_kWh;
+ transactionCostTax_eur = v_contractTax.feedinTax_eurpkWh * v_electricityVolume_kWh;
+ //transactionCostTax_eur = v_electricityVolume_kWh * v_contractTax.feedinTax_eurpkWh + v_contractTax.proportionalTax_pct*(v_electricityVolume_kWh * v_contractTax.feedinTax_eurpkWh + transactionCostDelivery_eur + transactionCostTransport_eur);
+ v_balanceElectricityTax_eur -= transactionCostTax_eur;
+ v_balanceElectricity_eur -= transactionCostTax_eur;
+}
+
+/*// trigger transaction with supplier/Coop
+if( p_energySupplier != null) {
+ //Agent energySupplier = p_energySupplier;
+ if( p_energySupplier instanceof EnergySupplier) {
+ EnergySupplier energySupplier = (EnergySupplier)p_energySupplier;
+ double transactionCost_eur = 0;//energySupplier.f_doEnergyTransaction(v_electricityVolume_kWh, v_electricityContractType);
+ v_balanceElectricity_eur -= transactionCost_eur;
+ transactionCost_eur = energySupplier.f_doEnergyTransaction(v_methaneVolume_kWh, v_methaneContractType);
+ v_balanceMethane_eur -= transactionCost_eur;
+ transactionCost_eur = energySupplier.f_doEnergyTransaction(v_hydrogenVolume_kWh, v_hydrogenContractType);
+ v_balanceHydrogen_eur -= transactionCost_eur;
+ } else if ( p_energySupplier instanceof EnergyCoop ) {
+ EnergyCoop energySupplier = (EnergyCoop)p_energySupplier;
+ double transactionCost_eur = 0;//energySupplier.f_doEnergyTransaction(v_electricityVolume_kWh, v_electricityContractType);
+ v_balanceElectricity_eur -= transactionCost_eur;
+ transactionCost_eur = energySupplier.f_doEnergyTransaction(v_methaneVolume_kWh, v_methaneContractType);
+ v_balanceMethane_eur -= transactionCost_eur;
+ transactionCost_eur = energySupplier.f_doEnergyTransaction(v_hydrogenVolume_kWh, v_hydrogenContractType);
+ v_balanceHydrogen_eur -= transactionCost_eur;
+ }
+} else {
+ traceln("Connection owner " + this + " has no energy supplier!");
+}*/
+
+// Also needs to include congestion tariffs!
+/*if ( p_congestionTariffApplicable ) {
+ double congestionCost_eur = v_electricityVolume_kWh * v_currentCongestionTariffWhenBuying_eurpkWh;
+ v_balanceElectricityTransport_eur -= congestionCost_eur; // TODO: This transaction is 'one-sided'; the gridOperator is not yet receiving/giving this money!!
+}*/
+
+// trigger district heat accounting with specified heat supplier agent
+/*
+if( v_energySupplierDistrictHeat instanceof EnergySupplier) {
+ EnergySupplier energySupplier = (EnergySupplier)v_energySupplierDistrictHeat;
+ double transactionCost_eur = 0;//energySupplier.f_doEnergyTransaction(v_heatVolume_kWh, v_heatContractType);
+ v_balanceHeat_eur -= transactionCost_eur;
+}
+else if( v_energySupplierDistrictHeat instanceof EnergyCoop ) {
+ EnergyCoop energySupplier = (EnergyCoop)v_energySupplierDistrictHeat;
+ double transactionCost_eur = 0;// energySupplier.f_doEnergyTransaction(v_heatVolume_kWh, v_heatContractType);
+ v_balanceHeat_eur -= transactionCost_eur;
+}
+
+v_balanceDiesel_eur += v_dieselVolume_kWh * .196; // TODO: UGLY HACK
+*/
+
+
+ VOID
+ double
+ 1660743030872
+ f_gatherEnergyFlows
+ true
+ 660
+ 210
+
+ false
+ true
+ true
+ // reset eenrgy flows
+v_electricityVolume_kWh = 0;
+v_heatVolume_kWh = 0;
+v_methaneVolume_kWh = 0;
+v_hydrogenVolume_kWh = 0;
+v_dieselVolume_kWh = 0;
+
+
+// gather electricity flows, convert to volume-per-timestep to facilitate financial transactions
+for(GridConnection n : gridConnections.getConnections() ) {
+ v_electricityVolume_kWh += (n.v_currentConsumptionFlows_kW.get(OL_EnergyCarriers.ELECTRICITY) - n.v_currentProductionFlows_kW.get(OL_EnergyCarriers.ELECTRICITY)) * energyModel.p_timeStep_h;
+ v_heatVolume_kWh += (n.v_currentConsumptionFlows_kW.get(OL_EnergyCarriers.HEAT) - n.v_currentProductionFlows_kW.get(OL_EnergyCarriers.HEAT)) * energyModel.p_timeStep_h;
+ v_methaneVolume_kWh += (n.v_currentConsumptionFlows_kW.get(OL_EnergyCarriers.METHANE) - n.v_currentProductionFlows_kW.get(OL_EnergyCarriers.METHANE)) * energyModel.p_timeStep_h;
+ v_hydrogenVolume_kWh += (n.v_currentConsumptionFlows_kW.get(OL_EnergyCarriers.HYDROGEN) - n.v_currentProductionFlows_kW.get(OL_EnergyCarriers.HYDROGEN)) * energyModel.p_timeStep_h;
+ v_dieselVolume_kWh += (n.v_currentConsumptionFlows_kW.get(OL_EnergyCarriers.DIESEL) - n.v_currentProductionFlows_kW.get(OL_EnergyCarriers.DIESEL)) * energyModel.p_timeStep_h;
+}
+
+v_totalElectricityUsed_kWh += v_electricityVolume_kWh;
+v_totalHeatUsed_kWh += v_heatVolume_kWh;
+v_totalMethaneUsed_kWh += v_methaneVolume_kWh;
+v_totalHydrogenUsed_kWh += v_hydrogenVolume_kWh;
+v_totalDieselUsed_kWh += v_dieselVolume_kWh;
+
+
+ VOID
+ double
+ 1663237679579
+ f_updateIncentives
+ 660
+ 230
+
+ false
+ true
+ true
+ if (v_contractDelivery.deliveryContractType==OL_DeliveryContractType.ELECTRICITY_VARIABLE) {
+ if (p_electricitySupplier instanceof EnergySupplier) {
+ v_electricityVariablePrice_eurpkWh = ((EnergySupplier)p_electricitySupplier).f_getVariableEnergyPrice();
+ } else if (p_electricitySupplier instanceof EnergyCoop) {
+ v_electricityVariablePrice_eurpkWh = ((EnergyCoop)p_electricitySupplier).f_getVariableEnergyPrice();
+ }
+}
+
+// Transport pricing (nodal pricing) is 'pushed' to the connectionOwner from the GridNode, so don't have to ask for the price here.
+/*if (v_contractTransport.transportContractType.equals(OL_TransportContractType.NODALPRICING)) {
+ if (p_gridOperator instanceof GridOperator) {
+ v_electricityVariablePrice_eurpkWh = ((GridOperator)p_gridOperator).f_getVariableEnergyPrice(v_electricityContractType, false);
+ } else if (p_gridOperator instanceof EnergyCoop) {
+ v_electricityVariablePrice_eurpkWh = ((EnergyCoop)p_gridOperator).f_getEnergyPrice(v_electricityContractType, false);
+ }
+}*/
+
+//f_setElectricityPriceBands();
+
+
+
+ VOID
+ double
+ 1666529572357
+ f_setElectricityPriceBands
+ true
+ 680
+ 250
+
+ false
+ true
+ true
+ if (v_contractDelivery.deliveryContractType.equals(OL_DeliveryContractType.ELECTRICITY_VARIABLE)) {
+ v_priceBandsDelivery.replace(-9999999.0, v_contractDelivery.feedinPrice_eurpkWh + v_electricityVariablePrice_eurpkWh );
+ v_priceBandsDelivery.replace(9999999.0, v_contractDelivery.deliveryPrice_eurpkWh + v_electricityVariablePrice_eurpkWh );
+}
+if (v_contractTransport.transportContractType.equals(OL_TransportContractType.NODALPRICING)) {
+ v_priceBandsTransport.replace(-9999999.0, v_currentNodalPrice_eurpkWh);
+ v_priceBandsTransport.replace(9999999.0, v_currentNodalPrice_eurpkWh);
+}
+
+if (v_contractTax.proportionalTax_pct != 0.0 && (v_contractDelivery.deliveryContractType.equals(OL_DeliveryContractType.ELECTRICITY_VARIABLE) || v_contractTransport.transportContractType.equals(OL_TransportContractType.NODALPRICING))) { // Add VAT (BTW), over all other cost components. At this point assumes there are only 2 price-bands, for delivery and feedin! No other 'steps'! Not true for capacity-tariff (bandbreedtemodel)!
+ v_priceBandsTax.replace(-9999999.0, v_contractTax.feedinTax_eurpkWh + v_contractTax.proportionalTax_pct*(v_contractDelivery.feedinPrice_eurpkWh + v_electricityVariablePrice_eurpkWh + v_currentNodalPrice_eurpkWh + v_contractTax.feedinTax_eurpkWh));
+ v_priceBandsTax.replace(9999999.0, v_contractTax.deliveryTax_eurpkWh + v_contractTax.proportionalTax_pct*(v_contractDelivery.deliveryPrice_eurpkWh + v_electricityVariablePrice_eurpkWh + v_currentNodalPrice_eurpkWh + v_contractTax.deliveryTax_eurpkWh));
+}
+
+
+
+ VOID
+ double
+ 1669036739539
+ f_setContractValues
+ 670
+ 80
+
+ false
+ true
+ true
+ double methaneDeliveryPrice_eurpkWh = 0.0;
+double methaneDeliveryTax_eurpkWh = 0.0;
+double methaneVAT_pct = 0.0;
+double hydrogenDeliveryPrice_eurpkWh = 0.0;
+double hydrogenDeliveryTax_eurpkWh = 0.0;
+double hydrogenVAT_pct = 0.0;
+double heatDeliveryPrice_eurpkWh = 0.0;
+double heatDeliveryTax_eurpkWh = 0.0;
+double heatVAT_pct = 0.0;
+
+//if( p_actorContractList == null) {
+ //traceln( "No contract data for connectionOwner " + p_actorID );
+ //traceln( "Creating default contracts!");
+
+ String defaultSupplier = "defaultSupplier";
+ if (p_energyCoopID != null){
+ defaultSupplier = p_energyCoopID;
+ }
+ String defaultGridOperator = "defaultGridOperator";
+ String defaultGovernmentLayer = "defaultGovernmentLayer";
+ double annualFee_eur = 0;
+ double deliveryPrice_eurpkWh = 0.2;
+ double feedinPrice_eurpkWh = 0.2;
+ double bandwidthTreshold_kW = 0.0;
+ double bandwidthTariff_eurpkWh = 0.0;
+ double nfATOstart_h = 0.0;
+ double nfATOend_h = 0.0;
+ double nfATOcapacity_kW = 0.0;
+ double taxDelivery_eurpkWh = 0.13;
+ double taxFeedin_eurpkWh = 0.0;
+ double proportionalTax_pct = 21;
+
+ /*if (p_actorID.equals("logistics0owner")){
+ v_contractDelivery = new J_DeliveryContract("coop1", OL_DeliveryContractType.ELECTRICITY_FIXED, OL_EnergyCarriers.ELECTRICITY, deliveryPrice_eurpkWh, feedinPrice_eurpkWh, annualFee_eur);
+ } else {
+ v_contractDelivery = new J_DeliveryContract(defaultSupplier, OL_DeliveryContractType.ELECTRICITY_FIXED, OL_EnergyCarriers.ELECTRICITY, deliveryPrice_eurpkWh, feedinPrice_eurpkWh, annualFee_eur);
+ }*/
+ v_contractDelivery = new J_DeliveryContract(defaultSupplier, OL_DeliveryContractType.ELECTRICITY_FIXED, OL_EnergyCarriers.ELECTRICITY, deliveryPrice_eurpkWh, feedinPrice_eurpkWh, annualFee_eur);
+
+ v_contractTransport = new J_TransportContract(defaultGridOperator, OL_TransportContractType.DEFAULT , OL_EnergyCarriers.ELECTRICITY, bandwidthTreshold_kW, bandwidthTariff_eurpkWh, annualFee_eur);
+
+ v_contractConnection = new J_ConnectionContract(defaultGridOperator, OL_ConnectionContractType.DEFAULT, OL_EnergyCarriers.ELECTRICITY, nfATOstart_h, nfATOend_h, nfATOcapacity_kW, annualFee_eur);
+
+ v_contractTax = new J_TaxContract(defaultGovernmentLayer, OL_EnergyCarriers.ELECTRICITY, taxDelivery_eurpkWh, taxFeedin_eurpkWh, proportionalTax_pct, annualFee_eur);
+
+ c_actorContracts.add(v_contractDelivery);
+ c_actorContracts.add(v_contractTransport);
+ c_actorContracts.add(v_contractConnection);
+ c_actorContracts.add(v_contractTax);
+/*
+} else {
+ for( JsonNode contractJson : p_actorContractList) {
+ //traceln("Contract hashmap l: " + l);
+ OL_ContractType contractService = OL_ContractType.valueOf(contractJson.required("contractType").textValue());
+ String contractScope = contractJson.required( "contractScope" ).textValue();
+ OL_EnergyCarriers energyCarrier = OL_EnergyCarriers.valueOf(contractJson.required("energyCarrier").textValue());
+ double annualFee_eur = contractJson.required("annualFee_eur").doubleValue();
+ Actor mySupplier = null;
+ if (energyCarrier.equals(OL_EnergyCarriers.ELECTRICITY)){
+ switch( contractService ) {
+ case DELIVERY:
+ //String contractScope = (String)l.get( "contract_scope" );
+ OL_DeliveryContractType deliveryContractType = OL_DeliveryContractType.valueOf(contractJson.get("deliveryContractType").textValue());
+ double deliveryPrice_eurpkWh = contractJson.required("deliveryPrice_eurpkWh").doubleValue();
+ double feedinPrice_eurpkWh = contractJson.required("feedinPrice_eurpkWh").doubleValue();
+ v_contractDelivery = new J_DeliveryContract(contractScope, deliveryContractType, OL_EnergyCarriers.ELECTRICITY, deliveryPrice_eurpkWh, feedinPrice_eurpkWh, annualFee_eur);
+ //traceln("Delivery contract: " + v_contractDelivery);
+ c_actorContracts.add(v_contractDelivery);
+ break;
+ case TRANSPORT:
+ OL_TransportContractType transportContractType = OL_TransportContractType.valueOf(contractJson.get("transportContractType").textValue());
+ double bandwidthTreshold_kW = contractJson.path("bandwidthTreshold_kW").doubleValue();
+ double bandwidthTariff_eurpkWh = contractJson.path("bandwidthTariff_eurpkWh").doubleValue();
+ v_contractTransport = new J_TransportContract(contractScope, transportContractType, energyCarrier, bandwidthTreshold_kW, bandwidthTariff_eurpkWh, annualFee_eur);
+ c_actorContracts.add(v_contractTransport);
+ break;
+ case CONNECTION:
+ OL_ConnectionContractType connectionContractType = OL_ConnectionContractType.valueOf(contractJson.required("connectionContractType").textValue());
+ //traceln("Initializing connection contract with ConnectionContractType: " + connectionContractType);
+ double nfATOstart_h = contractJson.path("nfATO_starttime_h").doubleValue();
+ double nfATOend_h = contractJson.path("nfATO_endtime_h").doubleValue();
+ double nfATOcapacity_kW = contractJson.path("nfATO_capacity_kW").doubleValue();
+ v_contractConnection = new J_ConnectionContract(contractScope, connectionContractType, energyCarrier, nfATOstart_h, nfATOend_h, nfATOcapacity_kW, annualFee_eur);
+ c_actorContracts.add(v_contractConnection);
+ break;
+ case TAX:
+ double taxDelivery_eurpkWh = contractJson.required("taxDelivery_eurpkWh").doubleValue();
+ double taxFeedin_eurpkWh = contractJson.required("taxFeedin_eurpkWh").doubleValue();
+ double proportionalTax_pct = contractJson.required("proportionalTax_pct").doubleValue();
+ v_contractTax = new J_TaxContract(contractScope, OL_EnergyCarriers.ELECTRICITY, taxDelivery_eurpkWh, taxFeedin_eurpkWh, proportionalTax_pct, annualFee_eur);
+ c_actorContracts.add(v_contractTax);
+ break;
+ default:
+
+ break;
+ }
+ //} else if (energyCarrier.equals(OL_EnergyCarriers.METHANE)){
+ } else {
+ switch( contractService ) {
+ case DELIVERY:
+ OL_DeliveryContractType deliveryContractType = OL_DeliveryContractType.valueOf(contractJson.required("deliveryContractType").textValue());
+ double deliveryPrice_eurpkWh = contractJson.required("deliveryPrice_eurpkWh").doubleValue();
+ double feedinPrice_eurpkWh = contractJson.required("feedinPrice_eurpkWh").doubleValue();
+ J_DeliveryContract contractDelivery = new J_DeliveryContract(contractScope, deliveryContractType, energyCarrier, deliveryPrice_eurpkWh, feedinPrice_eurpkWh, annualFee_eur);
+ //traceln("Delivery contract: " + v_contractDelivery);
+ c_actorContracts.add(contractDelivery);
+ //String contractScope = (String)l.get( "contractScope" );
+ mySupplier = findFirst(energyModel.pop_energySuppliers, p->p.p_actorID.equals(contractScope)) ;
+ if (mySupplier != null) {
+ ((EnergySupplier)mySupplier).f_connectToChild(this);
+ } else {
+ mySupplier = findFirst(energyModel.pop_energyCoops, p->p.p_actorID.equals(contractScope)) ;
+ if (mySupplier != null) {
+ ((EnergyCoop)mySupplier).f_connectToChild(this,energyCarrier);
+ //p_CoopParent = (EnergyCoop)mySupplier;
+ }
+ }
+ //traceln("Methane supplier: " + contractScope + " for actor " + p_actorID );
+ if (mySupplier != null) {
+ //energySupplier.connectTo(mySupplier);
+ if (energyCarrier==OL_EnergyCarriers.METHANE) {
+ p_methaneSupplier = mySupplier;
+ methaneDeliveryPrice_eurpkWh=deliveryPrice_eurpkWh;
+ } else if(energyCarrier==OL_EnergyCarriers.HYDROGEN) {
+ p_hydrogenSupplier = mySupplier;
+ hydrogenDeliveryPrice_eurpkWh=deliveryPrice_eurpkWh;
+ } else if(energyCarrier==OL_EnergyCarriers.HEAT) {
+ p_heatSupplier = mySupplier;
+ heatDeliveryPrice_eurpkWh=deliveryPrice_eurpkWh;
+ }
+ //traceln("MethaneSupplier " + mySupplier);
+ //energySupplier.f_connectToChild(this);
+ } else {
+ traceln("Connection owner --> f_connectToParentActor --> " + energyCarrier + " supplier not found, this should not be happening");
+ }
+ break;
+ case TAX:
+ double DeliveryTax_eurpkWh = contractJson.required("taxDelivery_eurpkWh").doubleValue();
+ double taxFeedin_eurpkWh = contractJson.required("taxFeedin_eurpkWh").doubleValue();
+ double VAT_pct = contractJson.required("proportionalTax_pct").doubleValue();
+ J_TaxContract contractTax = new J_TaxContract(contractScope, energyCarrier, DeliveryTax_eurpkWh, taxFeedin_eurpkWh, VAT_pct, annualFee_eur);
+ c_actorContracts.add(contractTax);
+ if (energyCarrier==OL_EnergyCarriers.METHANE) {
+ methaneDeliveryTax_eurpkWh=DeliveryTax_eurpkWh;
+ methaneVAT_pct=VAT_pct;
+ } else if(energyCarrier==OL_EnergyCarriers.HYDROGEN) {
+ hydrogenDeliveryTax_eurpkWh=DeliveryTax_eurpkWh;
+ hydrogenVAT_pct=VAT_pct;
+ } else if(energyCarrier==OL_EnergyCarriers.HEAT) {
+ heatVAT_pct=VAT_pct;
+ }
+ break;
+ case CONNECTION:
+ OL_ConnectionContractType connectionContractType = OL_ConnectionContractType.valueOf(contractJson.required("connectionContractType").textValue());
+ J_ConnectionContract contractConnection = new J_ConnectionContract(contractScope, connectionContractType, energyCarrier, 0.0, 0.0, 0.0, annualFee_eur);
+ c_actorContracts.add(contractConnection);
+
+
+
+ break;
+ case TRANSPORT:
+ OL_TransportContractType transportContractType = OL_TransportContractType.valueOf(contractJson.required("transportContractType").textValue());
+ double bandwidthTreshold_kW = contractJson.path("bandwidthTreshold_kW").doubleValue();
+ double bandwidthTariff_eurpkWh = contractJson.path("bandwidthTariff_eurpkWh").doubleValue();
+ J_TransportContract contractTransport = new J_TransportContract(contractScope, transportContractType, energyCarrier, bandwidthTreshold_kW, bandwidthTariff_eurpkWh, annualFee_eur);
+ c_actorContracts.add(contractTransport);
+ break;
+ default:
+ traceln("Unrecognized contract type!");
+ break;
+ }
+ }
+ }
+}
+*/
+// Calculate nett gas and hydrogen price
+v_methanePrice_eurpkWh = (methaneDeliveryPrice_eurpkWh + methaneDeliveryTax_eurpkWh) * (1 + methaneVAT_pct);
+v_hydrogenPrice_eurpkWh = (hydrogenDeliveryPrice_eurpkWh + hydrogenDeliveryTax_eurpkWh) * (1 + hydrogenVAT_pct);
+v_heatPrice_eurpkWh = (heatDeliveryPrice_eurpkWh + heatDeliveryTax_eurpkWh) * (1 + heatVAT_pct);
+ /*} else if (energyCarrier.equals(OL_EnergyCarriers.HYDROGEN)){
+ switch( contractService ) {
+ case DELIVERY:
+ OL_DeliveryContractType deliveryContractType = OL_DeliveryContractType.valueOf((String)l.get("deliveryContractType"));
+ double deliveryPrice_eurpkWh = (double)l.get("deliveryPrice_eurpkWh");
+ double feedinPrice_eurpkWh = (double)l.get("feedinPrice_eurpkWh");
+ v_contractDelivery = new J_DeliveryContract(contractScope, deliveryContractType, OL_EnergyCarriers.HYDROGEN, deliveryPrice_eurpkWh, feedinPrice_eurpkWh);
+ //traceln("Delivery contract: " + v_contractDelivery);
+ c_actorContracts.add(v_contractDelivery);
+ mySupplier = findFirst(main.pop_energySuppliers, p->p.p_actorID.equals(contractScope)) ;
+ if (mySupplier != null) {
+ ((EnergySupplier)mySupplier).f_connectToChild(this);
+ } else {
+ mySupplier = findFirst(main.pop_energyCoops, p->p.p_actorID.equals(contractScope)) ;
+ if (mySupplier != null) {
+ ((EnergyCoop)mySupplier).f_connectToChild(this,OL_EnergyCarriers.HYDROGEN);
+ //p_CoopParent = (EnergyCoop)mySupplier;
+ }
+ }
+ if (mySupplier != null) {
+ //energySupplier.connectTo(mySupplier);
+ p_hydrogenSupplier = mySupplier;
+ //energySupplier.f_connectToChild(this);
+ } else {
+ traceln("Connection owner --> f_connectToParentActor --> hydrogen supplier not found, this should not be happening");
+ }
+ break;
+ case TAX:
+ hydrogenDeliveryTax_eurpkWh = (double)l.get("taxDelivery_eurpkWh");
+ //double taxFeedin_eurpkWh = (double)l.get("taxFeedin_eurpkWh");
+ hydrogenVAT_pct = (double)l.get("proportionalTax_pct");
+ v_contractTax = new J_TaxContract(contractScope, OL_EnergyCarriers.HYDROGEN, hydrogenDeliveryTax_eurpkWh, 0, hydrogenVAT_pct);
+ c_actorContracts.add(v_contractTax);
+ break;
+ default:
+
+ break;
+ }
+ } else if (energyCarrier.equals(OL_EnergyCarriers.HEAT)){
+ switch( contractService ) {
+ case DELIVERY:
+ heatDeliveryPrice_eurpkWh = (double)l.get("deliveryPrice_eurpkWh");
+ mySupplier = findFirst(main.pop_energySuppliers, p->p.p_actorID.equals(contractScope)) ;
+ if (mySupplier != null) {
+ ((EnergySupplier)mySupplier).f_connectToChild(this);
+ } else {
+ mySupplier = findFirst(main.pop_energyCoops, p->p.p_actorID.equals(contractScope)) ;
+ if (mySupplier != null) {
+ ((EnergyCoop)mySupplier).f_connectToChild(this,OL_EnergyCarriers.HYDROGEN);
+ //p_CoopParent = (EnergyCoop)mySupplier;
+ }
+ }
+ if (mySupplier != null) {
+ //energySupplier.connectTo(mySupplier);
+ p_hydrogenSupplier = mySupplier;
+ //energySupplier.f_connectToChild(this);
+ } else {
+ traceln("Connection owner --> f_connectToParentActor --> heat supplier not found, this should not be happening");
+ }
+ break;
+ case TAX:
+ hydrogenDeliveryTax_eurpkWh = (double)l.get("taxDelivery_eurpkWh");
+ //double taxFeedin_eurpkWh = (double)l.get("taxFeedin_eurpkWh");
+ hydrogenVAT_pct = (double)l.get("proportionalTax_pct");
+ break;
+ default:
+
+ break;
+ }
+ }*/
+
+
+
+
+ VOID
+ double
+ 1674919795415
+ f_setInitPriceBands
+ true
+ 670
+ 130
+
+ false
+ true
+ true
+ v_priceBandsDelivery = new TreeMap<Double, Double>();
+v_priceBandsDelivery.put(-9999999.0, v_contractDelivery.feedinPrice_eurpkWh);
+v_priceBandsDelivery.put(0.0, 0.0);
+v_priceBandsDelivery.put(9999999.0, v_contractDelivery.deliveryPrice_eurpkWh);
+
+v_priceBandsTransport = new TreeMap<Double, Double>();
+v_priceBandsTransport.put(-9999999.0, 0.0);
+v_priceBandsTransport.put(0.0, 0.0);
+v_priceBandsTransport.put(9999999.0, 0.0);
+if (v_contractTransport.transportContractType.equals(OL_TransportContractType.BANDWIDTH)) {
+ //traceln("Setting capacity tariff for " + p_actorID);
+ v_priceBandsTransport.put(-9999999.0, v_contractTransport.bandwidthTariff_eurpkWh);
+ v_priceBandsTransport.put(-v_contractTransport.bandwidthTreshold_kW, 0.0);
+ v_priceBandsTransport.put(0.0, 0.0);
+ v_priceBandsTransport.put(v_contractTransport.bandwidthTreshold_kW, 0.0);
+ v_priceBandsTransport.put(9999999.0, v_contractTransport.bandwidthTariff_eurpkWh);
+ //traceln(v_priceBandsTransport.toString());
+} else {
+ v_priceBandsTransport.put(-9999999.0, 0.0);
+ v_priceBandsTransport.put(0.0, 0.0);
+ v_priceBandsTransport.put(9999999.0, 0.0);
+}
+
+v_priceBandsTax = new TreeMap<Double, Double>();
+v_priceBandsTax.put(-9999999.0, v_contractTax.feedinTax_eurpkWh);
+v_priceBandsTax.put(0.0, 0.0);
+v_priceBandsTax.put(9999999.0, v_contractTax.deliveryTax_eurpkWh);
+
+/*
+if( p_congestionTariffApplicable ){
+ v_priceBandsDelivery.put(- p_capacityLevel_kW, 0.0);
+ v_priceBandsDelivery.put(p_capacityLevel_kW, 0.0);
+}
+*/
+
+
+ RETURNS_VALUE
+ double
+ 1675011274392
+ f_getElectricityPrice
+ 660
+ 290
+
+ false
+ true
+ true
+
+ currentPowerDrawn_kW
+ double
+
+ double price_eurpkWh = 0;
+if( currentPowerDrawn_kW >= 0 ){
+ //Delivery
+ /*if( v_priceBandsDelivery.ceilingKey(currentPowerDrawn_kW) == currentPowerDrawn_kW ){
+ price += v_priceBandsDelivery.higherEntry( currentPowerDrawn_kW ).getValue();
+ }
+ else{
+ price += v_priceBandsDelivery.ceilingEntry( currentPowerDrawn_kW ).getValue();
+ }*/
+ price_eurpkWh += v_contractDelivery.deliveryPrice_eurpkWh + v_electricityVariablePrice_eurpkWh;
+
+ //Transport
+ /*if( v_priceBandsTransport.ceilingKey(currentPowerDrawn_kW) == currentPowerDrawn_kW ){
+ price += v_priceBandsTransport.higherEntry( currentPowerDrawn_kW ).getValue();
+ }
+ else{
+ price += v_priceBandsTransport.ceilingEntry( currentPowerDrawn_kW ).getValue();
+ }*/
+
+ price_eurpkWh += v_currentNodalPrice_eurpkWh;
+ //Tax
+ /*if( v_priceBandsTax.ceilingKey(currentPowerDrawn_kW) == currentPowerDrawn_kW ){
+ price += v_priceBandsTax.higherEntry( currentPowerDrawn_kW ).getValue();
+ }
+ else{
+ price += v_priceBandsTax.ceilingEntry( currentPowerDrawn_kW ).getValue();
+ }*/
+
+ price_eurpkWh += v_contractTax.deliveryTax_eurpkWh + v_contractTax.proportionalTax_pct;// * (v_contractTax.deliveryTax_eurpkWh + v_currentNodalPrice_eurpkWh + v_contractDelivery.deliveryPrice_eurpkWh + v_electricityVariablePrice_eurpkWh)
+ price_eurpkWh = price_eurpkWh * (1+0.01*v_contractTax.proportionalTax_pct);
+}
+else {
+ //Delivery
+ /*if( v_priceBandsDelivery.ceilingKey(currentPowerDrawn_kW) == currentPowerDrawn_kW ){
+ price += v_priceBandsDelivery.higherEntry( currentPowerDrawn_kW ).getValue();
+ }
+ else{
+ price += v_priceBandsDelivery.floorEntry( currentPowerDrawn_kW ).getValue();
+ }*/
+
+ price_eurpkWh += v_contractDelivery.feedinPrice_eurpkWh + v_electricityVariablePrice_eurpkWh;
+ //Transport
+ /*if( v_priceBandsTransport.ceilingKey(currentPowerDrawn_kW) == currentPowerDrawn_kW ){
+ price += v_priceBandsTransport.higherEntry( currentPowerDrawn_kW ).getValue();
+ }
+ else{
+ price += v_priceBandsTransport.floorEntry( currentPowerDrawn_kW ).getValue();
+ }*/
+ price_eurpkWh += v_contractDelivery.deliveryPrice_eurpkWh + v_electricityVariablePrice_eurpkWh;
+ //Tax
+ /*if( v_priceBandsTax.ceilingKey(currentPowerDrawn_kW) == currentPowerDrawn_kW ){
+ price += v_priceBandsTax.higherEntry( currentPowerDrawn_kW ).getValue();
+ }
+ else{
+ price += v_priceBandsTax.floorEntry( currentPowerDrawn_kW ).getValue();
+ }*/
+ price_eurpkWh += v_contractTax.feedinTax_eurpkWh + v_contractTax.proportionalTax_pct;// * (v_contractTax.deliveryTax_eurpkWh + v_currentNodalPrice_eurpkWh + v_contractDelivery.deliveryPrice_eurpkWh + v_electricityVariablePrice_eurpkWh)
+ price_eurpkWh = price_eurpkWh * (1+0.01*v_contractTax.proportionalTax_pct);
+}
+//traceln(price_eurpkWh);
+return price_eurpkWh;
+
+
+ RETURNS_VALUE
+ double
+ 1675012472432
+ f_getAvailablePowerAtPrice
+ 660
+ 310
+
+ false
+ true
+ true
+
+ currentPowerDrawn_kW
+ double
+
+ double availablePower_kW;//, availablePowerDelivery, availablePowerTransport, availablePowerTax = 0;
+
+/*if( currentPowerDrawn_kW >= 0 ){
+ // Check if one of the pricebands is at a 'breakpoint'
+ if( currentPowerDrawn_kW == v_priceBandsDelivery.ceilingKey( currentPowerDrawn_kW )){
+ availablePowerDelivery = v_priceBandsDelivery.higherKey( currentPowerDrawn_kW ) - currentPowerDrawn_kW;
+ } else {
+ availablePowerDelivery = v_priceBandsDelivery.ceilingKey( currentPowerDrawn_kW ) - currentPowerDrawn_kW;
+ }
+ if( currentPowerDrawn_kW == v_priceBandsTransport.ceilingKey( currentPowerDrawn_kW )){
+ availablePowerTransport = v_priceBandsTransport.higherKey( currentPowerDrawn_kW ) - currentPowerDrawn_kW;
+ } else {
+ availablePowerTransport = v_priceBandsTransport.ceilingKey( currentPowerDrawn_kW ) - currentPowerDrawn_kW;
+ }
+ if( currentPowerDrawn_kW == v_priceBandsTax.ceilingKey( currentPowerDrawn_kW )){
+ availablePowerTax = v_priceBandsTax.higherKey( currentPowerDrawn_kW ) - currentPowerDrawn_kW;
+ } else {
+ availablePowerTax = v_priceBandsTax.ceilingKey( currentPowerDrawn_kW ) - currentPowerDrawn_kW;
+ }
+}
+else {
+ if( currentPowerDrawn_kW == v_priceBandsDelivery.floorKey( currentPowerDrawn_kW )){
+ availablePowerDelivery = v_priceBandsDelivery.higherKey( currentPowerDrawn_kW ) - currentPowerDrawn_kW;
+ }
+ else {
+ availablePowerDelivery = v_priceBandsDelivery.ceilingKey( currentPowerDrawn_kW ) - currentPowerDrawn_kW;
+ }
+
+ if( currentPowerDrawn_kW == v_priceBandsTransport.floorKey( currentPowerDrawn_kW )){
+ availablePowerTransport = v_priceBandsTransport.higherKey( currentPowerDrawn_kW ) - currentPowerDrawn_kW;
+ }
+ else {
+ availablePowerTransport = v_priceBandsTransport.ceilingKey( currentPowerDrawn_kW ) - currentPowerDrawn_kW;
+ }
+
+ if( currentPowerDrawn_kW == v_priceBandsTax.floorKey( currentPowerDrawn_kW )){
+ availablePowerTax = v_priceBandsTax.higherKey( currentPowerDrawn_kW ) - currentPowerDrawn_kW;
+ }
+ else {
+ availablePowerTax = v_priceBandsTax.ceilingKey( currentPowerDrawn_kW ) - currentPowerDrawn_kW;
+ }
+
+}*/
+
+//availablePower = min(min(availablePowerDelivery, availablePowerTransport), availablePowerTax);
+if( currentPowerDrawn_kW >= 0 ){ // Only check if current power is positive or negative
+ availablePower_kW = 1e10; // 'Infinite', in this case 10 TW. Something else should be the limiting factor on power.
+} else {
+ availablePower_kW = -currentPowerDrawn_kW;
+}
+
+//traceln("Still using treemaps in f_getAvailablePowerAtPrice!");
+return availablePower_kW;
+
+
+ RETURNS_VALUE
+ double
+ 1675068408612
+ f_getAveragedElectricityPrice
+ Returns the average electricity price of a given additional power demand above a current demand, taking all tariff structures into accounts. Mainly used for heatpumps that only operate at full
+ 660
+ 330
+
+ false
+ true
+ true
+
+ baseDemand_kW
+ double
+
+
+ requestedPower_kW
+ double
+
+ double price_eurph = 0;
+double availablePower_kW = 0;
+double addedPrice_eurpkWh;
+double addedPower_kW;
+double currentPowerRequestLevel_kW;
+
+boolean isDemandMet = false;
+double loopcount = 1;
+
+//traceln( " ");
+//traceln( "starting demand: " + baseDemand_kW);
+//traceln("Power request: " + requestedPower_kW);
+
+while (! isDemandMet ) { // Loop door de treemap tot je requestedPower_kW bereikt
+ //traceln( " ");
+ //traceln( "loop " + loopcount + ", available Power: " + availablePower_kW);
+ currentPowerRequestLevel_kW = roundToDecimal( availablePower_kW + baseDemand_kW, 5);
+ //traceln("Current power request level = " + currentPowerRequestLevel_kW) ;
+
+ addedPrice_eurpkWh = f_getElectricityPrice(currentPowerRequestLevel_kW);
+ addedPower_kW = f_getAvailablePowerAtPrice(currentPowerRequestLevel_kW);
+ //traceln("Added power " + addedPower_kW);
+
+ if(addedPower_kW + availablePower_kW >= requestedPower_kW) {
+ addedPower_kW = requestedPower_kW - availablePower_kW;
+ price_eurph += addedPrice_eurpkWh * addedPower_kW;
+ isDemandMet = true;
+ }
+ else {
+ availablePower_kW += addedPower_kW;
+ price_eurph += addedPrice_eurpkWh * addedPower_kW;
+ loopcount += 1;
+ }
+ //traceln("price added " + addedPrice_eurpkWh);
+}
+//traceln("total price " + price_eurph);
+//getEngine().pause();
+traceln("Still using treemaps in f_getAveragedElectricityPrice!");
+
+return price_eurph / requestedPower_kW;
+
+
+
+
+ RETURNS_VALUE
+ double
+ 1679478105441
+ f_getMethanePrice
+ 660
+ 400
+
+ false
+ true
+ true
+ if ( v_methanePrice_eurpkWh == 0.0 ){
+ throw new IllegalStateException("Missing methane contracts! No methane price available for this connection!");
+}
+return v_methanePrice_eurpkWh;
+
+
+ RETURNS_VALUE
+ double
+ 1679478116012
+ f_getHydrogenPrice
+ 660
+ 420
+
+ false
+ true
+ true
+ if ( v_hydrogenPrice_eurpkWh == 0.0 ){
+ throw new IllegalStateException("Missing hydrogen contracts! No hydrogen price available for this connection!");
+}
+return v_hydrogenPrice_eurpkWh;
+
+
+ VOID
+ double
+ 1704371830113
+ f_resetStates
+ 660
+ 40
+
+ false
+ true
+ true
+ // Reset energytotals
+//v_totalElectricityUsed_kWh = v_totalHeatUsed_kWh = v_totalMethaneUsed_kWh = v_totalHydrogenUsed_kWh = v_totalDieselUsed_kWh = 0;
+// Reset finances
+//v_balanceElectricity_eur = v_balanceElectricityDelivery_eur = v_balanceElectricityTransport_eur = v_balanceElectricityTax_eur = 0;
+
+
+
+ VOID
+ double
+ 1716897235822
+ f_initialize
+ 660
+ 60
+
+ false
+ true
+ true
+ // What happens if this function is triggered multiple times per connectionOwner?
+f_setContractValues();
+f_connectToParentActor();
+
+
+ RETURNS_VALUE
+ ArrayList<GridConnection>
+ 1718289254859
+ f_getOwnedGridConnections
+ 60
+ 600
+
+ false
+ true
+ true
+ return this.c_ownedGridConnections;
+
+
+
+
+ 1660224852389
+ connections
+ true
+ -70
+ -110
+
+ false
+ true
+ true
+ false
+ COLLECTION_OF_LINKS
+ true
+ TreeMap<Double, Double>
+ SOLID
+ 1
+ -16777216
+ UNDER_AGENTS
+ NONE
+ END
+
+
+ 1660225105554
+ energySupplier
+ Link naar bovenliggende actor, bijv. een Coop, of energySupplier. Gebruikt om lid te worden van een Coop of aangesloten te zijn bij een energieleverancier.
+
+@since: Sprint 6
+@author: Gillis
+ true
+ 60
+ -70
+
+ false
+ true
+ true
+ false
+ SINGLE_LINK
+ false
+ Object
+ SOLID
+ 1
+ -16777216
+ UNDER_AGENTS
+ NONE
+ END
+
+
+
+
+ 1660730128545
+ energyModel
+ 60
+ -100
+
+ false
+ true
+ true
+
+ zero_engine
+ EnergyModel
+
+
+
+
+
+ 1660224852393
+ level
+ 0
+ 0
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ 0
+ DIM_NON_CURRENT
+
+
+ 1667917035332
+ line1
+ 920
+ 60
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ false
+ 0
+ 10
+ 1
+ -16777216
+ null
+ SOLID
+ 1
+ 0
+ 1
+ 0
+ 140
+ 0
+ 0
+
+
+ 1667917035334
+ text1
+ 950
+ 40
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ Contracts
+
+ SansSerif
+ 11
+
+
+ LEFT
+
+
+ 1674921588187
+ rectangle5
+ 510
+ 630
+
+ false
+ true
+ false
+ SHAPE_DRAW_2D3D
+ false
+ 0
+ 10
+ 2
+ -4144960
+ null
+ DASHED
+ 730
+ 189.967
+ 0.0
+ -1
+ null
+
+
+ 1674921588189
+ text12
+ 730
+ 660
+
+ false
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -8355712
+ Current consumption volumes
+
+ SansSerif
+ 11
+
+
+ LEFT
+
+
+ 1674921619300
+ text13
+ 970
+ 660
+
+ false
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -8355712
+ Electricity financial accounting
+
+ SansSerif
+ 11
+
+
+ LEFT
+
+
+ false
+ 1675071708039
+ button
+ true
+ 660
+ 350
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+
+ false
+ -16777216
+ true
+ traceln("f_getAveragedElectricityPrice(-5, 10): " + f_getAveragedElectricityPrice(-5, 10));
+traceln("f_getAveragedElectricityPrice(-5, 5): " + f_getAveragedElectricityPrice(-5, 5));
+traceln("f_getAveragedElectricityPrice(-5, 4): " + f_getAveragedElectricityPrice(-5, 4));
+
+/*
+traceln("f_getAvailablePowerAtPrice(5) " + f_getAvailablePowerAtPrice(5));
+traceln("f_getElectricityPrice(5) " + f_getElectricityPrice(5));
+traceln("f_getAvailablePowerAtPrice(0) " + f_getAvailablePowerAtPrice(0));
+traceln("f_getElectricityPrice(0) " + f_getElectricityPrice(0));
+traceln("f_getAvailablePowerAtPrice(-1) " + f_getAvailablePowerAtPrice(-1));
+traceln("f_getElectricityPrice(-1) " + f_getElectricityPrice(-1));
+traceln("f_getAvailablePowerAtPrice(-10) " + f_getAvailablePowerAtPrice(-10));
+traceln("f_getElectricityPrice(-10) " + f_getElectricityPrice(-10));
+*/
+
+
+
+
+ test avg price function
+
+
+
+ 1676900973459
+ text14
+ 540
+ 660
+
+ false
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -8355712
+ Total consumption
+
+ SansSerif
+ 11
+
+
+ LEFT
+
+
+
+
+
+
+ 1714643374614
+ va_ConnectionOwner
+ 0
+ 0
+
+ false
+ true
+ false
+
+ 1920
+ 980
+
+
+
+
+ 1660731375016
+ EnergyCoop
+ public OL_ResultScope getScope(){return OL_ResultScope.ENERGYCOOP;}
+public J_RapidRunData getRapidRunData(){return v_rapidRunData;}
+public J_LiveData getLiveData(){return v_liveData;}
+public J_RapidRunData getPreviousRapidRunData(){return v_previousRunData;}
+ 1752677829820
+ import com.fasterxml.jackson.databind.JsonNode;
+
+import zeroPackage.ZeroMath;
+//import zeroPackage.ZeroAccumulator;
+
+import java.util.EnumSet;
+
+/*
+import com.fasterxml.jackson.annotation.JsonIdentityInfo;
+import com.fasterxml.jackson.annotation.ObjectIdGenerators;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+*/
+//@JsonIgnoreProperties({"va_coop"})
+//@JsonIgnoreProperties({"_origin_VA"})
+
+
+ zero_engine
+ Actor
+
+
+
+ p_actorID
+
+
+ p_actorType
+
+
+ p_actorGroup
+
+
+ p_actorSubgroup
+
+
+ I_EnergyData
+ v_liveData = new J_LiveData(this);
+v_liveData.activeEnergyCarriers = EnumSet.of(OL_EnergyCarriers.ELECTRICITY);
+v_liveData.activeProductionEnergyCarriers = EnumSet.of(OL_EnergyCarriers.ELECTRICITY);
+v_liveData.activeConsumptionEnergyCarriers= EnumSet.of(OL_EnergyCarriers.ELECTRICITY);
+
+v_liveConnectionMetaData = new J_ConnectionMetaData(this);
+v_liveAssetsMetaData = new J_AssetsMetaData(this);
+v_liveData.connectionMetaData = v_liveConnectionMetaData;
+v_liveData.assetsMetaData = v_liveAssetsMetaData;
+energyModel.c_actors.add(this);
+
+fm_currentProductionFlows_kW = new J_FlowsMap();
+fm_currentConsumptionFlows_kW = new J_FlowsMap();
+fm_currentBalanceFlows_kW = new J_FlowsMap();
+fm_heatFromEnergyCarrier_kW = new J_FlowsMap();
+fm_consumptionForHeating_kW = new J_FlowsMap();
+fm_currentAssetFlows_kW = new J_ValueMap(OL_AssetFlowCategories.class);
+ false
+
+ 1660731375014
+ 1660731375014
+
+ T extends Agent
+
+ Generic parameter:
+
+ ENTITY
+ 100
+ false
+ 100
+ true
+
+ -4144960
+ null
+
+ true
+ true
+ false
+
+ 10
+ MPS
+
+
+ 1
+ METER
+
+
+ 1
+ METER
+
+
+ 1
+ METER
+
+
+
+ false
+
+ 1.0
+ SECOND
+
+ CONTINUOUS
+ 500
+ 500
+ 0
+ 100
+ 100
+ MOORE
+ USER_DEF
+ USER_DEF
+ 2
+ 50
+ 0.95
+ 10
+
+
+ true
+ 1658477089993
+ true
+ 1660809600000
+
+ 0
+ SECOND
+
+
+ 1
+ SECOND
+
+
+
+ 1660731375012
+ scale
+ 0
+ -150
+ false
+ false
+ false
+ SHAPE_DRAW_2D3D
+ 100
+ 0
+ BASED_ON_LENGTH
+ 10
+ METER
+ 10
+ true
+
+ 1660731375015
+ 1660731375011
+
+
+ 1667983361361
+ v_energyPassedThrough_kWh
+ true
+ -330
+ 860
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1667983361363
+ v_electricityVolume_kWh
+ true
+ -319
+ 919
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1667983361365
+ v_heatVolume_kWh
+ true
+ -319
+ 939
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1667983361367
+ v_methaneVolume_kWh
+ true
+ -319
+ 959
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1667983361369
+ v_electricitySurplus_kW
+ 63
+ 599
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1667983361389
+ v_hydrogenVolume_kWh
+ true
+ -319
+ 979
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1668587453344
+ v_balanceMembers_eur
+ true
+ -1050
+ 560
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1668587453348
+ v_balanceMethane_eur
+ true
+ -330
+ 760
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1668587453350
+ v_balanceHeat_eur
+ true
+ -330
+ 780
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1668587453352
+ v_balanceHydrogen_eur
+ true
+ -330
+ 800
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1668587944764
+ v_electricityContractType
+ true
+ -330
+ 580
+
+ false
+ true
+ true
+
+ OL_ContractType
+
+ OL_ContractType.ELECTRICITY_VARIABLE
+
+
+
+
+ 1668587944767
+ v_heatContractType
+ true
+ -330
+ 600
+
+ false
+ true
+ true
+
+ OL_ContractType
+
+ HEAT_FIXED
+
+
+
+
+ 1668587944769
+ v_methaneContractType
+ true
+ -330
+ 620
+
+ false
+ true
+ true
+
+ OL_ContractType
+
+ METHANE_FIXED
+
+
+
+
+ 1668587944771
+ v_hydrogenContractType
+ true
+ -330
+ 640
+
+ false
+ true
+ true
+
+ OL_ContractType
+
+ HYDROGEN_FIXED
+
+
+
+
+ 1669024099515
+ v_dieselVolume_kWh
+ true
+ -320
+ 1000
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1669024644541
+ v_balanceDiesel_eur
+ true
+ -330
+ 820
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1669037269503
+ v_contractEnergyCoop
+ true
+ -330
+ 680
+
+ false
+ true
+ true
+
+ String
+
+
+
+ 1669035973258
+ v_allowedCapacity_kW
+ 62
+ 700
+
+ false
+ true
+ true
+
+ Double
+
+
+
+ 1669037284540
+ v_contractEnergySupplier
+ true
+ -330
+ 700
+
+ false
+ true
+ true
+
+ String
+
+
+
+ 1669037300744
+ v_contractGridOperator
+ true
+ -330
+ 720
+
+ false
+ true
+ true
+
+ String
+
+
+
+ 1670254434536
+ v_enable_nfATO_b
+ true
+ -340
+ 450
+
+ false
+ true
+ true
+
+ boolean
+
+ false
+
+
+
+
+ 1675335053811
+ j_ActorData
+ 62
+ 670
+
+ false
+ true
+ true
+
+ J_ActorData
+
+
+
+ 1676552003055
+ v_contractDelivery
+ 390
+ 130
+
+ false
+ true
+ true
+
+ J_DeliveryContract
+
+
+
+ 1676552003057
+ v_contractTransport
+ 390
+ 150
+
+ false
+ true
+ true
+
+ J_TransportContract
+
+
+
+ 1676552003059
+ v_contractTax
+ 390
+ 170
+
+ false
+ true
+ true
+
+ J_TaxContract
+
+
+
+ 1676552003061
+ v_contractConnection
+ 390
+ 190
+
+ false
+ true
+ true
+
+ J_ConnectionContract
+
+
+
+ 1676552997739
+ v_balanceElectricityDelivery_eur
+ 660
+ 579
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1676552997741
+ v_balanceElectricityTransport_eur
+ 660
+ 599
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1676552997743
+ v_balanceElectricityTax_eur
+ 660
+ 619
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1676553064622
+ v_electricityVariablePrice_eurpkWh
+ 62
+ 470
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1676553064625
+ v_priceBandsDelivery
+ true
+ -340
+ 320
+
+ false
+ true
+ true
+
+ TreeMap<Double, Double>
+
+
+
+ 1676553064627
+ v_currentNodalPrice_eurpkWh
+ 62
+ 490
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1676553064629
+ v_priceBandsTransport
+ true
+ -340
+ 339
+
+ false
+ true
+ true
+
+ TreeMap<Double, Double>
+
+
+
+ 1676553064631
+ v_priceBandsTax
+ true
+ -340
+ 359
+
+ false
+ true
+ true
+
+ TreeMap<Double, Double>
+
+
+
+ 1679563490208
+ v_methanePrice_eurpkWh
+ 62
+ 510
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1679563490210
+ v_hydrogenPrice_eurpkWh
+ 62
+ 530
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1679563490212
+ v_heatPrice_eurpkWh
+ 62
+ 550
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1692113155819
+ v_balanceElectricity_eur
+ 660
+ 560
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1692113346724
+ v_totalBalanceCoop_eur
+ true
+ -1080
+ 600
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1692620449476
+ v_electricitySurplusLowPassed_kW
+ 63
+ 619
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1692620522011
+ v_lowPassFactor_fr
+ 62
+ 640
+
+ false
+ true
+ true
+
+ double
+
+ min(1, 0.8*1.2 * energyModel.p_timeStep_h) //0.2
+
+
+
+
+ 1692631118805
+ v_assetDepreciation_eur
+ true
+ -1050
+ 520
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1704291413594
+ v_currentEnergyCurtailed_kW
+ 60
+ 1270
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1709644748300
+ v_currentOwnElectricityProduction_kW
+ 60
+ 1320
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1723102014142
+ acc_totalOwnElectricityProduction_kW
+ 520
+ 1100
+
+ false
+ true
+ true
+
+ ZeroAccumulator
+
+ new ZeroAccumulator(true, energyModel.p_timeStep_h, 8760)
+
+
+
+
+ 1730133371154
+ v_currentCustomerFeedIn_kW
+ 60
+ 1360
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1730133390778
+ acc_totalCustomerFeedIn_kW
+ 520
+ 1139
+
+ false
+ true
+ true
+
+ ZeroAccumulator
+
+ new ZeroAccumulator(true, energyModel.p_timeStep_h, 8760)
+
+
+
+
+ 1731077836700
+ fm_currentConsumptionFlows_kW
+ 60
+ 1120
+
+ false
+ true
+ true
+
+ J_FlowsMap
+
+
+
+ 1731077836702
+ fm_currentProductionFlows_kW
+ 60
+ 1100
+
+ false
+ true
+ true
+
+ J_FlowsMap
+
+
+
+ 1731077836704
+ fm_currentBalanceFlows_kW
+ 60
+ 1140
+
+ false
+ true
+ true
+
+ J_FlowsMap
+
+
+
+ 1731078158609
+ v_currentPrimaryEnergyProduction_kW
+ 60
+ 1220
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1731078158611
+ v_currentFinalEnergyConsumption_kW
+ 60
+ 1200
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1731079071069
+ v_currentPrimaryEnergyProductionHeatpumps_kW
+ 60
+ 1240
+
+ false
+ false
+ true
+
+ double
+
+
+
+ 1731400569232
+ acc_totalCustomerDelivery_kW
+ 520
+ 1120
+
+ false
+ true
+ true
+
+ ZeroAccumulator
+
+ new ZeroAccumulator(true, energyModel.p_timeStep_h, 8760)
+
+
+
+
+ 1731400607488
+ v_currentCustomerDelivery_kW
+ 60
+ 1340
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1731404179099
+ v_totalCustomerFeedIn_MWh
+ 520
+ 1200
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1731404179102
+ v_totalCustomerDelivery_MWh
+ 520
+ 1220
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1731506246424
+ v_totalOwnElectricityProduction_MWh
+ 520
+ 1180
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1740152681807
+ v_cumulativeIndividualSelfconsumptionElectricity_fr
+ 1430
+ 750
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1740152689012
+ v_cumulativeIndividualSelfconsumptionEnergy_fr
+ 1430
+ 820
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1740152690222
+ v_cumulativeIndividualSelfSufficiencyElectricity_fr
+ 1430
+ 770
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1740152691469
+ v_cumulativeIndividualSelfSufficiencyEnergy_fr
+ 1430
+ 840
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1740489780788
+ v_cumulativeIndividualSelfconsumptionElectricity_MWh
+ 1430
+ 730
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1740489782775
+ v_cumulativeIndividualSelfconsumptionEnergy_MWh
+ 1430
+ 800
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1740672534686
+ v_cumulativeIndividualPeakFeedin_kW
+ 1430
+ 890
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1740672540722
+ v_cumulativeIndividualPeakDelivery_kW
+ 1430
+ 870
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1741277674318
+ v_previousRunData
+ 80
+ 940
+
+ false
+ true
+ true
+
+ J_RapidRunData
+
+ null
+
+
+
+
+ 1741872046287
+ v_rapidRunData
+ 60
+ 920
+
+ false
+ true
+ true
+
+ J_RapidRunData
+
+
+
+ 1741872046289
+ v_liveData
+ 60
+ 790
+
+ false
+ true
+ true
+
+ J_LiveData
+
+
+
+ 1741872046291
+ v_liveAssetsMetaData
+ 80
+ 810
+
+ false
+ true
+ true
+
+ J_AssetsMetaData
+
+
+
+ 1741943696911
+ v_liveConnectionMetaData
+ 80
+ 830
+
+ false
+ true
+ true
+
+ J_ConnectionMetaData
+
+
+
+ 1753111072241
+ v_assetFlows
+ true
+ 60
+ 1160
+
+ false
+ true
+ true
+
+ J_AssetFlows
+
+ new J_AssetFlows()
+
+
+
+
+ 1753970982500
+ fm_currentAssetFlows_kW
+ 202
+ 1161
+
+ false
+ true
+ true
+
+ J_ValueMap
+
+
+
+ 1754320819135
+ v_batteryStoredEnergy_kWh
+ 60
+ 1290
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1759144491399
+ v_originalRapidRunData
+ 80
+ 960
+
+ false
+ true
+ true
+
+ J_RapidRunData
+
+
+
+ 1759155291319
+ v_cumulativeIndividualPeakFeedinOriginal_kW
+ 1430
+ 970
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1759155291321
+ v_cumulativeIndividualPeakDeliveryOriginal_kW
+ 1430
+ 950
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1764773311957
+ fm_consumptionForHeating_kW
+ 60
+ 1420
+
+ false
+ true
+ true
+
+ J_FlowsMap
+
+
+
+ 1764773311959
+ fm_heatFromEnergyCarrier_kW
+ 60
+ 1400
+
+ false
+ true
+ true
+
+ J_FlowsMap
+
+
+
+ 1669037234222
+ p_actorContractList
+ 390
+ 50
+
+ false
+ true
+ true
+
+ com.fasterxml.jackson.databind.node.ArrayNode
+ NONE
+ false
+
+ 1658477089992
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1669036172744
+ p_connectionCapacity_kW
+ TODO: This is still hardcoded! How should Coop know where to 'gather' this data? (Capacity of shared connection)
+ true
+ -340
+ 200
+
+ false
+ true
+ true
+
+ double
+ NONE
+ false
+
+ 1669036172742
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1671707831168
+ p_gridNodeUnderResponsibility
+ Pointer of the designated parent actor (e.g. a Coop or energy supplier)
+
+@since: Sprint 6
+@author: Gillis
+ true
+ -340
+ 240
+
+ false
+ true
+ true
+
+ String
+ NONE
+ false
+
+ 1671707831166
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1676551040549
+ p_actorID
+ Unique identifier of this actor in String format. Designated in Config-excel and used to link actors to netConnections.
+
+@since: Sprint 6
+@author: Gillis
+ true
+ -340
+ 60
+
+ false
+ true
+ true
+
+ String
+ NONE
+ false
+
+ 1676551040547
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1676551040552
+ p_actorType
+ Actor type in OL_ActorType format. Designated in Config-excel and used to determine actor-type specific functionalities later.
+
+@since: Sprint 6
+@author: Gillis
+ true
+ -340
+ 80
+
+ false
+ true
+ true
+
+ String
+ NONE
+ false
+
+ 1676551040550
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1676551040555
+ p_parentActorID
+ Unique actor identifier in String format of a designated parent actor. This may be designated in Config-excel and is used to create an agent link with a higher lying agent (e.g. a Coop or energy supplier)
+
+@since: Sprint 6
+@author: Gillis
+ true
+ -330
+ 550
+
+ false
+ true
+ true
+
+ String
+ NONE
+ false
+
+ 1676551040553
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1676551040558
+ p_electricitySupplier
+ Pointer of the designated parent actor (e.g. a Coop or energy supplier)
+
+@since: Sprint 6
+@author: Gillis
+ 60
+ 130
+
+ false
+ true
+ true
+
+ Actor
+ NONE
+ false
+
+ 1676551040556
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1676551708075
+ p_CoopParent
+ 60
+ 240
+
+ false
+ true
+ true
+
+ Actor
+ NONE
+ false
+
+ null
+
+
+ 1676551708073
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1676551708078
+ p_gridOperator
+ 60
+ 220
+
+ false
+ true
+ true
+
+ Actor
+ NONE
+ false
+
+ 1676551708076
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1679563405825
+ p_methaneSupplier
+ Pointer of the designated parent actor (e.g. a Coop or energy supplier)
+
+@since: Sprint 6
+@author: Gillis
+ 60
+ 150
+
+ false
+ true
+ true
+
+ Actor
+ NONE
+ false
+
+ 1679563405823
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1679563405829
+ p_hydrogenSupplier
+ Pointer of the designated parent actor (e.g. a Coop or energy supplier)
+
+@since: Sprint 6
+@author: Gillis
+ 60
+ 170
+
+ false
+ true
+ true
+
+ Actor
+ NONE
+ false
+
+ 1679563405827
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1679563405832
+ p_heatSupplier
+ Pointer of the designated parent actor (e.g. a Coop or energy supplier)
+
+@since: Sprint 6
+@author: Gillis
+ 60
+ 190
+
+ false
+ true
+ true
+
+ Actor
+ NONE
+ false
+
+ 1679563405830
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1692112528722
+ p_yearlyOperationalCosts_eur
+ TODO: This is still hardcoded! How should Coop know where to 'gather' this data? (Capacity of shared connection)
+ true
+ -1050
+ 580
+
+ false
+ true
+ true
+
+ double
+ NONE
+ false
+
+ 123456
+
+
+ 1692112528720
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1692620732354
+ p_applyKostprijsPlus
+ true
+ 62
+ 580
+
+ false
+ true
+ true
+
+ boolean
+ NONE
+ false
+
+ true
+
+
+ 1692620732352
+ CHECK_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1756207893367
+ p_aggregatorBatteryManagement
+ 690
+ 730
+
+ false
+ true
+ true
+
+ I_AggregatorBatteryManagement
+ NONE
+ false
+
+ 1756207893365
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1679563561816
+ c_actorContracts
+ 391
+ 91
+
+ false
+ true
+ true
+
+ ArrayList
+ J_Contract
+ String
+
+
+
+ 1678292542481
+ c_coopMembers
+ 60
+ 260
+
+ false
+ true
+ true
+
+ ArrayList
+ Actor
+ Object
+
+
+
+ 1709628025685
+ c_coopCustomers
+ 60
+ 370
+
+ false
+ true
+ true
+
+ ArrayList
+ Actor
+ Object
+
+
+
+ 1739975612911
+ c_memberGridConnections
+ 60
+ 280
+
+ false
+ true
+ true
+
+ ArrayList
+ GridConnection
+ Object
+
+
+
+ 1739975642432
+ c_customerGridConnections
+ 60
+ 390
+
+ false
+ true
+ true
+
+ ArrayList
+ GridConnection
+ Object
+
+
+
+
+
+ 1669035973262
+ e_startNonFirmATO
+ true
+ -340
+ 470
+
+ false
+ true
+ true
+
+
+ 1
+ HOUR
+
+
+ 1
+ PER_HOUR
+
+ 1658477089991
+ true
+ 1669017600000
+
+ 1d/1f
+ HOUR
+
+
+ 1
+ DAY
+
+ false
+
+ v_allowedCapacity_kW = v_contractConnection.nfATOpower_kW;// p_nfatoLvl_kW;
+
+
+ 1669035973267
+ e_endNonFirmATO
+ true
+ -340
+ 490
+
+ false
+ true
+ true
+
+
+ 1
+ HOUR
+
+
+ 1
+ PER_HOUR
+
+ 1658477089990
+ true
+ 1669017600000
+
+ 1d/1f
+ HOUR
+
+
+ 1
+ DAY
+
+ false
+
+ v_allowedCapacity_kW = p_connectionCapacity_kW;
+
+
+
+
+ VOID
+ double
+ 1660736326703
+ f_connectToChild
+ 660
+ 70
+
+ false
+ true
+ true
+
+ ConnectingChildActor
+ Actor
+
+
+ EnergyCarrier
+ OL_EnergyCarriers
+
+ /*switch( EnergyCarrier ) {
+ case ELECTRICITY:
+ subConnectionsElectricity.connectTo(ConnectingChildNode);
+ break;
+ case METHANE:
+ subConnectionsMethane.connectTo(ConnectingChildNode);
+ break;
+ case HYDROGEN:
+ subConnectionsHydrogen.connectTo(ConnectingChildNode);
+ break;
+ case HEAT:
+ subConnectionsHeat.connectTo(ConnectingChildNode);
+ break;
+ default:
+
+ break;
+}*/
+if (ConnectingChildActor.p_actorGroup != null) {
+ if (ConnectingChildActor.p_actorGroup.contains("production") || ConnectingChildActor.p_actorGroup.contains("Production") || ConnectingChildActor.p_actorGroup.contains("member")) { // Count owned production-sites as 'behind the meter'
+ c_coopMembers.add( ConnectingChildActor);
+ c_memberGridConnections.addAll(((ConnectionOwner)ConnectingChildActor).c_ownedGridConnections);
+ (((ConnectionOwner)ConnectingChildActor).c_ownedGridConnections).forEach( gc -> gc.c_parentCoops.add(this));
+ //traceln("Adding: %s", ((ConnectionOwner)ConnectingChildActor).c_ownedGridConnections);
+ } else {
+ c_coopCustomers.add( ConnectingChildActor );
+ c_customerGridConnections.addAll(((ConnectionOwner)ConnectingChildActor).c_ownedGridConnections);
+ }
+} else {
+ c_coopCustomers.add( ConnectingChildActor );
+ c_customerGridConnections.addAll(((ConnectionOwner)ConnectingChildActor).c_ownedGridConnections);
+ //traceln("Adding: %s", ((ConnectionOwner)ConnectingChildActor).c_ownedGridConnections);
+}
+
+/*
+if ( v_contractGridOperator.equals("NODALPRICING")) {
+// traceln("Enabling nodal pricing for Coop memmber!");
+ if (ConnectingChildNode instanceof ConnectionOwner) {
+ //((ConnectionOwner)ConnectingChildNode).v_contractGridOperator = v_contractGridOperator;
+ ((ConnectionOwner)ConnectingChildNode).v_congestionTariff_b = true;
+ }
+}
+if ( v_contractEnergySupplier.equals("VARIABLE")) {
+ if (ConnectingChildNode instanceof ConnectionOwner) {
+ ((ConnectionOwner)ConnectingChildNode).v_electricityContractType = OL_DeliveryContractType.ELECTRICITY_VARIABLE;
+ //((ConnectionOwner)ConnectingChildNode).v_contractEnergySupplier= v_contractEnergySupplier;
+ //((ConnectionOwner)ConnectingChildNode).v_updatePriceBands_b = true;
+ }
+}
+*/
+
+
+ VOID
+ double
+ 1660806150226
+ f_updateFinances
+ true
+ 660
+ 200
+
+ false
+ true
+ true
+ // get current energy flows
+//f_gatherEnergyFlows();
+
+/*
+double currentPowerDrawn_kW = -v_electricitySurplus_kW;
+
+// trigger transaction with supplier/Coop
+
+double transactionCost_eur = 0;//((EnergySupplier)p_energySupplier).f_doEnergyTransaction(v_electricityVolume_kWh, v_electricityContractType);
+double transactionCostTax_eur = 0;
+double transactionCostTransport_eur = 0;
+double transactionCostDelivery_eur = 0;
+//transactionCost_eur = 0;//((EnergySupplier)p_energySupplier).f_doEnergyTransaction(v_heatVolume_kWh, v_heatContractType);
+//v_balanceHeat_eur -= transactionCost_eur;
+//transactionCost_eur = 0;//((EnergySupplier)p_energySupplier).f_doEnergyTransaction(v_methaneVolume_kWh, v_methaneContractType);
+//v_balanceMethane_eur -= transactionCost_eur;
+
+//
+if (v_electricityVolume_kWh >= 0) {
+ //transactionCostDelivery_eur = v_priceBandsDelivery.ceilingEntry( currentPowerDrawn_kW ).getValue() * v_electricityVolume_kWh;
+ if (v_contractDelivery!=null){
+ transactionCostDelivery_eur = (v_contractDelivery.deliveryPrice_eurpkWh + v_electricityVariablePrice_eurpkWh) * v_electricityVolume_kWh;
+ } else {
+ transactionCostDelivery_eur = v_electricityVariablePrice_eurpkWh * v_electricityVolume_kWh;
+ }
+ v_balanceElectricityDelivery_eur -= transactionCostDelivery_eur;
+ v_balanceElectricity_eur -= transactionCostDelivery_eur;
+
+ if (v_contractTax!=null){
+ transactionCostTax_eur = v_contractTax.deliveryTax_eurpkWh * v_electricityVolume_kWh;
+ //transactionCostTax_eur = v_electricityVolume_kWh * v_contractTax.feedinTax_eurpkWh + v_contractTax.proportionalTax_pct*(v_electricityVolume_kWh * v_contractTax.feedinTax_eurpkWh + transactionCostDelivery_eur + transactionCostTransport_eur);
+ v_balanceElectricityTax_eur -= transactionCostTax_eur;
+ v_balanceElectricity_eur -= transactionCostTax_eur;
+ }
+} else {
+ if (v_contractDelivery!=null){
+ transactionCostDelivery_eur = (v_contractDelivery.feedinPrice_eurpkWh + v_electricityVariablePrice_eurpkWh) * v_electricityVolume_kWh;
+ } else {
+ transactionCostDelivery_eur = v_electricityVariablePrice_eurpkWh * v_electricityVolume_kWh;
+ }
+ v_balanceElectricityDelivery_eur -= transactionCostDelivery_eur;
+ v_balanceElectricity_eur -= transactionCostDelivery_eur;
+
+ if (v_contractTax!=null){
+ transactionCostTax_eur = v_contractTax.feedinTax_eurpkWh * v_electricityVolume_kWh;
+ //transactionCostTax_eur = v_electricityVolume_kWh * v_contractTax.feedinTax_eurpkWh + v_contractTax.proportionalTax_pct*(v_electricityVolume_kWh * v_contractTax.feedinTax_eurpkWh + transactionCostDelivery_eur + transactionCostTransport_eur);
+ v_balanceElectricityTax_eur -= transactionCostTax_eur;
+ v_balanceElectricity_eur -= transactionCostTax_eur;
+ }
+}
+
+transactionCostTransport_eur = v_currentNodalPrice_eurpkWh * v_electricityVolume_kWh;
+v_balanceElectricityTransport_eur -= transactionCostTransport_eur;
+v_balanceElectricity_eur -= transactionCostTransport_eur;
+
+
+// TODO: Also needs to include congestion tariffs! So Coop needs to know to which GridNode it's connected! How should that work?
+*/
+
+
+ RETURNS_VALUE
+ double
+ 1660825183645
+ f_doEnergyTransaction
+ true
+ -330
+ 530
+
+ false
+ true
+ true
+
+ transactionVolume_kWh
+ double
+
+
+ contractType
+ OL_ContractType
+
+ double transactionCostClient_eur = 0;
+
+if( p_energySupplier instanceof EnergySupplier ) {
+ EnergySupplier energySupplier = (EnergySupplier)p_energySupplier;
+ transactionCostClient_eur = energySupplier.f_doEnergyTransaction(transactionVolume_kWh, contractType);
+} else if( p_energySupplier instanceof EnergyCoop ) {
+ EnergyCoop energySupplier = (EnergyCoop)p_energySupplier;
+ transactionCostClient_eur = energySupplier.f_doEnergyTransaction(transactionVolume_kWh, contractType);
+}
+
+v_energyPassedThrough_kWh += transactionVolume_kWh;
+
+return transactionCostClient_eur;
+
+
+ VOID
+ double
+ 1660825257472
+ f_connectToParentActor
+ Creates an agentLink in superConnection if a parentActorID is designated in the config-excel. Called from f_configureBackBone() in main for profiling reasons, so no parameters are given.
+
+@param: none
+@return: none
+@since: Sprint 6
+@author: HOUJ
+ 670
+ 120
+
+ false
+ true
+ true
+ Actor mySupplier = null;
+mySupplier = findFirst(energyModel.pop_energySuppliers, p->p.p_actorID.equals(v_contractDelivery.contractScope)) ;
+if (mySupplier != null) {
+ ((EnergySupplier)mySupplier).f_connectToChild(this);
+} else {
+ mySupplier = findFirst(energyModel.pop_energyCoops, p->p.p_actorID.equals(v_contractDelivery.contractScope)) ;
+ if (mySupplier != null) {
+ ((EnergyCoop)mySupplier).f_connectToChild(this,OL_EnergyCarriers.ELECTRICITY);
+ }
+}
+
+if (mySupplier != null) {
+ p_electricitySupplier = mySupplier;
+}
+else {
+ p_electricitySupplier = energyModel.pop_energySuppliers.get(0); // this is a harcoded fix to make the buurtmodel run for 21-3-2023
+ traceln("Connection owner %s --> f_connectToParentActor --> no parent actor %s found, this should not be happening", this, v_contractDelivery.contractScope);
+}
+
+Actor myGridoperator = null;
+// Connect to grid operator (can be a Coop!)
+myGridoperator = findFirst(energyModel.pop_gridOperators, p->p.p_actorID.equals(v_contractTransport.contractScope)) ;
+if (myGridoperator == null) {
+ myGridoperator = findFirst(energyModel.pop_energyCoops, p->p.p_actorID.equals(v_contractTransport.contractScope)) ;
+}
+
+if (myGridoperator != null) {
+ p_gridOperator = myGridoperator;
+} else {
+ //p_gridOperator = main.pop_gridOperators.get( 0 ) ; // this is a harcoded fix to make the buurtmodel run for 21-3-2023
+ traceln("Connection owner --> f_connectToParentActor --> no parent actor found, this should not be happening");
+}
+
+
+
+ VOID
+ double
+ 1667983361355
+ f_calculateEnergyBalance
+ 670
+ 220
+
+ false
+ true
+ true
+ v_currentOwnElectricityProduction_kW = 0; // Only electricity production from 'members' as opposed to 'customers'.
+v_currentCustomerFeedIn_kW = 0; // Feedin from customers (self-consumption behind-the-meter is not counted for customers)
+v_currentCustomerDelivery_kW = 0; // Delivery to customers (self-consumption behind-the-meter is not counted for customers)
+
+fm_currentProductionFlows_kW.clear();
+fm_currentConsumptionFlows_kW.clear();
+fm_currentBalanceFlows_kW.clear();
+fm_currentAssetFlows_kW.clear();
+v_currentPrimaryEnergyProduction_kW = 0;
+v_currentFinalEnergyConsumption_kW = 0;
+v_currentEnergyCurtailed_kW = 0;
+v_batteryStoredEnergy_kWh = 0;
+v_currentPrimaryEnergyProductionHeatpumps_kW = 0;
+
+
+for(GridConnection gc : c_memberGridConnections) { // Can't do this in parallel due to different threads writing to the same values!
+ if(gc.v_isActive){
+ fm_currentBalanceFlows_kW.addFlows(gc.fm_currentBalanceFlows_kW);
+ fm_currentProductionFlows_kW.addFlows(gc.fm_currentProductionFlows_kW);
+ fm_currentConsumptionFlows_kW.addFlows(gc.fm_currentConsumptionFlows_kW);
+ fm_heatFromEnergyCarrier_kW.addFlows(gc.fm_heatFromEnergyCarrier_kW);
+ fm_consumptionForHeating_kW.addFlows(gc.fm_consumptionForHeating_kW);
+ fm_currentAssetFlows_kW.addFlows(gc.fm_currentAssetFlows_kW);
+ v_currentFinalEnergyConsumption_kW += gc.v_currentFinalEnergyConsumption_kW;
+ v_currentPrimaryEnergyProduction_kW += gc.v_currentPrimaryEnergyProduction_kW;
+ v_currentEnergyCurtailed_kW += gc.v_currentEnergyCurtailed_kW;
+ v_batteryStoredEnergy_kWh += gc.v_batteryStoredEnergy_kWh;
+ v_currentPrimaryEnergyProductionHeatpumps_kW += gc.v_currentPrimaryEnergyProductionHeatpumps_kW;
+ v_currentOwnElectricityProduction_kW += gc.fm_currentProductionFlows_kW.get(OL_EnergyCarriers.ELECTRICITY);
+ }
+}
+
+// gather electricity flows
+for(Agent a : c_coopMembers ) { // Take 'behind the meter' production and consumption!
+ if (a instanceof EnergyCoop) {
+ EnergyCoop EC = (EnergyCoop)a;
+
+ fm_currentBalanceFlows_kW.addFlows(EC.fm_currentBalanceFlows_kW);
+ fm_currentProductionFlows_kW.addFlows(EC.fm_currentProductionFlows_kW);
+ fm_currentConsumptionFlows_kW.addFlows(EC.fm_currentConsumptionFlows_kW);
+ fm_heatFromEnergyCarrier_kW.addFlows(EC.fm_heatFromEnergyCarrier_kW);
+ fm_consumptionForHeating_kW.addFlows(EC.fm_consumptionForHeating_kW);
+ fm_currentAssetFlows_kW.addFlows(EC.fm_currentAssetFlows_kW);
+ v_currentPrimaryEnergyProduction_kW += EC.v_currentPrimaryEnergyProduction_kW;
+ v_currentFinalEnergyConsumption_kW += EC.v_currentFinalEnergyConsumption_kW;
+ v_currentEnergyCurtailed_kW += EC.v_currentEnergyCurtailed_kW;
+ v_batteryStoredEnergy_kWh += EC.v_batteryStoredEnergy_kWh;
+ v_currentPrimaryEnergyProductionHeatpumps_kW += EC.v_currentPrimaryEnergyProductionHeatpumps_kW;
+ v_currentOwnElectricityProduction_kW += EC.fm_currentProductionFlows_kW.get(OL_EnergyCarriers.ELECTRICITY);
+
+ // Asset flows
+ //v_assetFlows.addFlows(EC.v_assetFlows);
+ }
+}
+
+for (GridConnection GC : c_customerGridConnections) { // Don't look at 'behind the meter' production/consumption, but use 'nett flow' as measure of consumption/production
+ if(GC.v_isActive){
+ for (OL_EnergyCarriers energyCarrier : v_liveData.activeEnergyCarriers) {
+ double nettConsumption_kW = GC.fm_currentBalanceFlows_kW.get(energyCarrier);
+ fm_currentProductionFlows_kW.addFlow( energyCarrier, max(0, -nettConsumption_kW));
+ fm_currentConsumptionFlows_kW.addFlow( energyCarrier, max(0, nettConsumption_kW));
+ fm_currentBalanceFlows_kW.addFlow( energyCarrier, nettConsumption_kW);
+
+ if (energyCarrier == OL_EnergyCarriers.ELECTRICITY) {
+ v_currentCustomerFeedIn_kW += max(0,-nettConsumption_kW);
+ v_currentCustomerDelivery_kW += max(0,nettConsumption_kW);
+ }
+ }
+ }
+}
+
+for(Agent a : c_coopCustomers ) { // Don't look at 'behind the meter' production/consumption, but use 'nett flow' as measure of consumption/production
+ if (a instanceof EnergyCoop) {
+ EnergyCoop EC = (EnergyCoop)a;
+
+ fm_currentBalanceFlows_kW.addFlows(EC.fm_currentBalanceFlows_kW);
+ fm_currentProductionFlows_kW.addFlows(EC.fm_currentProductionFlows_kW);
+ fm_currentConsumptionFlows_kW.addFlows(EC.fm_currentConsumptionFlows_kW);
+ fm_currentAssetFlows_kW.addFlows(EC.fm_currentAssetFlows_kW);
+ v_currentCustomerFeedIn_kW += EC.v_currentCustomerFeedIn_kW;
+ v_currentCustomerDelivery_kW += EC.v_currentCustomerDelivery_kW;
+ }
+}
+
+v_electricitySurplus_kW = -fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.ELECTRICITY);
+
+//Coop update data classes
+if (energyModel.v_isRapidRun){
+ f_rapidRunDataLogging();
+} else {
+ f_updateLiveDataSets();
+}
+
+
+ RETURNS_VALUE
+ double
+ 1667983361357
+ f_getVariableEnergyPrice
+ v_currentNodalPrice_eurpkWh = node van deze Coop -> p_gridNodeUnderResponsibility. Mogelijk niet robuust! TODO: checken of dit goed gaat!
+
+
+
+ 661
+ 299
+
+ false
+ true
+ true
+ double energyPrice_eurpkWh = v_electricityVariablePrice_eurpkWh + v_contractDelivery.deliveryPrice_eurpkWh;
+
+if ( v_contractTransport.transportContractType==OL_TransportContractType.NODALPRICING) {
+ energyPrice_eurpkWh += v_currentNodalPrice_eurpkWh;
+}
+
+//traceln("Coop received energy price of: " + energyPrice_eurpkWh + " eur/kWh");
+return energyPrice_eurpkWh;
+
+
+ VOID
+ double
+ 1667983437058
+ f_returnKPIData
+ Executed on simulation end to export data.
+
+@author: JorritvandenHouten
+@since: Sprint 6
+ true
+ -340
+ 410
+
+ false
+ true
+ true
+ // Total electricity import, export
+traceln("Coop Electricity imported: "+ v_electricityImported_kWh);
+traceln("Coop Electricity exported: "+ v_electricityExported_kWh);
+traceln("Coop electricity costs: " + v_balanceElectricity_eur + " euro");
+//Total energy consumption and production
+
+// Assume 'infinite storage' of hydrogen within model-scope; only nett total import/export counts.
+if (v_hydrogenImported_kWh > v_hydrogenExported_kWh) {
+ v_hydrogenImported_kWh = v_hydrogenImported_kWh - v_hydrogenExported_kWh;
+ v_hydrogenExported_kWh = 0;
+} else {
+ v_hydrogenExported_kWh = v_hydrogenExported_kWh - v_hydrogenImported_kWh;
+ v_hydrogenImported_kWh = 0;
+}
+
+double energyProduced_kWh = 0;
+double energyConsumed_kWh = 0;
+for(Agent a : subConnectionsElectricity.getConnections() ) {
+ if(a instanceof ConnectionOwner){
+ ConnectionOwner n = (ConnectionOwner)a;
+ for ( GridConnection g : n.gridConnections.getConnections() ) {
+ for (EnergyAsset e : g.c_energyAssets) {
+ double EnergyUsed_kWh = e.j_ea.getEnergyUsed_kWh();
+ //traceln("EnergyAsset " + e.getIndex() + " of type " + e.p_defaultEnergyAssetPresetName + " used " + EnergyUsed_kWh + " kWh energy");
+ if (EnergyUsed_kWh > 0) {
+ energyConsumed_kWh += EnergyUsed_kWh;
+ } else {
+ energyProduced_kWh -= EnergyUsed_kWh;
+ }
+ }
+ }
+ } else if (a instanceof EnergyCoop) { // 'Recursive' code for Coop-of-Coops. Only supports 2 levels of Coops!
+ EnergyCoop n = (EnergyCoop)a;
+ for(Agent a2 : n.subConnectionsElectricity.getConnections() ) {
+ if(a2 instanceof ConnectionOwner){
+ ConnectionOwner n2 = (ConnectionOwner)a;
+ for ( GridConnection g : n2.gridConnections.getConnections() ) {
+ for (EnergyAsset e : g.c_energyAssets) {
+ double EnergyUsed_kWh = e.j_ea.getEnergyUsed_kWh();
+ //traceln("EnergyAsset " + e.getIndex() + " of type " + e.p_defaultEnergyAssetPresetName + " used " + EnergyUsed_kWh + " kWh energy");
+ if (EnergyUsed_kWh > 0) {
+ energyConsumed_kWh += EnergyUsed_kWh;
+ } else {
+ energyProduced_kWh -= EnergyUsed_kWh;
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+traceln("Energy consumed: "+ energyConsumed_kWh);
+traceln("Energy produced: "+ energyProduced_kWh);
+// TODO: Make sure this calculation is correct when all energy carriers are 'active'! Only checked for electricity
+
+//Total selfconsumption, selfsufficiency
+double totalSelfConsumption_fr = 1 - (v_electricityExported_kWh + v_methaneExported_kWh + v_hydrogenExported_kWh + v_heatExported_kWh)/energyProduced_kWh;
+double totalSelfSufficiency_fr = 1 - (v_electricityImported_kWh + v_methaneImported_kWh + v_hydrogenImported_kWh + v_heatImported_kWh + v_dieselImported_kWh)/energyConsumed_kWh;
+
+double totalSelfSufficiency_fr_check = (energyProduced_kWh - (v_electricityExported_kWh + v_methaneExported_kWh + v_hydrogenExported_kWh + v_heatExported_kWh))/energyConsumed_kWh;
+traceln("Coop selfconsumption: " + totalSelfConsumption_fr + "%");
+traceln("Coop selfsufficiency: " + totalSelfSufficiency_fr + "%, doublecheck " + totalSelfSufficiency_fr_check);
+// TODO: Account for fuel imports/exports!!
+
+
+
+
+ VOID
+ double
+ 1669037224999
+ f_setContractValues
+ 670
+ 140
+
+ false
+ true
+ true
+ if( p_actorContractList != null) {
+ //traceln("Contract list connectionOwner " + p_actorID + ": " + p_actorContractList.toString());
+} else {
+ traceln( "No contract data for connectionOwner " + p_actorID );
+}
+
+double methaneDeliveryPrice_eurpkWh = 0.0;
+double methaneDeliveryTax_eurpkWh = 0.0;
+double methaneVAT_pct = 0.0;
+double hydrogenDeliveryPrice_eurpkWh = 0.0;
+double hydrogenDeliveryTax_eurpkWh = 0.0;
+double hydrogenVAT_pct = 0.0;
+double heatDeliveryPrice_eurpkWh = 0.0;
+double heatDeliveryTax_eurpkWh = 0.0;
+double heatVAT_pct = 0.0;
+
+for( JsonNode contractJson : p_actorContractList) {
+ //traceln("Contract hashmap l: " + l);
+ OL_ContractType contractService = OL_ContractType.valueOf(contractJson.required("contractType").textValue());
+ String contractScope = contractJson.required( "contractScope" ).textValue();
+ OL_EnergyCarriers energyCarrier = OL_EnergyCarriers.valueOf(contractJson.required("energyCarrier").textValue());
+ double annualFee_eur = contractJson.required("annualFee_eur").doubleValue();
+ Actor mySupplier = null;
+ if (energyCarrier.equals(OL_EnergyCarriers.ELECTRICITY)){
+ switch( contractService ) {
+ case DELIVERY:
+ //String contractScope = (String)l.get( "contract_scope" );
+ OL_DeliveryContractType deliveryContractType = OL_DeliveryContractType.valueOf(contractJson.get("deliveryContractType").textValue());
+ double deliveryPrice_eurpkWh = contractJson.required("deliveryPrice_eurpkWh").doubleValue();
+ double feedinPrice_eurpkWh = contractJson.required("feedinPrice_eurpkWh").doubleValue();
+ v_contractDelivery = new J_DeliveryContract(contractScope, deliveryContractType, OL_EnergyCarriers.ELECTRICITY, deliveryPrice_eurpkWh, feedinPrice_eurpkWh, annualFee_eur);
+ //traceln("Delivery contract: " + v_contractDelivery);
+ c_actorContracts.add(v_contractDelivery);
+ break;
+ case TRANSPORT:
+ OL_TransportContractType transportContractType = OL_TransportContractType.valueOf(contractJson.get("transportContractType").textValue());
+ double bandwidthTreshold_kW = contractJson.path("bandwidthTreshold_kW").doubleValue();
+ double bandwidthTariff_eurpkWh = contractJson.path("bandwidthTariff_eurpkWh").doubleValue();
+ v_contractTransport = new J_TransportContract(contractScope, transportContractType, energyCarrier, bandwidthTreshold_kW, bandwidthTariff_eurpkWh, annualFee_eur);
+ c_actorContracts.add(v_contractTransport);
+ break;
+ case CONNECTION:
+ OL_ConnectionContractType connectionContractType = OL_ConnectionContractType.valueOf(contractJson.required("connectionContractType").textValue());
+ //traceln("Initializing connection contract with ConnectionContractType: " + connectionContractType);
+ double nfATOstart_h = contractJson.path("nfATO_starttime_h").doubleValue();
+ double nfATOend_h = contractJson.path("nfATO_endtime_h").doubleValue();
+ double nfATOcapacity_kW = contractJson.path("nfATO_capacity_kW").doubleValue();
+ v_contractConnection = new J_ConnectionContract(contractScope, connectionContractType, energyCarrier, nfATOstart_h, nfATOend_h, nfATOcapacity_kW, annualFee_eur);
+ c_actorContracts.add(v_contractConnection);
+ break;
+ case TAX:
+ double taxDelivery_eurpkWh = contractJson.required("taxDelivery_eurpkWh").doubleValue();
+ double taxFeedin_eurpkWh = contractJson.required("taxFeedin_eurpkWh").doubleValue();
+ double proportionalTax_pct = contractJson.required("proportionalTax_pct").doubleValue();
+ v_contractTax = new J_TaxContract(contractScope, OL_EnergyCarriers.ELECTRICITY, taxDelivery_eurpkWh, taxFeedin_eurpkWh, proportionalTax_pct, annualFee_eur);
+ c_actorContracts.add(v_contractTax);
+ break;
+ default:
+
+ break;
+ }
+ //} else if (energyCarrier.equals(OL_EnergyCarriers.METHANE)){
+ } else {
+ switch( contractService ) {
+ case DELIVERY:
+ OL_DeliveryContractType deliveryContractType = OL_DeliveryContractType.valueOf(contractJson.required("deliveryContractType").textValue());
+ double deliveryPrice_eurpkWh = contractJson.required("deliveryPrice_eurpkWh").doubleValue();
+ double feedinPrice_eurpkWh = contractJson.required("feedinPrice_eurpkWh").doubleValue();
+ J_DeliveryContract contractDelivery = new J_DeliveryContract(contractScope, deliveryContractType, energyCarrier, deliveryPrice_eurpkWh, feedinPrice_eurpkWh, annualFee_eur);
+ //traceln("Delivery contract: " + v_contractDelivery);
+ c_actorContracts.add(contractDelivery);
+ //String contractScope = (String)l.get( "contractScope" );
+ mySupplier = findFirst(energyModel.pop_energySuppliers, p->p.p_actorID.equals(contractScope)) ;
+ if (mySupplier != null) {
+ ((EnergySupplier)mySupplier).f_connectToChild(this);
+ } else {
+ mySupplier = findFirst(energyModel.pop_energyCoops, p->p.p_actorID.equals(contractScope)) ;
+ if (mySupplier != null) {
+ ((EnergyCoop)mySupplier).f_connectToChild(this,energyCarrier);
+ //p_CoopParent = (EnergyCoop)mySupplier;
+ }
+ }
+ //traceln("Methane supplier: " + contractScope + " for actor " + p_actorID );
+ if (mySupplier != null) {
+ //energySupplier.connectTo(mySupplier);
+ if (energyCarrier==OL_EnergyCarriers.METHANE) {
+ p_methaneSupplier = mySupplier;
+ methaneDeliveryPrice_eurpkWh=deliveryPrice_eurpkWh;
+ } else if(energyCarrier==OL_EnergyCarriers.HYDROGEN) {
+ p_hydrogenSupplier = mySupplier;
+ hydrogenDeliveryPrice_eurpkWh=deliveryPrice_eurpkWh;
+ } else if(energyCarrier==OL_EnergyCarriers.HEAT) {
+ p_heatSupplier = mySupplier;
+ heatDeliveryPrice_eurpkWh=deliveryPrice_eurpkWh;
+ }
+ //traceln("MethaneSupplier " + mySupplier);
+ //energySupplier.f_connectToChild(this);
+ } else {
+ traceln("Connection owner --> f_connectToParentActor --> " + energyCarrier + " supplier not found, this should not be happening");
+ }
+ break;
+ case TAX:
+ double DeliveryTax_eurpkWh = contractJson.required("taxDelivery_eurpkWh").doubleValue();
+ double taxFeedin_eurpkWh = contractJson.required("taxFeedin_eurpkWh").doubleValue();
+ double VAT_pct = contractJson.required("proportionalTax_pct").doubleValue();
+ J_TaxContract contractTax = new J_TaxContract(contractScope, energyCarrier, DeliveryTax_eurpkWh, taxFeedin_eurpkWh, VAT_pct, annualFee_eur);
+ c_actorContracts.add(contractTax);
+ if (energyCarrier==OL_EnergyCarriers.METHANE) {
+ methaneDeliveryTax_eurpkWh=DeliveryTax_eurpkWh;
+ methaneVAT_pct=VAT_pct;
+ } else if(energyCarrier==OL_EnergyCarriers.HYDROGEN) {
+ hydrogenDeliveryTax_eurpkWh=DeliveryTax_eurpkWh;
+ hydrogenVAT_pct=VAT_pct;
+ } else if(energyCarrier==OL_EnergyCarriers.HEAT) {
+ heatVAT_pct=VAT_pct;
+ }
+ break;
+ case CONNECTION:
+ OL_ConnectionContractType connectionContractType = OL_ConnectionContractType.valueOf(contractJson.required("connectionContractType").textValue());
+ J_ConnectionContract contractConnection = new J_ConnectionContract(contractScope, connectionContractType, energyCarrier, 0.0, 0.0, 0.0, annualFee_eur);
+ c_actorContracts.add(contractConnection);
+
+
+
+ break;
+ case TRANSPORT:
+ OL_TransportContractType transportContractType = OL_TransportContractType.valueOf(contractJson.required("transportContractType").textValue());
+ double bandwidthTreshold_kW = contractJson.path("bandwidthTreshold_kW").doubleValue();
+ double bandwidthTariff_eurpkWh = contractJson.path("bandwidthTariff_eurpkWh").doubleValue();
+ J_TransportContract contractTransport = new J_TransportContract(contractScope, transportContractType, energyCarrier, bandwidthTreshold_kW, bandwidthTariff_eurpkWh, annualFee_eur);
+ c_actorContracts.add(contractTransport);
+ break;
+ default:
+ traceln("Unrecognized contract type!");
+ break;
+ }
+ }
+}
+
+// Calculate nett gas and hydrogen price
+v_methanePrice_eurpkWh = (methaneDeliveryPrice_eurpkWh + methaneDeliveryTax_eurpkWh) * (1 + methaneVAT_pct);
+v_hydrogenPrice_eurpkWh = (hydrogenDeliveryPrice_eurpkWh + hydrogenDeliveryTax_eurpkWh) * (1 + hydrogenVAT_pct);
+v_heatPrice_eurpkWh = (heatDeliveryPrice_eurpkWh + heatDeliveryTax_eurpkWh) * (1 + heatVAT_pct);
+ /*} else if (energyCarrier.equals(OL_EnergyCarriers.HYDROGEN)){
+ switch( contractService ) {
+ case DELIVERY:
+ OL_DeliveryContractType deliveryContractType = OL_DeliveryContractType.valueOf((String)l.get("deliveryContractType"));
+ double deliveryPrice_eurpkWh = (double)l.get("deliveryPrice_eurpkWh");
+ double feedinPrice_eurpkWh = (double)l.get("feedinPrice_eurpkWh");
+ v_contractDelivery = new J_DeliveryContract(contractScope, deliveryContractType, OL_EnergyCarriers.HYDROGEN, deliveryPrice_eurpkWh, feedinPrice_eurpkWh);
+ //traceln("Delivery contract: " + v_contractDelivery);
+ c_actorContracts.add(v_contractDelivery);
+ mySupplier = findFirst(main.pop_energySuppliers, p->p.p_actorID.equals(contractScope)) ;
+ if (mySupplier != null) {
+ ((EnergySupplier)mySupplier).f_connectToChild(this);
+ } else {
+ mySupplier = findFirst(main.pop_energyCoops, p->p.p_actorID.equals(contractScope)) ;
+ if (mySupplier != null) {
+ ((EnergyCoop)mySupplier).f_connectToChild(this,OL_EnergyCarriers.HYDROGEN);
+ //p_CoopParent = (EnergyCoop)mySupplier;
+ }
+ }
+ if (mySupplier != null) {
+ //energySupplier.connectTo(mySupplier);
+ p_hydrogenSupplier = mySupplier;
+ //energySupplier.f_connectToChild(this);
+ } else {
+ traceln("Connection owner --> f_connectToParentActor --> hydrogen supplier not found, this should not be happening");
+ }
+ break;
+ case TAX:
+ hydrogenDeliveryTax_eurpkWh = (double)l.get("taxDelivery_eurpkWh");
+ //double taxFeedin_eurpkWh = (double)l.get("taxFeedin_eurpkWh");
+ hydrogenVAT_pct = (double)l.get("proportionalTax_pct");
+ v_contractTax = new J_TaxContract(contractScope, OL_EnergyCarriers.HYDROGEN, hydrogenDeliveryTax_eurpkWh, 0, hydrogenVAT_pct);
+ c_actorContracts.add(v_contractTax);
+ break;
+ default:
+
+ break;
+ }
+ } else if (energyCarrier.equals(OL_EnergyCarriers.HEAT)){
+ switch( contractService ) {
+ case DELIVERY:
+ heatDeliveryPrice_eurpkWh = (double)l.get("deliveryPrice_eurpkWh");
+ mySupplier = findFirst(main.pop_energySuppliers, p->p.p_actorID.equals(contractScope)) ;
+ if (mySupplier != null) {
+ ((EnergySupplier)mySupplier).f_connectToChild(this);
+ } else {
+ mySupplier = findFirst(main.pop_energyCoops, p->p.p_actorID.equals(contractScope)) ;
+ if (mySupplier != null) {
+ ((EnergyCoop)mySupplier).f_connectToChild(this,OL_EnergyCarriers.HYDROGEN);
+ //p_CoopParent = (EnergyCoop)mySupplier;
+ }
+ }
+ if (mySupplier != null) {
+ //energySupplier.connectTo(mySupplier);
+ p_hydrogenSupplier = mySupplier;
+ //energySupplier.f_connectToChild(this);
+ } else {
+ traceln("Connection owner --> f_connectToParentActor --> heat supplier not found, this should not be happening");
+ }
+ break;
+ case TAX:
+ hydrogenDeliveryTax_eurpkWh = (double)l.get("taxDelivery_eurpkWh");
+ //double taxFeedin_eurpkWh = (double)l.get("taxFeedin_eurpkWh");
+ hydrogenVAT_pct = (double)l.get("proportionalTax_pct");
+ break;
+ default:
+
+ break;
+ }
+ }*/
+
+
+
+
+ VOID
+ double
+ 1669042410671
+ f_initialize
+ 660
+ 100
+
+ false
+ true
+ true
+ v_liveConnectionMetaData.contractedDeliveryCapacityKnown = true;
+v_liveConnectionMetaData.contractedFeedinCapacityKnown = true;
+v_liveData.activeEnergyCarriers = EnumSet.of(OL_EnergyCarriers.ELECTRICITY);
+v_liveData.activeProductionEnergyCarriers = EnumSet.of(OL_EnergyCarriers.ELECTRICITY);
+v_liveData.activeConsumptionEnergyCarriers= EnumSet.of(OL_EnergyCarriers.ELECTRICITY);
+v_liveData.assetsMetaData.activeAssetFlows.clear();
+v_liveConnectionMetaData.contractedDeliveryCapacity_kW = 0.0;
+v_liveConnectionMetaData.contractedFeedinCapacity_kW = 0.0;
+
+//Get energy carriers and capacities boolean
+for(GridConnection GC:c_memberGridConnections){
+ if(GC.v_isActive){
+ v_liveConnectionMetaData.contractedDeliveryCapacity_kW += GC.v_liveConnectionMetaData.contractedDeliveryCapacity_kW;
+ v_liveConnectionMetaData.contractedFeedinCapacity_kW += GC.v_liveConnectionMetaData.contractedFeedinCapacity_kW;
+ v_liveData.activeEnergyCarriers.addAll(GC.v_liveData.activeEnergyCarriers);
+ v_liveData.activeProductionEnergyCarriers.addAll(GC.v_liveData.activeProductionEnergyCarriers);
+ v_liveData.activeConsumptionEnergyCarriers.addAll(GC.v_liveData.activeConsumptionEnergyCarriers);
+ v_liveData.assetsMetaData.activeAssetFlows.addAll(GC.v_liveData.assetsMetaData.activeAssetFlows);
+
+ if(!GC.v_liveConnectionMetaData.contractedDeliveryCapacityKnown){
+ v_liveConnectionMetaData.contractedDeliveryCapacityKnown = false;
+ }
+
+ if(!GC.v_liveConnectionMetaData.contractedFeedinCapacityKnown){
+ v_liveConnectionMetaData.contractedFeedinCapacityKnown = false;
+ }
+ }
+}
+
+acc_totalOwnElectricityProduction_kW = new ZeroAccumulator(true, energyModel.p_timeStep_h, 8760);
+acc_totalCustomerDelivery_kW = new ZeroAccumulator(true, energyModel.p_timeStep_h, 8760);
+acc_totalCustomerFeedIn_kW = new ZeroAccumulator(true, energyModel.p_timeStep_h, 8760);
+
+//========== LIVE WEEK DATASETS ==========//
+v_liveData.dsm_liveDemand_kW.createEmptyDataSets(v_liveData.activeConsumptionEnergyCarriers, roundToInt(168/energyModel.p_timeStep_h));
+v_liveData.dsm_liveSupply_kW.createEmptyDataSets(v_liveData.activeProductionEnergyCarriers, roundToInt(168/energyModel.p_timeStep_h));
+v_liveData.dsm_liveAssetFlows_kW.createEmptyDataSets(v_liveData.assetsMetaData.activeAssetFlows, roundToInt(168/energyModel.p_timeStep_h));
+
+
+
+ VOID
+ double
+ 1676553303568
+ f_updateIncentives
+ 661
+ 321
+
+ false
+ true
+ true
+ v_electricitySurplusLowPassed_kW += v_lowPassFactor_fr * ( v_electricitySurplus_kW - v_electricitySurplusLowPassed_kW );
+
+/* if (v_contractDelivery.deliveryContractType==OL_DeliveryContractType.ELECTRICITY_VARIABLE) {
+ if (p_electricitySupplier instanceof EnergySupplier) {
+ v_electricityVariablePrice_eurpkWh = ((EnergySupplier)p_electricitySupplier).f_getVariableEnergyPrice();
+ } else if (p_electricitySupplier instanceof EnergyCoop) {
+ v_electricityVariablePrice_eurpkWh = ((EnergyCoop)p_electricitySupplier).f_getVariableEnergyPrice();
+ }
+}
+
+f_setElectricityPriceBands(); */ // temporarily disabled!!
+
+
+
+ VOID
+ double
+ 1676553303571
+ f_setElectricityPriceBands
+ true
+ 681
+ 341
+
+ false
+ true
+ true
+ /*if (v_contractDelivery.deliveryContractType.equals(OL_DeliveryContractType.ELECTRICITY_VARIABLE)) {
+ v_priceBandsDelivery.replace(-9999999.0, v_contractDelivery.feedinPrice_eurpkWh + v_electricityVariablePrice_eurpkWh );
+ v_priceBandsDelivery.replace(9999999.0, v_contractDelivery.deliveryPrice_eurpkWh + v_electricityVariablePrice_eurpkWh );
+}
+if (v_contractTransport.transportContractType.equals(OL_TransportContractType.NODALPRICING)) {
+ v_priceBandsTransport.replace(-9999999.0, v_currentNodalPrice_eurpkWh);
+ v_priceBandsTransport.replace(9999999.0, v_currentNodalPrice_eurpkWh);
+}*/
+
+// Assuming Tax is not varying in time!!
+
+/*
+if( p_capacityTariffApplicable ){
+ v_priceBandsDelivery.replace(- p_capacityLevel_kW, v_electricitySellPrice_eurpkWh + v_currentCongestionTariffWhenSelling_eurpkWh);
+ v_priceBandsDelivery.replace(p_capacityLevel_kW, v_electricityVariablePrice_eurpkWh + v_currentNodalPrice_eurpkWh);
+}
+*/
+
+
+
+
+
+
+ VOID
+ double
+ 1676553472755
+ f_setInitPriceBands
+ true
+ -340
+ 390
+
+ false
+ true
+ true
+ v_priceBandsDelivery = new TreeMap<Double, Double>();
+v_priceBandsDelivery.put(-9999999.0, v_contractDelivery.feedinPrice_eurpkWh);
+v_priceBandsDelivery.put(0.0, 0.0);
+v_priceBandsDelivery.put(9999999.0, v_contractDelivery.deliveryPrice_eurpkWh);
+
+v_priceBandsTransport = new TreeMap<Double, Double>();
+v_priceBandsTransport.put(-9999999.0, 0.0);
+v_priceBandsTransport.put(0.0, 0.0);
+v_priceBandsTransport.put(9999999.0, 0.0);
+
+v_priceBandsTax = new TreeMap<Double, Double>();
+v_priceBandsTax.put(-9999999.0, v_contractTax.feedinTax_eurpkWh);
+v_priceBandsTax.put(0.0, 0.0);
+v_priceBandsTax.put(9999999.0, v_contractTax.deliveryTax_eurpkWh);
+
+/*
+if( p_congestionTariffApplicable ){
+ v_priceBandsDelivery.put(- p_capacityLevel_kW, 0.0);
+ v_priceBandsDelivery.put(p_capacityLevel_kW, 0.0);
+}
+*/
+
+
+ VOID
+ double
+ 1692111928489
+ f_totalFinances
+ true
+ -1080
+ 480
+
+ false
+ true
+ true
+ // Depreciation costs
+v_assetDepreciation_eur = f_totalAssetDepreciation();
+v_totalBalanceCoop_eur -= v_assetDepreciation_eur;
+// Operational costs: local parameter p_yearlyOperationalCosts_eur
+v_totalBalanceCoop_eur -= p_yearlyOperationalCosts_eur;
+// EPEX balance: take from local variable v_balanceElectricityDelivery_eur
+v_totalBalanceCoop_eur += v_balanceElectricity_eur;
+
+// member balance
+f_totalMembersBalance();
+v_totalBalanceCoop_eur += v_balanceMembers_eur;
+
+/*if (energyModel.b_addKpiVisuals) {
+ ch_coopBalance.updateData();
+}*/
+
+
+ RETURNS_VALUE
+ double
+ 1692112062708
+ f_totalAssetDepreciation
+ true
+ -1050
+ 500
+
+ false
+ true
+ true
+ // Sum depreciation costs of assets in own portfolio.
+double depreciationCosts_eur=0;
+
+/*for (Agent a : subConnectionsElectricity.getConnections()) {
+ if(a instanceof ConnectionOwner){
+ ConnectionOwner c = (ConnectionOwner)a;
+ if( c.p_actorGroup.equals("CoopProducer")) {
+ for(J_EA e:c.v_ownedGridConnection.c_energyAssets) {
+
+ double depreciation_eurpkWpa = energyModel.v_assetDepreciation.path(e.energyAssetType.name()).path("Depreciation_eurpkWpa").doubleValue();
+ traceln("Coop Depreciation %s eur/kW/annum", depreciation_eurpkWpa*e.getElectricCapacity_kW());
+ depreciationCosts_eur+= depreciation_eurpkWpa*e.getElectricCapacity_kW();
+ }
+
+ }
+ } else if (a instanceof EnergyCoop) {
+
+ }
+
+}*/ // Deprecated get depreciation per asset from input-json. Use other data-source!
+
+return depreciationCosts_eur;
+
+
+
+
+
+
+ VOID
+ double
+ 1692112229224
+ f_totalMembersBalance
+ true
+ -1050
+ 540
+
+ false
+ true
+ true
+ // Sum financial transactions from all members
+for(Agent a : c_coopMembers ) {
+ if(a instanceof ConnectionOwner){
+ ConnectionOwner n = (ConnectionOwner)a;
+ v_balanceMembers_eur -= n.v_balanceElectricityDelivery_eur;
+
+ } else if (a instanceof EnergyCoop) {
+
+ }
+}
+
+for(Agent a : c_coopCustomers ) {
+ if(a instanceof ConnectionOwner){
+ ConnectionOwner n = (ConnectionOwner)a;
+ v_balanceMembers_eur -= n.v_balanceElectricityDelivery_eur;
+
+ } else if (a instanceof EnergyCoop) {
+
+ }
+}
+
+
+
+
+
+
+
+
+ VOID
+ double
+ 1704371824571
+ f_resetStates
+ 660
+ 40
+
+ false
+ true
+ true
+ v_electricitySurplusLowPassed_kW= 0;
+v_totalOwnElectricityProduction_MWh = 0;
+v_totalCustomerFeedIn_MWh = 0;
+v_totalCustomerDelivery_MWh = 0;
+
+acc_totalOwnElectricityProduction_kW.reset();
+acc_totalCustomerDelivery_kW.reset();
+acc_totalCustomerFeedIn_kW.reset();
+
+v_rapidRunData.resetAccumulators(energyModel.p_runEndTime_h - energyModel.p_runStartTime_h, energyModel.p_timeStep_h, v_liveData.activeEnergyCarriers, v_liveData.activeConsumptionEnergyCarriers, v_liveData.activeProductionEnergyCarriers); //f_initializeAccumulators();
+
+
+
+ VOID
+ double
+ 1715857260657
+ f_updateLiveDataSets
+ 680
+ 240
+
+ false
+ true
+ true
+ //Current timestep
+double currentTime_h = energyModel.t_h-energyModel.p_runStartTime_h;
+
+v_liveData.addTimeStep(currentTime_h,
+ fm_currentBalanceFlows_kW,
+ fm_currentConsumptionFlows_kW,
+ fm_currentProductionFlows_kW,
+ fm_currentAssetFlows_kW,
+ v_currentPrimaryEnergyProduction_kW,
+ v_currentFinalEnergyConsumption_kW,
+ v_currentPrimaryEnergyProductionHeatpumps_kW,
+ v_currentEnergyCurtailed_kW,
+ v_batteryStoredEnergy_kWh/1000
+);
+/*
+ //Current timestep
+ double currentTime_h = energyModel.t_h-energyModel.p_runStartTime_h;
+
+ //Energy carrier flows
+ for (OL_EnergyCarriers EC : v_activeConsumptionEnergyCarriers) {
+ v_liveData.dsm_liveDemand_kW.get(EC).add( currentTime_h, roundToDecimal(fm_currentConsumptionFlows_kW.get(EC), 3) );
+ }
+ for (OL_EnergyCarriers EC : v_activeProductionEnergyCarriers) {
+ v_liveData.dsm_liveSupply_kW.get(EC).add( currentTime_h, roundToDecimal(fm_currentProductionFlows_kW.get(EC), 3) );
+ }
+
+
+ //Electricity balance
+ v_liveData.data_liveElectricityBalance_kW.add(currentTime_h, fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.ELECTRICITY));
+
+
+ //Total demand and supply
+ v_liveData.data_totalDemand_kW.add(currentTime_h, v_currentFinalEnergyConsumption_kW);
+ v_liveData.data_totalSupply_kW.add(currentTime_h, v_currentPrimaryEnergyProduction_kW);
+
+
+ //Live capacity datasets
+ v_liveData.data_gridCapacityDemand_kW.add(currentTime_h, v_liveConnectionMetaData.contractedDeliveryCapacity_kW);
+ v_liveData.data_gridCapacitySupply_kW.add(currentTime_h, -v_liveConnectionMetaData.contractedFeedinCapacity_kW);
+
+
+ //// Gather specific electricity flows from corresponding energy assets
+
+ //Baseload electricity
+ v_liveData.data_baseloadElectricityDemand_kW.add(currentTime_h, roundToDecimal(v_fixedConsumptionElectric_kW, 3));
+
+ //Cooking
+ v_liveData.data_cookingElectricityDemand_kW.add(currentTime_h, roundToDecimal(v_electricHobConsumption_kW, 3));
+
+ //Hydrogen elec consumption
+ v_liveData.data_hydrogenElectricityDemand_kW.add(currentTime_h, roundToDecimal(max(0, v_hydrogenElectricityConsumption_kW), 3));
+
+ //Heatpump elec consumption
+ v_liveData.data_heatPumpElectricityDemand_kW.add(currentTime_h, roundToDecimal(max(0, v_heatPumpElectricityConsumption_kW), 3));
+
+ //EVs
+ v_liveData.data_electricVehicleDemand_kW.add(currentTime_h, roundToDecimal(max(0,v_evChargingPowerElectric_kW), 3));
+ v_liveData.data_V2GSupply_kW.add(currentTime_h, roundToDecimal(max(0, -v_evChargingPowerElectric_kW), 3));
+
+ //Batteries
+ v_liveData.data_batteryCharging_kW.add(currentTime_h, roundToDecimal(max(0, v_batteryPowerElectric_kW), 3));
+ v_liveData.data_batteryDischarging_kW.add(currentTime_h, roundToDecimal(max(0, -v_batteryPowerElectric_kW), 3));
+ v_liveData.data_batteryStoredEnergyLiveWeek_MWh.add(currentTime_h, v_batteryStoredEnergy_kWh/1000);
+ double currentSOC = 0;
+ if(v_liveAssetsMetaData.totalInstalledBatteryStorageCapacity_MWh > 0){
+ currentSOC = (v_batteryStoredEnergy_kWh/1000)/v_liveAssetsMetaData.totalInstalledBatteryStorageCapacity_MWh;
+ }
+ v_liveData.data_batterySOC_fr.add(currentTime_h, roundToDecimal(currentSOC, 3));
+
+ //CHP production
+ v_liveData.data_CHPElectricityProductionLiveWeek_kW.add(currentTime_h, roundToDecimal(v_CHPProductionElectric_kW, 3));
+
+ //PV production
+ v_liveData.data_PVGeneration_kW.add(currentTime_h, roundToDecimal(v_pvProductionElectric_kW, 3));
+
+ //Wind production
+ v_liveData.data_windGeneration_kW.add(currentTime_h, roundToDecimal(v_windProductionElectric_kW, 3));
+
+ //PV production
+ v_liveData.data_PTGeneration_kW.add(currentTime_h, roundToDecimal(v_ptProductionHeat_kW, 3));
+
+ //District heating
+ v_liveData.data_districtHeatDelivery_kW.add(currentTime_h, roundToDecimal(max(0,fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.HEAT)), 3));
+*/
+
+
+ VOID
+ double
+ 1723103918133
+ f_fillAnnualDatasetsOLD
+ true
+ -1040
+ 680
+
+ false
+ true
+ true
+ double v_currentPowerElectricity_kW = - v_electricitySurplus_kW;
+double v_currentPowerMethane_kW = v_methaneVolume_kWh / energyModel.p_timeStep_h;
+double v_currentPowerHydrogen_kW = v_hydrogenVolume_kWh / energyModel.p_timeStep_h;
+double v_currentPowerDiesel_kW = v_dieselVolume_kWh / energyModel.p_timeStep_h;
+double v_currentPowerHeat_kW = v_heatVolume_kWh / energyModel.p_timeStep_h;
+
+//double currentImport_kW = (max(0,v_currentPowerElectricity_kW) + max(0,v_currentPowerHeat_kW) + max(0,v_currentPowerMethane_kW) + max(0,v_currentPowerHydrogen_kW) + max(0,v_currentPowerDiesel_kW));
+//double currentExport_kW = (max(0,-v_currentPowerElectricity_kW) + max(0,-v_currentPowerHeat_kW) + max(0,-v_currentPowerMethane_kW) + max(0,-v_currentPowerHydrogen_kW) + max(0,-v_currentPowerDiesel_kW));
+
+double currentImport_MWh = (max(0,v_electricityVolume_kWh) + max(0,v_heatVolume_kWh) + max(0,v_methaneVolume_kWh) + max(0,v_hydrogenVolume_kWh) + max(0,v_dieselVolume_kWh))/1000;
+double currentExport_MWh = (max(0,-v_electricityVolume_kWh) + max(0,-v_heatVolume_kWh) + max(0,-v_methaneVolume_kWh) + max(0,-v_hydrogenVolume_kWh) + max(0,-v_dieselVolume_kWh))/1000;
+double currentImport_kW = currentImport_MWh * 1000 / energyModel.p_timeStep_h;
+double currentExport_kW = currentExport_MWh * 1000 / energyModel.p_timeStep_h;
+//traceln("ElectricityVolume_kWh: %s kWh, current production: %s kW", v_electricityVolume_kWh, v_currentOwnElectricityProduction_kW);
+v_totalEnergyConsumed_MWh += (v_currentEnergyConsumption_kW * energyModel.p_timeStep_h)/1000;
+v_totalEnergyProduced_MWh += (v_currentEnergyProduction_kW * energyModel.p_timeStep_h)/1000;
+v_totalEnergyCurtailed_MWh += (v_currentEnergyCurtailed_kW * energyModel.p_timeStep_h)/1000;
+
+//data_annualCoopElectricityBalance_kW.add(energyModel.t_h, v_electricitySurplus_kW);
+acc_annualElectricityBalance_kW.addStep( -v_electricitySurplus_kW);
+acc_annualElectricityProduction_kW.addStep( v_currentElectricityProduction_kW);
+acc_annualElectricityConsumption_kW.addStep( v_currentElectricityConsumption_kW);
+acc_annualOwnElectricityProduction_kW.addStep( v_currentOwnElectricityProduction_kW);
+acc_annualCustomerFeedIn_kW.addStep( v_currentCustomerFeedIn_kW);
+
+acc_annualMethaneBalance_kW.addStep( v_methaneVolume_kWh/energyModel.p_timeStep_h);
+acc_annualHydrogenBalance_kW.addStep( v_hydrogenVolume_kWh/energyModel.p_timeStep_h);
+acc_annualDieselBalance_kW.addStep( v_dieselVolume_kWh/energyModel.p_timeStep_h);
+
+// Demand
+v_dailyBaseloadElectricityDemand_kW += v_fixedConsumptionElectric_kW;
+v_dailyHeatPumpElectricityDemand_kW += v_heatPumpElectricityConsumption_kW;
+v_dailyElectricVehicleDemand_kW += max(0,v_evChargingPowerElectric_kW);
+v_dailyBatteriesDemand_kW += max(0,v_batteryPowerElectric_kW);
+v_dailyNaturalGasDemand_kW += max(0, v_currentPowerMethane_kW);
+v_dailyDieselDemand_kW += max(0, v_currentPowerDiesel_kW);
+v_dailyHydrogenDemand_kW += max(0, v_currentPowerHydrogen_kW);
+//v_dailyDistrictHeatDemand_kWh +=
+// Supply
+v_dailyPVGeneration_kW += v_pvProductionElectric_kW;
+v_dailyWindGeneration_kW += v_windProductionElectric_kW;
+v_dailyBatteriesSupply_kW += max(0,-v_batteryPowerElectric_kW);
+v_dailyV2GSupply_kW += -min(0,v_evChargingPowerElectric_kW);
+v_dailyNaturalGasSupply_kW += max(0, -v_currentPowerMethane_kW);
+v_dailyHydrogenSupply_kW += max(0, -v_currentPowerHydrogen_kW);
+
+//v_dailyDistrictHeatSupply_kWh +=
+
+if (energyModel.t_h % 24 == 24-energyModel.p_timeStep_h) {
+ //data_annualElectricityDemand_MWh.add(energyModel.t_h, v_dailyElectricityDemand_kWh/(24 / energyModel.p_timeStep_h));
+ //data_annualElectricitySupply_MWh.add(energyModel.t_h, v_dailyElectricitySupply_kWh/(24 / energyModel.p_timeStep_h));
+ // Demand
+ data_annualBaseloadElectricityDemand_kW.add(energyModel.t_h, v_dailyBaseloadElectricityDemand_kW/(24 / energyModel.p_timeStep_h));
+ data_annualHeatPumpElectricityDemand_kW.add(energyModel.t_h, v_dailyHeatPumpElectricityDemand_kW/(24 / energyModel.p_timeStep_h));
+ data_annualElectricVehicleDemand_kW.add(energyModel.t_h, v_dailyElectricVehicleDemand_kW/(24 / energyModel.p_timeStep_h));
+ data_annualBatteriesDemand_kW.add(energyModel.t_h, v_dailyBatteriesDemand_kW/(24 / energyModel.p_timeStep_h));
+ data_annualNaturalGasDemand_kW.add(energyModel.t_h, v_dailyNaturalGasDemand_kW/(24 / energyModel.p_timeStep_h));
+ data_annualDieselDemand_kW.add(energyModel.t_h, v_dailyDieselDemand_kW/(24 / energyModel.p_timeStep_h));
+ data_annualHydrogenDemand_kW.add(energyModel.t_h, v_dailyHydrogenDemand_kW/(24 / energyModel.p_timeStep_h));
+ //data_annualDistrictHeatSupply_MWh.add(energyModel.t_h, v_dailyDistrictHeatDemand_kWh/(24 / energyModel.p_timeStep_h));
+ // Supply
+ data_annualPVGeneration_kW.add(energyModel.t_h, v_dailyPVGeneration_kW/(24 / energyModel.p_timeStep_h));
+ data_annualWindGeneration_kW.add(energyModel.t_h, v_dailyWindGeneration_kW/(24 / energyModel.p_timeStep_h));
+ data_annualBatteriesSupply_kW.add(energyModel.t_h, v_dailyBatteriesSupply_kW/(24 / energyModel.p_timeStep_h));
+ data_annualV2GSupply_kW.add(energyModel.t_h, v_dailyV2GSupply_kW/(24 / energyModel.p_timeStep_h));
+ data_annualNaturalGasSupply_kW.add(energyModel.t_h, v_dailyNaturalGasSupply_kW/(24 / energyModel.p_timeStep_h));
+ data_annualHydrogenSupply_kW.add(energyModel.t_h, v_dailyHydrogenSupply_kW/(24 / energyModel.p_timeStep_h));
+ //data_annualDistrictHeatSupply_MWh.add(energyModel.t_h, v_dailyDistrictHeatSupply_kWh/(24 / energyModel.p_timeStep_h));
+
+ // Resetting the daily values
+ //v_dailyElectricityDemand_kWh = 0;
+ //v_dailyElectricitySupply_kWh = 0;
+ v_dailyBaseloadElectricityDemand_kW = 0;
+ v_dailyHeatPumpElectricityDemand_kW = 0;
+ v_dailyElectricVehicleDemand_kW = 0;
+ v_dailyBatteriesDemand_kW = 0;
+ v_dailyNaturalGasDemand_kW = 0;
+ v_dailyDieselDemand_kW = 0;
+ v_dailyHydrogenDemand_kW = 0;
+ //v_dailyDistrictHeatDemand_kWh = 0;
+ v_dailyPVGeneration_kW = 0;
+ v_dailyWindGeneration_kW = 0;
+ v_dailyBatteriesSupply_kW = 0;
+ v_dailyV2GSupply_kW = 0;
+ v_dailyNaturalGasSupply_kW = 0;
+ v_dailyHydrogenSupply_kW = 0;
+ //v_dailyDistrictHeatSupply_kWh = 0;
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////
+//Summer week
+if (energyModel.t_h >= energyModel.p_startHourSummerWeek && energyModel.t_h < energyModel.p_startHourSummerWeek + 24*7){
+ data_summerWeekBaseloadElectricityDemand_kW.add(energyModel.t_h, v_fixedConsumptionElectric_kW);
+ data_summerWeekHeatPumpElectricityDemand_kW.add(energyModel.t_h, v_heatPumpElectricityConsumption_kW);
+ data_summerWeekElectricVehicleDemand_kW.add(energyModel.t_h, max(0,v_evChargingPowerElectric_kW));
+ data_summerWeekBatteriesDemand_kW.add(energyModel.t_h, max(0,v_batteryPowerElectric_kW));
+ data_summerWeekNaturalGasDemand_kW.add(energyModel.t_h, max(0, v_currentPowerMethane_kW));
+ data_summerWeekDieselDemand_kW.add(energyModel.t_h, max(0, v_currentPowerDiesel_kW));
+ data_summerWeekHydrogenDemand_kW.add(energyModel.t_h, max(0, v_currentPowerHydrogen_kW));
+
+ data_summerWeekPVGeneration_kW.add(energyModel.t_h, v_pvProductionElectric_kW);
+ data_summerWeekWindGeneration_kW.add(energyModel.t_h, v_windProductionElectric_kW);
+ data_summerWeekBatteriesSupply_kW.add(energyModel.t_h, max(0,-v_batteryPowerElectric_kW));
+ data_summerWeekV2GSupply_kW.add(energyModel.t_h, max(0, -v_evChargingPowerElectric_kW));
+ data_summerWeekNaturalGasSupply_kW.add(energyModel.t_h, max(0, -v_currentPowerMethane_kW));
+ data_summerWeekHydrogenSupply_kW.add(energyModel.t_h, max(0, -v_currentPowerHydrogen_kW));
+
+ acc_summerElectricityBalance_kW.addStep(v_currentPowerElectricity_kW);
+ acc_summerMethaneBalance_kW.addStep(v_currentPowerMethane_kW);
+ acc_summerHydrogenBalance_kW.addStep(v_currentPowerHydrogen_kW);
+ acc_summerDieselBalance_kW.addStep(v_currentPowerDiesel_kW);
+ acc_summerHeatBalance_kW.addStep(v_currentPowerHeat_kW);
+ acc_summerTotalImport_kW.addStep(currentImport_kW);
+ acc_summerTotalExport_kW.addStep(currentExport_kW);
+
+ acc_summerEnergyProduction_kW.addStep(v_currentEnergyProduction_kW);
+ acc_summerEnergyConsumption_kW.addStep(v_currentEnergyConsumption_kW);
+ acc_summerEnergyCurtailed_kW.addStep(v_currentEnergyCurtailed_kW);
+ acc_summerElectricityProduction_kW.addStep(v_currentElectricityProduction_kW);
+ acc_summerElectricityConsumption_kW.addStep(v_currentElectricityConsumption_kW);
+ //acc_summerHeatProduction_kW.addStep(v_currentEnergyProductionHeat_kW);
+
+}
+
+//Winter week
+if (energyModel.t_h >= energyModel.p_startHourWinterWeek && energyModel.t_h < energyModel.p_startHourWinterWeek + 24*7){
+ data_winterWeekBaseloadElectricityDemand_kW.add(energyModel.t_h, v_fixedConsumptionElectric_kW);
+ data_winterWeekHeatPumpElectricityDemand_kW.add(energyModel.t_h, v_heatPumpElectricityConsumption_kW);
+ data_winterWeekElectricVehicleDemand_kW.add(energyModel.t_h, max(0, v_evChargingPowerElectric_kW));
+ data_winterWeekBatteriesDemand_kW.add(energyModel.t_h, max(0, v_batteryPowerElectric_kW));
+ data_winterWeekNaturalGasDemand_kW.add(energyModel.t_h, max(0, v_currentPowerMethane_kW));
+ data_winterWeekDieselDemand_kW.add(energyModel.t_h, max(0, v_currentPowerDiesel_kW));
+ data_winterWeekHydrogenDemand_kW.add(energyModel.t_h, max(0, v_currentPowerHydrogen_kW));
+
+ data_winterWeekPVGeneration_kW.add(energyModel.t_h, v_pvProductionElectric_kW);
+ data_winterWeekWindGeneration_kW.add(energyModel.t_h, v_windProductionElectric_kW);
+ data_winterWeekBatteriesSupply_kW.add(energyModel.t_h, max(0, -v_batteryPowerElectric_kW));
+ data_winterWeekV2GSupply_kW.add(energyModel.t_h, max(0, -v_evChargingPowerElectric_kW));
+ data_winterWeekNaturalGasSupply_kW.add(energyModel.t_h, max(0, -v_currentPowerMethane_kW));
+ data_winterWeekHydrogenSupply_kW.add(energyModel.t_h, max(0, -v_currentPowerHydrogen_kW));
+
+ acc_winterElectricityBalance_kW.addStep(v_currentPowerElectricity_kW);
+ acc_winterMethaneBalance_kW.addStep(v_currentPowerMethane_kW);
+ acc_winterHydrogenBalance_kW.addStep(v_currentPowerHydrogen_kW);
+ acc_winterDieselBalance_kW.addStep(v_currentPowerDiesel_kW);
+ acc_winterHeatBalance_kW.addStep(v_currentPowerHeat_kW);
+ acc_winterTotalImport_kW.addStep(currentImport_kW);
+ acc_winterTotalExport_kW.addStep(currentExport_kW);
+
+ acc_winterEnergyProduction_kW.addStep(v_currentEnergyProduction_kW);
+ acc_winterEnergyConsumption_kW.addStep(v_currentEnergyConsumption_kW);
+ acc_winterEnergyCurtailed_kW.addStep(v_currentEnergyCurtailed_kW);
+ acc_winterElectricityProduction_kW.addStep(v_currentElectricityProduction_kW);
+ acc_winterElectricityConsumption_kW.addStep(v_currentElectricityConsumption_kW);
+ //acc_winterHeatProduction_kW.addStep(v_currentEnergyProductionHeat_kW);
+
+}
+
+// Daytime totals. Use overal-total minus daytime total to get nighttime totals.
+
+if(energyModel.t_h % 24 > 6 && energyModel.t_h % 24 < 18) { // Daytime totals. Use overal-total minus daytime total to get nighttime totals.
+
+ v_daytimeTotalImport_MWh += currentImport_MWh;
+ v_daytimeTotalExport_MWh += currentExport_MWh;
+ v_daytimeEnergyConsumed_MWh += v_currentEnergyConsumption_kW / 1000 * energyModel.p_timeStep_h;
+ v_daytimeEnergyProduced_MWh += v_currentEnergyProduction_kW / 1000 * energyModel.p_timeStep_h;
+
+ v_daytimeMethaneImport_MWh += v_currentPowerMethane_kW / 1000 * energyModel.p_timeStep_h;
+ v_daytimeDieselImport_MWh += v_currentPowerDiesel_kW / 1000 * energyModel.p_timeStep_h;
+ v_daytimeHydrogenImport_MWh += max(0, v_currentPowerHydrogen_kW) / 1000 * energyModel.p_timeStep_h;
+ v_daytimeHydrogenExport_MWh += max(0, -v_currentPowerHydrogen_kW) / 1000 * energyModel.p_timeStep_h;
+
+ v_daytimeElectricityConsumed_MWh += v_currentElectricityConsumption_kW / 1000 * energyModel.p_timeStep_h;
+ v_daytimeElectricityProduced_MWh += v_currentElectricityProduction_kW / 1000 * energyModel.p_timeStep_h;
+ v_daytimeElectricityExport_MWh += max(0,-v_electricityVolume_kWh) /1000;
+ v_daytimeElectricityImport_MWh += max(0,v_electricityVolume_kWh) /1000;
+
+}
+// Weekday totals. Use overal-totals minus weekday totals to get weekend totals.
+if ((energyModel.t_h+(energyModel.v_dayOfWeek1jan - 1)*24) % (24*7) < (24*5)) { // Simulation starts on a Thursday, hence the +3 day offset on t_h
+
+ v_weekdayTotalImport_MWh += currentImport_MWh;
+ v_weekdayTotalExport_MWh += currentExport_MWh;
+
+ v_weekdayEnergyConsumed_MWh += v_currentEnergyConsumption_kW * energyModel.p_timeStep_h/1000;
+ v_weekdayEnergyProduced_MWh += v_currentEnergyProduction_kW * energyModel.p_timeStep_h/1000;
+
+ v_weekdayMethaneImport_MWh += v_currentPowerMethane_kW / 1000 * energyModel.p_timeStep_h;
+ v_weekdayDieselImport_MWh += v_currentPowerDiesel_kW / 1000 * energyModel.p_timeStep_h;
+ v_weekdayHydrogenImport_MWh += max(0, v_currentPowerHydrogen_kW) / 1000 * energyModel.p_timeStep_h;
+ v_weekdayHydrogenExport_MWh += max(0, -v_currentPowerHydrogen_kW) / 1000 * energyModel.p_timeStep_h;
+
+ v_weekdayElectricityConsumed_MWh += v_currentElectricityConsumption_kW / 1000 * energyModel.p_timeStep_h;
+ v_weekdayElectricityProduced_MWh += v_currentElectricityProduction_kW / 1000 * energyModel.p_timeStep_h;
+ v_weekdayElectricityExport_MWh += max(0,-v_electricityVolume_kWh) /1000;
+ v_weekdayElectricityImport_MWh += max(0,v_electricityVolume_kWh) /1000;
+}
+
+
+
+ VOID
+ double
+ 1731081139333
+ f_calculateKPIs
+ 660
+ 360
+
+ false
+ true
+ true
+ //Cumulative KPIs of each grid connection individually
+f_getCumulativeIndividualGCValues();
+
+//Costumer delivery and feedin
+v_totalCustomerFeedIn_MWh = acc_totalCustomerFeedIn_kW.getIntegral_kWh() / 1000;
+v_totalCustomerDelivery_MWh = acc_totalCustomerDelivery_kW.getIntegral_kWh() / 1000;
+v_totalOwnElectricityProduction_MWh = acc_totalOwnElectricityProduction_kW.getIntegral_kWh() / 1000;
+
+
+
+ VOID
+ double
+ 1739970817879
+ f_collectGridConnectionRapidRunData
+ 1010
+ 230
+
+ false
+ true
+ true
+ // Make collective profiles, electricity per timestep, other energy carriers per day!
+
+for (GridConnection gc : c_memberGridConnections) {
+ if(gc.v_isActive){
+ // Totals
+ v_rapidRunData.am_totalBalanceAccumulators_kW.add(gc.v_rapidRunData.am_totalBalanceAccumulators_kW);
+ v_rapidRunData.am_totalHeatFromEnergyCarrier_kW.add(gc.v_rapidRunData.am_totalHeatFromEnergyCarrier_kW);
+ v_rapidRunData.am_totalConsumptionForHeating_kW.add(gc.v_rapidRunData.am_totalConsumptionForHeating_kW);
+ v_rapidRunData.am_dailyAverageConsumptionAccumulators_kW.add(gc.v_rapidRunData.am_dailyAverageConsumptionAccumulators_kW);
+ v_rapidRunData.am_dailyAverageProductionAccumulators_kW.add(gc.v_rapidRunData.am_dailyAverageProductionAccumulators_kW);
+ v_rapidRunData.acc_dailyAverageEnergyProduction_kW.add(gc.v_rapidRunData.acc_dailyAverageEnergyProduction_kW);
+ v_rapidRunData.acc_dailyAverageFinalEnergyConsumption_kW.add(gc.v_rapidRunData.acc_dailyAverageFinalEnergyConsumption_kW);
+ v_rapidRunData.acc_totalEnergyCurtailed_kW.add(gc.v_rapidRunData.acc_totalEnergyCurtailed_kW);
+ v_rapidRunData.acc_totalPrimaryEnergyProductionHeatpumps_kW.add(gc.v_rapidRunData.acc_totalPrimaryEnergyProductionHeatpumps_kW);
+ v_rapidRunData.am_assetFlowsAccumulators_kW.add(gc.v_rapidRunData.am_assetFlowsAccumulators_kW);
+
+ // Daytime
+ v_rapidRunData.acc_daytimeElectricityConsumption_kW.add(gc.v_rapidRunData.acc_daytimeElectricityConsumption_kW);
+ v_rapidRunData.acc_daytimeElectricityProduction_kW.add(gc.v_rapidRunData.acc_daytimeElectricityProduction_kW);
+ v_rapidRunData.acc_daytimeEnergyProduction_kW.add(gc.v_rapidRunData.acc_daytimeEnergyProduction_kW);
+ v_rapidRunData.acc_daytimeFinalEnergyConsumption_kW.add(gc.v_rapidRunData.acc_daytimeFinalEnergyConsumption_kW);
+ v_rapidRunData.am_daytimeImports_kW.add(gc.v_rapidRunData.am_daytimeImports_kW);
+ v_rapidRunData.am_daytimeExports_kW.add(gc.v_rapidRunData.am_daytimeExports_kW);
+ v_rapidRunData.am_daytimeHeatFromEnergyCarrier_kW.add(gc.v_rapidRunData.am_daytimeHeatFromEnergyCarrier_kW);
+ v_rapidRunData.am_daytimeConsumptionForHeating_kW.add(gc.v_rapidRunData.am_daytimeConsumptionForHeating_kW);
+
+ // Weekend
+ v_rapidRunData.acc_weekendElectricityConsumption_kW.add(gc.v_rapidRunData.acc_weekendElectricityConsumption_kW);
+ v_rapidRunData.acc_weekendElectricityProduction_kW.add(gc.v_rapidRunData.acc_weekendElectricityProduction_kW);
+ v_rapidRunData.acc_weekendEnergyProduction_kW.add(gc.v_rapidRunData.acc_weekendEnergyProduction_kW);
+ v_rapidRunData.acc_weekendFinalEnergyConsumption_kW.add(gc.v_rapidRunData.acc_weekendFinalEnergyConsumption_kW);
+ v_rapidRunData.am_weekendImports_kW.add(gc.v_rapidRunData.am_weekendImports_kW);
+ v_rapidRunData.am_weekendExports_kW.add(gc.v_rapidRunData.am_weekendExports_kW);
+ v_rapidRunData.am_weekendHeatFromEnergyCarrier_kW.add(gc.v_rapidRunData.am_weekendHeatFromEnergyCarrier_kW);
+ v_rapidRunData.am_weekendConsumptionForHeating_kW.add(gc.v_rapidRunData.am_weekendConsumptionForHeating_kW);
+
+ // Summerweek
+ v_rapidRunData.am_summerWeekBalanceAccumulators_kW.add(gc.v_rapidRunData.am_summerWeekBalanceAccumulators_kW);
+ v_rapidRunData.am_summerWeekConsumptionAccumulators_kW.add(gc.v_rapidRunData.am_summerWeekConsumptionAccumulators_kW);
+ v_rapidRunData.am_summerWeekProductionAccumulators_kW.add(gc.v_rapidRunData.am_summerWeekProductionAccumulators_kW);
+ v_rapidRunData.am_summerWeekHeatFromEnergyCarrier_kW.add(gc.v_rapidRunData.am_summerWeekHeatFromEnergyCarrier_kW);
+ v_rapidRunData.am_summerWeekConsumptionForHeating_kW.add(gc.v_rapidRunData.am_summerWeekConsumptionForHeating_kW);
+ v_rapidRunData.acc_summerWeekEnergyProduction_kW.add(gc.v_rapidRunData.acc_summerWeekEnergyProduction_kW);
+ v_rapidRunData.acc_summerWeekFinalEnergyConsumption_kW.add(gc.v_rapidRunData.acc_summerWeekFinalEnergyConsumption_kW);
+ v_rapidRunData.acc_summerWeekEnergyCurtailed_kW.add(gc.v_rapidRunData.acc_summerWeekEnergyCurtailed_kW);
+ v_rapidRunData.acc_summerWeekPrimaryEnergyProductionHeatpumps_kW.add(gc.v_rapidRunData.acc_summerWeekPrimaryEnergyProductionHeatpumps_kW);
+ v_rapidRunData.am_assetFlowsSummerWeek_kW.add(gc.v_rapidRunData.am_assetFlowsSummerWeek_kW);
+
+ // Winterweek
+ v_rapidRunData.am_winterWeekBalanceAccumulators_kW.add(gc.v_rapidRunData.am_winterWeekBalanceAccumulators_kW);
+ v_rapidRunData.am_winterWeekConsumptionAccumulators_kW.add(gc.v_rapidRunData.am_winterWeekConsumptionAccumulators_kW);
+ v_rapidRunData.am_winterWeekProductionAccumulators_kW.add(gc.v_rapidRunData.am_winterWeekProductionAccumulators_kW);
+ v_rapidRunData.am_winterWeekHeatFromEnergyCarrier_kW.add(gc.v_rapidRunData.am_winterWeekHeatFromEnergyCarrier_kW);
+ v_rapidRunData.am_winterWeekConsumptionForHeating_kW.add(gc.v_rapidRunData.am_winterWeekConsumptionForHeating_kW);
+ v_rapidRunData.acc_winterWeekEnergyProduction_kW.add(gc.v_rapidRunData.acc_winterWeekEnergyProduction_kW);
+ v_rapidRunData.acc_winterWeekFinalEnergyConsumption_kW.add(gc.v_rapidRunData.acc_winterWeekFinalEnergyConsumption_kW);
+ v_rapidRunData.acc_winterWeekEnergyCurtailed_kW.add(gc.v_rapidRunData.acc_winterWeekEnergyCurtailed_kW);
+ v_rapidRunData.acc_winterWeekPrimaryEnergyProductionHeatpumps_kW.add(gc.v_rapidRunData.acc_winterWeekPrimaryEnergyProductionHeatpumps_kW);
+ v_rapidRunData.am_assetFlowsWinterWeek_kW.add(gc.v_rapidRunData.am_assetFlowsWinterWeek_kW);
+ }
+}
+
+// This is only true because we have no customers and only members of the Coop for this implementation
+acc_totalOwnElectricityProduction_kW = v_rapidRunData.am_dailyAverageProductionAccumulators_kW.get(OL_EnergyCarriers.ELECTRICITY);
+//acc_summerWeekOwnElectricityProduction_kW = am_summerWeekProductionAccumulators_kW.get(OL_EnergyCarriers.ELECTRICITY);
+//acc_winterWeekOwnElectricityProduction_kW = am_winterWeekProductionAccumulators_kW.get(OL_EnergyCarriers.ELECTRICITY);
+
+//Calculate cumulative asset capacities
+f_getTotalInstalledCapacityOfAssets_rapidRun();
+
+
+
+ VOID
+ double
+ 1739974426481
+ f_initializeCustomCoop
+ 980
+ 120
+
+ false
+ true
+ true
+
+ gcList
+ List<GridConnection>
+
+ c_memberGridConnections.addAll(gcList);
+
+//Basic initialization
+f_initialize();
+
+//Collect live datasets
+f_collectGridConnectionLiveData();
+
+boolean allGCHaveRapidRun = true;
+boolean allGCHaveOriginalRapidRun = true;
+for(GridConnection GC : c_memberGridConnections){
+ if(GC.v_rapidRunData == null && GC.v_isActive){
+ allGCHaveRapidRun = false;
+ }
+ if(GC.v_originalRapidRunData == null && GC.v_isActive){
+ allGCHaveOriginalRapidRun = false;
+ }
+ if(!allGCHaveRapidRun && !allGCHaveOriginalRapidRun){
+ break;
+ }
+}
+
+if(allGCHaveRapidRun){
+
+ //Create rapid run data class used to store combined values of the members
+ f_createAndInitializeRapidRunDataClass();
+
+ //Collect current totals
+ f_collectGridConnectionRapidRunData();
+
+ //Calculate KPIs
+ f_calculateKPIs();
+}
+
+if(allGCHaveOriginalRapidRun){
+
+ //Create rapid run data class used to store combined values of the members
+ f_createAndInitializeOriginalRapidRunDataClass();
+
+ //Collect current totals
+ f_collectGridConnectionOriginalRapidRunData();
+
+ //Calculate orignial KPIs
+ f_getOriginalCumulativeIndividualGCValues();
+}
+
+
+ RETURNS_VALUE
+ double
+ 1740059187265
+ f_getGroupContractDeliveryCapacity_kW
+ 660
+ 430
+
+ false
+ true
+ true
+
+ rapidRunData
+ J_RapidRunData
+
+ DataSet data_netbelastingDuurkromme_kW = rapidRunData.getLoadDurationCurves(energyModel).ds_loadDurationCurveTotal_kW;
+int arraySize = data_netbelastingDuurkromme_kW.size();
+if (arraySize < 8760/energyModel.p_timeStep_h){
+ traceln("GroupContractDeliveryCapacity is zero because simulation is less than a full year long!");
+ return 0.0;
+} else {
+ return max(0,data_netbelastingDuurkromme_kW.getY(roundToInt(0.25*35/energyModel.p_timeStep_h)));
+}
+
+
+ RETURNS_VALUE
+ double
+ 1740059261369
+ f_getGroupContractFeedinCapacity_kW
+ 660
+ 450
+
+ false
+ true
+ true
+
+ rapidRunData
+ J_RapidRunData
+
+ DataSet data_netbelastingDuurkromme_kW = rapidRunData.getLoadDurationCurves(energyModel).ds_loadDurationCurveTotal_kW;
+int arraySize = data_netbelastingDuurkromme_kW.size();
+if (arraySize < 8760/energyModel.p_timeStep_h){
+ traceln("GroupContractDeliveryCapacity is zero because simulation is less than a full year long!");
+ return 0.0;
+} else {
+ return -min(0,data_netbelastingDuurkromme_kW.getY(arraySize-roundToInt(0.25*35/energyModel.p_timeStep_h)));
+}
+
+
+ VOID
+ double
+ 1740475013848
+ f_getCumulativeIndividualGCValues
+ 1430
+ 710
+
+ false
+ true
+ true
+ //Self consumption and sufficiency
+v_cumulativeIndividualSelfconsumptionElectricity_MWh = 0;
+v_cumulativeIndividualSelfconsumptionElectricity_fr = 0;
+v_cumulativeIndividualSelfSufficiencyElectricity_fr = 0;
+
+v_cumulativeIndividualSelfconsumptionEnergy_MWh = 0;
+v_cumulativeIndividualSelfconsumptionEnergy_fr = 0;
+v_cumulativeIndividualSelfSufficiencyEnergy_fr = 0;
+
+//Max peaks
+v_cumulativeIndividualPeakDelivery_kW = 0;
+v_cumulativeIndividualPeakFeedin_kW = 0;
+
+v_cumulativeIndividualPeakDeliveryOriginal_kW = 0;
+v_cumulativeIndividualPeakFeedinOriginal_kW = 0;
+
+
+//Loop over membered grid connections
+for(GridConnection GC : c_memberGridConnections){
+ if(GC.v_isActive){
+ //Add self consumption of gc individually
+ v_cumulativeIndividualSelfconsumptionElectricity_MWh += GC.v_rapidRunData.getTotalElectricitySelfConsumed_MWh();
+ v_cumulativeIndividualSelfconsumptionEnergy_MWh += GC.v_rapidRunData.getTotalEnergySelfConsumed_MWh();
+
+ //Add all peaks for member grid connections
+ v_cumulativeIndividualPeakDelivery_kW += GC.v_rapidRunData.getPeakDelivery_kW();
+ v_cumulativeIndividualPeakFeedin_kW += GC.v_rapidRunData.getPeakFeedin_kW();
+
+ if(v_originalRapidRunData != null && GC.v_originalRapidRunData != null){
+ v_cumulativeIndividualPeakDeliveryOriginal_kW += GC.v_originalRapidRunData.getPeakDelivery_kW();
+ v_cumulativeIndividualPeakFeedinOriginal_kW += GC.v_originalRapidRunData.getPeakFeedin_kW();
+ }
+ }
+}
+
+//Add all max peaks of GC
+
+//Do this also for the 'child' coops
+for(Agent a : c_coopMembers ) { // Take 'behind the meter' production and consumption!
+ if (a instanceof EnergyCoop) {
+ EnergyCoop EC = (EnergyCoop)a;
+ EC.f_getCumulativeIndividualGCValues();
+ v_cumulativeIndividualSelfconsumptionElectricity_MWh += EC.v_cumulativeIndividualSelfconsumptionElectricity_MWh;
+ v_cumulativeIndividualPeakDelivery_kW += EC.v_cumulativeIndividualPeakDelivery_kW;
+ v_cumulativeIndividualPeakFeedin_kW += EC.v_cumulativeIndividualPeakFeedin_kW;
+
+ if(v_originalRapidRunData != null && EC.v_originalRapidRunData != null){
+ v_cumulativeIndividualPeakDeliveryOriginal_kW += EC.v_cumulativeIndividualPeakDeliveryOriginal_kW;
+ v_cumulativeIndividualPeakFeedinOriginal_kW += EC.v_cumulativeIndividualPeakFeedinOriginal_kW;
+ }
+ }
+}
+
+v_cumulativeIndividualSelfconsumptionElectricity_fr = v_rapidRunData.getTotalElectricityProduced_MWh() > 0 ? v_cumulativeIndividualSelfconsumptionElectricity_MWh / v_rapidRunData.getTotalElectricityProduced_MWh() : 0;
+v_cumulativeIndividualSelfSufficiencyElectricity_fr = v_rapidRunData.getTotalElectricityConsumed_MWh() > 0 ? v_cumulativeIndividualSelfconsumptionElectricity_MWh / v_rapidRunData.getTotalElectricityConsumed_MWh() : 0;
+
+v_cumulativeIndividualSelfconsumptionEnergy_fr = v_rapidRunData.getTotalEnergyProduced_MWh() > 0 ? v_cumulativeIndividualSelfconsumptionEnergy_MWh / v_rapidRunData.getTotalEnergyProduced_MWh() : 0;
+v_cumulativeIndividualSelfSufficiencyEnergy_fr = v_rapidRunData.getTotalEnergyConsumed_MWh() > 0 ? v_cumulativeIndividualSelfconsumptionEnergy_MWh / v_rapidRunData.getTotalEnergyConsumed_MWh() : 0;
+
+
+
+ VOID
+ double
+ 1740480839774
+ f_getTotalInstalledCapacityOfAssets_rapidRun
+ 1030
+ 250
+
+ false
+ true
+ true
+ //Collect rapid run asset totals
+v_rapidRunData.assetsMetaData.totalInstalledWindPower_kW = 0.0;
+v_rapidRunData.assetsMetaData.totalInstalledPVPower_kW = 0.0;
+v_rapidRunData.assetsMetaData.totalInstalledBatteryStorageCapacity_MWh = 0.0;
+
+//Add all battery storage capacities of gc
+for(GridConnection GC : c_memberGridConnections){
+ if(GC.v_isActive){
+ v_rapidRunData.assetsMetaData.totalInstalledWindPower_kW += GC.v_rapidRunData.assetsMetaData.totalInstalledWindPower_kW;
+ v_rapidRunData.assetsMetaData.totalInstalledPVPower_kW += GC.v_rapidRunData.assetsMetaData.totalInstalledPVPower_kW;
+ v_rapidRunData.assetsMetaData.totalInstalledBatteryStorageCapacity_MWh += GC.v_rapidRunData.assetsMetaData.totalInstalledBatteryStorageCapacity_MWh;
+ }
+}
+
+//Do this also for the 'child' coops
+for(Agent a : c_coopMembers ) { // Take 'behind the meter' production and consumption!
+ if (a instanceof EnergyCoop) {
+ EnergyCoop EC = (EnergyCoop)a;
+ EC.f_getTotalInstalledCapacityOfAssets_rapidRun();
+ v_rapidRunData.assetsMetaData.totalInstalledWindPower_kW += EC.v_rapidRunData.assetsMetaData.totalInstalledWindPower_kW;
+ v_rapidRunData.assetsMetaData.totalInstalledPVPower_kW += EC.v_rapidRunData.assetsMetaData.totalInstalledPVPower_kW;
+ v_rapidRunData.assetsMetaData.totalInstalledBatteryStorageCapacity_MWh += EC.v_rapidRunData.assetsMetaData.totalInstalledBatteryStorageCapacity_MWh;
+ }
+}
+
+
+ RETURNS_VALUE
+ ArrayList<GridConnection>
+ 1740492770316
+ f_getAllChildMemberGridConnections
+ Function that gets all grid nodes and the children of those grid nodes, etc. All the way to the bottom node.
+ 60
+ 310
+
+ false
+ true
+ true
+ return new ArrayList(f_getAllChildMemberGridConnections_recursion(new HashSet<GridConnection>()));
+
+
+ RETURNS_VALUE
+ HashSet<GridConnection>
+ 1740492770320
+ f_getAllChildMemberGridConnections_recursion
+ Recursion Function that gets all grid nodes and the children of those grid nodes, etc. All the way to the bottom node. For basic use should be called with an empty list!
+ 80
+ 330
+
+ false
+ true
+ true
+
+ allMemberGridConnections
+ HashSet<GridConnection>
+
+ //Add to collection
+allMemberGridConnections.addAll(this.c_memberGridConnections);
+
+//Recursive loop (repeat this function till bottom)
+List<Actor> childCoops = findAll(c_coopMembers, coopMember -> coopMember instanceof EnergyCoop);
+
+if(childCoops.size() == 0){
+ return allMemberGridConnections;
+}
+else{
+ for(Agent childCoop : childCoops){
+ ((EnergyCoop)childCoop).f_getAllChildMemberGridConnections_recursion(allMemberGridConnections);
+ }
+ return allMemberGridConnections;
+}
+
+
+
+ RETURNS_VALUE
+ ArrayList<GridConnection>
+ 1740493169961
+ f_getAllChildCustomerGridConnections
+ 60
+ 420
+
+ false
+ true
+ true
+ return new ArrayList(f_getAllChildCustomerGridConnections_recursion(new HashSet<GridConnection>()));
+
+
+ RETURNS_VALUE
+ HashSet<GridConnection>
+ 1740493169963
+ f_getAllChildCustomerGridConnections_recursion
+ 80
+ 440
+
+ false
+ true
+ true
+
+ allCustomerGridConnections
+ HashSet<GridConnection>
+
+ //Add to collection
+allCustomerGridConnections.addAll(this.c_customerGridConnections);
+
+//Recursive loop (repeat this function till bottom)
+List<Actor> childCoops = findAll(c_coopCustomers, coopCustomer -> coopCustomer instanceof EnergyCoop);
+if(childCoops.size() == 0){
+ return allCustomerGridConnections;
+}
+else{
+ for(Agent childCoop : childCoops){
+ ((EnergyCoop)childCoop).f_getAllChildCustomerGridConnections_recursion(allCustomerGridConnections);
+ }
+ return allCustomerGridConnections;
+}
+
+
+
+ VOID
+ double
+ 1740502128180
+ f_collectGridConnectionLiveData
+ 990
+ 140
+
+ false
+ true
+ true
+ List<GridConnection> gcList = findAll(f_getAllChildMemberGridConnections(), gc -> gc.v_isActive);
+
+int liveWeekSize = gcList.get(0).v_liveData.data_gridCapacityDemand_kW.size();
+
+for (int i=0; i < liveWeekSize; i++){
+
+ double timeAxisValue = gcList.get(0).v_liveData.data_gridCapacityDemand_kW.getX(i); // we get the X value from a random dataset
+
+ // Demand
+ J_FlowsMap fm_demand_kW = new J_FlowsMap();
+ J_ValueMap<OL_AssetFlowCategories> fm_currentAssetFlows_kW = new J_ValueMap(OL_AssetFlowCategories.class);
+
+ double electricityDemandCapacityLiveWeek_kW = 0;
+ double electricitySupplyCapacityLiveWeek_kW = 0;
+ double netLoadLiveWeek_kW = 0;
+
+ double districtHeatingDemandLiveWeek_kW = 0;
+
+ // Supply
+ J_FlowsMap fm_supply_kW = new J_FlowsMap();
+
+ //Other
+ double batteryStoredEnergyLiveWeek_MWh = 0;
+
+ for (GridConnection gc : gcList){
+ for (OL_EnergyCarriers EC_consumption : gc.v_liveData.activeConsumptionEnergyCarriers) {
+ fm_demand_kW.addFlow( EC_consumption, gc.v_liveData.dsm_liveDemand_kW.get(EC_consumption).getY(i));
+ }
+ for (OL_EnergyCarriers EC_production : gc.v_liveData.activeProductionEnergyCarriers) {
+ fm_supply_kW.addFlow( EC_production, gc.v_liveData.dsm_liveSupply_kW.get(EC_production).getY(i));
+ }
+ for (OL_AssetFlowCategories AC : gc.v_liveAssetsMetaData.activeAssetFlows) {
+ fm_currentAssetFlows_kW.addFlow(AC, gc.v_liveData.dsm_liveAssetFlows_kW.get(AC).getY(i));
+ }
+
+ electricityDemandCapacityLiveWeek_kW += gc.v_liveData.data_gridCapacityDemand_kW.getY(i);
+ electricitySupplyCapacityLiveWeek_kW += gc.v_liveData.data_gridCapacitySupply_kW.getY(i);
+ netLoadLiveWeek_kW += gc.v_liveData.data_liveElectricityBalance_kW.getY(i);
+
+ //Other
+ batteryStoredEnergyLiveWeek_MWh += gc.v_liveData.data_batteryStoredEnergyLiveWeek_MWh.getY(i);
+ }
+
+ for (OL_EnergyCarriers EC_consumption : v_liveData.activeConsumptionEnergyCarriers) {
+ v_liveData.dsm_liveDemand_kW.get(EC_consumption).add(timeAxisValue, roundToDecimal(fm_demand_kW.get(EC_consumption), 3));
+ }
+ for (OL_EnergyCarriers EC_production : v_liveData.activeProductionEnergyCarriers) {
+ v_liveData.dsm_liveSupply_kW.get(EC_production).add(timeAxisValue, roundToDecimal(fm_supply_kW.get(EC_production), 3));
+ }
+
+ for (OL_AssetFlowCategories AC : fm_currentAssetFlows_kW.keySet()) {
+ v_liveData.dsm_liveAssetFlows_kW.get(AC).add(timeAxisValue, roundToDecimal(fm_currentAssetFlows_kW.get(AC), 3));
+ }
+
+ v_liveData.data_gridCapacityDemand_kW.add(timeAxisValue, electricityDemandCapacityLiveWeek_kW);
+ v_liveData.data_gridCapacitySupply_kW.add(timeAxisValue, electricitySupplyCapacityLiveWeek_kW);
+ v_liveData.data_liveElectricityBalance_kW.add(timeAxisValue, netLoadLiveWeek_kW);
+
+ //Stored
+ v_liveData.data_batteryStoredEnergyLiveWeek_MWh.add(timeAxisValue, batteryStoredEnergyLiveWeek_MWh);
+}
+
+
+//Calculate cumulative asset capacities
+f_getTotalInstalledCapacityOfAssets_live();
+
+//Recalculate SOC ts for energycoop
+f_recalculateSOCDataSet_live();
+
+
+
+ VOID
+ double
+ 1741626527076
+ f_rapidRunDataLogging
+ 680
+ 260
+
+ false
+ true
+ true
+ // EnergyCoop specific
+acc_totalOwnElectricityProduction_kW.addStep( v_currentOwnElectricityProduction_kW );
+acc_totalCustomerDelivery_kW.addStep( v_currentCustomerDelivery_kW );
+acc_totalCustomerFeedIn_kW.addStep( v_currentCustomerFeedIn_kW );
+
+//Run rapid data logging
+v_rapidRunData.addTimeStep(fm_currentBalanceFlows_kW,
+ fm_currentConsumptionFlows_kW,
+ fm_currentProductionFlows_kW,
+ fm_heatFromEnergyCarrier_kW,
+ fm_consumptionForHeating_kW,
+ fm_currentAssetFlows_kW,
+ v_currentPrimaryEnergyProduction_kW,
+ v_currentFinalEnergyConsumption_kW,
+ v_currentPrimaryEnergyProductionHeatpumps_kW,
+ v_currentEnergyCurtailed_kW,
+ v_batteryStoredEnergy_kWh/1000,
+ energyModel);
+
+
+ VOID
+ double
+ 1744211359139
+ f_getTotalInstalledCapacityOfAssets_live
+ 1010
+ 160
+
+ false
+ true
+ true
+ //Collect live asset totals
+v_liveAssetsMetaData.totalInstalledWindPower_kW = 0.0;
+v_liveAssetsMetaData.totalInstalledPVPower_kW = 0.0;
+v_liveAssetsMetaData.totalInstalledBatteryStorageCapacity_MWh = 0.0;
+
+//Add all battery storage capacities of gc
+for(GridConnection GC : c_memberGridConnections){
+ if(GC.v_isActive){
+ v_liveAssetsMetaData.totalInstalledWindPower_kW += GC.v_liveAssetsMetaData.totalInstalledWindPower_kW;
+ v_liveAssetsMetaData.totalInstalledPVPower_kW += GC.v_liveAssetsMetaData.totalInstalledPVPower_kW;
+ v_liveAssetsMetaData.totalInstalledBatteryStorageCapacity_MWh += GC.v_liveAssetsMetaData.totalInstalledBatteryStorageCapacity_MWh;
+ }
+}
+
+//Do this also for the 'child' coops
+for(Agent a : c_coopMembers ) { // Take 'behind the meter' production and consumption!
+ if (a instanceof EnergyCoop) {
+ EnergyCoop EC = (EnergyCoop)a;
+ EC.f_getTotalInstalledCapacityOfAssets_live();
+ v_liveAssetsMetaData.totalInstalledWindPower_kW += EC.v_liveAssetsMetaData.totalInstalledWindPower_kW;
+ v_liveAssetsMetaData.totalInstalledPVPower_kW += EC.v_liveAssetsMetaData.totalInstalledPVPower_kW;
+ v_liveAssetsMetaData.totalInstalledBatteryStorageCapacity_MWh += EC.v_liveAssetsMetaData.totalInstalledBatteryStorageCapacity_MWh;
+ }
+}
+
+
+ VOID
+ double
+ 1744271942642
+ f_recalculateSOCDataSet_live
+ 1010
+ 180
+
+ false
+ true
+ true
+ double totalInstalledBatteryStorageCapacity_MWh = v_liveAssetsMetaData.totalInstalledBatteryStorageCapacity_MWh;
+
+
+double currentSOC = 0;
+int liveWeekSize = v_liveData.data_batteryStoredEnergyLiveWeek_MWh.size();
+
+for (int i=0; i < liveWeekSize; i++){
+ if(totalInstalledBatteryStorageCapacity_MWh > 0){
+ currentSOC = v_liveData.data_batteryStoredEnergyLiveWeek_MWh.getY(i)/totalInstalledBatteryStorageCapacity_MWh;
+ }
+ else{
+ currentSOC = 0;
+ }
+ v_liveData.data_batterySOC_fr.add(v_liveData.data_batteryStoredEnergyLiveWeek_MWh.getX(i), roundToDecimal(currentSOC, 3));
+}
+
+
+ VOID
+ double
+ 1753348770752
+ f_startAfterDeserialisation
+ true
+ 980
+ 70
+
+ false
+ true
+ true
+ v_liveData = new J_LiveData(this);
+v_liveData.activeEnergyCarriers = EnumSet.of(OL_EnergyCarriers.ELECTRICITY);
+v_liveData.activeProductionEnergyCarriers = EnumSet.of(OL_EnergyCarriers.ELECTRICITY);
+v_liveData.activeConsumptionEnergyCarriers= EnumSet.of(OL_EnergyCarriers.ELECTRICITY);
+
+v_liveData.connectionMetaData = v_liveConnectionMetaData;
+v_liveData.assetsMetaData = v_liveAssetsMetaData;
+
+v_liveData.resetLiveDatasets(energyModel.p_runStartTime_h, energyModel.p_runStartTime_h + 24 * 7, energyModel.p_timeStep_h);
+
+for (GridConnection gc : c_memberGridConnections) {
+ for (OL_EnergyCarriers EC : gc.v_liveData.activeProductionEnergyCarriers) {
+ f_addProductionEnergyCarrier(EC);
+ }
+ for (OL_EnergyCarriers EC : gc.v_liveData.activeConsumptionEnergyCarriers) {
+ f_addConsumptionEnergyCarrier(EC);
+ }
+}
+
+fm_currentProductionFlows_kW = new J_FlowsMap();
+fm_currentConsumptionFlows_kW = new J_FlowsMap();
+fm_currentBalanceFlows_kW = new J_FlowsMap();
+fm_currentAssetFlows_kW = new J_ValueMap(OL_AssetFlowCategories.class);
+
+
+
+ VOID
+ EnergyCoop
+ 1754380102233
+ f_addConsumptionEnergyCarrier
+ 1438
+ 536
+
+ false
+ true
+ true
+
+ EC
+ OL_EnergyCarriers
+
+ if (!v_liveData.activeConsumptionEnergyCarriers.contains(EC)) {
+ v_liveData.activeEnergyCarriers.add(EC);
+ v_liveData.activeConsumptionEnergyCarriers.add(EC);
+
+ DataSet dsDemand = new DataSet( (int)(168 / energyModel.p_timeStep_h) );
+
+ double startTime = v_liveData.dsm_liveDemand_kW.get(OL_EnergyCarriers.ELECTRICITY).getXMin();
+ double endTime = v_liveData.dsm_liveDemand_kW.get(OL_EnergyCarriers.ELECTRICITY).getXMax();
+ for (double t = startTime; t <= endTime; t += energyModel.p_timeStep_h) {
+ dsDemand.add( t, 0);
+ }
+ v_liveData.dsm_liveDemand_kW.put( EC, dsDemand);
+}
+
+
+ VOID
+ EnergyCoop
+ 1754380102235
+ f_addProductionEnergyCarrier
+ 1438
+ 556
+
+ false
+ true
+ true
+
+ EC
+ OL_EnergyCarriers
+
+ if (!v_liveData.activeProductionEnergyCarriers.contains(EC)) {
+ v_liveData.activeEnergyCarriers.add(EC);
+ v_liveData.activeProductionEnergyCarriers.add(EC);
+
+ DataSet dsSupply = new DataSet( (int)(168 / energyModel.p_timeStep_h) );
+ double startTime = v_liveData.dsm_liveDemand_kW.get(OL_EnergyCarriers.ELECTRICITY).getXMin();
+ double endTime = v_liveData.dsm_liveDemand_kW.get(OL_EnergyCarriers.ELECTRICITY).getXMax();
+ for (double t = startTime; t <= endTime; t += energyModel.p_timeStep_h) {
+ dsSupply.add( t, 0);
+ }
+ v_liveData.dsm_liveSupply_kW.put( EC, dsSupply);
+}
+
+
+ VOID
+ EnergyCoop
+ 1754380102237
+ f_addAssetFlow
+ 1438
+ 576
+
+ false
+ true
+ true
+
+ AC
+ OL_AssetFlowCategories
+
+ if (!v_liveAssetsMetaData.activeAssetFlows.contains(AC)) {
+ v_liveAssetsMetaData.activeAssetFlows.add(AC);
+
+ DataSet dsAsset = new DataSet( (int)(168 / energyModel.p_timeStep_h) );
+
+ double startTime = v_liveData.dsm_liveDemand_kW.get(OL_EnergyCarriers.ELECTRICITY).getXMin();
+ double endTime = v_liveData.dsm_liveDemand_kW.get(OL_EnergyCarriers.ELECTRICITY).getXMax();
+ for (double t = startTime; t <= endTime; t += energyModel.p_timeStep_h) {
+ dsAsset.add( t, 0);
+ }
+ v_liveData.dsm_liveAssetFlows_kW.put( AC, dsAsset);
+
+ if (AC == OL_AssetFlowCategories.batteriesChargingPower_kW) { // also add batteriesDischarging!
+ dsAsset = new DataSet( (int)(168 / energyModel.p_timeStep_h) );
+
+ for (double t = startTime; t <= endTime; t += energyModel.p_timeStep_h) {
+ dsAsset.add( t, 0);
+ }
+ v_liveData.dsm_liveAssetFlows_kW.put( OL_AssetFlowCategories.batteriesDischargingPower_kW, dsAsset);
+ }
+ if (AC == OL_AssetFlowCategories.V2GPower_kW && !v_liveAssetsMetaData.activeAssetFlows.contains(OL_AssetFlowCategories.evChargingPower_kW)) { // also add evCharging!
+ dsAsset = new DataSet( (int)(168 / energyModel.p_timeStep_h) );
+
+ for (double t = startTime; t <= endTime; t += energyModel.p_timeStep_h) {
+ dsAsset.add( t, 0);
+ }
+ v_liveData.dsm_liveAssetFlows_kW.put( OL_AssetFlowCategories.evChargingPower_kW, dsAsset);
+ }
+}
+
+
+ VOID
+ double
+ 1754666678297
+ f_createAndInitializeRapidRunDataClass
+ 990
+ 210
+
+ false
+ true
+ true
+ //Create rapid run data class used to collect rapid run data of other gc
+v_rapidRunData = new J_RapidRunData(this);
+v_rapidRunData.assetsMetaData = v_liveAssetsMetaData.getClone();
+
+EnumSet<OL_EnergyCarriers> activeEnergyCarriers_rapidRun = EnumSet.copyOf(v_liveData.activeEnergyCarriers);
+EnumSet<OL_EnergyCarriers> activeConsumptionEnergyCarriers_rapidRun = EnumSet.copyOf(v_liveData.activeConsumptionEnergyCarriers);
+EnumSet<OL_EnergyCarriers> activeProductionEnergyCarriers_rapidRun = EnumSet.copyOf(v_liveData.activeProductionEnergyCarriers);
+EnumSet<OL_AssetFlowCategories> activeAssetFlows_rapidRun = EnumSet.copyOf(v_liveAssetsMetaData.activeAssetFlows);
+//Need to do this, for if the sliders have changed, otherwise potential errors/missing data
+boolean storeTotalAssetFlows = true;
+for(GridConnection GC : c_memberGridConnections){
+ if(GC.v_isActive){
+ activeEnergyCarriers_rapidRun.addAll(GC.v_rapidRunData.activeEnergyCarriers);
+ activeConsumptionEnergyCarriers_rapidRun.addAll(GC.v_rapidRunData.activeConsumptionEnergyCarriers);
+ activeProductionEnergyCarriers_rapidRun.addAll(GC.v_rapidRunData.activeProductionEnergyCarriers);
+
+ v_rapidRunData.assetsMetaData.activeAssetFlows.addAll(GC.v_rapidRunData.assetsMetaData.activeAssetFlows);
+
+ if(GC.v_rapidRunData.getStoreTotalAssetFlows() == false){
+ storeTotalAssetFlows = false;
+ }
+ }
+}
+
+//Adjust StoreTotalAssetFlows accordingly to the member data
+v_rapidRunData.setStoreTotalAssetFlows(storeTotalAssetFlows);
+
+//For now assumed to stay the same even after slider change: can't see rapid run graphs anyway after slider change
+v_rapidRunData.connectionMetaData = v_liveConnectionMetaData.getClone();
+
+//Initialize the rapid run data
+v_rapidRunData.initializeAccumulators(energyModel.p_runEndTime_h - energyModel.p_runStartTime_h, energyModel.p_timeStep_h, activeEnergyCarriers_rapidRun, activeConsumptionEnergyCarriers_rapidRun, activeProductionEnergyCarriers_rapidRun, activeAssetFlows_rapidRun);
+
+
+
+ RETURNS_VALUE
+ ArrayList<GridConnection>
+ 1754908113703
+ f_getMemberGridConnectionsCollectionPointer
+ 1440
+ 450
+
+ false
+ true
+ true
+ return this.c_memberGridConnections; // This should NOT be a copy, it should be a pointer!!
+
+
+ VOID
+ double
+ 1756290844166
+ f_addMemberGCs
+ 1510
+ 60
+
+ false
+ true
+ true
+
+ gcList
+ List<GridConnection>
+
+ f_initializeCustomCoop(gcList);
+
+// Adding this coop to the list of coops in the GC
+gcList.forEach(gc -> gc.c_parentCoops.add(this));
+
+
+
+ VOID
+ double
+ 1756207893357
+ f_aggregatorBatteryManagement_EnergyCoop
+ 670
+ 710
+
+ false
+ true
+ true
+ if(p_aggregatorBatteryManagement != null){
+ p_aggregatorBatteryManagement.manageExternalSetpoints();
+}
+
+
+ VOID
+ double
+ 1756301338833
+ f_removeMemberGCs
+ 1510
+ 80
+
+ false
+ true
+ true
+
+ gcList
+ List<GridConnection>
+
+ c_memberGridConnections.removeAll(gcList);
+List<GridConnection> newMemberGridConnectionsList = new ArrayList<GridConnection>(c_memberGridConnections);
+c_memberGridConnections.clear();
+
+// Remove this coop from the list of coops in the GC
+gcList.forEach(gc -> gc.c_parentCoops.remove(this));
+
+f_initializeCustomCoop(newMemberGridConnectionsList);
+
+
+ VOID
+ double
+ 1756207893363
+ f_aggregatorManagement_EnergyCoop
+ 650
+ 690
+
+ false
+ true
+ true
+ //Run battery setpoint management
+f_aggregatorBatteryManagement_EnergyCoop();
+
+
+ VOID
+ double
+ 1759144507495
+ f_collectGridConnectionOriginalRapidRunData
+ 1010
+ 300
+
+ false
+ true
+ true
+ // Make collective profiles, electricity per timestep, other energy carriers per day!
+
+for (GridConnection gc : c_memberGridConnections) {
+ if(gc.v_isActive){
+ // Totals
+ v_originalRapidRunData.am_totalBalanceAccumulators_kW.add(gc.v_originalRapidRunData.am_totalBalanceAccumulators_kW);
+ v_originalRapidRunData.am_totalHeatFromEnergyCarrier_kW.add(gc.v_originalRapidRunData.am_totalHeatFromEnergyCarrier_kW);
+ v_originalRapidRunData.am_totalConsumptionForHeating_kW.add(gc.v_originalRapidRunData.am_totalConsumptionForHeating_kW);
+ v_originalRapidRunData.am_dailyAverageConsumptionAccumulators_kW.add(gc.v_originalRapidRunData.am_dailyAverageConsumptionAccumulators_kW);
+ v_originalRapidRunData.am_dailyAverageProductionAccumulators_kW.add(gc.v_originalRapidRunData.am_dailyAverageProductionAccumulators_kW);
+ v_originalRapidRunData.acc_dailyAverageEnergyProduction_kW.add(gc.v_originalRapidRunData.acc_dailyAverageEnergyProduction_kW);
+ v_originalRapidRunData.acc_dailyAverageFinalEnergyConsumption_kW.add(gc.v_originalRapidRunData.acc_dailyAverageFinalEnergyConsumption_kW);
+ v_originalRapidRunData.acc_totalEnergyCurtailed_kW.add(gc.v_originalRapidRunData.acc_totalEnergyCurtailed_kW);
+ v_originalRapidRunData.acc_totalPrimaryEnergyProductionHeatpumps_kW.add(gc.v_originalRapidRunData.acc_totalPrimaryEnergyProductionHeatpumps_kW);
+ v_originalRapidRunData.am_assetFlowsAccumulators_kW.add(gc.v_originalRapidRunData.am_assetFlowsAccumulators_kW);
+
+ // Daytime
+ v_originalRapidRunData.acc_daytimeElectricityConsumption_kW.add(gc.v_originalRapidRunData.acc_daytimeElectricityConsumption_kW);
+ v_originalRapidRunData.acc_daytimeElectricityProduction_kW.add(gc.v_originalRapidRunData.acc_daytimeElectricityProduction_kW);
+ v_originalRapidRunData.acc_daytimeEnergyProduction_kW.add(gc.v_originalRapidRunData.acc_daytimeEnergyProduction_kW);
+ v_originalRapidRunData.acc_daytimeFinalEnergyConsumption_kW.add(gc.v_originalRapidRunData.acc_daytimeFinalEnergyConsumption_kW);
+ v_originalRapidRunData.am_daytimeImports_kW.add(gc.v_originalRapidRunData.am_daytimeImports_kW);
+ v_originalRapidRunData.am_daytimeExports_kW.add(gc.v_originalRapidRunData.am_daytimeExports_kW);
+ v_originalRapidRunData.am_daytimeHeatFromEnergyCarrier_kW.add(gc.v_originalRapidRunData.am_daytimeHeatFromEnergyCarrier_kW);
+ v_originalRapidRunData.am_daytimeConsumptionForHeating_kW.add(gc.v_originalRapidRunData.am_daytimeConsumptionForHeating_kW);
+
+ // Weekend
+ v_originalRapidRunData.acc_weekendElectricityConsumption_kW.add(gc.v_originalRapidRunData.acc_weekendElectricityConsumption_kW);
+ v_originalRapidRunData.acc_weekendElectricityProduction_kW.add(gc.v_originalRapidRunData.acc_weekendElectricityProduction_kW);
+ v_originalRapidRunData.acc_weekendEnergyProduction_kW.add(gc.v_originalRapidRunData.acc_weekendEnergyProduction_kW);
+ v_originalRapidRunData.acc_weekendFinalEnergyConsumption_kW.add(gc.v_originalRapidRunData.acc_weekendFinalEnergyConsumption_kW);
+ v_originalRapidRunData.am_weekendImports_kW.add(gc.v_originalRapidRunData.am_weekendImports_kW);
+ v_originalRapidRunData.am_weekendExports_kW.add(gc.v_originalRapidRunData.am_weekendExports_kW);
+ v_originalRapidRunData.am_weekendHeatFromEnergyCarrier_kW.add(gc.v_originalRapidRunData.am_weekendHeatFromEnergyCarrier_kW);
+ v_originalRapidRunData.am_weekendConsumptionForHeating_kW.add(gc.v_originalRapidRunData.am_weekendConsumptionForHeating_kW);
+
+ // Summerweek
+ v_originalRapidRunData.am_summerWeekBalanceAccumulators_kW.add(gc.v_originalRapidRunData.am_summerWeekBalanceAccumulators_kW);
+ v_originalRapidRunData.am_summerWeekConsumptionAccumulators_kW.add(gc.v_originalRapidRunData.am_summerWeekConsumptionAccumulators_kW);
+ v_originalRapidRunData.am_summerWeekProductionAccumulators_kW.add(gc.v_originalRapidRunData.am_summerWeekProductionAccumulators_kW);
+ v_originalRapidRunData.am_summerWeekHeatFromEnergyCarrier_kW.add(gc.v_originalRapidRunData.am_summerWeekHeatFromEnergyCarrier_kW);
+ v_originalRapidRunData.am_summerWeekConsumptionForHeating_kW.add(gc.v_originalRapidRunData.am_summerWeekConsumptionForHeating_kW);
+ v_originalRapidRunData.acc_summerWeekEnergyProduction_kW.add(gc.v_originalRapidRunData.acc_summerWeekEnergyProduction_kW);
+ v_originalRapidRunData.acc_summerWeekFinalEnergyConsumption_kW.add(gc.v_originalRapidRunData.acc_summerWeekFinalEnergyConsumption_kW);
+ v_originalRapidRunData.acc_summerWeekEnergyCurtailed_kW.add(gc.v_originalRapidRunData.acc_summerWeekEnergyCurtailed_kW);
+ v_originalRapidRunData.acc_summerWeekPrimaryEnergyProductionHeatpumps_kW.add(gc.v_originalRapidRunData.acc_summerWeekPrimaryEnergyProductionHeatpumps_kW);
+ v_originalRapidRunData.am_assetFlowsSummerWeek_kW.add(gc.v_originalRapidRunData.am_assetFlowsSummerWeek_kW);
+
+ // Winterweek
+ v_originalRapidRunData.am_winterWeekBalanceAccumulators_kW.add(gc.v_originalRapidRunData.am_winterWeekBalanceAccumulators_kW);
+ v_originalRapidRunData.am_winterWeekConsumptionAccumulators_kW.add(gc.v_originalRapidRunData.am_winterWeekConsumptionAccumulators_kW);
+ v_originalRapidRunData.am_winterWeekProductionAccumulators_kW.add(gc.v_originalRapidRunData.am_winterWeekProductionAccumulators_kW);
+ v_originalRapidRunData.am_winterWeekHeatFromEnergyCarrier_kW.add(gc.v_originalRapidRunData.am_winterWeekHeatFromEnergyCarrier_kW);
+ v_originalRapidRunData.am_winterWeekConsumptionForHeating_kW.add(gc.v_originalRapidRunData.am_winterWeekConsumptionForHeating_kW);
+ v_originalRapidRunData.acc_winterWeekEnergyProduction_kW.add(gc.v_originalRapidRunData.acc_winterWeekEnergyProduction_kW);
+ v_originalRapidRunData.acc_winterWeekFinalEnergyConsumption_kW.add(gc.v_originalRapidRunData.acc_winterWeekFinalEnergyConsumption_kW);
+ v_originalRapidRunData.acc_winterWeekEnergyCurtailed_kW.add(gc.v_originalRapidRunData.acc_winterWeekEnergyCurtailed_kW);
+ v_originalRapidRunData.acc_winterWeekPrimaryEnergyProductionHeatpumps_kW.add(gc.v_originalRapidRunData.acc_winterWeekPrimaryEnergyProductionHeatpumps_kW);
+ v_originalRapidRunData.am_assetFlowsWinterWeek_kW.add(gc.v_originalRapidRunData.am_assetFlowsWinterWeek_kW);
+ }
+}
+
+//Calculate cumulative asset capacities
+f_getTotalInstalledCapacityOfAssets_originalRapidRun();
+
+
+
+ VOID
+ double
+ 1759144507497
+ f_getTotalInstalledCapacityOfAssets_originalRapidRun
+ 1030
+ 320
+
+ false
+ true
+ true
+ //Collect rapid run asset totals
+v_originalRapidRunData.assetsMetaData.totalInstalledWindPower_kW = 0.0;
+v_originalRapidRunData.assetsMetaData.totalInstalledPVPower_kW = 0.0;
+v_originalRapidRunData.assetsMetaData.totalInstalledBatteryStorageCapacity_MWh = 0.0;
+
+//Add all battery storage capacities of gc
+for(GridConnection GC : c_memberGridConnections){
+ if(GC.v_isActive){
+ v_originalRapidRunData.assetsMetaData.totalInstalledWindPower_kW += GC.v_originalRapidRunData.assetsMetaData.totalInstalledWindPower_kW;
+ v_originalRapidRunData.assetsMetaData.totalInstalledPVPower_kW += GC.v_originalRapidRunData.assetsMetaData.totalInstalledPVPower_kW;
+ v_originalRapidRunData.assetsMetaData.totalInstalledBatteryStorageCapacity_MWh += GC.v_originalRapidRunData.assetsMetaData.totalInstalledBatteryStorageCapacity_MWh;
+ }
+}
+
+//Do this also for the 'child' coops
+for(Agent a : c_coopMembers ) { // Take 'behind the meter' production and consumption!
+ if (a instanceof EnergyCoop) {
+ EnergyCoop EC = (EnergyCoop)a;
+ EC.f_getTotalInstalledCapacityOfAssets_rapidRun();
+ v_originalRapidRunData.assetsMetaData.totalInstalledWindPower_kW += EC.v_originalRapidRunData.assetsMetaData.totalInstalledWindPower_kW;
+ v_originalRapidRunData.assetsMetaData.totalInstalledPVPower_kW += EC.v_originalRapidRunData.assetsMetaData.totalInstalledPVPower_kW;
+ v_originalRapidRunData.assetsMetaData.totalInstalledBatteryStorageCapacity_MWh += EC.v_originalRapidRunData.assetsMetaData.totalInstalledBatteryStorageCapacity_MWh;
+ }
+}
+
+
+ VOID
+ double
+ 1759144507499
+ f_createAndInitializeOriginalRapidRunDataClass
+ 990
+ 280
+
+ false
+ true
+ true
+ //Create rapid run data class used to collect rapid run data of other gc
+v_originalRapidRunData = new J_RapidRunData(this);
+v_originalRapidRunData.assetsMetaData = v_liveAssetsMetaData.getClone();
+
+EnumSet<OL_EnergyCarriers> activeEnergyCarriers_rapidRun = EnumSet.copyOf(v_liveData.activeEnergyCarriers);
+EnumSet<OL_EnergyCarriers> activeConsumptionEnergyCarriers_rapidRun = EnumSet.copyOf(v_liveData.activeConsumptionEnergyCarriers);
+EnumSet<OL_EnergyCarriers> activeProductionEnergyCarriers_rapidRun = EnumSet.copyOf(v_liveData.activeProductionEnergyCarriers);
+EnumSet<OL_AssetFlowCategories> activeAssetFlows_rapidRun = EnumSet.copyOf(v_liveAssetsMetaData.activeAssetFlows);
+//Need to do this, for if the sliders have changed, otherwise potential errors/missing data ????
+boolean storeTotalAssetFlows = true;
+for(GridConnection GC : c_memberGridConnections){
+ if(GC.v_isActive){
+ activeEnergyCarriers_rapidRun.addAll(GC.v_originalRapidRunData.activeEnergyCarriers);
+ activeConsumptionEnergyCarriers_rapidRun.addAll(GC.v_originalRapidRunData.activeConsumptionEnergyCarriers);
+ activeProductionEnergyCarriers_rapidRun.addAll(GC.v_originalRapidRunData.activeProductionEnergyCarriers);
+
+ v_originalRapidRunData.assetsMetaData.activeAssetFlows.addAll(GC.v_originalRapidRunData.assetsMetaData.activeAssetFlows);
+
+ if(GC.v_rapidRunData.getStoreTotalAssetFlows() == false){
+ storeTotalAssetFlows = false;
+ }
+ }
+}
+
+//Adjust StoreTotalAssetFlows accordingly to the member data
+v_originalRapidRunData.setStoreTotalAssetFlows(storeTotalAssetFlows);
+
+//For now assumed to stay the same even after slider change: can't see rapid run graphs anyway after slider change
+v_originalRapidRunData.connectionMetaData = v_liveConnectionMetaData.getClone();
+
+//Initialize the rapid run data
+v_originalRapidRunData.initializeAccumulators(energyModel.p_runEndTime_h - energyModel.p_runStartTime_h, energyModel.p_timeStep_h, activeEnergyCarriers_rapidRun, activeConsumptionEnergyCarriers_rapidRun, activeProductionEnergyCarriers_rapidRun, activeAssetFlows_rapidRun);
+
+
+
+ VOID
+ double
+ 1759155380190
+ f_getOriginalCumulativeIndividualGCValues
+ 1430
+ 925
+
+ false
+ true
+ true
+ v_cumulativeIndividualPeakDeliveryOriginal_kW = 0;
+v_cumulativeIndividualPeakFeedinOriginal_kW = 0;
+
+//Loop over membered grid connections
+for(GridConnection GC : c_memberGridConnections){
+ if(GC.v_isActive){
+ //Add all peaks for member grid connections
+ v_cumulativeIndividualPeakDeliveryOriginal_kW += GC.v_originalRapidRunData.getPeakDelivery_kW();
+ v_cumulativeIndividualPeakFeedinOriginal_kW += GC.v_originalRapidRunData.getPeakFeedin_kW();
+ }
+}
+
+for(Agent a : c_coopMembers ) { // Take 'behind the meter' production and consumption!
+ if (a instanceof EnergyCoop) {
+ EnergyCoop EC = (EnergyCoop)a;
+ EC.f_getOriginalCumulativeIndividualGCValues();
+
+ if(v_originalRapidRunData != null && EC.v_originalRapidRunData != null){
+ v_cumulativeIndividualPeakDeliveryOriginal_kW += EC.v_cumulativeIndividualPeakDeliveryOriginal_kW;
+ v_cumulativeIndividualPeakFeedinOriginal_kW += EC.v_cumulativeIndividualPeakFeedinOriginal_kW;
+ }
+ }
+}
+
+
+
+
+ 1660731375011
+ connections
+ true
+ 180
+ -150
+
+ false
+ true
+ true
+ false
+ COLLECTION_OF_LINKS
+ true
+ Object
+ SOLID
+ 1
+ -16777216
+ UNDER_AGENTS
+ NONE
+ END
+
+
+
+
+ 1660731826095
+ energyModel
+ 50
+ -100
+
+ false
+ true
+ true
+
+ zero_engine
+ EnergyModel
+
+
+
+
+
+ 1660731375015
+ level
+ 0
+ 0
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ 0
+ DIM_NON_CURRENT
+
+
+ 1740491441996
+ rect_energyBalanceMonitor
+ 0
+ 980
+
+ true
+ true
+ false
+ true
+ SHAPE_DRAW_2D3D
+ false
+ 0
+ 10
+ 3
+ -7876870
+ null
+ SOLID
+ 840
+ 720
+ 0.0
+ -1
+ null
+
+
+ 1692631026123
+ ch_coopBalance
+ true
+ -880
+ 360
+
+ false
+ true
+ false
+ SHAPE_DRAW_2D3D
+ false
+
+ 1751011892587
+ true
+ 1692691200000
+
+ 0
+ HOUR
+
+
+ 1
+ HOUR
+
+
+ false
+ 390
+ 390
+
+
+
+ 50
+ 30
+ 310
+ 300
+ -1
+ -16777216
+ -12566464
+
+
+
+ DEFAULT
+ DEFAULT
+ -12566464
+
+ true
+
+ 1692631027262
+ v_balanceMembers_eur
+ -3137392
+ Inkomsten leden
+
+
+ 1692631063902
+ v_balanceElectricityDelivery_eur
+ -32944
+ Inkomsten EPEX
+
+
+ 1692631086718
+ -v_assetDepreciation_eur
+ -13447886
+ Afschrijving assets
+
+
+ 1692631175228
+ -p_yearlyOperationalCosts_eur
+ -9404272
+ OPEX
+
+ 0
+ 1
+ AUTO
+
+ UP
+ 0.8
+
+
+
+ 1740403817351
+ txt_cumulativeIndividualGCValues
+ 1420
+ 680
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ Cumulative individual GC values
+
+ SansSerif
+ 12
+
+
+ LEFT
+
+
+ 1740490188581
+ text8
+ 400
+ 1010
+
+ false
+ true
+ false
+ true
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ Energy balance monitor
+
+ SansSerif
+ 20
+
+
+ CENTER
+
+
+ false
+ 1741856471603
+ button_viewData
+ 240
+ -90
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+
+ false
+ -16777216
+ true
+ energyModel.energyDataViewer.f_fillEnergyDataViewer(this);
+energyModel.energyDataViewer.viewArea.navigateTo();
+
+
+
+ View Data
+
+
+
+
+
+
+
+ 1741860694288
+ va_coop
+ 0
+ 0
+
+ false
+ true
+ false
+
+ 1920
+ 980
+
+
+
+
+ 1705600400154
+ EnergyDataViewer
+ import java.util.EnumSet;
+ false
+
+ 1705600400160
+ 1705600400160
+
+ T extends Agent
+
+ Generic parameter:
+
+ ENTITY
+ 100
+ false
+ 100
+ true
+
+ -4144960
+ null
+
+ true
+ true
+ false
+
+ 10
+ MPS
+
+
+ 1
+ METER
+
+
+ 1
+ METER
+
+
+ 1
+ METER
+
+
+
+ false
+
+ 1.0
+ SECOND
+
+ CONTINUOUS
+ 500
+ 500
+ 0
+ 100
+ 100
+ MOORE
+ USER_DEF
+ USER_DEF
+ 2
+ 50
+ 0.95
+ 10
+
+
+ true
+ 1658477089989
+ true
+ 1705651200000
+
+ 0
+ HOUR
+
+
+ 1
+ HOUR
+
+
+
+ 1705600400157
+ scale
+ 0
+ -150
+ false
+ false
+ false
+ SHAPE_DRAW_2D3D
+ 100
+ 0
+ BASED_ON_LENGTH
+ 10
+ METER
+ 10
+ true
+
+ 1705600400161
+ 1705600400155
+
+
+ 1741792546547
+ v_totalEnergySelfConsumed_MWh
+ 686
+ 240
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1741792546549
+ v_totalEnergyImport_MWh
+ 686
+ 140
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1741792546551
+ v_totalEnergyExport_MWh
+ 686
+ 160
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1741792546555
+ v_gridCapacityFeedIn_kW
+ 1216
+ 430
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1741792546557
+ v_gridCapacityDelivery_kW
+ 1216
+ 410
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1741792546559
+ v_dataElectricityBaseloadConsumptionLiveWeek_kW
+ true
+ -330
+ 100
+
+ false
+ true
+ true
+
+ DataSet
+
+
+
+ 1741792546561
+ v_dataElectricityForHeatConsumptionLiveWeek_kW
+ true
+ -330
+ 120
+
+ false
+ true
+ true
+
+ DataSet
+
+
+
+ 1741792546563
+ v_dataElectricityForTransportConsumptionLiveWeek_kW
+ true
+ -330
+ 140
+
+ false
+ true
+ true
+
+ DataSet
+
+
+
+ 1741792546565
+ v_dataElectricityForStorageConsumptionLiveWeek_kW
+ true
+ -330
+ 160
+
+ false
+ true
+ true
+
+ DataSet
+
+
+
+ 1741792546567
+ v_dataDistrictHeatConsumptionLiveWeek_kW
+ 180
+ 210
+
+ false
+ true
+ true
+
+ DataSet
+
+
+
+ 1741792546569
+ v_dataWindElectricityProductionLiveWeek_kW
+ true
+ -330
+ 280
+
+ false
+ true
+ true
+
+ DataSet
+
+
+
+ 1741792546571
+ v_dataPVElectricityProductionLiveWeek_kW
+ true
+ -330
+ 260
+
+ false
+ true
+ true
+
+ DataSet
+
+
+
+ 1741792546573
+ v_dataStorageElectricityProductionLiveWeek_kW
+ true
+ -330
+ 300
+
+ false
+ true
+ true
+
+ DataSet
+
+
+
+ 1741792546575
+ v_dataV2GElectricityProductionLiveWeek_kW
+ true
+ -330
+ 320
+
+ false
+ true
+ true
+
+ DataSet
+
+
+
+ 1741792546579
+ v_dataElectricityForHydrogenConsumptionLiveWeek_kW
+ true
+ -330
+ 180
+
+ false
+ true
+ true
+
+ DataSet
+
+
+
+ 1741792546581
+ v_summerWeekEnergySelfConsumed_MWh
+ 686
+ 880
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1741792546583
+ v_summerWeekEnergyImport_MWh
+ 686
+ 700
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1741792546585
+ v_summerWeekEnergyExport_MWh
+ 686
+ 720
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1741792546587
+ v_summerWeekElectricitySelfConsumed_MWh
+ 686
+ 800
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1741792546591
+ v_totalElectricitySelfConsumed_MWh
+ 686
+ 320
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1741792546593
+ v_totalElectricityConsumed_MWh
+ 686
+ 300
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1741792546595
+ v_rooftopPVPotential_kW
+ 1726
+ 210
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1741792546597
+ v_windPotential_kW
+ 1726
+ 260
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1741792546599
+ data_dailyAverageFinalEnergyConsumption_kW
+ 180
+ 630
+
+ false
+ true
+ true
+
+ DataSet
+
+
+
+ 1741792546601
+ v_dataElectricityBaseloadConsumptionYear_kW
+ true
+ -400
+ 710
+
+ false
+ true
+ true
+
+ DataSet
+
+
+
+ 1741792546603
+ v_dataElectricityForHeatConsumptionYear_kW
+ true
+ -400
+ 730
+
+ false
+ true
+ true
+
+ DataSet
+
+
+
+ 1741792546605
+ v_dataElectricityForTransportConsumptionYear_kW
+ true
+ -400
+ 750
+
+ false
+ true
+ true
+
+ DataSet
+
+
+
+ 1741792546607
+ v_dataElectricityForStorageConsumptionYear_kW
+ true
+ -400
+ 790
+
+ false
+ true
+ true
+
+ DataSet
+
+
+
+ 1741792546609
+ v_dataElectricityWindProductionYear_kW
+ true
+ -400
+ 890
+
+ false
+ true
+ true
+
+ DataSet
+
+
+
+ 1741792546611
+ v_dataElectricityPVProductionYear_kW
+ true
+ -400
+ 870
+
+ false
+ true
+ true
+
+ DataSet
+
+
+
+ 1741792546613
+ v_dataElectricityStorageProductionYear_kW
+ true
+ -400
+ 910
+
+ false
+ true
+ true
+
+ DataSet
+
+
+
+ 1741792546615
+ v_dataElectricityV2GProductionYear_kW
+ true
+ -400
+ 930
+
+ false
+ true
+ true
+
+ DataSet
+
+
+
+ 1741792546621
+ v_dataElectricityForHydrogenConsumptionYear_kW
+ true
+ -400
+ 770
+
+ false
+ true
+ true
+
+ DataSet
+
+
+
+ 1741792546623
+ v_individualSelfSufficiencyElectricity_fr
+ 1726
+ 370
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1741792546625
+ v_dataElectricityBaseloadConsumptionSummerWeek_kW
+ true
+ -410
+ 1280
+
+ false
+ true
+ true
+
+ DataSet
+
+
+
+ 1741792546627
+ v_dataElectricityForHeatConsumptionSummerWeek_kW
+ true
+ -410
+ 1300
+
+ false
+ true
+ true
+
+ DataSet
+
+
+
+ 1741792546629
+ v_dataElectricityForTransportConsumptionSummerWeek_kW
+ true
+ -410
+ 1320
+
+ false
+ true
+ true
+
+ DataSet
+
+
+
+ 1741792546631
+ v_dataElectricityForStorageConsumptionSummerWeek_kW
+ true
+ -410
+ 1340
+
+ false
+ true
+ true
+
+ DataSet
+
+
+
+ 1741792546635
+ v_dataElectricityForHydrogenConsumptionSummerWeek_kW
+ true
+ -410
+ 1360
+
+ false
+ true
+ true
+
+ DataSet
+
+
+
+ 1741792546637
+ v_dataElectricityBaseloadConsumptionWinterWeek_kW
+ true
+ -360
+ 1930
+
+ false
+ true
+ true
+
+ DataSet
+
+
+
+ 1741792546639
+ v_dataElectricityForHeatConsumptionWinterWeek_kW
+ true
+ -360
+ 1950
+
+ false
+ true
+ true
+
+ DataSet
+
+
+
+ 1741792546641
+ v_dataElectricityForTransportConsumptionWinterWeek_kW
+ true
+ -360
+ 1970
+
+ false
+ true
+ true
+
+ DataSet
+
+
+
+ 1741792546643
+ v_dataElectricityForStorageConsumptionWinterWeek_kW
+ true
+ -360
+ 1990
+
+ false
+ true
+ true
+
+ DataSet
+
+
+
+ 1741792546647
+ v_dataElectricityForHydrogenConsumptionWinterWeek_kW
+ true
+ -360
+ 2010
+
+ false
+ true
+ true
+
+ DataSet
+
+
+
+ 1741792546649
+ v_dataElectricityWindProductionSummerWeek_kW
+ true
+ -410
+ 1450
+
+ false
+ true
+ true
+
+ DataSet
+
+
+
+ 1741792546651
+ v_dataElectricityPVProductionSummerWeek_kW
+ true
+ -410
+ 1430
+
+ false
+ true
+ true
+
+ DataSet
+
+
+
+ 1741792546653
+ v_dataElectricityStorageProductionSummerWeek_kW
+ true
+ -410
+ 1470
+
+ false
+ true
+ true
+
+ DataSet
+
+
+
+ 1741792546655
+ v_dataElectricityV2GProductionSummerWeek_kW
+ true
+ -410
+ 1490
+
+ false
+ true
+ true
+
+ DataSet
+
+
+
+ 1741792546659
+ v_dataElectricityWindProductionWinterWeek_kW
+ true
+ -360
+ 2110
+
+ false
+ true
+ true
+
+ DataSet
+
+
+
+ 1741792546661
+ v_dataElectricityPVProductionWinterWeek_kW
+ true
+ -360
+ 2090
+
+ false
+ true
+ true
+
+ DataSet
+
+
+
+ 1741792546663
+ v_dataElectricityStorageProductionWinterWeek_kW
+ true
+ -360
+ 2130
+
+ false
+ true
+ true
+
+ DataSet
+
+
+
+ 1741792546665
+ v_dataElectricityV2GProductionWinterWeek_kW
+ true
+ -360
+ 2150
+
+ false
+ true
+ true
+
+ DataSet
+
+
+
+ 1741792546669
+ v_dataNetbelastingDuurkrommeYear_kW
+ 1206
+ 80
+
+ false
+ true
+ true
+
+ DataSet
+
+
+
+ 1741792546671
+ v_dataNetbelastingDuurkrommeSummer_kW
+ 1206
+ 120
+
+ false
+ true
+ true
+
+ DataSet
+
+
+
+ 1741792546673
+ v_dataNetbelastingDuurkrommeWinter_kW
+ 1206
+ 140
+
+ false
+ true
+ true
+
+ DataSet
+
+
+
+ 1741792546675
+ v_dataNetbelastingDuurkrommeDaytime_kW
+ 1206
+ 160
+
+ false
+ true
+ true
+
+ DataSet
+
+
+
+ 1741792546677
+ v_dataNetbelastingDuurkrommeNighttime_kW
+ 1206
+ 180
+
+ false
+ true
+ true
+
+ DataSet
+
+
+
+ 1741792546679
+ v_dataNetbelastingDuurkrommeWeekend_kW
+ 1206
+ 220
+
+ false
+ true
+ true
+
+ DataSet
+
+
+
+ 1741792546681
+ v_dataNetbelastingDuurkrommeWeekday_kW
+ 1206
+ 200
+
+ false
+ true
+ true
+
+ DataSet
+
+
+
+ 1741792546683
+ v_individualSelfconsumptionElectricity_fr
+ 1726
+ 390
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1741792546685
+ v_dataNetbelastingDuurkrommeYearVorige_kW
+ 1206
+ 100
+
+ false
+ true
+ true
+
+ DataSet
+
+
+
+ 1741792546687
+ v_dataElectricityFeedInCapacityLiveWeek_kW
+ 180
+ 310
+
+ false
+ true
+ true
+
+ DataSet
+
+
+
+ 1741792546689
+ v_dataElectricityDeliveryCapacityLiveWeek_kW
+ 180
+ 290
+
+ false
+ true
+ true
+
+ DataSet
+
+
+
+ 1741792546719
+ v_dataNetLoadLiveWeek_kW
+ 180
+ 260
+
+ false
+ true
+ true
+
+ DataSet
+
+
+
+ 1741792546721
+ v_dataNetLoadSummerWeek_kW
+ 180
+ 920
+
+ false
+ true
+ true
+
+ DataSet
+
+
+
+ 1741792546723
+ v_dataNetLoadWinterWeek_kW
+ 184
+ 1170
+
+ false
+ true
+ true
+
+ DataSet
+
+
+
+ 1741792546727
+ v_totalEnergyConsumed_MWh
+ 686
+ 220
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1741792546729
+ v_totalEnergyProduced_MWh
+ 686
+ 200
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1741792546731
+ v_annualOverloadDurationDelivery_hr
+ 686
+ 415
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1741792546733
+ v_annualOverloadDurationFeedin_hr
+ 686
+ 435
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1741792546735
+ v_totalEnergyConsumptionForDistrictHeating_MWh
+ 686
+ 500
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1741792546737
+ v_totalPrimaryEnergyProductionHeatpumps_MWh
+ 686
+ 520
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1741792546739
+ fm_totalImports_MWh
+ 686
+ 100
+
+ false
+ true
+ true
+
+ J_FlowsMap
+
+ new J_FlowsMap()
+
+
+
+
+ 1741792546741
+ fm_totalExports_MWh
+ 686
+ 120
+
+ false
+ true
+ true
+
+ J_FlowsMap
+
+ new J_FlowsMap()
+
+
+
+
+ 1741792546743
+ fm_summerWeekImports_MWh
+ 686
+ 660
+
+ false
+ true
+ true
+
+ J_FlowsMap
+
+ new J_FlowsMap()
+
+
+
+
+ 1741792546745
+ fm_summerWeekExports_MWh
+ 686
+ 680
+
+ false
+ true
+ true
+
+ J_FlowsMap
+
+ new J_FlowsMap()
+
+
+
+
+ 1741792546747
+ fm_winterWeekImports_MWh
+ 686
+ 950
+
+ false
+ true
+ true
+
+ J_FlowsMap
+
+ new J_FlowsMap()
+
+
+
+
+ 1741792546749
+ fm_winterWeekExports_MWh
+ 686
+ 970
+
+ false
+ true
+ true
+
+ J_FlowsMap
+
+ new J_FlowsMap()
+
+
+
+
+ 1741792546751
+ v_totalElectricityProduced_MWh
+ 686
+ 280
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1741792546753
+ v_summerWeekEnergyConsumed_MWh
+ 686
+ 860
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1741792546755
+ v_summerWeekEnergyProduced_MWh
+ 686
+ 840
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1741792546757
+ v_summerWeekElectricityConsumed_MWh
+ 686
+ 780
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1741792546759
+ v_summerWeekElectricityProduced_MWh
+ 686
+ 760
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1741792546761
+ v_winterWeekEnergyConsumed_MWh
+ 686
+ 1150
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1741792546763
+ v_winterWeekEnergyProduced_MWh
+ 686
+ 1130
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1741792546765
+ v_winterWeekEnergySelfConsumed_MWh
+ 686
+ 1170
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1741792546767
+ v_winterWeekElectricityConsumed_MWh
+ 686
+ 1070
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1741792546769
+ v_winterWeekElectricitySelfConsumed_MWh
+ 686
+ 1090
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1741792546771
+ v_winterWeekElectricityProduced_MWh
+ 686
+ 1050
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1741792546773
+ v_winterWeekEnergyImport_MWh
+ 686
+ 990
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1741792546775
+ v_winterWeekEnergyExport_MWh
+ 686
+ 1010
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1741792546777
+ v_daytimeEnergyImport_MWh
+ 686
+ 1470
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1741792546779
+ v_daytimeEnergyExport_MWh
+ 686
+ 1490
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1741792546781
+ fm_daytimeImports_MWh
+ 686
+ 1430
+
+ false
+ true
+ true
+
+ J_FlowsMap
+
+ new J_FlowsMap()
+
+
+
+
+ 1741792546783
+ fm_daytimeExports_MWh
+ 686
+ 1450
+
+ false
+ true
+ true
+
+ J_FlowsMap
+
+ new J_FlowsMap()
+
+
+
+
+ 1741792546785
+ v_daytimeEnergyConsumed_MWh
+ 686
+ 1355
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1741792546787
+ v_daytimeEnergyProduced_MWh
+ 686
+ 1335
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1741792546789
+ v_daytimeEnergySelfConsumed_MWh
+ 686
+ 1375
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1741792546791
+ v_daytimeElectricityConsumed_MWh
+ 686
+ 1275
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1741792546793
+ v_daytimeElectricityProduced_MWh
+ 686
+ 1255
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1741792546795
+ v_daytimeElectricitySelfConsumed_MWh
+ 686
+ 1295
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1741792546797
+ v_nighttimeEnergyImport_MWh
+ 686
+ 1750
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1741792546799
+ v_nighttimeEnergyExport_MWh
+ 686
+ 1770
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1741792546801
+ v_nighttimeEnergyConsumed_MWh
+ 686
+ 1640
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1741792546803
+ v_nighttimeEnergyProduced_MWh
+ 686
+ 1620
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1741792546805
+ v_nighttimeEnergySelfConsumed_MWh
+ 686
+ 1660
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1741792546807
+ v_weekdayEnergyImport_MWh
+ 686
+ 2100
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1741792546809
+ v_weekdayEnergyExport_MWh
+ 686
+ 2120
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1741792546811
+ v_weekdayEnergyConsumed_MWh
+ 686
+ 1995
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1741792546813
+ v_weekdayEnergyProduced_MWh
+ 686
+ 1975
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1741792546815
+ v_weekdayEnergySelfConsumed_MWh
+ 686
+ 2015
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1741792546817
+ v_weekendEnergyImport_MWh
+ 686
+ 2390
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1741792546819
+ v_weekendEnergyExport_MWh
+ 686
+ 2410
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1741792546821
+ v_weekendEnergyConsumed_MWh
+ 686
+ 2285
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1741792546823
+ v_weekendEnergyProduced_MWh
+ 686
+ 2265
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1741792546825
+ v_weekendEnergySelfConsumed_MWh
+ 686
+ 2305
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1741792546827
+ v_nighttimeElectricityConsumed_MWh
+ 686
+ 1559
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1741792546829
+ v_weekdayElectricityConsumed_MWh
+ 686
+ 1915
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1741792546831
+ v_weekendElectricityConsumed_MWh
+ 686
+ 2205
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1741792546833
+ v_nighttimeElectricityProduced_MWh
+ 686
+ 1540
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1741792546835
+ v_nighttimeElectricitySelfConsumed_MWh
+ 686
+ 1577
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1741792546837
+ v_weekdayElectricityProduced_MWh
+ 686
+ 1895
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1741792546839
+ v_weekdayElectricitySelfConsumed_MWh
+ 686
+ 1935
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1741792546841
+ v_weekendElectricityProduced_MWh
+ 686
+ 2185
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1741792546843
+ v_weekendElectricitySelfConsumed_MWh
+ 686
+ 2225
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1741792546845
+ fm_nighttimeImports_MWh
+ 686
+ 1710
+
+ false
+ true
+ true
+
+ J_FlowsMap
+
+ new J_FlowsMap()
+
+
+
+
+ 1741792546847
+ fm_nighttimeExports_MWh
+ 686
+ 1730
+
+ false
+ true
+ true
+
+ J_FlowsMap
+
+ new J_FlowsMap()
+
+
+
+
+ 1741792546849
+ fm_weekdayImports_MWh
+ 686
+ 2060
+
+ false
+ true
+ true
+
+ J_FlowsMap
+
+ new J_FlowsMap()
+
+
+
+
+ 1741792546851
+ fm_weekdayExports_MWh
+ 686
+ 2080
+
+ false
+ true
+ true
+
+ J_FlowsMap
+
+ new J_FlowsMap()
+
+
+
+
+ 1741792546853
+ fm_weekendImports_MWh
+ 686
+ 2350
+
+ false
+ true
+ true
+
+ J_FlowsMap
+
+ new J_FlowsMap()
+
+
+
+
+ 1741792546855
+ fm_weekendExports_MWh
+ 686
+ 2370
+
+ false
+ true
+ true
+
+ J_FlowsMap
+
+ new J_FlowsMap()
+
+
+
+
+ 1741792546857
+ dsm_dailyAverageConsumptionDataSets_kW
+ 180
+ 560
+
+ false
+ true
+ true
+
+ J_DataSetMap
+
+ new J_DataSetMap(OL_EnergyCarriers.class)
+
+
+
+
+ 1741792546859
+ dsm_dailyAverageProductionDataSets_kW
+ 180
+ 580
+
+ false
+ true
+ true
+
+ J_DataSetMap
+
+ new J_DataSetMap(OL_EnergyCarriers.class)
+
+
+
+
+ 1741792546861
+ dsm_summerWeekConsumptionDataSets_kW
+ 180
+ 860
+
+ false
+ true
+ true
+
+ J_DataSetMap
+
+ new J_DataSetMap(OL_EnergyCarriers.class)
+
+
+
+
+ 1741792546863
+ dsm_summerWeekProductionDataSets_kW
+ 180
+ 883
+
+ false
+ true
+ true
+
+ J_DataSetMap
+
+ new J_DataSetMap(OL_EnergyCarriers.class)
+
+
+
+
+ 1741792546865
+ dsm_winterWeekConsumptionDataSets_kW
+ 184
+ 1100
+
+ false
+ true
+ true
+
+ J_DataSetMap
+
+ new J_DataSetMap(OL_EnergyCarriers.class)
+
+
+
+
+ 1741792546867
+ dsm_winterWeekProductionDataSets_kW
+ 184
+ 1120
+
+ false
+ true
+ true
+
+ J_DataSetMap
+
+ new J_DataSetMap(OL_EnergyCarriers.class)
+
+
+
+
+ 1741792546869
+ dsm_liveConsumption_kW
+ 180
+ 150
+
+ false
+ true
+ true
+
+ J_DataSetMap
+
+ new J_DataSetMap(OL_EnergyCarriers.class)
+
+
+
+
+ 1741792546871
+ dsm_liveProduction_kW
+ 180
+ 170
+
+ false
+ true
+ true
+
+ J_DataSetMap
+
+ new J_DataSetMap(OL_EnergyCarriers.class)
+
+
+
+
+ 1741792546873
+ v_totalEnergyCurtailed_MWh
+ 1726
+ 180
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1741792546875
+ v_totalWindGeneration_MWh
+ 1726
+ 100
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1741792546877
+ v_totalPVGeneration_MWh
+ 1726
+ 80
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1741792546879
+ v_dataElectricityForCookingConsumptionYear_kW
+ true
+ -400
+ 810
+
+ false
+ true
+ true
+
+ DataSet
+
+
+
+ 1741792546881
+ v_dataElectricityForCookingConsumptionSummerWeek_kW
+ true
+ -410
+ 1380
+
+ false
+ true
+ true
+
+ DataSet
+
+
+
+ 1741792546883
+ v_dataElectricityForCookingConsumptionWinterWeek_kW
+ true
+ -360
+ 2030
+
+ false
+ true
+ true
+
+ DataSet
+
+
+
+ 1741792546885
+ v_dataElectricityForCookingConsumptionLiveWeek_kW
+ true
+ -330
+ 200
+
+ false
+ true
+ true
+
+ DataSet
+
+
+
+ 1741792546887
+ v_liveProductionEnergyCarriers
+ 1270
+ 700
+
+ false
+ true
+ true
+
+ EnumSet<OL_EnergyCarriers>
+
+
+
+ 1741792546889
+ v_liveConsumptionEnergyCarriers
+ 1270
+ 720
+
+ false
+ true
+ true
+
+ EnumSet<OL_EnergyCarriers>
+
+
+
+ 1741792546891
+ b_isRealDeliveryCapacityAvailable
+ 1216
+ 360
+
+ false
+ true
+ true
+
+ boolean
+
+ false
+
+
+
+
+ 1741792546893
+ b_isRealFeedinCapacityAvailable
+ 1216
+ 380
+
+ false
+ true
+ true
+
+ boolean
+
+ false
+
+
+
+
+ 1741792546897
+ v_dataCHPElectricityProductionLiveWeek_kW
+ true
+ -330
+ 340
+
+ false
+ true
+ true
+
+ DataSet
+
+
+
+ 1741792546899
+ v_dataElectricityCHPProductionYear_kW
+ true
+ -400
+ 950
+
+ false
+ true
+ true
+
+ DataSet
+
+
+
+ 1741792546901
+ v_dataElectricityCHPProductionSummerWeek_kW
+ true
+ -410
+ 1510
+
+ false
+ true
+ true
+
+ DataSet
+
+
+
+ 1741792546903
+ v_dataElectricityCHPProductionWinterWeek_kW
+ true
+ -360
+ 2170
+
+ false
+ true
+ true
+
+ DataSet
+
+
+
+ 1741792546923
+ v_totalWindEnergyCurtailed_MWh
+ 1726
+ 160
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1741792546925
+ v_totalPVEnergyCurtailed_MWh
+ 1726
+ 140
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1741792546927
+ v_rooftopPVInstalled_kW
+ 1726
+ 230
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1741792546929
+ v_windInstalled_kW
+ 1726
+ 280
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1741792546931
+ v_dataBatterySOCLiveWeek_fr
+ 180
+ 360
+
+ false
+ true
+ true
+
+ DataSet
+
+ new DataSet(672)
+
+
+
+
+ 1741792546933
+ v_dataBatterySOCYear_fr
+ 180
+ 670
+
+ false
+ true
+ true
+
+ DataSet
+
+ new DataSet(roundToInt((energyModel.p_runEndTime_h - energyModel.p_runStartTime_h)/24))
+
+
+
+
+ 1741792546935
+ v_dataBatterySOCSummerWeek_fr
+ 180
+ 960
+
+ false
+ false
+ true
+
+ DataSet
+
+ new DataSet(672)
+
+
+
+
+ 1741792546937
+ v_dataBatterySOCWinterWeek_fr
+ 184
+ 1210
+
+ false
+ true
+ true
+
+ DataSet
+
+ new DataSet(672)
+
+
+
+
+ 1741792546939
+ v_batteryStorageCapacityInstalled_MWh
+ 1726
+ 310
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1741792546943
+ v_individualSelfSufficiencyEnergy_fr
+ 1726
+ 410
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1741792546945
+ v_individualSelfconsumptionEnergy_fr
+ 1726
+ 430
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1741792546947
+ v_individualPeakDelivery_kW
+ 1726
+ 460
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1741792546949
+ v_individualPeakFeedin_kW
+ 1726
+ 480
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1741792546951
+ v_gridCapacityDelivery_groupcontract_kW
+ 1216
+ 500
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1741792546953
+ v_gridCapacityFeedin_groupcontract_kW
+ 1216
+ 520
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1741792546955
+ v_engineAgent
+ 436
+ -10
+
+ false
+ true
+ true
+
+ I_EnergyData
+
+
+
+ 1741958031736
+ v_gridCapacityFeedIn_kW_rapidRun
+ 1215
+ 475
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1741958031738
+ v_gridCapacityDelivery_kW_rapidRun
+ 1215
+ 455
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1743067237799
+ v_summerWeekPrimaryEnergyProductionHeatpumps_MWh
+ 685
+ 910
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1743067333060
+ v_winterWeekPrimaryEnergyProductionHeatpumps_MWh
+ 685
+ 1195
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1743067347245
+ v_daytimePrimaryEnergyProductionHeatpumps_MWh
+ 685
+ 1515
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1743067361421
+ v_nighttimePrimaryEnergyProductionHeatpumps_MWh
+ 686
+ 1805
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1743067393031
+ v_weekdayPrimaryEnergyProductionHeatpumps_MWh
+ 686
+ 2148
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1743067406399
+ v_weekendPrimaryEnergyProductionHeatpumps_MWh
+ 686
+ 2442
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1754307361345
+ dsm_assetFlowsSummerWeek_kW
+ 180
+ 833
+
+ false
+ true
+ true
+
+ J_DataSetMap
+
+ new J_DataSetMap(OL_AssetFlowCategories.class)
+
+
+
+
+ 1754307559209
+ dsm_assetFlowsWinterWeek_kW
+ 184
+ 1069
+
+ false
+ true
+ true
+
+ J_DataSetMap
+
+ new J_DataSetMap(OL_AssetFlowCategories.class)
+
+
+
+
+ 1754307918052
+ dsm_assetFlowsAccumulators_kW
+ 180
+ 520
+
+ false
+ true
+ true
+
+ J_DataSetMap
+
+ new J_DataSetMap(OL_AssetFlowCategories.class)
+
+
+
+
+ 1754308111992
+ dsm_liveAssetFlowsAccumulators_kW
+ 180
+ 110
+
+ false
+ true
+ true
+
+ J_DataSetMap
+
+ new J_DataSetMap(OL_AssetFlowCategories.class)
+
+
+
+
+ 1754312472355
+ v_liveAssetFlowCategories
+ 1270
+ 670
+
+ false
+ true
+ true
+
+ EnumSet<OL_AssetFlowCategories>
+
+
+
+ 1758803622755
+ v_rapidRunProductionEnergyCarriers
+ 1590
+ 700
+
+ false
+ true
+ true
+
+ EnumSet<OL_EnergyCarriers>
+
+
+
+ 1758803622757
+ v_rapidRunConsumptionEnergyCarriers
+ 1590
+ 720
+
+ false
+ true
+ true
+
+ EnumSet<OL_EnergyCarriers>
+
+
+
+ 1758803622759
+ v_rapidRunAssetFlowCategories
+ 1590
+ 670
+
+ false
+ true
+ true
+
+ EnumSet<OL_AssetFlowCategories>
+
+
+
+ 1741792546958
+ p_areaType
+ 166
+ -10
+
+ false
+ true
+ true
+
+ OL_GISObjectType
+ NONE
+ false
+
+ 1741792546956
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1741792546961
+ p_name
+ 306
+ -10
+
+ false
+ true
+ true
+
+ String
+ NONE
+ false
+
+ 1741792546959
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+
+
+ VOID
+ double
+ 1741792546529
+ f_initializeMaps
+ 936
+ -10
+
+ false
+ true
+ true
+ // FlowsMaps
+fm_totalImports_MWh = new J_FlowsMap();
+fm_totalExports_MWh = new J_FlowsMap();
+fm_summerWeekImports_MWh = new J_FlowsMap();
+fm_summerWeekExports_MWh = new J_FlowsMap();
+fm_winterWeekImports_MWh = new J_FlowsMap();
+fm_winterWeekExports_MWh = new J_FlowsMap();
+fm_daytimeImports_MWh = new J_FlowsMap();
+fm_daytimeExports_MWh = new J_FlowsMap();
+fm_nighttimeImports_MWh = new J_FlowsMap();
+fm_nighttimeExports_MWh = new J_FlowsMap();
+fm_weekdayImports_MWh = new J_FlowsMap();
+fm_weekdayExports_MWh = new J_FlowsMap();
+fm_weekendImports_MWh = new J_FlowsMap();
+fm_weekendExports_MWh = new J_FlowsMap();
+
+// DataSetMaps
+dsm_liveConsumption_kW = new J_DataSetMap(OL_EnergyCarriers.class);
+dsm_liveProduction_kW = new J_DataSetMap(OL_EnergyCarriers.class);
+dsm_dailyAverageConsumptionDataSets_kW = new J_DataSetMap(OL_EnergyCarriers.class);
+dsm_dailyAverageProductionDataSets_kW = new J_DataSetMap(OL_EnergyCarriers.class);
+dsm_summerWeekConsumptionDataSets_kW = new J_DataSetMap(OL_EnergyCarriers.class);
+dsm_summerWeekProductionDataSets_kW = new J_DataSetMap(OL_EnergyCarriers.class);
+dsm_winterWeekConsumptionDataSets_kW = new J_DataSetMap(OL_EnergyCarriers.class);
+dsm_winterWeekProductionDataSets_kW = new J_DataSetMap(OL_EnergyCarriers.class);
+
+
+
+ VOID
+ double
+ 1741792546531
+ f_updatePreviousTotalsGC
+ true
+ 1246
+ -70
+
+ false
+ true
+ true
+ for (GridConnection GC : energyModel.f_getGridConnections()){
+ J_previousTotals previousTotals = c_previousTotals_GC.get(GC);
+
+ previousTotals.setPreviousTotalImports_MWh(GC.fm_totalImports_MWh);
+ previousTotals.setPreviousTotalExports_MWh(GC.fm_totalExports_MWh);
+
+ previousTotals.setPreviousTotalConsumedEnergy_MWh(GC.v_totalEnergyConsumed_MWh);
+ previousTotals.setPreviousTotalProducedEnergy_MWh(GC.v_totalEnergyProduced_MWh);
+ previousTotals.setPreviousSelfConsumedEnergy_MWh(GC.v_totalEnergySelfConsumed_MWh);
+ previousTotals.setPreviousImportedEnergy_MWh(GC.v_totalEnergyImport_MWh);
+ previousTotals.setPreviousExportedEnergy_MWh(GC.v_totalEnergyExport_MWh);
+ previousTotals.setPreviousSelfConsumedElectricity_MWh(GC.v_totalElectricitySelfConsumed_MWh);
+ previousTotals.setPreviousElectricityConsumed_MWh(GC.v_totalElectricityConsumed_MWh);
+
+ //Overload
+ previousTotals.setPreviousOverloadDurationDelivery_hr(GC.v_totalOverloadDurationDelivery_hr);
+ previousTotals.setPreviousOverloadDurationFeedin_hr(GC.v_totalOverloadDurationFeedin_hr);
+}
+
+
+
+ VOID
+ double
+ 1741792546533
+ f_fillEnergyDataViewer
+ 1226
+ -250
+
+ false
+ true
+ true
+
+ data
+ I_EnergyData
+
+ v_engineAgent = data;
+
+//Set live and rapidrun EnumSets for EnergyCarriers and AssetFlowCategories
+v_liveConsumptionEnergyCarriers = data.getLiveData().activeConsumptionEnergyCarriers;
+v_liveProductionEnergyCarriers = data.getLiveData().activeProductionEnergyCarriers;
+v_liveAssetFlowCategories = data.getLiveData().assetsMetaData.activeAssetFlows;
+
+//Update variables
+f_updateLiveDatasets(data);
+
+if (data.getRapidRunData() != null) {
+ v_rapidRunConsumptionEnergyCarriers = data.getRapidRunData().activeConsumptionEnergyCarriers;
+ v_rapidRunProductionEnergyCarriers = data.getRapidRunData().activeProductionEnergyCarriers;
+ v_rapidRunAssetFlowCategories = data.getRapidRunData().assetsMetaData.activeAssetFlows;
+
+ //Update variables
+ f_updateVariables(data);
+
+ //Update variables
+ f_updateWeeklyDatasets(data);
+
+ //Update variables
+ f_updateYearlyDatasets(data);
+
+ //Get duurkromme
+ f_updateLoadDurationCurve(data);
+}
+
+
+
+ VOID
+ double
+ 1741792546535
+ f_updateVariables
+ 1246
+ -220
+
+ false
+ true
+ true
+
+ data
+ I_EnergyData
+
+ //Grid capacity
+v_gridCapacityDelivery_kW = data.getLiveData().connectionMetaData.contractedDeliveryCapacity_kW;
+v_gridCapacityFeedIn_kW = data.getLiveData().connectionMetaData.contractedFeedinCapacity_kW;
+
+v_gridCapacityDelivery_kW_rapidRun = data.getRapidRunData().connectionMetaData.contractedDeliveryCapacity_kW;
+v_gridCapacityFeedIn_kW_rapidRun = data.getRapidRunData().connectionMetaData.contractedFeedinCapacity_kW;
+//area.v_gridCapacityDelivery_groupcontract_kW = GC.p_contractedDeliveryCapacity_kW;
+//area.v_gridCapacityFeedin_groupcontract_kW = GC.p_contractedFeedinCapacity_kW;
+
+b_isRealDeliveryCapacityAvailable = data.getLiveData().connectionMetaData.contractedDeliveryCapacityKnown;
+b_isRealFeedinCapacityAvailable = data.getLiveData().connectionMetaData.contractedFeedinCapacityKnown;
+
+//Installed Asset variables
+v_batteryStorageCapacityInstalled_MWh = data.getLiveData().assetsMetaData.totalInstalledBatteryStorageCapacity_MWh;
+
+// KPIs for individual vs collective plots
+v_individualSelfconsumptionElectricity_fr = data.getRapidRunData().getTotalElectricitySelfConsumed_MWh()/data.getRapidRunData().getTotalElectricityConsumed_MWh();
+v_individualSelfSufficiencyElectricity_fr = data.getRapidRunData().getTotalElectricitySelfConsumed_MWh()/data.getRapidRunData().getTotalElectricityProduced_MWh();
+
+v_individualSelfconsumptionEnergy_fr = data.getRapidRunData().getTotalEnergySelfConsumed_MWh()/data.getRapidRunData().getTotalEnergyConsumed_MWh();
+v_individualSelfSufficiencyEnergy_fr = data.getRapidRunData().getTotalEnergySelfConsumed_MWh()/data.getRapidRunData().getTotalEnergyProduced_MWh();
+
+v_individualPeakDelivery_kW = data.getRapidRunData().getPeakDelivery_kW();
+v_individualPeakFeedin_kW = data.getRapidRunData().getPeakFeedin_kW();
+
+//========== TOTALS ==========//
+fm_totalImports_MWh.clear();
+fm_totalExports_MWh.clear();
+
+for (OL_EnergyCarriers energyCarrier : data.getRapidRunData().activeConsumptionEnergyCarriers) {
+ fm_totalImports_MWh.put( energyCarrier, data.getRapidRunData().getTotalImport_MWh(energyCarrier) );
+}
+for (OL_EnergyCarriers energyCarrier : data.getRapidRunData().activeProductionEnergyCarriers) {
+ fm_totalExports_MWh.put( energyCarrier, data.getRapidRunData().getTotalExport_MWh(energyCarrier) );
+}
+
+v_totalEnergyImport_MWh = data.getRapidRunData().getTotalEnergyImport_MWh();
+v_totalEnergyExport_MWh = data.getRapidRunData().getTotalEnergyExport_MWh();
+
+v_totalEnergyConsumed_MWh = data.getRapidRunData().getTotalEnergyConsumed_MWh();
+v_totalEnergyProduced_MWh = data.getRapidRunData().getTotalEnergyProduced_MWh();
+v_totalEnergySelfConsumed_MWh = data.getRapidRunData().getTotalEnergySelfConsumed_MWh();
+
+v_totalElectricityConsumed_MWh = data.getRapidRunData().getTotalElectricityConsumed_MWh();
+v_totalElectricityProduced_MWh = data.getRapidRunData().getTotalElectricityProduced_MWh();
+v_totalElectricitySelfConsumed_MWh = data.getRapidRunData().getTotalElectricitySelfConsumed_MWh();
+
+v_annualOverloadDurationDelivery_hr = data.getRapidRunData().getTotalOverloadDurationDelivery_hr();
+v_annualOverloadDurationFeedin_hr = data.getRapidRunData().getTotalOverloadDurationFeedin_hr();
+
+v_totalEnergyConsumptionForDistrictHeating_MWh = data.getRapidRunData().getTotalDistrictHeatingConsumption_MWh();
+v_totalPrimaryEnergyProductionHeatpumps_MWh = data.getRapidRunData().getTotalPrimaryEnergyProductionHeatpumps_MWh();
+
+//========== SUMMER/WINTER WEEK ==========//
+fm_summerWeekImports_MWh.clear();
+fm_winterWeekImports_MWh.clear();
+fm_summerWeekExports_MWh.clear();
+fm_winterWeekExports_MWh.clear();
+
+for (OL_EnergyCarriers energyCarrier : data.getRapidRunData().activeConsumptionEnergyCarriers) {
+ fm_summerWeekImports_MWh.put( energyCarrier, data.getRapidRunData().getSummerWeekImport_MWh(energyCarrier) );
+ fm_winterWeekImports_MWh.put( energyCarrier, data.getRapidRunData().getWinterWeekImport_MWh(energyCarrier) );
+}
+for (OL_EnergyCarriers energyCarrier : data.getRapidRunData().activeProductionEnergyCarriers) {
+ fm_summerWeekExports_MWh.put( energyCarrier, data.getRapidRunData().getSummerWeekExport_MWh(energyCarrier) );
+ fm_winterWeekExports_MWh.put( energyCarrier, data.getRapidRunData().getWinterWeekExport_MWh(energyCarrier) );
+}
+
+v_summerWeekEnergyImport_MWh = data.getRapidRunData().getSummerWeekEnergyImport_MWh();
+v_summerWeekEnergyExport_MWh = data.getRapidRunData().getSummerWeekEnergyExport_MWh();
+
+v_summerWeekEnergyConsumed_MWh = data.getRapidRunData().getSummerWeekEnergyConsumed_MWh();
+v_summerWeekEnergyProduced_MWh = data.getRapidRunData().getSummerWeekEnergyProduced_MWh();
+v_summerWeekEnergySelfConsumed_MWh = data.getRapidRunData().getSummerWeekEnergySelfConsumed_MWh();
+
+v_summerWeekElectricityConsumed_MWh = data.getRapidRunData().getSummerWeekElectricityConsumed_MWh();
+v_summerWeekElectricityProduced_MWh = data.getRapidRunData().getSummerWeekElectricityProduced_MWh();
+v_summerWeekElectricitySelfConsumed_MWh = data.getRapidRunData().getSummerWeekElectricitySelfConsumed_MWh();
+
+v_summerWeekPrimaryEnergyProductionHeatpumps_MWh = data.getRapidRunData().getSummerWeekPrimaryEnergyProductionHeatpumps_MWh();
+
+v_winterWeekEnergyImport_MWh = data.getRapidRunData().getWinterWeekEnergyImport_MWh();
+v_winterWeekEnergyExport_MWh = data.getRapidRunData().getWinterWeekEnergyExport_MWh();
+
+v_winterWeekEnergyConsumed_MWh = data.getRapidRunData().getWinterWeekEnergyConsumed_MWh();
+v_winterWeekEnergyProduced_MWh = data.getRapidRunData().getWinterWeekEnergyProduced_MWh();
+v_winterWeekEnergySelfConsumed_MWh = data.getRapidRunData().getWinterWeekEnergySelfConsumed_MWh();
+
+v_winterWeekElectricityConsumed_MWh = data.getRapidRunData().getWinterWeekElectricityConsumed_MWh();
+v_winterWeekElectricityProduced_MWh = data.getRapidRunData().getWinterWeekElectricityProduced_MWh();
+v_winterWeekElectricitySelfConsumed_MWh = data.getRapidRunData().getWinterWeekElectricitySelfConsumed_MWh();
+
+v_winterWeekPrimaryEnergyProductionHeatpumps_MWh = data.getRapidRunData().getWinterWeekPrimaryEnergyProductionHeatpumps_MWh();
+
+//========== DAY/NIGHT ==========//
+fm_daytimeImports_MWh.clear();
+fm_nighttimeImports_MWh.clear();
+fm_daytimeExports_MWh.clear();
+fm_nighttimeExports_MWh.clear();
+
+for (OL_EnergyCarriers energyCarrier : data.getRapidRunData().activeConsumptionEnergyCarriers) {
+ fm_daytimeImports_MWh.put( energyCarrier, data.getRapidRunData().getDaytimeImport_MWh(energyCarrier) );
+ fm_nighttimeImports_MWh.put( energyCarrier, data.getRapidRunData().getNighttimeImport_MWh(energyCarrier) );
+}
+for (OL_EnergyCarriers energyCarrier : data.getRapidRunData().activeProductionEnergyCarriers) {
+ fm_daytimeExports_MWh.put( energyCarrier, data.getRapidRunData().getDaytimeExport_MWh(energyCarrier) );
+ fm_nighttimeExports_MWh.put( energyCarrier, data.getRapidRunData().getNighttimeExport_MWh(energyCarrier) );
+}
+
+v_daytimeEnergyImport_MWh = data.getRapidRunData().getDaytimeEnergyImport_MWh();
+v_daytimeEnergyExport_MWh = data.getRapidRunData().getDaytimeEnergyExport_MWh();
+
+v_daytimeEnergyConsumed_MWh = data.getRapidRunData().getDaytimeEnergyConsumed_MWh();
+v_daytimeEnergyProduced_MWh = data.getRapidRunData().getDaytimeEnergyProduced_MWh();
+v_daytimeEnergySelfConsumed_MWh = data.getRapidRunData().getDaytimeEnergySelfConsumed_MWh();
+
+v_daytimeElectricityConsumed_MWh = data.getRapidRunData().getDaytimeElectricityConsumed_MWh();
+v_daytimeElectricityProduced_MWh = data.getRapidRunData().getDaytimeElectricityProduced_MWh();
+v_daytimeElectricitySelfConsumed_MWh = data.getRapidRunData().getDaytimeElectricitySelfConsumed_MWh();
+
+v_daytimePrimaryEnergyProductionHeatpumps_MWh = data.getRapidRunData().getDaytimePrimaryEnergyProductionHeatpumps_MWh();
+
+v_nighttimeEnergyImport_MWh = data.getRapidRunData().getNighttimeEnergyImport_MWh();
+v_nighttimeEnergyExport_MWh = data.getRapidRunData().getNighttimeEnergyExport_MWh();
+
+v_nighttimeEnergyConsumed_MWh = data.getRapidRunData().getNighttimeEnergyConsumed_MWh();
+v_nighttimeEnergyProduced_MWh = data.getRapidRunData().getNighttimeEnergyProduced_MWh();
+v_nighttimeEnergySelfConsumed_MWh = data.getRapidRunData().getNighttimeEnergySelfConsumed_MWh();
+
+v_nighttimeElectricityConsumed_MWh = data.getRapidRunData().getNighttimeElectricityConsumed_MWh();
+v_nighttimeElectricityProduced_MWh = data.getRapidRunData().getNighttimeElectricityProduced_MWh();
+v_nighttimeElectricitySelfConsumed_MWh = data.getRapidRunData().getNighttimeElectricitySelfConsumed_MWh();
+
+v_nighttimePrimaryEnergyProductionHeatpumps_MWh = data.getRapidRunData().getNighttimePrimaryEnergyProductionHeatpumps_MWh();
+
+//========== WEEK/WEEKEND ==========//
+fm_weekdayImports_MWh.clear();
+fm_weekendImports_MWh.clear();
+fm_weekdayExports_MWh.clear();
+fm_weekendExports_MWh.clear();
+
+for (OL_EnergyCarriers energyCarrier : data.getRapidRunData().activeConsumptionEnergyCarriers) {
+ fm_weekdayImports_MWh.put( energyCarrier, data.getRapidRunData().getWeekdayImport_MWh(energyCarrier) );
+ fm_weekendImports_MWh.put( energyCarrier, data.getRapidRunData().getWeekendImport_MWh(energyCarrier) );
+}
+for (OL_EnergyCarriers energyCarrier : data.getRapidRunData().activeProductionEnergyCarriers) {
+ fm_weekdayExports_MWh.put( energyCarrier, data.getRapidRunData().getWeekdayExport_MWh(energyCarrier) );
+ fm_weekendExports_MWh.put( energyCarrier, data.getRapidRunData().getWeekendExport_MWh(energyCarrier) );
+}
+
+v_weekdayEnergyImport_MWh = data.getRapidRunData().getWeekdayEnergyImport_MWh();
+v_weekdayEnergyExport_MWh = data.getRapidRunData().getWeekdayEnergyExport_MWh();
+
+v_weekdayEnergyConsumed_MWh = data.getRapidRunData().getWeekdayEnergyConsumed_MWh();
+v_weekdayEnergyProduced_MWh = data.getRapidRunData().getWeekdayEnergyProduced_MWh();
+v_weekdayEnergySelfConsumed_MWh = data.getRapidRunData().getWeekdayEnergySelfConsumed_MWh();
+
+v_weekdayElectricityConsumed_MWh = data.getRapidRunData().getWeekdayElectricityConsumed_MWh();
+v_weekdayElectricityProduced_MWh = data.getRapidRunData().getWeekdayElectricityProduced_MWh();
+v_weekdayElectricitySelfConsumed_MWh = data.getRapidRunData().getWeekdayElectricitySelfConsumed_MWh();
+
+v_weekdayPrimaryEnergyProductionHeatpumps_MWh = data.getRapidRunData().getWeekdayPrimaryEnergyProductionHeatpumps_MWh();
+
+v_weekendEnergyImport_MWh = data.getRapidRunData().getWeekendEnergyImport_MWh();
+v_weekendEnergyExport_MWh = data.getRapidRunData().getWeekendEnergyExport_MWh();
+
+v_weekendEnergyConsumed_MWh = data.getRapidRunData().getWeekendEnergyConsumed_MWh();
+v_weekendEnergyProduced_MWh = data.getRapidRunData().getWeekendEnergyProduced_MWh();
+v_weekendEnergySelfConsumed_MWh = data.getRapidRunData().getWeekendEnergySelfConsumed_MWh();
+
+v_weekendElectricityConsumed_MWh = data.getRapidRunData().getWeekendElectricityConsumed_MWh();
+v_weekendElectricityProduced_MWh = data.getRapidRunData().getWeekendElectricityProduced_MWh();
+v_weekendElectricitySelfConsumed_MWh = data.getRapidRunData().getWeekendElectricitySelfConsumed_MWh();
+
+v_weekendPrimaryEnergyProductionHeatpumps_MWh = data.getRapidRunData().getWeekendPrimaryEnergyProductionHeatpumps_MWh();
+
+
+
+ VOID
+ double
+ 1741792546537
+ f_updateLiveDatasets
+ 1246
+ -200
+
+ false
+ true
+ true
+
+ data
+ I_EnergyData
+
+ //Datasets for live charts
+//========== CONSUMPTION ==========//
+dsm_liveConsumption_kW = data.getLiveData().dsm_liveDemand_kW;
+dsm_liveAssetFlowsAccumulators_kW = data.getLiveData().dsm_liveAssetFlows_kW;
+/*
+v_dataElectricityBaseloadConsumptionLiveWeek_kW = data.getLiveData().data_baseloadElectricityDemand_kW;
+v_dataElectricityForHeatConsumptionLiveWeek_kW = data.getLiveData().data_heatPumpElectricityDemand_kW;
+v_dataElectricityForTransportConsumptionLiveWeek_kW = data.getLiveData().data_electricVehicleDemand_kW;
+v_dataElectricityForStorageConsumptionLiveWeek_kW = data.getLiveData().data_batteryCharging_kW;
+v_dataElectricityForHydrogenConsumptionLiveWeek_kW = data.getLiveData().data_hydrogenElectricityDemand_kW;
+v_dataElectricityForCookingConsumptionLiveWeek_kW = data.getLiveData().data_cookingElectricityDemand_kW;
+v_dataDistrictHeatConsumptionLiveWeek_kW = data.getLiveData().data_districtHeatDelivery_kW;
+*/
+//========== PRODUCTION ==========//
+dsm_liveProduction_kW = data.getLiveData().dsm_liveSupply_kW;
+/*
+v_dataWindElectricityProductionLiveWeek_kW = data.getLiveData().data_windGeneration_kW;
+v_dataPVElectricityProductionLiveWeek_kW = data.getLiveData().data_PVGeneration_kW;
+v_dataStorageElectricityProductionLiveWeek_kW = data.getLiveData().data_batteryDischarging_kW;
+v_dataV2GElectricityProductionLiveWeek_kW = data.getLiveData().data_V2GSupply_kW;
+v_dataCHPElectricityProductionLiveWeek_kW = data.getLiveData().data_CHPElectricityProductionLiveWeek_kW;
+*/
+//SOC
+v_dataBatterySOCLiveWeek_fr.reset();
+for (int i = 0; i < data.getLiveData().data_batteryStoredEnergyLiveWeek_MWh.size(); i++) {
+ // Get the x and y values from the source dataset
+ double x = data.getLiveData().data_batteryStoredEnergyLiveWeek_MWh.getX(i);
+ double y = data.getLiveData().data_batteryStoredEnergyLiveWeek_MWh.getY(i);
+
+ // Modify the y value (e.g., divide it by 2)
+ double SOC = v_batteryStorageCapacityInstalled_MWh > 0 ? y / v_batteryStorageCapacityInstalled_MWh : 0;
+
+ // Add the new x and y values to the target dataset
+ v_dataBatterySOCLiveWeek_fr.add(x, SOC);
+}
+
+//Total
+v_dataNetLoadLiveWeek_kW = data.getLiveData().data_liveElectricityBalance_kW;
+
+//Capacity
+v_dataElectricityDeliveryCapacityLiveWeek_kW = data.getLiveData().data_gridCapacityDemand_kW;
+v_dataElectricityFeedInCapacityLiveWeek_kW = data.getLiveData().data_gridCapacitySupply_kW;
+
+
+
+ VOID
+ double
+ 1741792546539
+ f_updateWeeklyDatasets
+ 1246
+ -180
+
+ false
+ true
+ true
+
+ data
+ I_EnergyData
+
+ //========== SUMMER WEEK ==========//
+// Consumption
+double summerWeekStartTime_h = energyModel.p_startOfSummerWeek_h - energyModel.p_runStartTime_h;
+dsm_summerWeekConsumptionDataSets_kW = data.getRapidRunData().am_summerWeekConsumptionAccumulators_kW.getDataSetMap(summerWeekStartTime_h);
+for (OL_AssetFlowCategories AC : data.getRapidRunData().am_assetFlowsSummerWeek_kW.keySet()) {
+ dsm_assetFlowsSummerWeek_kW.put(AC, data.getRapidRunData().am_assetFlowsSummerWeek_kW.get(AC).getDataSet(summerWeekStartTime_h));
+}
+/*
+v_dataElectricityBaseloadConsumptionSummerWeek_kW = data.getRapidRunData().acc_summerWeekBaseloadElectricityConsumption_kW.getDataSet(summerWeekStartTime_h);
+v_dataElectricityForHeatConsumptionSummerWeek_kW = data.getRapidRunData().acc_summerWeekHeatPumpElectricityConsumption_kW.getDataSet(summerWeekStartTime_h);
+v_dataElectricityForTransportConsumptionSummerWeek_kW = data.getRapidRunData().acc_summerWeekElectricVehicleConsumption_kW.getDataSet(summerWeekStartTime_h);
+v_dataElectricityForStorageConsumptionSummerWeek_kW = data.getRapidRunData().acc_summerWeekBatteriesConsumption_kW.getDataSet(summerWeekStartTime_h);
+v_dataElectricityForCookingConsumptionSummerWeek_kW = data.getRapidRunData().acc_summerWeekElectricCookingConsumption_kW.getDataSet(summerWeekStartTime_h);
+v_dataElectricityForHydrogenConsumptionSummerWeek_kW = data.getRapidRunData().acc_summerWeekElectrolyserElectricityConsumption_kW.getDataSet(summerWeekStartTime_h);
+v_dataDistrictHeatConsumptionSummerWeek_kW = data.getRapidRunData().acc_summerWeekDistrictHeatingConsumption_kW.getDataSet(summerWeekStartTime_h);
+*/
+// Production
+dsm_summerWeekProductionDataSets_kW = data.getRapidRunData().am_summerWeekProductionAccumulators_kW.getDataSetMap(summerWeekStartTime_h);
+/*
+v_dataElectricityWindProductionSummerWeek_kW = data.getRapidRunData().acc_summerWeekWindProduction_kW.getDataSet(summerWeekStartTime_h);
+v_dataElectricityPVProductionSummerWeek_kW = data.getRapidRunData().acc_summerWeekPVProduction_kW.getDataSet(summerWeekStartTime_h);
+v_dataElectricityStorageProductionSummerWeek_kW = data.getRapidRunData().acc_summerWeekBatteriesProduction_kW.getDataSet(summerWeekStartTime_h);
+v_dataElectricityV2GProductionSummerWeek_kW = data.getRapidRunData().acc_summerWeekV2GProduction_kW.getDataSet(summerWeekStartTime_h);
+v_dataElectricityCHPProductionSummerWeek_kW = data.getRapidRunData().acc_summerWeekCHPElectricityProduction_kW.getDataSet(summerWeekStartTime_h);
+*/
+// Other
+v_dataNetLoadSummerWeek_kW = data.getRapidRunData().am_summerWeekBalanceAccumulators_kW.get(OL_EnergyCarriers.ELECTRICITY).getDataSet(summerWeekStartTime_h);
+
+DataSet summerWeekBatteryStorage = data.getRapidRunData().ts_summerWeekBatteriesStoredEnergy_MWh.getDataSet(summerWeekStartTime_h);
+v_dataBatterySOCSummerWeek_fr.reset();
+for (int i = 0; i < summerWeekBatteryStorage.size(); i++) {
+ // Get the x and y values from the source dataset
+ double x = summerWeekBatteryStorage.getX(i);
+ double y = summerWeekBatteryStorage.getY(i);
+
+ // Modify the y value (e.g., divide it by 2)
+ double SOC = v_batteryStorageCapacityInstalled_MWh > 0 ? y / v_batteryStorageCapacityInstalled_MWh : 0;
+
+ // Add the new x and y values to the target dataset
+ v_dataBatterySOCSummerWeek_fr.add(x, SOC);
+}
+
+//========== WINTER WEEK ==========//
+// Consumption
+double winterWeekStartTime_h = energyModel.p_startOfWinterWeek_h - energyModel.p_runStartTime_h;
+dsm_winterWeekConsumptionDataSets_kW = data.getRapidRunData().am_winterWeekConsumptionAccumulators_kW.getDataSetMap(winterWeekStartTime_h);
+for (OL_AssetFlowCategories AC : data.getRapidRunData().am_assetFlowsWinterWeek_kW.keySet()) {
+ dsm_assetFlowsWinterWeek_kW.put(AC, data.getRapidRunData().am_assetFlowsWinterWeek_kW.get(AC).getDataSet(winterWeekStartTime_h));
+}
+
+/*v_dataElectricityBaseloadConsumptionWinterWeek_kW = data.getRapidRunData().acc_winterWeekBaseloadElectricityConsumption_kW.getDataSet(winterWeekStartTime_h);
+v_dataElectricityForHeatConsumptionWinterWeek_kW = data.getRapidRunData().acc_winterWeekHeatPumpElectricityConsumption_kW.getDataSet(winterWeekStartTime_h);
+v_dataElectricityForTransportConsumptionWinterWeek_kW = data.getRapidRunData().acc_winterWeekElectricVehicleConsumption_kW.getDataSet(winterWeekStartTime_h);
+v_dataElectricityForStorageConsumptionWinterWeek_kW = data.getRapidRunData().acc_winterWeekBatteriesConsumption_kW.getDataSet(winterWeekStartTime_h);
+v_dataElectricityForCookingConsumptionWinterWeek_kW = data.getRapidRunData().acc_winterWeekElectricCookingConsumption_kW.getDataSet(winterWeekStartTime_h);
+v_dataElectricityForHydrogenConsumptionWinterWeek_kW = data.getRapidRunData().acc_winterWeekElectrolyserElectricityConsumption_kW.getDataSet(winterWeekStartTime_h);
+v_dataDistrictHeatConsumptionWinterWeek_kW = data.getRapidRunData().acc_winterWeekDistrictHeatingConsumption_kW.getDataSet(winterWeekStartTime_h);
+*/
+// Production
+dsm_winterWeekProductionDataSets_kW = data.getRapidRunData().am_winterWeekProductionAccumulators_kW.getDataSetMap(winterWeekStartTime_h);
+/*
+v_dataElectricityWindProductionWinterWeek_kW = data.getRapidRunData().acc_winterWeekWindProduction_kW.getDataSet(winterWeekStartTime_h);
+v_dataElectricityPVProductionWinterWeek_kW = data.getRapidRunData().acc_winterWeekPVProduction_kW.getDataSet(winterWeekStartTime_h);
+v_dataElectricityStorageProductionWinterWeek_kW = data.getRapidRunData().acc_winterWeekBatteriesProduction_kW.getDataSet(winterWeekStartTime_h);
+v_dataElectricityV2GProductionWinterWeek_kW = data.getRapidRunData().acc_winterWeekV2GProduction_kW.getDataSet(winterWeekStartTime_h);
+v_dataElectricityCHPProductionWinterWeek_kW = data.getRapidRunData().acc_winterWeekCHPElectricityProduction_kW.getDataSet(winterWeekStartTime_h);
+*/
+// Other
+v_dataNetLoadWinterWeek_kW = data.getRapidRunData().am_winterWeekBalanceAccumulators_kW.get(OL_EnergyCarriers.ELECTRICITY).getDataSet(winterWeekStartTime_h);
+
+DataSet winterWeekBatteryStorage = data.getRapidRunData().ts_winterWeekBatteriesStoredEnergy_MWh.getDataSet(winterWeekStartTime_h);
+v_dataBatterySOCWinterWeek_fr.reset();
+for (int i = 0; i < winterWeekBatteryStorage.size(); i++) {
+ // Get the x and y values from the source dataset
+ double x = winterWeekBatteryStorage.getX(i);
+ double y = winterWeekBatteryStorage.getY(i);
+
+ // Modify the y value (e.g., divide it by 2)
+ double SOC = v_batteryStorageCapacityInstalled_MWh > 0 ? y / v_batteryStorageCapacityInstalled_MWh : 0;
+
+ // Add the new x and y values to the target dataset
+ v_dataBatterySOCWinterWeek_fr.add(x, SOC);
+}
+
+
+ VOID
+ double
+ 1741792546541
+ f_updateYearlyDatasets
+ 1246
+ -160
+
+ false
+ true
+ true
+
+ data
+ I_EnergyData
+
+ //Datasets for yearly profiles chart
+//Demand
+double startTime_h = energyModel.p_runStartTime_h;
+dsm_dailyAverageConsumptionDataSets_kW = data.getRapidRunData().am_dailyAverageConsumptionAccumulators_kW.getDataSetMap(startTime_h);
+dsm_dailyAverageProductionDataSets_kW = data.getRapidRunData().am_dailyAverageProductionAccumulators_kW.getDataSetMap(startTime_h);
+dsm_assetFlowsAccumulators_kW = data.getRapidRunData().am_assetFlowsAccumulators_kW.getDataSetMap(startTime_h);
+/*
+v_dataElectricityBaseloadConsumptionYear_kW = data.getRapidRunData().acc_dailyAverageBaseloadElectricityConsumption_kW.getDataSet(startTime_h);
+v_dataElectricityForHeatConsumptionYear_kW = data.getRapidRunData().acc_dailyAverageHeatPumpElectricityConsumption_kW.getDataSet(startTime_h);
+v_dataElectricityForTransportConsumptionYear_kW = data.getRapidRunData().acc_dailyAverageElectricVehicleConsumption_kW.getDataSet(startTime_h);
+v_dataElectricityForStorageConsumptionYear_kW = data.getRapidRunData().acc_dailyAverageBatteriesConsumption_kW.getDataSet(startTime_h);
+v_dataElectricityForHydrogenConsumptionYear_kW = data.getRapidRunData().acc_dailyAverageElectrolyserElectricityConsumption_kW.getDataSet(startTime_h);
+v_dataElectricityForCookingConsumptionYear_kW = data.getRapidRunData().acc_dailyAverageElectricCookingConsumption_kW.getDataSet(startTime_h);
+v_dataDistrictHeatConsumptionYear_kW = data.getRapidRunData().acc_dailyAverageDistrictHeatingConsumption_kW.getDataSet(startTime_h);
+*/
+data_dailyAverageFinalEnergyConsumption_kW = data.getRapidRunData().acc_dailyAverageFinalEnergyConsumption_kW.getDataSet(startTime_h);
+
+//Supply
+/*
+v_dataElectricityWindProductionYear_kW = data.getRapidRunData().acc_dailyAverageWindProduction_kW.getDataSet(startTime_h);
+v_dataElectricityPVProductionYear_kW = data.getRapidRunData().acc_dailyAveragePVProduction_kW.getDataSet(startTime_h);
+v_dataElectricityStorageProductionYear_kW = data.getRapidRunData().acc_dailyAverageBatteriesProduction_kW.getDataSet(startTime_h);
+v_dataElectricityV2GProductionYear_kW = data.getRapidRunData().acc_dailyAverageV2GProduction_kW.getDataSet(startTime_h);
+v_dataElectricityCHPProductionYear_kW = data.getRapidRunData().acc_dailyAverageCHPElectricityProduction_kW.getDataSet(startTime_h);
+*/
+if (data.getRapidRunData().ts_dailyAverageBatteriesStoredEnergy_MWh != null) {
+ DataSet totalBatteryStorage = data.getRapidRunData().ts_dailyAverageBatteriesStoredEnergy_MWh.getDataSet(startTime_h);
+ v_dataBatterySOCYear_fr.reset();
+ for (int i = 0; i < totalBatteryStorage.size(); i++) {
+ // Get the x and y values from the source dataset
+ double x = totalBatteryStorage.getX(i);
+ double y = totalBatteryStorage.getY(i);
+
+ // Modify the y value (e.g., divide it by 2)
+ double SOC = v_batteryStorageCapacityInstalled_MWh > 0 ? y / v_batteryStorageCapacityInstalled_MWh : 0;
+
+ // Add the new x and y values to the target dataset
+ v_dataBatterySOCYear_fr.add(x, SOC);
+ }
+}
+
+
+ VOID
+ double
+ 1741792546543
+ f_addTimeStepLiveDataSetsGC
+ true
+ 1246
+ -90
+
+ false
+ true
+ true
+
+ data
+ I_EnergyData
+
+ //Update SOC live plot
+double batteryStoredEnergyLiveWeek_MWh = 0;
+int i = max(0, data.getLiveData().data_batteryStoredEnergyLiveWeek_MWh.size() - 1);
+batteryStoredEnergyLiveWeek_MWh = data.getLiveData().data_batteryStoredEnergyLiveWeek_MWh.getY(i);
+double timeAxisValue = data.getLiveData().data_batteryStoredEnergyLiveWeek_MWh.getX(i);
+double SOC = v_batteryStorageCapacityInstalled_MWh > 0 ? batteryStoredEnergyLiveWeek_MWh / v_batteryStorageCapacityInstalled_MWh : 0;
+v_dataBatterySOCLiveWeek_.add(timeAxisValue, SOC);
+
+
+
+ VOID
+ double
+ 1741792546545
+ f_updateLoadDurationCurve
+ 1246
+ -140
+
+ false
+ true
+ true
+
+ data
+ I_EnergyData
+
+ J_LoadDurationCurves ldc = data.getRapidRunData().getLoadDurationCurves(energyModel);
+
+v_dataNetbelastingDuurkrommeYear_kW = ldc.ds_loadDurationCurveTotal_kW;
+v_dataNetbelastingDuurkrommeYearVorige_kW = ldc.ds_previousLoadDurationCurveTotal_kW;
+
+v_dataNetbelastingDuurkrommeSummer_kW = ldc.ds_loadDurationCurveSummer_kW;
+v_dataNetbelastingDuurkrommeWinter_kW = ldc.ds_loadDurationCurveWinter_kW;
+v_dataNetbelastingDuurkrommeDaytime_kW = ldc.ds_loadDurationCurveDaytime_kW;
+v_dataNetbelastingDuurkrommeNighttime_kW = ldc.ds_loadDurationCurveNighttime_kW;
+v_dataNetbelastingDuurkrommeWeekend_kW = ldc.ds_loadDurationCurveWeekend_kW;
+v_dataNetbelastingDuurkrommeWeekday_kW = ldc.ds_loadDurationCurveWeekday_kW;
+
+
+ VOID
+ double
+ 1741858724892
+ f_updateLiveActiveAssetBooleans
+ true
+ 1246
+ -110
+
+ false
+ true
+ true
+
+ data
+ I_EnergyData
+
+ b_hasElectricHeating = data.getLiveData().assetsMetaData.hasElectricHeating;
+b_hasElectricTransport = data.getLiveData().assetsMetaData.hasElectricTransport;
+b_hasPV = data.getLiveData().assetsMetaData.hasPV;
+b_hasWindturbine = data.getLiveData().assetsMetaData.hasWindturbine;
+b_hasBattery = data.getLiveData().assetsMetaData.hasBattery;
+b_hasHeatGridConnection = data.getLiveData().assetsMetaData.hasHeatGridConnection;
+b_hasCHP = data.getLiveData().assetsMetaData.hasCHP;
+b_hasV2G = data.getLiveData().assetsMetaData.hasV2G;
+b_hasElectricCooking = data.getLiveData().assetsMetaData.hasElectricCooking;
+
+
+
+
+ 1705600400155
+ connections
+ 50
+ -50
+
+ false
+ true
+ true
+ false
+ COLLECTION_OF_LINKS
+ true
+ Object
+ SOLID
+ 1
+ -16777216
+ UNDER_AGENTS
+ NONE
+ END
+
+
+
+
+ 1741695593845
+ energyModel
+ 50
+ -100
+
+ false
+ true
+ true
+
+ zero_engine
+ EnergyModel
+
+
+
+
+
+ 1705600400161
+ level
+ 0
+ 0
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ 0
+ DIM_NON_CURRENT
+
+
+ 1741792546446
+ t_profiles
+ 316
+ 20
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ Profiles
+
+ SansSerif
+ 20
+
+
+ LEFT
+
+
+ 1741792546449
+ t_totals
+ 796
+ 30
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ Totals
+
+ SansSerif
+ 20
+
+
+ LEFT
+
+
+ 1741792546451
+ txt_liveWeek
+ 151
+ 60
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ Live Week
+
+ SansSerif
+ 16
+
+
+ LEFT
+
+
+ 1741792546453
+ txt_year
+ 151
+ 460
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ Year
+
+ SansSerif
+ 16
+
+
+ LEFT
+
+
+ 1741792546455
+ txt_summerWeek
+ 150
+ 780
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ Summer Week
+
+
+ SansSerif
+ 16
+
+
+ LEFT
+
+
+ 1741792546457
+ txt_winterWeek
+ 150
+ 1010
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ Winter Week
+
+
+ SansSerif
+ 16
+
+
+ LEFT
+
+
+ 1741792546459
+ txt_yearTotals
+ 646
+ 60
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ Year
+
+ SansSerif
+ 16
+
+
+ LEFT
+
+
+ 1741792546461
+ txt_SummerWinterWeekTotals
+ 616
+ 620
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ Summer / Winter
+
+ SansSerif
+ 16
+
+
+ LEFT
+
+
+ 1741792546463
+ t_belastingduurkromme
+ 1286
+ 20
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ Belastingduurkromme
+
+
+ SansSerif
+ 20
+
+
+ LEFT
+
+
+ 1741792546465
+ t_gn
+ 1246
+ 320
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ GridNode & Capacity
+
+ SansSerif
+ 20
+
+
+ LEFT
+
+
+ 1741792546467
+ t_other
+ 1766
+ 40
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ Other
+
+ SansSerif
+ 20
+
+
+ LEFT
+
+
+ 1741792546523
+ txt_DayNightTotals
+ 626
+ 1210
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ Day / Night
+
+ SansSerif
+ 16
+
+
+ LEFT
+
+
+ 1741792546525
+ txt_WeekdayWeekendTotals
+ 626
+ 1850
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ Weekday / Weekend
+
+ SansSerif
+ 16
+
+
+ LEFT
+
+
+ 1741792546527
+ t_liveData
+ 1280
+ 620
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ Live Data
+
+ SansSerif
+ 20
+
+
+ LEFT
+
+
+ false
+ 1741860356570
+ button_back
+ 270
+ -100
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+
+ false
+ -16777216
+ true
+ if (v_engineAgent != null) {
+ if (v_engineAgent instanceof GridConnection) {
+ ((GridConnection)v_engineAgent).va_gridConnection.navigateTo();
+ }
+ else if (v_engineAgent instanceof EnergyCoop) {
+ ((EnergyCoop)v_engineAgent).va_coop.navigateTo();
+ }
+ else if (v_engineAgent instanceof EnergyModel) {
+ ((EnergyModel)v_engineAgent).va_engine.navigateTo();
+ }
+}
+
+
+
+ Back to Agent
+
+
+
+ 1758803480802
+ t_rapidRunData
+ 1580
+ 620
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ RapidRun Data
+
+ SansSerif
+ 20
+
+
+ LEFT
+
+
+
+
+
+
+ 1741855056296
+ viewArea
+ 0
+ 0
+
+ false
+ true
+ false
+
+ 1920
+ 980
+
+
+
+
+ 1658477103140
+ EnergyModel
+ public OL_ResultScope getScope(){return OL_ResultScope.ENERGYMODEL;}
+public J_RapidRunData getRapidRunData(){return v_rapidRunData;}
+public J_LiveData getLiveData(){return v_liveData;}
+public J_RapidRunData getPreviousRapidRunData(){return v_previousRunData;}
+
+public static void forceSetOwner(Agent agent, AgentArrayList pop) throws Exception {
+ Agent owner = pop.getOwner();
+ Field f = Agent.class.getDeclaredField("d");
+ f.setAccessible(true);
+ f.set(agent, owner);
+ Field ff = Agent.class.getDeclaredField("j");
+ ff.setAccessible(true);
+ ff.set(agent, pop);
+ /*Field c = Agent.class.getDeclaredField("c");
+ traceln("Field c: %s", c);
+ c.setAccessible(true);
+ c.toString();*/
+}
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.fasterxml.jackson.databind.node.TextNode;
+import com.fasterxml.jackson.databind.node.NumericNode;
+import com.fasterxml.jackson.core.type.TypeReference;
+
+// For deserialisation
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.annotation.PropertyAccessor;
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import java.lang.reflect.Field;
+
+import java.io.FileOutputStream;
+import java.util.stream.Stream;
+import java.util.Dictionary.*;
+import java.util.Hashtable.*;
+import java.util.*;
+import java.util.stream.Collectors;
+
+import org.apache.commons.lang3.tuple.Triple;
+
+import java.io.*;
+import java.io.File;
+import java.io.IOException;
+import java.util.Date;
+import java.time.LocalDate;
+import java.time.DayOfWeek;
+import java.text.SimpleDateFormat;
+import com.fasterxml.jackson.databind.node.JsonNodeFactory;
+
+//Possibility to turn of traceln
+import java.io.OutputStream;
+import java.io.PrintStream;
+
+//Curves
+import com.anylogic.engine.markup.AbstractCurve;
+import com.anylogic.engine.markup.GISMarkupSegment;
+import com.anylogic.engine.markup.GISPoint;
+//import zero_engine.OL_EnergyCarriers;
+//import zero_engine.OL_EnergyCarriers;
+import com.querydsl.core.types.dsl.TimeExpression;
+//import zero_engine.J_EAStorageElectric;
+//import zero_engine.J_EAConsumption;
+
+import com.anylogic.cloud.util.DateUtils;
+ I_EnergyData
+ v_liveData = new J_LiveData(this);
+v_liveData.activeEnergyCarriers = EnumSet.of(OL_EnergyCarriers.ELECTRICITY);
+v_liveData.activeProductionEnergyCarriers = EnumSet.of(OL_EnergyCarriers.ELECTRICITY);
+v_liveData.activeConsumptionEnergyCarriers = EnumSet.of(OL_EnergyCarriers.ELECTRICITY);
+v_liveConnectionMetaData = new J_ConnectionMetaData(this);
+v_liveAssetsMetaData = new J_AssetsMetaData(this);
+v_liveData.connectionMetaData = v_liveConnectionMetaData;
+v_liveData.assetsMetaData = v_liveAssetsMetaData;
+
+fm_currentProductionFlows_kW = new J_FlowsMap();
+fm_currentConsumptionFlows_kW = new J_FlowsMap();
+fm_currentBalanceFlows_kW = new J_FlowsMap();
+fm_heatFromEnergyCarrier_kW = new J_FlowsMap();
+fm_consumptionForHeating_kW = new J_FlowsMap();
+fm_currentAssetFlows_kW = new J_ValueMap(OL_AssetFlowCategories.class);
+ false
+
+ 1658477103138
+ 1658477103138
+
+ T extends Agent
+
+ Generic parameter:
+
+ ENTITY
+ 100
+ false
+ 100
+ true
+
+ -4144960
+ null
+
+ true
+ true
+ false
+
+ 10
+ MPS
+
+
+ 1
+ METER
+
+
+ 1
+ METER
+
+
+ 1
+ METER
+
+
+
+ false
+
+ 1.0
+ SECOND
+
+ CONTINUOUS
+ 500
+ 500
+ 0
+ 100
+ 100
+ MOORE
+ USER_DEF
+ USER_DEF
+ 2
+ 50
+ 0.95
+ 10
+
+
+ false
+ 1658477089988
+ true
+ 1658563200000
+
+ 0
+ HOUR
+
+
+ p_timeStep_h
+ HOUR
+
+
+
+ 1658477103136
+ scale
+ 0
+ -150
+ false
+ false
+ false
+ SHAPE_DRAW_2D3D
+ 100
+ 0
+ BASED_ON_LENGTH
+ 10
+ METER
+ 10
+ true
+
+ 1658477103139
+ 1658477103135
+
+
+ 1659356181110
+ pp_windProduction_fr
+ Fraction of yearly demand in MWh per hour, multiplied by demand in MWh per year = MW for that hour
+ -850
+ 553
+
+ false
+ true
+ true
+
+ J_ProfilePointer
+
+
+
+ 1663238634515
+ v_timeStepsElapsed
+ 1070
+ 420
+
+ false
+ true
+ true
+
+ int
+
+ 0
+
+
+
+
+ 1666979598282
+ v_totalBatteryChargeAmount_MWh
+ 1000
+ 1090
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1666979615893
+ v_totalBatteryDischargeAmount_MWh
+ 1000
+ 1110
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1669026980656
+ v_totalBatteryEnergyUsed_MWh
+ 1000
+ 1130
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1676968233773
+ v_totalEnergyCurtailed_MWh
+ 540
+ 1240
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1683718894234
+ v_timeSeriesRuntime_ms
+ 1051
+ 640
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1683718916458
+ v_gridNodesRuntime_ms
+ 1051
+ 680
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1683718921466
+ v_gridConnectionsRuntime_ms
+ 1051
+ 660
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1683718924632
+ v_incentivesRuntime_ms
+ 1051
+ 720
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1683718924634
+ v_financialsRuntime_ms
+ 1051
+ 700
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1690290329895
+ hourOfYearPerMonth
+ -610
+ 110
+
+ false
+ true
+ true
+
+ int[]
+
+ new int[] {0, 744, 1392, 2136, 2856, 3600, 4320, 5064, 5808, 6528, 7272, 7992}
+
+
+
+
+ 1696863807573
+ v_modelSelfSufficiency_fr
+ 540
+ 1270
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1696863821721
+ v_modelSelfConsumption_fr
+ 540
+ 1290
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1697554735224
+ v_isRapidRun
+ 1090
+ 68
+
+ false
+ true
+ true
+
+ boolean
+
+ false
+
+
+
+
+ 1698924487994
+ v_batteryStoredEnergyDeltaSinceStart_MWh
+ 1000
+ 1150
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1698929546080
+ v_totalEnergyProduced_MWh
+ 540
+ 1140
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1699277193134
+ t_h
+ 1070
+ 380
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1700556115968
+ v_totalEnergySelfConsumed_MWh
+ 540
+ 1180
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1700725227193
+ v_currentFinalEnergyConsumption_kW
+ 80
+ 1180
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1700725244568
+ v_currentPrimaryEnergyProduction_kW
+ 80
+ 1160
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1700725502196
+ v_currentEnergyCurtailed_kW
+ 80
+ 1220
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1701699259425
+ v_currentEnergyImport_kW
+ 80
+ 1281
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1701699273727
+ v_currentEnergyExport_kW
+ 80
+ 1301
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1701786316417
+ v_currentElectricityImport_kW
+ 80
+ 1320
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1701786316419
+ v_currentElectricityExport_kW
+ 80
+ 1340
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1704795167515
+ v_totalElectricityConsumed_MWh
+ 540
+ 1080
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1704795167517
+ v_totalElectricityProduced_MWh
+ 540
+ 1060
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1704815333011
+ v_totalElectricitySelfConsumed_MWh
+ 540
+ 1100
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1705422009185
+ v_currentPrimaryEnergyProductionHeatpumps_kW
+ 80
+ 1240
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1707233056349
+ v_individualSelfConsumption_fr
+ 540
+ 1330
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1708951590474
+ v_collectiveSelfConsumption_fr
+ 540
+ 1350
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1708951616508
+ v_individualSelfSufficiency_fr
+ 540
+ 1310
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1712842800772
+ v_dayOfWeek1jan
+ -610
+ 130
+
+ false
+ true
+ true
+
+ int
+
+
+
+ 1715074195578
+ v_kpiCalcsRuntime_ms
+ 1051
+ 740
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1718883144081
+ v_electricityYieldForecast_fr
+ -600
+ 660
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1721228298986
+ v_currentDLRfactor_fr
+ -584
+ 526
+
+ false
+ true
+ true
+
+ double
+
+ 1.0
+
+
+
+
+ 1721228965491
+ v_minDLRfactor_fr
+ -584
+ 551
+
+ false
+ true
+ true
+
+ double
+
+ 2
+
+
+
+
+ 1721228970137
+ v_maxDLRfactor_fr
+ -584
+ 571
+
+ false
+ true
+ true
+
+ double
+
+ 1
+
+
+
+
+ 1722498503201
+ acc_totalDLRfactor_f
+ 80
+ 1380
+
+ false
+ true
+ true
+
+ ZeroAccumulator
+
+ new ZeroAccumulator(true, p_timeStep_h, 8760);
+
+
+
+
+ 1727107003296
+ pp_PVProduction35DegSouth_fr
+ Fraction of yearly demand in MWh per hour, multiplied by demand in MWh per year = MW for that hour
+ -850
+ 513
+
+ false
+ true
+ true
+
+ J_ProfilePointer
+
+
+
+ 1727784890604
+ pf_windProduction_fr
+ -850
+ 730
+
+ false
+ true
+ true
+
+ J_ProfileForecaster
+
+
+
+ 1727784892429
+ pf_PVProduction35DegSouth_fr
+ -850
+ 690
+
+ false
+ true
+ true
+
+ J_ProfileForecaster
+
+
+
+ 1729088545879
+ pf_dayAheadElectricityPricing_eurpMWh
+ -850
+ 750
+
+ false
+ true
+ true
+
+ J_ProfileForecaster
+
+
+
+ 1729088545881
+ pp_dayAheadElectricityPricing_eurpMWh
+ -850
+ 573
+
+ false
+ true
+ true
+
+ J_ProfilePointer
+
+
+
+ 1730452122313
+ fm_currentBalanceFlows_kW
+ 80
+ 1100
+
+ false
+ true
+ true
+
+ J_FlowsMap
+
+
+
+ 1730457670958
+ v_totalEnergyImport_MWh
+ 540
+ 1200
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1730457670960
+ v_totalEnergyExport_MWh
+ 540
+ 1220
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1730459808621
+ v_totalEnergyConsumed_MWh
+ 540
+ 1160
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1730479615156
+ fm_currentConsumptionFlows_kW
+ 80
+ 1080
+
+ false
+ true
+ true
+
+ J_FlowsMap
+
+
+
+ 1730479616638
+ fm_currentProductionFlows_kW
+ 80
+ 1060
+
+ false
+ true
+ true
+
+ J_FlowsMap
+
+
+
+ 1731422680250
+ b_isDaytime
+ 1070
+ 450
+
+ false
+ true
+ true
+
+ boolean
+
+ false
+
+
+
+
+ 1731422698257
+ b_isWeekday
+ 1070
+ 470
+
+ false
+ true
+ true
+
+ boolean
+
+ false
+
+
+
+
+ 1731422704613
+ b_isSummerWeek
+ 1070
+ 492
+
+ false
+ true
+ true
+
+ boolean
+
+ false
+
+
+
+
+ 1731422714256
+ b_isWinterWeek
+ 1070
+ 512
+
+ false
+ true
+ true
+
+ boolean
+
+ false
+
+
+
+
+ 1731422900385
+ b_isLastTimeStepOfDay
+ 1070
+ 532
+
+ false
+ true
+ true
+
+ boolean
+
+ false
+
+
+
+
+ 1731423522698
+ t_hourOfDay
+ 1070
+ 400
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1741277544181
+ v_previousRunData
+ 100
+ 940
+
+ false
+ true
+ true
+
+ J_RapidRunData
+
+ null
+
+
+
+
+ 1741872284288
+ v_rapidRunData
+ 80
+ 920
+
+ false
+ true
+ true
+
+ J_RapidRunData
+
+
+
+ 1741872284290
+ v_liveData
+ 80
+ 770
+
+ false
+ true
+ true
+
+ J_LiveData
+
+
+
+ 1741872284292
+ v_liveAssetsMetaData
+ 100
+ 810
+
+ false
+ true
+ true
+
+ J_AssetsMetaData
+
+
+
+ 1741943984271
+ v_liveConnectionMetaData
+ 100
+ 792
+
+ false
+ true
+ true
+
+ J_ConnectionMetaData
+
+
+
+ 1744272354153
+ p_startOfWinterWeek_h
+ -610
+ 270
+
+ false
+ true
+ true
+
+ int
+
+
+
+ 1744272373654
+ p_startOfSummerWeek_h
+ -610
+ 250
+
+ false
+ true
+ true
+
+ int
+
+
+
+ 1749206124686
+ pp_PVProduction15DegEastWest_fr
+ Fraction of yearly demand in MWh per hour, multiplied by demand in MWh per year = MW for that hour
+ -850
+ 533
+
+ false
+ true
+ true
+
+ J_ProfilePointer
+
+
+
+ 1749206126234
+ pp_ambientTemperature_degC
+ Fraction of yearly demand in MWh per hour, multiplied by demand in MWh per year = MW for that hour
+ -850
+ 493
+
+ false
+ true
+ true
+
+ J_ProfilePointer
+
+
+
+ 1749206255808
+ pf_PVProduction15DegEastWest_fr
+ -850
+ 710
+
+ false
+ true
+ true
+
+ J_ProfileForecaster
+
+
+
+ 1749206262291
+ pf_ambientTemperature_degC
+ -850
+ 670
+
+ false
+ true
+ true
+
+ J_ProfileForecaster
+
+
+
+ 1753110053329
+ v_assetFlows
+ true
+ 80
+ 1120
+
+ false
+ true
+ true
+
+ J_AssetFlows
+
+ new J_AssetFlows()
+
+
+
+
+ 1753971036198
+ fm_currentAssetFlows_kW
+ 180
+ 1120
+
+ false
+ true
+ true
+
+ J_ValueMap<OL_AssetFlowCategories>
+
+
+
+ 1754321000847
+ v_batteryStoredEnergy_kWh
+ 80
+ 1260
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1764773669987
+ fm_consumptionForHeating_kW
+ 80
+ 1460
+
+ false
+ true
+ true
+
+ J_FlowsMap
+
+
+
+ 1764773669989
+ fm_heatFromEnergyCarrier_kW
+ 80
+ 1440
+
+ false
+ true
+ true
+
+ J_FlowsMap
+
+
+
+ 1658496701675
+ p_timeStep_h
+ Model timestep in uren. Kan in experimenten aangepast worden naar wens.
+
+@since: Sprint 6
+@author: Gillis
+ -360
+ 90
+
+ false
+ true
+ true
+
+ double
+ NONE
+ false
+
+ 0.25
+
+
+ 1658496701673
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1658752734133
+ b_parallelizeConnectionOwners
+ Schakelaar om optionele visualisatie-agent te creëren.
+
+@since: Sprint 6
+@author: Jorrit
+ -360
+ 141
+
+ false
+ true
+ true
+
+ boolean
+ NONE
+ false
+
+ false
+
+
+ 1658752734131
+ CHECK_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1663577621793
+ b_parallelizeGridConnections
+ Boolean om paralelle berekening van gridconnections aan te zetten.
+
+@since: Sprint 6
+@author: Gillis
+ -360
+ 120
+
+ false
+ true
+ true
+
+ boolean
+ NONE
+ false
+
+ false
+
+
+ 1663577621791
+ CHECK_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1671636582218
+ p_forecastTime_h
+ Model timestep in uren. Kan in experimenten aangepast worden naar wens.
+
+@since: Sprint 6
+@author: Gillis
+ -850
+ 770
+
+ false
+ true
+ true
+
+ double
+ NONE
+ false
+
+ 18
+
+
+ 1671636582216
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1699275323339
+ p_winterWeekNumber
+ -610
+ 210
+
+ false
+ true
+ true
+
+ double
+ NONE
+ false
+
+ 49
+
+
+ 1699275323337
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1699275323347
+ p_summerWeekNumber
+ -610
+ 230
+
+ false
+ true
+ true
+
+ double
+ NONE
+ false
+
+ 18
+
+
+ 1699275323345
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1701855537716
+ p_truckTripsCsv
+ -355
+ 505
+
+ false
+ true
+ true
+
+ TextFile
+ NONE
+ false
+
+ 1701855537714
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1701855572858
+ p_householdTripsCsv
+ -355
+ 525
+
+ false
+ true
+ true
+
+ TextFile
+ NONE
+ false
+
+ 1701855572856
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1701855585052
+ p_cookingPatternCsv
+ -355
+ 545
+
+ false
+ true
+ true
+
+ TextFile
+ NONE
+ false
+
+ 1701855585050
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1712844009289
+ p_year
+ -610
+ 90
+
+ false
+ true
+ true
+
+ int
+ NONE
+ false
+
+ 0
+
+
+ 1712844009287
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1715864755905
+ avgc_data
+ -355
+ 475
+
+ false
+ true
+ true
+
+ J_AVGC_data
+ NONE
+ false
+
+ 1715864755903
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1721289658523
+ b_enableDLR
+ Schakelaar om optionele visualisatie-agent te creëren.
+
+@since: Sprint 6
+@author: Jorrit
+ -360
+ 171
+
+ false
+ true
+ true
+
+ boolean
+ NONE
+ false
+
+ false
+
+
+ 1721289658521
+ CHECK_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1731439789362
+ p_runStartTime_h
+ -610
+ 158
+
+ false
+ true
+ true
+
+ double
+ NONE
+ false
+
+ 0
+
+
+ 1731439789360
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1731439835898
+ p_runEndTime_h
+ -610
+ 178
+
+ false
+ true
+ true
+
+ double
+ NONE
+ false
+
+ 8760
+
+
+ 1731439835896
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1731588224262
+ b_isInitialized
+ 700
+ 200
+
+ false
+ true
+ true
+
+ boolean
+ NONE
+ false
+
+ false
+
+
+ 1731588224260
+ CHECK_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1741868549911
+ b_storePreviousRapidRunData
+ Schakelaar om optionele visualisatie-agent te creëren.
+
+@since: Sprint 6
+@author: Jorrit
+ -359
+ 191
+
+ false
+ true
+ true
+
+ boolean
+ NONE
+ false
+
+ true
+
+
+ 1741868549909
+ CHECK_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1743087797088
+ p_regionName
+ -840
+ 90
+
+ false
+ true
+ true
+
+ String
+ NONE
+ false
+
+ 1743087797086
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1758796402884
+ b_isDeserialised
+ 870
+ 200
+
+ false
+ true
+ true
+
+ boolean
+ NONE
+ false
+
+ false
+
+
+ 1758796402882
+ CHECK_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1663238323139
+ c_connectionOwners
+ 90
+ 440
+
+ false
+ true
+ true
+
+ ArrayList
+ ConnectionOwner
+ String
+
+
+
+ 1663251681035
+ c_gridNodesTopLevel
+ 399
+ 108
+
+ false
+ true
+ true
+
+ ArrayList
+ GridNode
+ String
+
+
+
+ 1663252052482
+ c_gridNodesNotTopLevel
+ 399
+ 128
+
+ false
+ true
+ true
+
+ ArrayList
+ GridNode
+ String
+
+
+
+ 1663312177330
+ c_gridConnections
+ 90
+ 240
+
+ false
+ true
+ true
+
+ ArrayList
+ GridConnection
+ String
+
+
+
+ 1663336485480
+ c_gridNodesHeat
+ true
+ 399
+ 148
+
+ false
+ true
+ true
+
+ ArrayList
+ GridNode
+ String
+
+
+
+ 1664953351408
+ c_productionAssets
+ true
+ 399
+ 204
+
+ false
+ true
+ true
+
+ ArrayList
+ J_EAProduction
+ String
+
+
+
+ 1665492426842
+ c_ambientDependentAssets
+ 399
+ 244
+
+ false
+ true
+ true
+
+ ArrayList
+ J_EA
+ String
+
+
+
+ 1666978650654
+ c_energyAssets
+ 399
+ 182
+
+ false
+ true
+ true
+
+ ArrayList
+ J_EA
+ String
+
+
+
+ 1692799535493
+ c_storageAssets
+ 399
+ 224
+
+ false
+ true
+ true
+
+ ArrayList
+ J_EAStorage
+ String
+
+
+
+ 1692871551713
+ c_EVs
+ 399
+ 264
+
+ false
+ true
+ true
+
+ ArrayList
+ J_EAEV
+ String
+
+
+
+ 1703256089183
+ c_actors
+ 91
+ 458
+
+ false
+ true
+ true
+
+ ArrayList
+ Actor
+ String
+
+
+
+ 1716453161218
+ c_subGridConnections
+ A subGridConnections are a subset of (children of) of GridConnections that are "part" of another GC and thus are not counted towards the totals.
+ 90
+ 260
+
+ false
+ true
+ true
+
+ ArrayList
+ GridConnection
+ String
+
+
+
+ 1716885030303
+ c_gridNodeExecutionList
+ 400
+ 70
+
+ false
+ true
+ true
+
+ ArrayList
+ GridNode
+ String
+
+
+
+ 1718895986988
+ c_gridNodeExecutionListReverse
+ 400
+ 90
+
+ false
+ true
+ true
+
+ ArrayList
+ GridNode
+ String
+
+
+
+ 1722584740368
+ c_pausedGridConnections
+ A paused GridConnection is removed from the collection c_gridConnections and stored in here. Paused GridConnections are not operated or counted towards totals.
+ 90
+ 280
+
+ false
+ true
+ true
+
+ ArrayList
+ GridConnection
+ String
+
+
+
+ 1727099354305
+ c_profiles
+ -850
+ 473
+
+ false
+ true
+ true
+
+ ArrayList
+ J_ProfilePointer
+ String
+
+
+
+ 1727779411251
+ c_forecasts
+ -850
+ 650
+
+ false
+ true
+ true
+
+ ArrayList
+ J_ProfileForecaster
+ String
+
+
+
+ 1749650197321
+ c_chargerProfiles
+ -850
+ 600
+
+ false
+ true
+ true
+
+ ArrayList
+ List<J_ChargingSession>
+ String
+
+
+
+ 1754054323740
+ c_defaultHeatingStrategies
+ The keys are triples: ( heatingType, boolean hasBuildingThermalModel, boolean hasHeatBuffer ). These map to classes (not instances!) that implement the heating interface. The classes are usually instantiated with the GridConnection as an argument of the constructor.
+An example of how to use this mapping to create an instance for a triple t, and GridConnection gc:
+I_HeatingManagement x = c_defaultHeatingStrategies.get(t).getDeclaredConstructor(GridConnection.class, OL_GridConnectionHeatingType.class).newInstance(gc, heatingType);
+ -360
+ 220
+
+ false
+ true
+ true
+
+ LinkedHashMap
+ Triple<OL_GridConnectionHeatingType, Boolean, Boolean>
+ Class<? extends I_HeatingManagement>
+
+
+
+ 1762791167547
+ c_assetManagement
+ 400
+ 286
+
+ false
+ true
+ true
+
+ ArrayList
+ I_AssetManagement
+ String
+
+
+
+
+
+ VOID
+ double
+ 1664894248130
+ f_updatePricesForNextTimestep
+ 1090
+ 310
+
+ false
+ true
+ true
+
+ t_h
+ double
+
+ // Update the dayaheadprice
+nationalEnergyMarket.f_updateEnergyPrice();
+
+//
+for (EnergySupplier e : pop_energySuppliers) {
+ e.f_updateEnergyPrice();
+}
+for (GridOperator g : pop_gridOperators) {
+ if( g.p_hasCongestionPricing ){
+ g.f_updateCongestionTariff();
+ }
+}
+for (EnergyCoop e : pop_energyCoops) {
+ //e.f_updateEnergyPrice();
+ //e.f_updateOtherIncentives();
+ //e.f_setPriceBandsExperiment();
+ e.f_updateIncentives();
+}
+
+for (GridNode GN : c_gridNodeExecutionListReverse) {
+ GN.f_propagateNodalPricing();
+}
+
+
+/*if (p_parallelize) {
+ c_connectionOwners.parallelStream().forEach(co -> co.f_updateIncentives());
+} else {*/
+ for (ConnectionOwner c : pop_connectionOwners) {
+ c.f_updateIncentives();
+ }
+//}
+
+
+ VOID
+ double
+ 1664952601107
+ f_updateTimeseries
+ 1090
+ 190
+
+ false
+ true
+ true
+
+ t_h
+ double
+
+ b_isDaytime = t_h % 24 > 6 && t_h % 24 < 18;
+b_isWeekday = (t_h+(v_dayOfWeek1jan-1)*24) % (24*7) < (24*5);
+b_isSummerWeek = (t_h % 8760) >= p_startOfSummerWeek_h && (t_h % 8760) < p_startOfSummerWeek_h + 24*7;
+b_isWinterWeek = (t_h % 8760) >= p_startOfWinterWeek_h && (t_h % 8760) < p_startOfWinterWeek_h + 24*7;
+b_isLastTimeStepOfDay = t_h % 24 == (24-p_timeStep_h);
+t_hourOfDay = t_h % 24; // Assumes modelrun starts at midnight.
+
+c_profiles.forEach(p -> p.updateValue(t_h));
+//v_currentAmbientTemperature_degC = pp_ambientTemperature_degC.getCurrentValue();
+//v_currentWindPowerNormalized_r = pp_windProduction_fr.getCurrentValue();
+//v_currentSolarPowerNormalized_r = pp_PVProduction35DegSouth_fr.getCurrentValue();
+//v_currentCookingDemand_fr = tf_cooking_demand(t_h);
+
+if (b_enableDLR) {
+ v_currentDLRfactor_fr = 1 + max(-0.1,pp_windProduction_fr.getCurrentValue() * 0.025*(30-pp_ambientTemperature_degC.getCurrentValue()) + 0.5 - pp_PVProduction35DegSouth_fr.getCurrentValue());
+ //v_currentDLRfactor_fr = 1 + uniform(-0.1, 1.0);
+ v_minDLRfactor_fr = min (v_minDLRfactor_fr, v_currentDLRfactor_fr);
+ v_maxDLRfactor_fr = max (v_maxDLRfactor_fr, v_currentDLRfactor_fr);
+ acc_totalDLRfactor_f.addStep( v_currentDLRfactor_fr);
+ /*if (v_currentDLRfactor_fr < 0.5) {
+ traceln("v_currentDLRfactor_fr is invalid! %s", v_currentDLRfactor_fr);
+ pauseSimulation();
+ }*/
+}
+//traceln("Current DLR factor: %s, ", v_currentDLRfactor_fr);
+//traceln("Time hour " + time(HOUR) + ", t_h " + t_h + ", fleet demand " + v_currentLogisticsFleetEDemand_fr);
+
+//Update ambient dependent assets
+f_updateAmbientDependentAssets();
+
+// Update forecasts, the relevant profile pointers are already updated above
+c_forecasts.forEach(f -> f.updateForecast(t_h));
+//v_SolarYieldForecast_fr = pf_PVProduction35DegSouth_fr.getForecast();
+//v_WindYieldForecast_fr = pf_windProduction_fr.getForecast();
+// The ElectricityYieldForecast assumes solar and wind forecasts have the same forecast time
+if ( v_liveAssetsMetaData.totalInstalledPVPower_kW + v_liveAssetsMetaData.totalInstalledWindPower_kW > 0 ) {
+ v_electricityYieldForecast_fr = (pf_PVProduction35DegSouth_fr.getForecast() * v_liveAssetsMetaData.totalInstalledPVPower_kW + pf_windProduction_fr.getForecast() * v_liveAssetsMetaData.totalInstalledWindPower_kW) / (v_liveAssetsMetaData.totalInstalledPVPower_kW + v_liveAssetsMetaData.totalInstalledWindPower_kW);
+}
+// And price forecast!
+//v_epexForecast_eurpkWh = 0.001*pf_dayAheadElectricityPricing_eurpMWh.getForecast();
+
+for (GridNode GN : c_gridNodeExecutionList) {
+ GN.f_updateForecasts();
+}
+
+
+
+
+ VOID
+ double
+ 1665051878402
+ f_calculateGridnodeFlows
+ 1090
+ 270
+
+ false
+ true
+ true
+
+ t_h
+ double
+
+ v_currentElectricityImport_kW = 0;
+v_currentElectricityExport_kW = 0;
+
+for(GridNode n : c_gridNodeExecutionList) {
+ n.f_calculateEnergyBalance();
+}
+
+for(GridNode n : c_gridNodesTopLevel) {
+ if (n.p_energyCarrier == OL_EnergyCarriers.ELECTRICITY) {
+ v_currentElectricityImport_kW += max(0, n.v_currentLoad_kW );
+ v_currentElectricityExport_kW += max(0, -n.v_currentLoad_kW );
+ }
+}
+
+
+
+ VOID
+ double
+ 1665051962956
+ f_calculateActorFlows
+ 1090
+ 290
+
+ false
+ true
+ true
+
+ t_h
+ double
+
+ /*
+if (b_parallelizeConnectionOwners) {
+ c_connectionOwners.parallelStream().forEach(co -> co.f_updateFinances());
+} else {
+ for (ConnectionOwner c : pop_connectionOwners) {
+ c.f_updateFinances();
+ }
+}
+*/
+
+for (EnergyCoop h : pop_energyCoops) {
+ h.f_calculateEnergyBalance();
+}
+/*for (EnergySupplier e : pop_energySuppliers) {
+ e.f_updateFinances();
+}*/
+
+
+
+ VOID
+ double
+ 1666978595555
+ f_sumBatteryUse
+ 990
+ 1070
+
+ false
+ true
+ true
+ v_totalBatteryDischargeAmount_MWh = 0;
+v_totalBatteryChargeAmount_MWh = 0;
+v_totalBatteryEnergyUsed_MWh = 0;
+
+for(J_EA ea : c_energyAssets) { // Single loop of all assets without using c_EVs and c_storageAssets
+ if( ea instanceof J_EAStorageElectric ) {
+ J_EAStorageElectric e = (J_EAStorageElectric)ea;
+ v_totalBatteryDischargeAmount_MWh += e.getTotalDischargeAmount_kWh() / 1000;
+ v_totalBatteryChargeAmount_MWh += e.getTotalChargeAmount_kWh() / 1000;
+ v_totalBatteryEnergyUsed_MWh += e.getEnergyUsed_kWh() / 1000;
+ }
+
+ if( ea instanceof J_EAEV ) {
+ J_EAEV e = (J_EAEV)ea;
+ v_totalBatteryDischargeAmount_MWh += e.getTotalDischargeAmount_kWh() / 1000;
+ v_totalBatteryChargeAmount_MWh += e.getTotalChargeAmount_kWh() / 1000;
+ v_totalBatteryEnergyUsed_MWh += e.getEnergyUsed_kWh() / 1000;
+ }
+
+}
+
+//Calculate delta stored energy in battery for energy balance check
+v_batteryStoredEnergyDeltaSinceStart_MWh = v_totalBatteryChargeAmount_MWh - v_totalBatteryDischargeAmount_MWh - v_totalBatteryEnergyUsed_MWh;
+if (v_batteryStoredEnergyDeltaSinceStart_MWh == Double.NaN) {
+ v_batteryStoredEnergyDeltaSinceStart_MWh = 0;
+}
+traceln("Electricity delta in batteries (including EVs): "+ v_batteryStoredEnergyDeltaSinceStart_MWh + " MWh");
+
+
+ VOID
+ double
+ 1668528129020
+ f_calculateGridConnectionFlows
+ 1090
+ 230
+
+ false
+ true
+ true
+
+ t_h
+ double
+
+ fm_currentProductionFlows_kW.clear();
+fm_currentConsumptionFlows_kW.clear();
+fm_currentBalanceFlows_kW.clear();
+fm_heatFromEnergyCarrier_kW.clear();
+fm_consumptionForHeating_kW.clear();
+fm_currentAssetFlows_kW.clear();
+
+v_currentFinalEnergyConsumption_kW = 0;
+v_currentPrimaryEnergyProduction_kW = 0;
+v_currentEnergyCurtailed_kW = 0;
+v_currentPrimaryEnergyProductionHeatpumps_kW = 0;
+v_batteryStoredEnergy_kWh = 0;
+
+if (b_parallelizeGridConnections) {
+ c_gridConnections.parallelStream().forEach(gc -> gc.f_calculateEnergyBalance());
+}
+else {
+ for(GridConnection gc : c_gridConnections) {
+ gc.f_calculateEnergyBalance();
+ }
+}
+
+//OLD LOCATION OF AGGREGATOR CALL, NECESSARY IF MANAGEMENT IS WITHOUT TIME STEP DELAY
+
+for(GridConnection gc : c_gridConnections) { // Can't do this in parallel due to different threads writing to the same values!
+
+ fm_currentBalanceFlows_kW.addFlows(gc.fm_currentBalanceFlows_kW);
+ fm_currentProductionFlows_kW.addFlows(gc.fm_currentProductionFlows_kW);
+ fm_currentConsumptionFlows_kW.addFlows(gc.fm_currentConsumptionFlows_kW);
+ fm_heatFromEnergyCarrier_kW.addFlows(gc.fm_heatFromEnergyCarrier_kW);
+ fm_consumptionForHeating_kW.addFlows(gc.fm_consumptionForHeating_kW);
+ fm_currentAssetFlows_kW.addFlows(gc.fm_currentAssetFlows_kW);
+ v_currentFinalEnergyConsumption_kW += gc.v_currentFinalEnergyConsumption_kW;
+ v_currentPrimaryEnergyProduction_kW += gc.v_currentPrimaryEnergyProduction_kW;
+ v_currentEnergyCurtailed_kW += gc.v_currentEnergyCurtailed_kW;
+ v_batteryStoredEnergy_kWh += gc.v_batteryStoredEnergy_kWh;
+ v_currentPrimaryEnergyProductionHeatpumps_kW += gc.v_currentPrimaryEnergyProductionHeatpumps_kW;
+
+}
+
+for (GridConnection gc : c_subGridConnections) {
+ gc.f_calculateEnergyBalance();
+}
+
+v_currentEnergyImport_kW = 0.0;
+v_currentEnergyExport_kW = 0.0;
+for (OL_EnergyCarriers EC : v_liveData.activeEnergyCarriers) {
+ double netFlow_kW = fm_currentBalanceFlows_kW.get(EC);
+ v_currentEnergyImport_kW += max( 0, netFlow_kW );
+ v_currentEnergyExport_kW += max( 0, -netFlow_kW );
+}
+
+//Call aggregator functions (ONLY WORK WITH TIME STEP DELAY FOR NOW) (LOCATION OF THIS CALL IS NOT DETERMINED YET, FOR NOW HERE)
+f_runAggregators();
+
+
+
+ VOID
+ double
+ 1671636439933
+ f_initializeForecasts
+ 730
+ 113
+
+ false
+ true
+ true
+ pf_ambientTemperature_degC = new J_ProfileForecaster(null, pp_ambientTemperature_degC, p_forecastTime_h, t_h, p_timeStep_h);
+c_forecasts.add(pf_ambientTemperature_degC);
+
+pf_PVProduction35DegSouth_fr = new J_ProfileForecaster(null, pp_PVProduction35DegSouth_fr, p_forecastTime_h, t_h, p_timeStep_h);
+c_forecasts.add(pf_PVProduction35DegSouth_fr);
+
+pf_PVProduction15DegEastWest_fr = new J_ProfileForecaster(null, pp_PVProduction15DegEastWest_fr, p_forecastTime_h, t_h, p_timeStep_h);
+c_forecasts.add(pf_PVProduction15DegEastWest_fr);
+
+pf_windProduction_fr = new J_ProfileForecaster(null, pp_windProduction_fr, p_forecastTime_h, t_h, p_timeStep_h);
+c_forecasts.add(pf_windProduction_fr);
+
+pf_dayAheadElectricityPricing_eurpMWh = new J_ProfileForecaster(null, pp_dayAheadElectricityPricing_eurpMWh, p_forecastTime_h, t_h, p_timeStep_h);
+c_forecasts.add(pf_dayAheadElectricityPricing_eurpMWh);
+
+
+
+ VOID
+ double
+ 1696521316832
+ f_runRapidSimulation
+ 1070
+ 48
+
+ false
+ true
+ true
+ pauseSimulation();
+
+traceln(" ");
+traceln("*** Running headless simulation *** ");
+traceln(" ");
+
+double startTime1 = System.currentTimeMillis();
+
+
+//// Store and reset model states
+for (J_EA EA : c_energyAssets) {
+ EA.storeStatesAndReset();
+}
+for (I_AssetManagement AM : c_assetManagement) {
+ AM.storeStatesAndReset();
+}
+
+
+for (GridConnection GC : c_gridConnections) {
+
+ if (GC.v_rapidRunData != null) {
+ if (b_storePreviousRapidRunData) {
+ GC.v_previousRunData = GC.v_rapidRunData;
+ }
+ }
+ GC.v_rapidRunData = new J_RapidRunData(GC);
+ GC.v_rapidRunData.assetsMetaData = GC.v_liveAssetsMetaData.getClone();
+ GC.v_rapidRunData.connectionMetaData = GC.v_liveConnectionMetaData.getClone();
+ GC.v_rapidRunData.initializeAccumulators(p_runEndTime_h - p_runStartTime_h, p_timeStep_h, GC.v_liveData.activeEnergyCarriers, GC.v_liveData.activeConsumptionEnergyCarriers, GC.v_liveData.activeProductionEnergyCarriers, GC.v_liveAssetsMetaData.activeAssetFlows); //f_initializeAccumulators();
+
+ GC.f_resetStates();
+
+ GC.c_tripTrackers.forEach(tt->{
+ tt.storeAndResetState();
+ tt.setStartIndex(p_runStartTime_h);
+ tt.prepareNextActivity(p_runStartTime_h*60);
+ });
+ if (GC instanceof GCHouse) {
+ if (((GCHouse)GC).p_cookingTracker != null) {
+ ((GCHouse)GC).p_cookingTracker.storeAndResetState();
+ }
+ }
+}
+for (GridConnection GC : c_subGridConnections) {
+ GC.f_resetStates();
+}
+
+for (GridNode GN : pop_gridNodes) {
+ GN.f_resetStates();
+}
+
+for (ConnectionOwner CO : pop_connectionOwners) {
+ CO.f_resetStates();
+}
+
+for (EnergyCoop EC : pop_energyCoops) {
+ if (EC.v_rapidRunData != null) {
+ if (b_storePreviousRapidRunData) {
+ EC.v_previousRunData = EC.v_rapidRunData;
+ }
+ /*EC.v_rapidRunData.assetsMetaData = EC.v_liveAssetsMetaData.getClone();
+ EC.v_rapidRunData.connectionMetaData = EC.v_liveConnectionMetaData.getClone();
+ if(EC.v_rapidRunData.getStoreTotalAssetFlows() == false){
+ EC.v_rapidRunData.setStoreTotalAssetFlows(true);
+ EC.v_rapidRunData.initializeAccumulators(p_runEndTime_h - p_runStartTime_h, p_timeStep_h, EC.v_liveData.activeEnergyCarriers, EC.v_liveData.activeConsumptionEnergyCarriers, EC.v_liveData.activeProductionEnergyCarriers, EC.v_liveAssetsMetaData.activeAssetFlows);
+ }*/
+ }
+ EC.v_rapidRunData = new J_RapidRunData(EC);
+ EC.v_rapidRunData.assetsMetaData = EC.v_liveAssetsMetaData.getClone();
+ EC.v_rapidRunData.connectionMetaData = EC.v_liveConnectionMetaData.getClone();
+ //if(EC.v_rapidRunData.getStoreTotalAssetFlows() == false){
+ EC.v_rapidRunData.setStoreTotalAssetFlows(true);
+ //}
+ EC.v_rapidRunData.initializeAccumulators(p_runEndTime_h - p_runStartTime_h, p_timeStep_h, EC.v_liveData.activeEnergyCarriers, EC.v_liveData.activeConsumptionEnergyCarriers, EC.v_liveData.activeProductionEnergyCarriers, EC.v_liveAssetsMetaData.activeAssetFlows);
+ EC.f_resetStates();
+
+}
+
+
+int v_timeStepsElapsed_live = v_timeStepsElapsed;
+v_timeStepsElapsed=0;
+
+c_profiles.forEach(p -> p.updateValue(p_runStartTime_h));
+c_forecasts.forEach(p -> p.initializeForecast(p_runStartTime_h));
+
+if (v_rapidRunData != null && b_storePreviousRapidRunData) {
+ v_previousRunData = v_rapidRunData;
+}
+v_rapidRunData = new J_RapidRunData(this);
+v_rapidRunData.assetsMetaData = v_liveAssetsMetaData.getClone();
+v_rapidRunData.connectionMetaData = v_liveConnectionMetaData.getClone();
+v_rapidRunData.initializeAccumulators(p_runEndTime_h - p_runStartTime_h, p_timeStep_h, v_liveData.activeEnergyCarriers, v_liveData.activeConsumptionEnergyCarriers, v_liveData.activeProductionEnergyCarriers, v_liveAssetsMetaData.activeAssetFlows); //f_initializeAccumulators();
+f_resetAnnualValues();
+
+v_isRapidRun = true;
+
+////Run energy calculations loop
+for(t_h = p_runStartTime_h; t_h < p_runEndTime_h; t_h += p_timeStep_h){
+ // Update time-series for model-wide variables (such as temps, wind, etc.)
+ double startTime = System.currentTimeMillis();
+ f_updateTimeseries(t_h);
+ v_timeSeriesRuntime_ms += (System.currentTimeMillis()-startTime);
+
+ // Operate assets on each gridConnection
+ startTime = System.currentTimeMillis();
+ f_calculateGridConnectionFlows(t_h);
+ v_gridConnectionsRuntime_ms += (System.currentTimeMillis()-startTime);
+
+ // Calculate grid node flows
+ startTime = System.currentTimeMillis();
+ f_calculateGridnodeFlows(t_h);
+ v_gridNodesRuntime_ms += (System.currentTimeMillis()-startTime);
+
+ // Financial accounting of energy flows
+ startTime = System.currentTimeMillis();
+ f_calculateActorFlows(t_h);
+ v_financialsRuntime_ms += (System.currentTimeMillis()-startTime);
+
+ // Update elektriciteitsprijzen
+ startTime = System.currentTimeMillis();
+ f_updatePricesForNextTimestep(t_h);
+ v_incentivesRuntime_ms += (System.currentTimeMillis()-startTime);
+
+ //Run rapid data logging
+ v_rapidRunData.addTimeStep(fm_currentBalanceFlows_kW,
+ fm_currentConsumptionFlows_kW,
+ fm_currentProductionFlows_kW,
+ fm_heatFromEnergyCarrier_kW,
+ fm_consumptionForHeating_kW,
+ fm_currentAssetFlows_kW,
+ v_currentPrimaryEnergyProduction_kW,
+ v_currentFinalEnergyConsumption_kW,
+ v_currentPrimaryEnergyProductionHeatpumps_kW,
+ v_currentEnergyCurtailed_kW,
+ v_batteryStoredEnergy_kWh/1000,
+ this);
+ v_timeStepsElapsed++;
+}
+
+
+
+////Caclulate KPIs
+double startTime = System.currentTimeMillis();
+f_calculateKPIs();
+
+//Perform energy balance check
+f_performEnergyBalanceCheck();
+
+v_kpiCalcsRuntime_ms = (System.currentTimeMillis()-startTime);
+
+
+traceln("---FINISHED YEAR MODEL RUN----");
+
+
+////Return model to previous state to continue simulation run
+v_timeStepsElapsed = v_timeStepsElapsed_live;
+t_h = p_runStartTime_h + v_timeStepsElapsed * p_timeStep_h;
+
+
+for (J_EA EA : c_energyAssets) {
+ EA.restoreStates();
+}
+for (I_AssetManagement AM : c_assetManagement) {
+ AM.restoreStates();
+}
+
+/*for (GridNode GN : pop_gridNodes) {
+ //Has no reset states
+}*/
+
+for (GridConnection GC : c_gridConnections) {
+ GC.f_resetStatesAfterRapidRun();
+ GC.c_tripTrackers.forEach(tt->{
+ tt.restoreState();
+ tt.prepareNextActivity((t_h-p_runStartTime_h)*60);
+ });
+ //GC.c_tripTrackers.forEach(tt->tt.prepareNextActivity((t_h-p_runStartTime_h)*60));
+ if (GC instanceof GCHouse) {
+ if (((GCHouse)GC).p_cookingTracker != null) {
+ ((GCHouse)GC).p_cookingTracker.restoreState();
+ }
+ }
+}
+
+v_isRapidRun = false;
+
+double duration = System.currentTimeMillis() - startTime1;
+
+traceln("*** headless run duration: "+ duration/1000 + " s ***");
+
+traceln("Live-sim t_h after rapidRun: %s", t_h);
+if (b_isDeserialised) {
+ traceln("Anylogic Model time(HOUR): %s", time(HOUR));
+}
+c_profiles.forEach(p -> p.updateValue(t_h));
+c_forecasts.forEach(p -> p.initializeForecast(t_h));
+
+
+
+ VOID
+ double
+ 1698922757486
+ f_calculateKPIs
+ Executed on simulation end to export data.
+
+@author: JorritvandenHouten
+@since: Sprint 6
+ 1090
+ 110
+
+ false
+ true
+ true
+ pop_gridNodes.forEach(gn -> gn.f_calculateKPIs());
+
+pop_energyCoops.forEach(ec -> ec.f_calculateKPIs());
+
+// Totals from accumulators:
+v_totalElectricityConsumed_MWh = v_rapidRunData.getTotalElectricityConsumed_MWh();
+v_totalElectricityProduced_MWh= v_rapidRunData.getTotalElectricityProduced_MWh();
+
+v_totalEnergyConsumed_MWh = v_rapidRunData.getTotalEnergyConsumed_MWh();
+v_totalEnergyProduced_MWh = v_rapidRunData.getTotalEnergyProduced_MWh();
+v_totalEnergyImport_MWh = v_rapidRunData.am_totalBalanceAccumulators_kW.totalIntegralPos_kWh()/1000;
+v_totalEnergyExport_MWh = -v_rapidRunData.am_totalBalanceAccumulators_kW.totalIntegralNeg_kWh()/1000;
+v_totalEnergyCurtailed_MWh = v_rapidRunData.getTotalEnergyCurtailed_MWh();
+
+// Electricity self consumption
+v_individualSelfSufficiency_fr = sum(c_gridConnections, gc -> gc.v_rapidRunData.getTotalElectricitySelfConsumed_MWh()) / v_totalElectricityConsumed_MWh;
+v_individualSelfConsumption_fr = sum(c_gridConnections, gc -> gc.v_rapidRunData.getTotalElectricitySelfConsumed_MWh()) / v_totalElectricityProduced_MWh;
+v_totalElectricitySelfConsumed_MWh = v_rapidRunData.getTotalElectricitySelfConsumed_MWh();
+v_collectiveSelfConsumption_fr = v_totalElectricitySelfConsumed_MWh / v_totalElectricityProduced_MWh;
+
+traceln("");
+traceln("__--** Totals **--__");
+traceln("Energy consumed: "+ v_totalEnergyConsumed_MWh + " MWh");
+traceln("Energy produced: "+ v_totalEnergyProduced_MWh + " MWh");
+traceln("Energy import: "+ v_totalEnergyImport_MWh + " MWh");
+traceln("Energy export: "+ v_totalEnergyExport_MWh + " MWh");
+
+
+
+
+
+ VOID
+ double
+ 1699958741073
+ f_resetAnnualValues
+ 1090
+ 88
+
+ false
+ true
+ true
+ v_rapidRunData.resetAccumulators(p_runEndTime_h - p_runStartTime_h, p_timeStep_h, v_liveData.activeEnergyCarriers, v_liveData.activeConsumptionEnergyCarriers, v_liveData.activeProductionEnergyCarriers); //f_initializeAccumulators();
+
+// Others
+acc_totalDLRfactor_f.reset();
+
+
+
+
+ VOID
+ double
+ 1701162826549
+ f_runTimestep
+ 1070
+ 168
+
+ false
+ true
+ true
+ if(t_h-p_runStartTime_h!=0.0 && (t_h-p_runStartTime_h) % (p_runEndTime_h - p_runStartTime_h) == 0.0) {
+ f_loopSimulation();
+}
+
+//Update t_h
+t_h = p_runStartTime_h + v_timeStepsElapsed * p_timeStep_h;
+
+// Update tijdreeksen in leesbare variabelen
+f_updateTimeseries(t_h);
+
+// Operate assets on each gridConnection
+f_calculateGridConnectionFlows(t_h);
+
+// Calculate grid node flows
+f_calculateGridnodeFlows(t_h);
+
+// Financial accounting of energy flows
+f_calculateActorFlows(t_h);
+
+// Update elektriciteitsprijzen
+f_updatePricesForNextTimestep(t_h);
+
+//Update live data
+f_updateLiveData();
+
+v_timeStepsElapsed ++;
+
+
+
+ VOID
+ double
+ 1716884712799
+ f_buildGridNodeTree
+ 730
+ 68
+
+ false
+ true
+ true
+ //Initialize top level grid values
+double topLevelElectricGridCapacity_kW = 0;
+boolean topLevelGridCapacitiesKnown = true;
+
+ // First make all links between GridNodes
+for( GridNode GN : pop_gridNodes ) {
+ GN.f_connectToParentNode();
+}
+
+// First clear lists (needed after deserialisation)
+c_gridNodeExecutionList.clear();
+c_gridNodeExecutionListReverse.clear();
+c_gridNodesTopLevel.clear();
+c_gridNodesNotTopLevel.clear();
+
+// Then build execution order list
+for( GridNode GN : pop_gridNodes ) {
+ GridNode parentNode = findFirst(pop_gridNodes, p->p.p_gridNodeID.equals(GN.p_parentNodeID)); // Works as long as p_gridNodeID is not null. p_parentNodeID can be null no problemo.
+ //if (GN.p_parentNodeID == null) {
+ if (parentNode == null) {
+ f_gridNodeRecursiveAdd(GN);
+ c_gridNodesTopLevel.add(GN);
+ if(GN.p_energyCarrier == OL_EnergyCarriers.ELECTRICITY){
+ topLevelElectricGridCapacity_kW +=GN.p_capacity_kW;
+ if(!GN.p_realCapacityAvailable){
+ topLevelGridCapacitiesKnown = false;
+ }
+ }
+ } else {
+ c_gridNodesNotTopLevel.add(GN);
+ if (GN.p_gridNodeID.equals(parentNode.p_parentNodeID)) {
+ traceln("Throwing exception because of circular dependency between gridNodes! GridNode %s and parentNode %s", GN.p_gridNodeID, parentNode.p_gridNodeID);
+ throw new RuntimeException("Exception: circular GridNode dependency, only tree-topology supported");
+ }
+ }
+}
+c_gridNodeExecutionListReverse = c_gridNodeExecutionList;
+Collections.reverse(c_gridNodeExecutionList);
+
+
+//Set cumulative toplevel grid values as energyModel values
+v_liveConnectionMetaData.physicalCapacity_kW = topLevelElectricGridCapacity_kW;
+v_liveConnectionMetaData.contractedDeliveryCapacity_kW = topLevelElectricGridCapacity_kW;
+v_liveConnectionMetaData.contractedFeedinCapacity_kW = topLevelElectricGridCapacity_kW;
+v_liveConnectionMetaData.physicalCapacityKnown = topLevelGridCapacitiesKnown;
+v_liveConnectionMetaData.contractedDeliveryCapacityKnown = topLevelGridCapacitiesKnown;
+v_liveConnectionMetaData.contractedFeedinCapacityKnown = topLevelGridCapacitiesKnown;
+
+//traceln("Grid Node execution list: %s", c_gridNodeExecutionList );
+
+
+ VOID
+ double
+ 1716886716306
+ f_gridNodeRecursiveAdd
+ 750
+ 88
+
+ false
+ true
+ true
+
+ GN
+ GridNode
+
+ c_gridNodeExecutionList.add(GN);
+for (GridNode GNchild : GN.c_connectedGridNodes) {
+ f_gridNodeRecursiveAdd(GNchild);
+}
+
+
+
+
+ RETURNS_VALUE
+ ArrayList<GridConnection>
+ 1716890117265
+ f_getActiveGridConnections
+ 1660
+ 520
+
+ false
+ true
+ true
+ ArrayList<GridConnection> copyOfGridConnectionList = new ArrayList<>(c_gridConnections);
+copyOfGridConnectionList.removeAll(Arrays.asList(pop_gridConnections)); // Remove all default gridconnections (no flex control, only used for gridnode profile)
+return copyOfGridConnectionList;
+
+
+
+ VOID
+ double
+ 1716893898501
+ f_initializeEngine
+ 700
+ 48
+
+ false
+ true
+ true
+ // What if this function is accidently called twice? Need to start with a clean sheet?
+if (b_isInitialized) {
+ throw new RuntimeException("Error: Engine was initalized a second time.");
+}
+// Initialize time and date
+//v_hourOfYearStart=hourOfYearPerMonth[getMonth()] + (getDayOfMonth()-1)*24;
+t_h = p_runStartTime_h;
+
+Date startDate = date();
+p_year = startDate.getYear() + 1900;
+
+LocalDate localDate = LocalDate.of(p_year, 1, 1);
+v_dayOfWeek1jan = DayOfWeek.from(localDate).getValue();
+p_startOfWinterWeek_h = roundToInt(24 * (p_winterWeekNumber * 7 + (8-v_dayOfWeek1jan)%7)); // Week 49 is winterweek.
+p_startOfSummerWeek_h = roundToInt(24 * (p_summerWeekNumber * 7 + (8-v_dayOfWeek1jan)%7)); // Week 18 is summerweek.
+
+
+
+int monthIdx = 0;
+while ( t_h > hourOfYearPerMonth[monthIdx] ) {
+ monthIdx++;
+ if (monthIdx==hourOfYearPerMonth.length){
+ break;
+ }
+}
+
+int dayOfMonth = 1+(int)((t_h - hourOfYearPerMonth[monthIdx])/24.0);
+traceln("Day of month start: %s", dayOfMonth);
+traceln("Month of year start: %s", monthIdx);
+startDate.setMonth(monthIdx);
+startDate.setDate(dayOfMonth);
+startDate.setHours(0);
+startDate.setMinutes(0);
+traceln("Startdate: %s", startDate);
+//startDate.set
+getExperiment().getEngine().setStartDate(startDate);
+
+
+//traceln("Day of the week on january 1st %s: %s, int value: %s", p_year, DayOfWeek.from(localDate).name(), v_dayOfWeek1jan);
+
+// Initialize all agents in the correct order, creating all connections. What about setting initial values? And how about repeated simulations?
+
+f_buildGridNodeTree();
+c_gridConnections.forEach(GC -> GC.f_initialize());
+
+// Only relevant for deserialisation:
+c_pausedGridConnections.forEach(GC -> GC.f_initialize());
+
+pop_connectionOwners.forEach(CO -> CO.f_initialize());
+pop_energyCoops.forEach(EC -> EC.f_initialize()); // Not yet robust when there is no supplier initialized!
+
+
+
+// Initializing Live Data Class
+v_liveAssetsMetaData.updateActiveAssetData(c_gridConnections);
+for (GridConnection GC : c_gridConnections) {
+ v_liveData.activeEnergyCarriers.addAll(GC.v_liveData.activeEnergyCarriers);
+ v_liveData.activeConsumptionEnergyCarriers.addAll(GC.v_liveData.activeConsumptionEnergyCarriers);
+ v_liveData.activeProductionEnergyCarriers.addAll(GC.v_liveData.activeProductionEnergyCarriers);
+}
+
+// Loop over populations to check v_ispaused
+f_initializePause();
+
+for (GridNode GN : c_gridNodeExecutionList) {
+ GN.f_initializeGridnode();
+}
+
+v_liveData.connectionMetaData.contractedDeliveryCapacityKnown = false;
+v_liveData.connectionMetaData.contractedFeedinCapacityKnown = false;
+v_liveData.connectionMetaData.physicalCapacityKnown = false;
+
+f_initializeForecasts();
+
+f_initializeLiveDataSets();
+
+//f_initializeAccumulators();
+
+// Use parallelisation?
+if (c_gridConnections.size() > 100) {
+ b_parallelizeGridConnections = true;
+}
+if (pop_connectionOwners.size() > 500 && b_parallelizeGridConnections) {
+ b_parallelizeConnectionOwners = true;
+}
+
+b_isInitialized = true;
+
+
+ RETURNS_VALUE
+ ArrayList<ConnectionOwner>
+ 1716897568717
+ f_getConnectionOwners
+ 1640
+ 560
+
+ false
+ true
+ true
+ return c_connectionOwners;
+
+
+ RETURNS_VALUE
+ double
+ 1716899946694
+ f_getTopLevelGridCapacity_kW
+ 1640
+ 580
+
+ false
+ true
+ true
+ return v_liveConnectionMetaData.physicalCapacity_kW;
+
+
+ RETURNS_VALUE
+ ArrayList<J_EA>
+ 1717058801652
+ f_getEnergyAssets
+ 1640
+ 600
+
+ false
+ true
+ true
+ return c_energyAssets;
+
+
+ RETURNS_VALUE
+ ArrayList<GridNode>
+ 1718289616227
+ f_getGridNodesTopLevel
+ 1640
+ 640
+
+ false
+ true
+ true
+ return this.c_gridNodesTopLevel;
+
+
+ RETURNS_VALUE
+ ArrayList<GridNode>
+ 1718289761647
+ f_getGridNodesNotTopLevel
+ 1640
+ 660
+
+ false
+ true
+ true
+ return this.c_gridNodesNotTopLevel;
+
+
+ VOID
+ double
+ 1722590514591
+ f_initializePause
+ Function to initialize the paused gridconnections.
+ 730
+ 153
+
+ false
+ true
+ true
+ for (GridConnection GC : UtilityConnections) {
+ if (!GC.v_isActive) {
+ GC.f_setActive(false);
+ }
+}
+for (GridConnection GC : EnergyProductionSites) {
+ if (!GC.v_isActive) {
+ GC.f_setActive(false);
+ }
+}
+for (GridConnection GC : EnergyConversionSites) {
+ if (!GC.v_isActive) {
+ GC.f_setActive(false);
+ }
+}
+for (GridConnection GC : GridBatteries) {
+ if (!GC.v_isActive) {
+ GC.f_setActive(false);
+ }
+}
+for (GridConnection GC : PublicChargers) {
+ if (!GC.v_isActive) {
+ GC.f_setActive(false);
+ }
+}
+
+
+ VOID
+ double
+ 1727106160366
+ f_addProfile
+ -740
+ 472
+
+ false
+ true
+ true
+
+ profile
+ J_ProfilePointer
+
+ c_profiles.add(profile);
+
+
+ RETURNS_VALUE
+ ArrayList<GridConnection>
+ 1727167397666
+ f_getPausedGridConnections
+ 1660
+ 540
+
+ false
+ true
+ true
+ return c_pausedGridConnections;
+
+
+ RETURNS_VALUE
+ J_ProfilePointer
+ 1727193246625
+ f_findProfile
+ -600
+ 472
+
+ false
+ true
+ true
+
+ assetName
+ String
+
+ J_ProfilePointer profilePointer = findFirst(c_profiles, p -> p.name.equals(assetName));
+//traceln("J_EAConsumption with name %s found profile asset: %s", assetName, profilePointer);
+if (profilePointer == null) {
+ traceln("No profilePointer with name %s found", assetName);
+ throw new RuntimeException(String.format("Consumption or production asset without valid profile!") );
+}
+return profilePointer;
+
+
+ VOID
+ double
+ 1731329529733
+ f_updateLiveData
+ 1091
+ 333
+
+ false
+ true
+ true
+ //Current timestep
+double currentTime_h = t_h-p_runStartTime_h;
+
+v_liveData.addTimeStep(currentTime_h,
+ fm_currentBalanceFlows_kW,
+ fm_currentConsumptionFlows_kW,
+ fm_currentProductionFlows_kW,
+ fm_currentAssetFlows_kW,
+ v_currentPrimaryEnergyProduction_kW,
+ v_currentFinalEnergyConsumption_kW,
+ v_currentPrimaryEnergyProductionHeatpumps_kW,
+ v_currentEnergyCurtailed_kW,
+ v_batteryStoredEnergy_kWh/1000
+);
+
+
+
+ VOID
+ double
+ 1731573713521
+ f_initializeLiveDataSets
+ 730
+ 133
+
+ false
+ true
+ true
+ v_liveData.dsm_liveDemand_kW.createEmptyDataSets(v_liveData.activeEnergyCarriers, roundToInt(168/p_timeStep_h));
+v_liveData.dsm_liveSupply_kW.createEmptyDataSets(v_liveData.activeEnergyCarriers, roundToInt(168/p_timeStep_h));
+v_liveData.dsm_liveAssetFlows_kW.createEmptyDataSets(v_liveData.assetsMetaData.activeAssetFlows, roundToInt(168/p_timeStep_h));
+
+
+ RETURNS_VALUE
+ EnergyCoop
+ 1739958854535
+ f_addEnergyCoop
+ 1640
+ 280
+
+ false
+ true
+ true
+
+ gcList
+ ArrayList<GridConnection>
+
+ // Add energyCoop
+EnergyCoop energyCoop = add_pop_energyCoops();
+energyCoop.p_actorID = "Custom Coop for filtered GC list";
+// Connect GCs, connectionOwners and energyCoop and gather data
+/*for(GridConnection gc : gcList) {
+ if(gc.p_owner == null) {
+ throw new RuntimeException("Can't add gridConnection without a connectionOwner to EnergyCoop!");
+ } else {
+ gc.p_owner.p_actorGroup = "member";
+ gc.p_owner.p_coopParent = energyCoop;
+ gc.p_owner.f_initialize();
+ }
+}*/
+// Initialisation, collecting data and calculating KPIs.
+energyCoop.f_initializeCustomCoop(gcList);
+
+// Adding this coop to the list of coops in the GC
+gcList.forEach(gc -> gc.c_parentCoops.add(energyCoop));
+
+// Return energyCoop to caller
+return energyCoop;
+
+
+ VOID
+ EnergyCoop
+ 1739972940581
+ f_removeEnergyCoop
+ 1640
+ 300
+
+ false
+ true
+ true
+
+ energyCoop
+ EnergyCoop
+
+ // Connect GCs, connectionOwners and energyCoop and gather data
+for(Agent CO : energyCoop.c_coopCustomers){
+ if(CO instanceof ConnectionOwner){
+ ((ConnectionOwner)CO).p_coopParent = null;
+ ((ConnectionOwner)CO).f_initialize();
+ }
+}
+
+for(Agent CO : energyCoop.c_coopMembers){
+ if(CO instanceof ConnectionOwner){
+ ((ConnectionOwner)CO).p_coopParent = null;
+ ((ConnectionOwner)CO).f_initialize();
+ }
+}
+
+// Removing this coop from the list of coops in the GC
+for (GridConnection GC : energyCoop.f_getAllChildMemberGridConnections()) {
+ GC.c_parentCoops.remove(energyCoop);
+ if(GC instanceof GCGridBattery && GC.f_getBatteryManagement() instanceof J_BatteryManagementPeakShaving && ((J_BatteryManagementPeakShaving)GC.f_getBatteryManagement()).getTargetType() == OL_ResultScope.ENERGYCOOP){
+ ((J_BatteryManagementPeakShaving)GC.f_getBatteryManagement()).setTarget(null);
+ ((J_BatteryManagementPeakShaving)GC.f_getBatteryManagement()).setTargetType( OL_ResultScope.ENERGYCOOP );
+ GC.f_setActive(false);
+ }
+}
+
+// Remove energyCoop from pop_energyCoops.
+remove_pop_energyCoops(energyCoop);
+
+
+
+
+ VOID
+ EnergyCoop
+ 1740056275008
+ f_addConsumptionEnergyCarrier
+ 1640
+ 340
+
+ false
+ true
+ true
+
+ EC
+ OL_EnergyCarriers
+
+ if (!v_liveData.activeConsumptionEnergyCarriers.contains(EC)) {
+ v_liveData.activeEnergyCarriers.add(EC);
+ v_liveData.activeConsumptionEnergyCarriers.add(EC);
+
+ DataSet dsDemand = new DataSet( (int)(168 / p_timeStep_h) );
+
+ double startTime = v_liveData.dsm_liveDemand_kW.get(OL_EnergyCarriers.ELECTRICITY).getXMin();
+ double endTime = v_liveData.dsm_liveDemand_kW.get(OL_EnergyCarriers.ELECTRICITY).getXMax();
+ for (double t = startTime; t <= endTime; t += p_timeStep_h) {
+ dsDemand.add( t, 0);
+ }
+ v_liveData.dsm_liveDemand_kW.put( EC, dsDemand);
+}
+
+
+ VOID
+ double
+ 1741710906926
+ f_updateActiveAssetsMetaData
+ 1640
+ 180
+
+ false
+ true
+ true
+
+//Update main area
+v_liveAssetsMetaData.updateActiveAssetData(f_getAllGridConnections());
+
+//Update coop
+if(pop_energyCoops.size()>0){
+ pop_energyCoops.get(pop_energyCoops.size()-1).v_liveAssetsMetaData.updateActiveAssetData(pop_energyCoops.get(pop_energyCoops.size()-1).f_getAllChildMemberGridConnections());
+}
+
+//Update grid connection active asset data
+for(GridConnection GC : f_getAllGridConnections()){
+ GC.v_liveAssetsMetaData.updateActiveAssetData(new ArrayList<>(List.of(GC)));
+}
+
+
+
+ VOID
+ EnergyCoop
+ 1746021439807
+ f_addProductionEnergyCarrier
+ 1640
+ 360
+
+ false
+ true
+ true
+
+ EC
+ OL_EnergyCarriers
+
+ if (!v_liveData.activeProductionEnergyCarriers.contains(EC)) {
+ v_liveData.activeEnergyCarriers.add(EC);
+ v_liveData.activeProductionEnergyCarriers.add(EC);
+
+ DataSet dsSupply = new DataSet( (int)(168 / p_timeStep_h) );
+ double startTime = v_liveData.dsm_liveDemand_kW.get(OL_EnergyCarriers.ELECTRICITY).getXMin();
+ double endTime = v_liveData.dsm_liveDemand_kW.get(OL_EnergyCarriers.ELECTRICITY).getXMax();
+ for (double t = startTime; t <= endTime; t += p_timeStep_h) {
+ dsSupply.add( t, 0);
+ }
+ v_liveData.dsm_liveSupply_kW.put( EC, dsSupply);
+}
+
+
+ VOID
+ double
+ 1751886925823
+ f_updateAmbientDependentAssets
+ 1113
+ 210
+
+ false
+ true
+ true
+ // Update environmental conditions for relevant energy assets
+for( J_EA e : c_ambientDependentAssets ) {
+ if( e instanceof J_EAStorageHeat) { // includes J_EABuilding
+ switch(((J_EAStorageHeat) e).getAmbientTempType()){
+ case FIXED:
+ //Do nothing, use preset ambient temp
+ break;
+ case AMBIENT_AIR:
+ ((J_EAStorageHeat)e).updateAmbientTemperature( pp_ambientTemperature_degC.getCurrentValue() );
+ break;
+ case BUILDING:
+ new RuntimeException("AmbientTempType 'BUILDING' is not supported yet for J_EAStorageHeat!");
+ /*
+ GridConnection parentGC = (GridConnection)e.getParentAgent();
+ if(parentGC.p_BuildingThermalAsset == null){
+ new RuntimeException("GC has heat storage with AmbientTempType 'Building', with no J_EABuilding present");
+ }
+ else{
+ ((J_EAStorageHeat)e).updateAmbientTemperature(parentGC.p_BuildingThermalAsset.getCurrentTemperature());
+ }
+ */
+ break;
+ case HEAT_GRID:
+ // Do Nothing, keep fixed temp for now
+ //new RuntimeException("AmbientTempType 'HEAT_GRID' is not supported yet for J_EAStorageHeat!");
+ break;
+ case HEAT_STORAGE:
+ new RuntimeException("AmbientTempType 'HEAT_STORAGE' is not supported yet for J_EAStorageHeat!");
+ break;
+ }
+ }
+ if (e instanceof J_EAConversionHeatPump) {
+ switch(((J_EAConversionHeatPump) e).getAmbientTempType()){
+ case FIXED:
+ //Do nothing, use preset ambient temp
+ break;
+ case AMBIENT_AIR:
+ ((J_EAConversionHeatPump)e).updateAmbientTemperature( pp_ambientTemperature_degC.getCurrentValue() );
+ break;
+ case BUILDING:
+ new RuntimeException("AmbientTempType 'BUILDING' is not supported yet for J_EAConversionHeatPump!");
+ /*
+ GridConnection parentGC = (GridConnection)e.getParentAgent();
+ if(parentGC.p_BuildingThermalAsset == null){
+ new RuntimeException("GC has heatpump with AmbientTempType 'Building', with no J_EABuilding present");
+ }
+ else{
+ ((J_EAConversionHeatPump)e).updateAmbientTemperature(parentGC.p_BuildingThermalAsset.getCurrentTemperature());
+ }
+ */
+ break;
+ case HEAT_GRID:
+ new RuntimeException("AmbientTempType 'HEAT_GRID' is not supported yet for J_EAConversionHeatPump!");
+ break;
+ case HEAT_STORAGE:
+ new RuntimeException("AmbientTempType 'HEAT_STORAGE' is not supported yet for J_EAConversionHeatPump!");
+ break;
+ }
+ }
+ if( e instanceof J_EABuilding ) {
+ //traceln("v_currentSolarPowerNormalized_r: %s", v_currentSolarPowerNormalized_r);
+ ((J_EABuilding)e).updateSolarRadiation(pp_PVProduction35DegSouth_fr.getCurrentValue()*1000);
+ }
+}
+
+
+ VOID
+ double
+ 1753350603730
+ f_performEnergyBalanceCheck
+ 980
+ 1040
+
+ false
+ true
+ true
+ //Get battery energy use for balance check
+f_sumBatteryUse();
+
+// *** Total energy balance ***
+double deltaThermalEnergySinceStart_MWh = 0;
+double totalAmbientHeating_MWh = 0;
+double totalEnergyCurtailed_MWh = 0;
+double totalEnergyProduced_MWh = 0;
+double totalEnergyUsed_MWh = 0;
+double totalEnergyChargedOutsideModel_MWh = 0;
+double totalHeatProduced_MWh = 0;
+for (J_EA e : c_energyAssets) {
+ if (((GridConnection) e.getParentAgent()).v_isActive ) {
+ double EnergyUsed_kWh = e.getEnergyUsed_kWh();
+ if (EnergyUsed_kWh > 0) {
+ if( e instanceof J_EAConversionGasCHP ) {
+ totalEnergyUsed_MWh += EnergyUsed_kWh/1000;
+ //electricityProduced_kWh = ((J_EAConversionGasCHP)e).getElectricityProduced_kWh();
+ //electricityProduced_MWh += electricityProduced_kWh/1000;
+ } else {
+ totalEnergyUsed_MWh += EnergyUsed_kWh/1000;
+ }
+ } else {
+ totalEnergyProduced_MWh -= EnergyUsed_kWh/1000;
+ if ( e instanceof J_EABuilding ) {
+ traceln("Building has produced more energy than it has used?? Is lossfactor too low?");
+ traceln("Lossfactor: %s", ((J_EABuilding)e).lossFactor_WpK);
+ }
+ }
+ if (e instanceof J_EAStorageHeat) { // includes J_EABuilding
+ totalAmbientHeating_MWh += ((J_EAStorageHeat)e).energyAbsorbed_kWh/1000;
+ totalHeatProduced_MWh += ((J_EAStorageHeat)e).energyAbsorbed_kWh/1000;
+ totalEnergyProduced_MWh += ((J_EAStorageHeat)e).energyAbsorbed_kWh/1000;
+ deltaThermalEnergySinceStart_MWh += (((J_EAStorageHeat)e).getRemainingHeatStorageHeat_kWh() - ((J_EAStorageHeat)e).getStartingHeatStorageHeat_kWh())/1000;
+ }
+ if (e instanceof J_EAEV) {
+ totalEnergyChargedOutsideModel_MWh += ((J_EAEV)e).getEnergyChargedOutsideModelArea_kWh()/1000;
+ }
+ if (e instanceof J_EAConversionHeatPump) {
+ totalHeatProduced_MWh -= EnergyUsed_kWh/1000;
+ }
+ }
+}
+double v_totalDeltaStoredEnergy_MWh = v_batteryStoredEnergyDeltaSinceStart_MWh + deltaThermalEnergySinceStart_MWh; // Positive number means more energy stored at the end of the simulation.
+
+//Total selfconsumption, selfsufficiency
+v_totalEnergySelfConsumed_MWh = v_totalEnergyConsumed_MWh - (v_totalEnergyImport_MWh + max(0,-v_totalDeltaStoredEnergy_MWh)); // Putting positive delta-stored energy here assumes this energy was imported as opposed to self-produced. Putting negative delta-stored energy here assumes this energy was self-consumed, as opposed to exported.
+//v_totalSelfConsumedEnergy_MWh = totalEnergyUsed_MWh - (v_totalImportedEnergy_MWh + max(0,-v_totalDeltaStoredEnergy_MWh)); // Putting positive delta-stored energy here assumes this energy was imported as opposed to self-produced. Putting negative delta-stored energy here assumes this energy was self-consumed, as opposed to exported.
+
+// Export and production-based selfconsumption
+if ( v_totalEnergyProduced_MWh > 0 ){
+ v_modelSelfConsumption_fr = v_totalEnergySelfConsumed_MWh / v_totalEnergyProduced_MWh;
+}
+traceln("");
+traceln("Total energy absorbed from environment by buildings: %s MWh", totalAmbientHeating_MWh);
+traceln("Delta thermal stored energy since start: %s MWh", deltaThermalEnergySinceStart_MWh);
+traceln("Total energy from vehicles charging outside the model scope: %s MWh", totalEnergyChargedOutsideModel_MWh);
+
+traceln("Energy selfconsumption: " + v_modelSelfConsumption_fr*100 + "%");
+double totalElectricitySelfConsumption_fr = 0;
+
+/*if ( v_totalElectricityProduced_MWh > 0 ){
+ totalElectricitySelfConsumption_fr = 1 - fm_totalExports_MWh.get(OL_EnergyCarriers.ELECTRICITY)/v_totalElectricityProduced_MWh;
+}*/
+
+//v_modelSelfSufficiency_fr = 1 - (v_totalElectricityImport_MWh + max(0,v_totalMethaneImport_MWh - v_totalMethaneExport_MWh) + max(0,v_totalHydrogenImport_MWh - v_totalHydrogenExport_MWh) + v_totalDieselImport_MWh - v_batteryStoredEnergyDeltaSinceStart_MWh - deltaThermalEnergySinceStart_MWh) / v_totalEnergyUsed_MWh;
+v_modelSelfSufficiency_fr = v_totalEnergySelfConsumed_MWh / v_totalEnergyConsumed_MWh; // Calculation based on (total_consumption - total_import) / total_consumption. Positive delta-stored energy is contained in v_totalSelfConsumedEnergy_MWh.
+//v_modelSelfSufficiency_fr = v_totalSelfConsumedEnergy_MWh / totalEnergyUsed_MWh; // Calculation based on (total_consumption - total_import) / total_consumption. Positive delta-stored energy is contained in v_totalSelfConsumedEnergy_MWh.
+
+traceln("Energy selfsufficiency (via import calc): %s %%", v_modelSelfSufficiency_fr*100);
+//double totalSelfSufficiency_fr_check = (v_totalEnergyProduced_MWh - (v_totalElectricityExport_MWh + max(0,v_totalMethaneExport_MWh-v_totalMethaneImport_MWh) + max(0,v_totalHydrogenExport_MWh-v_totalHydrogenImport_MWh)))/v_totalEnergyUsed_MWh; // Calculation based on (total_production - total_export) / total_consumption
+//double totalSelfSufficiency_fr_check = v_totalSelfConsumedEnergyCheck_MWh / totalEnergyUsed_MWh; // Calculation based on (total_production - total_export) / total_consumption. Negative delta-stored energy is contained in v_totalSelfConsumedEnergy_MWh.
+
+// Remaining difference due to different temps of houses start vs end?
+traceln("");
+for (OL_EnergyCarriers EC : v_liveData.activeEnergyCarriers) {
+ traceln("Import " + EC.toString() + ": " + v_rapidRunData.getTotalImport_MWh(EC) + " MWh");
+ traceln("Export " + EC.toString() + ": " + v_rapidRunData.getTotalExport_MWh(EC) + " MWh");
+}
+
+traceln("");
+traceln("__--** Checks **--__");
+
+traceln("Check energy used from array and from energy assets: %s MWh", ( v_totalEnergyConsumed_MWh - totalEnergyUsed_MWh) );
+traceln("Check energy produced from array and from energy assets: %s MWh", ( v_totalEnergyProduced_MWh - totalEnergyProduced_MWh) );
+
+double energyBalanceCheck_MWh = v_totalEnergyImport_MWh + v_totalEnergyProduced_MWh - (v_totalEnergyExport_MWh + v_totalEnergyConsumed_MWh + v_totalDeltaStoredEnergy_MWh);
+traceln("Check on energy balance is: " + energyBalanceCheck_MWh + " MWh, must be zero!");
+traceln("");
+
+if ( Math.abs(energyBalanceCheck_MWh) > 1e-6 ) {
+ traceln("");
+ String warningString = String.format("__--** WARNING!!!! **--__");
+ String errorString = String.format("ENERGY BALANCE ERROR EXCEEDING TOLERANCE!! Error: %s MWh", energyBalanceCheck_MWh);
+ traceln(warningString);
+ //traceln(red, errorString);
+ System.err.println(errorString);
+ traceln(warningString);
+ traceln("");
+
+}
+
+
+ VOID
+ double
+ 1753963201170
+ f_startAfterDeserialisation
+ 860
+ 50
+
+ false
+ true
+ true
+ // Reconstruct the LiveData class
+/*v_liveData = new J_LiveData(this);
+v_liveData.activeEnergyCarriers = EnumSet.of(OL_EnergyCarriers.ELECTRICITY);
+v_liveData.activeProductionEnergyCarriers = EnumSet.of(OL_EnergyCarriers.ELECTRICITY);
+v_liveData.activeConsumptionEnergyCarriers = EnumSet.of(OL_EnergyCarriers.ELECTRICITY);
+
+//v_liveConnectionMetaData = new J_ConnectionMetaData(this);
+//v_liveAssetsMetaData = new J_AssetsMetaData(this);
+v_liveData.connectionMetaData = v_liveConnectionMetaData;
+v_liveData.assetsMetaData = v_liveAssetsMetaData;*/
+
+v_liveData.resetLiveDatasets(p_runStartTime_h, p_runStartTime_h, p_timeStep_h);
+
+fm_currentProductionFlows_kW = new J_FlowsMap();
+fm_currentConsumptionFlows_kW = new J_FlowsMap();
+fm_currentBalanceFlows_kW = new J_FlowsMap();
+fm_currentAssetFlows_kW = new J_ValueMap(OL_AssetFlowCategories.class);
+
+// Reconstruct the LiveData class in the EnergyCoops
+for (EnergyCoop ec : pop_energyCoops) {
+ /*ec.v_liveData = new J_LiveData(ec);
+ ec.v_liveData.activeEnergyCarriers = EnumSet.of(OL_EnergyCarriers.ELECTRICITY);
+ ec.v_liveData.activeProductionEnergyCarriers = EnumSet.of(OL_EnergyCarriers.ELECTRICITY);
+ ec.v_liveData.activeConsumptionEnergyCarriers = EnumSet.of(OL_EnergyCarriers.ELECTRICITY);
+
+ ec.v_liveData.connectionMetaData = ec.v_liveConnectionMetaData;
+ ec.v_liveData.assetsMetaData = ec.v_liveAssetsMetaData;
+ */
+ ec.v_liveData.resetLiveDatasets(p_runStartTime_h, p_runStartTime_h, p_timeStep_h);
+
+ ec.fm_currentProductionFlows_kW = new J_FlowsMap();
+ ec.fm_currentConsumptionFlows_kW = new J_FlowsMap();
+ ec.fm_currentBalanceFlows_kW = new J_FlowsMap();
+ ec.fm_currentAssetFlows_kW = new J_ValueMap(OL_AssetFlowCategories.class);
+}
+
+// Reconstruct the LiveData class in the GridConnections and add EnergyCarriers
+List<GridConnection> allGridConnections = new ArrayList<>(c_gridConnections);
+allGridConnections.addAll(c_pausedGridConnections);
+for (GridConnection gc : allGridConnections) {
+ /*gc.v_liveData = new J_LiveData(gc);
+ gc.v_liveData.activeEnergyCarriers = EnumSet.of(OL_EnergyCarriers.ELECTRICITY);
+ gc.v_liveData.activeProductionEnergyCarriers = EnumSet.of(OL_EnergyCarriers.ELECTRICITY);
+ gc.v_liveData.activeConsumptionEnergyCarriers = EnumSet.of(OL_EnergyCarriers.ELECTRICITY);
+
+ gc.v_liveData.connectionMetaData = gc.v_liveConnectionMetaData;
+ gc.v_liveData.assetsMetaData = gc.v_liveAssetsMetaData;
+ */
+ gc.v_liveData.resetLiveDatasets(p_runStartTime_h, p_runStartTime_h, p_timeStep_h);
+
+ gc.fm_currentProductionFlows_kW = new J_FlowsMap();
+ gc.fm_currentConsumptionFlows_kW = new J_FlowsMap();
+ gc.fm_currentBalanceFlows_kW = new J_FlowsMap();
+ gc.fm_currentAssetFlows_kW = new J_ValueMap(OL_AssetFlowCategories.class);
+
+ /*for (J_EA j_ea : gc.c_energyAssets) {
+ gc.f_addEnergyCarriersAndAssetCategoriesFromEA(j_ea);
+ }*/
+}
+
+// Initialize time and date
+//v_hourOfYearStart=hourOfYearPerMonth[getMonth()] + (getDayOfMonth()-1)*24;
+t_h = p_runStartTime_h;
+
+Date startDate = date();
+p_year = startDate.getYear() + 1900;
+
+LocalDate localDate = LocalDate.of(p_year, 1, 1);
+v_dayOfWeek1jan = DayOfWeek.from(localDate).getValue();
+p_startOfWinterWeek_h = roundToInt(24 * (p_winterWeekNumber * 7 + (8-v_dayOfWeek1jan)%7)); // Week 49 is winterweek.
+p_startOfSummerWeek_h = roundToInt(24 * (p_summerWeekNumber * 7 + (8-v_dayOfWeek1jan)%7)); // Week 18 is summerweek.
+
+int monthIdx = 0;
+while ( t_h > hourOfYearPerMonth[monthIdx] ) {
+ monthIdx++;
+ if (monthIdx==hourOfYearPerMonth.length){
+ break;
+ }
+}
+
+int dayOfMonth = 1+(int)((t_h - hourOfYearPerMonth[monthIdx])/24.0);
+traceln("Day of month start: %s", dayOfMonth);
+traceln("Month of year start: %s", monthIdx);
+startDate.setMonth(monthIdx);
+startDate.setDate(dayOfMonth);
+startDate.setHours(0);
+startDate.setMinutes(0);
+traceln("Startdate: %s", startDate);
+//startDate.set
+getExperiment().getEngine().setStartDate(startDate);
+
+f_initializeForecasts();
+
+f_initializeLiveDataSets();
+
+b_isDeserialised = true;
+
+
+ RETURNS_VALUE
+ Pair<J_DataSetMap, J_DataSetMap>
+ 1754052061419
+ f_getPeakWeekDataSets
+ 1071
+ 132
+
+ false
+ true
+ true
+ double[] elecBalance_kW = v_rapidRunData.am_totalBalanceAccumulators_kW.get(OL_EnergyCarriers.ELECTRICITY).getTimeSeries_kW();
+
+int maxIndex = 0; // index with peak import
+for (int i = 1; i < elecBalance_kW.length; i++) {
+ if (elecBalance_kW[i] > elecBalance_kW[maxIndex]) {
+ maxIndex = i;
+ }
+}
+
+int minIndex = 0; // index with peak export
+for (int i = 1; i < elecBalance_kW.length; i++) {
+ if (elecBalance_kW[i] < elecBalance_kW[minIndex]) {
+ minIndex = i;
+ }
+}
+
+int startIdx = max(0,maxIndex - 7*48);
+int endIdx = max(startIdx + 7*96, maxIndex + 7*48);
+J_DataSetMap peakImportWeekAssetFlows = new J_DataSetMap(OL_AssetFlowCategories.class);
+for (OL_AssetFlowCategories AC : v_rapidRunData.am_assetFlowsAccumulators_kW.keySet()) {
+ double[] assetFlowArray_kW = v_rapidRunData.am_assetFlowsAccumulators_kW.get(AC).getTimeSeries_kW();
+ for (int i=startIdx; i<endIdx; i++) {
+ peakImportWeekAssetFlows.get(AC).add(p_timeStep_h * i, assetFlowArray_kW[i]);
+ }
+}
+
+startIdx = max(0,minIndex - 7*48);
+endIdx = max(startIdx + 7*96, minIndex + 7*48);
+J_DataSetMap peakExportWeekAssetFlows = new J_DataSetMap(OL_AssetFlowCategories.class);
+for (OL_AssetFlowCategories AC : v_rapidRunData.am_assetFlowsAccumulators_kW.keySet()) {
+ double[] assetFlowArray_kW = v_rapidRunData.am_assetFlowsAccumulators_kW.get(AC).getTimeSeries_kW();
+ for (int i=startIdx; i<endIdx; i++) {
+ peakExportWeekAssetFlows.get(AC).add(p_timeStep_h * i, assetFlowArray_kW[i]);
+ }
+}
+
+return new Pair<>(peakImportWeekAssetFlows, peakExportWeekAssetFlows);
+
+
+
+ VOID
+ EnergyCoop
+ 1754379679149
+ f_addAssetFlow
+ 1640
+ 380
+
+ false
+ true
+ true
+
+ AC
+ OL_AssetFlowCategories
+
+ if (!v_liveAssetsMetaData.activeAssetFlows.contains(AC)) {
+ v_liveAssetsMetaData.activeAssetFlows.add(AC);
+
+ DataSet dsAsset = new DataSet( (int)(168 / p_timeStep_h) );
+
+ double startTime = v_liveData.dsm_liveDemand_kW.get(OL_EnergyCarriers.ELECTRICITY).getXMin();
+ double endTime = v_liveData.dsm_liveDemand_kW.get(OL_EnergyCarriers.ELECTRICITY).getXMax();
+ for (double t = startTime; t <= endTime; t += p_timeStep_h) {
+ dsAsset.add( t, 0);
+ }
+ v_liveData.dsm_liveAssetFlows_kW.put( AC, dsAsset);
+
+ if (AC == OL_AssetFlowCategories.batteriesChargingPower_kW) { // also add batteriesDischarging!
+ dsAsset = new DataSet( (int)(168 / p_timeStep_h) );
+
+ for (double t = startTime; t <= endTime; t += p_timeStep_h) {
+ dsAsset.add( t, 0);
+ }
+ v_liveData.dsm_liveAssetFlows_kW.put( OL_AssetFlowCategories.batteriesDischargingPower_kW, dsAsset);
+ }
+ if (AC == OL_AssetFlowCategories.V2GPower_kW && !v_liveAssetsMetaData.activeAssetFlows.contains(OL_AssetFlowCategories.evChargingPower_kW)) { // also add evCharging!
+ dsAsset = new DataSet( (int)(168 / p_timeStep_h) );
+
+ for (double t = startTime; t <= endTime; t += p_timeStep_h) {
+ dsAsset.add( t, 0);
+ }
+ v_liveData.dsm_liveAssetFlows_kW.put( OL_AssetFlowCategories.evChargingPower_kW, dsAsset);
+ }
+}
+
+
+ RETURNS_VALUE
+ List<GridConnection>
+ 1754908171225
+ f_getGridConnectionsCollectionPointer
+ 1640
+ 700
+
+ false
+ true
+ true
+ return this.c_gridConnections;
+
+
+ RETURNS_VALUE
+ List<GridConnection>
+ 1755014169405
+ f_getPausedGridConnectionsCollectionPointer
+ 1640
+ 720
+
+ false
+ true
+ true
+ return this.c_pausedGridConnections;
+
+
+ VOID
+ double
+ 1756207695591
+ f_runAggregators
+ 1110
+ 250
+
+ false
+ true
+ true
+ //Function used to perform central management functions (like setpoint battery steering)
+
+//Run energy coop aggrator
+for (EnergyCoop EC : pop_energyCoops) {
+ EC.f_aggregatorManagement_EnergyCoop();
+}
+
+
+ RETURNS_VALUE
+ Date
+ 1758012535712
+ f_getDate
+ 1640
+ 470
+
+ false
+ true
+ true
+ Date startDate = getExperiment().getEngine().getStartDate();
+long startDateUnixTime_ms = startDate.getTime();
+long runtime_ms = (long) (v_timeStepsElapsed * p_timeStep_h * 60 * 60 * 1000);
+Date date = new Date();
+date.setTime(startDateUnixTime_ms + runtime_ms);
+return date;
+
+
+ VOID
+ double
+ 1758619562148
+ f_loopSimulation
+ 1640
+ 70
+
+ false
+ true
+ true
+ v_timeStepsElapsed = 0;
+f_clearAllLiveDatasets();
+traceln("The simulation has been looped.");
+
+
+ VOID
+ double
+ 1758619851984
+ f_clearAllLiveDatasets
+ 1660
+ 90
+
+ false
+ true
+ true
+ //Energy Model
+v_liveData.clearLiveDatasets();
+
+//Energy Coops
+pop_energyCoops.forEach(EC -> EC.v_liveData.clearLiveDatasets());
+
+//GridConnections
+c_gridConnections.forEach(GC -> GC.v_liveData.clearLiveDatasets());
+c_pausedGridConnections.forEach(GC -> GC.v_liveData.clearLiveDatasets());
+
+
+ VOID
+ double
+ 1758792939882
+ f_initializeEngineAfterLoad
+ true
+ 870
+ -30
+
+ false
+ true
+ true
+ // Initialize time and date
+//v_hourOfYearStart=hourOfYearPerMonth[getMonth()] + (getDayOfMonth()-1)*24;
+t_h = p_runStartTime_h;
+
+Date startDate = date();
+p_year = startDate.getYear() + 1900;
+
+LocalDate localDate = LocalDate.of(p_year, 1, 1);
+v_dayOfWeek1jan = DayOfWeek.from(localDate).getValue();
+p_startOfWinterWeek_h = roundToInt(24 * (p_winterWeekNumber * 7 + (8-v_dayOfWeek1jan)%7)); // Week 49 is winterweek.
+p_startOfSummerWeek_h = roundToInt(24 * (p_summerWeekNumber * 7 + (8-v_dayOfWeek1jan)%7)); // Week 18 is summerweek.
+
+int monthIdx = 0;
+while ( t_h > hourOfYearPerMonth[monthIdx] ) {
+ monthIdx++;
+ if (monthIdx==hourOfYearPerMonth.length){
+ break;
+ }
+}
+
+int dayOfMonth = 1+(int)((t_h - hourOfYearPerMonth[monthIdx])/24.0);
+traceln("Day of month start: %s", dayOfMonth);
+traceln("Month of year start: %s", monthIdx);
+startDate.setMonth(monthIdx);
+startDate.setDate(dayOfMonth);
+startDate.setHours(0);
+startDate.setMinutes(0);
+traceln("Startdate: %s", startDate);
+//startDate.set
+getExperiment().getEngine().setStartDate(startDate);
+
+
+
+// Initialize all agents in the correct order, creating all connections. What about setting initial values? And how about repeated simulations?
+
+/*f_buildGridNodeTree();
+c_gridConnections.forEach(GC -> GC.f_initialize());
+
+// Only relevant for deserialisation:
+c_pausedGridConnections.forEach(GC -> GC.f_initialize());
+
+pop_connectionOwners.forEach(CO -> CO.f_initialize());
+pop_energyCoops.forEach(EC -> EC.f_initialize()); // Not yet robust when there is no supplier initialized!
+
+
+
+// Initializing Live Data Class
+v_liveAssetsMetaData.updateActiveAssetData(c_gridConnections);
+for (GridConnection GC : c_gridConnections) {
+ v_liveData.activeEnergyCarriers.addAll(GC.v_liveData.activeEnergyCarriers);
+ v_liveData.activeConsumptionEnergyCarriers.addAll(GC.v_liveData.activeConsumptionEnergyCarriers);
+ v_liveData.activeProductionEnergyCarriers.addAll(GC.v_liveData.activeProductionEnergyCarriers);
+}
+
+// Loop over populations to check v_ispaused
+f_initializePause();
+
+for (GridNode GN : c_gridNodeExecutionList) {
+ GN.f_initializeGridnode();
+}
+
+v_liveData.connectionMetaData.contractedDeliveryCapacityKnown = false;
+v_liveData.connectionMetaData.contractedFeedinCapacityKnown = false;
+v_liveData.connectionMetaData.physicalCapacityKnown = false;
+*/
+f_initializeForecasts();
+
+f_initializeLiveDataSets();
+
+
+
+ RETURNS_VALUE
+ ArrayList<GridConnection>
+ 1761140687507
+ f_getAllGridConnections
+ 1640
+ 500
+
+ false
+ true
+ true
+ ArrayList<GridConnection> copyOfGridConnectionList = new ArrayList<>(c_gridConnections);
+copyOfGridConnectionList.addAll(c_pausedGridConnections);
+copyOfGridConnectionList.removeAll(Arrays.asList(pop_gridConnections)); // Remove all default gridconnections (no flex control, only used for gridnode profile)
+
+return copyOfGridConnectionList;
+
+
+
+ VOID
+ double
+ 1762791721564
+ f_registerAssetManagement
+ 1650
+ 860
+
+ false
+ true
+ true
+
+ newAssetManagement
+ I_AssetManagement
+
+ //Should only be called by GC
+c_assetManagement.add(newAssetManagement);
+
+
+ VOID
+ double
+ 1762791721568
+ f_removeAssetManagement
+ 1650
+ 880
+
+ false
+ true
+ true
+
+ assetManagement
+ I_AssetManagement
+
+ //Should only be called by GC
+c_assetManagement.remove(assetManagement);
+
+
+
+
+ 1658477103135
+ connections
+ true
+ 50
+ -50
+
+ false
+ true
+ true
+ false
+ COLLECTION_OF_LINKS
+ true
+ Object
+ SOLID
+ 1
+ -16777216
+ UNDER_AGENTS
+ NONE
+ END
+
+
+ 1696520909218
+ connections1
+ true
+ 40
+ -180
+
+ false
+ true
+ true
+ false
+ COLLECTION_OF_LINKS
+ false
+ Object
+ SOLID
+ 1
+ -16777216
+ UNDER_AGENTS
+ NONE
+ END
+
+
+
+
+ 1658477403183
+ pop_gridNodes
+ 400
+ 50
+
+ false
+ true
+ true
+
+ zero_engine
+ GridNode
+
+
+
+ zero_engine
+ GridNode
+ 1658477288306
+
+
+
+
+ p_gridNodeID
+
+
+ p_parentNodeID
+
+
+ p_nodeType
+
+
+ p_energyCarrier
+
+
+ p_capacity_kW
+
+
+ p_transportBuffer
+
+
+ p_ownerGridOperator
+
+
+ p_gridNodeOwnerID
+
+
+ b_transportBufferValid
+
+
+ p_longitude
+
+
+ p_latitude
+
+
+ gisRegion
+
+
+ p_description
+
+
+ p_realCapacityAvailable
+
+
+ p_serviceAreaGisRegion
+
+
+ p_uniqueColor
+
+
+ p_localNodalPricingFactor_eurpkWh
+
+
+ p_defaultLineColor
+
+
+ p_defaultFillColor
+
+
+ p_localNodalPricingTreshold_fr
+
+
+ p_originalCapacity_kW
+
+
+ p_hasProfileData
+
+
+ true
+
+ 100
+
+ ARRAY_LIST_BASED
+ true
+ XYZ
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ ""
+
+ EMPTY
+
+ 1658477089986
+
+
+ ONE_AGENT_PER_DATABASE_RECORD
+
+
+
+ 1658477403184
+ pop_gridConnections
+ 90
+ 45
+
+ false
+ true
+ true
+
+ zero_engine
+ GridConnection
+
+
+
+ zero_engine
+ GridConnection
+ 1658499438201
+
+
+
+
+ p_parentNodeElectricID
+
+
+ p_parentNodeHeatID
+
+
+ p_BuildingThermalAsset
+
+
+ p_ownerID
+
+
+ p_batteryAsset
+
+
+ p_electrolyserOperationMode
+
+
+ p_heatBuffer
+
+
+ p_gasBuffer
+
+
+ p_cookingTracker
+
+
+ p_energyLabel
+
+
+ p_DHWAsset
+
+
+ p_longitude
+
+
+ p_latitude
+
+
+ p_gridConnectionID
+
+
+ p_floorSurfaceArea_m2
+
+
+ p_GISPoint
+
+
+ p_owner
+
+
+ p_roofSurfaceArea_m2
+
+
+ p_purposeBAG
+
+
+ p_name
+
+
+ p_curtailmentMode
+
+
+ p_address
+
+
+ p_parentNodeHeat
+
+
+ p_parentNodeElectric
+
+
+ v_isActive
+
+
+ p_uid
+
+
+ true
+
+ 100
+
+ ARRAY_LIST_BASED
+ XYZ
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ ""
+
+ EMPTY
+
+ 1658477089985
+
+
+ ONE_AGENT_PER_DATABASE_RECORD
+
+
+
+ 1658499722957
+ energyDataViewer
+ 397
+ 342
+
+ false
+ true
+ true
+
+ zero_engine
+ EnergyDataViewer
+
+
+
+ zero_engine
+ EnergyDataViewer
+ 1705600400160
+
+
+
+
+ p_areaType
+
+
+ p_name
+
+
+ false
+
+ 0
+
+ ARRAY_LIST_BASED
+ XYZ
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ ""
+
+ SPECIFIED_NUMBER
+
+ 1658477089984
+
+
+ ONE_AGENT_PER_DATABASE_RECORD
+
+
+
+ 1660730126216
+ pop_connectionOwners
+ 90
+ 340
+
+ false
+ true
+ true
+
+ zero_engine
+ ConnectionOwner
+
+
+
+ zero_engine
+ ConnectionOwner
+ 1660224852392
+
+
+
+
+ p_actorID
+
+
+ p_actorType
+
+
+ p_actorSubgroup
+
+
+ p_actorGroup
+
+
+ p_coopParent
+
+
+ p_actorContractList
+
+
+ p_capacityTariffApplicable
+
+
+ p_capacityPrice_eur
+
+
+ p_capacityLevel_kW
+
+
+ p_congestionTariffApplicable
+
+
+ p_connectionCapacity_kW
+
+
+ p_electricitySupplier
+
+
+ p_nfatoStart_h
+
+
+ p_nfatoEnd_h
+
+
+ p_nfatoLvl_kW
+
+
+ p_gridOperator
+
+
+ p_methaneSupplier
+
+
+ p_hydrogenSupplier
+
+
+ p_heatSupplier
+
+
+ p_connectionOwnerType
+
+
+ p_connectionOwnerIndexNr
+
+
+ p_detailedCompany
+
+
+ b_hasPrivateUI
+
+
+ p_energySupplierID
+
+
+ p_energyCoopID
+
+
+ b_dataSharingAgreed
+
+
+ true
+
+ 100
+
+ ARRAY_LIST_BASED
+ XYZ
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ ""
+
+ EMPTY
+
+ 1658477089982
+
+
+ ONE_AGENT_PER_DATABASE_RECORD
+
+
+
+ 1660731786332
+ pop_energySuppliers
+ 90
+ 360
+
+ false
+ true
+ true
+
+ zero_engine
+ EnergySupplier
+
+
+
+ zero_engine
+ EnergySupplier
+ 1660731377982
+
+
+
+
+ p_actorID
+
+
+ p_actorType
+
+
+ p_actorSubgroup
+
+
+ p_actorGroup
+
+
+ p_parentActorID
+
+
+ p_parentActor
+
+
+ p_fixedElectricityPrice_eurpkWh
+
+
+ p_fixedHeatPrice_eurpkWh
+
+
+ p_fixedMethanePrice_eurpkWh
+
+
+ p_fixedHydrogenPrice_eurpkWh
+
+
+ p_variableElectricityPriceOverNational_eurpkWh
+
+
+ p_fixedFeedinTariff_eurpkWh
+
+
+ p_salderenActive
+
+
+ true
+
+ 100
+
+ ARRAY_LIST_BASED
+ XYZ
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ ""
+
+ EMPTY
+
+ 1658477089981
+
+
+ ONE_AGENT_PER_DATABASE_RECORD
+
+
+
+ 1660731820965
+ pop_energyCoops
+ 90
+ 380
+
+ false
+ true
+ true
+
+ zero_engine
+ EnergyCoop
+
+
+
+ zero_engine
+ EnergyCoop
+ 1660731375014
+
+
+
+
+ p_actorID
+
+
+ p_actorType
+
+
+ p_actorContractList
+
+
+ p_connectionCapacity_kW
+
+
+ p_gridNodeUnderResponsibility
+
+
+ p_parentActorID
+
+
+ p_electricitySupplier
+
+
+ p_CoopParent
+
+
+ p_gridOperator
+
+
+ p_methaneSupplier
+
+
+ p_hydrogenSupplier
+
+
+ p_heatSupplier
+
+
+ p_yearlyOperationalCosts_eur
+
+
+ p_applyKostprijsPlus
+
+
+ p_actorGroup
+
+
+ p_actorSubgroup
+
+
+ p_aggregatorBatteryManagement
+
+
+ true
+
+ 100
+
+ ARRAY_LIST_BASED
+ XYZ
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ ""
+
+ EMPTY
+
+ 1658477089980
+
+
+ ONE_AGENT_PER_DATABASE_RECORD
+
+
+
+ 1660731850501
+ pop_gridOperators
+ 90
+ 420
+
+ false
+ true
+ true
+
+ zero_engine
+ GridOperator
+
+
+
+ zero_engine
+ GridOperator
+ 1660731380913
+
+
+
+
+ p_actorID
+
+
+ p_actorType
+
+
+ p_actorSubgroup
+
+
+ p_actorGroup
+
+
+ p_parentActorID
+
+
+ p_parentActor
+
+
+ p_capacitypricing_households_kW
+
+
+ p_capacitypricing_households_eur
+
+
+ p_hasCapacityPricing
+
+
+ p_hasCongestionPricing2
+
+
+ true
+
+ 1
+
+ ARRAY_LIST_BASED
+ XYZ
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ ""
+
+ EMPTY
+
+ 1658477089979
+
+
+ ONE_AGENT_PER_DATABASE_RECORD
+
+
+
+ 1660731876775
+ nationalEnergyMarket
+ 90
+ 540
+
+ false
+ true
+ true
+
+ zero_engine
+ NationalEnergyMarket
+
+
+
+ zero_engine
+ NationalEnergyMarket
+ 1660731384413
+
+
+
+
+ p_actorID
+
+
+ p_actorType
+
+
+ p_actorSubgroup
+
+
+ p_actorGroup
+
+
+ false
+
+ 100
+
+ ARRAY_LIST_BASED
+
+ 0
+ MPS
+
+ XYZ
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ ""
+
+ SPECIFIED_NUMBER
+
+ 1658477089978
+
+
+ ONE_AGENT_PER_DATABASE_RECORD
+
+
+
+ 1660731999276
+ pop_governmentLayer
+ true
+ 90
+ 400
+
+ false
+ true
+ true
+
+ zero_engine
+ ZeroAgent
+
+
+
+ zero_engine
+ ZeroAgent
+ 1660731364523
+
+
+
+ true
+
+ 100
+
+ ARRAY_LIST_BASED
+ true
+ XYZ
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ ""
+
+ EMPTY
+
+ 1658477089977
+
+
+ ONE_AGENT_PER_DATABASE_RECORD
+
+
+
+ 1663772677806
+ Houses
+ 90
+ 65
+
+ false
+ true
+ true
+
+ zero_engine
+ GCHouse
+
+
+
+ zero_engine
+ GCHouse
+ 1663772408665
+
+
+
+
+ p_parentNodeElectricID
+
+
+ p_parentNodeHeatID
+
+
+ p_BuildingThermalAsset
+
+
+ p_ownerID
+
+
+ p_batteryAsset
+
+
+ p_electrolyserOperationMode
+
+
+ p_heatBuffer
+
+
+ p_gasBuffer
+
+
+ p_cookingTracker
+
+
+ p_energyLabel
+
+
+ p_DHWAsset
+
+
+ p_longitude
+
+
+ p_latitude
+
+
+ p_gridConnectionID
+
+
+ p_floorSurfaceArea_m2
+
+
+ p_GISPoint
+
+
+ p_owner
+
+
+ p_roofSurfaceArea_m2
+
+
+ p_purposeBAG
+
+
+ p_curtailmentMode
+
+
+ p_name
+
+
+ p_address
+
+
+ p_parentNodeHeat
+
+
+ p_parentNodeElectric
+
+
+ p_airco
+
+
+ p_smartChargingPowerAttenuation_fr
+
+
+ p_bouwjaar
+
+
+ p_eigenOprit
+
+
+ p_name
+
+
+ p_address
+
+
+ p_cookingMethod
+
+
+ v_dayTempSetpoint_degC
+
+
+ v_nightTempSetpoint_degC
+
+
+ p_airco
+
+
+ v_isActive
+
+
+ p_uid
+
+
+ true
+
+ 100
+
+ ARRAY_LIST_BASED
+ XYZ
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ ""
+
+ EMPTY
+
+ 1658477089976
+
+
+ ONE_AGENT_PER_DATABASE_RECORD
+
+
+
+ 1663774441970
+ DistrictHeatingSystems
+ 90
+ 85
+
+ false
+ true
+ true
+
+ zero_engine
+ GCDistrictHeating
+
+
+
+ zero_engine
+ GCDistrictHeating
+ 1663773810343
+
+
+
+
+ p_parentNodeElectricID
+
+
+ p_parentNodeHeatID
+
+
+ p_BuildingThermalAsset
+
+
+ p_ownerID
+
+
+ p_batteryAsset
+
+
+ p_electrolyserOperationMode
+
+
+ p_heatBuffer
+
+
+ p_gasBuffer
+
+
+ p_cookingTracker
+
+
+ p_energyLabel
+
+
+ p_DHWAsset
+
+
+ p_longitude
+
+
+ p_latitude
+
+
+ p_gridConnectionID
+
+
+ p_floorSurfaceArea_m2
+
+
+ p_GISPoint
+
+
+ p_owner
+
+
+ p_roofSurfaceArea_m2
+
+
+ p_purposeBAG
+
+
+ p_DHheatStorage
+
+
+ p_curtailmentMode
+
+
+ p_name
+
+
+ p_address
+
+
+ p_parentNodeHeat
+
+
+ p_parentNodeElectric
+
+
+ p_residualHeatLTSource
+
+
+ p_DHheatStorage
+
+
+ v_isActive
+
+
+ p_uid
+
+
+ true
+
+ 100
+
+ ARRAY_LIST_BASED
+ XYZ
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ ""
+
+ EMPTY
+
+ 1658477089975
+
+
+ ONE_AGENT_PER_DATABASE_RECORD
+
+
+
+ 1663774461816
+ EnergyProductionSites
+ 90
+ 125
+
+ false
+ true
+ true
+
+ zero_engine
+ GCEnergyProduction
+
+
+
+ zero_engine
+ GCEnergyProduction
+ 1663773842877
+
+
+
+
+ p_parentNodeElectricID
+
+
+ p_parentNodeHeatID
+
+
+ p_BuildingThermalAsset
+
+
+ p_ownerID
+
+
+ p_batteryAsset
+
+
+ p_electrolyserOperationMode
+
+
+ p_heatBuffer
+
+
+ p_gasBuffer
+
+
+ p_cookingTracker
+
+
+ p_energyLabel
+
+
+ p_DHWAsset
+
+
+ p_longitude
+
+
+ p_latitude
+
+
+ p_gridConnectionID
+
+
+ p_floorSurfaceArea_m2
+
+
+ p_GISPoint
+
+
+ p_owner
+
+
+ p_roofSurfaceArea_m2
+
+
+ p_purposeBAG
+
+
+ p_name
+
+
+ p_curtailmentMode
+
+
+ p_address
+
+
+ p_parentNodeHeat
+
+
+ p_parentNodeElectric
+
+
+ p_isSliderGC
+
+
+ v_isActive
+
+
+ p_uid
+
+
+ true
+
+ 100
+
+ ARRAY_LIST_BASED
+ XYZ
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ ""
+
+ EMPTY
+
+ 1658477089974
+
+
+ ONE_AGENT_PER_DATABASE_RECORD
+
+
+
+ 1663774484695
+ EnergyConversionSites
+ 90
+ 165
+
+ false
+ true
+ true
+
+ zero_engine
+ GCEnergyConversion
+
+
+
+ zero_engine
+ GCEnergyConversion
+ 1663773857866
+
+
+
+
+ p_parentNodeElectricID
+
+
+ p_gridConnectionID
+
+
+ p_parentNodeHeatID
+
+
+ p_BuildingThermalAsset
+
+
+ p_ownerID
+
+
+ p_batteryAsset
+
+
+ p_electrolyserOperationMode
+
+
+ p_heatBuffer
+
+
+ p_gasBuffer
+
+
+ p_cookingTracker
+
+
+ p_energyLabel
+
+
+ p_DHWAsset
+
+
+ p_longitude
+
+
+ p_latitude
+
+
+ p_floorSurfaceArea_m2
+
+
+ p_GISPoint
+
+
+ p_owner
+
+
+ p_roofSurfaceArea_m2
+
+
+ p_purposeBAG
+
+
+ p_name
+
+
+ p_curtailmentMode
+
+
+ p_address
+
+
+ p_parentNodeHeat
+
+
+ p_parentNodeElectric
+
+
+ p_conversionEfficiency
+
+
+ p_productionNominal_Nm3
+
+
+ p_conversionEfficiencyFC
+
+
+ p_productionNominalFC_Nm3
+
+
+ p_productionMinimumFC_Nm3
+
+
+ p_powerNominalFC_kW
+
+
+ p_energyProductionNominalFC_kWh_Nm3
+
+
+ p_inputPressureFC_Bar
+
+
+ p_loadChangeTimeMinMaxFC_s
+
+
+ p_startUpTimeIdleFC_s
+
+
+ p_startUpTimeShutdownFC_s
+
+
+ p_electricityPriceMinForProfitFC_eurpkWh
+
+
+ p_minProductionRatio
+
+
+ b_forecast_lastWeekBased
+
+
+ p_purposeBAG
+
+
+ p_name
+
+
+ p_curtailmentMode
+
+
+ p_address
+
+
+ p_parentNodeHeat
+
+
+ p_parentNodeElectric
+
+
+ v_isActive
+
+
+ p_uid
+
+
+ true
+
+ 100
+
+ ARRAY_LIST_BASED
+ XYZ
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ ""
+
+ EMPTY
+
+ 1658477089973
+
+
+ ONE_AGENT_PER_DATABASE_RECORD
+
+
+
+ 1663774484696
+ UtilityConnections
+ 90
+ 145
+
+ false
+ true
+ true
+
+ zero_engine
+ GCUtility
+
+
+
+ zero_engine
+ GCUtility
+ 1672138285225
+
+
+
+
+ p_parentNodeElectricID
+
+
+ p_gridConnectionID
+
+
+ p_parentNodeHeatID
+
+
+ p_BuildingThermalAsset
+
+
+ p_ownerID
+
+
+ p_batteryAsset
+
+
+ p_electrolyserOperationMode
+
+
+ p_heatBuffer
+
+
+ p_gasBuffer
+
+
+ p_cookingTracker
+
+
+ p_energyLabel
+
+
+ p_DHWAsset
+
+
+ p_longitude
+
+
+ p_latitude
+
+
+ p_floorSurfaceArea_m2
+
+
+ p_GISPoint
+
+
+ p_owner
+
+
+ p_roofSurfaceArea_m2
+
+
+ p_purposeBAG
+
+
+ p_name
+
+
+ p_curtailmentMode
+
+
+ p_address
+
+
+ p_parentNodeHeat
+
+
+ p_parentNodeElectric
+
+
+ v_isActive
+
+
+ p_uid
+
+
+ true
+
+ 100
+
+ ARRAY_LIST_BASED
+ XYZ
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ ""
+
+ EMPTY
+
+ 1658477089972
+
+
+ ONE_AGENT_PER_DATABASE_RECORD
+
+
+
+ 1666957373353
+ GridBatteries
+ 90
+ 105
+
+ false
+ true
+ true
+
+ zero_engine
+ GCGridBattery
+
+
+
+ zero_engine
+ GCGridBattery
+ 1666956363817
+
+
+
+
+ p_parentNodeElectricID
+
+
+ p_parentNodeHeatID
+
+
+ p_BuildingThermalAsset
+
+
+ p_ownerID
+
+
+ p_batteryAsset
+
+
+ p_electrolyserOperationMode
+
+
+ p_heatBuffer
+
+
+ p_gasBuffer
+
+
+ p_cookingTracker
+
+
+ p_energyLabel
+
+
+ p_DHWAsset
+
+
+ p_longitude
+
+
+ p_latitude
+
+
+ p_gridConnectionID
+
+
+ p_floorSurfaceArea_m2
+
+
+ p_GISPoint
+
+
+ p_owner
+
+
+ p_roofSurfaceArea_m2
+
+
+ p_purposeBAG
+
+
+ p_name
+
+
+ p_curtailmentMode
+
+
+ p_address
+
+
+ p_parentNodeHeat
+
+
+ p_parentNodeElectric
+
+
+ p_isSliderGC
+
+
+ v_isActive
+
+
+ p_uid
+
+
+ true
+
+ 100
+
+ ARRAY_LIST_BASED
+ XYZ
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ ""
+
+ EMPTY
+
+ 1658477089970
+
+
+ ONE_AGENT_PER_DATABASE_RECORD
+
+
+
+ 1676382641979
+ pop_GIS_Buildings
+ 397
+ 402
+
+ false
+ true
+ true
+
+ zero_engine
+ GIS_Building
+
+
+
+ zero_engine
+ GIS_Building
+ 1676382560900
+
+
+
+
+ p_status
+
+
+ p_useType
+
+
+ p_buildingType
+
+
+ p_buildingYear
+
+
+ p_floorSurfaceArea_m2
+
+
+ p_floors
+
+
+ p_roofSurfaceArea_m2
+
+
+ p_pandNaam
+
+
+ gisRegion
+
+
+ p_longitude
+
+
+ p_latitude
+
+
+ p_GISObjectType
+
+
+ p_GISRegion_coords
+
+
+ p_id
+
+
+ p_defaultLineColor
+
+
+ p_defaultFillColor
+
+
+ p_defaultLineWidth
+
+
+ p_defaultLineStyle
+
+
+ p_pandNaam
+
+
+ p_annotation
+
+
+ p_defaultFillColorString
+
+
+ p_defaultLineColorString
+
+
+ p_defaultLineStyleString
+
+
+ true
+
+ 100
+
+ ARRAY_LIST_BASED
+ true
+ XYZ
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ ""
+
+ EMPTY
+
+ 1658477089969
+
+
+ ONE_AGENT_PER_DATABASE_RECORD
+
+
+
+ 1676382641980
+ pop_GIS_Objects
+ 397
+ 362
+
+ false
+ true
+ true
+
+ zero_engine
+ GIS_Object
+
+
+
+ zero_engine
+ GIS_Object
+ 1667726338855
+
+
+
+
+ gisRegion
+
+
+ p_latitude
+
+
+ p_GISObjectType
+
+
+ p_GISRegion_coords
+
+
+ p_id
+
+
+ p_defaultLineColor
+
+
+ p_defaultFillColor
+
+
+ p_longitude
+
+
+ p_defaultLineWidth
+
+
+ p_defaultLineStyle
+
+
+ p_annotation
+
+
+ p_defaultFillColorString
+
+
+ p_defaultLineColorString
+
+
+ p_defaultLineStyleString
+
+
+ true
+
+ 100
+
+ ARRAY_LIST_BASED
+ true
+ XYZ
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ ""
+
+ EMPTY
+
+ 1658477089968
+
+
+ ONE_AGENT_PER_DATABASE_RECORD
+
+
+
+ 1676382641981
+ pop_GIS_Parcels
+ 397
+ 380
+
+ false
+ true
+ true
+
+ zero_engine
+ GIS_Parcel
+
+
+
+ zero_engine
+ GIS_Parcel
+ 1660572036694
+
+
+
+
+ gisRegion
+
+
+ p_latitude
+
+
+ p_GISObjectType
+
+
+ p_GISRegion_coords
+
+
+ p_id
+
+
+ p_defaultLineColor
+
+
+ p_defaultFillColor
+
+
+ p_longitude
+
+
+ p_defaultLineWidth
+
+
+ p_defaultLineStyle
+
+
+ p_annotation
+
+
+ p_address
+
+
+ p_defaultFillColorString
+
+
+ p_defaultLineColorString
+
+
+ p_defaultLineStyleString
+
+
+ true
+
+ 100
+
+ ARRAY_LIST_BASED
+ true
+ XYZ
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ ""
+
+ EMPTY
+
+ 1658477089967
+
+
+ ONE_AGENT_PER_DATABASE_RECORD
+
+
+
+ 1717960182623
+ PublicChargers
+ 90
+ 185
+
+ false
+ true
+ true
+
+ zero_engine
+ GCPublicCharger
+
+
+
+ zero_engine
+ GCPublicCharger
+ 1717956409512
+
+
+
+
+ p_parentNodeElectricID
+
+
+ p_gridConnectionID
+
+
+ p_parentNodeHeatID
+
+
+ p_BuildingThermalAsset
+
+
+ p_ownerID
+
+
+ p_batteryAsset
+
+
+ p_electrolyserOperationMode
+
+
+ p_heatBuffer
+
+
+ p_gasBuffer
+
+
+ p_cookingTracker
+
+
+ p_energyLabel
+
+
+ p_DHWAsset
+
+
+ p_longitude
+
+
+ p_latitude
+
+
+ p_floorSurfaceArea_m2
+
+
+ p_GISPoint
+
+
+ p_owner
+
+
+ p_roofSurfaceArea_m2
+
+
+ p_purposeBAG
+
+
+ p_isInitialCharger
+
+
+ p_chargingProfileName
+
+
+ p_curtailmentMode
+
+
+ p_name
+
+
+ p_address
+
+
+ p_parentNodeHeat
+
+
+ p_parentNodeElectric
+
+
+ p_isInitialCharger1
+
+
+ p_chargingProfileName1
+
+
+ chargingSessionSocket1
+
+
+ chargingSessionSocket2
+
+
+ p_chargerAsset
+
+
+ p_isChargingCentre
+
+
+ p_gisregion
+
+
+ p_nbOfChargers
+
+
+ p_maxChargingPower_kW
+
+
+ p_chargingVehicleType
+
+
+ p_isInitialCharger
+
+
+ p_chargingProfileName
+
+
+ v_isActive
+
+
+ p_uid
+
+
+ true
+
+ 100
+
+ ARRAY_LIST_BASED
+ true
+ XYZ
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ ""
+
+ EMPTY
+
+ 1658477089966
+
+
+ ONE_AGENT_PER_DATABASE_RECORD
+
+
+
+ 1718797587108
+ Neighborhoods
+ 90
+ 206
+
+ false
+ true
+ true
+
+ zero_engine
+ GCNeighborhood
+
+
+
+ zero_engine
+ GCNeighborhood
+ 1718724980089
+
+
+
+
+ p_parentNodeElectricID
+
+
+ p_gridConnectionID
+
+
+ p_parentNodeHeatID
+
+
+ p_BuildingThermalAsset
+
+
+ p_ownerID
+
+
+ p_batteryAsset
+
+
+ p_electrolyserOperationMode
+
+
+ p_heatBuffer
+
+
+ p_gasBuffer
+
+
+ p_cookingTracker
+
+
+ p_energyLabel
+
+
+ p_DHWAsset
+
+
+ p_longitude
+
+
+ p_latitude
+
+
+ p_floorSurfaceArea_m2
+
+
+ p_GISPoint
+
+
+ p_owner
+
+
+ p_roofSurfaceArea_m2
+
+
+ p_purposeBAG
+
+
+ p_name
+
+
+ p_curtailmentMode
+
+
+ p_thresholdCOP_hybridHeatpump
+
+
+ p_address
+
+
+ p_parentNodeHeat
+
+
+ p_parentNodeElectric
+
+
+ p_thresholdCOP_hybridHeatpump
+
+
+ p_nbCompaniesTotal
+
+
+ p_nbHouseholds
+
+
+ p_municipalityCode
+
+
+ p_nbServices
+
+
+ p_nbIndustry
+
+
+ p_nbAgriculture
+
+
+ p_ignoreGridCapacityBattery
+
+
+ p_chpAsset
+
+
+ p_parentNodeHeat
+
+
+ p_parentNodeElectric
+
+
+ v_isActive
+
+
+ p_uid
+
+
+ true
+
+ 100
+
+ ARRAY_LIST_BASED
+ true
+ XYZ
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ ""
+
+ EMPTY
+
+ 1658477089965
+
+
+ ONE_AGENT_PER_DATABASE_RECORD
+
+
+
+
+
+ 1658477103139
+ level
+ 0
+ 0
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ 0
+ DIM_NON_CURRENT
+
+
+ 1665052211228
+ rect_parametersAndProfiles
+ -880
+ 400
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ false
+ 0
+ 10
+ 3
+ -16744448
+ null
+ SOLID
+ 780
+ 380
+ 0.0
+ -1
+ null
+
+
+ 1659709739366
+ txt_Profiles
+ -861
+ 445
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ Profiles:
+
+ SansSerif
+ 14
+
+
+ LEFT
+
+
+ 1665052264314
+ rect_energyBalanceCheck2
+ 960
+ 980
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ false
+ 0
+ 10
+ 3
+ -3308225
+ null
+ SOLID
+ 420
+ 440
+ 0.0
+ -1
+ null
+
+
+ 1665052603927
+ rectangle2
+ true
+ -880
+ 400
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ false
+ 0
+ 10
+ 1
+ -16744448
+ null
+ SOLID
+ 240
+ 39
+ 0.0
+ -1
+ null
+
+
+ 1665052191319
+ txt_inputProfiles
+ true
+ -850
+ 409
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16744448
+ Generic profiles/data
+
+ SansSerif
+ 18
+
+
+ LEFT
+
+
+ 1665052678662
+ rect_energyBalanceCheck1
+ 960
+ 980
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ false
+ 0
+ 10
+ 1
+ -3308225
+ null
+ SOLID
+ 420
+ 40
+ 0.0
+ -1
+ null
+
+
+ 1665052678664
+ txt_energyBalanceCheck
+ 1080
+ 990
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -3308225
+ EnergyBalance Check
+
+
+ SansSerif
+ 18
+
+
+ LEFT
+
+
+ 1668602188368
+ txt_gridConnections
+ 120
+ 10
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ Gridconnections
+
+ SansSerif
+ 11
+
+
+ LEFT
+
+
+ 1668602188372
+ line_gridConnections
+ 60
+ 30
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ false
+ 0
+ 10
+ 1
+ -16777216
+ null
+ SOLID
+ 1
+ 0
+ 1
+ 0
+ 190
+ 0
+ 0
+
+
+ 1668602207232
+ txt_infraAndAssets
+ 440
+ 10
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ Infra & assets
+
+ SansSerif
+ 11
+
+
+ LEFT
+
+
+ 1668602207235
+ line_infraAndAssets
+ 380
+ 30
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ false
+ 0
+ 10
+ 1
+ -16777216
+ null
+ SOLID
+ 1
+ 0
+ 1
+ 0
+ 180
+ 0
+ 0
+
+
+ 1668602284894
+ line_actors
+ 60
+ 320
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ false
+ 0
+ 10
+ 1
+ -16777216
+ null
+ SOLID
+ 1
+ 0
+ 1
+ 0
+ 190
+ 0
+ 0
+
+
+ 1668602284900
+ txt_actors
+ 130
+ 300
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ Actors
+
+ SansSerif
+ 11
+
+
+ LEFT
+
+
+ 1668602384222
+ line_otherAgents
+ 60
+ 510
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ false
+ 0
+ 10
+ 1
+ -16777216
+ null
+ SOLID
+ 1
+ 0
+ 1
+ 0
+ 190
+ 0
+ 0
+
+
+ 1668602384225
+ txt_otherAgents
+ 150
+ 490
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ Other populations
+
+ SansSerif
+ 11
+
+
+ CENTER
+
+
+ 1668602513058
+ line_variables
+ -620
+ 506
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ false
+ 0
+ 10
+ 1
+ -16777216
+ null
+ SOLID
+ 1
+ 0
+ 1
+ 0
+ 180
+ 0
+ 0
+
+
+ 1668602513060
+ txt_variables
+ -559
+ 487
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ DLR factors
+
+ SansSerif
+ 11
+
+
+ LEFT
+
+
+ 1671703651141
+ text10
+ -533
+ 622
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ Derived Forecasts
+
+ SansSerif
+ 11
+
+
+ CENTER
+
+
+ 1690205003572
+ line_initialization
+ 680
+ 30
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ false
+ 0
+ 10
+ 1
+ -16777216
+ null
+ SOLID
+ 1
+ 0
+ 1
+ 0
+ 240
+ 0
+ 0
+
+
+ 1690205003577
+ txt_initialization
+ 800
+ 10
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ Initialization
+
+ SansSerif
+ 11
+
+
+ CENTER
+
+
+ 1693309354364
+ line_UI_visualisationAgens
+ 381
+ 320
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ false
+ 0
+ 10
+ 1
+ -16777216
+ null
+ SOLID
+ 1
+ 0
+ 1
+ 0
+ 180
+ 0
+ 0
+
+
+ 1693309354506
+ txt_UI_visualisationAgens
+ 407
+ 302
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ UI & Visualisation agents
+
+ SansSerif
+ 11
+
+
+ LEFT
+
+
+ false
+ 1697557019965
+ button_rapidSim
+ 1280
+ 40
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+
+ false
+ -16777216
+ true
+ f_runRapidSimulation();
+
+
+
+ Run Rapid Simulation
+
+
+
+ 1716890105093
+ line10
+ 1620
+ 450
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ false
+ 0
+ 10
+ 1
+ -16777216
+ null
+ SOLID
+ 1
+ 0
+ 1
+ 0
+ 190
+ 0
+ 0
+
+
+ 1716890105095
+ text12
+ 1710
+ 430
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ Getters
+
+ SansSerif
+ 11
+
+
+ CENTER
+
+
+ 1729238050157
+ line_selectedEnergyCarriers
+ -620
+ 640
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ false
+ 0
+ 10
+ 1
+ -16777216
+ null
+ SOLID
+ 1
+ 0
+ 1
+ 0
+ 190
+ 0
+ 0
+
+
+ 1739958834681
+ line11
+ 1620
+ 260
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ false
+ 0
+ 10
+ 1
+ -16777216
+ null
+ SOLID
+ 1
+ 0
+ 1
+ 0
+ 190
+ 0
+ 0
+
+
+ 1739958834683
+ text14
+ 1710
+ 240
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ Adders
+
+ SansSerif
+ 11
+
+
+ CENTER
+
+
+ false
+ 1741856477946
+ button_viewData
+ 220
+ -60
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+
+ false
+ -16777216
+ true
+ energyDataViewer.f_fillEnergyDataViewer(this);
+energyDataViewer.viewArea.navigateTo();
+
+
+
+ View Data
+
+
+
+ 1749205921716
+ txt_Forecasters
+ -860
+ 622
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ Forecasters:
+
+ SansSerif
+ 14
+
+
+ LEFT
+
+
+ 1753352444348
+ txt_simulationEngine
+ 1150
+ 10
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ Simulation engine
+
+ SansSerif
+ 11
+
+
+ CENTER
+
+
+ 1753352509622
+ line_simulationEngine
+ 1050
+ 30
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ false
+ 0
+ 10
+ 1
+ -16777216
+ null
+ SOLID
+ 1
+ 0
+ 1
+ 0
+ 220
+ 0
+ 0
+
+
+ 1753353340150
+ txt_updateFunctions
+ 1710
+ 140
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ Update functions
+
+ SansSerif
+ 11
+
+
+ CENTER
+
+
+ 1753353355569
+ line_updateFunctions
+ 1620
+ 160
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ false
+ 0
+ 10
+ 1
+ -16777216
+ null
+ SOLID
+ 1
+ 0
+ 1
+ 0
+ 190
+ 0
+ 0
+
+
+ 1753353677323
+ txt_energyModelState
+ 100
+ 720
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ EnergyModel Data
+
+ SansSerif
+ 11
+
+
+ LEFT
+
+
+ 1753353677325
+ line_energyModelState
+ 60
+ 740
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ false
+ 0
+ 10
+ 1
+ -16777216
+ null
+ SOLID
+ 1
+ 0
+ 1
+ 0
+ 190
+ 0
+ 0
+
+
+ 1753352925389
+ rect_output2
+ 0
+ 980
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ false
+ 0
+ 10
+ 3
+ -65536
+ null
+ SOLID
+ 900
+ 440
+ 0.0
+ -1
+ null
+
+
+ 1729238026851
+ txt_rapidRunTimeProfiling
+ 1143
+ 598
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ Rapid Run Time Profiling
+
+ SansSerif
+ 11
+
+
+ CENTER
+
+
+ 1671703651139
+ line_rapidRunTimeProfiling
+ 1040
+ 620
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ false
+ 0
+ 10
+ 1
+ -16777216
+ null
+ SOLID
+ 1
+ 0
+ 1
+ 0
+ 220
+ 0
+ 0
+
+
+ 1753352939846
+ rect_output3
+ 0
+ 980
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ false
+ 0
+ 10
+ 1
+ -65536
+ null
+ SOLID
+ 180
+ 40
+ 0.0
+ -1
+ null
+
+
+ 1753352943299
+ txt_outputs
+ 50
+ 990
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -65536
+ Outputs
+
+
+ SansSerif
+ 18
+
+
+ LEFT
+
+
+ 1753355115074
+ line_timeParametersAndVariables
+ 1050
+ 360
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ false
+ 0
+ 10
+ 1
+ -16777216
+ null
+ SOLID
+ 1
+ 0
+ 1
+ 0
+ 220
+ 0
+ 0
+
+
+ 1753355117052
+ txt_timeParametersAndVariables
+ 1150
+ 340
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ Time variables
+
+ SansSerif
+ 11
+
+
+ CENTER
+
+
+ 1753355925806
+ rect_parametersAndProfiles1
+ -880
+ 0
+
+ true
+ true
+ false
+ true
+ SHAPE_DRAW_2D3D
+ false
+ 0
+ 10
+ 3
+ -16744448
+ null
+ SOLID
+ 780
+ 350
+ 0.0
+ -1
+ null
+
+
+ 1753355926112
+ rectangle3
+ true
+ -880
+ 0
+
+ true
+ true
+ false
+ true
+ SHAPE_DRAW_2D3D
+ false
+ 0
+ 10
+ 1
+ -16744448
+ null
+ SOLID
+ 240
+ 39
+ 0.0
+ -1
+ null
+
+
+ 1753355926114
+ txt_inputParameters
+ true
+ -850
+ 9
+
+ true
+ true
+ false
+ true
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16744448
+ Input parameters
+
+ SansSerif
+ 18
+
+
+ LEFT
+
+
+ 1753356014542
+ txt_additionalData
+ -370
+ 445
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ Data:
+
+ SansSerif
+ 14
+
+
+ LEFT
+
+
+ 1753356088472
+ txt_simulationSettings
+ -380
+ 60
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ Simulation settings:
+
+ SansSerif
+ 14
+
+
+ LEFT
+
+
+ 1753356207478
+ txt_timeParameters1
+ -630
+ 60
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ Time parameters:
+
+ SansSerif
+ 14
+
+
+ LEFT
+
+
+ 1753356318998
+ txt_projectParameters
+ -850
+ 60
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ Project parameters:
+
+ SansSerif
+ 14
+
+
+ LEFT
+
+
+ 1758620074679
+ txt_loopSimulationFunctionality
+ 1720
+ 30
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ Loop simulation functionality
+
+ SansSerif
+ 11
+
+
+ CENTER
+
+
+ 1758620074681
+ line_updateFunctions1
+ 1630
+ 50
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ false
+ 0
+ 10
+ 1
+ -16777216
+ null
+ SOLID
+ 1
+ 0
+ 1
+ 0
+ 190
+ 0
+ 0
+
+
+
+
+ 1699290897134
+ level1
+ 0
+ 0
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ 0
+ DIM_NON_CURRENT
+
+
+
+
+ 1696520909213
+ va_engine
+ 0
+ 0
+
+ false
+ true
+ false
+
+ 1920
+ 980
+
+
+
+
+ 1660731377984
+ EnergySupplier
+ 1752677829820
+
+ zero_engine
+ Actor
+
+
+
+ p_actorID
+
+
+ p_actorType
+
+
+ p_actorSubgroup
+
+
+ p_actorGroup
+
+
+ false
+
+ 1660731377982
+ 1660731377982
+
+ T extends Agent
+
+ Generic parameter:
+
+ ENTITY
+ 100
+ false
+ 100
+ true
+
+ -4144960
+ null
+
+ true
+ true
+ false
+
+ 10
+ MPS
+
+
+ 1
+ METER
+
+
+ 1
+ METER
+
+
+ 1
+ METER
+
+
+
+ false
+
+ 1.0
+ SECOND
+
+ CONTINUOUS
+ 500
+ 500
+ 0
+ 100
+ 100
+ MOORE
+ USER_DEF
+ USER_DEF
+ 2
+ 50
+ 0.95
+ 10
+
+
+ true
+ 1658477089964
+ true
+ 1660809600000
+
+ 0
+ SECOND
+
+
+ 1
+ SECOND
+
+
+
+ 1660731377980
+ scale
+ 0
+ -150
+ false
+ false
+ false
+ SHAPE_DRAW_2D3D
+ 100
+ 0
+ BASED_ON_LENGTH
+ 10
+ METER
+ 10
+ true
+
+ 1660731377983
+ 1660731377979
+
+
+ 1660746837357
+ v_currentVariableElectricityPrice_eurpkWh
+ 70
+ 290
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1660752591616
+ v_currentBalanceClients_eur
+ Bank account balance for all energy carriers traded with clients.
+
+@author: Gillis
+@since: Sprint 6
+ 70
+ 430
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1660804951335
+ v_totalElectricitySoldToClients_kWh
+ 70
+ 450
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1660804979322
+ v_totalElectricityBoughtFromClients_kWh
+ 70
+ 470
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1660805212026
+ v_currentBalanceNat_eur
+ 70
+ 520
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1660805212029
+ v_totalElectricitySoldToNat_kWh
+ 70
+ 540
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1660805212031
+ v_totalElectricityBoughtFromNat_kWh
+ 70
+ 560
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1660810211679
+ v_currentNettElectricityVolume_kWh
+ 70
+ 490
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1661173036699
+ v_currentBalanceElectricityClients_eur
+ Bank account balance for electricity traded with clients.
+
+@author: Jorrit
+@since: Sprint 6
+ 70
+ 330
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1661173058952
+ v_currentBalanceHeatClients_eur
+ Bank account balance for heat traded with clients.
+
+@author: Jorrit
+@since: Sprint 6
+ 70
+ 350
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1661173096820
+ v_currentBalanceMethaneClients_eur
+ Bank account balance for methane
+@author: Jorrit
+@since: Sprint 6
+ 70
+ 370
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1661174191671
+ v_currentBalanceHydrogenClients_eur
+ Bank account balance for hydrogen traded with clients.
+
+@author: Jorrit
+@since: Sprint 6
+ 70
+ 390
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1675335068922
+ j_ActorData
+ 70
+ 680
+
+ false
+ true
+ true
+
+ J_ActorData
+
+
+
+ 1660736336144
+ p_actorID
+ Unique identifier of this actor in String format. Designated in Config-excel and used to link actors to netConnections.
+
+@since: Sprint 6
+@author: Gillis
+ true
+ -240
+ 80
+
+ false
+ true
+ true
+
+ String
+ NONE
+ false
+
+ 1660736336142
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1660736336147
+ p_actorType
+ Actor type in OL_ActorType format. Designated in Config-excel and used to determine actor-type specific functionalities later.
+
+@since: Sprint 6
+@author: Gillis
+ true
+ -240
+ 100
+
+ false
+ true
+ true
+
+ String
+ NONE
+ false
+
+ 1660736336145
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1660736336150
+ p_parentActorID
+ Unique actor identifier in String format of a designated parent actor. This may be designated in Config-excel and is used to create an agent link with a higher lying agent (e.g. a Coop or energy supplier)
+
+@since: Sprint 6
+@author: Gillis
+ true
+ 60
+ 150
+
+ false
+ true
+ true
+
+ String
+ NONE
+ false
+
+ 1660736336148
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1660736336153
+ p_parentActor
+ Pointer of the designated parent actor (e.g. a Coop or energy supplier)
+
+@since: Sprint 6
+@author: Gillis
+ true
+ 60
+ 170
+
+ false
+ true
+ true
+
+ ConnectionOwner
+ NONE
+ false
+
+ 1660736336151
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1660746260066
+ p_fixedElectricityPrice_eurpkWh
+ 300
+ 70
+
+ false
+ true
+ true
+
+ double
+ NONE
+ false
+
+ 1660746260064
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1660746283321
+ p_fixedHeatPrice_eurpkWh
+ 300
+ 90
+
+ false
+ true
+ true
+
+ double
+ NONE
+ false
+
+ 1660746283319
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1660746306858
+ p_fixedMethanePrice_eurpkWh
+ 300
+ 110
+
+ false
+ true
+ true
+
+ double
+ NONE
+ false
+
+ 1660746306856
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1660746679056
+ p_fixedHydrogenPrice_eurpkWh
+ 300
+ 130
+
+ false
+ true
+ true
+
+ double
+ NONE
+ false
+
+ 1660746679054
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1660746710965
+ p_variableElectricityPriceOverNational_eurpkWh
+ 300
+ 150
+
+ false
+ true
+ true
+
+ double
+ NONE
+ false
+
+ 1660746710963
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1667921811994
+ p_fixedFeedinTariff_eurpkWh
+ 300
+ 170
+
+ false
+ true
+ true
+
+ double
+ NONE
+ false
+
+ 1667921811992
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1671620607517
+ p_salderenActive
+ 300
+ 190
+
+ false
+ true
+ true
+
+ boolean
+ NONE
+ false
+
+ 1671620607515
+ CHECK_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+
+
+ VOID
+ double
+ 1660736336138
+ f_connectToChild
+ 790
+ 80
+
+ false
+ true
+ true
+
+ ConnectingChildNode
+ Agent
+
+ subConnections.connectTo(ConnectingChildNode);
+
+
+
+ VOID
+ double
+ 1660736336141
+ f_connectToParentActor
+ Creates an agentLink in superConnection if a parentActorID is designated in the config-excel. Called from f_configureBackBone() in main for profiling reasons, so no parameters are given.
+
+@param: none
+@return: none
+@since: Sprint 6
+@author: HOUJ
+ true
+ 780
+ -40
+
+ false
+ true
+ true
+ if ( p_parentActorID != null ) {
+ ConnectionOwner myParentActor = findFirst(main.pop_connectionOwners, p->p.p_actorID.equals(p_parentActorID)) ;
+ if( myParentActor instanceof ConnectionOwner) {
+ p_parentActor = myParentActor;
+ superConnection.connectTo(myParentActor);
+ myParentActor.f_connectToChild(this);
+ }
+}
+
+
+ RETURNS_VALUE
+ double
+ 1660743197178
+ f_doEnergyTransaction
+ 790
+ 140
+
+ false
+ true
+ true
+
+ transactionVolume_kWh
+ double
+
+
+ contractType
+ OL_ContractType
+
+ double transactionCostClient_eur = 0;
+double transactionCostNat_eur = 0;
+/*switch (contractType) {
+ case ELECTRICITY_FIXED:
+ transactionCostClient_eur = transactionVolume_kWh * p_fixedElectricityPrice_eurpkWh;
+ transactionCostNat_eur = - transactionVolume_kWh * v_currentVariableElectricityPrice_eurpkWh;
+ v_totalElectricitySoldToClients_kWh += max(0,transactionVolume_kWh);
+ v_totalElectricityBoughtFromClients_kWh -= min(0,transactionVolume_kWh);
+ v_currentNettElectricityVolume_kWh += transactionVolume_kWh;
+ v_currentBalanceElectricityClients_eur += transactionCostClient_eur;
+ break;
+ case ELECTRICITY_VARIABLE:
+ transactionCostClient_eur = transactionVolume_kWh * (p_variableElectricityPriceOverNational_eurpkWh + v_currentVariableElectricityPrice_eurpkWh);
+ transactionCostNat_eur = - transactionVolume_kWh * v_currentVariableElectricityPrice_eurpkWh;
+ v_currentBalanceElectricityClients_eur += transactionCostClient_eur;
+ break;
+ case HEAT_FIXED:
+ transactionCostClient_eur = transactionVolume_kWh * p_fixedHeatPrice_eurpkWh;
+ transactionCostNat_eur = - transactionVolume_kWh * 0;
+ v_currentBalanceHeatClients_eur += transactionCostClient_eur;
+ break;
+ case METHANE_FIXED:
+ transactionCostClient_eur = transactionVolume_kWh * p_fixedMethanePrice_eurpkWh;
+ transactionCostNat_eur = - transactionVolume_kWh * 0;
+ v_currentBalanceMethaneClients_eur += transactionCostClient_eur;
+ break;
+ case HYDROGEN_FIXED:
+ transactionCostClient_eur = transactionVolume_kWh * p_fixedHydrogenPrice_eurpkWh;
+ transactionCostNat_eur = - transactionVolume_kWh * 0;
+ v_currentBalanceHydrogenClients_eur += transactionCostClient_eur;
+ break;
+ default:
+ throw new IllegalStateException("Invalid contract type: " + contractType);
+}*/
+v_currentBalanceClients_eur += transactionCostClient_eur;
+return transactionCostClient_eur;
+
+
+ RETURNS_VALUE
+ double
+ 1660746864022
+ f_getVariableEnergyPrice
+ 790
+ 160
+
+ false
+ true
+ true
+ return v_currentVariableElectricityPrice_eurpkWh;
+
+
+ VOID
+ double
+ 1660746926252
+ f_updateEnergyPrice
+ 790
+ 180
+
+ false
+ true
+ true
+ v_currentVariableElectricityPrice_eurpkWh = energyModel.nationalEnergyMarket.f_getNationalElectricityPrice_eurpMWh()/1000;
+v_currentNettElectricityVolume_kWh = 0;
+
+
+ VOID
+ double
+ 1660806140354
+ f_updateFinances
+ 790
+ 200
+
+ false
+ true
+ true
+ v_totalElectricityBoughtFromNat_kWh += max(0,v_currentNettElectricityVolume_kWh);
+v_totalElectricitySoldToNat_kWh -= min(0,v_currentNettElectricityVolume_kWh);
+v_currentBalanceNat_eur -= v_currentNettElectricityVolume_kWh * v_currentVariableElectricityPrice_eurpkWh;
+
+
+
+
+ 1660731377979
+ connections
+ 50
+ -50
+
+ false
+ true
+ true
+ false
+ COLLECTION_OF_LINKS
+ true
+ Object
+ SOLID
+ 1
+ -16777216
+ UNDER_AGENTS
+ NONE
+ END
+
+
+ 1660736386946
+ superConnection
+ Link naar bovenliggende actor, bijv. een Coop, of energySupplier. Gebruikt om lid te worden van een Coop of aangesloten te zijn bij een energieleverancier.
+
+@since: Sprint 6
+@author: Gillis
+ 240
+ -70
+
+ false
+ true
+ true
+ false
+ COLLECTION_OF_LINKS
+ false
+ Object
+ SOLID
+ 1
+ -16777216
+ UNDER_AGENTS
+ NONE
+ END
+
+
+ 1660736386948
+ subConnections
+ Link naar onderliggende actor of netConnection. Gebruikt om actoren te linken aan netConnection objecten, of actoren aan actoren te linken (bijv. leden van de Coop)
+
+@since: Sprint 6
+@author: Gillis
+ 240
+ -40
+
+ false
+ true
+ true
+ false
+ COLLECTION_OF_LINKS
+ false
+ Object
+ SOLID
+ 1
+ -16777216
+ UNDER_AGENTS
+ NONE
+ END
+
+
+
+
+ 1660731790387
+ energyModel
+ 50
+ -100
+
+ false
+ true
+ true
+
+ zero_engine
+ EnergyModel
+
+
+
+
+
+ 1660731377983
+ level
+ 0
+ 0
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ 0
+ DIM_NON_CURRENT
+
+
+ 1667918539063
+ line4
+ 770
+ 40
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ false
+ 0
+ 10
+ 1
+ -16777216
+ null
+ SOLID
+ 1
+ 0
+ 1
+ 0
+ 140
+ 0
+ 0
+
+
+ 1667918539066
+ text4
+ 820
+ 20
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ Functions
+
+ SansSerif
+ 11
+
+
+ LEFT
+
+
+ 1667918539068
+ line5
+ 760
+ 60
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ false
+ 0
+ 10
+ 1
+ -16777216
+ null
+ DOTTED
+ 1
+ 0
+ 1
+ 0
+ 0
+ 40
+ 0
+
+
+ 1667918539070
+ text6
+ 740
+ 190
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 270.0
+ -16777216
+ Occuring
+
+ SansSerif
+ 11
+
+
+ LEFT
+
+
+ 1667918539072
+ line6
+ 760
+ 130
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ false
+ 0
+ 10
+ 1
+ -16777216
+ null
+ DOTTED
+ 1
+ 0
+ 1
+ 0
+ 0
+ 80
+ 0
+
+
+ 1667918539074
+ text5
+ 740
+ 90
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 270.0
+ -16777216
+ Init
+
+ SansSerif
+ 11
+
+
+ LEFT
+
+
+ 1667919493893
+ line
+ true
+ -270
+ 50
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ false
+ 0
+ 10
+ 1
+ -16777216
+ null
+ SOLID
+ 1
+ 0
+ 1
+ 0
+ 140
+ 0
+ 0
+
+
+ 1667919493896
+ text
+ true
+ -240
+ 30
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ ID & connections
+
+ SansSerif
+ 11
+
+
+ LEFT
+
+
+ 1667919510566
+ line1
+ 290
+ 40
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ false
+ 0
+ 10
+ 1
+ -16777216
+ null
+ SOLID
+ 1
+ 0
+ 1
+ 0
+ 240
+ 0
+ 0
+
+
+ 1667919510568
+ text1
+ 380
+ 20
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ Fixed tariffs
+
+ SansSerif
+ 11
+
+
+ LEFT
+
+
+
+
+
+
+ 1663773810345
+ GCDistrictHeating
+ /*
+@Override
+public void f_operateFlexAssets(){
+ f_operateAssetsDistrictHeating();
+}
+
+@Override
+public void f_connectToJ_EA(J_EA j_ea){
+ f_connectToJ_EA_default(j_ea);
+ f_connectToJ_EA_DistrictHeating(j_ea);
+}
+*/
+ 1752677823817
+
+ zero_engine
+ GridConnection
+
+
+
+ p_parentNodeElectricID
+
+
+ p_parentNodeHeatID
+
+
+ p_BuildingThermalAsset
+
+
+ p_ownerID
+
+
+ p_batteryAsset
+
+
+ p_electrolyserOperationMode
+
+
+ p_heatBuffer
+
+
+ p_gasBuffer
+
+
+ p_cookingTracker
+
+
+ p_energyLabel
+
+
+ p_DHWAsset
+
+
+ p_longitude
+
+
+ p_latitude
+
+
+ p_gridConnectionID
+
+
+ p_floorSurfaceArea_m2
+
+
+ p_GISPoint
+
+
+ p_owner
+
+
+ p_roofSurfaceArea_m2
+
+
+ p_purposeBAG
+
+
+ p_name
+
+
+ p_curtailmentMode
+
+
+ p_address
+
+
+ p_parentNodeHeat
+
+
+ p_parentNodeElectric
+
+
+ v_isActive
+
+
+ p_uid
+
+
+ false
+
+ 1663773810343
+ 1663773810343
+
+ T extends Agent
+
+ Generic parameter:
+
+ ENTITY
+ 100
+ false
+ 100
+ true
+
+ -4144960
+ null
+
+ true
+ true
+ false
+
+ 10
+ MPS
+
+
+ 1
+ METER
+
+
+ 1
+ METER
+
+
+ 1
+ METER
+
+
+
+ false
+
+ 1.0
+ SECOND
+
+ CONTINUOUS
+ 500
+ 500
+ 0
+ 100
+ 100
+ MOORE
+ USER_DEF
+ USER_DEF
+ 2
+ 50
+ 0.95
+ 10
+
+
+ true
+ 1658477089963
+ true
+ 1663833600000
+
+ 0
+ HOUR
+
+
+ 1
+ HOUR
+
+
+
+ 1663773810341
+ scale
+ 0
+ -150
+ false
+ false
+ false
+ SHAPE_DRAW_2D3D
+ 100
+ 0
+ BASED_ON_LENGTH
+ 10
+ METER
+ 10
+ true
+
+ 1663773810344
+ 1663773810340
+
+
+ 1664534447977
+ b_incentiveNationalPrice
+ true
+ 660
+ 260
+
+ false
+ true
+ true
+
+ boolean
+
+ false
+
+
+
+
+ 1664534582189
+ b_incentiveGridNodePrice
+ true
+ 660
+ 280
+
+ false
+ true
+ true
+
+ boolean
+
+ false
+
+
+
+
+ 1664534594839
+ b_incentiveCoopPrice
+ true
+ 660
+ 300
+
+ false
+ true
+ true
+
+ boolean
+
+ false
+
+
+
+
+ 1666196152392
+ v_bufferTemp_degC
+ 520
+ 690
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1677512160570
+ b_residualHeatLTSource
+ 520
+ 670
+
+ false
+ true
+ true
+
+ boolean
+
+
+
+ 1678448870527
+ v_chpElectricityPrice
+ true
+ 1120
+ 470
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1724252832488
+ b_validLocalBuffer
+ 520
+ 650
+
+ false
+ true
+ true
+
+ boolean
+
+ false
+
+
+
+
+ 1677500555195
+ p_residualHeatLTSource
+ 480
+ 410
+
+ false
+ true
+ true
+
+ J_EAProduction
+ NONE
+ false
+
+ null
+
+
+ 1677500555193
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1721810038977
+ p_DHheatStorage
+ 480
+ 430
+
+ false
+ true
+ true
+
+ J_EAStorageHeat
+ NONE
+ false
+
+ 1721810038975
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1688462266916
+ c_electricityPriceList
+ true
+ 1120
+ 490
+
+ false
+ true
+ true
+
+ ArrayList
+ Double
+ String
+
+
+
+
+
+ VOID
+ double
+ 1663773953770
+ f_operateAssetsDistrictHeating
+ true
+ 1120
+ 0
+
+ false
+ true
+ true
+ // District heating system, heating power based on temperature of buffer of heating system. (big or small) Heat transfer from DH_GridConnection to heat NetNode is based on temperature difference between heating-buffer and water in heating network
+//traceln("Operating District Heating agent = "+ this + " -> DH primary heating asset = " + p_primaryHeatingAsset.j_ea.ownerAsset.toString());
+//traceln("Operating District Heating agent = "+ this + " -> DH secondary heating asset = " + p_secondaryHeatingAsset.j_ea.ownerAsset.toString());
+//traceln("DistrictHeating Active!");
+if(p_primaryHeatingAsset == null){
+ return;
+}
+
+double tempSetpoint_degC = 0;
+double minBufferTemp_degC = 0;
+double maxTempBuffer_degC = 0;
+double storageTemp_degC = 0;
+//double DHnetworkTemp_degC = 0;
+//v_currentElectricityPriceConsumption_eurpkWh = ((ConnectionOwner)l_ownerActor.getConnectedAgent()).f_getElectricityPrice( v_currentPowerElectricity_kW );
+v_currentElectricityPriceConsumption_eurpkWh = p_parentNodeElectric.v_currentTotalNodalPrice_eurpkWh;
+
+//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, 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();
+ v_bufferTemp_degC = p_DHheatStorage.getCurrentTemperature();
+
+ //traceln("Thermal storage asset heatCapacity: " + p_DHheatStorage.getHeatCapacity_kW());
+ double heatingSetpoint_kW = max(0,(tempSetpoint_degC - v_bufferTemp_degC)) * p_DHheatStorage.getHeatCapacity_JpK() / (3.6e6 * energyModel.p_timeStep_h);
+ //Pair<J_FlowsMap, Double> flowsPair = p_primaryHeatingAsset.f_updateAllFlows( heatingSetpoint_kW / p_primaryHeatingAsset.getCapacityHeat_kW() );
+ p_primaryHeatingAsset.f_updateAllFlows( heatingSetpoint_kW / p_primaryHeatingAsset.getOutputCapacity_kW() );
+ double heatingPower_kW = -p_primaryHeatingAsset.getLastFlows().get(OL_EnergyCarriers.HEAT);
+
+ //traceln("Heating setpoint: %s kW, heating power: %s kW", heatingSetpoint_kW, heatingPower_kW);
+ p_DHheatStorage.v_powerFraction_fr = ( heatingPower_kW - heatTransferToNetwork_kW ) / p_DHheatStorage.getCapacityHeat_kW();
+ if ( abs(p_DHheatStorage.v_powerFraction_fr ) > 1) {
+ traceln("p_DHheatStorage.v_powerFraction_fr greater than 1! %s", p_DHheatStorage.v_powerFraction_fr );
+ }
+ p_DHheatStorage.f_updateAllFlows(p_DHheatStorage.v_powerFraction_fr);
+ //traceln("heatTransferToNetwork_kW: " + heatTransferToNetwork_kW);
+ //traceln("District heating system temperature: %s degC", p_DHheatStorage.getCurrentTemperature());
+} else {
+ //Pair<J_FlowsMap, Double> flowsPair = p_primaryHeatingAsset.f_updateAllFlows(heatTransferToNetwork_kW/p_primaryHeatingAsset.getCapacityHeat_kW()); // heatingasset must be powerful enough every single timestep!
+ p_primaryHeatingAsset.f_updateAllFlows(heatTransferToNetwork_kW/p_primaryHeatingAsset.getOutputCapacity_kW());
+ if ( 0.00001 < (heatTransferToNetwork_kW + p_primaryHeatingAsset.getLastFlows().get(OL_EnergyCarriers.HEAT)) ) {
+ traceln("Warning! District heating primary heating asset not able to fulfill heat demand! Heatdemand: %s kW, heat produced: %s kW", heatTransferToNetwork_kW, -p_primaryHeatingAsset.getLastFlows().get(OL_EnergyCarriers.HEAT) );
+ }
+ //traceln("Primary heating system powerFraction: %s", p_primaryHeatingAsset.v_powerFraction_fr);
+ //totalHeatingPower_kWth = b_primarySourceTempAboveTargetTemp? p_primaryHeatingAsset.v_powerFraction_fr * p_primaryHeatingAsset.getHeatCapacity_kW() : 0; // only model net heat flow when temperature levels allow this
+
+}
+
+//double heatTransferToNetworkCoefficient_kWpK = 10000;
+//traceln("storageTemp_degC: " + storageTemp_degC + ", DHnetworkTemp_degC: " + DHnetworkTemp_degC);
+
+//traceln("storageTemp_degC: "+storageTemp_degC+", network current temp_degC: " + DHnetworkTemp_degC + ", heatTransferToNetwork_kW: "+heatTransferToNetwork_kW);
+
+//traceln("totalHeatingPower " +totalHeatingPower_kWth);
+
+// Block (passive energy flows if too cold
+//heatTransferToNetwork_kW = b_storageBelowNetworkTemp? 0 : heatTransferToNetwork_kW;
+
+//p_primaryHeatingAsset.f_updateAllFlows( p_primaryHeatingAsset.v_powerFraction_fr );
+
+//traceln("District heating " + p_parentNodeHeatID + " storage temperature " + storageTemp_degC + " degC" + ", district heating network temperature " + p_parentNodeHeat.p_transportBuffer.getCurrentTemperature() + " deg C" );
+
+//v_currentPowerHeat_kW += p_BuildingThermalAsset.heatConsumption_kW - p_BuildingThermalAsset.heatProduction_kW;
+
+
+
+
+ VOID
+ double
+ 1666266296956
+ f_connectToChildDistrictHeating
+ true
+ 770
+ -80
+
+ false
+ true
+ true
+
+ ConnectingChildNode
+ Agent
+
+ //assetLinks.connectTo(ConnectingChildNode);
+EnergyAsset EA = (EnergyAsset) ConnectingChildNode;
+c_energyAssets.add(EA);
+
+if (EA.j_ea instanceof J_EAConsumption) {
+ c_consumptionAssets.add(EA);
+} else if (EA.j_ea instanceof J_EAProduction ) {
+ c_productionAssets.add(EA);
+ if( EA.p_energyAssetType == OL_EnergyAssetType.RESIDUALHEATLT) {
+ // handle residual heat not as a direct heat source!
+ p_residualHeatLTSource = EA;
+ }
+ else {
+ c_productionAssets.add(EA);
+
+ }
+
+} else if (EA.j_ea instanceof J_EAStorage ) {
+ c_storageAssets.add(EA);
+ if (EA.j_ea instanceof J_EAStorageHeat) {
+ p_BuildingThermalAsset = EA;
+ }
+} else if (EA.j_ea instanceof J_EAConversion) {
+ c_conversionAssets.add((J_EAConversion)EA.j_ea );
+
+ switch (p_heatingType) {
+ case HEATPUMP_GASPEAK:
+ p_primaryHeatingAsset = p_primaryHeatingAsset == null && EA.j_ea instanceof J_EAConversionHeatPump? EA : p_primaryHeatingAsset;
+ p_secondaryHeatingAsset = p_secondaryHeatingAsset == null && EA.j_ea instanceof J_EAConversionGasBurner? EA : p_secondaryHeatingAsset;
+ break;
+ case GASFIRED:
+ p_primaryHeatingAsset = p_primaryHeatingAsset == null && EA.j_ea instanceof J_EAConversionGasBurner? EA : p_primaryHeatingAsset;
+ p_secondaryHeatingAsset = p_secondaryHeatingAsset == null && EA.j_ea instanceof J_EAConversionGasBurner? EA : p_secondaryHeatingAsset;
+ break;
+ case HYDROGENFIRED:
+ p_primaryHeatingAsset = p_primaryHeatingAsset == null && EA.j_ea instanceof J_EAConversionHydrogenBurner? EA : p_primaryHeatingAsset;
+ p_secondaryHeatingAsset = p_secondaryHeatingAsset == null && EA.j_ea instanceof J_EAConversionHydrogenBurner? EA : p_secondaryHeatingAsset;
+ break;
+ case HEATPUMP_BOILERPEAK: // ambigue wat we met boiler bedoelen; eboiler of grootschalige DH_boiler = gasburner!
+ p_primaryHeatingAsset = p_primaryHeatingAsset == null && EA.j_ea instanceof J_EAConversionHeatPump? EA : p_primaryHeatingAsset;
+ p_secondaryHeatingAsset = p_secondaryHeatingAsset == null && EA.j_ea instanceof J_EAConversionGasBurner? EA : p_secondaryHeatingAsset;
+ break;
+ case GASFIRED_CHPPEAK:
+ p_primaryHeatingAsset = p_primaryHeatingAsset == null && EA.j_ea instanceof J_EAConversionGasCHP? EA : p_primaryHeatingAsset;
+ p_secondaryHeatingAsset = p_secondaryHeatingAsset == null && EA.j_ea instanceof J_EAConversionGasBurner? EA : p_secondaryHeatingAsset;
+ break;
+ case DISTRICT_EBOILER_CHP:
+ p_primaryHeatingAsset = p_primaryHeatingAsset == null && EA.j_ea instanceof J_EAConversionElectricHeater? EA : p_primaryHeatingAsset;
+ p_secondaryHeatingAsset = p_secondaryHeatingAsset == null && EA.j_ea instanceof J_EAConversionGasCHP? EA : p_secondaryHeatingAsset;
+ break;
+
+ case LT_RESIDUAL_HEATPUMP_GASPEAK:
+ p_primaryHeatingAsset = p_primaryHeatingAsset == null && EA.j_ea instanceof J_EAConversionHeatPump? EA : p_primaryHeatingAsset;
+ p_secondaryHeatingAsset = p_secondaryHeatingAsset == null && EA.j_ea instanceof J_EAConversionGasBurner? EA : p_secondaryHeatingAsset;
+ break;
+ default:
+ throw new IllegalStateException("Invalid DistrictHeating HeatingType: " + p_heatingType);
+ }
+
+
+ //if (EA.j_ea instanceof J_EAConversionGasBurner || EA.j_ea instanceof J_EAConversionHeatPump || EA.j_ea instanceof J_EAConversionHeatDeliverySet || EA.j_ea instanceof J_EAConversionElectricHeater || EA.j_ea instanceof J_EAConversionGasCHP ) {
+ // if (p_primaryHeatingAsset == null) {
+ // p_primaryHeatingAsset = EA;
+ // } else if (p_secondaryHeatingAsset == null) {
+ // p_secondaryHeatingAsset = EA;
+ // } else {
+ // traceln("District Heating gridconnection already has two heating systems!");
+ // }
+ // //traceln("heatingAsset class " + p_spaceHeatingAsset.getClass().toString());
+ if( ((J_EAConversion)EA.j_ea) instanceof J_EAConversionHeatPump && ((J_EAConversionHeatPump)EA.j_ea).getAmbientTempType().equals("WATER") ) {
+ EA.p_linkedSourceEnergyAsset = p_residualHeatLTSource;
+ ((J_EAConversionHeatPump)EA.j_ea).setSourceAssetHeatPower( EA.p_linkedSourceEnergyAsset.j_ea.capacityHeat_kW );
+ }
+//}
+} else {
+ traceln("f_connectToChild in EnergyAsset: Exception! EnergyAsset " + ConnectingChildNode.getId() + " is of unknown type or null! ");
+}
+
+
+
+/*
+// create a local list of energyAssets connected to its netConnection Agent for easy reference
+List<EnergyAsset> connectedEnergyAssets = subConnections.getConnections();
+
+int numberOfEnergyAssets = connectedEnergyAssets.size();
+for( int i = 0; i < numberOfEnergyAssets; i++ ) {
+ if( connectedEnergyAssets.get(i) instanceof EnergyAsset ) {
+ c_connectedEnergyAssets.add(connectedEnergyAssets.get(i));
+
+ }
+}
+
+List<EnergyAsset> consumptionAssets = filter(c_connectedEnergyAssets, b -> b.j_ea instanceof J_EAConsumption);
+List<EnergyAsset> productionAssets = filter(c_connectedEnergyAssets, b -> b.j_ea instanceof J_EAProduction);
+List<EnergyAsset> storageAssets = filter(c_connectedEnergyAssets, b -> b.j_ea instanceof J_EAStorage);
+List<EnergyAsset> conversionAssets = filter(c_connectedEnergyAssets, b -> b.j_ea instanceof J_EAConversion);
+traceln("NetConnection connecting to " + numberOfEnergyAssets + " EnergyAssets");
+*/
+
+
+
+ VOID
+ double
+ 1677511998575
+ f_setConfigurationBooleans
+ 520
+ 530
+
+ false
+ true
+ true
+ // one time setting of booleans marking system configuration for use in transparant logic switching
+b_residualHeatLTSource = p_residualHeatLTSource instanceof J_EAProduction? true : false;
+
+// Check if buffer is present and has physically correct parameters
+if (p_DHheatStorage instanceof J_EAStorageHeat) {
+ if(p_DHheatStorage.getCapacityHeat_kW() > 0 & p_DHheatStorage.getCapacityHeat_kW()> 0 ) {
+ b_validLocalBuffer = true;
+ }
+}
+
+/*
+// first update parameters of any heatpumps if present // [GH] This logic should only be run once, not every timestep! updateAmbientTemp should also be triggered from main.
+for(J_EA e : c_energyAssets) {
+ if(e instanceof J_EAConversionHeatPump) {
+ if ( ((J_EAConversionHeatPump)e).getAmbientTempType().equals("WATER") && b_residualHeatLTSource ) {
+ //traceln("water ambientTempType for LTresidual heat with heatpump check!");
+ ((J_EAConversionHeatPump)e).f_setLinkedVariable(energyModel, "WATER", ((J_EAConversionHeatPump)e).p_linkedSourceEnergyAsset );
+ e.updateAmbientTemperature( ((J_EAConversionHeatPump)e).p_baseTemperatureReference );
+ }
+ }
+}
+*/
+
+
+ VOID
+ double
+ 1678448031698
+ f_operateSmartHeating
+ true
+ 800
+ 480
+
+ false
+ true
+ true
+ v_chpElectricityPrice = ((ConnectionOwner)l_ownerActor.getConnectedAgent()).f_getAveragedElectricityPrice(v_currentPowerElectricity_kW, - p_secondaryHeatingAsset.capacityElectric_kW );
+v_electricityPriceLowPassed_eurpkWh += v_lowPassFactor_fr * ( v_chpElectricityPrice - v_electricityPriceLowPassed_eurpkWh );
+//v_currentPriceLevel = f_getPriceLevel( v_currentElectricityPriceConsumption_eurpkWh );
+
+c_electricityPriceList.add( v_chpElectricityPrice );
+if (c_electricityPriceList.size() > 30) {
+ c_electricityPriceList.remove(0);
+}
+
+double runningAverage = c_electricityPriceList.stream()
+ .mapToDouble(Double::doubleValue)
+ .average()
+ .orElse(0.0);
+
+double variance = c_electricityPriceList.stream()
+ .mapToDouble(value -> Math.pow(value - runningAverage, 2))
+ .average()
+ .orElse(0.0);
+
+
+double standardDeviation = Math.sqrt(variance);
+double currentDeviation = Math.abs(v_chpElectricityPrice - runningAverage) / standardDeviation;
+
+GridNode superNodeElectric = l_parentNodeElectric.getConnectedAgent().superConnection.getConnectedAgent();
+switch (p_heatingType) {
+ case GASFIRED_CHPPEAK:
+ if( v_chpElectricityPrice > (v_electricityPriceLowPassed_eurpkWh + p_pricelevelHighDifFromAvg_eurpkWh) && p_BuildingThermalAsset.getCurrentTemperature() < p_BuildingThermalAsset.getMaxTemperature_degC() ){
+ p_secondaryHeatingAsset.v_powerFraction_fr = 1;
+ }
+ if ( p_BuildingThermalAsset.getCurrentTemperature() <= p_BuildingThermalAsset.getMinTemperature_degC() ){
+ p_primaryHeatingAsset.v_powerFraction_fr = 1; //max(0, (p_primaryHeatingAsset.j_ea.capacityHeat_kW - p_secondaryHeatingAsset.j_ea.capacityHeat_kW * p_secondaryHeatingAsset.v_powerFraction_fr) / p_primaryHeatingAsset.j_ea.capacityHeat_kW );
+ }
+ break;
+ case DISTRICT_EBOILER_CHP:
+ if ( p_BuildingThermalAsset.getCurrentTemperature() <= p_BuildingThermalAsset.getMinTemperature_degC() ){
+ //als minimum temp is bereikt, allebei aan
+ traceln("beide aan");
+ p_primaryHeatingAsset.v_powerFraction_fr = 1;
+ p_secondaryHeatingAsset.v_powerFraction_fr = 1;
+ }
+ //else if ( superNodeElectric.v_currentLoadElectricity_kW < 0 && p_BuildingThermalAsset.j_ea.getCurrentTemperature() < p_BuildingThermalAsset.j_ea.getMaxTemperature_degC() ){
+ else if( v_chpElectricityPrice < ( runningAverage - 3.0 * standardDeviation ) && p_BuildingThermalAsset.getCurrentTemperature() < p_BuildingThermalAsset.getMaxTemperature_degC() - 1 ){
+ p_primaryHeatingAsset.v_powerFraction_fr = 0.5;
+ }
+ else if( v_chpElectricityPrice < ( runningAverage - 1.0 * standardDeviation ) && p_BuildingThermalAsset.getCurrentTemperature() < p_BuildingThermalAsset.getMaxTemperature_degC() - 1 ){
+ p_primaryHeatingAsset.v_powerFraction_fr = 0.25;
+ }
+ else if( v_chpElectricityPrice > ( runningAverage + 4.0 * standardDeviation ) && p_BuildingThermalAsset.getCurrentTemperature() < p_BuildingThermalAsset.getMaxTemperature_degC() - 1 ){
+ p_secondaryHeatingAsset.v_powerFraction_fr = 0.5;
+ }
+ else if( v_chpElectricityPrice > ( runningAverage + 3.0 * standardDeviation ) && p_BuildingThermalAsset.getCurrentTemperature() < p_BuildingThermalAsset.getMaxTemperature_degC() - 1 ){
+ p_secondaryHeatingAsset.v_powerFraction_fr = 0.25;
+ }
+ else if ( p_BuildingThermalAsset.getCurrentTemperature() < p_BuildingThermalAsset.getSetTemperature_degC() ) {
+ p_primaryHeatingAsset.v_powerFraction_fr = 0.5;
+ p_secondaryHeatingAsset.v_powerFraction_fr = 0.5;
+ }
+ break;
+ default:
+ traceln("ERROR DISTRICT heating wants to use smart assets but does not have correct heating assets");
+ break;
+}
+
+
+
+ VOID
+ double
+ 1693302929918
+ f_connectToJ_EA_DistrictHeating
+ true
+ 1120
+ -20
+
+ false
+ true
+ true
+
+ j_ea
+ J_EA
+
+ if (j_ea instanceof J_EAProduction ) {
+ //c_productionAssets.add(EA);
+ if( j_ea.energyAssetType == OL_EnergyAssetType.RESIDUALHEATLT) {
+ // handle residual heat not as a direct heat source!
+ p_residualHeatLTSource = (J_EAProduction)j_ea;
+ }
+} else if (j_ea instanceof J_EAConversion) {
+ switch (p_heatingType) {
+ case HEATPUMP_GASPEAK:
+ p_primaryHeatingAsset = p_primaryHeatingAsset == null && j_ea instanceof J_EAConversionHeatPump? (J_EAConversion)j_ea : p_primaryHeatingAsset;
+ p_secondaryHeatingAsset = p_secondaryHeatingAsset == null && j_ea instanceof J_EAConversionGasBurner? (J_EAConversion)j_ea : p_secondaryHeatingAsset;
+ break;
+ case GASBURNER:
+ p_primaryHeatingAsset = p_primaryHeatingAsset == null && j_ea instanceof J_EAConversionGasBurner? (J_EAConversion)j_ea : p_primaryHeatingAsset;
+ //p_secondaryHeatingAsset = p_secondaryHeatingAsset == null && j_ea instanceof J_EAConversionGasBurner? (J_EAConversion)j_ea : p_secondaryHeatingAsset;
+ break;
+ case HYDROGENBURNER:
+ p_primaryHeatingAsset = p_primaryHeatingAsset == null && j_ea instanceof J_EAConversionHydrogenBurner? (J_EAConversion)j_ea : p_primaryHeatingAsset;
+ p_secondaryHeatingAsset = p_secondaryHeatingAsset == null && j_ea instanceof J_EAConversionHydrogenBurner? (J_EAConversion)j_ea : p_secondaryHeatingAsset;
+ break;
+ case HEATPUMP_BOILERPEAK: // ambigue wat we met boiler bedoelen; eboiler of grootschalige DH_boiler = gasburner!
+ p_primaryHeatingAsset = p_primaryHeatingAsset == null && j_ea instanceof J_EAConversionHeatPump? (J_EAConversion)j_ea : p_primaryHeatingAsset;
+ p_secondaryHeatingAsset = p_secondaryHeatingAsset == null && j_ea instanceof J_EAConversionGasBurner? (J_EAConversion)j_ea : p_secondaryHeatingAsset;
+ break;
+ case GASFIRED_CHPPEAK:
+ p_primaryHeatingAsset = p_primaryHeatingAsset == null && j_ea instanceof J_EAConversionGasCHP? (J_EAConversion)j_ea : p_primaryHeatingAsset;
+ p_secondaryHeatingAsset = p_secondaryHeatingAsset == null && j_ea instanceof J_EAConversionGasBurner? (J_EAConversion)j_ea : p_secondaryHeatingAsset;
+ break;
+ case DISTRICT_EBOILER_CHP:
+ p_primaryHeatingAsset = p_primaryHeatingAsset == null && j_ea instanceof J_EAConversionElectricHeater? (J_EAConversion)j_ea : p_primaryHeatingAsset;
+ p_secondaryHeatingAsset = p_secondaryHeatingAsset == null && j_ea instanceof J_EAConversionGasCHP? (J_EAConversion)j_ea : p_secondaryHeatingAsset;
+ break;
+
+ case LT_RESIDUAL_HEATPUMP_GASPEAK:
+ p_primaryHeatingAsset = p_primaryHeatingAsset == null && j_ea instanceof J_EAConversionHeatPump? (J_EAConversion)j_ea : p_primaryHeatingAsset;
+ p_secondaryHeatingAsset = p_secondaryHeatingAsset == null && j_ea instanceof J_EAConversionGasBurner? (J_EAConversion)j_ea : p_secondaryHeatingAsset;
+ break;
+ default:
+ throw new IllegalStateException("Invalid DistrictHeating HeatingType: " + p_heatingType);
+ }
+
+
+ //if (EA.j_ea instanceof J_EAConversionGasBurner || EA.j_ea instanceof J_EAConversionHeatPump || EA.j_ea instanceof J_EAConversionHeatDeliverySet || EA.j_ea instanceof J_EAConversionElectricHeater || EA.j_ea instanceof J_EAConversionGasCHP ) {
+ // if (p_primaryHeatingAsset == null) {
+ // p_primaryHeatingAsset = EA;
+ // } else if (p_secondaryHeatingAsset == null) {
+ // p_secondaryHeatingAsset = EA;
+ // } else {
+ // traceln("District Heating gridconnection already has two heating systems!");
+ // }
+ // //traceln("heatingAsset class " + p_spaceHeatingAsset.getClass().toString());
+
+ /*
+ if( j_ea instanceof J_EAConversionHeatPump && ((J_EAConversionHeatPump)j_ea).getAmbientTempType().equals("WATER") ) {
+ ((J_EAConversionHeatPump)j_ea).p_linkedSourceEnergyAsset = p_residualHeatLTSource;
+ ((J_EAConversionHeatPump)j_ea).setSourceAssetHeatPower( ((J_EAProduction)((J_EAConversionHeatPump)j_ea).p_linkedSourceEnergyAsset).getCapacityHeat_kW() );
+ }
+ */
+
+//}
+} else if (j_ea instanceof J_EAStorageHeat ) {
+ p_DHheatStorage = (J_EAStorageHeat)j_ea;
+} else {
+ traceln("f_connectToChild in EnergyAsset: Exception! EnergyAsset " + j_ea + " is of unknown type or null! ");
+}
+
+
+
+/*
+// create a local list of energyAssets connected to its netConnection Agent for easy reference
+List<EnergyAsset> connectedEnergyAssets = subConnections.getConnections();
+
+int numberOfEnergyAssets = connectedEnergyAssets.size();
+for( int i = 0; i < numberOfEnergyAssets; i++ ) {
+ if( connectedEnergyAssets.get(i) instanceof EnergyAsset ) {
+ c_connectedEnergyAssets.add(connectedEnergyAssets.get(i));
+
+ }
+}
+
+List<EnergyAsset> consumptionAssets = filter(c_connectedEnergyAssets, b -> b.j_ea instanceof J_EAConsumption);
+List<EnergyAsset> productionAssets = filter(c_connectedEnergyAssets, b -> b.j_ea instanceof J_EAProduction);
+List<EnergyAsset> storageAssets = filter(c_connectedEnergyAssets, b -> b.j_ea instanceof J_EAStorage);
+List<EnergyAsset> conversionAssets = filter(c_connectedEnergyAssets, b -> b.j_ea instanceof J_EAConversion);
+traceln("NetConnection connecting to " + numberOfEnergyAssets + " EnergyAssets");
+*/
+
+
+
+ RETURNS_VALUE
+ boolean
+ 1702369244977
+ f_calcCheapestHeatingPrice
+ true
+ 1800
+ 90
+
+ false
+ true
+ true
+ 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( v_currentPowerElectricity_kW, p_primaryHeatingAsset.getElectricCapacity_kW() ) / HP_COP;
+ isGasCheaper = v_gasHeatingCost_eurpkWh_TEMPORARY < v_eHeatingCost_eurpkWh_TEMPORARY ? true:false;
+}
+
+return isGasCheaper;
+
+
+ VOID
+ double
+ 1702369244982
+ f_heatWithHeatpump
+ true
+ 1780
+ 50
+
+ false
+ true
+ true
+
+double powerFraction_heatPump_fr = 0;
+double powerFraction_heatModel_fr = 0;
+double avgElectricityPrice_eurpkWh = 10;
+J_EAConversionHeatPump hp = (J_EAConversionHeatPump)p_primaryHeatingAsset;
+
+if ( p_smartHeatingEnabled ) {
+ avgElectricityPrice_eurpkWh = ((ConnectionOwner)l_ownerActor.getConnectedAgent()).f_getAveragedElectricityPrice( v_currentPowerElectricity_kW, hp.getElectricCapacity_kW() );
+ //traceln("avg electircity rprice for HP: " + avgElectricityPrice_eurpkWh);
+}
+
+//heat the house
+if (v_currentIndoorTemp_degC < v_tempSetpoint_degC - p_heatingKickinTreshold_degC ) {
+ powerFraction_heatPump_fr = 1;
+ powerFraction_heatModel_fr = hp.getHeatCapacity_kW() / p_BuildingThermalAsset.getHeatCapacity_kW();
+}
+//also heat the house if the price is cheap, the the house is colder than desired + 1 and the vehicle does not need charging
+else if( p_smartHeatingEnabled && avgElectricityPrice_eurpkWh < v_electricityPriceLowPassed_eurpkWh - p_pricelevelLowDifFromAvg_eurpkWh
+ && v_currentIndoorTemp_degC < v_tempSetpoint_degC + 1) {
+ powerFraction_heatPump_fr = 1;
+ powerFraction_heatModel_fr = hp.getHeatCapacity_kW() / p_heatBuffer.getHeatCapacity_kW();
+}
+
+p_BuildingThermalAsset.v_powerFraction_fr = powerFraction_heatModel_fr;
+p_primaryHeatingAsset.v_powerFraction_fr = powerFraction_heatPump_fr;
+
+
+
+ VOID
+ double
+ 1702369244984
+ f_heatWithHybridHeatpump
+ true
+ 1780
+ 70
+
+ false
+ true
+ true
+
+// Heatpump and gasburner, switch based on heatpump COP)
+if (v_currentIndoorTemp_degC < ( v_tempSetpoint_degC - p_heatingKickinTreshold_degC) ) {
+
+ J_EAConversionHeatPump HP = (J_EAConversionHeatPump)p_primaryHeatingAsset;
+ //HP.updateAmbientTemp(main.v_currentAmbientTemperature_degC); // update heatpump temp levels! <-- waarom dit gebeurt al in de main (peter 21-02-23)
+ boolean gasCheaper = f_calcCheapestHeatingPrice();
+ traceln("isGasCheaper: "+gasCheaper);
+
+ if ( gasCheaper ) { // heat with gas
+ double powerDemand_kW = (v_tempSetpoint_degC - v_currentIndoorTemp_degC) * ((J_EAStorageHeat)p_BuildingThermalAsset).getHeatCapacity_JpK() / 3.6e6;
+ p_primaryHeatingAsset.v_powerFraction_fr = 0;
+ p_secondaryHeatingAsset.v_powerFraction_fr = min(1, powerDemand_kW / p_secondaryHeatingAsset.getHeatCapacity_kW());
+ p_BuildingThermalAsset.v_powerFraction_fr = p_secondaryHeatingAsset.v_powerFraction_fr * p_secondaryHeatingAsset.getHeatCapacity_kW() / p_BuildingThermalAsset.getHeatCapacity_kW();
+ } else { // heat with heatpump
+ p_primaryHeatingAsset.v_powerFraction_fr = 1;//min(1,powerDemand_kW / p_primaryHeatingAsset.getHeatCapacity_kW());
+ p_secondaryHeatingAsset.v_powerFraction_fr = 0;
+ p_BuildingThermalAsset.v_powerFraction_fr = HP.getHeatCapacity_kW() / p_BuildingThermalAsset.getHeatCapacity_kW();
+ }
+}
+else{
+ p_primaryHeatingAsset.v_powerFraction_fr = 0;
+ p_secondaryHeatingAsset.v_powerFraction_fr = 0;
+ p_BuildingThermalAsset.v_powerFraction_fr = 0;
+}
+
+p_secondaryHeatingAsset.f_updateAllFlows(p_secondaryHeatingAsset.v_powerFraction_fr);
+
+
+
+
+ 1663773810340
+ connections
+ 50
+ -50
+
+ false
+ true
+ true
+ false
+ COLLECTION_OF_LINKS
+ true
+ Object
+ SOLID
+ 1
+ -16777216
+ UNDER_AGENTS
+ NONE
+ END
+
+
+
+
+ 1663774444750
+ energyModel
+ true
+ 50
+ -100
+
+ false
+ true
+ true
+
+ zero_engine
+ EnergyModel
+
+
+
+
+
+ 1663773810344
+ level
+ 0
+ 0
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ 0
+ DIM_NON_CURRENT
+
+
+ 1678448899357
+ pl_SOC1
+ true
+ 1030
+ 500
+
+ false
+ true
+ false
+ SHAPE_DRAW_2D3D
+ true
+
+ 1751011893244
+ true
+ 1668499200000
+
+ 0
+ HOUR
+
+
+ 15
+ MINUTE
+
+
+ false
+ 500
+ 280
+
+
+
+ 50
+ 30
+ 420
+ 160
+ -1
+ -16777216
+ -12566464
+
+
+
+ DEFAULT
+ DEFAULT
+ -12566464
+
+ true
+ MOVEMENT_WITH_TIME
+ MODEL_TIME_UNIT
+ 0
+ 1
+ AUTO
+ true
+ LINEAR
+
+ current electricity price
+ 1678448899351
+ my_dataset
+ -32944
+ v_currentElectricityPriceConsumption_eurpkWh
+ true
+ NONE
+ 1.0
+
+
+ ElectricityPrice LowPassed
+ 1678448899352
+ my_dataset8
+ -13447886
+ v_electricityPriceLowPassed_eurpkWh
+ true
+ NONE
+ 1.0
+
+
+ CHP full power current price
+ 1658477089962
+ my_dataset9
+ -9404272
+ v_chpElectricityPrice
+ true
+ NONE
+ 1.0
+
+ 1000
+ 48
+ false
+ HH_mm
+
+
+ 1678452019907
+ pl_SOC2
+ true
+ 760
+ 840
+
+ false
+ true
+ false
+ SHAPE_DRAW_2D3D
+ false
+
+ 1751011893246
+ true
+ 1668499200000
+
+ 0
+ HOUR
+
+
+ 15
+ MINUTE
+
+
+ false
+ 500
+ 280
+
+
+
+ 50
+ 30
+ 420
+ 160
+ -1
+ -16777216
+ -12566464
+
+
+
+ DEFAULT
+ DEFAULT
+ -12566464
+
+ true
+ MOVEMENT_WITH_TIME
+ MODEL_TIME_UNIT
+ 0
+ 1
+ AUTO
+ true
+ LINEAR
+
+ Storage temp
+ 1678452019904
+ my_dataset9
+ -65536
+ v_bufferTemp_degC
+ true
+ NONE
+ 1.0
+
+ 1000
+ 48
+ false
+ HH_mm
+
+
+
+
+
+
+ 1663773857868
+ GCEnergyConversion
+ @Override
+public void f_operateFlexAssets(){
+ f_operateFlexAssets_override();
+}
+
+@Override
+public void f_resetSpecificGCStates(){
+ f_resetSpecificGCStates_override();
+}
+
+@Override
+public void f_resetSpecificGCStatesAfterRapidRun(){
+ f_resetSpecificGCStatesAfterRapidRun_override();
+}
+
+@Override
+public void f_rapidRunDataLogging() {
+ super.f_rapidRunDataLogging();
+ //f_fillAnnualDatasets_electrolyser();
+}
+ 1752677823817
+ import java.util.*;
+
+ zero_engine
+ GridConnection
+
+
+
+ p_parentNodeElectricID
+
+
+ p_gridConnectionID
+
+
+ p_parentNodeHeatID
+
+
+ p_BuildingThermalAsset
+
+
+ p_ownerID
+
+
+ p_batteryAsset
+
+
+ p_electrolyserOperationMode
+
+
+ p_heatBuffer
+
+
+ p_gasBuffer
+
+
+ p_cookingTracker
+
+
+ p_energyLabel
+
+
+ p_DHWAsset
+
+
+ p_longitude
+
+
+ p_latitude
+
+
+ p_floorSurfaceArea_m2
+
+
+ p_GISPoint
+
+
+ p_owner
+
+
+ p_roofSurfaceArea_m2
+
+
+ p_purposeBAG
+
+
+ p_name
+
+
+ p_curtailmentMode
+
+
+ p_address
+
+
+ p_parentNodeHeat
+
+
+ p_parentNodeElectric
+
+
+ v_isActive
+
+
+ p_uid
+
+
+ false
+
+ 1663773857866
+ 1663773857866
+
+ T extends Agent
+
+ Generic parameter:
+
+ ENTITY
+ 100
+ false
+ 100
+ true
+
+ -4144960
+ null
+
+ true
+ true
+ false
+
+ 10
+ MPS
+
+
+ 1
+ METER
+
+
+ 1
+ METER
+
+
+ 1
+ METER
+
+
+
+ false
+
+ 1.0
+ SECOND
+
+ CONTINUOUS
+ 500
+ 500
+ 0
+ 100
+ 100
+ MOORE
+ USER_DEF
+ USER_DEF
+ 2
+ 50
+ 0.95
+ 10
+
+
+ true
+ 1658477089961
+ true
+ 1663833600000
+
+ 0
+ HOUR
+
+
+ 1
+ HOUR
+
+
+
+ 1663773857864
+ scale
+ 0
+ -150
+ false
+ false
+ false
+ SHAPE_DRAW_2D3D
+ 100
+ 0
+ BASED_ON_LENGTH
+ 10
+ METER
+ 10
+ true
+
+ 1663773857867
+ 1663773857863
+
+
+ 1707149728754
+ v_hydrogenProductionDeficit_kWh
+ 1610
+ 350
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1708448002658
+ v_electrolyserRegime
+ Variable that contains the electrolyser regime at the current timestep.
+
+Shutdown.
+Standby.
+Idle.
+Functional.
+FullCapacity.
+ 1610
+ 440
+
+ false
+ true
+ true
+
+ OL_ElectrolyserState
+
+ OL_ElectrolyserState.SHUTDOWN
+
+
+
+
+ 1708448456203
+ v_producedOxygen_kg
+ value of the produced oxygen at the current time step.
+ 1610
+ 490
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1708949135932
+ v_totalDownTimeElectrolyser_hr
+ 1610
+ 300
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1708949154946
+ v_totalEnergyLossIdle_kWh
+ 1610
+ 320
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1709045630640
+ v_fuelcellRegime
+ 2010
+ 400
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1709045655596
+ v_totalDownTimeFC_hr
+ 2010
+ 440
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1715597878431
+ v_electricityPriceMaxForProfit_eurpkWh
+ 1610
+ 410
+
+ false
+ true
+ true
+
+ double
+
+ 0.10
+
+
+
+
+ 1715607690911
+ v_gridNodeCongestionLimit_kW
+ Congestion limit of the grid node. If this limit is reached, electrolyser should not be functional.
+ 1610
+ 250
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1720522233689
+ v_hydrogenInStorage_kWh
+ 1610
+ 470
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1707860525999
+ p_conversionEfficiency
+ 1610
+ 160
+
+ false
+ true
+ true
+
+ double
+ NONE
+ false
+
+ 1707860525997
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1707860642684
+ p_productionNominal_Nm3
+ 1610
+ 230
+
+ false
+ true
+ true
+
+ double
+ NONE
+ false
+
+ 1658477089960
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1709045216547
+ p_conversionEfficiencyFC
+ 2010
+ 160
+
+ false
+ true
+ true
+
+ double
+ NONE
+ false
+
+ 1709045216545
+
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1709045216581
+ p_productionNominalFC_Nm3
+ 2010
+ 180
+
+ false
+ true
+ true
+
+ double
+ NONE
+ false
+
+ 1709045216579
+
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1709045216603
+ p_productionMinimumFC_Nm3
+ 2010
+ 200
+
+ false
+ true
+ true
+
+ double
+ NONE
+ false
+
+ 1709045216601
+
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1709045216633
+ p_powerNominalFC_kW
+ 2010
+ 220
+
+ false
+ true
+ true
+
+ double
+ NONE
+ false
+
+ 1709045216631
+
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1709045216658
+ p_energyProductionNominalFC_kWh_Nm3
+ 2010
+ 240
+
+ false
+ true
+ true
+
+ double
+ NONE
+ false
+
+ 1709045216656
+
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1709045216687
+ p_inputPressureFC_Bar
+ 2010
+ 260
+
+ false
+ true
+ true
+
+ double
+ NONE
+ false
+
+ 1709045216685
+
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1709045216711
+ p_loadChangeTimeMinMaxFC_s
+ The time it takes for the electrolyser to shift from minimum to maximum production in seconds
+ 2010
+ 280
+
+ false
+ true
+ true
+
+ double
+ NONE
+ false
+
+ 1709045216709
+
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1709045216759
+ p_startUpTimeIdleFC_s
+ 2010
+ 320
+
+ false
+ true
+ true
+
+ double
+ NONE
+ false
+
+ 1709045216757
+
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1709045216780
+ p_startUpTimeShutdownFC_s
+ 2010
+ 300
+
+ false
+ true
+ true
+
+ double
+ NONE
+ false
+
+ 1709045216778
+
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1709045216801
+ p_electricityPriceMinForProfitFC_eurpkWh
+ 2010
+ 370
+
+ false
+ true
+ true
+
+ double
+ NONE
+ false
+
+ 0.05
+
+
+ 1709045216799
+
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1709733732105
+ p_minProductionRatio
+ ratio of the nominal power of the electrolyser for minimum production
+ 1610
+ 140
+
+ false
+ true
+ true
+
+ double
+ NONE
+ false
+
+ 1709733732103
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1717070647695
+ b_forecast_lastWeekBased
+ 1600
+ 560
+
+ false
+ true
+ true
+
+ boolean
+ NONE
+ false
+
+ true
+
+
+ 1717070647693
+ CHECK_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1716916299738
+ c_forecast_RES_kW
+ 1610
+ 180
+
+ false
+ true
+ true
+
+ ArrayList
+ Double
+ String
+
+
+
+ 1716993724806
+ c_forecast_gridNodePowerFlow_kW
+ 1610
+ 200
+
+ false
+ true
+ true
+
+ ArrayList
+ Double
+ String
+
+
+
+
+
+ VOID
+ double
+ 1707149702398
+ f_manageElektrolyserOUD
+ true
+ 1610
+ -40
+
+ false
+ true
+ true
+
+ ElektrolyserAsset
+ J_EAConversionElektrolyser
+
+ if (ElektrolyserAsset.getElectricCapacity_kW()>0) {
+
+ //double availableCapacityFromBatteries_kW = p_batteryAsset == null ? 0 : ((J_EAStorageElectric)p_batteryAsset.j_ea).getCapacityAvailable_kW();
+ double availableElectricPower_kW = v_allowedCapacity_kW - v_currentPowerElectricity_kW;
+ double excessElectricPower_kW = -(v_currentPowerElectricity_kW + v_allowedCapacity_kW); // Should at least draw this much power to stay within connection limits. Doesn't account for a battery!
+ double eta_r = ElektrolyserAsset.getEta_r();
+ double connectionCapacity_kW = v_allowedCapacity_kW; // Use only 90% of capacity for robustness against delay
+ double ProductionSetpoint_kW = ElektrolyserAsset.getElectricCapacity_kW() * 0.30 * eta_r; // Aim for average production power of xx% of elektrolyser peak power
+ double elektrolyserSetpointElectric_kW = 0;
+
+ if (p_elektrolyserOperationMode==OL_ElektrolyserOperationMode.BALANCE) {
+ double FeedbackGain_kWpkWh = 1.0/24; // Try to recover deficit in 24 hours
+ elektrolyserSetpointElectric_kW = ProductionSetpoint_kW/eta_r + v_hydrogenProductionDeficit_kWh * FeedbackGain_kWpkWh /eta_r ;
+
+ //traceln("Elektrolyser electric power setpoint: " + elektrolyserSetpointElectric_kW + " kW");
+ //traceln("Elektrolyser power fraction: " + elektrolyserSetpointElectric_kW/ElektrolyserAsset.j_ea.getElectricCapacity_kW());
+ } else if (p_elektrolyserOperationMode==OL_ElektrolyserOperationMode.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
+ //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
+ double priceGain_peur = 5; // How strongly to ramp up power with price-delta's
+ double WTP_eurpkWh = v_electricityPriceLowPassed_eurpkWh + deficitGain_eurpkWh * v_hydrogenProductionDeficit_kWh;
+ elektrolyserSetpointElectric_kW = max(0,ElektrolyserAsset.getElectricCapacity_kW()*(WTP_eurpkWh - currentElectricityPriceCharge_eurpkWh)*priceGain_peur) ;
+ //traceln("WTP hydrogen production is " + roundToDecimal(WTP_eurpkWh,3) + " eurpkWh is higher than electricity price " + roundToDecimal(currentElectricityPriceCharge_eurpkWh,3) + " eurpkWh, so produce! Setpoint power: " + round(elektrolyserSetpointElectric_kW) + " kW");
+ }
+
+ // Limit elektrolyser power to available electric power on connection (assuming it is last in merit!)
+ elektrolyserSetpointElectric_kW = min(availableElectricPower_kW,max(elektrolyserSetpointElectric_kW,excessElectricPower_kW));
+
+ double[] flowsArray = ElektrolyserAsset.f_updateAllFlows(elektrolyserSetpointElectric_kW/ElektrolyserAsset.getElectricCapacity_kW());
+
+ v_conversionPowerElectric_kW += flowsArray[4];
+ //v_hydrogenElectricityConsumption_kW += flowsArray[4];
+
+ v_hydrogenProductionDeficit_kWh += ProductionSetpoint_kW - ElektrolyserAsset.hydrogenProduction_kW; // Update hydrogen production deficit
+}
+
+
+ VOID
+ double
+ 1707149769851
+ f_operateFlexAssets_overwriteOUD
+ true
+ 1610
+ -20
+
+ false
+ true
+ true
+ for( J_EA v : c_conversionAssets ){
+ if (v instanceof J_EAConversionElektrolyser) {
+ f_manageElektrolyser((J_EAConversionElektrolyser)v);
+ }
+ if (v instanceof J_EAConversionCurtailer) {
+ // Must go last!
+ } /*else {
+ v_currentPowerElectricity_kW += v.electricityConsumption_kW - v.electricityProduction_kW;
+ v_conversionPowerElectric_kW += v.electricityConsumption_kW - v.electricityProduction_kW;
+ v_currentPowerMethane_kW += v.methaneConsumption_kW - v.methaneProduction_kW;
+ v_currentPowerHydrogen_kW += v.hydrogenConsumption_kW - v.hydrogenProduction_kW;
+ v_currentPowerHeat_kW += v.heatConsumption_kW - v.heatProduction_kW;
+ v_currentPowerDiesel_kW += v.dieselConsumption_kW;
+ } */
+}
+
+// Determine EV charging
+f_manageCharging();
+//v_currentPowerElectricity_kW += v_evChargingPowerElectric_kW;
+
+// Operate battery
+if (p_batteryAsset != null){
+ v_batterySOC_fr = p_batteryAsset.getCurrentStateOfCharge();
+ if( p_batteryOperationMode == OL_BatteryOperationMode.BALANCE) {
+ f_batteryManagementBalanceCoop( v_batterySOC_fr );
+ }
+ else {
+ f_batteryManagementPrice( v_batterySOC_fr );
+ }
+ p_batteryAsset.f_updateAllFlows(p_batteryAsset.v_powerFraction_fr);
+ //v_batteryPowerElectric_kW = p_batteryAsset.electricityConsumption_kW - p_batteryAsset.electricityProduction_kW;
+ //v_currentPowerElectricity_kW += v_batteryPowerElectric_kW;
+}
+
+// Operate curtailer. Must be the last asset to run!!
+
+if (p_curtailer != null){
+ f_manageCurtailer(p_curtailer);
+ //v_currentPowerElectricity_kW += p_curtailer.electricityConsumption_kW;
+}
+
+
+ VOID
+ double
+ 1707149801187
+ f_batteryManagementBalanceCoop
+ Regeling voor balancering van Coop-load.
+
+@author: Gillis Hommen
+@since: 28-12-2022
+ 1230
+ 180
+
+ false
+ true
+ true
+ if ((p_batteryAsset).getStorageCapacity_kWh() != 0){
+ 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 = 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*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;
+ if (energyModel.v_liveAssetsMetaData.totalInstalledWindPower_kW > 10000) {
+ SOC_setp_fr = 0.95 - 0.95 * energyModel.pf_windProduction_fr.getForecast() - 0.9*energyModel.pf_PVProduction35DegSouth_fr.getForecast();
+ //traceln("Forecast-based SOC setpoint: " + SOC_setp_fr + " %");
+ } else {
+ SOC_setp_fr = (0.5 + 0.35 * Math.sin(2*Math.PI*(energyModel.t_h-10)/24))*(1-0.8*energyModel.pf_windProduction_fr.getForecast()); // Sinusoidal setpoint: aim for low SOC at 6:00h, high SOC at 18:00h.
+ }
+ double FeedbackGain_kWpSOC = 1.5 * p_batteryAsset.getCapacityElectric_kW(); // How strongly to aim for SOC setpoint
+ double FeedforwardGain_kWpKw = 0.1; // Feedforward based on current surpluss in Coop
+ double chargeOffset_kW = 0; // Charging 'bias', basically increases SOC setpoint slightly during the whole day.
+ double chargeSetpoint_kW = 0;
+ chargeSetpoint_kW = FeedforwardGain_kWpKw * (currentCoopElectricitySurplus_kW - chargeOffset_kW) + (SOC_setp_fr - p_batteryAsset.getCurrentStateOfCharge_fr()) * FeedbackGain_kWpSOC;
+ chargeSetpoint_kW = min(max(chargeSetpoint_kW, availableDischargePower_kW),availableChargePower_kW); // Don't allow too much (dis)charging!
+ p_batteryAsset.v_powerFraction_fr = max(-1,min(1, chargeSetpoint_kW / p_batteryAsset.getCapacityElectric_kW())); // Convert to powerFraction and limit power
+ //traceln("Coop surpluss " + currentCoopElectricitySurplus_kW + "kW, Battery charging power " + p_batteryAsset.v_powerFraction_fr*p_batteryAsset.j_ea.getElectricCapacity_kW() + " kW at " + currentBatteryStateOfCharge*100 + " % SOC");
+ }
+ }
+}
+
+
+ VOID
+ double
+ 1707149873038
+ f_manageCurtailer
+ true
+ 1350
+ 120
+
+ false
+ true
+ true
+
+ CurtailerAsset
+ J_EAConversionCurtailer
+
+ //traceln("Hello! " + CurtailerAsset.j_ea.getElectricCapacity_kW());
+if (CurtailerAsset.getElectricCapacity_kW()>0) {
+ double curtailerSetpointElectric_kW = -min(0,v_currentPowerElectricity_kW + p_connectionCapacity_kW);
+ CurtailerAsset.f_updateAllFlows(curtailerSetpointElectric_kW/CurtailerAsset.getElectricCapacity_kW());
+
+ /*if ( curtailerSetpointElectric_kW > 0 ) {
+ traceln("Windfarm is curtailing " + curtailerSetpointElectric_kW + " kW!");
+ }*/
+}
+
+
+ VOID
+ double
+ 1708089250229
+ f_manageElectrolyser
+ 1610
+ 60
+
+ false
+ true
+ true
+
+ ElectrolyserAsset
+ J_EAConversionElectrolyser
+
+
+if (ElectrolyserAsset.getInputCapacity_kW()>0) {
+ //double availableCapacityFromBatteries_kW = p_batteryAsset == null ? 0 : ((J_EAStorageElectric)p_batteryAsset.j_ea).getCapacityAvailable_kW();
+
+ double v_allowedDeliveryCapacity_kW = v_liveConnectionMetaData.contractedDeliveryCapacity_kW;
+ double v_allowedFeedinCapacity_kW = v_liveConnectionMetaData.contractedFeedinCapacity_kW;
+ double availableElectricPower_kW = max(0, v_allowedDeliveryCapacity_kW - fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.ELECTRICITY));
+ double excessElectricPower_kW = max(0, - fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.ELECTRICITY) - v_allowedFeedinCapacity_kW);
+
+ double eta_r = ElectrolyserAsset.getEta_r();
+ //double connectionCapacity_kW = v_allowedCapacity_kW; // Use only 90% of capacity for robustness against delay
+ double ProductionSetpoint_kW = ElectrolyserAsset.getInputCapacity_kW() * 0.30 * eta_r; // Aim for average production power of xx% of elektrolyser peak power
+ double electrolyserSetpointElectric_kW = 0;
+
+
+ //Electrolyser output based on current and future regime
+ electrolyserSetpointElectric_kW = f_electrolyserRegime(electrolyserSetpointElectric_kW, excessElectricPower_kW, ElectrolyserAsset);
+
+ data_liveWeekElectrolyserPower_kW.add(energyModel.t_h, electrolyserSetpointElectric_kW);
+
+ /*
+ if (p_elektrolyserOperationMode==OL_ElektrolyserOperationMode.BALANCE) {
+ double FeedbackGain_kWpkWh = 1.0/24; // Try to recover deficit in 24 hours
+ elektrolyserSetpointElectric_kW = ProductionSetpoint_kW/eta_r + v_hydrogenProductionDeficit_kWh * FeedbackGain_kWpkWh /eta_r ;
+
+ //traceln("Elektrolyser electric power setpoint: " + elektrolyserSetpointElectric_kW + " kW");
+ //traceln("Elektrolyser power fraction: " + elektrolyserSetpointElectric_kW/ElektrolyserAsset.j_ea.getElectricCapacity_kW());
+ } else if (p_elektrolyserOperationMode==OL_ElektrolyserOperationMode.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
+ //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
+ double priceGain_peur = 5; // How strongly to ramp up power with price-delta's
+ double WTP_eurpkWh = v_electricityPriceLowPassed_eurpkWh + deficitGain_eurpkWh * v_hydrogenProductionDeficit_kWh;
+ elektrolyserSetpointElectric_kW = max(0,ElektrolyserAsset.getElectricCapacity_kW()*(WTP_eurpkWh - currentElectricityPriceCharge_eurpkWh)*priceGain_peur) ;
+ elektrolyserSetpointElectric_kW = random()*ElektrolyserAsset.getElectricCapacity_kW();
+ //traceln("WTP hydrogen production is " + roundToDecimal(WTP_eurpkWh,3) + " eurpkWh is higher than electricity price " + roundToDecimal(currentElectricityPriceCharge_eurpkWh,3) + " eurpkWh, so produce! Setpoint power: " + round(elektrolyserSetpointElectric_kW) + " kW");
+ }
+ */
+
+ // Limit elektrolyser power to available electric power on connection (assuming it is last in merit!)
+ electrolyserSetpointElectric_kW = min(availableElectricPower_kW,max(electrolyserSetpointElectric_kW, excessElectricPower_kW));
+
+
+
+ //Output
+ //double[] flowsArray = ElectrolyserAsset.f_updateAllFlows(electrolyserSetpointElectric_kW/ElectrolyserAsset.getElectricCapacity_kW());
+ //Pair<J_FlowsMap, Double> flowsPair = ElectrolyserAsset.f_updateAllFlows(electrolyserSetpointElectric_kW/ElectrolyserAsset.getCapacityElectric_kW());
+ ElectrolyserAsset.f_updateAllFlows(electrolyserSetpointElectric_kW/ElectrolyserAsset.getInputCapacity_kW());
+
+ //v_conversionPowerElectric_kW += ElectrolyserAsset.getLastFlows().get(OL_EnergyCarriers.ELECTRICITY);
+ //v_hydrogenElectricityConsumption_kW += ElectrolyserAsset.getLastFlows().get(OL_EnergyCarriers.ELECTRICITY);
+
+ v_hydrogenProductionDeficit_kWh += ProductionSetpoint_kW - max(0,-ElectrolyserAsset.getLastFlows().get(OL_EnergyCarriers.HYDROGEN)); // Update hydrogen production deficit
+
+
+ // This variable is reset after a rapidrun, but not saved before running the headless simulation.
+ v_hydrogenInStorage_kWh -= ElectrolyserAsset.getLastFlows().get(OL_EnergyCarriers.HYDROGEN) * energyModel.p_timeStep_h;
+
+ /*if (b_useHydrogenLocally) {
+ List<GridConnection> receivingGCs = findAll(energyModel.c_gridConnections, gc -> gc.b_useHydrogenLocally && gc != this);
+ //traceln("hydrogen reveicing gcs: %s", receivingGCs);
+ for (GridConnection gc : receivingGCs) {
+
+ gc.v_hydrogenInStorage_kWh += energyModel.p_timeStep_h * flowsArray[2] / receivingGCs.size();
+ }
+ }*/
+
+}
+
+
+ VOID
+ double
+ 1708089644411
+ f_operateFlexAssets_override
+ 910
+ 220
+
+ false
+ true
+ true
+ for( J_EA v : c_conversionAssets ){
+ if (v instanceof J_EAConversionElectrolyser) {
+ f_manageElectrolyser((J_EAConversionElectrolyser)v);
+ }
+}
+
+// Determine EV charging
+f_manageEVCharging();
+
+// Operate battery
+f_manageBattery();
+
+
+
+ RETURNS_VALUE
+ double
+ 1708447959640
+ f_electrolyserRegime
+ 1620
+ 80
+
+ false
+ true
+ true
+
+ elektrolyserSetpointElectric_kW
+ double
+
+
+ excessElectricPower_kW
+ double
+
+
+ ElectrolyserAsset
+ J_EAConversionElectrolyser
+
+ double solar_forecast_kW;
+double wind_forecast_kW;
+
+double forecast_time_h = ElectrolyserAsset.getStartUpTimeStandby_h()+ 2*energyModel.p_timeStep_h;
+
+//Get current limitation values
+//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.p_parentNodeElectric.v_currentLoad_kW - previousElectrolyserConsumption_kW;
+data_liveWeekGridNoderPowerFlow_kW.add(energyModel.t_h, this.p_parentNodeElectric.v_currentLoad_kW);
+
+
+switch (p_electrolyserOperationMode){
+
+ case PRICE:
+ f_electrolyserRegimeControl_Price(excessElectricPower_kW, ElectrolyserAsset);
+ break;
+ case BALANCE:
+ f_electrolyserRegimeControl_Balance(currentGridNodePowerFlow_kW, forecast_time_h, ElectrolyserAsset);
+ break;
+ case ALWAYS_IDLE:
+ f_electrolyserRegimeControl_AlwaysIdle(currentGridNodePowerFlow_kW, ElectrolyserAsset);
+ break;
+}
+
+switch (ElectrolyserAsset.getState()){
+
+ case SHUTDOWN:
+ elektrolyserSetpointElectric_kW = 0;
+
+ if(energyModel.v_isRapidRun){
+ v_totalDownTimeElectrolyser_hr = v_totalDownTimeElectrolyser_hr + energyModel.p_timeStep_h;
+ }
+ break;
+
+ case STANDBY:
+ elektrolyserSetpointElectric_kW = 0;
+
+ if(energyModel.v_isRapidRun){
+ v_totalDownTimeElectrolyser_hr = v_totalDownTimeElectrolyser_hr + energyModel.p_timeStep_h;
+ }
+ break;
+
+ case IDLE:
+ elektrolyserSetpointElectric_kW = 0.025*ElectrolyserAsset.getInputCapacity_kW(); // 1 - 5 percent of nominal load to keep it warm!
+
+ if(energyModel.v_isRapidRun){
+ v_totalDownTimeElectrolyser_hr = v_totalDownTimeElectrolyser_hr + energyModel.p_timeStep_h;
+ v_totalEnergyLossIdle_kWh = v_totalEnergyLossIdle_kWh + elektrolyserSetpointElectric_kW*energyModel.p_timeStep_h;
+ }
+ break;
+
+ case FUNCTIONAL:
+ switch (p_electrolyserOperationMode){
+
+ case PRICE:
+ elektrolyserSetpointElectric_kW = ElectrolyserAsset.getInputCapacity_kW()*p_minProductionRatio;
+ break;
+
+ case BALANCE:
+ elektrolyserSetpointElectric_kW = ElectrolyserAsset.getInputCapacity_kW()*p_minProductionRatio;
+ break;
+ case ALWAYS_IDLE:
+ elektrolyserSetpointElectric_kW = ElectrolyserAsset.getInputCapacity_kW()*p_minProductionRatio;
+ break;
+ }
+ break;
+
+ case FULLCAPACITY:
+ switch (p_electrolyserOperationMode){
+
+ case PRICE:
+ elektrolyserSetpointElectric_kW = ElectrolyserAsset.getInputCapacity_kW();
+ break;
+
+ case BALANCE:
+ elektrolyserSetpointElectric_kW = min(ElectrolyserAsset.getInputCapacity_kW(), abs(v_gridNodeCongestionLimit_kW - currentGridNodePowerFlow_kW));
+ break;
+ case ALWAYS_IDLE:
+ elektrolyserSetpointElectric_kW = min(ElectrolyserAsset.getInputCapacity_kW(), abs(v_gridNodeCongestionLimit_kW - currentGridNodePowerFlow_kW));
+ break;
+ }
+ break;
+}
+
+
+return elektrolyserSetpointElectric_kW;
+
+
+ VOID
+ double
+ 1708448673879
+ f_electrolyserRegimeControl_Price
+ Function that defines the regime of the hydrogen plant of the next timestep.
+ 1630
+ 100
+
+ false
+ true
+ true
+
+ excessElectricPower_kW
+ double
+
+
+ ElectrolyserAsset
+ J_EAConversionElectrolyser
+
+ ConnectionOwner ownerActor = p_owner;
+//double currentElectricityPriceCharge_eurpkWh = ownerActor.f_getElectricityPrice(-excessElectricPower_kW); // query price at 1kW
+double currentElectricityPriceEPEX_eurpkWh = energyModel.pf_dayAheadElectricityPricing_eurpMWh.getForecast();
+
+switch (ElectrolyserAsset.getState()){
+
+ case SHUTDOWN:
+ if (currentElectricityPriceEPEX_eurpkWh < v_electricityPriceMaxForProfit_eurpkWh){
+ ElectrolyserAsset.setElectrolyserState(OL_ElectrolyserState.IDLE);
+ }
+ else{
+ ElectrolyserAsset.setElectrolyserState(OL_ElectrolyserState.SHUTDOWN);
+ }
+ break;
+
+ case STANDBY:
+ if (currentElectricityPriceEPEX_eurpkWh < v_electricityPriceMaxForProfit_eurpkWh){
+ ElectrolyserAsset.setElectrolyserState(OL_ElectrolyserState.IDLE);
+ }
+ else{
+ ElectrolyserAsset.setElectrolyserState( OL_ElectrolyserState.STANDBY);
+ }
+ break;
+
+ case IDLE:
+ if (currentElectricityPriceEPEX_eurpkWh < v_electricityPriceMaxForProfit_eurpkWh){
+ ElectrolyserAsset.setElectrolyserState(OL_ElectrolyserState.FUNCTIONAL);
+ }
+ else{
+ ElectrolyserAsset.setElectrolyserState(OL_ElectrolyserState.IDLE);
+ }
+ break;
+
+ case FUNCTIONAL:
+ if (currentElectricityPriceEPEX_eurpkWh < v_electricityPriceMaxForProfit_eurpkWh){
+ ElectrolyserAsset.setElectrolyserState(OL_ElectrolyserState.FULLCAPACITY);
+ }
+ else{
+ ElectrolyserAsset.setElectrolyserState(OL_ElectrolyserState.IDLE);
+ }
+ break;
+
+ case FULLCAPACITY:
+ if (currentElectricityPriceEPEX_eurpkWh < v_electricityPriceMaxForProfit_eurpkWh){
+ ElectrolyserAsset.setElectrolyserState(OL_ElectrolyserState.FULLCAPACITY);
+ }
+ else{
+ ElectrolyserAsset.setElectrolyserState(OL_ElectrolyserState.FUNCTIONAL);
+ }
+ break;
+}
+
+
+
+
+
+ VOID
+ double
+ 1709045117969
+ f_manageFuelCell
+ 2020
+ 70
+
+ false
+ true
+ true
+
+//if (FuelCellAsset.getElectricCapacity_kW()>0) {
+
+
+//}
+
+
+
+
+
+
+
+ VOID
+ double
+ 1715611921617
+ f_electrolyserRegimeControl_Balance
+ 1630
+ 120
+
+ false
+ true
+ true
+
+ currentGridNodePowerFlow_kW
+ double
+
+
+ forecast_time_h
+ double
+
+
+ ElectrolyserAsset
+ J_EAConversionElectrolyser
+
+ double solar_forecast_kW;
+double wind_forecast_kW;
+
+//Initialize limitation values
+if (c_forecast_RES_kW.size() == 0){
+
+ for(int i = energyModel.v_timeStepsElapsed; i < energyModel.v_timeStepsElapsed + roundToInt(forecast_time_h/energyModel.p_timeStep_h); i++){
+ solar_forecast_kW = - energyModel.pp_PVProduction35DegSouth_fr.getValue(energyModel.t_h + i*energyModel.p_timeStep_h) * energyModel.v_liveAssetsMetaData.totalInstalledPVPower_kW;
+ wind_forecast_kW = - energyModel.pp_windProduction_fr.getValue(energyModel.t_h + i*energyModel.p_timeStep_h) * energyModel.v_liveAssetsMetaData.totalInstalledWindPower_kW;
+
+ c_forecast_RES_kW.add(solar_forecast_kW + wind_forecast_kW);
+
+ c_forecast_gridNodePowerFlow_kW.add(currentGridNodePowerFlow_kW - c_forecast_RES_kW.get(0) + solar_forecast_kW + wind_forecast_kW);
+
+ }
+}
+
+//Get future limitation values
+else if(energyModel.v_timeStepsElapsed < (8760-forecast_time_h)/energyModel.p_timeStep_h){
+
+ //Get current RES production
+ double currentRESProduction_kW = c_forecast_RES_kW.get(0);
+
+ //Update forecast array RES
+ c_forecast_RES_kW.remove(0);
+
+ solar_forecast_kW = - energyModel.pp_PVProduction35DegSouth_fr.getValue(energyModel.t_h + forecast_time_h) * energyModel.v_liveAssetsMetaData.totalInstalledPVPower_kW;
+ wind_forecast_kW = - energyModel.pp_windProduction_fr.getValue(energyModel.t_h + forecast_time_h) * energyModel.v_liveAssetsMetaData.totalInstalledWindPower_kW;
+
+ c_forecast_RES_kW.add(solar_forecast_kW + wind_forecast_kW);
+
+ //Update forecast array Grid node power flow
+ c_forecast_gridNodePowerFlow_kW.remove(0);
+
+ //Get past grid node power flow and weather (last week) if last week forecast prediction is selected.
+ if (b_forecast_lastWeekBased && data_liveWeekElectrolyserPower_kW.size() > 672 - roundToInt(forecast_time_h/energyModel.p_timeStep_h)){ // Use last week to create the forecast
+
+ double lastWeekGridNodePowerFlow_kW = data_liveWeekGridNoderPowerFlow_kW.getY(roundToInt(forecast_time_h/energyModel.p_timeStep_h)) - data_liveWeekElectrolyserPower_kW.getY(roundToInt(forecast_time_h/energyModel.p_timeStep_h));
+ double solar_lastWeek_kW = - energyModel.pp_PVProduction35DegSouth_fr.getValue(energyModel.t_h + forecast_time_h - 168) * energyModel.v_liveAssetsMetaData.totalInstalledPVPower_kW;
+ double wind_lastWeek_kW = - energyModel.pp_windProduction_fr.getValue(energyModel.t_h + forecast_time_h - 168) * energyModel.v_liveAssetsMetaData.totalInstalledWindPower_kW;
+
+ c_forecast_gridNodePowerFlow_kW.add(lastWeekGridNodePowerFlow_kW - solar_lastWeek_kW - wind_lastWeek_kW + solar_forecast_kW + wind_forecast_kW);
+ }
+ else{//use current power flow to predict forecast
+ c_forecast_gridNodePowerFlow_kW.add(currentGridNodePowerFlow_kW - currentRESProduction_kW + c_forecast_RES_kW.get(roundToInt(forecast_time_h/energyModel.p_timeStep_h)-1));
+ }
+}
+
+
+//Set state based on current state and forecast.
+switch (ElectrolyserAsset.getState()){
+
+ case SHUTDOWN: //Not ready to be powerd up and complete shut down (when broken, maintenance, etc.)
+
+ break;
+
+ case STANDBY: // Ready to be powered on, but no electricity consumption.
+ //Check if electrolyser will be able to be functional at least two time steps when powering up, if so: power_up = true.
+ if (c_forecast_gridNodePowerFlow_kW.get(roundToInt(forecast_time_h/energyModel.p_timeStep_h)-2) < v_gridNodeCongestionLimit_kW && c_forecast_gridNodePowerFlow_kW.get(roundToInt(forecast_time_h/energyModel.p_timeStep_h)-1) < v_gridNodeCongestionLimit_kW){
+ ElectrolyserAsset.setElectrolyserState(OL_ElectrolyserState.POWER_UP);
+ ElectrolyserAsset.setRemainingPowerUpDuration_timesteps(roundToInt(ElectrolyserAsset.getStartUpTimeStandby_h()/energyModel.p_timeStep_h));
+ }
+ break;
+
+ case POWER_UP:
+ if(ElectrolyserAsset.getRemainingPowerUpDuration_timesteps() == 0){
+ ElectrolyserAsset.setElectrolyserState(OL_ElectrolyserState.IDLE);
+ }
+ break;
+
+ case IDLE: // Ready to start producting hydrogen, heated up, so consuming electricity, but not producing hydrogen yet.
+ if ( currentGridNodePowerFlow_kW < v_gridNodeCongestionLimit_kW ){
+ ElectrolyserAsset.setElectrolyserState(OL_ElectrolyserState.FUNCTIONAL);
+ }
+ else{
+ boolean power_down = true;
+ for(int i = 0; i < c_forecast_gridNodePowerFlow_kW.size() - 2; i++){
+ if (c_forecast_gridNodePowerFlow_kW.get(i) < v_gridNodeCongestionLimit_kW){
+ power_down = false;
+ }
+ }
+
+ //Set mode based on power down or not.
+ if (power_down){
+ ElectrolyserAsset.setElectrolyserState(OL_ElectrolyserState.STANDBY);
+ }
+ }
+ break;
+
+ case FUNCTIONAL: // Producing hydrogen at minimum possible amount (to make sure system is working correctly, no leaks).
+ if ( currentGridNodePowerFlow_kW < v_gridNodeCongestionLimit_kW ){
+ ElectrolyserAsset.setElectrolyserState(OL_ElectrolyserState.FULLCAPACITY);
+ }
+ else{
+ ElectrolyserAsset.setElectrolyserState(OL_ElectrolyserState.IDLE);
+ }
+ break;
+
+ case FULLCAPACITY: // Producing hydrogen as much as possible.
+ if ( currentGridNodePowerFlow_kW < v_gridNodeCongestionLimit_kW ){
+ ElectrolyserAsset.setElectrolyserState(OL_ElectrolyserState.FULLCAPACITY);
+ }
+ else{
+ ElectrolyserAsset.setElectrolyserState(OL_ElectrolyserState.IDLE);
+ }
+ break;
+}
+
+
+
+ VOID
+ double
+ 1717066943639
+ f_resetSpecificGCStates_override
+ 1230
+ 570
+
+ false
+ true
+ true
+ //Reset variables
+v_totalDownTimeElectrolyser_hr = 0;
+v_totalEnergyLossIdle_kWh = 0;
+v_producedOxygen_kg = 0;
+v_hydrogenInStorage_kWh = 0;
+
+
+
+
+ VOID
+ double
+ 1717068271650
+ f_resetSpecificGCStatesAfterRapidRun_override
+ 1250
+ 590
+
+ false
+ true
+ true
+ //Rest forecast collections
+c_forecast_RES_kW.clear();
+c_forecast_gridNodePowerFlow_kW.clear();
+
+
+//Reset dataset
+data_liveWeekElectrolyserPower_kW.reset();
+data_liveWeekGridNoderPowerFlow_kW.reset();
+
+//Reset variables
+v_hydrogenProductionDeficit_kWh = 0;
+v_hydrogenInStorage_kWh = 0;
+
+
+ VOID
+ double
+ 1717139694847
+ f_electrolyserRegimeControl_AlwaysIdle
+ 1610
+ -110
+
+ false
+ true
+ true
+
+ currentGridNodePowerFlow_kW
+ double
+
+
+ ElectrolyserAsset
+ J_EAConversionElectrolyser
+
+ switch (ElectrolyserAsset.getState()){
+
+ case SHUTDOWN: //Not ready to be powerd up and complete shut down (when broken, maintenance, etc.)
+ break;
+
+ case STANDBY: // Ready to be powered on, but no electricity consumption.
+ ElectrolyserAsset.setElectrolyserState(OL_ElectrolyserState.POWER_UP);
+ break;
+
+ case POWER_UP:
+ ElectrolyserAsset.setElectrolyserState(OL_ElectrolyserState.IDLE);
+ break;
+
+ case IDLE: // Ready to start producting hydrogen, heated up, so consuming electricity, but not producing hydrogen yet.
+ if ( currentGridNodePowerFlow_kW < v_gridNodeCongestionLimit_kW ){
+ ElectrolyserAsset.setElectrolyserState(OL_ElectrolyserState.FUNCTIONAL);
+ }
+ break;
+
+ case FUNCTIONAL: // Producing hydrogen at minimum possible amount (to make sure system is working correctly, no leaks).
+ if ( currentGridNodePowerFlow_kW < v_gridNodeCongestionLimit_kW ){
+ ElectrolyserAsset.setElectrolyserState(OL_ElectrolyserState.FULLCAPACITY);
+ }
+ else{
+ ElectrolyserAsset.setElectrolyserState(OL_ElectrolyserState.IDLE);
+ }
+ break;
+
+ case FULLCAPACITY: // Producing hydrogen as much as possible.
+ if ( currentGridNodePowerFlow_kW < v_gridNodeCongestionLimit_kW ){
+ ElectrolyserAsset.setElectrolyserState(OL_ElectrolyserState.FULLCAPACITY);
+ }
+ else{
+ ElectrolyserAsset.setElectrolyserState(OL_ElectrolyserState.IDLE);
+ }
+ break;
+}
+
+
+
+
+
+ 1717063231444
+ data_liveWeekElectrolyserPower_kW
+ 1610
+ 390
+
+ false
+ true
+ true
+ false
+
+ 1751011893317
+ true
+ 1717142400000
+
+ 0
+ HOUR
+
+
+ 1
+ HOUR
+
+
+ false
+ 672
+
+
+ 1717069403489
+ data_liveWeekGridNoderPowerFlow_kW
+ 1600
+ 540
+
+ false
+ true
+ true
+ false
+
+ 1751011893319
+ true
+ 1717142400000
+
+ 0
+ HOUR
+
+
+ 1
+ HOUR
+
+
+ false
+ 672
+
+
+
+
+ 1663773857863
+ connections
+ 50
+ -50
+
+ false
+ true
+ true
+ false
+ COLLECTION_OF_LINKS
+ true
+ Object
+ SOLID
+ 1
+ -16777216
+ UNDER_AGENTS
+ NONE
+ END
+
+
+
+
+ 1663774487514
+ energyModel
+ true
+ 50
+ -100
+
+ false
+ true
+ true
+
+ zero_engine
+ EnergyModel
+
+
+
+
+
+ 1663773857867
+ level
+ 0
+ 0
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ 0
+ DIM_NON_CURRENT
+
+
+ 1707149618071
+ rectangle4
+ 1580
+ 20
+
+ false
+ true
+ false
+ true
+ SHAPE_DRAW_2D3D
+ false
+ 0
+ 10
+ 3
+ -14774017
+ null
+ SOLID
+ 350
+ 490
+ 0.0
+ -1
+ null
+
+
+ 1709045045153
+ rectangle5
+ 1980
+ 20
+
+ true
+ true
+ false
+ true
+ SHAPE_DRAW_2D3D
+ false
+ 0
+ 10
+ 3
+ -65281
+ null
+ SOLID
+ 280
+ 490
+ 0.0
+ -1
+ null
+
+
+ 1709045095108
+ text11
+ 2000
+ 30
+
+ false
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ H2 FuelCell functionality
+
+ SansSerif
+ 14
+
+
+ LEFT
+
+
+ 1712934875018
+ textH2elec1
+ 1600
+ 30
+
+ false
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ H2 electrolyser functionality
+
+ SansSerif
+ 14
+
+
+ LEFT
+
+
+
+
+
+
+ 1663773842879
+ GCEnergyProduction
+ @Override
+public void f_operateFlexAssets(){
+ f_operateFlexAssets_overwrite();
+}
+ 1752677823817
+
+ zero_engine
+ GridConnection
+
+
+
+ p_parentNodeElectricID
+
+
+ p_parentNodeHeatID
+
+
+ p_BuildingThermalAsset
+
+
+ p_ownerID
+
+
+ p_batteryAsset
+
+
+ p_electrolyserOperationMode
+
+
+ p_heatBuffer
+
+
+ p_gasBuffer
+
+
+ p_cookingTracker
+
+
+ p_energyLabel
+
+
+ p_DHWAsset
+
+
+ p_longitude
+
+
+ p_latitude
+
+
+ p_gridConnectionID
+
+
+ p_floorSurfaceArea_m2
+
+
+ p_GISPoint
+
+
+ p_owner
+
+
+ p_roofSurfaceArea_m2
+
+
+ p_purposeBAG
+
+
+ p_name
+
+
+ p_curtailmentMode
+
+
+ p_address
+
+
+ p_parentNodeHeat
+
+
+ p_parentNodeElectric
+
+
+ v_isActive
+
+
+ p_uid
+
+
+ false
+
+ 1663773842877
+ 1663773842877
+
+ T extends Agent
+
+ Generic parameter:
+
+ ENTITY
+ 100
+ false
+ 100
+ true
+
+ -4144960
+ null
+
+ true
+ true
+ false
+
+ 10
+ MPS
+
+
+ 1
+ METER
+
+
+ 1
+ METER
+
+
+ 1
+ METER
+
+
+
+ false
+
+ 1.0
+ SECOND
+
+ CONTINUOUS
+ 500
+ 500
+ 0
+ 100
+ 100
+ MOORE
+ USER_DEF
+ USER_DEF
+ 2
+ 50
+ 0.95
+ 10
+
+
+ true
+ 1658477089959
+ true
+ 1663833600000
+
+ 0
+ HOUR
+
+
+ 1
+ HOUR
+
+
+
+ 1663773842875
+ scale
+ 0
+ -150
+ false
+ false
+ false
+ SHAPE_DRAW_2D3D
+ 100
+ 0
+ BASED_ON_LENGTH
+ 10
+ METER
+ 10
+ true
+
+ 1663773842878
+ 1663773842874
+
+
+ 1671113514350
+ v_hydrogenProductionDeficit_kWh
+ 1120
+ 460
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1728385990273
+ p_isSliderGC
+ 270
+ 460
+
+ false
+ true
+ true
+
+ boolean
+ NONE
+ false
+
+ false
+
+
+ 1728385990271
+ CHECK_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+
+
+ VOID
+ double
+ 1671111800831
+ f_operateFlexAssets_overwrite
+ 800
+ 240
+
+ false
+ true
+ true
+ /*for( J_EA v : c_conversionAssets ){
+ if (v instanceof J_EAConversionElektrolyser) {
+ f_manageElektrolyser((J_EAConversionElektrolyser)v);
+ }
+}*/
+
+f_manageEVCharging();
+
+f_manageBattery();
+
+
+
+ VOID
+ double
+ 1671112355094
+ f_manageElektrolyser
+ true
+ 800
+ 480
+
+ false
+ true
+ true
+
+ ElektrolyserAsset
+ J_EAConversionElektrolyser
+
+ if (ElektrolyserAsset.getInputCapacity_kW()>0) {
+
+ //double availableCapacityFromBatteries_kW = p_batteryAsset == null ? 0 : ((J_EAStorageElectric)p_batteryAsset.j_ea).getCapacityAvailable_kW();
+ double availableElectricPower_kW = v_liveConnectionMetaData.contractedDeliveryCapacity_kW - fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.ELECTRICITY);
+ double excessElectricPower_kW = -(fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.ELECTRICITY) + v_liveConnectionMetaData.contractedFeedinCapacity_kW); // Should at least draw this much power to stay within connection limits. Doesn't account for a battery!
+ double eta_r = ElektrolyserAsset.getEta_r();
+ //double connectionCapacity_kW = v_allowedCapacity_kW; // Use only 90% of capacity for robustness against delay
+ double ProductionSetpoint_kW = ElektrolyserAsset.getInputCapacity_kW() * 0.30 * eta_r; // Aim for average production power of xx% of elektrolyser peak power
+ double elektrolyserSetpointElectric_kW = 0;
+
+ if (p_electrolyserOperationMode==OL_ElectrolyserOperationMode.BALANCE) {
+ double FeedbackGain_kWpkWh = 1.0/24; // Try to recover deficit in 24 hours
+ elektrolyserSetpointElectric_kW = ProductionSetpoint_kW/eta_r + v_hydrogenProductionDeficit_kWh * FeedbackGain_kWpkWh /eta_r ;
+
+ //traceln("Elektrolyser electric power setpoint: " + elektrolyserSetpointElectric_kW + " kW");
+ //traceln("Elektrolyser power fraction: " + elektrolyserSetpointElectric_kW/ElektrolyserAsset.j_ea.getElectricCapacity_kW());
+ } else if (p_electrolyserOperationMode==OL_ElectrolyserOperationMode.PRICE) {
+ //if(l_ownerActor.getConnectedAgent() instanceof ConnectionOwner) {
+ //double currentElectricityPriceCharge_eurpkWh = ownerActor.v_priceBandsDelivery.ceilingEntry(100.0).getValue(); // 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
+ double priceGain_peur = 5; // How strongly to ramp up power with price-delta's
+ double WTP_eurpkWh = v_electricityPriceLowPassed_eurpkWh + deficitGain_eurpkWh * v_hydrogenProductionDeficit_kWh;
+ elektrolyserSetpointElectric_kW = max(0,ElektrolyserAsset.getInputCapacity_kW()*(WTP_eurpkWh - currentElectricityPriceCharge_eurpkWh)*priceGain_peur) ;
+ //traceln("WTP hydrogen production is " + roundToDecimal(WTP_eurpkWh,3) + " eurpkWh is higher than electricity price " + roundToDecimal(currentElectricityPriceCharge_eurpkWh,3) + " eurpkWh, so produce! Setpoint power: " + round(elektrolyserSetpointElectric_kW) + " kW");
+ }
+
+ // Limit elektrolyser power to available electric power on connection (assuming it is last in merit!)
+ elektrolyserSetpointElectric_kW = min(availableElectricPower_kW,max(elektrolyserSetpointElectric_kW,excessElectricPower_kW));
+
+ ElektrolyserAsset.f_updateAllFlows(elektrolyserSetpointElectric_kW/ElektrolyserAsset.getInputCapacity_kW());
+
+ v_hydrogenProductionDeficit_kWh += ProductionSetpoint_kW - max(0,-ElektrolyserAsset.getLastFlows().get(OL_EnergyCarriers.HYDROGEN)); // Update hydrogen production deficit
+}
+
+
+
+
+ 1663773842874
+ connections
+ 50
+ -50
+
+ false
+ true
+ true
+ false
+ COLLECTION_OF_LINKS
+ true
+ Object
+ SOLID
+ 1
+ -16777216
+ UNDER_AGENTS
+ NONE
+ END
+
+
+
+
+ 1663774465365
+ energyModel
+ true
+ 50
+ -100
+
+ false
+ true
+ true
+
+ zero_engine
+ EnergyModel
+
+
+
+
+
+ 1663773842878
+ level
+ 0
+ 0
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ 0
+ DIM_NON_CURRENT
+
+
+
+
+ 1666956363819
+ GCGridBattery
+ @Override
+public void f_operateFlexAssets(){
+ f_operateFlexAssets_overwrite();
+}
+ 1752677823817
+
+ zero_engine
+ GridConnection
+
+
+
+ p_parentNodeElectricID
+
+
+ p_parentNodeHeatID
+
+
+ p_BuildingThermalAsset
+
+
+ p_ownerID
+
+
+ p_batteryAsset
+
+
+ p_electrolyserOperationMode
+
+
+ p_heatBuffer
+
+
+ p_gasBuffer
+
+
+ p_cookingTracker
+
+
+ p_energyLabel
+
+
+ p_DHWAsset
+
+
+ p_longitude
+
+
+ p_latitude
+
+
+ p_gridConnectionID
+
+
+ p_floorSurfaceArea_m2
+
+
+ p_GISPoint
+
+
+ p_owner
+
+
+ p_roofSurfaceArea_m2
+
+
+ p_purposeBAG
+
+
+ p_name
+
+
+ p_curtailmentMode
+
+
+ p_address
+
+
+ p_parentNodeHeat
+
+
+ p_parentNodeElectric
+
+
+ v_isActive
+
+
+ p_uid
+
+
+ false
+
+ 1666956363817
+ 1666956363817
+
+ T extends Agent
+
+ Generic parameter:
+
+ ENTITY
+ 100
+ false
+ 100
+ true
+
+ -4144960
+ null
+
+ true
+ true
+ false
+
+ 10
+ MPS
+
+
+ 1
+ METER
+
+
+ 1
+ METER
+
+
+ 1
+ METER
+
+
+
+ false
+
+ 1.0
+ SECOND
+
+ CONTINUOUS
+ 500
+ 500
+ 0
+ 100
+ 100
+ MOORE
+ USER_DEF
+ USER_DEF
+ 2
+ 50
+ 0.95
+ 10
+
+
+ true
+ 1658477089958
+ true
+ 1667030400000
+
+ 0
+ HOUR
+
+
+ 1
+ HOUR
+
+
+
+ 1666956363815
+ scale
+ 0
+ -150
+ false
+ false
+ false
+ SHAPE_DRAW_2D3D
+ 100
+ 0
+ BASED_ON_LENGTH
+ 10
+ METER
+ 10
+ true
+
+ 1666956363818
+ 1666956363814
+
+
+ 1724948346123
+ v_electricityPriceMaxForProfit_eurpkWh
+ 1540
+ 100
+
+ false
+ true
+ true
+
+ double
+
+ 0.05
+
+
+
+
+ 1724948346126
+ v_gridNodeCongestionLimit_kW
+ Congestion limit of the grid node. If this limit is reached, electrolyser should not be functional.
+ 1540
+ 70
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1732029220158
+ p_isSliderGC
+ 270
+ 460
+
+ false
+ true
+ true
+
+ boolean
+ NONE
+ false
+
+ false
+
+
+ 1732029220156
+ CHECK_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+
+
+ VOID
+ double
+ 1666956397906
+ f_connectToChild_overwrite
+ true
+ 770
+ -150
+
+ false
+ true
+ true
+
+ ConnectingChildNode
+ Agent
+
+ //assetLinks.connectTo(ConnectingChildNode);
+EnergyAsset EA = (EnergyAsset) ConnectingChildNode;
+c_energyAssets.add(EA);
+
+if (EA.j_ea instanceof J_EAConsumption) {
+ //c_consumptionAssets.add(EA);
+} else if (EA.j_ea instanceof J_EAProduction ) {
+ //c_productionAssets.add(EA);
+} else if (EA.j_ea instanceof J_EAStorage ) {
+ //c_storageAssets.add(EA);
+ if (EA.j_ea instanceof J_EAStorageHeat) {
+ //p_BuildingThermalAsset = EA;
+ }
+ else if(EA.j_ea instanceof J_EAStorageElectric && ((J_EAStorageElectric)EA.j_ea).getStorageCapacity_kWh() !=0) {
+ //p_batteryAsset = EA;
+ }
+} else if (EA.j_ea instanceof J_EAConversion) {
+ c_conversionAssets.add((J_EAConversion)EA.j_ea);
+ if (EA.j_ea instanceof J_EAConversionGasBurner || EA.j_ea instanceof J_EAConversionHeatPump || EA.j_ea instanceof J_EAConversionHeatDeliverySet || EA.j_ea instanceof J_EAConversionElectricHeater ) {
+ if (p_primaryHeatingAsset == null) {
+ p_primaryHeatingAsset = (J_EAConversion)EA.j_ea;
+ } else if (p_secondaryHeatingAsset == null) {
+ p_secondaryHeatingAsset = (J_EAConversion)EA.j_ea;
+ } else {
+ traceln("District Heating gridconnection already has two heating systems!");
+ }
+ //traceln("heatingAsset class " + p_spaceHeatingAsset.getClass().toString());
+ }
+} else {
+ traceln("f_connectToChild in EnergyAsset: Exception! EnergyAsset " + ConnectingChildNode.getId() + " is of unknown type or null! ");
+}
+
+
+/*
+// create a local list of energyAssets connected to its netConnection Agent for easy reference
+List<EnergyAsset> connectedEnergyAssets = subConnections.getConnections();
+
+int numberOfEnergyAssets = connectedEnergyAssets.size();
+for( int i = 0; i < numberOfEnergyAssets; i++ ) {
+ if( connectedEnergyAssets.get(i) instanceof EnergyAsset ) {
+ c_connectedEnergyAssets.add(connectedEnergyAssets.get(i));
+
+ }
+}
+
+List<EnergyAsset> consumptionAssets = filter(c_connectedEnergyAssets, b -> b.j_ea instanceof J_EAConsumption);
+List<EnergyAsset> productionAssets = filter(c_connectedEnergyAssets, b -> b.j_ea instanceof J_EAProduction);
+List<EnergyAsset> storageAssets = filter(c_connectedEnergyAssets, b -> b.j_ea instanceof J_EAStorage);
+List<EnergyAsset> conversionAssets = filter(c_connectedEnergyAssets, b -> b.j_ea instanceof J_EAConversion);
+traceln("NetConnection connecting to " + numberOfEnergyAssets + " EnergyAssets");
+*/
+
+
+
+ VOID
+ double
+ 1666956527771
+ f_operateFlexAssets_overwrite
+ 910
+ 220
+
+ false
+ true
+ true
+ f_manageBattery();
+
+
+
+ VOID
+ double
+ 1666967854749
+ f_operateFixedConsumptionAssets_overwrite
+ true
+ 910
+ 200
+
+ false
+ true
+ true
+ for(EnergyAsset e : c_consumptionAssets) {
+ if( e.p_energyAssetType == OL_EnergyAssetType.ELECTRICITY_CONSUMPTION_PROFILE ) {
+ e.f_updateElectricityFlows( main.v_currentBuildingOtherElectricityDemand_fr );
+ }
+ else {
+ traceln("Grid battery has other consumption assets than 'other electricity consumption'");
+ e.v_powerFraction_fr = 0;
+ }
+}
+
+
+ VOID
+ double
+ 1688369593905
+ f_calculateEnergyBalance_overwrite
+ true
+ 840
+ 330
+
+ false
+ true
+ true
+ v_previousPowerElectricity_kW = v_currentPowerElectricity_kW;
+v_currentPowerElectricity_kW = 0;
+v_currentPowerMethane_kW = 0;
+v_currentPowerHydrogen_kW = 0;
+v_currentPowerHeat_kW = 0;
+v_currentPowerDiesel_kW = 0;
+
+v_currentElectricityConsumption_kW = 0;
+v_currentElectricityProduction_kW = 0;
+v_currentEnergyConsumption_kW = 0;
+v_currentEnergyProduction_kW = 0;
+v_currentEnergyCurtailed_kW = 0;
+
+
+// Categorical power flows
+v_fixedConsumptionElectric_kW = 0;
+v_electricHobConsumption_kW = 0;
+v_heatPumpElectricityConsumption_kW = 0;
+v_hydrogenElectricityConsumption_kW = 0;
+v_evChargingPowerElectric_kW = 0;
+v_batteryPowerElectric_kW = 0;
+v_windProductionElectric_kW = 0;
+v_pvProductionElectric_kW = 0;
+v_conversionPowerElectric_kW = 0;
+
+
+f_operateFixedAssets();
+f_operateFlexAssets();
+f_curtailment();
+f_connectionMetering();
+
+
+ VOID
+ double
+ 1709827456110
+ f_manageCurtailer
+ true
+ 800
+ 560
+
+ false
+ true
+ true
+
+ CurtailerAsset
+ J_EAConversionCurtailer
+
+ //traceln("Hello! " + CurtailerAsset.j_ea.getElectricCapacity_kW());
+if (CurtailerAsset.getElectricCapacity_kW()>0) {
+ double curtailerSetpointElectric_kW = -min(0,v_currentPowerElectricity_kW + p_connectionCapacity_kW);
+ double[] flowsArray = CurtailerAsset.f_updateAllFlows(curtailerSetpointElectric_kW/CurtailerAsset.getElectricCapacity_kW());
+ v_conversionPowerElectric_kW = flowsArray[4] - flowsArray[0];
+ /*if ( curtailerSetpointElectric_kW > 0 ) {
+ traceln("Windfarm is curtailing " + curtailerSetpointElectric_kW + " kW!");
+ }*/
+}
+
+
+
+
+ 1666956363814
+ connections
+ 50
+ -50
+
+ false
+ true
+ true
+ false
+ COLLECTION_OF_LINKS
+ true
+ Object
+ SOLID
+ 1
+ -16777216
+ UNDER_AGENTS
+ NONE
+ END
+
+
+
+
+ 1666957377035
+ energyModel
+ true
+ 50
+ -100
+
+ false
+ true
+ true
+
+ zero_engine
+ EnergyModel
+
+
+
+
+
+ 1666956363818
+ level
+ 0
+ 0
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ 0
+ DIM_NON_CURRENT
+
+
+ 1682065741241
+ SOC_plot
+ 520
+ 560
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ true
+
+ 1751011893340
+ true
+ 1682150400000
+
+ 0
+ HOUR
+
+
+ energyModel.p_timeStep_h
+ HOUR
+
+
+ false
+ 510
+ 270
+
+
+
+ 50
+ 30
+ 430
+ 180
+ -1
+ -16777216
+ -12566464
+
+
+
+ DEFAULT
+ DEFAULT
+ -12566464
+
+ true
+ MOVEMENT_WITH_TIME
+ MODEL_TIME_UNIT
+ 0
+ 1
+ AUTO
+ true
+ LINEAR
+
+ SOC
+ 1658477089957
+ my_dataset
+ -10496
+ p_batteryAsset != null ? p_batteryAsset.getCurrentStateOfCharge_fr() : 0
+ true
+ NONE
+ 1.0
+
+ 192
+ 100
+ false
+ MODEL_TIME_UNITS
+
+
+ 1724948353249
+ rectangle4
+ 1450
+ 20
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ false
+ 0
+ 10
+ 1
+ -16777216
+ null
+ SOLID
+ 600
+ 180
+ 0.0
+ -1
+ null
+
+
+ 1724948367410
+ txt_whateverthisis
+ 1450
+ 30
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ Adjusted by sliders in batUI: find the correct ones and adjust those instead TODO!!!
+
+ SansSerif
+ 14
+
+
+ LEFT
+
+
+
+
+
+
+ 1663772408667
+ GCHouse
+ @Override
+public void f_connectToJ_EA(J_EA j_ea){
+ f_connectToJ_EA_default(j_ea);
+ f_connectTo_J_EA_House(j_ea);
+}
+
+@Override
+public void f_removeTheJ_EA(J_EA j_ea){
+ f_removeTheJ_EA_default(j_ea);
+ f_removeTheJ_EA_house(j_ea);
+}
+
+@Override
+public void f_operateFlexAssets(){
+ f_operateFlexAssets_overwrite();
+}
+
+/*
+@Override
+public void f_manageEVCharging(){
+ f_manageCharging_overwrite();
+}*/
+
+
+
+ 1752677823817
+
+ zero_engine
+ GridConnection
+
+
+
+ p_parentNodeElectricID
+
+
+ p_parentNodeHeatID
+
+
+ p_BuildingThermalAsset
+
+
+ p_ownerID
+
+
+ p_batteryAsset
+
+
+ p_electrolyserOperationMode
+
+
+ p_heatBuffer
+
+
+ p_gasBuffer
+
+
+ p_cookingTracker
+
+
+ p_energyLabel
+
+
+ p_DHWAsset
+
+
+ p_longitude
+
+
+ p_latitude
+
+
+ p_gridConnectionID
+
+
+ p_floorSurfaceArea_m2
+
+
+ p_GISPoint
+
+
+ p_owner
+
+
+ p_roofSurfaceArea_m2
+
+
+ p_purposeBAG
+
+
+ p_curtailmentMode
+
+
+ p_name
+
+
+ p_address
+
+
+ p_parentNodeHeat
+
+
+ p_parentNodeElectric
+
+
+ v_isActive
+
+
+ p_uid
+
+
+ false
+
+ 1663772408665
+ 1663772408665
+
+ T extends Agent
+
+ Generic parameter:
+
+ ENTITY
+ 100
+ false
+ 100
+ true
+
+ -4144960
+ null
+
+ true
+ true
+ false
+
+ 10
+ MPS
+
+
+ 1
+ METER
+
+
+ 1
+ METER
+
+
+ 1
+ METER
+
+
+
+ false
+
+ 1.0
+ SECOND
+
+ CONTINUOUS
+ 500
+ 500
+ 0
+ 100
+ 100
+ MOORE
+ USER_DEF
+ USER_DEF
+ 2
+ 50
+ 0.95
+ 10
+
+
+ true
+ 1658477089956
+ true
+ 1663833600000
+
+ 0
+ HOUR
+
+
+ 1
+ HOUR
+
+
+
+ 1663772408663
+ scale
+ 0
+ -150
+ false
+ false
+ false
+ SHAPE_DRAW_2D3D
+ 100
+ 0
+ BASED_ON_LENGTH
+ 10
+ METER
+ 10
+ true
+
+ 1663772408666
+ 1663772408662
+
+
+ 1674899648649
+ v_hpPreviousConsumptionLevel
+ true
+ 2010
+ 80
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1674900257329
+ v_dailyHPConsumption_kWh
+ true
+ 2010
+ 100
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1677597726836
+ v_copHeatpump
+ true
+ 2020
+ 390
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1690363061408
+ v_electricHobConsumption_kWh
+ This is part of the v_fixedConsumptionElectric_kW, thus variable only exists for additional information
+ true
+ 150
+ 1520
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1704447485797
+ v_gasHeatingCost_eurpkWh_TEMPORARY
+ true
+ 2050
+ 660
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1704447485799
+ v_eHeatingCost_eurpkWh_TEMPORARY
+ true
+ 2050
+ 640
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1704447555064
+ v_tempSetpoint_degC
+ true
+ 2050
+ 600
+
+ false
+ true
+ true
+
+ double
+
+ 19
+
+
+
+
+ 1704447555073
+ v_heatingOn_time
+ true
+ 2050
+ 540
+
+ false
+ true
+ true
+
+ double
+
+ 8
+
+
+
+
+ 1704447555075
+ v_heatingOff_time
+ true
+ 2050
+ 560
+
+ false
+ true
+ true
+
+ double
+
+ 23
+
+
+
+
+ 1678703448389
+ p_smartChargingPowerAttenuation_fr
+ true
+ 250
+ 440
+
+ false
+ true
+ true
+
+ double
+ NONE
+ false
+
+ 2.0
+
+
+ 1678703448387
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1717323052486
+ p_bouwjaar
+ 50
+ 510
+
+ false
+ true
+ true
+
+ int
+ NONE
+ false
+
+ 1717323052484
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1722350833847
+ p_eigenOprit
+ 50
+ 530
+
+ false
+ true
+ true
+
+ boolean
+ NONE
+ false
+
+ 1722350833845
+ CHECK_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1726685123865
+ p_cookingMethod
+ 250
+ 510
+
+ false
+ true
+ true
+
+ OL_HouseholdCookingMethod
+ NONE
+ false
+
+ OL_HouseholdCookingMethod.NONE
+
+
+ 1726685123863
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1749653249111
+ p_airco
+ 600
+ 580
+
+ false
+ true
+ true
+
+ J_EAAirco
+ NONE
+ false
+
+ 1749653249109
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1753354062572
+ v_dayTempSetpoint_degC
+ true
+ 2050
+ 518
+
+ false
+ true
+ true
+
+ double
+ NONE
+ false
+
+ 18
+
+
+ 1753354062570
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1753354182380
+ v_nightTempSetpoint_degC
+ true
+ 2050
+ 500
+
+ false
+ true
+ true
+
+ double
+ NONE
+ false
+
+ 18
+
+
+ 1753354182378
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+
+
+ 1674899601674
+ e_measureHeatpump
+ true
+ 2010
+ 50
+
+ false
+ true
+ true
+
+
+ 1
+ HOUR
+
+
+ 1
+ PER_HOUR
+
+ 1658477089954
+ true
+ 1674979200000
+
+ 0.99
+ DAY
+
+
+ 1
+ DAY
+
+ false
+
+ if( p_primaryHeatingAsset.j_ea instanceof J_EAConversionHeatPump ){
+ v_dailyHPConsumption_kWh = ((J_EAConversionHeatPump)p_primaryHeatingAsset.j_ea).totalElectricityConsumed_kWh - v_hpPreviousConsumptionLevel;
+ v_hpPreviousConsumptionLevel = ((J_EAConversionHeatPump)p_primaryHeatingAsset.j_ea).totalElectricityConsumed_kWh;
+}
+
+
+
+
+ VOID
+ double
+ 1664963959146
+ f_operateFlexAssets_overwrite
+ 910
+ 220
+
+ false
+ true
+ true
+ f_manageCookingTracker();
+f_manageAirco();
+super.f_operateFlexAssets();
+
+/*
+double availablePowerAtPrice_kW = v_liveConnectionMetaData.contractedDeliveryCapacity_kW;
+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;
+}
+
+f_manageHeating();
+
+if( c_electricVehicles.size() > 0){
+ double availableCapacityFromBatteries = p_batteryAsset == null ? 0 : p_batteryAsset.getCapacityAvailable_kW();
+ double availableChargingCapacity = v_liveConnectionMetaData.contractedDeliveryCapacity_kW + availableCapacityFromBatteries - fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.ELECTRICITY);
+ //f_maxPowerCharging( max(0, availableChargingCapacity));
+ f_manageEVCharging();
+ //v_currentPowerElectricity_kW += v_evChargingPowerElectric_kW;
+}
+
+f_manageChargers();
+
+f_manageBattery();*/
+
+
+ VOID
+ double
+ 1669203453155
+ f_createThermalStorageModel
+ true
+ 1290
+ 1190
+
+ false
+ true
+ true
+ OL_EAPresetStorageAssets isolationLevel;
+switch(p_isolationLabel) {
+ case A:
+ isolationLevel = OL_EAPresetStorageAssets.House_heatmodel_A;
+ break;
+ case B:
+ isolationLevel = OL_EAPresetStorageAssets.House_heatmodel_B;
+ break;
+ case C:
+ isolationLevel = OL_EAPresetStorageAssets.House_heatmodel_C;
+ break;
+ case D:
+ isolationLevel = OL_EAPresetStorageAssets.House_heatmodel_D;
+ break;
+ case E:
+ isolationLevel = OL_EAPresetStorageAssets.House_heatmodel_E;
+ break;
+ case F:
+ isolationLevel = OL_EAPresetStorageAssets.House_heatmodel_F;
+ break;
+ case G:
+ isolationLevel = OL_EAPresetStorageAssets.House_heatmodel_G;
+ break;
+ default:
+ traceln("f_createPresetStorageHeat: house without invalid label, label set to C");
+ isolationLevel = OL_EAPresetStorageAssets.House_heatmodel_C;
+ break;
+}
+
+//Get preset input from DB
+List< Tuple > data = selectFrom( storage_assets ).where( storage_assets.name.eq( isolationLevel ) ).
+list();
+
+OL_EnergyAssetType assetType = null;
+String energyAssetPresetName = isolationLevel.toString();
+double capacityHeat_kW = 0;
+double lossFactor_WpK = 0;
+double heatCapacity_JpK = 0;
+double minTemperature_degC = 0;
+double maxTemperature_degC = 0;
+double setTemperature_degC = 0;
+String ambientTempType = "";
+
+
+for( Tuple tup : data ) {
+ assetType = tup.get( storage_assets.energy_asset_type );
+ capacityHeat_kW = tup.get( storage_assets.capacity_heat_kw );
+ lossFactor_WpK = tup.get( storage_assets.loss_factor_wpk );
+ heatCapacity_JpK = tup.get( storage_assets.heat_capacity_jpk );
+ minTemperature_degC = tup.get( storage_assets.min_temp_degc);
+ maxTemperature_degC = tup.get( storage_assets.max_temp_degc);
+ setTemperature_degC = tup.get( storage_assets.set_temp_degc);
+ ambientTempType = tup.get( storage_assets.ambient_temp_type);
+}
+
+EnergyAsset e = main.add_pop_energyAssets( null, p_gridConnectionID, assetType, isolationLevel.toString() );
+e.j_ea = new J_EAStorageHeat(e, OL_EAStorageTypes.HEATMODEL_BUILDING, capacityHeat_kW, lossFactor_WpK, energyModel.p_timeStep_h, setTemperature_degC , minTemperature_degC, maxTemperature_degC, setTemperature_degC, heatCapacity_JpK, ambientTempType);
+e.f_connectToParentNode( this );
+main.c_storageAssets.add(e);
+main.c_ambientAirDependentAssets.add(e);
+
+// update static ambient temperature once for underground types
+if( ambientTempType != null && ambientTempType.equals("GROUND") ) {
+ e.j_ea.updateAmbientTemperature( main.p_undergroundTemperature_degC );
+}
+if( ambientTempType != null && ambientTempType.equals("AIR") ) {
+ e.j_ea.updateAmbientTemperature( main.v_currentAmbientTemperature_degC );
+}
+
+
+
+
+ VOID
+ double
+ 1674402121915
+ f_chargeOnPrice_overwrite
+ true
+ 2040
+ 700
+
+ false
+ true
+ true
+
+ currentElectricityPriceConsumption_eurpkWh
+ double
+
+
+ availablePowerOnGC_kW
+ double
+
+ //J_EAEV EV_instance = (J_EAEV)p_householdEV.j_ea;
+
+double chargingRatio = 0.0; // needs to be set at zero!
+double powerAvailableAtPrice_kW = 0;
+double powerAvailableAtLastLoop_kW = 0;
+double currentPowerDrawn_kW = v_currentPowerElectricity_kW;
+boolean continueLoop = true;
+double maxChargingPower_kW = p_householdEV.getElectricCapacity_kW();
+ConnectionOwner owner = (ConnectionOwner)l_ownerActor.getConnectedAgent();
+double electricityPrice_eurpkWh = 0;
+String lastLoopsPriceLevel = "";
+OL_priceLevels priceLevel;
+int index = 0; // purely to not let loop go wild, if something goes wrong
+
+
+if( p_householdEV.getAvailability() && p_householdEV.chargingNeed != OL_EVChargingNeed.NONE ){
+ while ( continueLoop && index < 5 ){
+ powerAvailableAtPrice_kW += owner.f_getAvailablePowerAtPrice( currentPowerDrawn_kW );
+ electricityPrice_eurpkWh = owner.f_getElectricityPrice( currentPowerDrawn_kW );
+ priceLevel = f_getPriceLevel( electricityPrice_eurpkWh );
+
+ if (powerAvailableAtPrice_kW > p_minChargingPower_kW){ // only charge if there is at least 2 OR 1 kW availablE
+ // SCENARIO LOW CHARGING NEED -> Only when price is low
+ if ( p_householdEV.chargingNeed == OL_EVChargingNeed.LOW) {
+ if( priceLevel == OL_priceLevels.LOW ) {
+ if (powerAvailableAtPrice_kW >= p_householdEV.getElectricCapacity_kW() / p_smartChargingPowerAttenuation_fr ){
+ chargingRatio = 1 / p_smartChargingPowerAttenuation_fr;
+ continueLoop = false;
+ }
+ else{
+ powerAvailableAtLastLoop_kW = powerAvailableAtPrice_kW;
+ currentPowerDrawn_kW += powerAvailableAtPrice_kW;
+ lastLoopsPriceLevel = "low";
+ }
+ }
+ else if ( lastLoopsPriceLevel.equals("low")) {
+ chargingRatio = min( powerAvailableAtLastLoop_kW, p_householdEV.getElectricCapacity_kW() ) / p_householdEV.getElectricCapacity_kW();
+ continueLoop = false;
+ }
+ else {
+ continueLoop = false;
+ }
+ }
+ // SCENARIO MEDIUM CHARGING NEED -> Only when price is low or a bit when medium
+ else if ( p_householdEV.chargingNeed == OL_EVChargingNeed.MEDIUM){
+ if( priceLevel == OL_priceLevels.LOW) {
+ if (powerAvailableAtPrice_kW >= p_householdEV.getElectricCapacity_kW() ){
+ chargingRatio = 1 ;
+ continueLoop = false;
+ }
+ else{
+ powerAvailableAtLastLoop_kW = powerAvailableAtPrice_kW;
+ currentPowerDrawn_kW += powerAvailableAtPrice_kW;
+ lastLoopsPriceLevel = "low";
+ }
+ }
+ else if( priceLevel == OL_priceLevels.MEDIUM ) {
+ if( lastLoopsPriceLevel.equals("low") && powerAvailableAtLastLoop_kW > p_minChargingPower_kW ) { // charge what you can at low (/free) price and a bit on medium price
+ chargingRatio = powerAvailableAtLastLoop_kW / p_householdEV.getElectricCapacity_kW() + p_householdEV.getElectricCapacity_kW() / 4;
+ continueLoop = false;
+
+ }
+ else { //hier zou je nog een extra min() statement bij kunnen zetten die het minimale neemt van de huidige min statment en powerAvailableAtPrice_kW, echter, komt hoogstwaarschijnlijk niet voor (1/4 van laadsnelheid is inprincipe altijd minder dan 2 + 'x' kW.). Ook is het geen ramp om HEEEEEL sporadisch op hoge prijs te laden.
+ chargingRatio = p_householdEV.getElectricCapacity_kW() / 4 ; //charge slow, if there is no hurry and price is average
+ continueLoop = false;
+ }
+ }
+ else if (lastLoopsPriceLevel.equals("low") && powerAvailableAtLastLoop_kW > p_minChargingPower_kW ){
+ chargingRatio = powerAvailableAtLastLoop_kW / p_householdEV.getElectricCapacity_kW();
+ continueLoop = false;
+ }
+ else{
+ continueLoop = false;
+ }
+ }
+ // SCENARIO HIGH CHARGING NEED -> charge full power, otherwise the EV will not get full
+ else {
+ chargingRatio = 1.0; // Hier kan er boven de gridconnectie geladen worden. Zeker als je 11 kW laders hebt met een warmtepomp erbij
+ continueLoop = false;
+ }
+ }
+ else { // Als er minder dan 2 kW beschikbaar is in deze prijsband (i.e. huidige loop), ga nog een keer door de loop heen in de volgende prijsband
+ powerAvailableAtLastLoop_kW = powerAvailableAtPrice_kW;
+ currentPowerDrawn_kW += powerAvailableAtPrice_kW;
+ }
+ index ++;
+ }
+}
+if( p_householdEV.chargingNeed != OL_EVChargingNeed.HIGH){ //unless the charging need is high, limit the charging speed to grid connection.
+ chargingRatio = min(1, min( availablePowerOnGC_kW / p_householdEV.getElectricCapacity_kW(), chargingRatio));
+}
+p_householdEV.f_updateAllFlows( chargingRatio );
+v_evChargingPowerElectric_kW += p_householdEV.electricityConsumption_kW - p_householdEV.electricityProduction_kW;
+
+
+
+
+ VOID
+ double
+ 1675014184707
+ f_manageCharging_overwrite
+ true
+ 1160
+ 280
+
+ false
+ true
+ true
+ double availableCapacityFromBatteries = p_batteryAsset == null ? 0 : p_batteryAsset.getCapacityAvailable_kW();
+//double availableChargingCapacity = v_allowedCapacity_kW + availableCapacityFromBatteries - v_currentPowerElectricity_kW;
+double availableChargingCapacity = v_liveConnectionMetaData.contractedDeliveryCapacity_kW + availableCapacityFromBatteries - fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.ELECTRICITY);
+//v_vehicleSOC_fr = p_householdEV.getCurrentStateOfCharge_fr();
+
+switch (p_chargingAttitudeVehicles) {
+ case SIMPLE:
+ f_simpleCharging();
+ break;
+ case V1G:
+ case MAX_SPREAD:
+ f_maxSpreadCharging();
+ break;
+ case CHEAP:
+ f_chargeOnPrice( v_currentElectricityPriceConsumption_eurpkWh, max(0, availableChargingCapacity));
+ break;
+ case V2G:
+ //v_currentElectricityPriceConsumption_eurpkWh = ((ConnectionOwner)l_ownerActor.getConnectedAgent()).f_getElectricityPrice(p_connectionCapacity_kW);
+ //v_electricityPriceLowPassed_eurpkWh += v_lowPassFactor_fr * ( v_currentElectricityPriceConsumption_eurpkWh - v_electricityPriceLowPassed_eurpkWh );
+ f_chargeOnPrice_V2G( v_currentElectricityPriceConsumption_eurpkWh, max(0, availableChargingCapacity));
+ break;
+ default:
+ traceln("Incorrect charging mode in household @f_manageCharging_overwrite");
+}
+
+
+
+ VOID
+ double
+ 1675034695162
+ f_determineChargingDemandOfEV
+ true
+ 2040
+ 720
+
+ false
+ true
+ true
+ //J_EAEV EVinstance = (J_EAEV)p_householdEV;
+if( p_householdEV != null && p_chargingAttitudeVehicles == OL_ChargingAttitude.CHEAP ){
+ if(! p_householdEV.getAvailability() ){ // not at home
+ p_householdEV.chargingNeed = OL_EVChargingNeed.EV_NOT_AVAILABLE;
+ }
+ else if( p_householdEV.getCurrentStateOfCharge() >= 1){ // is full
+ p_householdEV.chargingNeed = OL_EVChargingNeed.NONE;
+ }
+ else { // could use some charging
+ double chargeNeedForNextTrip_kWh = max(0, p_householdEV.tripTracker.v_energyNeedForNextTrip_kWh + p_householdEV.getStorageCapacity_kWh() * (p_minEVChargeTarget_fr - p_householdEV.getCurrentStateOfCharge()));
+ double timeToNextTrip_min = p_householdEV.tripTracker.v_nextEventStartTime_min - energyModel.t_h*60;
+ double chargeDeadline_min = floor((p_householdEV.tripTracker.v_nextEventStartTime_min / 60 - chargeNeedForNextTrip_kWh / p_householdEV.getElectricCapacity_kW()) / energyModel.p_timeStep_h) * 60 * energyModel.p_timeStep_h;
+ if ( chargeNeedForNextTrip_kWh == 0) {
+ p_householdEV.chargingNeed = OL_EVChargingNeed.LOW;
+ }
+ else if (energyModel.t_h*60 < chargeDeadline_min ){
+ //traceln(energyModel.t_h*60 + ", " + chargeDeadline_min);
+ //traceln(chargeNeedForNextTrip_kWh);
+ p_householdEV.chargingNeed = OL_EVChargingNeed.MEDIUM;
+ }
+ else {
+ p_householdEV.chargingNeed = OL_EVChargingNeed.HIGH;
+ }
+ }
+ v_vehicleChargingNeed = p_householdEV.chargingNeed;
+}
+
+
+
+ VOID
+ double
+ 1693300820997
+ f_connectTo_J_EA_House
+ 1090
+ 90
+
+ false
+ true
+ true
+
+ j_ea
+ J_EA
+
+ if (j_ea instanceof J_EAAirco) {
+ p_airco = (J_EAAirco)j_ea;
+}
+/*if (j_ea instanceof J_EAEV) {
+ if (p_householdEV != null){
+ throw new RuntimeException(String.format("Exception: trying to assign 2 EVs to a household!! --> one of them will not charge! "));
+ }
+ p_householdEV = (J_EAEV)j_ea;
+}*/
+
+
+
+
+
+ VOID
+ double
+ 1696923950404
+ f_setAnnualEnergyDemand
+ 1010
+ -80
+
+ false
+ true
+ true
+ traceln("Placeholder function f_setAnnualEnergyDemand called! Nothing will happen.");
+
+
+ VOID
+ double
+ 1696924006982
+ f_setEnergyLabel
+ 1090
+ 60
+
+ false
+ true
+ true
+ traceln("Placeholder function f_setEnergyLabel called! Nothing will happen.");
+
+
+ VOID
+ double
+ 1726334759211
+ f_manageCookingTracker
+ 1160
+ 220
+
+ false
+ true
+ true
+ // Add heat from cooking assets to house
+if (p_cookingTracker != null) { // check for presence of cooking asset
+ p_cookingTracker.manageActivities(energyModel.t_h-energyModel.p_runStartTime_h); // also calls f_updateAllFlows in HOB asset
+
+ double residualHeatGasPit_kW = -p_cookingTracker.HOB.getLastFlows().get(OL_EnergyCarriers.HEAT);
+ if (p_BuildingThermalAsset != null) {
+ p_BuildingThermalAsset.v_powerFraction_fr += residualHeatGasPit_kW / p_BuildingThermalAsset.getCapacityHeat_kW(); // Does this work out correctly with new heatingManagement structure??
+ }
+}
+
+
+ VOID
+ double
+ 1749648447119
+ f_manageAirco
+ 1160
+ 240
+
+ false
+ true
+ true
+ if( p_airco != null ) {
+ if (p_airco.remainingONtimesteps == 0){
+ double switchOnProbability = 0;
+ switch (roundToInt(energyModel.pp_ambientTemperature_degC.getCurrentValue())) {
+ case 23:
+ switchOnProbability = 0.0025;
+ break;
+ case 24:
+ switchOnProbability = 0.005;
+ break;
+ case 25:
+ switchOnProbability = 0.008;
+ break;
+ case 26:
+ switchOnProbability = 0.01;
+ break;
+ case 27:
+ switchOnProbability = 0.012;
+ break;
+ case 28:
+ switchOnProbability = 0.014;
+ break;
+ case 29:
+ switchOnProbability = 0.016;
+ break;
+ case 30:
+ switchOnProbability = 0.018;
+ break;
+ case 31:
+ switchOnProbability = 0.02;
+ break;
+ }
+ if( randomTrue(switchOnProbability)){
+ int nbTimestepsOn = uniform_discr(4, 12);
+ p_airco.turnOnAirco( nbTimestepsOn );
+ }
+ }
+ p_airco.f_updateAllFlows( 1.0 );
+}
+
+
+ VOID
+ double
+ 1749722407831
+ f_removeTheJ_EA_house
+ 1090
+ 110
+
+ false
+ true
+ true
+
+ j_ea
+ J_EA
+
+ if (j_ea instanceof J_EAAirco) {
+ p_airco = null;
+}
+/*
+if (j_ea instanceof J_EAEV) {
+ p_householdEV = null;
+}
+*/
+
+
+
+
+ 1674899624978
+ d_heatpumpDailyConsumption
+ true
+ 2170
+ 50
+
+ false
+ true
+ true
+ true
+
+ 1751011893431
+ true
+ 1674979200000
+
+ 1
+ DAY
+
+
+ 1
+ DAY
+
+
+ true
+ v_dailyHPConsumption_kWh
+ 100
+
+
+
+
+ 1663772408662
+ connections
+ 50
+ -50
+
+ false
+ true
+ true
+ false
+ COLLECTION_OF_LINKS
+ true
+ Object
+ SOLID
+ 1
+ -16777216
+ UNDER_AGENTS
+ NONE
+ END
+
+
+
+
+ 1663772679600
+ energyModel
+ true
+ 50
+ -100
+
+ false
+ true
+ true
+
+ zero_engine
+ EnergyModel
+
+
+
+
+
+ 1663772408666
+ level
+ 0
+ 0
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ 0
+ DIM_NON_CURRENT
+
+
+ 1674899851745
+ HeatpumpPlot
+ true
+ 1970
+ 110
+
+ false
+ true
+ false
+ SHAPE_DRAW_2D3D
+ false
+
+ 1751011893401
+ true
+ 1674979200000
+
+ 0
+ HOUR
+
+
+ 1
+ HOUR
+
+
+ false
+ 490
+ 260
+
+
+
+ 50
+ 30
+ 410
+ 170
+ -1
+ -16777216
+ -12566464
+
+
+
+ DEFAULT
+ DEFAULT
+ -12566464
+
+ true
+ MOVEMENT_WITH_TIME
+ DAY
+ 0
+ 1
+ AUTO
+ true
+ LINEAR
+
+ Heatpump daily consumption kWh
+ 1658477089955
+ d_heatpumpDailyConsumption
+ -2987746
+ 0
+ false
+ NONE
+ 1.0
+
+ 25
+ 25
+ false
+ dd_MM
+
+
+ 1726301544269
+ line3
+ 2050
+ 460
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ false
+ 0
+ 10
+ 1
+ -16777216
+ null
+ SOLID
+ 1
+ 0
+ 1
+ 0
+ 310
+ 0
+ 0
+
+
+ 1726301549553
+ txt_heatingFunctionality
+ 2150
+ 440
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ Heating functionality
+
+ SansSerif
+ 10
+
+
+ LEFT
+
+
+
+
+
+
+ 1665480522864
+ GCIndustry
+ true
+ @Override
+public void f_connectToJ_EA(J_EA j_ea){
+ f_connectToJ_EA_default(j_ea);
+ f_connectTo_J_EA_Industry(j_ea);
+}
+
+@Override
+public void f_operateFlexAssets(){
+ f_operateFlexAssets_overwrite();
+}
+ 1752737189062
+
+ zero_engine
+ GridConnection
+
+
+
+ p_parentNodeElectricID
+
+
+ p_parentNodeHeatID
+
+
+ p_BuildingThermalAsset
+
+
+ p_ownerID
+
+
+ p_batteryAsset
+
+
+ p_electrolyserOperationMode
+
+
+ p_heatBuffer
+
+
+ p_gasBuffer
+
+
+ p_cookingTracker
+
+
+ p_energyLabel
+
+
+ p_DHWAsset
+
+
+ p_longitude
+
+
+ p_latitude
+
+
+ p_gridConnectionID
+
+
+ p_floorSurfaceArea_m2
+
+
+ p_GISPoint
+
+
+ p_owner
+
+
+ p_roofSurfaceArea_m2
+
+
+ p_purposeBAG
+
+
+ p_name
+
+
+ p_curtailmentMode
+
+
+ p_address
+
+
+ p_parentNodeHeat
+
+
+ p_parentNodeElectric
+
+
+ v_isActive
+
+
+ p_uid
+
+
+ false
+
+ 1665480522862
+ 1665480522862
+
+ T extends Agent
+
+ Generic parameter:
+
+ ENTITY
+ 100
+ false
+ 100
+ true
+
+ -4144960
+ null
+
+ true
+ true
+ false
+
+ 10
+ MPS
+
+
+ 1
+ METER
+
+
+ 1
+ METER
+
+
+ 1
+ METER
+
+
+
+ false
+
+ 1.0
+ SECOND
+
+ CONTINUOUS
+ 500
+ 500
+ 0
+ 100
+ 100
+ MOORE
+ USER_DEF
+ USER_DEF
+ 2
+ 50
+ 0.95
+ 10
+
+
+ true
+ 1658477089953
+ true
+ 1665561600000
+
+ 0
+ HOUR
+
+
+ 1
+ HOUR
+
+
+
+ 1665480522860
+ scale
+ 0
+ -150
+ false
+ false
+ false
+ SHAPE_DRAW_2D3D
+ 100
+ 0
+ BASED_ON_LENGTH
+ 10
+ METER
+ 10
+ true
+
+ 1665480522863
+ 1665480522859
+
+
+ 1684919215378
+ v_previousPowerMethane_kW
+ 1120
+ 470
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+
+
+ VOID
+ double
+ 1665498760168
+ f_connectToChild_overwrite
+ true
+ 780
+ 150
+
+ false
+ true
+ true
+
+ ConnectingParentNode
+ Agent
+
+ //assetLinks.connectTo(ConnectingParentNode);
+EnergyAsset EA = (EnergyAsset) ConnectingParentNode;
+c_energyAssets.add(EA);
+
+if (EA.j_ea instanceof J_EAConsumption) {
+ //c_consumptionAssets.add(EA);
+} else if (EA.j_ea instanceof J_EAProduction ) {
+//c_productionAssets.add(EA);
+} else if (EA.j_ea instanceof J_EAStorage ) {
+ //c_storageAssets.add(EA);
+ if (EA.j_ea instanceof J_EAStorageHeat) {
+ //p_BuildingThermalAsset = EA; Obsolete! Need to replace in connectToJ_EA
+ }
+ else if (EA.j_ea instanceof J_EAEV) {
+ //c_vehicleAssets.add( EA );
+ //c_vehicleAssets.get( v_vehicleIndex ).v_powerFraction_fr = 1;
+ /*MobilityTracker m = main.add_mobilityTrackers();
+ c_mobilityTrackers.add( m );
+ m.p_vehicleIndex = v_vehicleIndex;
+ m.p_gridConnection = this;
+ m.p_vehicleInstance = (J_EAEV)m.p_vehicleInstance;
+ m.p_energyAsset = c_vehicleAssets.get( v_vehicleIndex );
+ m.p_vehicleInstance = (J_EAEV)m.p_energyAsset.j_ea;
+ m.p_mobilityPatternType = OL_MobilityPatternType.TRUCK;
+ ((J_EAEV)m.p_vehicleInstance).setMobilityTracker( m );
+ m.f_getData();*/
+ //v_vehicleIndex ++;
+ }
+} else if (EA.j_ea instanceof J_EAConversion) {
+ c_conversionAssets.add((J_EAConversion)EA.j_ea);
+ if(p_gridConnectionType == OL_GridConnectionType.AGRO_ENERGYHUB) {
+
+ if (EA.j_ea instanceof J_EAConversionGasBurner || EA.j_ea instanceof J_EAConversionHydrogenBurner) {
+ if (p_primaryHeatingAsset==null) {
+ p_primaryHeatingAsset = (J_EAConversion)EA.j_ea ;
+ } else {
+ p_secondaryHeatingAsset = (J_EAConversion)EA.j_ea ;
+ }
+ } else if ( EA.j_ea instanceof J_EAConversionHeatPump || EA.j_ea instanceof J_EAConversionGasCHP) {
+ if (p_primaryHeatingAsset==null) {
+ //p_primaryHeatingAsset = EA; Obsolete!
+ } else {
+ p_secondaryHeatingAsset = p_primaryHeatingAsset;
+ //p_primaryHeatingAsset = EA; Obsolete!
+ }
+ if (EA.j_ea instanceof J_EAConversionHeatPump) {
+ ((J_EAConversionHeatPump)p_primaryHeatingAsset).outputTemperature_degC = 80; // For pastorizing milk
+ }
+ //traceln("heatingAsset class " + p_spaceHeatingAsset.getClass().toString());
+ } else if (EA.j_ea instanceof J_EAConversionCurtailer || EA.j_ea instanceof J_EAConversionCurtailerHeat) {
+ p_curtailer = (J_EAConversionCurtailer)EA.j_ea ;
+ } else {
+ traceln("f_connectToChild in EnergyAsset: Exception! EnergyAsset " + ConnectingParentNode.getId() + " is of unknown type or null! ");
+ }
+ } else {
+ if (EA.j_ea instanceof J_EAConversionGasBurner || EA.j_ea instanceof J_EAConversionHeatPump || EA.j_ea instanceof J_EAConversionHydrogenBurner ) {
+ p_primaryHeatingAsset = (J_EAConversion)EA.j_ea ;
+ } else {
+ traceln("f_connectToChild in EnergyAsset: Exception! EnergyAsset " + ConnectingParentNode.getId() + " is of unknown type or null! ");
+ }
+ }
+
+}
+
+
+
+ VOID
+ double
+ 1665499506761
+ f_operateFixedConsumptionAssets_overwrite
+ true
+ 800
+ 220
+
+ false
+ true
+ true
+ switch( p_gridConnectionType ) {
+ case STEEL:
+ for(EnergyAsset ea : c_consumptionAssets) {
+ if( ea.p_energyAssetType == OL_EnergyAssetType.ELECTRICITY_DEMAND ) {
+ ea.f_updateElectricityFlows( main.v_currentIndustrySteelElectricityDemand_fr );
+ }
+ else if( ea.p_energyAssetType == OL_EnergyAssetType.HEAT_DEMAND ) {
+ ea.f_updateAllFlows( main.v_currentIndustrySteelHeatDemand_fr );
+ }
+ else {
+ ea.v_powerFraction_fr = 0; // To disable other asset
+ traceln("industry has other consumption assets than modeled so far");
+ }
+ }
+ break;
+ case INDUSTRY_OTHER:
+ for(EnergyAsset ea : c_consumptionAssets) {
+ if( ea.p_energyAssetType == OL_EnergyAssetType.ELECTRICITY_CONSUMPTION_PROFILE ) {
+ ea.f_updateElectricityFlows( main.v_currentIndustryOtherElectricityDemand_fr );
+ }
+ else if( ea.p_energyAssetType == OL_EnergyAssetType.HEAT_DEMAND ) {
+ ea.f_updateAllFlows( main.v_currentIndustryOtherHeatDemand_fr );
+ }
+ else {
+ ea.v_powerFraction_fr = 0; // To disable other asset
+ traceln("industry has other consumption assets than modeled so far");
+ }
+ }
+ break;
+ default:
+ traceln("industry not modeled so far");
+
+ break;
+}
+
+
+ VOID
+ double
+ 1665501255400
+ f_operateFlexAssets_overwrite
+ 800
+ 240
+
+ false
+ true
+ true
+ if(p_gridConnectionID.contains("agrohub")) {
+ f_operateFlexAssets_agroenergyhub();
+ for( J_EAStorage v : c_storageAssets ) {
+ //v_currentPowerElectricity_kW += v.electricityConsumption_kW - v.electricityProduction_kW;
+ v_conversionPowerElectric_kW += v.getLastFlows().get(OL_EnergyCarriers.ELECTRICITY);
+ //v_currentPowerMethane_kW += v.methaneConsumption_kW - v.methaneProduction_kW;
+ //v_currentPowerHydrogen_kW += v.hydrogenConsumption_kW - v.hydrogenProduction_kW;
+ //v_currentPowerHeat_kW += v.heatConsumption_kW - v.heatProduction_kW;
+ //v_currentPowerDiesel_kW += v.dieselConsumption_kW;
+ }
+
+ //traceln("Agroenergyhub logic!");
+} else {
+
+ // Determine house heating
+ f_manageHeatingAssets();
+
+}
+
+f_manageCharging();
+/*for( J_EAVehicle v: c_vehicleAssets) {
+ v_currentPowerElectricity_kW += v.electricityConsumption_kW - v.electricityProduction_kW;
+}*/
+
+if (p_batteryAsset != null){ // TEST CODE
+ if (p_batteryAsset.getStorageCapacity_kWh() > 0) {
+ //f_batteryManagementBalance(p_batteryAsset.getCurrentStateOfCharge());
+ f_batteryManagementNodalPricing();
+ p_batteryAsset.f_updateAllFlows();
+ //J_FlowsMap flowsMap = flowsPair.getFirst();
+ //traceln("flows:" + Arrays.toString(arr));
+ //v_batteryPowerElectric_kW = flowsMap.get(OL_EnergyCarriers.ELECTRICITY);
+ }
+}
+
+//v_currentLoadLowPassed_kW += v_lowPassFactorLoad_fr * ( v_currentPowerElectricity_kW - v_currentLoadLowPassed_kW ); //you want to do deterine the lowpassLoad BEFORE the using the battery. As this behavior of the battery should nog be dependent on the load of the battery in the previous timesteps
+
+//v_previousPowerMethane_kW = v_currentPowerMethane_kW;
+v_previousPowerMethane_kW = fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.METHANE);
+
+
+
+
+ VOID
+ double
+ 1684397492292
+ f_operateFlexAssets_agroenergyhub
+ 800
+ 510
+
+ false
+ true
+ true
+ double heatDemand_kW = (fm_currentConsumptionFlows_kW.get(OL_EnergyCarriers.HEAT) - fm_currentProductionFlows_kW.get(OL_EnergyCarriers.HEAT));
+double biogasSupply_kW = 0;
+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;
+ }
+}
+
+//traceln("BiogasSupply from mestvergister: " + biogasSupply_kW + " kW");
+//traceln("Heat demand agroenergyhub:" + heatDemand_kW);
+
+if ( p_secondaryHeatingAsset == null) { // Just one heating asset
+ if ( p_primaryHeatingAsset== null ) {
+ traceln("No heating assets for industry gridconnection " + p_gridConnectionID);
+ } else {
+ if ( p_primaryHeatingAsset instanceof J_EAConversionGasBurner || p_primaryHeatingAsset instanceof J_EAConversionHeatPump || p_primaryHeatingAsset instanceof J_EAConversionHydrogenBurner) { // when there is only a gas burner or DH set
+ p_primaryHeatingAsset.v_powerFraction_fr = min(1,heatDemand_kW / p_primaryHeatingAsset.getOutputCapacity_kW());
+ //traceln("Running manageHeatingAsset for single heating asset");
+ } else {
+ traceln("GridConnection " + p_gridConnectionID + " has a single unsupported heating asset!");
+ }
+ }
+} else { // Two heating assets
+ if ( p_primaryHeatingAsset instanceof J_EAConversionHeatPump & p_secondaryHeatingAsset instanceof J_EAConversionGasCHP) { // Heatpump and gasburner, switch based on heatpump COP)
+ //((J_EAConversionHeatPump)p_primaryHeatingAsset.j_ea).updateAmbientTemp(main.v_currentAmbientTemperature_degC); // update heatpump temp levels! <-- waarom dit gebeurt al in de main (peter 21-02-23)
+ double HP_COP = ((J_EAConversionHeatPump)p_primaryHeatingAsset).getCOP();
+ double HP_powerDemand_kW = heatDemand_kW / HP_COP;
+ // Decide to use CHP or HeatPump to fulfill heat demand based on 'SoC' of gasbuffer and current electricity use on site
+ if ( (-(fm_currentConsumptionFlows_kW.get(OL_EnergyCarriers.ELECTRICITY) - fm_currentProductionFlows_kW.get(OL_EnergyCarriers.ELECTRICITY)) > 0.5*v_liveConnectionMetaData.contractedFeedinCapacity_kW*2*(p_gasBuffer.getCurrentStateOfCharge_fr()-0.5) | p_gasBuffer.getCurrentStateOfCharge_fr() < 0.05) & p_gasBuffer.getCurrentStateOfCharge_fr() < 0.9) { // Use heatpump when it can be done selfsufficiently or when methane supply is zero
+ //traceln("HeatPump in operation with COP " + HP_COP);
+ p_secondaryHeatingAsset.v_powerFraction_fr = 0;
+ p_primaryHeatingAsset.v_powerFraction_fr = min(1,HP_powerDemand_kW / p_primaryHeatingAsset.getInputCapacity_kW());
+ } else { // CHP when there is no electricity surpluss or when gas tank is overfilling
+ //traceln("CHP capacityHeat_kW: " + p_primaryHeatingAsset.j_ea.getHeatCapacity_kW());
+ p_secondaryHeatingAsset.v_powerFraction_fr = min(1,heatDemand_kW / p_secondaryHeatingAsset.getOutputCapacity_kW());
+ //p_primaryHeatingAsset.v_powerFraction_fr = 0;//min(1,currentDHWdemand_kW / p_secondaryHeatingAsset.j_ea.getHeatCapacity_kW());
+ // Let heatpump fill heatdemand gap if it exists
+ p_primaryHeatingAsset.v_powerFraction_fr = max(0,min(1,(heatDemand_kW-p_secondaryHeatingAsset.v_powerFraction_fr*p_secondaryHeatingAsset.getOutputCapacity_kW()) / p_primaryHeatingAsset.getOutputCapacity_kW())); // Let gas burner fill the heatdemandgap
+ }
+ } else if ( p_primaryHeatingAsset instanceof J_EAConversionGasCHP & p_secondaryHeatingAsset instanceof J_EAConversionGasBurner) { // CHP & gas burner
+ if ( p_gasBuffer.getCurrentStateOfCharge_fr() < 0.05) { // Use regular gas burner when biogas buffer is nearly empty
+// if ( (-v_currentPowerElectricity_kW > 0.5*p_connectionCapacity_kW*2*(p_gasBuffer.j_ea.getCurrentStateOfCharge()-0.5) | p_gasBuffer.j_ea.getCurrentStateOfCharge() < 0.05) & p_gasBuffer.j_ea.getCurrentStateOfCharge() < 0.9) { // Use gas burner when biogas is depleted or when there is too much PV and CHP would lead to curtailment
+ //traceln("HeatPump in operation with COP " + HP_COP);
+ p_primaryHeatingAsset.v_powerFraction_fr = 0;
+ p_secondaryHeatingAsset.v_powerFraction_fr = min(1,heatDemand_kW / p_secondaryHeatingAsset.getOutputCapacity_kW());
+ } else { // CHP when there is sufficient biogas
+ //traceln("CHP capacityHeat_kW: " + p_primaryHeatingAsset.j_ea.getHeatCapacity_kW());
+ if ( p_gasBuffer.getCurrentStateOfCharge_fr() < 0.9 ) { // Biogas tank not full, allow reduced CHP power when it prevents curtailment.
+ p_primaryHeatingAsset.v_powerFraction_fr = min(min(1,heatDemand_kW / p_primaryHeatingAsset.getOutputCapacity_kW()),(v_liveConnectionMetaData.contractedFeedinCapacity_kW + (fm_currentConsumptionFlows_kW.get(OL_EnergyCarriers.ELECTRICITY) - fm_currentProductionFlows_kW.get(OL_EnergyCarriers.ELECTRICITY))) / p_primaryHeatingAsset.getInputCapacity_kW());
+ } else {
+ p_primaryHeatingAsset.v_powerFraction_fr = min(1,heatDemand_kW / p_primaryHeatingAsset.getOutputCapacity_kW());
+ //if ( p_gasBuffer.j_ea.getCurrentStateOfCharge() > 0.98 ) { // Biogas tank not full, allow reduced CHP power when it prevents curtailment.
+ // traceln("Biogas tank 98% full! must run CHP! Heat demand: " + heatDemand_kW + " kW");
+ //}
+ }
+ p_secondaryHeatingAsset.v_powerFraction_fr = max(0,min(1,(heatDemand_kW-p_primaryHeatingAsset.v_powerFraction_fr*p_primaryHeatingAsset.getOutputCapacity_kW()) / p_secondaryHeatingAsset.getOutputCapacity_kW())); // Let gas burner fill the heatdemandgap
+ }
+ } else if ( p_primaryHeatingAsset instanceof J_EAConversionHeatPump & p_secondaryHeatingAsset instanceof J_EAConversionGasBurner) { // Heatpump and gasburner, switch based on heatpump COP)
+ //((J_EAConversionHeatPump)p_primaryHeatingAsset.j_ea).updateAmbientTemp(main.v_currentAmbientTemperature_degC); // update heatpump temp levels! <-- waarom dit gebeurt al in de main (peter 21-02-23)
+ //double HP_COP = ((J_EAConversionHeatPump)p_primaryHeatingAsset.j_ea).getCOP();
+ //double HP_powerDemand_kW = heatDemand_kW / HP_COP;
+ p_primaryHeatingAsset.v_powerFraction_fr = min(1,heatDemand_kW / p_primaryHeatingAsset.getOutputCapacity_kW());
+ p_secondaryHeatingAsset.v_powerFraction_fr = max(0,min(1,(heatDemand_kW-p_primaryHeatingAsset.v_powerFraction_fr*p_primaryHeatingAsset.getOutputCapacity_kW()) / p_secondaryHeatingAsset.getOutputCapacity_kW())); // Let gas burner fill the heatdemandgap
+ } else {
+ traceln("**** EXCEPTION ****: Unsupported combination of heatings systems in GridConnection " + p_gridConnectionID);
+ p_primaryHeatingAsset.v_powerFraction_fr = 0;
+ p_secondaryHeatingAsset.v_powerFraction_fr = 0;
+ //p_BuildingThermalAsset.v_powerFraction_fr = 0;
+ }
+ p_secondaryHeatingAsset.f_updateAllFlows(p_secondaryHeatingAsset.v_powerFraction_fr);
+}
+if (p_primaryHeatingAsset != null) {
+ p_primaryHeatingAsset.f_updateAllFlows(p_primaryHeatingAsset.v_powerFraction_fr);
+}
+
+if (p_gasBuffer != null) {
+// if (p_secondaryHeatingAsset != null) {
+// p_gasBuffer.v_powerFraction_fr = (biogasSupply_kW - p_primaryHeatingAsset.v_currentConsumptionMethane_kW - p_secondaryHeatingAsset.v_currentConsumptionMethane_kW)/p_gasBuffer.j_ea.getGasCapacity_kW();
+// } else {
+ if (p_primaryHeatingAsset instanceof J_EAConversionGasCHP) {
+ p_gasBuffer.v_powerFraction_fr = (biogasSupply_kW - p_primaryHeatingAsset.getLastFlows().get(OL_EnergyCarriers.METHANE)) / p_gasBuffer.getCapacityGas_kW();
+ } else if (p_secondaryHeatingAsset != null) {
+ if (p_secondaryHeatingAsset instanceof J_EAConversionGasCHP) {
+ p_gasBuffer.v_powerFraction_fr = (biogasSupply_kW - p_secondaryHeatingAsset.getLastFlows().get(OL_EnergyCarriers.METHANE)) / p_gasBuffer.getCapacityGas_kW();
+ }
+ }
+// }
+ p_gasBuffer.f_updateAllFlows(p_gasBuffer.v_powerFraction_fr);
+}
+
+/*if (p_curtailer != null) {
+ //traceln("Hello! " + CurtailerAsset.j_ea.getElectricCapacity_kW());
+ if (p_curtailer.getElectricCapacity_kW()>0) {
+ double curtailerSetpointElectric_kW = 0.0;
+ if ( p_primaryHeatingAsset instanceof J_EAConversionGasCHP ) {
+ curtailerSetpointElectric_kW = -min(0,v_currentPowerElectricity_kW - p_primaryHeatingAsset.heatProduction_kW + p_connectionCapacity_kW);
+ } else {
+ curtailerSetpointElectric_kW = -min(0,v_currentPowerElectricity_kW + p_connectionCapacity_kW);
+ }
+ p_curtailer.f_updateAllFlows(curtailerSetpointElectric_kW/p_curtailer.getElectricCapacity_kW());
+ }
+}*/
+
+
+ VOID
+ double
+ 1684940409126
+ f_manageCurtailer
+ true
+ 830
+ 530
+
+ false
+ true
+ true
+
+ CurtailerAsset
+ EnergyAsset
+
+ //traceln("Hello! " + CurtailerAsset.j_ea.getElectricCapacity_kW());
+if (CurtailerAsset.j_ea.getElectricCapacity_kW()>0) {
+ double curtailerSetpointElectric_kW = -min(0,v_currentPowerElectricity_kW + p_connectionCapacity_kW);
+ CurtailerAsset.f_updateAllFlows(curtailerSetpointElectric_kW/CurtailerAsset.j_ea.getElectricCapacity_kW());
+
+ /*if ( curtailerSetpointElectric_kW > 0 ) {
+ traceln("Windfarm is curtailing " + curtailerSetpointElectric_kW + " kW!");
+ }*/
+}
+
+
+ VOID
+ double
+ 1693299907029
+ f_connectTo_J_EA_Industry
+ 950
+ 90
+
+ false
+ true
+ true
+
+ j_ea
+ J_EA
+
+
+if (j_ea instanceof J_EAConversion) {
+ c_conversionAssets.add((J_EAConversion)j_ea);
+ if(p_gridConnectionID.contains("agrohub")) {
+
+ if (j_ea instanceof J_EAConversionGasBurner || j_ea instanceof J_EAConversionHydrogenBurner) {
+ if (p_primaryHeatingAsset == null) {
+ p_primaryHeatingAsset = (J_EAConversion)j_ea ;
+ } else if ( p_primaryHeatingAsset!=j_ea ) {
+ p_secondaryHeatingAsset = (J_EAConversion)j_ea ;
+ }
+ } else if ( j_ea instanceof J_EAConversionHeatPump || j_ea instanceof J_EAConversionGasCHP) {
+ if (p_primaryHeatingAsset==null) {
+ p_primaryHeatingAsset = (J_EAConversion)j_ea;
+ } else {
+ p_secondaryHeatingAsset = p_primaryHeatingAsset;
+ p_primaryHeatingAsset = (J_EAConversion)j_ea;
+ }
+ if (j_ea instanceof J_EAConversionHeatPump) {
+ ((J_EAConversionHeatPump)p_primaryHeatingAsset).outputTemperature_degC = 80; // For pastorizing milk
+ }
+ //traceln("heatingAsset class " + p_spaceHeatingAsset.getClass().toString());
+ //} else if (j_ea instanceof J_EAConversionCurtailer) {
+ // p_curtailer = (J_EAConversionCurtailer)j_ea ;
+ } else {
+ traceln("f_connectToChild in EnergyAsset: Exception! EnergyAsset " + j_ea + " is of unknown type or null! ");
+ }
+ } else {
+ if (j_ea instanceof J_EAConversionGasBurner || j_ea instanceof J_EAConversionHeatPump || j_ea instanceof J_EAConversionHydrogenBurner ) {
+ if (p_primaryHeatingAsset == null) {
+ p_primaryHeatingAsset = (J_EAConversion)j_ea ;
+ } else if ( p_primaryHeatingAsset!=j_ea ) {
+ p_secondaryHeatingAsset = (J_EAConversion)j_ea ;
+ }
+ } else {
+ traceln("f_connectToChild in EnergyAsset: Exception! EnergyAsset " + j_ea + " is of unknown type or null! ");
+ }
+ }
+}
+
+
+
+
+
+
+
+
+ 1665480522859
+ connections
+ 50
+ -50
+
+ false
+ true
+ true
+ false
+ COLLECTION_OF_LINKS
+ true
+ Object
+ SOLID
+ 1
+ -16777216
+ UNDER_AGENTS
+ NONE
+ END
+
+
+
+
+ 1665480522863
+ level
+ 0
+ 0
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ 0
+ DIM_NON_CURRENT
+
+
+
+
+ 1718724980083
+ GCNeighborhood
+ @Override
+public void f_operateFlexAssets(){
+ f_operateFlexAssets_overwrite();
+}
+
+/*
+@Override
+public void f_resetSpecificGCStatesAfterRapidRun(){
+ f_resetSpecificGCStatesAfterRapidRun_override();
+}
+*/
+
+@Override
+public void f_resetSpecificGCStates(){
+ f_resetSpecificGCStates_override();
+}
+ 1752677823817
+
+ zero_engine
+ GridConnection
+
+
+
+ p_parentNodeElectricID
+
+
+ p_gridConnectionID
+
+
+ p_parentNodeHeatID
+
+
+ p_BuildingThermalAsset
+
+
+ p_ownerID
+
+
+ p_batteryAsset
+
+
+ p_electrolyserOperationMode
+
+
+ p_heatBuffer
+
+
+ p_gasBuffer
+
+
+ p_cookingTracker
+
+
+ p_energyLabel
+
+
+ p_DHWAsset
+
+
+ p_longitude
+
+
+ p_latitude
+
+
+ p_floorSurfaceArea_m2
+
+
+ p_GISPoint
+
+
+ p_owner
+
+
+ p_roofSurfaceArea_m2
+
+
+ p_purposeBAG
+
+
+ p_name
+
+
+ p_curtailmentMode
+
+
+ p_address
+
+
+ p_parentNodeHeat
+
+
+ p_parentNodeElectric
+
+
+ v_isActive
+
+
+ p_uid
+
+
+ false
+
+ 1718724980089
+ 1718724980089
+
+ T extends Agent
+
+ Generic parameter:
+
+ ENTITY
+ 100
+ false
+ 100
+ true
+
+ -4144960
+ null
+
+ true
+ true
+ false
+
+ 10
+ MPS
+
+
+ 1
+ METER
+
+
+ 1
+ METER
+
+
+ 1
+ METER
+
+
+
+ false
+
+ 1.0
+ SECOND
+
+ CONTINUOUS
+ 500
+ 500
+ 0
+ 100
+ 100
+ MOORE
+ USER_DEF
+ USER_DEF
+ 2
+ 50
+ 0.95
+ 10
+
+
+ true
+ 1658477089952
+ true
+ 1718784000000
+
+ 0
+ HOUR
+
+
+ 1
+ HOUR
+
+
+
+ 1718724980086
+ scale
+ 0
+ -150
+ false
+ false
+ false
+ SHAPE_DRAW_2D3D
+ 100
+ 0
+ BASED_ON_LENGTH
+ 10
+ METER
+ 10
+ true
+
+ 1718724980090
+ 1718724980084
+
+
+ 1722514794122
+ v_amountOfGasBurners_services_fr
+ true
+ 1690
+ 80
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1722514798317
+ v_amountOfHybridHeatpump_services_fr
+ true
+ 1690
+ 100
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1722514800696
+ v_amountOfElectricHeatpumps_services_fr
+ true
+ 1690
+ 120
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1722514802997
+ v_amountOfDistrictHeating_services_fr
+ true
+ 1690
+ 140
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1722514805108
+ v_amountOfGasBurners_houses_fr
+ true
+ 1690
+ 220
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1722514809527
+ v_amountOfHybridHeatpump_houses_fr
+ true
+ 1690
+ 240
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1722514811890
+ v_amountOfElectricHeatpumps_houses_fr
+ true
+ 1690
+ 260
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1722514815083
+ v_amountOfDistrictHeating_houses_fr
+ true
+ 1690
+ 280
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1724397994084
+ v_nbCurrentHouseholdsWithBattery
+ true
+ 2300
+ 450
+
+ false
+ true
+ true
+
+ int
+
+
+
+ 1732636587634
+ v_amountOfGasBurners_industry_fr
+ true
+ 2170
+ 60
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1732636587636
+ v_amountOfHybridHeatpump_industry_fr
+ true
+ 2170
+ 80
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1732636587638
+ v_amountOfElectricHeatpumps_industry_fr
+ true
+ 2170
+ 100
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1732636587640
+ v_amountOfDistrictHeating_industry_fr
+ true
+ 2170
+ 120
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1732636587642
+ v_amountOfHydrogenUseForHeating_industry_fr
+ true
+ 2170
+ 160
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1732636647667
+ v_amountOfGasBurners_agriculture_fr
+ true
+ 2170
+ 220
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1732636647669
+ v_amountOfHybridHeatpump_agriculture_fr
+ true
+ 2170
+ 240
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1732636647671
+ v_amountOfElectricHeatpumps_agriculture_fr
+ true
+ 2170
+ 260
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1732636647673
+ v_amountOfDistrictHeating_agriculture_fr
+ true
+ 2170
+ 280
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1733992320729
+ v_SOC_setp_fr_offset_balance
+ 1680
+ 490
+
+ false
+ true
+ true
+
+ double
+
+ 0.6
+
+
+
+
+ 1733992537947
+ v_FeedbackGain_kWpSOC_factor_balance
+ 1680
+ 510
+
+ false
+ true
+ true
+
+ double
+
+ 0.4
+
+
+
+
+ 1733992922419
+ v_SOC_setp_fr_price
+ 2120
+ 490
+
+ false
+ true
+ true
+
+ double
+
+ 0.5
+
+
+
+
+ 1733993584071
+ v_priceGain_kWhpeur
+ 2120
+ 510
+
+ false
+ true
+ true
+
+ double
+
+ 2
+
+
+
+
+ 1734716021367
+ v_batteryMoneyMade_euro
+ 1250
+ 630
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1738663322715
+ v_amountOfLowTempHeatgrid_services_fr
+ true
+ 1690
+ 160
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1738663467936
+ v_amountOfLowTempHeatgrid_houses_fr
+ true
+ 1690
+ 300
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1752589060012
+ v_currentLoadLowPassed_kW
+ 1270
+ 450
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1722588367044
+ p_thresholdCOP_hybridHeatpump
+ Threshold for when the gas burner needs to kick in in a hybrid heatpump system
+ true
+ 1720
+ 360
+
+ false
+ true
+ true
+
+ double
+ NONE
+ false
+
+ 3.5
+
+
+ 1722588367042
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1729069223731
+ p_nbCompaniesTotal
+ 1680
+ 840
+
+ false
+ true
+ true
+
+ int
+ NONE
+ false
+
+ 1729069223729
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1729069237070
+ p_nbHouseholds
+ 1680
+ 820
+
+ false
+ true
+ true
+
+ int
+ NONE
+ false
+
+ 1729069237068
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1730911077796
+ p_municipalityCode
+ 1680
+ 930
+
+ false
+ true
+ true
+
+ String
+ NONE
+ false
+
+ 1730911077794
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1732637253709
+ p_nbServices
+ 1700
+ 860
+
+ false
+ true
+ true
+
+ int
+ NONE
+ false
+
+ 1732637253707
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1732637257024
+ p_nbIndustry
+ 1700
+ 880
+
+ false
+ true
+ true
+
+ int
+ NONE
+ false
+
+ 1732637257022
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1732637259177
+ p_nbAgriculture
+ 1700
+ 900
+
+ false
+ true
+ true
+
+ int
+ NONE
+ false
+
+ 1732637259175
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1736870299796
+ p_ignoreGridCapacityBattery
+ 1680
+ 540
+
+ false
+ true
+ true
+
+ boolean
+ NONE
+ false
+
+ false
+
+
+ 1736870299794
+ CHECK_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1736933490243
+ p_chpAsset
+ 600
+ 430
+
+ false
+ true
+ true
+
+ J_EAConversionGasCHP
+ NONE
+ false
+
+ 1736933490241
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1722589144737
+ c_heatDemandEA
+ true
+ 1690
+ 390
+
+ false
+ true
+ true
+
+ LinkedHashMap
+ String
+ J_EAConsumption
+
+
+
+
+
+ VOID
+ double
+ 1719849166911
+ f_operateFlexAssets_overwrite
+ 910
+ 220
+
+ false
+ true
+ true
+ //Manage the heating assets
+
+f_manageHeating();
+
+f_manageEVCharging();
+
+//v_lowPassFactorLoad_fr = 0.003; // Vastgezet voor de NBHs
+//v_currentLoadLowPassed_kW += v_lowPassFactorLoad_fr * ( fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.ELECTRICITY) - v_currentLoadLowPassed_kW ); //you want to do determine the lowpassLoad BEFORE the using the battery. As this behavior of the battery should nog be dependent on the load of the battery in the previous timesteps
+
+f_manageBattery();
+
+
+ VOID
+ double
+ 1722514612938
+ f_setHeatingMethodPct_services
+ true
+ 1690
+ 60
+
+ false
+ true
+ true
+
+ pctArray
+ double[]
+
+ v_amountOfGasBurners_services_fr = pctArray[0]/100;
+v_amountOfElectricHeatpumps_services_fr = pctArray[1]/100;
+v_amountOfHybridHeatpump_services_fr = pctArray[2]/100;
+v_amountOfDistrictHeating_services_fr = pctArray[3]/100;
+v_amountOfLowTempHeatgrid_services_fr = pctArray[4]/100;
+
+
+
+ VOID
+ double
+ 1722514620314
+ f_setHeatingMethodPct_houses
+ true
+ 1690
+ 200
+
+ false
+ true
+ true
+
+ pctArray
+ double[]
+
+ v_amountOfGasBurners_houses_fr = pctArray[0]/100;
+v_amountOfElectricHeatpumps_houses_fr = pctArray[1]/100;
+v_amountOfHybridHeatpump_houses_fr = pctArray[2]/100;
+v_amountOfDistrictHeating_houses_fr = pctArray[3]/100;
+v_amountOfLowTempHeatgrid_houses_fr = pctArray[4]/100;
+
+
+
+ VOID
+ double
+ 1722585552607
+ f_manageHeatingAssets_overwrite
+ true
+ 1760
+ -20
+
+ false
+ true
+ true
+ if(p_primaryHeatingAsset == null){ // null check, as certain neighborhoods don't have thermal assets (fix dat niet elke tijdstep wordt aangeroepen)!
+ return;
+}
+
+//Division of the power demand //{Gasburner power request, HP power request, DH power request, Hydrogenburner power request}
+double powerDemandDivision_kW[] = f_dividePowerDemandHeatingAssets();
+
+//Split the power fractions (powerDemandDivision[] = {Gasburner power request, HP power request, DH power request}
+if(p_primaryHeatingAsset.getOutputCapacity_kW() != 0){
+ double powerFraction_GASBURNER = powerDemandDivision_kW[0] / p_primaryHeatingAsset.getOutputCapacity_kW();
+ p_primaryHeatingAsset.v_powerFraction_fr = powerFraction_GASBURNER;
+
+ //Gas burner control (always assigned to primary heating asset)
+ p_primaryHeatingAsset.f_updateAllFlows(powerFraction_GASBURNER);
+}
+if(p_secondaryHeatingAsset.getOutputCapacity_kW() != 0){
+ double powerFraction_HEATPUMP = powerDemandDivision_kW[1] / p_secondaryHeatingAsset.getOutputCapacity_kW();
+ p_secondaryHeatingAsset.v_powerFraction_fr = powerFraction_HEATPUMP;
+
+ //Heatpump control (always assigned to secondary heating asset)
+ p_secondaryHeatingAsset.f_updateAllFlows(powerFraction_HEATPUMP);
+}
+if(p_tertiaryHeatingAsset.getOutputCapacity_kW() != 0){
+ double powerFraction_HEATDELIVERYSET = powerDemandDivision_kW[2] / p_tertiaryHeatingAsset.getOutputCapacity_kW();
+ p_tertiaryHeatingAsset.v_powerFraction_fr = powerFraction_HEATDELIVERYSET;
+
+ //Heat delivery set control (always assigned to tertiary heating asset)
+ p_tertiaryHeatingAsset.f_updateAllFlows(powerFraction_HEATDELIVERYSET);
+
+ //Update districtheating variable
+ v_districtHeatDelivery_kW = powerDemandDivision_kW[2]/p_tertiaryHeatingAsset.getEta_r();
+}
+if(p_quaternaryHeatingAsset.getOutputCapacity_kW() != 0){
+ double powerFraction_HYDROGENBURNER = powerDemandDivision_kW[3] / p_quaternaryHeatingAsset.getOutputCapacity_kW();
+ p_quaternaryHeatingAsset.v_powerFraction_fr = powerFraction_HYDROGENBURNER;
+
+ //Hydrogen burner(always assigned to quaternary heating asset)
+ p_quaternaryHeatingAsset.f_updateAllFlows(powerFraction_HYDROGENBURNER);
+}
+if(p_quinaryHeatingAsset.getOutputCapacity_kW() != 0){
+ double powerFraction_LOWTEMPHEATGRID = powerDemandDivision_kW[4] / p_quinaryHeatingAsset.getOutputCapacity_kW();
+ p_quinaryHeatingAsset.v_powerFraction_fr = powerFraction_LOWTEMPHEATGRID;
+
+ //Hydrogen burner(always assigned to quaternary heating asset)
+ p_quinaryHeatingAsset.f_updateAllFlows(powerFraction_LOWTEMPHEATGRID);
+}
+
+
+ RETURNS_VALUE
+ double[]
+ 1722587530130
+ f_dividePowerDemandHeatingAssets
+ true
+ 1690
+ 340
+
+ false
+ true
+ true
+ //Initialize power demand division array
+double powerDemandDivision_kW[] = {0, 0, 0, 0, 0}; // {Gasburner power request, HP power request, DH power request, Hydrogenburner power request, lowTempHeatgridPowerDemand}
+
+//Calculate fraction of total heat demand delivered by the CHP
+/*
+double powerDemand_kW = fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.HEAT);
+double fractionOfTotalHeatDemandDeliveredyByCHP = max(0,p_chpAsset.getLastFlows().get(OL_EnergyCarriers.HEAT))/powerDemand_kW;
+double remainingFraction = fractionOfTotalHeatDemandDeliveredyByCHP;
+*/
+//Demanded total heating power at the current time step
+//double powerDemand_kW = fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.HEAT);
+
+//Demanded heating power for companies and household seperatly the current time step
+double powerDemand_households_kW = max(0,c_heatDemandEA.get("HOUSEHOLDS").getLastFlows().get(OL_EnergyCarriers.HEAT));
+double powerDemand_agriculture_kW = max(0,c_heatDemandEA.get("AGRICULTURE").getLastFlows().get(OL_EnergyCarriers.HEAT));
+double powerDemand_industry_kW = max(0,c_heatDemandEA.get("INDUSTRY").getLastFlows().get(OL_EnergyCarriers.HEAT));
+double powerDemand_services_kW = max(0,c_heatDemandEA.get("SERVICES").getLastFlows().get(OL_EnergyCarriers.HEAT));
+
+//Divide the powerdemand per heating type
+double gasBurnerPowerDemand_kW = powerDemand_households_kW*v_amountOfGasBurners_houses_fr +
+ powerDemand_agriculture_kW*v_amountOfGasBurners_agriculture_fr +
+ powerDemand_industry_kW*v_amountOfGasBurners_industry_fr +
+ powerDemand_services_kW*v_amountOfGasBurners_services_fr;
+
+double electricHPPowerDemand_kW = powerDemand_households_kW*v_amountOfElectricHeatpumps_houses_fr +
+ powerDemand_agriculture_kW*v_amountOfElectricHeatpumps_agriculture_fr +
+ powerDemand_industry_kW*v_amountOfElectricHeatpumps_industry_fr +
+ powerDemand_services_kW*v_amountOfElectricHeatpumps_services_fr;
+
+double hybridHPPowerDemand_kW = powerDemand_households_kW*v_amountOfHybridHeatpump_houses_fr +
+ powerDemand_agriculture_kW*v_amountOfHybridHeatpump_agriculture_fr +
+ powerDemand_industry_kW*v_amountOfHybridHeatpump_industry_fr +
+ powerDemand_services_kW*v_amountOfHybridHeatpump_services_fr;
+
+double districtHeatingPowerDemand_kW = powerDemand_households_kW*v_amountOfDistrictHeating_houses_fr +
+ powerDemand_agriculture_kW*v_amountOfDistrictHeating_agriculture_fr +
+ powerDemand_industry_kW*v_amountOfDistrictHeating_industry_fr +
+ powerDemand_services_kW*v_amountOfDistrictHeating_services_fr;
+
+double hydrogenBurnerPowerDemand_kW = powerDemand_industry_kW*v_amountOfHydrogenUseForHeating_industry_fr;
+
+double lowTempHeatgridPowerDemand_kW = powerDemand_households_kW*v_amountOfLowTempHeatgrid_houses_fr +
+ powerDemand_services_kW*v_amountOfLowTempHeatgrid_services_fr;
+//double lowTempHeatgridPowerDemand_kW = (powerDemand_households_kW + powerDemand_agriculture_kW + powerDemand_industry_kW + powerDemand_services_kW) - hybridHPPowerDemand - electricHPPowerDemand - gasBurnerPowerDemand - districtHeatingPowerDemand - hydrogenBurnerPowerDemand; // To make sure all power demand is met
+
+//Get the current Heatpump COP
+double HP_COP = ((J_EAConversionHeatPump)p_secondaryHeatingAsset).getCOP();
+
+if ( HP_COP < p_thresholdCOP_hybridHeatpump ) { // switch to gasburner when HP COP is below treshold
+ powerDemandDivision_kW[0] = max(0, gasBurnerPowerDemand_kW + hybridHPPowerDemand_kW);
+ powerDemandDivision_kW[1] = max(0, electricHPPowerDemand_kW);
+}
+else{
+ powerDemandDivision_kW[0] = max(0, gasBurnerPowerDemand_kW);
+ powerDemandDivision_kW[1] = max(0, electricHPPowerDemand_kW + hybridHPPowerDemand_kW);
+}
+powerDemandDivision_kW[2] = max(0, districtHeatingPowerDemand_kW);
+powerDemandDivision_kW[3] = max(0, hydrogenBurnerPowerDemand_kW);
+powerDemandDivision_kW[4] = max(0, lowTempHeatgridPowerDemand_kW);
+
+return powerDemandDivision_kW; //{Gasburner power request, HP power request, DH power request, Hydrogenburner power request, lowTempHeatgridPowerDemand};
+
+
+ VOID
+ double
+ 1722595238227
+ f_connectToJ_EA_default_overwrite_OUD
+ true
+ 1110
+ -20
+
+ false
+ true
+ true
+
+ j_ea
+ J_EA
+
+ energyModel.c_energyAssets.add(j_ea);
+c_energyAssets.add(j_ea);
+
+if (j_ea instanceof J_EAVehicle) {
+ J_EAVehicle vehicle = (J_EAVehicle)j_ea;
+ if (vehicle instanceof J_EADieselVehicle) {
+ c_dieselVehicles.add( (J_EADieselVehicle)vehicle );
+ } else if (vehicle instanceof J_EAHydrogenVehicle) {
+ c_hydrogenVehicles.add((J_EAHydrogenVehicle)vehicle);
+ } else if (vehicle instanceof J_EAEV) {
+ c_vehiclesAvailableForCharging.add((J_EAEV)vehicle);
+ energyModel.c_EVs.add((J_EAEV)vehicle);
+ }
+ c_vehicleAssets.add(vehicle);
+ J_ActivityTrackerTrips tripTracker = vehicle.getTripTracker();
+ if (tripTracker == null) { // Only provide tripTracker when vehicle doesn't have it yet!
+ if (vehicle.energyAssetType == OL_EnergyAssetType.ELECTRIC_TRUCK || vehicle.energyAssetType == OL_EnergyAssetType.DIESEL_TRUCK || vehicle.energyAssetType == OL_EnergyAssetType.HYDROGEN_TRUCK) {
+ int rowIndex = uniform_discr(1, 7);//getIndex() % 200;
+ tripTracker = new J_ActivityTrackerTrips(energyModel, energyModel.p_truckTripsExcel, rowIndex, energyModel.t_h*60, vehicle);
+ } else if (vehicle.energyAssetType == OL_EnergyAssetType.DIESEL_VAN || vehicle.energyAssetType == OL_EnergyAssetType.ELECTRIC_VAN || vehicle.energyAssetType == OL_EnergyAssetType.HYDROGEN_VAN) {// No mobility pattern for business vans available yet!! Falling back to truck mobility pattern
+ int rowIndex = uniform_discr(1, 7);//getIndex() % 200;
+ tripTracker = new J_ActivityTrackerTrips(energyModel, energyModel.p_truckTripsExcel, rowIndex, energyModel.t_h*60, vehicle);
+ } else {
+ //traceln("Adding passenger vehicle to gridconnection %s", this);
+ int rowIndex = uniform_discr(0, 200);//getIndex() % 200;
+ tripTracker = new J_ActivityTrackerTrips(energyModel, energyModel.p_householdTripsExcel, rowIndex, energyModel.t_h*60, vehicle);
+ //tripTracker = new J_ActivityTrackerTrips(energyModel, energyModel.p_householdTripsExcel, 18, energyModel.t_h*60, vehicle);
+ //int rowIndex = uniform_discr(1, 7);//getIndex() % 200;
+ //tripTracker = new J_ActivityTrackerTrips(energyModel, energyModel.p_truckTripsExcel, 2, energyModel.t_h*60, vehicle);
+ }
+
+ vehicle.tripTracker = tripTracker;
+ }
+ c_tripTrackers.add( tripTracker );
+ v_vehicleIndex ++;
+} else if (j_ea instanceof J_EAConsumption) {
+ c_consumptionAssets.add((J_EAConsumption)j_ea);
+ if (j_ea.energyAssetType == OL_EnergyAssetType.HOT_WATER_CONSUMPTION) {
+ p_DHWAsset = (J_EAConsumption)j_ea;
+ }
+} else if (j_ea instanceof J_EAProduction) {
+ c_productionAssets.add((J_EAProduction)j_ea);
+ //energyModel.c_productionAssets.add((J_EAProduction)j_ea);
+
+ if (j_ea.energyAssetType == OL_EnergyAssetType.PHOTOVOLTAIC) {
+ v_hasPV = true;
+ v_totalInstalledPVPower_kW += ((J_EAProduction)j_ea).getCapacityElectric_kW();
+ if (l_parentNodeElectric.getConnectedAgent() != null) {
+ l_parentNodeElectric.getConnectedAgent().v_totalInstalledPVPower_kW += ((J_EAProduction)j_ea).getCapacityElectric_kW();
+ }
+ energyModel.v_totalInstalledPVPower_kW += ((J_EAProduction)j_ea).getCapacityElectric_kW();
+ }
+ else if (j_ea.energyAssetType == OL_EnergyAssetType.WINDMILL) {
+ v_totalInstalledWindPower_kW += ((J_EAProduction)j_ea).getCapacityElectric_kW();
+ if (l_parentNodeElectric.getConnectedAgent() != null) {
+ l_parentNodeElectric.getConnectedAgent().v_totalInstalledWindPower_kW += ((J_EAProduction)j_ea).getCapacityElectric_kW();
+ }
+ energyModel.v_totalInstalledWindPower_kW += ((J_EAProduction)j_ea).getCapacityElectric_kW();
+ }
+} else if (j_ea instanceof J_EAConversion) {
+ c_conversionAssets.add((J_EAConversion)j_ea);
+ if ( j_ea.energyAssetType == OL_EnergyAssetType.GAS_PIT | j_ea.energyAssetType == OL_EnergyAssetType.ELECTRIC_HOB){
+ //traceln("Adding HOB to house" + this);
+ if (p_cookingTracker == null) {
+ //traceln("Adding cookingTracker to house" + this);
+ int rowIndex = uniform_discr(2, 300);
+ p_cookingTracker = new J_ActivityTrackerCooking(energyModel.p_cookingPatternExcel, rowIndex, energyModel.t_h*60, (J_EAConversion)j_ea );
+ } else {
+ p_cookingTracker.HOB = (J_EAConversion)j_ea;
+ }
+ } else if (j_ea instanceof J_EAConversionGasBurner) {
+ p_primaryHeatingAsset = (J_EAConversion)j_ea;
+ } else if (j_ea instanceof J_EAConversionHeatPump) {
+ energyModel.c_ambientAirDependentAssets.add(j_ea);
+ p_secondaryHeatingAsset = (J_EAConversion)j_ea;
+ //} else if (j_ea instanceof J_EAConversionHydrogenBurner) {
+ // p_primaryHeatingAsset = (J_EAConversion)j_ea;
+ } else if (j_ea instanceof J_EAConversionHydrogenBurner) {
+ p_tertiaryHeatingAsset = (J_EAConversion)j_ea;
+ //} else if (j_ea instanceof J_EAConversionCurtailer) {
+ // p_curtailer = (J_EAConversionCurtailer)j_ea;
+ }
+} else if (j_ea instanceof J_EAStorage) {
+ c_storageAssets.add((J_EAStorage)j_ea);
+ energyModel.c_storageAssets.add((J_EAStorage)j_ea);
+ if (j_ea.energyAssetType == OL_EnergyAssetType.BUILDINGTHERMALS) {
+ //traceln("Adding buildingThermals to gridconnection");
+ p_BuildingThermalAsset = (J_EABuilding)j_ea;
+ /*if ( p_energyLabel != null & p_gridConnectionType != null){ // Get building thermals from lookup table when isolation label and house type are available
+ double lossFactor_WpK2 = energyModel.v_buildingThermalPars.path( p_gridConnectionType.name() ).path(p_energyLabel.name()).path("lossFactor_WpK").doubleValue();
+ double heatCapacity_JpK2 = energyModel.v_buildingThermalPars.path( p_gridConnectionType.name() ).path(p_energyLabel.name()).path("heatCapacity_JpK").doubleValue();
+ p_BuildingThermalAsset.lossFactor_WpK = lossFactor_WpK2;
+ p_BuildingThermalAsset.heatCapacity_JpK = heatCapacity_JpK2;
+ traceln("House thermal model updated!");
+ traceln("House type: %s, energy label: %s", p_gridConnectionType, p_energyLabel);
+ traceln("lossfactor %s, heatcapacity %s", lossFactor_WpK2, heatCapacity_JpK2);
+ }*/ // Deprecated get lossfactor and heatcapacity from json-input. Replace with other datasource!
+ p_BuildingThermalAsset.updateAmbientTemperature( energyModel.v_currentAmbientTemperature_degC );
+ //v_tempSetpoint_degC = p_BuildingThermalAsset.setTemperature_degC;
+ energyModel.c_ambientAirDependentAssets.add(p_BuildingThermalAsset);
+ } else if (j_ea instanceof J_EAStorageGas) {
+ p_gasBuffer = (J_EAStorageGas)j_ea;
+ } else if (j_ea instanceof J_EAStorageElectric) {
+ p_batteryAsset = (J_EAStorageElectric)j_ea;
+ } else if (j_ea instanceof J_EAStorageHeat) {
+ energyModel.c_ambientAirDependentAssets.add(j_ea);
+ }
+} else if (j_ea instanceof J_EAProfile) {
+ //p_energyProfile = (J_EAProfile)j_ea;
+ c_profileAssets.add((J_EAProfile)j_ea);
+} else {
+ traceln("Unrecognized energy asset %s in gridconnection %s", j_ea, this);
+}
+
+
+
+ VOID
+ double
+ 1730370456790
+ f_connectToJ_EA_default_overwrite
+ true
+ 1760
+ -40
+
+ false
+ true
+ true
+
+ j_ea
+ J_EA
+
+ for (OL_EnergyCarriers EC : j_ea.getActiveConsumptionEnergyCarriers()) {
+ if (!v_activeConsumptionEnergyCarriers.contains(EC)) {
+ v_activeEnergyCarriers.add(EC);
+ v_activeConsumptionEnergyCarriers.add(EC);
+
+ if (energyModel.b_isInitialized) {
+ //Add EC to energyModel
+ energyModel.f_addConsumptionEnergyCarrier(EC);
+
+ //Initialize dataset
+ DataSet dsDemand = new DataSet( (int)(168 / energyModel.p_timeStep_h) );
+ double startTime = v_liveData.dsm_liveDemand_kW.get(OL_EnergyCarriers.ELECTRICITY).getXMin();
+ double endTime = v_liveData.dsm_liveDemand_kW.get(OL_EnergyCarriers.ELECTRICITY).getXMax();
+ for (double t = startTime; t <= endTime; t += energyModel.p_timeStep_h) {
+ dsDemand.add( t, 0);
+ }
+ v_liveData.dsm_liveDemand_kW.put( EC, dsDemand);
+ }
+ }
+}
+
+for (OL_EnergyCarriers EC : j_ea.getActiveProductionEnergyCarriers()) {
+ if (!v_activeProductionEnergyCarriers.contains(EC)) {
+ v_activeEnergyCarriers.add(EC);
+ v_activeProductionEnergyCarriers.add(EC);
+ if (energyModel.b_isInitialized) {
+
+ //Add EC to energyModel
+ energyModel.f_addProductionEnergyCarrier(EC);
+
+ //Initialize datasets
+ DataSet dsSupply = new DataSet( (int)(168 / energyModel.p_timeStep_h) );
+ double startTime = v_liveData.dsm_liveDemand_kW.get(OL_EnergyCarriers.ELECTRICITY).getXMin();
+ double endTime = v_liveData.dsm_liveDemand_kW.get(OL_EnergyCarriers.ELECTRICITY).getXMax();
+ for (double t = startTime; t <= endTime; t += energyModel.p_timeStep_h) {
+ dsSupply.add( t, 0);
+ }
+ v_liveData.dsm_liveSupply_kW.put( EC, dsSupply);
+ }
+ }
+}
+
+
+energyModel.c_energyAssets.add(j_ea);
+c_energyAssets.add(j_ea);
+
+if (j_ea instanceof J_EAVehicle) {
+ J_EAVehicle vehicle = (J_EAVehicle)j_ea;
+ if (vehicle instanceof J_EADieselVehicle) {
+ c_dieselVehicles.add( (J_EADieselVehicle)vehicle );
+ } else if (vehicle instanceof J_EAHydrogenVehicle) {
+ c_hydrogenVehicles.add((J_EAHydrogenVehicle)vehicle);
+ } else if (vehicle instanceof J_EAEV) {
+ c_vehiclesAvailableForCharging.add((J_EAEV)vehicle);
+ energyModel.c_EVs.add((J_EAEV)vehicle);
+ //c_EvAssets.add(j_ea);
+ }
+ c_vehicleAssets.add(vehicle);
+ J_ActivityTrackerTrips tripTracker = vehicle.getTripTracker();
+ if (tripTracker == null) { // Only provide tripTracker when vehicle doesn't have it yet!
+ if (vehicle.energyAssetType == OL_EnergyAssetType.ELECTRIC_TRUCK || vehicle.energyAssetType == OL_EnergyAssetType.DIESEL_TRUCK || vehicle.energyAssetType == OL_EnergyAssetType.HYDROGEN_TRUCK) {
+ int rowIndex = uniform_discr(1, 7);//getIndex() % 200;
+ tripTracker = new J_ActivityTrackerTrips(energyModel, energyModel.p_truckTripsCsv, rowIndex, energyModel.t_h*60, vehicle);
+ } else if (vehicle.energyAssetType == OL_EnergyAssetType.DIESEL_VAN || vehicle.energyAssetType == OL_EnergyAssetType.ELECTRIC_VAN || vehicle.energyAssetType == OL_EnergyAssetType.HYDROGEN_VAN) {// No mobility pattern for business vans available yet!! Falling back to truck mobility pattern
+ int rowIndex = uniform_discr(1, 7);//getIndex() % 200;
+ tripTracker = new J_ActivityTrackerTrips(energyModel, energyModel.p_truckTripsCsv, rowIndex, energyModel.t_h*60, vehicle);
+ tripTracker.setAnnualDistance_km(30_000);
+ } else {
+ //traceln("Adding passenger vehicle to gridconnection %s", this);
+ int rowIndex = uniform_discr(0, 200);//getIndex() % 200;
+ tripTracker = new J_ActivityTrackerTrips(energyModel, energyModel.p_householdTripsCsv, rowIndex, energyModel.t_h*60, vehicle);
+ //tripTracker = new J_ActivityTrackerTrips(energyModel, energyModel.p_householdTripsExcel, 18, energyModel.t_h*60, vehicle);
+ //int rowIndex = uniform_discr(1, 7);//getIndex() % 200;
+ //tripTracker = new J_ActivityTrackerTrips(energyModel, energyModel.p_truckTripsExcel, 2, energyModel.t_h*60, vehicle);
+ }
+
+ vehicle.tripTracker = tripTracker;
+ }
+ c_tripTrackers.add( tripTracker );
+ v_vehicleIndex ++;
+} else if (j_ea instanceof J_EAConsumption) {
+ c_consumptionAssets.add((J_EAConsumption)j_ea);
+ if (j_ea.energyAssetType == OL_EnergyAssetType.HOT_WATER_CONSUMPTION) {
+ p_DHWAsset = (J_EAConsumption)j_ea;
+ }
+ if( j_ea.energyAssetType == OL_EnergyAssetType.ELECTRICITY_DEMAND ) {
+ //c_fixedConsumptionElectricAssets.add(j_ea);
+ }
+ if( j_ea.energyAssetType == OL_EnergyAssetType.ELECTRIC_HOB ) {
+ //c_electricHobAssets.add(j_ea);
+ }
+} else if (j_ea instanceof J_EAProduction) {
+ c_productionAssets.add((J_EAProduction)j_ea);
+ //energyModel.c_productionAssets.add((J_EAProduction)j_ea);
+
+ if (j_ea.energyAssetType == OL_EnergyAssetType.PHOTOVOLTAIC) {
+ //v_liveAssetsMetaData.hasPV = true;
+ v_liveAssetsMetaData.totalInstalledPVPower_kW += ((J_EAProduction)j_ea).getCapacityElectric_kW();
+ 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 ( 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);
+ }
+ else if (j_ea.energyAssetType == OL_EnergyAssetType.PHOTOTHERMAL){
+ //v_liveAssetsMetaData.hasPT = true;
+ //c_ptAssets.add(j_ea);
+ }
+} else if (j_ea instanceof J_EAConversion) {
+ c_conversionAssets.add((J_EAConversion)j_ea);
+ if ( j_ea.energyAssetType == OL_EnergyAssetType.GAS_PIT || j_ea.energyAssetType == OL_EnergyAssetType.ELECTRIC_HOB){
+ if (j_ea.energyAssetType == OL_EnergyAssetType.ELECTRIC_HOB) {
+ //c_electricHobAssets.add(j_ea);
+ //c_conversionElectricAssets.add(j_ea);
+ }
+ if (p_cookingTracker == null) {
+ int rowIndex = uniform_discr(2, 300);
+ p_cookingTracker = new J_ActivityTrackerCooking(energyModel.p_cookingPatternCsv, rowIndex, energyModel.t_h*60, (J_EAConversion)j_ea );
+ } else {
+ p_cookingTracker.HOB = (J_EAConversion)j_ea;
+ }
+ } else if (j_ea instanceof J_EAConversionGasBurner) {
+ p_primaryHeatingAsset = (J_EAConversion)j_ea;
+ } else if (j_ea instanceof J_EAConversionHeatPump) {
+ energyModel.c_ambientDependentAssets.add(j_ea);
+// c_electricHeatpumpAssets.add(j_ea);
+ if(((J_EAConversionHeatPump)j_ea).getAmbientTempType() == OL_AmbientTempType.AMBIENT_AIR){
+ p_secondaryHeatingAsset = (J_EAConversion)j_ea;
+ }
+ else if(((J_EAConversionHeatPump)j_ea).getAmbientTempType() == OL_AmbientTempType.HEAT_GRID){
+ p_quinaryHeatingAsset = (J_EAConversion)j_ea;
+ }
+ } else if (j_ea instanceof J_EAConversionHeatDeliverySet) {
+ p_tertiaryHeatingAsset = (J_EAConversion)j_ea;
+ } else if (j_ea instanceof J_EAConversionHydrogenBurner) {
+ p_quaternaryHeatingAsset = (J_EAConversion)j_ea;
+ } else if (j_ea instanceof J_EAConversionGasCHP) {
+ //c_chpAssets.add(j_ea);
+ }
+} else if (j_ea instanceof J_EAStorage) {
+ c_storageAssets.add((J_EAStorage)j_ea);
+ energyModel.c_storageAssets.add((J_EAStorage)j_ea);
+ if (j_ea.energyAssetType == OL_EnergyAssetType.BUILDINGTHERMALS) {
+ //traceln("Adding buildingThermals to gridconnection");
+ p_BuildingThermalAsset = (J_EABuilding)j_ea;
+ /*if ( p_energyLabel != null & p_gridConnectionType != null){ // Get building thermals from lookup table when isolation label and house type are available
+ double lossFactor_WpK2 = energyModel.v_buildingThermalPars.path( p_gridConnectionType.name() ).path(p_energyLabel.name()).path("lossFactor_WpK").doubleValue();
+ double heatCapacity_JpK2 = energyModel.v_buildingThermalPars.path( p_gridConnectionType.name() ).path(p_energyLabel.name()).path("heatCapacity_JpK").doubleValue();
+ p_BuildingThermalAsset.lossFactor_WpK = lossFactor_WpK2;
+ p_BuildingThermalAsset.heatCapacity_JpK = heatCapacity_JpK2;
+ traceln("House thermal model updated!");
+ traceln("House type: %s, energy label: %s", p_gridConnectionType, p_energyLabel);
+ traceln("lossfactor %s, heatcapacity %s", lossFactor_WpK2, heatCapacity_JpK2);
+ }*/ // Deprecated get lossfactor and heatcapacity from json-input. Replace with other datasource!
+ p_BuildingThermalAsset.updateAmbientTemperature( energyModel.v_currentAmbientTemperature_degC );
+ //v_tempSetpoint_degC = p_BuildingThermalAsset.setTemperature_degC;
+ energyModel.c_ambientDependentAssets.add(p_BuildingThermalAsset);
+ } else if (j_ea instanceof J_EAStorageGas) {
+ p_gasBuffer = (J_EAStorageGas)j_ea;
+ } else if (j_ea instanceof J_EAStorageElectric) {
+ p_batteryAsset = (J_EAStorageElectric)j_ea;
+ //c_batteryAssets.add(j_ea);
+ v_liveAssetsMetaData.totalInstalledBatteryStorageCapacity_MWh += ((J_EAStorageElectric)j_ea).getStorageCapacity_kWh()/1000;
+ energyModel.v_liveAssetsMetaData.totalInstalledBatteryStorageCapacity_MWh += ((J_EAStorageElectric)j_ea).getStorageCapacity_kWh()/1000;
+
+ } else if (j_ea instanceof J_EAStorageHeat) {
+ energyModel.c_ambientDependentAssets.add(j_ea);
+ }
+} else if (j_ea instanceof J_EAProfile) {
+ //p_energyProfile = (J_EAProfile)j_ea;
+ c_profileAssets.add((J_EAProfile)j_ea);
+ /*
+ if (((J_EAProfile)j_ea).profileType == OL_ProfileAssetType.CHARGING){
+ //v_evChargingPowerElectric_kW += flowsArray[4] - flowsArray[0];
+ //c_EvAssets.add(j_ea);
+ } else if( ((J_EAProfile)j_ea).profileType == OL_ProfileAssetType.ELECTRICITYBASELOAD){
+ //v_fixedConsumptionElectric_kW += flowsArray[4] - flowsArray[0];
+ //c_fixedConsumptionElectricAssets.add(j_ea);
+ } else if( ((J_EAProfile)j_ea).profileType == OL_ProfileAssetType.WINDTURBINE){
+ //v_windProductionElectric_kW += flowsArray[0];
+ //c_windAssets.add(j_ea);
+ } else if( ((J_EAProfile)j_ea).profileType == OL_ProfileAssetType.HEATDEMAND){
+ //Do nothing
+ } else {
+ traceln( "Unrecognized profile type!");
+ }
+ */
+} else {
+ traceln("Unrecognized energy asset %s in gridconnection %s", j_ea, this);
+}
+
+
+
+ VOID
+ double
+ 1732550952237
+ f_setH2HeatingFr_industry
+ true
+ 2170
+ 140
+
+ false
+ true
+ true
+
+ amountOfHydrogenUseForHeating_fr
+ double
+
+
+//Get current values
+if(amountOfHydrogenUseForHeating_fr >= 1){
+ //throw new RuntimeException("Can not replace all gas in industry with hydrogen! The model does not support this.");
+ amountOfHydrogenUseForHeating_fr = 0.999;
+}
+double actualHeatingDemandSpaceHeating_fr = (1 - v_amountOfHydrogenUseForHeating_industry_fr);
+double[] currentPctArray = {v_amountOfGasBurners_industry_fr*100/actualHeatingDemandSpaceHeating_fr,
+ v_amountOfHybridHeatpump_industry_fr*100/actualHeatingDemandSpaceHeating_fr,
+ v_amountOfElectricHeatpumps_industry_fr*100/actualHeatingDemandSpaceHeating_fr,
+ v_amountOfDistrictHeating_industry_fr*100/actualHeatingDemandSpaceHeating_fr};
+
+//Set new hydrogen use for heating fr
+v_amountOfHydrogenUseForHeating_industry_fr = min(1, amountOfHydrogenUseForHeating_fr);
+
+
+//Set new values
+f_setHeatingMethodPct_industry(currentPctArray);
+
+
+
+ VOID
+ double
+ 1732636739570
+ f_setHeatingMethodPct_industry
+ true
+ 2170
+ 40
+
+ false
+ true
+ true
+
+ pctArray
+ double[]
+
+ //Calculate actual space heating
+double actualHeatingDemandSpaceHeating_fr = (1 - v_amountOfHydrogenUseForHeating_industry_fr);
+
+v_amountOfGasBurners_industry_fr = actualHeatingDemandSpaceHeating_fr * pctArray[0]/100;
+v_amountOfElectricHeatpumps_industry_fr = actualHeatingDemandSpaceHeating_fr * pctArray[1]/100;
+v_amountOfHybridHeatpump_industry_fr = actualHeatingDemandSpaceHeating_fr * pctArray[2]/100;
+v_amountOfDistrictHeating_industry_fr = actualHeatingDemandSpaceHeating_fr * pctArray[3]/100;
+
+
+
+
+ VOID
+ double
+ 1732636773704
+ f_setHeatingMethodPct_agriculture
+ true
+ 2170
+ 200
+
+ false
+ true
+ true
+
+ pctArray
+ double[]
+
+ v_amountOfGasBurners_agriculture_fr = pctArray[0]/100;
+v_amountOfElectricHeatpumps_agriculture_fr = pctArray[1]/100;
+v_amountOfHybridHeatpump_agriculture_fr = pctArray[2]/100;
+v_amountOfDistrictHeating_agriculture_fr = pctArray[3]/100;
+
+
+
+
+ VOID
+ double
+ 1734716016619
+ f_resetSpecificGCStates_override
+ 1250
+ 610
+
+ false
+ true
+ true
+ v_batteryMoneyMade_euro = 0;
+v_currentLoadLowPassed_kW = 0;
+
+
+ VOID
+ double
+ 1736869275213
+ f_batteryManagementBalanceNoGCCapacity_NBH
+ 1680
+ 570
+
+ false
+ false
+ true
+ //traceln("Battery storage capacity: " + ((J_EAStorageElectric)p_batteryAsset.j_ea).getStorageCapacity_kWh());
+if (p_batteryAsset.getStorageCapacity_kWh() != 0){
+ double currentLoadDeviation_kW = fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.ELECTRICITY) - v_currentLoadLowPassed_kW; // still excludes battery power
+ //traceln("electricitySuprlus_kW: " + electricitySurplus_kW);
+ //v_electricityPriceLowPassed_eurpkWh += v_lowPassFactor_fr * ( electricitySurplus_kW - v_electricityPriceLowPassed_eurpkWh );
+ //double v_allowedDeliveryCapacity_kW = p_contractedDeliveryCapacity_kW*0.95;
+ //double v_allowedFeedinCapacity_kW = p_contractedFeedinCapacity_kW*0.95;
+ //double connectionCapacity_kW = v_allowedCapacity_kW; // Use only 90% of capacity for robustness against delay
+ //double availableChargePower_kW = v_allowedDeliveryCapacity_kW - fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.ELECTRICITY); // Max battery charging power within grid capacity
+ //double availableDischargePower_kW = fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.ELECTRICITY) + v_allowedFeedinCapacity_kW; // Max discharging power within grid capacity
+
+ double SOC_setp_fr_offset = v_SOC_setp_fr_offset_balance; // default: 0.6
+ //TODO: Verander in iets specifieks voor project - overwrite in GC Neighborhood
+ //traceln("Current price is " + currentElectricityPriceCharge_eurpkWh + " eurpkWh, between " + currentPricePowerBandNeg_kW + " kW and " + currentPricePowerBandPos_kW + " kW");
+ //SOC_setp_fr = 0.6 + 0.25 * Math.cos(2*Math.PI*(energyModel.t_h-18)/24); // Sinusoidal setpoint: aim for low SOC at 6:00h, high SOC at 18:00h.
+
+ //TODO forecast keer installed cap per buurt genormaliseerd.
+ double windEnergyExpectedNormalized_fr = energyModel.pf_windProduction_fr.getForecast() * energyModel.p_forecastTime_h * v_liveAssetsMetaData.totalInstalledWindPower_kW / p_batteryAsset.getStorageCapacity_kWh();
+ double solarEnergyExpectedNormalized_fr = energyModel.pf_PVProduction35DegSouth_fr.getForecast() * energyModel.p_forecastTime_h * v_liveAssetsMetaData.totalInstalledPVPower_kW / p_batteryAsset.getStorageCapacity_kWh();
+ //double heatpumpExpectedEnergyDrawNormalized_fr = ...
+ double SOC_setp_fr = SOC_setp_fr_offset + 0.1 * Math.cos(2*Math.PI*(energyModel.t_h-7)/24) - 0.1 * windEnergyExpectedNormalized_fr - 0.1 * solarEnergyExpectedNormalized_fr;
+ //traceln("Forecast-based SOC setpoint: " + SOC_setp_fr + " %");
+
+ //traceln("SOC_setp_fr" + SOC_setp_fr);
+
+ //traceln("SOC setpoint at " + getHourOfDay() + " h is " + SOC_setp_fr*100 + "%");
+ double FeedbackGain_kWpSOC_factor = v_FeedbackGain_kWpSOC_factor_balance; // default: 0.4
+ double FeedbackGain_kWpSOC = FeedbackGain_kWpSOC_factor * p_batteryAsset.getCapacityElectric_kW(); // How strongly to aim for SOC setpoint
+ double FeedforwardGain_kWpKw = 1; // Feedforward based on current surpluss in Coop
+ double chargeOffset_kW = 0; // Charging 'bias', basically increases SOC setpoint slightly during the whole day.
+ double chargeSetpoint_kW = 0;
+ chargeSetpoint_kW = -FeedforwardGain_kWpKw * currentLoadDeviation_kW + (SOC_setp_fr - p_batteryAsset.getCurrentStateOfCharge_fr()) * FeedbackGain_kWpSOC;
+ //chargeSetpoint_kW = min(max(chargeSetpoint_kW, -availableDischargePower_kW),availableChargePower_kW); // Don't allow too much (dis)charging!
+ p_batteryAsset.v_powerFraction_fr = max(-1,min(1, chargeSetpoint_kW / p_batteryAsset.getCapacityElectric_kW())); // Convert to powerFraction and limit power
+ //traceln("v_powerFraction_fr" + p_batteryAsset.v_powerFraction_fr);
+ //traceln("Coop surpluss " + currentCoopElectricitySurplus_kW + "kW, Battery charging power " + p_batteryAsset.v_powerFraction_fr*p_batteryAsset.j_ea.getElectricCapacity_kW() + " kW at " + currentBatteryStateOfCharge*100 + " % SOC");
+}
+
+
+
+
+ 1718724980084
+ connections
+ 50
+ -50
+
+ false
+ true
+ true
+ false
+ COLLECTION_OF_LINKS
+ true
+ Object
+ SOLID
+ 1
+ -16777216
+ UNDER_AGENTS
+ NONE
+ END
+
+
+
+
+ 1718797589418
+ energyModel
+ true
+ 50
+ -100
+
+ false
+ true
+ true
+
+ zero_engine
+ EnergyModel
+
+
+
+
+
+ 1718724980090
+ level
+ 0
+ 0
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ 0
+ DIM_NON_CURRENT
+
+
+ 1722502672021
+ rect_heatSliderFunctionality
+ 1650
+ 10
+
+ true
+ true
+ false
+ true
+ SHAPE_DRAW_2D3D
+ false
+ 0
+ 10
+ 3
+ -65536
+ null
+ SOLID
+ 960
+ 400
+ 0.0
+ -1
+ null
+
+
+ 1722502691313
+ txt_heatSliderFunctionality
+ 1680
+ 20
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ Heat sliders functionality
+
+ SansSerif
+ 14
+
+
+ LEFT
+
+
+ 1724397965238
+ rect_batterySliderFunctionality
+ 1650
+ 420
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ false
+ 0
+ 10
+ 3
+ -16711936
+ null
+ SOLID
+ 960
+ 170
+ 0.0
+ -1
+ null
+
+
+ 1724397981363
+ txt_batterySliderFunctionality
+ 1670
+ 430
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ Battery control
+
+ SansSerif
+ 14
+
+
+ LEFT
+
+
+ 1729064990067
+ rectangle4
+ 1650
+ 740
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ false
+ 0
+ 10
+ 3
+ -16777216
+ null
+ SOLID
+ 430
+ 230
+ 0.0
+ -1
+ null
+
+
+ 1729065010495
+ txt_AdditionalGCNBHParameters
+ 1670
+ 760
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ Extra specifieke Parameters
+
+ SansSerif
+ 14
+
+
+ LEFT
+
+
+ 1733992649922
+ txt_batteryBalance
+ 1670
+ 460
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ Balance
+
+ SansSerif
+ 12
+
+
+ LEFT
+
+
+ 1733993648205
+ txt_batteryPrice
+ 2110
+ 460
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ Prijs
+
+ SansSerif
+ 12
+
+
+ LEFT
+
+
+ 1736933200347
+ rect_batterySliderFunctionality1
+ 1650
+ 600
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ false
+ 0
+ 10
+ 3
+ -16711936
+ null
+ SOLID
+ 960
+ 120
+ 0.0
+ -1
+ null
+
+
+ 1736933209166
+ txt_chpSliderFunctionality
+ 1670
+ 610
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ CHP control
+
+ SansSerif
+ 14
+
+
+ LEFT
+
+
+
+
+
+
+ 1717956409506
+ GCPublicCharger
+
+/*@Override
+public void f_operateFixedAssets(){
+ f_operateFixedAssets_overwrite();
+}*/
+
+@Override
+public void f_operateFlexAssets(){
+ f_operateFlexAssets_overwrite();
+}
+ 1752677823817
+
+ zero_engine
+ GridConnection
+
+
+
+ p_parentNodeElectricID
+
+
+ p_gridConnectionID
+
+
+ p_parentNodeHeatID
+
+
+ p_BuildingThermalAsset
+
+
+ p_ownerID
+
+
+ p_batteryAsset
+
+
+ p_electrolyserOperationMode
+
+
+ p_heatBuffer
+
+
+ p_gasBuffer
+
+
+ p_cookingTracker
+
+
+ p_energyLabel
+
+
+ p_DHWAsset
+
+
+ p_longitude
+
+
+ p_latitude
+
+
+ p_floorSurfaceArea_m2
+
+
+ p_GISPoint
+
+
+ p_owner
+
+
+ p_roofSurfaceArea_m2
+
+
+ p_purposeBAG
+
+
+ p_name
+
+
+ p_curtailmentMode
+
+
+ p_address
+
+
+ p_parentNodeHeat
+
+
+ p_parentNodeElectric
+
+
+ v_isActive
+
+
+ p_uid
+
+
+ false
+
+ 1717956409512
+ 1717956409512
+
+ T extends Agent
+
+ Generic parameter:
+
+ ENTITY
+ 100
+ false
+ 100
+ true
+
+ -4144960
+ null
+
+ true
+ true
+ false
+
+ 10
+ MPS
+
+
+ 1
+ METER
+
+
+ 1
+ METER
+
+
+ 1
+ METER
+
+
+
+ false
+
+ 1.0
+ SECOND
+
+ CONTINUOUS
+ 500
+ 500
+ 0
+ 100
+ 100
+ MOORE
+ USER_DEF
+ USER_DEF
+ 2
+ 50
+ 0.95
+ 10
+
+
+ true
+ 1658477089951
+ true
+ 1718006400000
+
+ 0
+ HOUR
+
+
+ 1
+ HOUR
+
+
+
+ 1717956409509
+ scale
+ 0
+ -150
+ false
+ false
+ false
+ SHAPE_DRAW_2D3D
+ 100
+ 0
+ BASED_ON_LENGTH
+ 10
+ METER
+ 10
+ true
+
+ 1717956409513
+ 1717956409507
+
+
+ 1720728863554
+ v_netBewustLadenActive
+ 270
+ 480
+
+ false
+ true
+ true
+
+ boolean
+
+ false
+
+
+
+
+ 1749648407076
+ v_isActiveCharger1
+ true
+ 1950
+ 500
+
+ false
+ true
+ true
+
+ boolean
+
+
+
+ 1749648407078
+ v_netBewustLadenActive1
+ true
+ 1950
+ 520
+
+ false
+ true
+ true
+
+ boolean
+
+ false
+
+
+
+
+ 1749648407080
+ v_sessionIndex
+ true
+ 1950
+ 720
+
+ false
+ true
+ true
+
+ int
+
+ 0
+
+
+
+
+ 1749648407082
+ v_nextSessionStartTime
+ true
+ 1950
+ 740
+
+ false
+ true
+ true
+
+ int
+
+ 0
+
+
+
+
+ 1749648407084
+ v_v2gProbability
+ true
+ 1950
+ 780
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1749648407086
+ v_nextSessionInfo
+ true
+ 1950
+ 760
+
+ false
+ true
+ true
+
+ String[]
+
+
+
+ 1749648407088
+ v_shiftedLoadV1G_kW
+ true
+ 1950
+ 810
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1749648407090
+ v_shiftedLoadV2G_kW
+ true
+ 1950
+ 830
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1749648407096
+ v_sessionIndexStored
+ true
+ 2060
+ 720
+
+ false
+ true
+ true
+
+ int
+
+ 0
+
+
+
+
+ 1717959948784
+ p_gisregion
+ true
+ 50
+ 510
+
+ false
+ true
+ true
+
+ GISRegion
+ NONE
+ false
+
+ 1717959948782
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1718020204898
+ p_nbOfChargers
+ 1640
+ 100
+
+ false
+ true
+ true
+
+ double
+ NONE
+ false
+
+ 1718020204896
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1718020213388
+ p_maxChargingPower_kW
+ 1640
+ 120
+
+ false
+ true
+ true
+
+ double
+ NONE
+ false
+
+ 1718020213386
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1718020656896
+ p_chargingVehicleType
+ 1640
+ 140
+
+ false
+ false
+ true
+
+ OL_EnergyAssetType
+ NONE
+ false
+
+ 1718020656894
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1718903294274
+ p_isInitialCharger
+ 270
+ 500
+
+ false
+ true
+ true
+
+ boolean
+ NONE
+ false
+
+ 1718903294272
+ CHECK_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1720377369145
+ p_chargingProfileName
+ 270
+ 520
+
+ false
+ true
+ true
+
+ String
+ NONE
+ false
+
+ 1720377369143
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1749648407099
+ p_isInitialCharger1
+ true
+ 1950
+ 540
+
+ false
+ true
+ true
+
+ boolean
+ NONE
+ false
+
+ 1749648407097
+ CHECK_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1749648407102
+ p_chargingProfileName1
+ true
+ 1950
+ 560
+
+ false
+ true
+ true
+
+ String
+ NONE
+ false
+
+ 1749648407100
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1749648407105
+ chargingSessionSocket1
+ true
+ 1950
+ 600
+
+ false
+ true
+ true
+
+ ChargingSession
+ NONE
+ false
+
+ 1749648407103
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1749648407108
+ chargingSessionSocket2
+ true
+ 1950
+ 620
+
+ false
+ true
+ true
+
+ ChargingSession
+ NONE
+ false
+
+ 1749648407106
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1749648407111
+ p_chargerAsset
+ true
+ 1950
+ 580
+
+ false
+ true
+ true
+
+ J_EAPublicCharger
+ NONE
+ false
+
+ 1749648407109
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1750335661857
+ p_isChargingCentre
+ 270
+ 540
+
+ false
+ true
+ true
+
+ boolean
+ NONE
+ false
+
+ 1750335661855
+ CHECK_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+
+
+ VOID
+ double
+ 1717956478582
+ f_operateFixedAssets_overwrite
+ true
+ 910
+ 200
+
+ false
+ true
+ true
+ for ( J_EAProfile e : c_profileAssets){
+ double[] flowsArray = e.f_updateAllFlows( energyModel.t_h );
+ if (e.profileType == OL_ProfileAssetType.CHARGING){
+ v_evChargingPowerElectric_kW += flowsArray[4] - flowsArray[0];
+ }
+ else if( e.profileType == OL_ProfileAssetType.ELECTRICITYBASELOAD){
+ v_fixedConsumptionElectric_kW += flowsArray[4] - flowsArray[0];
+ }
+ else {
+ traceln( "Profile type is not registered in GCPublicCharger");
+ }
+ //v_currentPowerElectricity_kW += flowsArray[4];
+}
+
+
+
+ VOID
+ double
+ 1726749088568
+ f_operateFlexAssets_overwrite
+ 910
+ 220
+
+ false
+ true
+ true
+ //Manage charging
+f_manageEVCharging();
+
+f_manageChargePoints();
+
+
+
+ VOID
+ double
+ 1749648407069
+ f_operateChargerNew
+ true
+ 1950
+ 650
+
+ false
+ true
+ true
+ if( v_sessionIndex != -1){ //if we didnt reach the last session
+ f_manageChargingSessions(); //here we install a new charging session, but if end time of previous overlaps with start time of next there is a problem
+}
+
+double ratioOfCapacity = 0;
+double chargingPower = 0;
+v_shiftedLoadV1G_kW = 0;
+v_shiftedLoadV2G_kW = 0;
+
+if (chargingSessionSocket1 != null){
+ chargingPower += chargingSessionSocket1.operate();
+ v_shiftedLoadV1G_kW += chargingSessionSocket1.getShiftedLoadV1GCurrentTimestep();
+ v_shiftedLoadV2G_kW += chargingSessionSocket1.getShiftedLoadV2GCurrentTimestep();
+ if ( chargingSessionSocket1.timeStepsToDisconnect == 0 ){
+ //traceln("EndTime: " + (chargingSessionSocket1.endTime / 4.0) + ", current timestep: " + energyModel.t_h );
+ chargingSessionSocket1 = null;
+ }
+}
+
+if (chargingSessionSocket2 != null){
+ chargingPower += chargingSessionSocket2.operate();
+ v_shiftedLoadV1G_kW += chargingSessionSocket2.getShiftedLoadV1GCurrentTimestep();
+ v_shiftedLoadV2G_kW += chargingSessionSocket2.getShiftedLoadV2GCurrentTimestep();
+ if ( chargingSessionSocket2.timeStepsToDisconnect == 0 ){
+ chargingSessionSocket2 = null;
+ }
+}
+
+ratioOfCapacity = chargingPower / p_chargerAsset.capacityElectric_kW;
+if (!v_isActiveCharger){
+ ratioOfCapacity = 0;
+}
+
+p_chargerAsset.f_updateAllFlows( ratioOfCapacity );
+
+v_totalShiftedLoadV1G_kWh += v_shiftedLoadV1G_kW;
+v_totalShiftedLoadV2G_kWh += v_shiftedLoadV2G_kW;
+
+
+
+ VOID
+ double
+ 1749648407072
+ f_manageChargingSessions
+ true
+ 1960
+ 670
+
+ false
+ true
+ true
+ if( energyModel.t_h == v_nextSessionStartTime / 4.0){
+ int startIndex = Integer.parseInt(v_nextSessionInfo[0]);
+ int endIndex = Integer.parseInt(v_nextSessionInfo[1]);
+ double chargingDemand_kWh = Double.parseDouble(v_nextSessionInfo[2]);
+ double batteryCap_kWh = Double.parseDouble(v_nextSessionInfo[3]);
+ //
+ double chargingPower_kW = Double.parseDouble(v_nextSessionInfo[5]);
+ int socket = Integer.parseInt(v_nextSessionInfo[6]);
+
+ if ( socket == 1){
+ if (chargingSessionSocket1 != null){
+ traceln("Error, new charging session but socket 1 is not empty, profile: " + p_chargingProfileName + ", startIndex: " + startIndex + ", existing session end index: " + chargingSessionSocket1.endTime);
+ }
+ chargingSessionSocket1 = new ChargingSession(startIndex, endIndex, chargingDemand_kWh, batteryCap_kWh, chargingPower_kW, socket, randomTrue(energyModel.v_V2GProbability), 0.25);
+ //traceln("new session created, start: " + startIndex + ", end: " +endIndex+ ", current timestep: " + energyModel.t_h * 4 + ", timeslots alive: " + chargingSessionSocket1.timeStepsToDisconnect );
+ }
+ else {
+ if (chargingSessionSocket2 != null){
+ traceln("Error, new charging session but socket 2 is not empty, profile: " + p_chargingProfileName + ", startIndex: " + startIndex + ", existing session end index: " + chargingSessionSocket2.endTime);
+ }
+ chargingSessionSocket2 = new ChargingSession(startIndex, endIndex, chargingDemand_kWh, batteryCap_kWh, chargingPower_kW, socket, randomTrue(energyModel.v_V2GProbability), 0.25);
+ }
+
+ v_sessionIndex ++;
+
+
+ f_getNextSessionInfo();
+ if ( energyModel.t_h == v_nextSessionStartTime / 4.0 ){
+ //traceln("Multiple charging sessions starting at the same timestap in charging profile: " + p_chargingProfileName + " at time: " + v_nextSessionStartTime);
+ f_manageChargingSessions();
+ }
+ else if ( energyModel.t_h > v_nextSessionStartTime / 4.0){
+ traceln(" charging profile data incorrect, next charging session is in the past");
+ }
+
+}
+
+
+
+
+ VOID
+ double
+ 1749648407074
+ f_getNextSessionInfo
+ true
+ 1960
+ 690
+
+ false
+ true
+ true
+ // example: 2/54/50.3/72.1/21.8/10.8/2
+
+String sessie = selectFirstValue(
+ "SELECT " + p_chargingProfileName + " FROM chargingsessions WHERE " +
+ "session = ? LIMIT 1;",
+ v_sessionIndex);
+
+if( sessie != null){
+ v_nextSessionInfo = sessie.split("/");
+ v_nextSessionStartTime = Integer.parseInt(v_nextSessionInfo[0]);
+ //traceln("Profile " + p_chargingProfileName + " next start time: " + v_nextSessionInfo[0]);
+}
+else{
+ v_sessionIndex = -1;
+ //traceln( "No new charging session available in data for " + p_chargingProfileName + ", current session index: " + v_sessionIndex);
+}
+
+
+
+
+ 1717956409507
+ connections
+ 50
+ -50
+
+ false
+ true
+ true
+ false
+ COLLECTION_OF_LINKS
+ true
+ Object
+ SOLID
+ 1
+ -16777216
+ UNDER_AGENTS
+ NONE
+ END
+
+
+
+
+ 1717960182629
+ energyModel
+ true
+ 50
+ -100
+
+ false
+ true
+ true
+
+ zero_engine
+ EnergyModel
+
+
+
+
+
+ 1717956409513
+ level
+ 0
+ 0
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ 0
+ DIM_NON_CURRENT
+
+
+ 1718020159680
+ rectangle4
+ 1600
+ 40
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ false
+ 0
+ 10
+ 3
+ -65536
+ null
+ SOLID
+ 300
+ 160
+ 0.0
+ -1
+ null
+
+
+ 1718020176410
+ txt_chargingStationFunctions
+ 1620
+ 60
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ Charging Centre Functions
+
+ SansSerif
+ 14
+
+
+ LEFT
+
+
+
+
+
+
+ 1672138285227
+ GCUtility
+ @Override
+public void f_operateFlexAssets(){
+ f_operateFlexAssets_overwrite();
+}
+
+@Override
+public void f_resetSpecificGCStates(){
+ f_resetSpecificGCStates_overwrite();
+}
+
+ 1752677823817
+
+ zero_engine
+ GridConnection
+
+
+
+ p_parentNodeElectricID
+
+
+ p_gridConnectionID
+
+
+ p_parentNodeHeatID
+
+
+ p_BuildingThermalAsset
+
+
+ p_ownerID
+
+
+ p_batteryAsset
+
+
+ p_electrolyserOperationMode
+
+
+ p_heatBuffer
+
+
+ p_gasBuffer
+
+
+ p_cookingTracker
+
+
+ p_energyLabel
+
+
+ p_DHWAsset
+
+
+ p_longitude
+
+
+ p_latitude
+
+
+ p_floorSurfaceArea_m2
+
+
+ p_GISPoint
+
+
+ p_owner
+
+
+ p_roofSurfaceArea_m2
+
+
+ p_purposeBAG
+
+
+ p_name
+
+
+ p_curtailmentMode
+
+
+ p_address
+
+
+ p_parentNodeHeat
+
+
+ p_parentNodeElectric
+
+
+ v_isActive
+
+
+ p_uid
+
+
+ false
+
+ 1672138285225
+ 1672138285225
+
+ T extends Agent
+
+ Generic parameter:
+
+ ENTITY
+ 100
+ false
+ 100
+ true
+
+ -4144960
+ null
+
+ true
+ true
+ false
+
+ 10
+ MPS
+
+
+ 1
+ METER
+
+
+ 1
+ METER
+
+
+ 1
+ METER
+
+
+
+ false
+
+ 1.0
+ SECOND
+
+ CONTINUOUS
+ 500
+ 500
+ 0
+ 100
+ 100
+ MOORE
+ USER_DEF
+ USER_DEF
+ 2
+ 50
+ 0.95
+ 10
+
+
+ true
+ 1658477089950
+ true
+ 1672214400000
+
+ 0
+ HOUR
+
+
+ 1
+ HOUR
+
+
+
+ 1672138285223
+ scale
+ 0
+ -150
+ false
+ false
+ false
+ SHAPE_DRAW_2D3D
+ 100
+ 0
+ BASED_ON_LENGTH
+ 10
+ METER
+ 10
+ true
+
+ 1672138285226
+ 1672138285222
+
+
+ 1721138603371
+ v_totalHydrogenUsed_MWh
+ 1230
+ 470
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1721139587618
+ v_enableFuelCell
+ 270
+ 460
+
+ false
+ true
+ true
+
+ boolean
+
+
+
+ 1725879138068
+ v_maxHydrogenPower_kW
+ 1480
+ 470
+
+ false
+ true
+ true
+
+ double
+
+
+
+
+
+ VOID
+ double
+ 1698936515692
+ f_operateFlexAssets_overwrite
+ 910
+ 220
+
+ false
+ true
+ true
+ f_manageHeating();
+
+f_manageEVCharging();
+
+f_manageBattery();
+
+if (v_enableFuelCell) {
+ f_manageFuelCell();
+}
+
+
+ VOID
+ double
+ 1721138603366
+ f_manageFuelCell
+ 1070
+ 600
+
+ false
+ true
+ true
+ // 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) > 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) - 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);
+
+ // Check the amount of Hydrogen that has been generated so far
+ // Only works because there is a single energy conversion site
+ if (energyModel.EnergyConversionSites.get(0).v_hydrogenInStorage_kWh > 0 ) {
+ // Calling operate directly instead of updateAllFlows, so that it's not bounded
+ //Pair<J_FlowsMap, Double> flowsPair = fuelCellAsset.operate(ratioOfCapacity);
+ fuelCellAsset.f_updateAllFlows(ratioOfCapacity);
+ //traceln("fuel cell operated: " + Arrays.toString(arr));
+
+ // Since not calling updateAllFlows, have to manually do this
+ //double energyUse_kW = - flowsMap.values().stream().mapToDouble(Double::doubleValue).sum();
+ //f_addFlows(flowsMap, flowsPair.getSecond(), fuelCellAsset);
+
+ // updating other variables
+ //v_currentPowerHydrogen_kW += arr[0];
+ //v_hydrogenInStorage_kWh -= arr[6] * energyModel.p_timeStep_h;
+ energyModel.EnergyConversionSites.get(0).v_hydrogenInStorage_kWh -= fuelCellAsset.getLastFlows().get(OL_EnergyCarriers.HYDROGEN) * energyModel.p_timeStep_h;
+ if (energyModel.v_isRapidRun) {
+ v_totalHydrogenUsed_MWh += fuelCellAsset.getLastFlows().get(OL_EnergyCarriers.HYDROGEN) * energyModel.p_timeStep_h / 1000;
+ if (fuelCellAsset.getLastFlows().get(OL_EnergyCarriers.HYDROGEN) > v_maxHydrogenPower_kW) {
+ v_maxHydrogenPower_kW = fuelCellAsset.getLastFlows().get(OL_EnergyCarriers.HYDROGEN);
+ }
+ }
+ }
+ }
+}
+
+
+ VOID
+ double
+ 1721138706438
+ f_resetSpecificGCStates_overwrite
+ 1250
+ 550
+
+ false
+ true
+ true
+ //Reset variables
+v_totalHydrogenUsed_MWh = 0;
+v_maxHydrogenPower_kW = 0;
+
+
+
+
+ 1672138285222
+ connections
+ 50
+ -50
+
+ false
+ true
+ true
+ false
+ COLLECTION_OF_LINKS
+ true
+ Object
+ SOLID
+ 1
+ -16777216
+ UNDER_AGENTS
+ NONE
+ END
+
+
+
+
+ 1696862765126
+ energyModel
+ true
+ 40
+ -40
+
+ false
+ true
+ true
+
+ zero_engine
+ EnergyModel
+
+
+
+
+
+ 1672138285226
+ level
+ 0
+ 0
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ 0
+ DIM_NON_CURRENT
+
+
+
+
+ 1676382560905
+ GIS_Building
+ Object for GISRegions of buildings. Contains information about the building. The addresses are available through the contained GridConnections.
+ 1752681631114
+ //import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+//@JsonIgnoreProperties({"level"})
+
+ zero_engine
+ GIS_Object
+
+
+
+ gisRegion
+
+
+ p_longitude
+
+
+ p_latitude
+
+
+ p_GISObjectType
+
+
+ p_GISRegion_coords
+
+
+ p_id
+
+
+ p_defaultLineColor
+
+
+ p_defaultFillColor
+
+
+ p_defaultLineWidth
+
+
+ p_defaultLineStyle
+
+
+ p_annotation
+
+
+ p_defaultFillColorString
+
+
+ p_defaultLineColorString
+
+
+ p_defaultLineStyleString
+
+
+ false
+
+ 1676382560900
+ 1676382560900
+
+ T extends Agent
+
+ Generic parameter:
+
+ ENTITY
+ 100
+ false
+ 100
+ true
+
+ -4144960
+ null
+
+ true
+ true
+ false
+
+ 10
+ MPS
+
+
+ 1
+ METER
+
+
+ 1
+ METER
+
+
+ 1
+ METER
+
+
+
+ false
+
+ 1.0
+ SECOND
+
+ CONTINUOUS
+ 500
+ 500
+ 0
+ 100
+ 100
+ MOORE
+ USER_DEF
+ USER_DEF
+ 2
+ 50
+ 0.95
+ 10
+
+
+ true
+ 1658477089949
+ true
+ 1663833600000
+
+ 0
+ HOUR
+
+
+ 1
+ HOUR
+
+
+
+ 1676382560901
+ scale
+ 0
+ -150
+ false
+ false
+ false
+ SHAPE_DRAW_2D3D
+ 100
+ 0
+ BASED_ON_LENGTH
+ 10
+ METER
+ 10
+ true
+
+ 1676382560913
+ 1676382560915
+
+
+ 1696858052529
+ p_status
+ 40
+ 340
+
+ false
+ true
+ true
+
+ String
+ NONE
+ false
+
+ 1696858052527
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1696858052547
+ p_useType
+ 40
+ 360
+
+ false
+ true
+ true
+
+ String
+ NONE
+ false
+
+ 1696858052545
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1696858052551
+ p_buildingType
+ 40
+ 300
+
+ false
+ true
+ true
+
+ OL_BuildingType
+ NONE
+ false
+
+ OL_BuildingType.Office
+
+
+ 1696858052549
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1696858052555
+ p_buildingYear
+ 40
+ 320
+
+ false
+ true
+ true
+
+ double
+ NONE
+ false
+
+ 1696858052553
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1696858052560
+ p_floorSurfaceArea_m2
+ 40
+ 260
+
+ false
+ true
+ true
+
+ double
+ NONE
+ false
+
+ 1696858052558
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1696858052564
+ p_floors
+ 40
+ 240
+
+ false
+ true
+ true
+
+ double
+ NONE
+ false
+
+ 1696858052562
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1714137583569
+ p_roofSurfaceArea_m2
+ 40
+ 280
+
+ false
+ true
+ true
+
+ double
+ NONE
+ false
+
+ 1714137583567
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1721036302503
+ p_pandNaam
+ 40
+ 220
+
+ false
+ true
+ true
+
+ String
+ NONE
+ false
+
+ 1721036302501
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+
+
+ 1676382560915
+ connections
+ 250
+ -50
+
+ false
+ true
+ true
+ false
+ COLLECTION_OF_LINKS
+ true
+ Object
+ SOLID
+ 1
+ -16777216
+ UNDER_AGENTS
+ NONE
+ END
+
+
+
+
+ 1676382645186
+ energyModel
+ 50
+ -100
+
+ false
+ true
+ true
+
+ zero_engine
+ EnergyModel
+
+
+
+
+
+ 1676382560913
+ level
+ 0
+ 0
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ 0
+ DIM_NON_CURRENT
+
+
+ 1721721465291
+ t_buildingDescription1
+ 50
+ 180
+
+ false
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ Building Info
+
+ Dialog
+ 18
+
+
+ LEFT
+
+
+
+
+
+
+ 1697018621698
+ va_building
+ 0
+ 0
+
+ false
+ true
+ false
+
+ 1920
+ 980
+
+
+
+
+ 1667726338857
+ GIS_Object
+ Generic Object for GISRegions. Is used for GridConnections of type: GCEnergyProduction, GCEnergyConversion, GCGridBattery, GCPublicCharger.
+ public static void forceSetOwner(Agent agent, AgentArrayList pop) throws Exception {
+ Agent owner = pop.getOwner();
+ Field f = Agent.class.getDeclaredField("d");
+ f.setAccessible(true);
+ f.set(agent, owner);
+ Field ff = Agent.class.getDeclaredField("j");
+ ff.setAccessible(true);
+ ff.set(agent, pop);
+ /*Field c = Agent.class.getDeclaredField("c");
+ traceln("Field c: %s", c);
+ c.setAccessible(true);
+ c.toString();*/
+}
+ 1752681631114
+ import java.lang.reflect.Field;
+
+
+//@JsonIgnoreProperties({"va_building", "va_parcel", "_origin_VA","gisRegion",
+// "p_defaultFillColor", "p_defaultLineColor", "p_defaultLineStyle"})
+ false
+
+ 1667726338855
+ 1667726338855
+
+ T extends Agent
+
+ Generic parameter:
+
+ ENTITY
+ 100
+ false
+ 100
+ true
+
+ -4144960
+ null
+
+ true
+ true
+ false
+
+ 10
+ MPS
+
+
+ 1
+ METER
+
+
+ 1
+ METER
+
+
+ 1
+ METER
+
+
+
+ false
+
+ 1.0
+ SECOND
+
+ CONTINUOUS
+ 500
+ 500
+ 0
+ 100
+ 100
+ MOORE
+ USER_DEF
+ USER_DEF
+ 2
+ 50
+ 0.95
+ 10
+
+
+ true
+ 1658477089948
+ true
+ 1667808000000
+
+ 0
+ HOUR
+
+
+ 1
+ HOUR
+
+
+
+ 1667726338853
+ scale
+ 0
+ -150
+ false
+ false
+ false
+ SHAPE_DRAW_2D3D
+ 100
+ 0
+ BASED_ON_LENGTH
+ 10
+ METER
+ 10
+ true
+
+ 1667726338856
+ 1667726338852
+
+
+ 1697009799975
+ gisRegion
+ 50
+ 140
+
+ false
+ true
+ true
+
+ GISRegion
+ NONE
+ false
+
+ 1697009799973
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1697009799980
+ p_longitude
+ 50
+ 100
+
+ false
+ true
+ true
+
+ double
+ NONE
+ false
+
+ 1697009799978
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1697009799984
+ p_latitude
+ 50
+ 80
+
+ false
+ true
+ true
+
+ double
+ NONE
+ false
+
+ 1697009799982
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1697464235545
+ p_GISObjectType
+ 50
+ 40
+
+ false
+ true
+ true
+
+ OL_GISObjectType
+ NONE
+ false
+
+ 1697464235543
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1702547667207
+ p_GISRegion_coords
+ true
+ 50
+ 120
+
+ false
+ true
+ true
+
+ String
+ NONE
+ false
+
+ 1702547667205
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1705666644943
+ p_id
+ 50
+ 20
+
+ false
+ true
+ true
+
+ String
+ NONE
+ false
+
+ 1705666644941
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1721720988124
+ p_defaultLineColor
+ 390
+ 70
+
+ false
+ true
+ true
+
+ Color
+ NONE
+ METER
+ false
+
+ 1721720988122
+ COLOR_PICKER
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1721720988128
+ p_defaultFillColor
+ 390
+ 50
+
+ false
+ true
+ true
+
+ Color
+ NONE
+ METER
+ false
+
+ 1721720988126
+ COLOR_PICKER
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1721809734127
+ p_defaultLineWidth
+ 390
+ 90
+
+ false
+ true
+ true
+
+ double
+ NONE
+ METER
+ false
+
+ 1
+
+
+ 1721809734125
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1721809794729
+ p_defaultLineStyle
+ 390
+ 110
+
+ false
+ true
+ true
+
+ LineStyle
+ NONE
+ METER
+ false
+
+ LineStyle.LINE_STYLE_SOLID
+
+
+ 1721809794727
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1721830375724
+ p_annotation
+ 50
+ 60
+
+ false
+ true
+ true
+
+ String
+ NONE
+ false
+
+ 1721830375722
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1753363681727
+ p_defaultFillColorString
+ 820
+ 70
+
+ false
+ true
+ true
+
+ String
+ NONE
+ METER
+ false
+
+ 1753363681725
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1753363694080
+ p_defaultLineColorString
+ 820
+ 90
+
+ false
+ true
+ true
+
+ String
+ NONE
+ METER
+ false
+
+ 1753363694078
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1753363711888
+ p_defaultLineStyleString
+ 820
+ 110
+
+ false
+ true
+ true
+
+ String
+ NONE
+ METER
+ false
+
+ 1753363711886
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1721726757949
+ c_containedGridConnections
+ 390
+ 140
+
+ false
+ true
+ true
+
+ ArrayList
+ GridConnection
+ String
+
+
+
+
+
+ VOID
+ double
+ 1721720983063
+ f_style
+ 390
+ 30
+
+ false
+ true
+ true
+
+ fillColor
+ Color
+
+
+ lineColor
+ Color
+
+
+ width
+ Double
+
+
+ lineStyle
+ LineStyle
+
+ if (fillColor == null) {
+ fillColor = p_defaultFillColor;
+}
+gisRegion.setFillColor( fillColor );
+if (lineColor == null) {
+ lineColor = p_defaultLineColor;
+}
+gisRegion.setLineColor( lineColor );
+if (width == null) {
+ width = p_defaultLineWidth;
+}
+gisRegion.setLineWidth( width );
+if (lineStyle == null) {
+ lineStyle = p_defaultLineStyle;
+}
+gisRegion.setLineStyle( lineStyle );
+
+
+ VOID
+ double
+ 1753363771985
+ f_writeStyleStrings
+ 820
+ 40
+
+ false
+ true
+ true
+ if (p_defaultFillColor!=null){
+ p_defaultFillColorString = p_defaultFillColor.getRed() + "," + p_defaultFillColor.getGreen() + "," + p_defaultFillColor.getBlue();
+}
+if (p_defaultLineColor!=null){
+ p_defaultLineColorString = p_defaultLineColor.getRed() + "," + p_defaultLineColor.getGreen() + "," + p_defaultLineColor.getBlue();
+}
+if (p_defaultLineStyle!=null){
+ p_defaultLineStyleString = p_defaultLineStyle.toString();
+}
+
+
+ VOID
+ double
+ 1753364192780
+ f_resetStyle
+ 820
+ 140
+
+ false
+ true
+ true
+ String[] rgb;
+if (p_defaultFillColorString!=null){
+ rgb = p_defaultFillColorString.split(",");
+
+ if (rgb.length == 3) {
+ p_defaultFillColor = new Color(
+ Integer.parseInt(rgb[0]),
+ Integer.parseInt(rgb[1]),
+ Integer.parseInt(rgb[2])
+ );
+ }
+}
+
+if (p_defaultLineColorString!=null){
+ rgb = p_defaultLineColorString.split(",");
+ if (rgb.length == 3) {
+ p_defaultLineColor = new Color(
+ Integer.parseInt(rgb[0]),
+ Integer.parseInt(rgb[1]),
+ Integer.parseInt(rgb[2])
+ );
+ }
+}
+if (p_defaultLineStyleString!=null){
+ p_defaultLineStyle = LineStyle.valueOf(LineStyle.class, p_defaultLineStyleString);
+}
+
+
+
+
+ 1667726338852
+ connections
+ true
+ 50
+ -50
+
+ false
+ true
+ true
+ false
+ COLLECTION_OF_LINKS
+ true
+ Object
+ SOLID
+ 1
+ -16777216
+ UNDER_AGENTS
+ NONE
+ END
+
+
+
+
+ 1697464974649
+ energyModel
+ 50
+ -100
+
+ false
+ true
+ true
+
+ zero_engine
+ EnergyModel
+
+
+
+
+
+ 1667726338856
+ level
+ 0
+ 0
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ 0
+ DIM_NON_CURRENT
+
+
+ 1753862409877
+ txt_serializationFunctions
+ 810
+ 10
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ Functions needed for Serialization
+
+ SansSerif
+ 12
+
+
+ LEFT
+
+
+
+
+
+
+ 1660572036696
+ GIS_Parcel
+ Object for GISRegions of empty parcels. c_containedGridConnections should always be empty, hence the address
+ 1752681631114
+
+ zero_engine
+ GIS_Object
+
+
+
+ p_longitude
+
+
+ p_latitude
+
+
+ gisRegion
+
+
+ p_GISObjectType
+
+
+ p_GISRegion_coords
+
+
+ p_id
+
+
+ p_defaultLineColor
+
+
+ p_defaultFillColor
+
+
+ p_defaultLineWidth
+
+
+ p_defaultLineStyle
+
+
+ p_annotation
+
+
+ p_defaultFillColorString
+
+
+ p_defaultLineColorString
+
+
+ p_defaultLineStyleString
+
+
+ false
+
+ 1660572036694
+ 1660572036694
+
+ T extends Agent
+
+ Generic parameter:
+
+ ENTITY
+ 100
+ false
+ 100
+ true
+
+ -4144960
+ null
+
+ true
+ true
+ false
+
+ 10
+ MPS
+
+
+ 1
+ METER
+
+
+ 1
+ METER
+
+
+ 1
+ METER
+
+
+
+ false
+
+ 1.0
+ SECOND
+
+ CONTINUOUS
+ 500
+ 500
+ 0
+ 100
+ 100
+ MOORE
+ USER_DEF
+ USER_DEF
+ 2
+ 50
+ 0.95
+ 10
+
+
+ true
+ 1658477089947
+ true
+ 1660636800000
+
+ 0
+ HOUR
+
+
+ 1
+ HOUR
+
+
+
+ 1660572036692
+ scale
+ 0
+ -150
+ false
+ false
+ false
+ SHAPE_DRAW_2D3D
+ 100
+ 0
+ BASED_ON_LENGTH
+ 10
+ METER
+ 10
+ true
+
+ 1660572036695
+ 1660572036691
+
+
+ 1726152082148
+ p_address
+ A Java class that contains all the relevant information about the grid connection address. The class contains a method .getAddress() which returns a formatted String of the address.
+ 50
+ 210
+
+ false
+ true
+ true
+
+ J_Address
+ NONE
+ false
+
+ 1726152082146
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+
+
+ 1660572036691
+ connections
+ true
+ 50
+ -50
+
+ false
+ true
+ true
+ false
+ COLLECTION_OF_LINKS
+ true
+ Object
+ true
+ DOTTED
+ 1
+ -16777216
+ ABOVE_AGENTS
+ NONE
+ END
+
+
+
+
+ 1721736146575
+ energyModel
+ true
+ 50
+ -100
+
+ false
+ true
+ true
+
+ zero_engine
+ EnergyModel
+
+
+
+
+
+ 1660572036695
+ level
+ 0
+ 0
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ 0
+ DIM_NON_CURRENT
+
+
+ 1721721376067
+ t_addressDescription
+ 50
+ 170
+
+ false
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ Address Info
+
+ Dialog
+ 18
+
+
+ LEFT
+
+
+
+
+
+
+ 1660731364525
+ GovernmentLayer
+ 1752677829820
+
+ zero_engine
+ Actor
+
+
+
+ p_actorID
+
+
+ p_actorType
+
+
+ p_actorSubgroup
+
+
+ p_actorGroup
+
+
+ false
+
+ 1660731364523
+ 1660731364523
+
+ T extends Agent
+
+ Generic parameter:
+
+ ENTITY
+ 100
+ false
+ 100
+ true
+
+ -4144960
+ null
+
+ true
+ true
+ false
+
+ 10
+ MPS
+
+
+ 1
+ METER
+
+
+ 1
+ METER
+
+
+ 1
+ METER
+
+
+
+ false
+
+ 1.0
+ SECOND
+
+ CONTINUOUS
+ 500
+ 500
+ 0
+ 100
+ 100
+ MOORE
+ USER_DEF
+ USER_DEF
+ 2
+ 50
+ 0.95
+ 10
+
+
+ true
+ 1658477089946
+ true
+ 1660809600000
+
+ 0
+ SECOND
+
+
+ 1
+ SECOND
+
+
+
+ 1660731364521
+ scale
+ 0
+ -150
+ false
+ false
+ false
+ SHAPE_DRAW_2D3D
+ 100
+ 0
+ BASED_ON_LENGTH
+ 10
+ METER
+ 10
+ true
+
+ 1660731364524
+ 1660731364520
+
+
+ 1660731364520
+ connections
+ true
+ 50
+ -50
+
+ false
+ true
+ true
+ false
+ COLLECTION_OF_LINKS
+ true
+ Object
+ SOLID
+ 1
+ -16777216
+ UNDER_AGENTS
+ NONE
+ END
+
+
+
+
+ 1660731364524
+ level
+ 0
+ 0
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ 0
+ DIM_NON_CURRENT
+
+
+
+
+ 1658499438203
+ GridConnection
+ public final String p_uid = UUID.randomUUID().toString();
+
+public OL_ResultScope getScope(){return OL_ResultScope.GRIDCONNECTION;}
+public J_RapidRunData getRapidRunData(){return v_rapidRunData;}
+public J_LiveData getLiveData(){return v_liveData;}
+public J_RapidRunData getPreviousRapidRunData(){return v_previousRunData;}
+
+public static void forceSetOwner(Agent agent, AgentArrayList pop) throws Exception {
+ Agent owner = pop.getOwner();
+ Field f = Agent.class.getDeclaredField("d");
+ f.setAccessible(true);
+ f.set(agent, owner);
+ Field ff = Agent.class.getDeclaredField("j");
+ ff.setAccessible(true);
+ ff.set(agent, pop);
+ /*Field c = Agent.class.getDeclaredField("c");
+ traceln("Field c: %s", c);
+ c.setAccessible(true);
+ c.toString();*/
+}
+
+
+ 1752677823817
+ /*import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.TextNode;
+import com.fasterxml.jackson.databind.node.NumericNode;
+import com.fasterxml.jackson.core.json.JsonReadFeature;
+*/
+import java.io.IOException;
+import java.util.Scanner;
+import java.util.*;
+import java.util.stream.Collectors;
+import java.io.*;
+import java.lang.reflect.Field;
+import org.apache.commons.lang3.tuple.Triple;
+import zeroPackage.ZeroMath;
+//import zeroPackage.ZeroAccumulator;
+import javax.management.RuntimeErrorException;
+
+/*
+import com.fasterxml.jackson.annotation.JsonIdentityInfo;
+import com.fasterxml.jackson.annotation.ObjectIdGenerators;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonTypeInfo;
+import com.fasterxml.jackson.annotation.JsonSubTypes;
+
+
+@JsonTypeInfo(
+ use = JsonTypeInfo.Id.CLASS,
+ include = JsonTypeInfo.As.PROPERTY,
+ property = "type" // 👈 this will be the field name in your JSON
+ )
+@JsonSubTypes({
+ @JsonSubTypes.Type(value = GCDistrictHeating.class, name = "GCDistrictHeating"),
+ @JsonSubTypes.Type(value = GCEnergyConversion.class, name = "GCEnergyConversion"),
+ @JsonSubTypes.Type(value = GCEnergyProduction.class, name = "GCEnergyProduction"),
+ @JsonSubTypes.Type(value = GCGridBattery.class, name = "GCGridBattery"),
+ @JsonSubTypes.Type(value = GCHouse.class, name = "GCHouse"),
+ @JsonSubTypes.Type(value = GCNeighborhood.class, name = "GCNeighborhood"),
+ @JsonSubTypes.Type(value = GCPublicCharger.class, name = "GCPublicCharger"),
+ @JsonSubTypes.Type(value = GCUtility.class, name = "GCUtility"),
+ //@JsonSubTypes.Type(value = J_EAEV.class, name = "J_EAEV"),
+ //@JsonSubTypes.Type(value = J_EADieselVehicle.class, name = "J_EADieselVehicle"),
+
+ // Add other known subtypes here if needed
+})
+*/
+
+//@JsonIgnoreProperties({"va_gridConnection","_origin_VA","_pl_powerFlows_autoUpdateEvent_xjal","_SOC_plot_autoUpdateEvent_xjal"})
+//@JsonIdentityInfo(generator = ObjectIdGenerators.UUIDGenerator.class, property = "@id")
+ I_EnergyData
+ energyModel.c_gridConnections.add(this);
+
+
+v_liveData = new J_LiveData(this);
+v_liveData.activeEnergyCarriers = EnumSet.of(OL_EnergyCarriers.ELECTRICITY);
+v_liveData.activeProductionEnergyCarriers = EnumSet.of(OL_EnergyCarriers.ELECTRICITY);
+v_liveData.activeConsumptionEnergyCarriers= EnumSet.of(OL_EnergyCarriers.ELECTRICITY);
+v_liveConnectionMetaData = new J_ConnectionMetaData(this);
+v_liveAssetsMetaData = new J_AssetsMetaData(this);
+v_liveData.connectionMetaData = v_liveConnectionMetaData;
+v_liveData.assetsMetaData = v_liveAssetsMetaData;
+
+fm_currentProductionFlows_kW = new J_FlowsMap();
+fm_currentConsumptionFlows_kW = new J_FlowsMap();
+fm_currentBalanceFlows_kW = new J_FlowsMap();
+fm_currentAssetFlows_kW = new J_ValueMap(OL_AssetFlowCategories.class);
+
+fm_consumptionForHeating_kW = new J_FlowsMap();
+fm_heatFromEnergyCarrier_kW = new J_FlowsMap();
+ false
+
+ 1658499438201
+ 1658499438201
+
+ T extends Agent
+
+ Generic parameter:
+
+ ENTITY
+ 100
+ false
+ 100
+ true
+
+ -4144960
+ null
+
+ true
+ true
+ false
+
+ 10
+ MPS
+
+
+ 1
+ METER
+
+
+ 1
+ METER
+
+
+ 1
+ METER
+
+
+
+ false
+
+ 1.0
+ SECOND
+
+ CONTINUOUS
+ 500
+ 500
+ 0
+ 100
+ 100
+ MOORE
+ USER_DEF
+ USER_DEF
+ 2
+ 50
+ 0.95
+ 10
+
+
+ true
+ 1658477089945
+ true
+ 1658563200000
+
+ 0
+ HOUR
+
+
+ 1
+ HOUR
+
+
+
+ 1658499438199
+ scale
+ 30
+ -260
+ false
+ false
+ false
+ SHAPE_DRAW_2D3D
+ 100
+ 0
+ BASED_ON_LENGTH
+ 10
+ METER
+ 10
+ true
+
+ 1658499438202
+ 1658499438198
+
+
+ 1666282164534
+ v_previousPowerElectricity_kW
+ 25
+ 870
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1674329641809
+ v_currentElectricityPriceConsumption_eurpkWh
+ true
+ 2300
+ 380
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1674396166866
+ v_WTPCharging_eurpkWh
+ true
+ 2300
+ 400
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1678710234324
+ v_lowPassFactorLoad_fr
+ true
+ 2300
+ 440
+
+ false
+ true
+ true
+
+ double
+
+ 0.1
+
+
+
+
+ 1695824940090
+ v_WTRV2G_eurpkWh
+ true
+ 2300
+ 420
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1701700372072
+ v_currentEnergyCurtailed_kW
+ 25
+ 775
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1705421898378
+ v_currentPrimaryEnergyProductionHeatpumps_kW
+ 25
+ 755
+
+ false
+ false
+ true
+
+ double
+
+
+
+ 1720442507543
+ v_enableCurtailment
+ 270
+ 240
+
+ false
+ true
+ true
+
+ boolean
+
+
+
+ 1720435316099
+ v_nfatoWeekendDeliveryCapacity_kW
+ Capacities for Non-Firm ATO per hour of the day
+ 270
+ 170
+
+ false
+ true
+ true
+
+ double[]
+
+ new double[24]
+
+
+
+
+ 1720435335143
+ v_nfatoWeekDeliveryCapacity_kW
+ Capacities for Non-Firm ATO per hour of the day
+ 270
+ 150
+
+ false
+ true
+ true
+
+ double[]
+
+ new double[24]
+
+
+
+
+ 1720520594279
+ v_enableNFato
+ 270
+ 260
+
+ false
+ true
+ true
+
+ boolean
+
+
+
+ 1721833484396
+ v_previousPowerHeat_kW
+ Heat balance of previous timestep
+ 25
+ 890
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1721821764640
+ v_hasQuarterHourlyValues
+ 270
+ 280
+
+ false
+ true
+ true
+
+ boolean
+
+
+
+ 1725968910310
+ v_nfatoWeekendFeedinCapacity_kW
+ Capacities for Non-Firm ATO per hour of the day
+ 270
+ 210
+
+ false
+ true
+ true
+
+ double[]
+
+ new double[24]
+
+
+
+
+ 1725968910312
+ v_nfatoWeekFeedinCapacity_kW
+ Capacities for Non-Firm ATO per hour of the day
+ 270
+ 190
+
+ false
+ true
+ true
+
+ double[]
+
+ new double[24]
+
+
+
+
+ 1729777741783
+ fm_currentConsumptionFlows_kW
+ 25
+ 695
+
+ false
+ true
+ true
+
+ J_FlowsMap
+
+
+
+ 1729778045250
+ fm_currentProductionFlows_kW
+ 25
+ 675
+
+ false
+ true
+ true
+
+ J_FlowsMap
+
+
+
+ 1729779945875
+ v_currentPrimaryEnergyProduction_kW
+ 25
+ 715
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1729779968944
+ v_currentFinalEnergyConsumption_kW
+ 25
+ 735
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1729781848174
+ fm_currentBalanceFlows_kW
+ 25
+ 655
+
+ false
+ true
+ true
+
+ J_FlowsMap
+
+
+
+ 1737539227165
+ v_batteryStoredEnergy_kWh
+ 25
+ 836
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1741182119260
+ v_rapidRunData
+ 320
+ 840
+
+ false
+ true
+ true
+
+ J_RapidRunData
+
+
+
+ 1741182119264
+ v_liveData
+ 320
+ 920
+
+ false
+ true
+ true
+
+ J_LiveData
+
+
+
+ 1741277722819
+ v_previousRunData
+ 330
+ 860
+
+ false
+ true
+ true
+
+ J_RapidRunData
+
+ null
+
+
+
+
+ 1741871129695
+ v_liveAssetsMetaData
+ 330
+ 940
+
+ false
+ true
+ true
+
+ J_AssetsMetaData
+
+
+
+ 1741942930553
+ v_liveConnectionMetaData
+ 330
+ 960
+
+ false
+ true
+ true
+
+ J_ConnectionMetaData
+
+
+
+ 1753970741239
+ fm_currentAssetFlows_kW
+ 25
+ 815
+
+ false
+ true
+ true
+
+ J_ValueMap
+
+
+
+ 1758897737246
+ v_originalRapidRunData
+ 330
+ 880
+
+ false
+ true
+ true
+
+ J_RapidRunData
+
+
+
+ 1762852227489
+ p_batteryManagement
+ Is variable to be able to make it private, but functions as a parameter -> doesnt change during rapid run.
+ 640
+ 710
+
+ false
+ true
+ true
+
+ I_BatteryManagement
+
+
+
+ 1762852413970
+ p_chargingManagement
+ Is variable to be able to make it private, but functions as a parameter -> doesnt change during rapid run.
+ 640
+ 460
+
+ false
+ true
+ true
+
+ I_ChargingManagement
+
+
+
+ 1762852443276
+ p_heatingManagement
+ Is variable to be able to make it private, but functions as a parameter -> doesnt change during rapid run.
+ 620
+ 110
+
+ false
+ true
+ true
+
+ I_HeatingManagement
+
+
+
+ 1764770171693
+ fm_consumptionForHeating_kW
+ 30
+ 960
+
+ false
+ true
+ true
+
+ J_FlowsMap
+
+
+
+ 1764770205588
+ fm_heatFromEnergyCarrier_kW
+ 30
+ 940
+
+ false
+ true
+ true
+
+ J_FlowsMap
+
+
+
+ 1658500465208
+ p_parentNodeElectricID
+ 50
+ 160
+
+ false
+ true
+ true
+
+ String
+ NONE
+ false
+
+ 1658500465206
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1658752146271
+ p_gridConnectionID
+ 50
+ 60
+
+ false
+ true
+ true
+
+ String
+ NONE
+ false
+
+ 1658752146269
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1660053984881
+ p_parentNodeHeatID
+ 50
+ 200
+
+ false
+ true
+ true
+
+ String
+ NONE
+ false
+
+ 1660053984879
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1660115328584
+ p_BuildingThermalAsset
+ 600
+ 70
+
+ false
+ true
+ true
+
+ J_EABuilding
+ NONE
+ false
+
+ null
+
+
+ 1660115328582
+ TEXT_BOX
+ 0
+ 100
+ SEPARATOR
+
+
+
+
+ 1660229326795
+ p_ownerID
+ 50
+ 120
+
+ false
+ true
+ true
+
+ String
+ NONE
+ false
+
+ 1660229326793
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1668695364192
+ p_batteryAsset
+ 620
+ 690
+
+ false
+ true
+ true
+
+ J_EAStorageElectric
+ NONE
+ false
+
+ 1668695364190
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1671459091954
+ p_electrolyserOperationMode
+ 270
+ 100
+
+ false
+ true
+ true
+
+ OL_ElectrolyserOperationMode
+ NONE
+ false
+
+ OL_ElectrolyserOperationMode.BALANCE
+
+
+ 1671459091952
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1676449763319
+ p_heatBuffer
+ 620
+ 670
+
+ false
+ true
+ true
+
+ J_EAStorageHeat
+ NONE
+ false
+
+ 1676449763317
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1684919785784
+ p_gasBuffer
+ 620
+ 770
+
+ false
+ true
+ true
+
+ J_EAStorageGas
+ NONE
+ false
+
+ 1684919785782
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1692878211840
+ p_cookingTracker
+ 620
+ 380
+
+ false
+ true
+ true
+
+ J_ActivityTrackerCooking
+ NONE
+ false
+
+ 1692878211838
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1692890035894
+ p_energyLabel
+ 50
+ 460
+
+ false
+ true
+ true
+
+ OL_GridConnectionIsolationLabel
+ NONE
+ false
+
+ 1692890035892
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1692973005119
+ p_DHWAsset
+ 620
+ 320
+
+ false
+ true
+ true
+
+ J_EAConsumption
+ NONE
+ false
+
+ null
+
+
+ 1692973005117
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1697021029662
+ p_longitude
+ 50
+ 315
+
+ false
+ true
+ true
+
+ double
+ NONE
+ false
+
+ 1697021029660
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1697021029674
+ p_latitude
+ 50
+ 335
+
+ false
+ true
+ true
+
+ double
+ NONE
+ false
+
+ 1697021029672
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1698935198538
+ p_floorSurfaceArea_m2
+ 50
+ 420
+
+ false
+ true
+ true
+
+ double
+ NONE
+ false
+
+ 1698935198536
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1700492967648
+ p_GISPoint
+ 50
+ 295
+
+ false
+ true
+ true
+
+ GISPoint
+ NONE
+ false
+
+ 1700492967646
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1704985428470
+ p_owner
+ 50
+ 140
+
+ false
+ true
+ true
+
+ ConnectionOwner
+ NONE
+ false
+
+ 1704985428468
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1714137460172
+ p_roofSurfaceArea_m2
+ 50
+ 440
+
+ false
+ true
+ true
+
+ double
+ NONE
+ false
+
+ 1714137460170
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1718887078133
+ p_purposeBAG
+ 50
+ 399
+
+ false
+ true
+ true
+
+ String
+ NONE
+ false
+
+ 1718887078131
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1722411169263
+ p_curtailmentMode
+ 270
+ 120
+
+ false
+ true
+ true
+
+ OL_CurtailmentMode
+ NONE
+ false
+
+ OL_CurtailmentMode.CAPACITY
+
+
+ 1722411169261
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1722429053561
+ p_name
+ 50
+ 80
+
+ false
+ true
+ true
+
+ String
+ NONE
+ false
+
+ 1722429053559
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1726146956845
+ p_address
+ A Java class that contains all the relevant information about the grid connection address. The class contains a method .getAddress() which returns a formatted String of the address.
+ 50
+ 370
+
+ false
+ true
+ true
+
+ J_Address
+ NONE
+ false
+
+ 1726146956843
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1747302864499
+ p_parentNodeHeat
+ 50
+ 220
+
+ false
+ true
+ true
+
+ GridNode
+ NONE
+ false
+
+ 1747302864497
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1747303156910
+ p_parentNodeElectric
+ 50
+ 180
+
+ false
+ true
+ true
+
+ GridNode
+ NONE
+ false
+
+ 1747303156908
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1753366605959
+ v_isActive
+ 270
+ 310
+
+ false
+ true
+ true
+
+ boolean
+ NONE
+ false
+
+ true
+
+
+ 1753366605957
+ CHECK_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1757330831065
+ p_uid
+ true
+ 50
+ 100
+
+ false
+ true
+ true
+
+ String
+ NONE
+ false
+
+ 1757330831063
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1659962626903
+ c_energyAssets
+ 580
+ 50
+
+ false
+ true
+ true
+
+ ArrayList
+ J_EA
+ String
+
+
+
+ 1659962626907
+ c_storageAssets
+ 600
+ 650
+
+ false
+ true
+ true
+
+ ArrayList
+ J_EAStorage
+ String
+
+
+
+ 1659962626909
+ c_consumptionAssets
+ 600
+ 300
+
+ false
+ true
+ true
+
+ ArrayList
+ J_EAConsumption
+ String
+
+
+
+ 1659962626911
+ c_productionAssets
+ 600
+ 340
+
+ false
+ true
+ true
+
+ ArrayList
+ J_EAProduction
+ String
+
+
+
+ 1659962626913
+ c_conversionAssets
+ 600
+ 360
+
+ false
+ true
+ true
+
+ ArrayList
+ J_EAConversion
+ String
+
+
+
+ 1667746389220
+ c_vehicleAssets
+ 600
+ 400
+
+ false
+ true
+ true
+
+ ArrayList
+ J_EAVehicle
+ String
+
+
+
+ 1669115948280
+ c_dieselVehicles
+ 620
+ 580
+
+ false
+ true
+ true
+
+ ArrayList
+ J_EADieselVehicle
+ String
+
+
+
+ 1692864624612
+ c_tripTrackers
+ 620
+ 420
+
+ false
+ true
+ true
+
+ ArrayList
+ J_ActivityTrackerTrips
+ String
+
+
+
+ 1700044359363
+ c_profileAssets
+ 600
+ 278
+
+ false
+ true
+ true
+
+ ArrayList
+ J_EAProfile
+ String
+
+
+
+ 1704895219414
+ c_connectedGISObjects
+ 50
+ 490
+
+ false
+ true
+ true
+
+ ArrayList
+ GIS_Object
+ String
+
+
+
+ 1711012701187
+ c_hydrogenVehicles
+ 620
+ 600
+
+ false
+ true
+ true
+
+ ArrayList
+ J_EAHydrogenVehicle
+ String
+
+
+
+ 1742484728807
+ c_parentCoops
+ 50
+ 250
+
+ false
+ true
+ true
+
+ ArrayList
+ EnergyCoop
+ String
+
+
+
+ 1750258408126
+ c_chargers
+ 600
+ 626
+
+ false
+ true
+ true
+
+ ArrayList
+ J_EAChargePoint
+ String
+
+
+
+ 1753088511626
+ c_heatingAssets
+ A collection of assets that can deliver heat. This collection does not include the heat buffer or thermal building.
+ 600
+ 90
+
+ false
+ true
+ true
+
+ ArrayList
+ J_EAConversion
+ String
+
+
+
+ 1754581015887
+ c_electricVehicles
+ 620
+ 440
+
+ false
+ true
+ true
+
+ ArrayList
+ J_EAEV
+ String
+
+
+
+
+
+ VOID
+ double
+ 1658500398176
+ f_connectToParents
+ 911
+ 190
+
+ false
+ true
+ true
+ GridNode myParentNodeElectric = findFirst(energyModel.pop_gridNodes, p->p.p_gridNodeID.equals(p_parentNodeElectricID)) ;
+if( myParentNodeElectric != null ) {
+ p_parentNodeElectric = myParentNodeElectric;
+ myParentNodeElectric.f_connectToChild(this);
+}
+
+GridNode myParentNodeHeat = findFirst(energyModel.pop_gridNodes, p->p.p_gridNodeID.equals(p_parentNodeHeatID)) ;
+if( myParentNodeHeat != null ) {
+ p_parentNodeHeat = myParentNodeHeat;
+ myParentNodeHeat.f_connectToChild(this);
+}
+
+if ( p_owner == null ){
+ p_owner = findFirst(energyModel.pop_connectionOwners, p->p.p_actorID.equals(p_ownerID));
+}
+
+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) {
+ //p_ownerActor = myParentEnergySupplier;
+ l_ownerActor.connectTo(myParentEnergySupplier);
+ myParentEnergySupplier.f_connectToChild(this);
+}
+EnergyCoop myParentEnergyCoop = findFirst(main.pop_energyCoops, p->p.p_actorID.equals(p_ownerID)) ;
+if( myParentEnergyCoop instanceof EnergyCoop) {
+ //p_ownerActor = myParentEnergyCoop;
+ l_ownerActor.connectTo(myParentEnergyCoop);
+ myParentEnergyCoop.f_connectToChild(this);
+}*/
+
+
+ VOID
+ double
+ 1660212665961
+ f_connectionMetering
+ 910
+ 450
+
+ false
+ true
+ true
+ 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("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){
+ f_rapidRunDataLogging();
+} else {
+ f_fillLiveDataSets();
+}
+
+/*
+// Further Subdivision of asset types within energy carriers
+v_fixedConsumptionElectric_kW = 0;
+for (J_EA j_ea : c_fixedConsumptionElectricAssets) {
+ v_fixedConsumptionElectric_kW += j_ea.getLastFlows().get(OL_EnergyCarriers.ELECTRICITY);
+}
+
+v_hydrogenElectricityConsumption_kW = 0;
+for (J_EA j_ea : c_electrolyserAssets) {
+ v_hydrogenElectricityConsumption_kW += j_ea.getLastFlows().get(OL_EnergyCarriers.ELECTRICITY);
+}
+
+v_heatPumpElectricityConsumption_kW = 0;
+for (J_EA j_ea : c_electricHeatpumpAssets) {
+ v_heatPumpElectricityConsumption_kW += j_ea.getLastFlows().get(OL_EnergyCarriers.ELECTRICITY);
+}
+
+v_evChargingPowerElectric_kW = 0;
+for (J_EA j_ea : c_EvAssets) {
+ if (j_ea instanceof J_EAEV) {
+ if (((J_EAEV)j_ea).vehicleScaling == 0) {
+ continue;
+ }
+ }
+ v_evChargingPowerElectric_kW += j_ea.getLastFlows().get(OL_EnergyCarriers.ELECTRICITY);
+}
+
+v_batteryPowerElectric_kW = 0;
+v_batteryStoredEnergy_kWh = 0;
+for (J_EA j_ea : c_batteryAssets) {
+ if (((J_EAStorageElectric)j_ea).getCapacityElectric_kW() != 0 && ((J_EAStorageElectric)j_ea).getStorageCapacity_kWh() != 0) {
+ v_batteryPowerElectric_kW += j_ea.getLastFlows().get(OL_EnergyCarriers.ELECTRICITY);
+ v_batteryStoredEnergy_kWh += ((J_EAStorageElectric)j_ea).getCurrentStateOfCharge_kWh();
+
+ }
+}
+
+v_CHPProductionElectric_kW = 0;
+for (J_EA j_ea : c_chpAssets) {
+ v_CHPProductionElectric_kW -= j_ea.getLastFlows().get(OL_EnergyCarriers.ELECTRICITY);
+}
+
+v_pvProductionElectric_kW = 0;
+for (J_EA j_ea : c_pvAssets) {
+ v_pvProductionElectric_kW -= j_ea.getLastFlows().get(OL_EnergyCarriers.ELECTRICITY);
+}
+
+v_windProductionElectric_kW = 0;
+for (J_EA j_ea : c_windAssets) {
+ v_windProductionElectric_kW -= j_ea.getLastFlows().get(OL_EnergyCarriers.ELECTRICITY);
+}
+
+v_ptProductionHeat_kW = 0;
+for (J_EA j_ea : c_ptAssets) {
+ v_ptProductionHeat_kW -= j_ea.getLastFlows().get(OL_EnergyCarriers.HEAT);
+}
+
+//Set asset flows
+v_assetFlows.setFlows(v_fixedConsumptionElectric_kW,
+ v_heatPumpElectricityConsumption_kW,
+ max(0,v_evChargingPowerElectric_kW),
+ max(0,v_batteryPowerElectric_kW),
+ v_hydrogenElectricityConsumption_kW,
+ v_electricHobConsumption_kW,
+ v_districtHeatDelivery_kW,
+ v_pvProductionElectric_kW,
+ v_windProductionElectric_kW,
+ v_ptProductionHeat_kW,
+ v_CHPProductionElectric_kW,
+ max(0,-v_batteryPowerElectric_kW),
+ max(0,-v_evChargingPowerElectric_kW),
+ v_batteryStoredEnergy_kWh/1000);
+*/
+//
+
+
+
+ VOID
+ double
+ 1664961435385
+ f_operateFlexAssets
+ 910
+ 280
+
+ false
+ true
+ true
+ //Must be overwritten in child agent
+f_manageHeating();
+
+f_manageEVCharging();
+
+f_manageChargePoints();
+
+f_manageBattery();
+
+
+ VOID
+ double
+ 1668528273163
+ f_calculateEnergyBalance
+ 890
+ 240
+
+ false
+ true
+ true
+ v_previousPowerElectricity_kW = fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.ELECTRICITY);
+v_previousPowerHeat_kW = fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.HEAT);
+
+fm_currentProductionFlows_kW.clear();
+fm_currentConsumptionFlows_kW.clear();
+fm_currentBalanceFlows_kW.clear();
+fm_currentAssetFlows_kW.clear();
+
+fm_heatFromEnergyCarrier_kW.clear();
+fm_consumptionForHeating_kW.clear();
+
+v_currentPrimaryEnergyProduction_kW = 0;
+v_currentFinalEnergyConsumption_kW = 0;
+
+v_currentEnergyCurtailed_kW = 0;
+v_currentPrimaryEnergyProductionHeatpumps_kW = 0;
+v_batteryStoredEnergy_kWh = 0;
+// Categorical power flows
+/*v_fixedConsumptionElectric_kW = 0;
+v_electricHobConsumption_kW = 0;
+v_heatPumpElectricityConsumption_kW = 0;
+v_hydrogenElectricityConsumption_kW = 0;
+v_evChargingPowerElectric_kW = 0;
+v_batteryPowerElectric_kW = 0;
+v_windProductionElectric_kW = 0;
+v_pvProductionElectric_kW = 0;
+v_ptProductionHeat_kW = 0;
+v_conversionPowerElectric_kW = 0;
+v_CHPProductionElectric_kW = 0;
+v_districtHeatDelivery_kW = 0;*/
+
+if (v_enableNFato) {
+ f_nfatoUpdateConnectionCapacity();
+}
+
+c_tripTrackers.forEach(t -> t.manageActivities(energyModel.t_h-energyModel.p_runStartTime_h));
+
+f_operateFixedAssets();
+f_operateFlexAssets();
+
+f_curtailment();
+
+f_connectionMetering();
+
+//if (!Double.isFinite(v_currentPowerElectricity_kW)) {
+// traceln("Gridconnection %s with connection_id %s has NaN or infinite v_currentPowerElectricity_kW at time %s!", p_gridConnectionID, p_company_connection_id, energyModel.t_h);
+//}
+
+
+ VOID
+ double
+ 1668528300576
+ f_operateFixedAssets
+ 910
+ 260
+
+ false
+ true
+ true
+ c_dieselVehicles.forEach(v -> v.f_updateAllFlows());
+c_hydrogenVehicles.forEach(v -> v.f_updateAllFlows());
+c_consumptionAssets.forEach(c -> c.f_updateAllFlows());
+c_productionAssets.forEach(p -> p.f_updateAllFlows());
+c_profileAssets.forEach(p -> p.f_updateAllFlows(energyModel.t_h));
+
+
+ VOID
+ double
+ 1668983912731
+ f_resetStates
+ 890
+ 580
+
+ false
+ true
+ true
+ fm_currentProductionFlows_kW.clear();
+fm_currentConsumptionFlows_kW.clear();
+fm_currentBalanceFlows_kW.clear();
+fm_heatFromEnergyCarrier_kW.clear();
+fm_consumptionForHeating_kW.clear();
+//fm_currentAssetFlows_kW.clear(); // Why not this one??
+
+v_previousPowerElectricity_kW = 0;
+v_previousPowerHeat_kW = 0;
+//v_electricityPriceLowPassed_eurpkWh = 0;
+//v_currentElectricityPriceConsumption_eurpkWh = 0;
+
+v_rapidRunData.resetAccumulators(energyModel.p_runEndTime_h - energyModel.p_runStartTime_h, energyModel.p_timeStep_h, v_liveData.activeEnergyCarriers, v_liveData.activeConsumptionEnergyCarriers, v_liveData.activeProductionEnergyCarriers); //f_initializeAccumulators();
+
+//Reset specific variables/collections in specific GC types (GCProduction, GConversion, etc.)
+f_resetSpecificGCStates();
+
+
+
+ VOID
+ double
+ 1671095995172
+ f_manageEVCharging
+ 920
+ 370
+
+ false
+ true
+ true
+ if(c_electricVehicles.size() > 0){
+ if (p_chargingManagement == null) {
+ //throw new RuntimeException("Tried to charge EV without algorithm in GC!: " + p_gridConnectionID);
+ traceln("Tried to charge EV without algorithm in GC!: %s" ,p_gridConnectionID);
+
+ } else {
+ p_chargingManagement.manageCharging();
+ }
+}
+
+
+
+ VOID
+ double
+ 1671095995175
+ f_simpleCharging
+ Charging when arriving home, not taking grid limits into account
+ true
+ 1960
+ 320
+
+ false
+ true
+ true
+ // Removing items while going through a loop, so we do so in reverse order
+
+ArrayList<J_EAEV> copiedVehicleList = new ArrayList<J_EAEV>(c_vehiclesAvailableForCharging);
+int countDeletedItems = 0;
+
+for ( int i = 0; i < copiedVehicleList.size(); i++ ) {
+ J_EAEV ev = copiedVehicleList.get(i);
+ if (ev.vehicleScaling != 0) {
+ if( !ev.getAvailability() || ev.getCurrentStateOfCharge_fr() == 1 ) {
+ ev.f_updateAllFlows( 0.0 );
+ c_vehiclesAvailableForCharging.remove( i - countDeletedItems );
+ countDeletedItems ++;
+ }
+ else {
+ ev.f_updateAllFlows( 1.0 );
+ }
+ }
+}
+
+
+ VOID
+ double
+ 1671095995177
+ f_maxSpreadCharging
+ true
+ 1970
+ 360
+
+ false
+ true
+ true
+ ArrayList<J_EAEV> copiedVehicleList = new ArrayList<J_EAEV>(c_vehiclesAvailableForCharging);
+int countDeletedItems = 0;
+
+for ( int i = 0; i < copiedVehicleList.size(); i++ ){
+ J_EAEV ev = copiedVehicleList.get(i);
+ if (ev.vehicleScaling != 0) {
+ if(!ev.getAvailability() || ev.getCurrentStateOfCharge_fr() == 1) {
+ ev.f_updateAllFlows( 0.0 );
+ c_vehiclesAvailableForCharging.remove( i - countDeletedItems );
+ countDeletedItems ++;
+ }
+ else {
+ double chargeNeedForNextTrip_kWh = max(0, ev.getEnergyNeedForNextTrip_kWh() - ev.getCurrentStateOfCharge_kWh());
+ double maxChargingPower_kW = ev.getCapacityElectric_kW();
+ double chargeDeadline_h = floor((ev.tripTracker.v_nextEventStartTime_min / 60 - chargeNeedForNextTrip_kWh / maxChargingPower_kW) / energyModel.p_timeStep_h) * energyModel.p_timeStep_h;
+
+ double emptyKWhInBattery = ev.getStorageCapacity_kWh() - ev.getCurrentStateOfCharge_kWh();
+ double timeToNextTrip_h = ev.tripTracker.v_nextEventStartTime_min / 60 - energyModel.t_h;
+ // At the end of the simulation the triptracker returns back to the start of the year, so we make sure the timeToNextTrip is not negative
+ timeToNextTrip_h = (timeToNextTrip_h % 8760 + 8760) % 8760;
+
+ double chargingPower_kW;
+ if ( energyModel.t_h >= chargeDeadline_h && chargeNeedForNextTrip_kWh > 0) { // Must-charge time at max charging power
+ //traceln("Urgency charging! May exceed connection capacity!");
+ chargingPower_kW = maxChargingPower_kW / 2 ; // delen door 2 als quickfix doordat HAVI trucks anders mega pieken veroorzaken in de middag waardoor 'slim' laden beetje nutteloos lijkt
+ }
+ else {
+ chargingPower_kW = emptyKWhInBattery / timeToNextTrip_h;
+ }
+
+ chargingPower_kW = min(chargingPower_kW, maxChargingPower_kW); // cap the charging speed at the electric capacity
+ double ratio_fr = chargingPower_kW / maxChargingPower_kW;
+ ev.f_updateAllFlows( ratio_fr );
+ }
+ }
+}
+
+
+ VOID
+ double
+ 1671095995179
+ f_maxPowerCharging
+ Charge at max power taking grid constaints into account
+ true
+ 1970
+ 380
+
+ false
+ true
+ true
+
+ availableCapacityForCharging_kW
+ double
+
+ double remainingChargingPower_kW = availableCapacityForCharging_kW;
+
+ArrayList<J_EAEV> copiedVehicleList = new ArrayList<J_EAEV>(c_vehiclesAvailableForCharging);
+int countDeletedItems = 0;
+
+// Sort vehicles by time until charge deadline
+copiedVehicleList.sort((ev1, ev2) -> Double.compare(f_getChargeDeadline(ev1), f_getChargeDeadline(ev2)));
+c_vehiclesAvailableForCharging = copiedVehicleList;
+
+for ( int i = 0; i < copiedVehicleList.size(); i++ ){
+ J_EAEV ev = copiedVehicleList.get(i);
+ if (ev.vehicleScaling != 0) {
+ if( !ev.getAvailability() || ev.getCurrentStateOfCharge_fr() == 1 ) {
+ ev.f_updateAllFlows( 0.0 );
+ c_vehiclesAvailableForCharging.remove( i - countDeletedItems );
+ countDeletedItems ++;
+ }
+ else {
+ //traceln("current time: " + energyModel.t_h);
+ //traceln("ev: " + ev);
+ //traceln("dist: " + ev.getTripTracker().v_tripDist_km);
+ double chargeNeedForNextTrip_kWh = max(0, ev.getEnergyNeedForNextTrip_kWh() - ev.getCurrentStateOfCharge_kWh());
+ //traceln("chargeNeedForNextTrip_kWh: " + chargeNeedForNextTrip_kWh);
+ double maxChargingPower_kW = ev.getCapacityElectric_kW();
+ double chargeDeadline_h = floor((ev.tripTracker.v_nextEventStartTime_min / 60 - chargeNeedForNextTrip_kWh / maxChargingPower_kW) / energyModel.p_timeStep_h) * energyModel.p_timeStep_h;
+
+ //double starttime = ev.tripTracker.v_nextEventStartTime_min / 60;
+ //traceln("starttime: " + starttime);
+ //traceln("chargeDeadline_h: " + chargeDeadline_h);
+
+ double chargingPower_kW;
+ if ( energyModel.t_h >= chargeDeadline_h && chargeNeedForNextTrip_kWh > 0) { // Must-charge time at max charging power
+ //traceln("Urgency charging! May exceed connection capacity!");
+ chargingPower_kW = maxChargingPower_kW;
+ }
+ else {
+ chargingPower_kW = remainingChargingPower_kW;
+ }
+
+ chargingPower_kW = min(chargingPower_kW, maxChargingPower_kW);
+ remainingChargingPower_kW = max(0, remainingChargingPower_kW - chargingPower_kW);
+ double ratio_fr = chargingPower_kW / maxChargingPower_kW;
+ ev.f_updateAllFlows( ratio_fr );
+ //gridConnection.v_evChargingPowerElectric_kW += flowsArray[4] - flowsArray[0];
+
+ //double x = flowsArray[4] - flowsArray[0];
+ //traceln("flow: " + x);
+ //traceln("ev: " + ev);
+
+ }
+ }
+}
+
+
+ VOID
+ double
+ 1671095995181
+ f_chargeOnPrice
+ true
+ 1970
+ 420
+
+ false
+ true
+ true
+
+ currentElectricityPriceConsumption_eurpkWh
+ double
+
+
+ availableChargingPower_kW
+ double
+
+ ArrayList<J_EAEV> copiedVehicleList = new ArrayList<J_EAEV>(c_vehiclesAvailableForCharging);
+int countDeletedItems = 0;
+
+double remainingChargePower_kW = availableChargingPower_kW;
+
+for ( int i = 0; i < copiedVehicleList.size(); i++ ){
+ J_EAEV vehicle = copiedVehicleList.get(i);
+
+ if (vehicle.getVehicleScaling() == 0) {
+ continue;
+ }
+
+ if(!vehicle.getAvailability() ){
+ vehicle.f_updateAllFlows( 0 );
+ c_vehiclesAvailableForCharging.remove( i - countDeletedItems );
+ countDeletedItems ++;
+ } else {
+ //double availableChargingPower_kW = v_allowedCapacity_kW - v_currentPowerElectricity_kW - v_chargingPower_kW;
+ double chargeNeedForNextTrip_kWh = max(0, vehicle.energyNeedForNextTrip_kWh - vehicle.getCurrentStateOfCharge_kWh());
+ //double timeToNexTrip_min = vehicle.getMobilityTracker().v_nextTripStartTime_min - energyModel.t_h*60;
+ double maxChargingPower_kW = vehicle.getCapacityElectric_kW();
+ double timeToNextTrip_min = vehicle.tripTracker.v_nextEventStartTime_min - energyModel.t_h*60;
+ double chargeDeadline_min = floor((vehicle.tripTracker.v_nextEventStartTime_min / 60 - chargeNeedForNextTrip_kWh / maxChargingPower_kW) / energyModel.p_timeStep_h) * 60 * energyModel.p_timeStep_h;
+
+ double priceGain_kWhpeur = 1; // When WTP is higher than current electricity price, ramp up charging power with this gain based on the price-delta.
+ double urgencyGain_eurpkWh = 0.4; // How strongly WTP-price shifts based on charging flexibility
+ double maxSpreadChargingPower_kW = min(chargeNeedForNextTrip_kWh / (max(1, timeToNextTrip_min - v_additionalTimeSpreadCharging_MIN) / 60), maxChargingPower_kW);
+ //traceln("maxSpreadChargingPower_kW" + maxSpreadChargingPower_kW);
+ double WTPoffset_eurpkWh = 0.05*(1-energyModel.v_WindYieldForecast_fr);//0.15; // Adds an offset to the WTP price; this value is very much context specific, depending on market conditions during charging periods
+
+ double chargeSetpoint_kW = 0;
+
+ if ( energyModel.t_h*60 >= chargeDeadline_min & chargeNeedForNextTrip_kWh > 0) { // Must-charge time at max charging power
+ //traceln("Urgency charging! May exceed connection capacity!");
+ chargeSetpoint_kW = maxChargingPower_kW;
+ } else if ( vehicle.getCurrentStateOfCharge_fr() < 0.15 ) {
+ chargeSetpoint_kW = min(remainingChargePower_kW, maxChargingPower_kW);
+ } else {
+ //double WTPprice_eurpkWh = v_electricityPriceLowPassed_eurpkWh - flexibilityGain_eurph * (chargeDeadline_min - energyModel.t_h*60 - 600);
+ v_WTPCharging_eurpkWh = WTPoffset_eurpkWh + v_electricityPriceLowPassed_eurpkWh + urgencyGain_eurpkWh * ( maxSpreadChargingPower_kW / maxChargingPower_kW ); // Scale WTP based on flexibility expressed in terms of power-fraction
+ //WTPprice_eurpkWh = WTPoffset_eurpkWh + (main.v_epexNext24hours_eurpkWh+v_electricityPriceLowPassed_eurpkWh)/2 + flexibilityGain_eurpkWh * sqrt(maxSpreadChargingPower_kW/maxChargingPower_kW); // Scale WTP based on flexibility expressed in terms of power-fraction
+ chargeSetpoint_kW = max(0, maxChargingPower_kW * (v_WTPCharging_eurpkWh / currentElectricityPriceConsumption_eurpkWh - 1) * priceGain_kWhpeur);
+ chargeSetpoint_kW = min(remainingChargePower_kW, chargeSetpoint_kW);
+ //traceln("Trying to charge cheaply, time " + energyModel.t_h*60 + " minutes, charge setpoint: " + chargeSetpoint_kW + " kW");
+ /*if (this.getIndex() == 0){
+ traceln("wtp = " + v_WTPCharging_eurpkWh);
+ traceln("remainingChargePower_kW: " + remainingChargePower_kW + "charge setpoint kW: " + chargeSetpoint_kW);
+ }*/
+ }
+ //}
+ //traceln("Hello! Charge setpoint: " + chargeSetpoint_kW);
+ //Pair<J_FlowsMap, Double> flowsPair = vehicle.f_updateAllFlows( chargeSetpoint_kW / maxChargingPower_kW );
+ vehicle.f_updateAllFlows( chargeSetpoint_kW / maxChargingPower_kW );
+ //v_evChargingPowerElectric_kW += flowsMap.get(OL_EnergyCarriers.ELECTRICITY);
+
+ // This seems wrong? the evChargingPowerElectric is keeping track of the total, but is subtracted every time!!
+ //remainingChargePower_kW = availableChargingPower_kW - v_evChargingPowerElectric_kW
+
+ remainingChargePower_kW = availableChargingPower_kW - vehicle.getLastFlows().get(OL_EnergyCarriers.ELECTRICITY);;
+
+ }
+
+}
+
+
+
+
+ VOID
+ double
+ 1677512714652
+ f_setOperatingSwitches
+ 910
+ 210
+
+ false
+ true
+ true
+ if( this instanceof GCDistrictHeating gc) { // Temporarily disabled while transfering to class-based energy assets!
+ gc.f_setConfigurationBooleans();
+}
+
+
+ VOID
+ double
+ 1692799608559
+ f_connectToJ_EA_default
+ 930
+ 120
+
+ false
+ true
+ true
+
+ j_ea
+ J_EA
+
+ f_addEnergyCarriersAndAssetCategoriesFromEA(j_ea);
+
+energyModel.c_energyAssets.add(j_ea);
+c_energyAssets.add(j_ea);
+
+if (j_ea instanceof I_HeatingAsset) {
+ c_heatingAssets.add((J_EAConversion)j_ea);
+ if (p_heatingManagement != null) {
+ p_heatingManagement.notInitialized();
+ }
+}
+
+if (j_ea instanceof J_EAVehicle vehicle) {
+ if (vehicle instanceof J_EADieselVehicle dieselVehicle) {
+ c_dieselVehicles.add( dieselVehicle );
+ } else if (vehicle instanceof J_EAHydrogenVehicle hydrogenVehicle) {
+ c_hydrogenVehicles.add(hydrogenVehicle);
+ } else if (vehicle instanceof J_EAEV ev) {
+ if(p_chargingManagement == null){
+ f_addChargingManagement(OL_ChargingAttitude.SIMPLE);
+ }
+ c_electricVehicles.add(ev);
+ energyModel.c_EVs.add(ev);
+ ev.setV2GActive(p_chargingManagement.getV2GActive());
+ }
+ c_vehicleAssets.add(vehicle);
+ J_ActivityTrackerTrips tripTracker = vehicle.getTripTracker();
+ if (tripTracker == null) { // Only provide tripTracker when vehicle doesn't have it yet!
+ if (vehicle.energyAssetType == OL_EnergyAssetType.ELECTRIC_TRUCK || vehicle.energyAssetType == OL_EnergyAssetType.DIESEL_TRUCK || vehicle.energyAssetType == OL_EnergyAssetType.HYDROGEN_TRUCK) {
+ int rowIndex = uniform_discr(1, 7);//getIndex() % 200;
+ tripTracker = new J_ActivityTrackerTrips(energyModel, energyModel.p_truckTripsCsv, rowIndex, (energyModel.t_h-energyModel.p_runStartTime_h)*60, vehicle);
+ } else if (vehicle.energyAssetType == OL_EnergyAssetType.DIESEL_VAN || vehicle.energyAssetType == OL_EnergyAssetType.ELECTRIC_VAN || vehicle.energyAssetType == OL_EnergyAssetType.HYDROGEN_VAN) {// No mobility pattern for business vans available yet!! Falling back to truck mobility pattern
+ int rowIndex = uniform_discr(1, 7);//getIndex() % 200;
+ tripTracker = new J_ActivityTrackerTrips(energyModel, energyModel.p_truckTripsCsv, rowIndex, (energyModel.t_h-energyModel.p_runStartTime_h)*60, vehicle);
+ tripTracker.setAnnualDistance_km(30_000);
+ } else {
+ //traceln("Adding passenger vehicle to gridconnection %s", this);
+ int rowIndex = uniform_discr(0, 200);
+ while (rowIndex == 28 || rowIndex == 42 || rowIndex == 150) { // 445, 457, 483, 540, 563 all impossible triptrackers for vehicles with 116 kWh and 0.16 kWhpkm
+ rowIndex = uniform_discr(0, 200);
+ }
+ tripTracker = new J_ActivityTrackerTrips(energyModel, energyModel.p_householdTripsCsv, rowIndex, (energyModel.t_h-energyModel.p_runStartTime_h)*60, vehicle);
+ //tripTracker = new J_ActivityTrackerTrips(energyModel, energyModel.p_householdTripsExcel, 18, energyModel.t_h*60, vehicle);
+ //int rowIndex = uniform_discr(1, 7);//getIndex() % 200;
+ //tripTracker = new J_ActivityTrackerTrips(energyModel, energyModel.p_truckTripsExcel, 2, energyModel.t_h*60, vehicle);
+ }
+
+ vehicle.tripTracker = tripTracker;
+ }
+ c_tripTrackers.add( tripTracker );
+ //v_vehicleIndex ++;
+} else if (j_ea instanceof J_EAConsumption consumptionAsset) {
+ c_consumptionAssets.add(consumptionAsset);
+ if (j_ea.energyAssetType == OL_EnergyAssetType.HOT_WATER_CONSUMPTION) {
+ p_DHWAsset = consumptionAsset;
+ }
+} else if (j_ea instanceof J_EAProduction productionAsset) {
+ //c_productionAssets.add((J_EAProduction)j_ea);
+ c_productionAssets.add(productionAsset);
+
+ if (j_ea.energyAssetType == OL_EnergyAssetType.PHOTOVOLTAIC) {
+ double capacity_kW = productionAsset.getCapacityElectric_kW();
+ v_liveAssetsMetaData.totalInstalledPVPower_kW += capacity_kW;
+ 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;
+ }
+ else if (productionAsset.energyAssetType == OL_EnergyAssetType.WINDMILL) {
+ double capacity_kW = productionAsset.getCapacityElectric_kW();
+ v_liveAssetsMetaData.totalInstalledWindPower_kW += capacity_kW;
+ 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;
+ }
+ else if (productionAsset.energyAssetType == OL_EnergyAssetType.PHOTOTHERMAL){
+ if (p_heatingManagement != null) {
+ p_heatingManagement.notInitialized();
+ }
+ }
+} else if (j_ea instanceof J_EAConversion conversionAsset) {
+ c_conversionAssets.add(conversionAsset);
+ if ( conversionAsset.energyAssetType == OL_EnergyAssetType.GAS_PIT || j_ea.energyAssetType == OL_EnergyAssetType.ELECTRIC_HOB){
+ if (p_cookingTracker == null) {
+ int rowIndex = uniform_discr(2, 300);
+ p_cookingTracker = new J_ActivityTrackerCooking(energyModel.p_cookingPatternCsv, rowIndex, (energyModel.t_h-energyModel.p_runStartTime_h)*60, (J_EAConversion)j_ea );
+ } else {
+ p_cookingTracker.HOB = (J_EAConversion)j_ea;
+ }
+ } else if (j_ea instanceof J_EAConversionHeatPump) {
+ energyModel.c_ambientDependentAssets.add(j_ea);
+ }
+} else if (j_ea instanceof J_EAStorage storageAsset) {
+ c_storageAssets.add(storageAsset);
+ energyModel.c_storageAssets.add(storageAsset);
+ if (j_ea instanceof J_EAStorageHeat) {
+ energyModel.c_ambientDependentAssets.add(j_ea);
+ if (j_ea instanceof J_EABuilding buildingAsset) {
+ p_BuildingThermalAsset = buildingAsset;
+ if (p_heatingManagement != null) {
+ p_heatingManagement.notInitialized();
+ }
+ }
+ else {
+ p_heatBuffer = (J_EAStorageHeat)j_ea;
+ if (p_heatingManagement != null) {
+ p_heatingManagement.notInitialized();
+ }
+ }
+ } else if (j_ea instanceof J_EAStorageGas gasStorage) {
+ p_gasBuffer = gasStorage;
+ } else if (j_ea instanceof J_EAStorageElectric battery) {
+ p_batteryAsset = battery;
+ double capacity_MWh = battery.getStorageCapacity_kWh()/1000;
+ v_liveAssetsMetaData.totalInstalledBatteryStorageCapacity_MWh += capacity_MWh;
+ c_parentCoops.forEach( coop -> coop.v_liveAssetsMetaData.totalInstalledBatteryStorageCapacity_MWh += capacity_MWh);
+ energyModel.v_liveAssetsMetaData.totalInstalledBatteryStorageCapacity_MWh += capacity_MWh;
+
+ }
+} else if (j_ea instanceof J_EAProfile profileAsset) {
+ c_profileAssets.add(profileAsset);
+} else if (j_ea instanceof J_EADieselTractor tractor) {
+ c_profileAssets.add(tractor);
+} else if (j_ea instanceof J_EAChargePoint charger) {
+ if(p_chargingManagement == null){
+ f_addChargingManagement(OL_ChargingAttitude.SIMPLE);
+ }
+ c_chargers.add(charger);
+} else {
+ if (!(this instanceof GCHouse && j_ea instanceof J_EAAirco)) {
+ traceln("Unrecognized energy asset %s in gridconnection %s", j_ea, this);
+ }
+}
+
+
+
+ VOID
+ double
+ 1693307881182
+ f_connectToJ_EA
+ 910
+ 100
+
+ false
+ true
+ true
+
+ j_ea
+ J_EA
+
+ f_connectToJ_EA_default(j_ea);
+// Abstract method to be used call GC-subtype specific functions
+
+
+ VOID
+ double
+ 1695822607494
+ f_chargeOnPrice_V2G
+ true
+ 1970
+ 440
+
+ false
+ true
+ true
+
+ currentElectricityPriceConsumption_eurpkWh
+ double
+
+
+ availableChargingPower_kW
+ double
+
+ ArrayList<J_EAEV> copiedVehicleList = new ArrayList<J_EAEV>(c_vehiclesAvailableForCharging);
+int countDeletedItems = 0;
+
+double remainingChargePower_kW = availableChargingPower_kW;
+
+for ( int i = 0; i < copiedVehicleList.size(); i++ ){
+ J_EAEV vehicle = copiedVehicleList.get(i);
+
+ if (vehicle.getVehicleScaling() == 0) {
+ continue;
+ }
+
+ if(!vehicle.getAvailability() ){
+ vehicle.f_updateAllFlows( 0 );
+ c_vehiclesAvailableForCharging.remove( i - countDeletedItems );
+ countDeletedItems ++;
+ } else {
+ //double availableChargingPower_kW = v_allowedCapacity_kW - v_currentPowerElectricity_kW - v_chargingPower_kW;
+ double chargeNeedForNextTrip_kWh = vehicle.energyNeedForNextTrip_kWh - vehicle.getCurrentStateOfCharge_kWh();
+ //double timeToNexTrip_min = vehicle.getMobilityTracker().v_nextTripStartTime_min - energyModel.t_h*60;
+ double maxChargingPower_kW = vehicle.getCapacityElectric_kW();
+ double timeToNextTrip_min = vehicle.tripTracker.v_nextEventStartTime_min - energyModel.t_h*60;
+ double chargeDeadline_min = floor((vehicle.tripTracker.v_nextEventStartTime_min / 60 - chargeNeedForNextTrip_kWh / maxChargingPower_kW) / energyModel.p_timeStep_h) * 60 * energyModel.p_timeStep_h;
+
+ double priceGain_kWhpeur = 1; // When WTP is higher than current electricity price, ramp up charging power with this gain based on the price-delta.
+ double urgencyGain_eurpkWh = 0.4; // How strongly WTP-price shifts based on charging flexibility
+ double maxSpreadChargingPower_kW = min(chargeNeedForNextTrip_kWh / (max(1, timeToNextTrip_min - v_additionalTimeSpreadCharging_MIN) / 60), maxChargingPower_kW);
+ //traceln("maxSpreadChargingPower_kW" + maxSpreadChargingPower_kW);
+ double WTPoffset_eurpkWh = 0;
+ if (energyModel.v_liveAssetsMetaData.totalInstalledWindPower_kW > 499) {
+ WTPoffset_eurpkWh = 0.05*(1-energyModel.v_WindYieldForecast_fr);//0.15; // Adds an offset to the WTP price; this value is very much context specific, depending on market conditions during charging periods
+ } else {
+ WTPoffset_eurpkWh = 0.02;
+ }
+ double V2G_WTR_offset_eurpkWh = 0.05;
+ double chargeSetpoint_kW = 0;
+
+ if ( energyModel.t_h*60 >= chargeDeadline_min - 15 && chargeNeedForNextTrip_kWh > 0) { // Must-charge time at max charging power
+ //traceln("Urgency charging! May exceed connection capacity!");
+ chargeSetpoint_kW = maxChargingPower_kW;
+ } else if ( vehicle.getCurrentStateOfCharge_fr() < 0.15 ) {
+ chargeSetpoint_kW = min(remainingChargePower_kW, maxChargingPower_kW);
+ } else {
+ //double WTPprice_eurpkWh = v_electricityPriceLowPassed_eurpkWh - flexibilityGain_eurph * (chargeDeadline_min - energyModel.t_h*60 - 600);
+ v_WTPCharging_eurpkWh = WTPoffset_eurpkWh + v_electricityPriceLowPassed_eurpkWh + urgencyGain_eurpkWh * ( max(0,maxSpreadChargingPower_kW) / maxChargingPower_kW ); // Scale WTP based on flexibility expressed in terms of power-fraction
+ //WTPprice_eurpkWh = WTPoffset_eurpkWh + (main.v_epexNext24hours_eurpkWh+v_electricityPriceLowPassed_eurpkWh)/2 + flexibilityGain_eurpkWh * sqrt(maxSpreadChargingPower_kW/maxChargingPower_kW); // Scale WTP based on flexibility expressed in terms of power-fraction
+ chargeSetpoint_kW = max(0, maxChargingPower_kW * (v_WTPCharging_eurpkWh / currentElectricityPriceConsumption_eurpkWh - 1) * priceGain_kWhpeur);
+ chargeSetpoint_kW = min(remainingChargePower_kW, chargeSetpoint_kW);
+
+ if ( chargeNeedForNextTrip_kWh < -maxChargingPower_kW*energyModel.p_timeStep_h && chargeSetpoint_kW == 0 ) { // Surpluss SOC and high energy price
+ v_WTRV2G_eurpkWh = V2G_WTR_offset_eurpkWh + v_electricityPriceLowPassed_eurpkWh; // Scale WTP based on flexibility expressed in terms of power-fraction
+ chargeSetpoint_kW = min(0, -maxChargingPower_kW * (currentElectricityPriceConsumption_eurpkWh / v_WTRV2G_eurpkWh - 1) * priceGain_kWhpeur);
+ /*if (chargeSetpoint_kW < 0) {
+ traceln(" V2G Active! Power: " + chargeSetpoint_kW );
+ }*/
+
+ }
+ //traceln("Trying to charge cheaply, time " + energyModel.t_h*60 + " minutes, charge setpoint: " + chargeSetpoint_kW + " kW");
+ /*if (this.getIndex() == 0){
+ traceln("wtp = " + v_WTPCharging_eurpkWh);
+ traceln("remainingChargePower_kW: " + remainingChargePower_kW + "charge setpoint kW: " + chargeSetpoint_kW);
+ }*/
+ }
+
+ vehicle.f_updateAllFlows( chargeSetpoint_kW / maxChargingPower_kW );
+
+ remainingChargePower_kW = availableChargingPower_kW - vehicle.getLastFlows().get(OL_EnergyCarriers.ELECTRICITY);
+
+ }
+}
+
+
+
+
+ VOID
+ double
+ 1698854861644
+ f_initialize
+ 900
+ 50
+
+ false
+ true
+ true
+ if (v_liveConnectionMetaData.physicalCapacity_kW < 0) {
+ throw new RuntimeException("Exception: GridConnection " + p_gridConnectionID + " has negative physical connection capacity!");
+} else if (v_liveConnectionMetaData.contractedDeliveryCapacity_kW < 0) {
+ throw new RuntimeException("Exception: GridConnection " + p_gridConnectionID + " has negative contracted delivery capacity!");
+} else if (v_liveConnectionMetaData.contractedFeedinCapacity_kW < 0) {
+ throw new RuntimeException("Exception: GridConnection " + p_gridConnectionID + " has negative contracted feed in capacity!");
+}
+
+if(v_isActive){
+ if (v_liveConnectionMetaData.contractedDeliveryCapacity_kW == 0.0 && v_liveConnectionMetaData.contractedFeedinCapacity_kW == 0.0 && v_liveConnectionMetaData.physicalCapacity_kW == 0.0) { // If no contracted or physical capacity is given, throw error.
+ throw new RuntimeException("Exception: GridConnection " + p_gridConnectionID + " has 0.0 physical and contracted capacity! Not a valid state of for this agent");
+ } else {
+ if (v_liveConnectionMetaData.contractedDeliveryCapacity_kW == 0.0 && v_liveConnectionMetaData.contractedFeedinCapacity_kW == 0.0) { // If no contracted capacity is given, use physical capacity
+ v_liveConnectionMetaData.contractedDeliveryCapacity_kW = v_liveConnectionMetaData.physicalCapacity_kW;
+ v_liveConnectionMetaData.contractedFeedinCapacity_kW = v_liveConnectionMetaData.physicalCapacity_kW;
+ } else if ( v_liveConnectionMetaData.physicalCapacity_kW == 0 ) { // if no physical capacity is given, use max of delivery and feedin contracted capacities
+ v_liveConnectionMetaData.physicalCapacity_kW = max(v_liveConnectionMetaData.contractedDeliveryCapacity_kW, v_liveConnectionMetaData.contractedFeedinCapacity_kW);
+ }
+ }
+}
+
+if ( c_connectedGISObjects.size()>0) { // can this go into initialisation function?
+ //p_floorSurfaceArea_m2 = totalSurfaceAreaGC_m2;
+ p_longitude = c_connectedGISObjects.get(0).p_longitude; // Get longitude of first building (only used to get nearest trafo)
+ p_latitude = c_connectedGISObjects.get(0).p_latitude; // Get latitude of first building (only used to get nearest trafo)
+ setLatLon(p_latitude, p_longitude);
+
+ //If GC has no assigned trafo_id --> Assign to nearest trafo
+ if (p_parentNodeElectricID == null){
+ //Set nearest agent as trafo
+ GridNode nearestLVStation = getNearestAgent(energyModel.c_gridNodesNotTopLevel);
+ //nearestLVStation.c_electricityGridConnections.add(companyGC); // this should be taken care of in GC.f_initialize()!
+ if (nearestLVStation!=null) {
+ p_parentNodeElectricID = nearestLVStation.p_gridNodeID;
+ }
+ }
+}
+
+if (p_parentNodeElectricID == null) {
+ p_parentNodeElectricID = findFirst(energyModel.pop_gridNodes, GN->GN.p_energyCarrier.equals(OL_EnergyCarriers.ELECTRICITY)).p_gridNodeID;
+ traceln("GridConnection %s wasn't assigned a GridNodeElectric! Using first gridNode Electric in pop_gridNodes", this);
+}
+
+f_connectToParents();
+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!");
+}
+else {
+ // Calculate the Wind and PV Installed under the parent gridnode
+ double PV_kW = 0;
+ double Wind_kW = 0;
+ for (J_EAProduction j_ea : c_productionAssets) {
+ if (j_ea.getEAType() == OL_EnergyAssetType.PHOTOVOLTAIC) {
+ PV_kW += ((J_EAProduction)j_ea).getCapacityElectric_kW();
+ }
+ else if (j_ea.getEAType() == OL_EnergyAssetType.WINDMILL) {
+ Wind_kW += ((J_EAProduction)j_ea).getCapacityElectric_kW();
+ }
+ }
+ p_parentNodeElectric.v_totalInstalledPVPower_kW += PV_kW;
+ p_parentNodeElectric.v_totalInstalledWindPower_kW += Wind_kW;
+}
+
+f_setOperatingSwitches();
+
+// Initializing Live Data Class
+v_liveAssetsMetaData.updateActiveAssetData(new ArrayList<>(List.of(this)));
+//v_liveData.activeConsumptionEnergyCarriers = v_activeConsumptionEnergyCarriers;
+//v_liveData.activeProductionEnergyCarriers = v_activeProductionEnergyCarriers;
+//v_liveData.activeEnergyCarriers = v_activeEnergyCarriers;
+
+f_initializeDataSets();
+
+
+
+ VOID
+ double
+ 1702373771433
+ f_addFlows
+ 930
+ 300
+
+ false
+ true
+ true
+
+ flowsMap
+ J_FlowsMap
+
+
+ energyUse_kW
+ double
+
+
+ assetFlowsMap
+ J_ValueMap
+
+
+ caller
+ J_EA
+
+ if (caller instanceof J_EAStorageElectric) {
+ fm_currentBalanceFlows_kW.addFlow(OL_EnergyCarriers.ELECTRICITY, flowsMap.get(OL_EnergyCarriers.ELECTRICITY));
+
+ // Only allocate battery losses as consumption. Charging/discharging is neither production nor consumption. Do we need an element in flowsmap indicating power into storage??
+ fm_currentConsumptionFlows_kW.addFlow(OL_EnergyCarriers.ELECTRICITY, max(0, energyUse_kW));
+ v_currentFinalEnergyConsumption_kW += max(0, energyUse_kW);
+ v_batteryStoredEnergy_kWh += ((J_EAStorageElectric)caller).getCurrentStateOfCharge_kWh();
+} else {
+ fm_currentBalanceFlows_kW.addFlows(flowsMap);
+ for (OL_EnergyCarriers EC : flowsMap.keySet()) {
+ double flow_kW = flowsMap.get(EC);
+ if (flow_kW < 0) {
+ fm_currentProductionFlows_kW.addFlow(EC, -flow_kW);
+ }
+ else {
+ fm_currentConsumptionFlows_kW.addFlow(EC, flow_kW);
+ }
+ }
+ v_currentPrimaryEnergyProduction_kW += max(0, -energyUse_kW);
+ v_currentFinalEnergyConsumption_kW += max(0, energyUse_kW);
+}
+
+if ( caller instanceof J_EAConversionHeatPump ) {
+ v_currentPrimaryEnergyProductionHeatpumps_kW -= energyUse_kW;
+}
+
+fm_currentAssetFlows_kW.addFlows(assetFlowsMap);
+
+
+ VOID
+ double
+ 1714646521271
+ f_removeTheJ_EA
+ 910
+ 140
+
+ false
+ true
+ true
+
+ j_ea
+ J_EA
+
+ f_removeTheJ_EA_default(j_ea);
+// Abstract method to be used call GC-subtype specific functions
+
+
+ VOID
+ double
+ 1714646913998
+ f_removeTheJ_EA_default
+ 930
+ 160
+
+ false
+ true
+ true
+
+ j_ea
+ J_EA
+
+ c_energyAssets.remove(j_ea);
+energyModel.c_energyAssets.remove(j_ea);
+
+if (j_ea instanceof J_EAVehicle) {
+ J_EAVehicle vehicle = (J_EAVehicle)j_ea;
+ if (vehicle instanceof J_EADieselVehicle) {
+ c_dieselVehicles.remove( (J_EADieselVehicle)vehicle );
+ } else if (vehicle instanceof J_EAHydrogenVehicle) {
+ c_hydrogenVehicles.remove((J_EAHydrogenVehicle)vehicle);
+ } else if (vehicle instanceof J_EAEV) {
+ c_electricVehicles.remove(j_ea);
+ energyModel.c_EVs.remove((J_EAEV)vehicle);
+ }
+ c_vehicleAssets.remove(j_ea);
+
+ J_ActivityTrackerTrips tripTracker = vehicle.tripTracker;
+ c_tripTrackers.remove( tripTracker );
+ vehicle.tripTracker = null;
+ //v_vehicleIndex --;
+} else if (j_ea instanceof J_EAConsumption) {
+ c_consumptionAssets.remove((J_EAConsumption)j_ea);
+ if (j_ea.energyAssetType == OL_EnergyAssetType.HOT_WATER_CONSUMPTION) {
+ p_DHWAsset = null;
+ }
+ if( j_ea.energyAssetType == OL_EnergyAssetType.ELECTRICITY_DEMAND ) {
+ }
+ if( j_ea.energyAssetType == OL_EnergyAssetType.ELECTRIC_HOB ) {
+ }
+} else if (j_ea instanceof J_EAProduction) {
+ c_productionAssets.remove((J_EAProduction)j_ea);
+ //energyModel.c_productionAssets.remove((J_EAProduction)j_ea);
+ if (j_ea.energyAssetType == OL_EnergyAssetType.PHOTOVOLTAIC) {
+ J_EAProduction otherPV = findFirst(c_productionAssets, x -> x.getEAType() == OL_EnergyAssetType.PHOTOVOLTAIC);
+ if (otherPV == null) {
+ //v_liveAssetsMetaData.hasPV = false;
+ }
+ double capacity_kW = ((J_EAProduction)j_ea).getCapacityElectric_kW();
+ v_liveAssetsMetaData.totalInstalledPVPower_kW -= capacity_kW;
+ 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;
+ }
+ else if (j_ea.energyAssetType == OL_EnergyAssetType.WINDMILL) {
+ double capacity_kW = ((J_EAProduction)j_ea).getCapacityElectric_kW();
+ v_liveAssetsMetaData.totalInstalledWindPower_kW -= capacity_kW;
+ 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;
+ }
+ else if (j_ea.energyAssetType == OL_EnergyAssetType.PHOTOTHERMAL){
+ }
+} else if (j_ea instanceof J_EAConversion) {
+ c_conversionAssets.remove((J_EAConversion)j_ea);
+ // Non Heating Assets
+ if (j_ea.energyAssetType == OL_EnergyAssetType.ELECTRIC_HOB) {
+ }
+ if ( j_ea.energyAssetType == OL_EnergyAssetType.GAS_PIT || j_ea.energyAssetType == OL_EnergyAssetType.ELECTRIC_HOB){
+ p_cookingTracker = null;
+ } else if (j_ea instanceof J_EAConversionElectrolyser) {
+ }
+ else{
+ // Heating Assets
+ c_heatingAssets.remove(j_ea);
+ if (p_heatingManagement != null) {
+ p_heatingManagement.notInitialized();
+ }
+ // Special Heating Assets
+ if (j_ea instanceof J_EAConversionHeatPump) {
+ energyModel.c_ambientDependentAssets.remove(j_ea);
+ } else if (j_ea instanceof J_EAConversionGasCHP) {
+ }
+ }
+} else if (j_ea instanceof J_EAStorage) {
+ c_storageAssets.remove((J_EAStorage)j_ea);
+ energyModel.c_storageAssets.remove((J_EAStorage)j_ea);
+ if (j_ea instanceof J_EAStorageHeat) {
+ energyModel.c_ambientDependentAssets.remove(j_ea);
+ if (j_ea.energyAssetType == OL_EnergyAssetType.BUILDINGTHERMALS) {
+ p_BuildingThermalAsset = null;
+ if (p_heatingManagement != null) {
+ p_heatingManagement.notInitialized();
+ }
+ }
+ else {
+ p_heatBuffer = null;
+ if (p_heatingManagement != null) {
+ p_heatingManagement.notInitialized();
+ }
+ }
+ } else if (j_ea instanceof J_EAStorageGas) {
+ p_gasBuffer = null;
+ } else if (j_ea instanceof J_EAStorageElectric) {
+ p_batteryAsset = null;
+ v_liveAssetsMetaData.totalInstalledBatteryStorageCapacity_MWh -= ((J_EAStorageElectric)j_ea).getStorageCapacity_kWh()/1000;
+ energyModel.v_liveAssetsMetaData.totalInstalledBatteryStorageCapacity_MWh -= ((J_EAStorageElectric)j_ea).getStorageCapacity_kWh()/1000;
+ }
+} else if (j_ea instanceof J_EAProfile) {
+ c_profileAssets.remove((J_EAProfile)j_ea);
+} else if (j_ea instanceof J_EAChargePoint) {
+ c_chargers.remove(j_ea);
+} else {
+ traceln("Unrecognized energy asset %s in gridconnection %s", j_ea, this);
+}
+
+
+
+ VOID
+ double
+ 1717060111619
+ f_resetSpecificGCStates
+ 910
+ 600
+
+ false
+ true
+ true
+
+
+ VOID
+ double
+ 1717068094093
+ f_resetStatesAfterRapidRun
+ 890
+ 620
+
+ false
+ true
+ true
+ //Reset specificGC states after rapid run
+f_resetSpecificGCStatesAfterRapidRun();
+
+
+
+
+
+
+
+ VOID
+ double
+ 1717068167776
+ f_resetSpecificGCStatesAfterRapidRun
+ 910
+ 640
+
+ false
+ true
+ true
+ // to be overwritten by child GCs!
+
+
+ VOID
+ double
+ 1720442672576
+ f_curtailment
+ 910
+ 420
+
+ false
+ true
+ true
+ //Electricity
+if (v_enableCurtailment) {
+ switch(p_curtailmentMode) {
+ case CAPACITY:
+ // Keep feedin power within connection capacity
+ if (fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.ELECTRICITY) < - v_liveConnectionMetaData.contractedFeedinCapacity_kW) { // overproduction!
+ for (J_EAProduction j_ea : c_productionAssets) {
+ j_ea.curtailEnergyCarrierProduction(OL_EnergyCarriers.ELECTRICITY, - fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.ELECTRICITY) - v_liveConnectionMetaData.contractedFeedinCapacity_kW);
+ if (!(fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.ELECTRICITY) < - v_liveConnectionMetaData.contractedFeedinCapacity_kW)) {
+ break;
+ }
+ }
+ }
+ break;
+ case MARKETPRICE:
+ if(energyModel.pp_dayAheadElectricityPricing_eurpMWh.getCurrentValue() < 0.0) {
+ if (fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.ELECTRICITY) < 0.0) { // Feedin, bring to zero!
+ for (J_EAProduction j_ea : c_productionAssets) {
+ j_ea.curtailEnergyCarrierProduction(OL_EnergyCarriers.ELECTRICITY, - fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.ELECTRICITY));
+ if (!(fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.ELECTRICITY) < 0.0)) {
+ break;
+ }
+ }
+ }
+ }
+ break;
+ case NODALPRICING:
+ // Prevent feedin when nodal price is negative
+ double priceTreshold_eur = -0.0;
+ if( p_parentNodeElectric.v_currentTotalNodalPrice_eurpkWh < priceTreshold_eur) {
+
+ 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.curtailEnergyCarrierProduction(OL_EnergyCarriers.ELECTRICITY, v_currentPowerElectricitySetpoint_kW - fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.ELECTRICITY));
+ if (!(fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.ELECTRICITY) < v_currentPowerElectricitySetpoint_kW)) {
+ break;
+ }
+ }
+ }
+ break;
+ default:
+ }
+}
+
+
+ VOID
+ double
+ 1720430481154
+ f_nfatoUpdateConnectionCapacity
+ Updates the Connection Capacity of the GC depending on the time of day / day of week.
+ 890
+ 530
+
+ false
+ true
+ true
+ int dayOfWeek = (int) ((energyModel.t_h / 24 + energyModel.v_dayOfWeek1jan) % 7);
+
+double timeOfDay = energyModel.t_h % 24;
+int hourOfDay = (int) timeOfDay;
+
+if (timeOfDay == hourOfDay) {
+ int previousHour = ((hourOfDay - 1) % 24 + 24) % 24;
+ if (dayOfWeek == 0 || dayOfWeek == 6) {
+ if (dayOfWeek == 6 && hourOfDay == 0) { // Friday night we need to subtract the previous week capacity
+ v_liveConnectionMetaData.contractedDeliveryCapacity_kW += v_nfatoWeekendDeliveryCapacity_kW[hourOfDay] - v_nfatoWeekDeliveryCapacity_kW[previousHour];
+ v_liveConnectionMetaData.contractedFeedinCapacity_kW += v_nfatoWeekendFeedinCapacity_kW[hourOfDay] - v_nfatoWeekFeedinCapacity_kW[previousHour];
+ }
+ else {
+ v_liveConnectionMetaData.contractedDeliveryCapacity_kW += v_nfatoWeekendDeliveryCapacity_kW[hourOfDay] - v_nfatoWeekendDeliveryCapacity_kW[previousHour];
+ v_liveConnectionMetaData.contractedFeedinCapacity_kW += v_nfatoWeekendFeedinCapacity_kW[hourOfDay] - v_nfatoWeekendFeedinCapacity_kW[previousHour];
+ }
+ }
+ else {
+ if (dayOfWeek == 1 && hourOfDay == 0) { // Sunday night we need to subtract the previous weekend capacity
+ v_liveConnectionMetaData.contractedDeliveryCapacity_kW += v_nfatoWeekDeliveryCapacity_kW[hourOfDay] - v_nfatoWeekendDeliveryCapacity_kW[previousHour];
+ v_liveConnectionMetaData.contractedFeedinCapacity_kW += v_nfatoWeekFeedinCapacity_kW[hourOfDay] - v_nfatoWeekendFeedinCapacity_kW[previousHour];
+ }
+ else {
+ v_liveConnectionMetaData.contractedDeliveryCapacity_kW += v_nfatoWeekDeliveryCapacity_kW[hourOfDay] - v_nfatoWeekDeliveryCapacity_kW[previousHour];
+ v_liveConnectionMetaData.contractedFeedinCapacity_kW += v_nfatoWeekFeedinCapacity_kW[hourOfDay] - v_nfatoWeekFeedinCapacity_kW[previousHour];
+ }
+ }
+}
+
+
+ VOID
+ double
+ 1720431721926
+ f_nfatoSetConnectionCapacity
+ When changing the NFATO settings this function sets the GC capacity to the correct value. When reset is true the capacity is restored back to its original value.
+ 890
+ 550
+
+ false
+ true
+ true
+
+ reset
+ boolean
+
+ int mult = reset == true ? -1 : 1; // When reset is true we need to subtract the capacity, else we add
+
+int dayOfWeek = (int) ((energyModel.t_h / 24 + energyModel.v_dayOfWeek1jan) % 7);
+double timeOfDay = energyModel.t_h % 24;
+int hourOfDay = (int) timeOfDay;
+
+if (dayOfWeek == 0 || dayOfWeek == 6) {
+ if (dayOfWeek == 6 && hourOfDay == 0) { // Friday night we need to subtract the previous week capacity
+ v_liveConnectionMetaData.contractedDeliveryCapacity_kW += mult * v_nfatoWeekDeliveryCapacity_kW[hourOfDay];
+ v_liveConnectionMetaData.contractedFeedinCapacity_kW += mult * v_nfatoWeekFeedinCapacity_kW[hourOfDay];
+ }
+ else {
+ v_liveConnectionMetaData.contractedDeliveryCapacity_kW += mult * v_nfatoWeekendDeliveryCapacity_kW[hourOfDay];
+ v_liveConnectionMetaData.contractedFeedinCapacity_kW += mult * v_nfatoWeekendFeedinCapacity_kW[hourOfDay];
+ }
+}
+else {
+ if (dayOfWeek == 1 && hourOfDay == 0) { // Sunday night we need to subtract the previous week capacity
+ v_liveConnectionMetaData.contractedDeliveryCapacity_kW += mult * v_nfatoWeekendDeliveryCapacity_kW[hourOfDay];
+ v_liveConnectionMetaData.contractedFeedinCapacity_kW += mult * v_nfatoWeekendFeedinCapacity_kW[hourOfDay];
+ }
+ else {
+ v_liveConnectionMetaData.contractedDeliveryCapacity_kW += mult * v_nfatoWeekDeliveryCapacity_kW[hourOfDay];
+ v_liveConnectionMetaData.contractedFeedinCapacity_kW += mult * v_nfatoWeekFeedinCapacity_kW[hourOfDay];
+ }
+}
+
+
+ VOID
+ double
+ 1722512642645
+ f_removeFlows
+ 1060
+ 300
+
+ false
+ true
+ true
+
+ flowsMap
+ J_FlowsMap
+
+
+ energyUse_kW
+ double
+
+
+ assetFlowsMap_kW
+ J_ValueMap<OL_AssetFlowCategories>
+
+
+ caller
+ J_EA
+
+ for (OL_EnergyCarriers EC : flowsMap.keySet()) {
+ fm_currentBalanceFlows_kW.addFlow(EC, -flowsMap.get(EC));
+
+ if (flowsMap.get(EC) < 0) {
+ fm_currentProductionFlows_kW.addFlow(EC, flowsMap.get(EC));
+ }
+ else if (flowsMap.get(EC) > 0){
+ fm_currentConsumptionFlows_kW.addFlow(EC, -flowsMap.get(EC));
+ }
+}
+
+if (caller instanceof J_EAStorageElectric) {
+ // Only allocate battery losses as consumption. Charging/discharging is neither production nor consumption. Do we need an element in flowsmap indicating power into storage??
+ fm_currentConsumptionFlows_kW.addFlow(OL_EnergyCarriers.ELECTRICITY, max(0, energyUse_kW));
+ v_currentFinalEnergyConsumption_kW += max(0, energyUse_kW);
+} else {
+ double curtailment_kW = max(0, -energyUse_kW);
+ double lostLoad_kW = max(0, energyUse_kW);
+ v_currentEnergyCurtailed_kW += curtailment_kW;
+ v_currentPrimaryEnergyProduction_kW -= curtailment_kW;
+ v_currentFinalEnergyConsumption_kW -= lostLoad_kW;
+}
+
+if ( caller instanceof J_EAConversionHeatPump ) {
+ v_currentPrimaryEnergyProductionHeatpumps_kW += energyUse_kW;
+}
+for(var AC : assetFlowsMap_kW.keySet()) {
+ fm_currentAssetFlows_kW.addFlow(AC, -assetFlowsMap_kW.get(AC));
+}
+
+
+ VOID
+ double
+ 1722518225504
+ f_fillLiveDataSets
+ 930
+ 490
+
+ false
+ true
+ true
+ //Current timestep
+double currentTime_h = energyModel.t_h-energyModel.p_runStartTime_h;
+
+v_liveData.addTimeStep(currentTime_h,
+ fm_currentBalanceFlows_kW,
+ fm_currentConsumptionFlows_kW,
+ fm_currentProductionFlows_kW,
+ fm_currentAssetFlows_kW,
+ v_currentPrimaryEnergyProduction_kW,
+ v_currentFinalEnergyConsumption_kW,
+ v_currentPrimaryEnergyProductionHeatpumps_kW,
+ v_currentEnergyCurtailed_kW,
+ v_batteryStoredEnergy_kWh/1000
+);
+
+
+ VOID
+ double
+ 1722518905501
+ f_rapidRunDataLogging
+ 930
+ 470
+
+ false
+ true
+ true
+ v_rapidRunData.addTimeStep(fm_currentBalanceFlows_kW,
+ fm_currentConsumptionFlows_kW,
+ fm_currentProductionFlows_kW,
+ fm_heatFromEnergyCarrier_kW,
+ fm_consumptionForHeating_kW,
+ fm_currentAssetFlows_kW,
+ v_currentPrimaryEnergyProduction_kW,
+ v_currentFinalEnergyConsumption_kW,
+ v_currentPrimaryEnergyProductionHeatpumps_kW,
+ v_currentEnergyCurtailed_kW,
+ v_batteryStoredEnergy_kWh/1000,
+ energyModel);
+
+
+ VOID
+ double
+ 1722584668566
+ f_setActive
+ Function to pause a gridconnection so it is not operated or counted towards totals in the energy model.
+ 270
+ 330
+
+ false
+ true
+ true
+
+ setActive
+ boolean
+
+ if((energyModel.c_pausedGridConnections.contains(this) && !setActive) ||
+ (!energyModel.c_pausedGridConnections.contains(this) && setActive)){
+ return;
+}
+
+if (!setActive) {
+ energyModel.c_gridConnections.remove(this);
+ energyModel.c_pausedGridConnections.add(this);
+
+ // Set GIS Region visibility
+ for (GIS_Object obj : c_connectedGISObjects) {
+ obj.gisRegion.setVisible(false);
+ }
+
+ // update GN parents' wind / solar totals
+ 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;
+
+ for(EnergyCoop coop : c_parentCoops){
+ coop.v_liveAssetsMetaData.totalInstalledPVPower_kW -= v_liveAssetsMetaData.totalInstalledPVPower_kW;
+ coop.v_liveAssetsMetaData.totalInstalledWindPower_kW -= v_liveAssetsMetaData.totalInstalledWindPower_kW;
+ coop.v_liveAssetsMetaData.totalInstalledBatteryStorageCapacity_MWh -= v_liveAssetsMetaData.totalInstalledBatteryStorageCapacity_MWh;
+ coop.v_liveConnectionMetaData.contractedDeliveryCapacity_kW -= v_liveConnectionMetaData.contractedDeliveryCapacity_kW;
+ coop.v_liveConnectionMetaData.contractedFeedinCapacity_kW -= v_liveConnectionMetaData.contractedFeedinCapacity_kW;
+ }
+
+ // Reset Connection Capacity to default
+ f_nfatoSetConnectionCapacity(true);
+
+ // Is setting all of these to zero overkill?
+ fm_currentProductionFlows_kW.clear();
+ fm_currentConsumptionFlows_kW.clear();
+ fm_currentBalanceFlows_kW.clear();
+ fm_currentAssetFlows_kW.clear();
+ fm_heatFromEnergyCarrier_kW.clear();
+ fm_consumptionForHeating_kW.clear();
+
+ v_previousPowerElectricity_kW = 0;
+ v_previousPowerHeat_kW = 0;
+
+ v_currentEnergyCurtailed_kW = 0;
+ v_currentPrimaryEnergyProductionHeatpumps_kW = 0;
+ v_batteryStoredEnergy_kWh = 0;
+
+ v_isActive = setActive;
+}
+else {
+ //traceln("Activating gridConnection");
+ energyModel.c_gridConnections.add(this);
+ energyModel.c_pausedGridConnections.remove(this);
+
+ // Set GIS Region visibility
+ for (GIS_Object obj : c_connectedGISObjects) {
+ obj.gisRegion.setVisible(true);
+ }
+
+ // Set Connection Capacity according to NFATO
+ f_nfatoSetConnectionCapacity(false);
+
+ v_isActive = setActive; // v_isActive must be true before calling updateActiveAssetData!
+ v_liveAssetsMetaData.updateActiveAssetData(new ArrayList<>(List.of(this)));
+ v_liveAssetsMetaData.activeAssetFlows.forEach(x->energyModel.f_addAssetFlow(x));
+ v_liveAssetsMetaData.activeAssetFlows.forEach(x-> c_parentCoops.forEach(coop -> coop.f_addAssetFlow(x)));
+
+ // update GN parents' wind / solar totals (will be wrong if you changed your totals while paused)
+ 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;
+
+ for(EnergyCoop coop : c_parentCoops){
+ coop.v_liveAssetsMetaData.totalInstalledPVPower_kW += v_liveAssetsMetaData.totalInstalledPVPower_kW;
+ coop.v_liveAssetsMetaData.totalInstalledWindPower_kW += v_liveAssetsMetaData.totalInstalledWindPower_kW;
+ coop.v_liveAssetsMetaData.totalInstalledBatteryStorageCapacity_MWh += v_liveAssetsMetaData.totalInstalledBatteryStorageCapacity_MWh;
+ coop.v_liveConnectionMetaData.contractedDeliveryCapacity_kW += v_liveConnectionMetaData.contractedDeliveryCapacity_kW;
+ coop.v_liveConnectionMetaData.contractedFeedinCapacity_kW += v_liveConnectionMetaData.contractedFeedinCapacity_kW;
+ if(!v_liveConnectionMetaData.contractedDeliveryCapacityKnown){
+ coop.v_liveConnectionMetaData.contractedDeliveryCapacityKnown = false;
+ }
+ if(!v_liveConnectionMetaData.contractedFeedinCapacityKnown){
+ coop.v_liveConnectionMetaData.contractedFeedinCapacityKnown = false;
+ }
+ }
+
+ //Fast forward time dependent energy assets (if present)
+ c_chargers.forEach(charger -> charger.fastForwardCharingSessions(energyModel.t_h));
+
+ //Initialize/reset dataset maps to 0
+ double startTime = energyModel.v_liveData.dsm_liveDemand_kW.get(OL_EnergyCarriers.ELECTRICITY).getXMin();
+ double endTime = energyModel.v_liveData.dsm_liveDemand_kW.get(OL_EnergyCarriers.ELECTRICITY).getXMax();
+ v_liveData.resetLiveDatasets(startTime, endTime, energyModel.p_timeStep_h);
+}
+
+
+ RETURNS_VALUE
+ double
+ 1725455130676
+ f_getChargeDeadline
+ true
+ 1990
+ 400
+
+ false
+ true
+ true
+
+ ev
+ J_EAEV
+
+ double chargeNeedForNextTrip_kWh = max(0, ev.getEnergyNeedForNextTrip_kWh() - ev.getCurrentStateOfCharge_kWh());
+double maxChargingPower_kW = ev.getCapacityElectric_kW();
+
+return floor((ev.tripTracker.v_nextEventStartTime_min / 60 - chargeNeedForNextTrip_kWh / maxChargingPower_kW) / energyModel.p_timeStep_h) * energyModel.p_timeStep_h;
+
+
+
+ VOID
+ double
+ 1730728785333
+ f_initializeDataSets
+ 910
+ 70
+
+ false
+ true
+ true
+ v_liveData.dsm_liveDemand_kW.createEmptyDataSets(v_liveData.activeConsumptionEnergyCarriers, (int)(168 / energyModel.p_timeStep_h));
+v_liveData.dsm_liveSupply_kW.createEmptyDataSets(v_liveData.activeProductionEnergyCarriers, (int)(168 / energyModel.p_timeStep_h));
+v_liveData.dsm_liveAssetFlows_kW.createEmptyDataSets(v_liveData.assetsMetaData.activeAssetFlows, (int)(168 / energyModel.p_timeStep_h));
+
+
+
+ VOID
+ double
+ 1750258434630
+ f_manageChargePoints
+ 920
+ 390
+
+ false
+ true
+ true
+ c_chargers.forEach( x -> x.f_updateAllFlows(energyModel.t_h) );
+
+
+
+ VOID
+ double
+ 1753099764237
+ f_manageHeating
+ 920
+ 350
+
+ false
+ true
+ true
+ if (p_heatingManagement != null) {
+ p_heatingManagement.manageHeating();
+}
+
+
+ VOID
+ double
+ 1752570332887
+ f_manageBattery
+ 920
+ 330
+
+ false
+ true
+ true
+ if (p_batteryAsset != null) {
+ if (p_batteryAsset.getStorageCapacity_kWh() > 0 && p_batteryAsset.getCapacityElectric_kW() > 0) {
+ if (p_batteryManagement == null) {
+ throw new RuntimeException("Tried to operate battery without algorithm in GC: " + p_gridConnectionID);
+ }
+ p_batteryManagement.manageBattery();
+ }
+}
+
+
+ VOID
+ double
+ 1753348699140
+ f_startAfterDeserialisation
+ true
+ 1030
+ 50
+
+ false
+ true
+ true
+ v_liveData = new J_LiveData(this);
+v_liveData.activeEnergyCarriers = EnumSet.of(OL_EnergyCarriers.ELECTRICITY);
+v_liveData.activeProductionEnergyCarriers = EnumSet.of(OL_EnergyCarriers.ELECTRICITY);
+v_liveData.activeConsumptionEnergyCarriers= EnumSet.of(OL_EnergyCarriers.ELECTRICITY);
+
+//v_liveConnectionMetaData = new J_ConnectionMetaData(this);
+//v_liveAssetsMetaData = new J_AssetsMetaData(this);
+v_liveData.connectionMetaData = v_liveConnectionMetaData;
+v_liveData.assetsMetaData = v_liveAssetsMetaData;
+
+v_liveData.resetLiveDatasets(energyModel.p_runStartTime_h, energyModel.p_runStartTime_h + 24 * 7, energyModel.p_timeStep_h);
+
+for (J_EA j_ea : c_energyAssets) {
+ f_addEnergyCarriersAndAssetCategoriesFromEA(j_ea);
+}
+
+fm_currentProductionFlows_kW = new J_FlowsMap();
+fm_currentConsumptionFlows_kW = new J_FlowsMap();
+fm_currentBalanceFlows_kW = new J_FlowsMap();
+fm_currentAssetFlows_kW = new J_ValueMap(OL_AssetFlowCategories.class);
+
+
+ VOID
+ double
+ 1753969724598
+ f_removeAllHeatingAssets
+ 620
+ 230
+
+ false
+ true
+ true
+ while (c_heatingAssets.size() > 0) {
+ c_heatingAssets.get(0).removeEnergyAsset();
+}
+
+
+ RETURNS_VALUE
+ OL_GridConnectionHeatingType
+ 1754051705071
+ f_getCurrentHeatingType
+ 630
+ 190
+
+ false
+ true
+ true
+ if (p_heatingManagement != null) {
+ return p_heatingManagement.getCurrentHeatingType();
+}
+else {
+ return OL_GridConnectionHeatingType.NONE;
+}
+
+
+ VOID
+ double
+ 1754393382442
+ f_addHeatManagement
+ This function takes heatingType as an argument and adds the default heating management class to the GridConnection
+ 630
+ 150
+
+ false
+ true
+ true
+
+ heatingType
+ OL_GridConnectionHeatingType
+
+
+ isGhost
+ boolean
+
+ //Remove existing asset management from energyModel
+if(this.p_heatingManagement != null){
+ energyModel.f_removeAssetManagement(this.p_heatingManagement);
+}
+
+
+if (heatingType == OL_GridConnectionHeatingType.NONE) {
+ return;
+}
+if (isGhost) {
+ this.p_heatingManagement = new J_HeatingManagementGhost( this, heatingType );
+ //Add new asset management to energyModel
+ if(this.p_heatingManagement != null){
+ energyModel.f_registerAssetManagement(this.p_heatingManagement);
+ }
+ return;
+}
+if (heatingType == OL_GridConnectionHeatingType.CUSTOM) {
+ throw new RuntimeException("f_addHeatManagementToGC called with heating type CUSTOM");
+}
+
+boolean hasThermalBuilding = this.p_BuildingThermalAsset != null;
+boolean hasHeatBuffer = this.p_heatBuffer != null;
+Triple<OL_GridConnectionHeatingType, Boolean, Boolean> triple = Triple.of( heatingType, hasThermalBuilding, hasHeatBuffer );
+Class<? extends I_HeatingManagement> managementClass = energyModel.c_defaultHeatingStrategies.get(triple);
+
+if (managementClass == null) {
+ throw new RuntimeException("No heating strategy available for heatingType: " + heatingType + " with hasThermalBuilding: " + hasThermalBuilding + " and hasHeatBuffer: " + hasHeatBuffer);
+}
+
+I_HeatingManagement heatingManagement = null;
+try {
+ heatingManagement = managementClass.getDeclaredConstructor(GridConnection.class, OL_GridConnectionHeatingType.class).newInstance(this, heatingType);
+}
+catch (Exception e) {
+ e.printStackTrace();
+}
+
+J_HeatingPreferences existingHeatingPreferences = this.p_heatingManagement != null ? this.p_heatingManagement.getHeatingPreferences() : null; //Store the existing heating preferences
+
+this.p_heatingManagement = heatingManagement;
+this.p_heatingManagement.setHeatingPreferences(existingHeatingPreferences); // Reasign the existing heating preferences
+
+
+//Add new asset management to energyModel
+if(this.p_heatingManagement != null){
+ energyModel.f_registerAssetManagement(this.p_heatingManagement);
+}
+
+
+ VOID
+ EnergyCoop
+ 1754380684463
+ f_addConsumptionEnergyCarrier
+ 1325
+ 67
+
+ false
+ true
+ true
+
+ EC
+ OL_EnergyCarriers
+
+ v_liveData.activeEnergyCarriers.add(EC);
+v_liveData.activeConsumptionEnergyCarriers.add(EC);
+
+DataSet dsDemand = new DataSet( (int)(168 / energyModel.p_timeStep_h) );
+
+double startTime = v_liveData.dsm_liveDemand_kW.get(OL_EnergyCarriers.ELECTRICITY).getXMin();
+double endTime = v_liveData.dsm_liveDemand_kW.get(OL_EnergyCarriers.ELECTRICITY).getXMax();
+for (double t = startTime; t <= endTime; t += energyModel.p_timeStep_h) {
+ dsDemand.add( t, 0);
+}
+v_liveData.dsm_liveDemand_kW.put( EC, dsDemand);
+
+
+
+ VOID
+ EnergyCoop
+ 1754380684465
+ f_addProductionEnergyCarrier
+ 1325
+ 87
+
+ false
+ true
+ true
+
+ EC
+ OL_EnergyCarriers
+
+ v_liveData.activeEnergyCarriers.add(EC);
+v_liveData.activeProductionEnergyCarriers.add(EC);
+
+DataSet dsSupply = new DataSet( (int)(168 / energyModel.p_timeStep_h) );
+double startTime = v_liveData.dsm_liveDemand_kW.get(OL_EnergyCarriers.ELECTRICITY).getXMin();
+double endTime = v_liveData.dsm_liveDemand_kW.get(OL_EnergyCarriers.ELECTRICITY).getXMax();
+for (double t = startTime; t <= endTime; t += energyModel.p_timeStep_h) {
+ dsSupply.add( t, 0);
+}
+v_liveData.dsm_liveSupply_kW.put( EC, dsSupply);
+
+
+
+ VOID
+ EnergyCoop
+ 1754380684467
+ f_addAssetFlow
+ 1325
+ 107
+
+ false
+ true
+ true
+
+ AC
+ OL_AssetFlowCategories
+
+ if (!v_liveAssetsMetaData.activeAssetFlows.contains(AC)) {
+ v_liveAssetsMetaData.activeAssetFlows.add(AC);
+
+ DataSet dsAsset = new DataSet( (int)(168 / energyModel.p_timeStep_h) );
+ double startTime = v_liveData.dsm_liveDemand_kW.get(OL_EnergyCarriers.ELECTRICITY).getXMin();
+ double endTime = v_liveData.dsm_liveDemand_kW.get(OL_EnergyCarriers.ELECTRICITY).getXMax();
+ for (double t = startTime; t <= endTime; t += energyModel.p_timeStep_h) {
+ dsAsset.add( t, 0);
+ }
+ v_liveData.dsm_liveAssetFlows_kW.put( AC, dsAsset);
+
+ if (AC == OL_AssetFlowCategories.batteriesChargingPower_kW) { // also add batteriesDischarging!
+ v_liveAssetsMetaData.activeAssetFlows.add(OL_AssetFlowCategories.batteriesDischargingPower_kW);
+ dsAsset = new DataSet( (int)(168 / energyModel.p_timeStep_h) );
+ for (double t = startTime; t <= endTime; t += energyModel.p_timeStep_h) {
+ dsAsset.add( t, 0);
+ }
+ v_liveData.dsm_liveAssetFlows_kW.put( OL_AssetFlowCategories.batteriesDischargingPower_kW, dsAsset);
+ }
+ if (AC == OL_AssetFlowCategories.V2GPower_kW && !v_liveAssetsMetaData.activeAssetFlows.contains(OL_AssetFlowCategories.evChargingPower_kW)) { // also add evCharging!
+ v_liveAssetsMetaData.activeAssetFlows.add(OL_AssetFlowCategories.evChargingPower_kW);
+ dsAsset = new DataSet( (int)(168 / energyModel.p_timeStep_h) );
+ for (double t = startTime; t <= endTime; t += energyModel.p_timeStep_h) {
+ dsAsset.add( t, 0);
+ }
+ v_liveData.dsm_liveAssetFlows_kW.put( OL_AssetFlowCategories.evChargingPower_kW, dsAsset);
+ }
+
+ //Add asset flow also to aggregators
+ c_parentCoops.forEach(x -> x.f_addAssetFlow(AC));
+ energyModel.f_addAssetFlow(AC);
+}
+
+
+ VOID
+ double
+ 1754582754934
+ f_activateV2GChargingMode
+ 270
+ 70
+
+ false
+ true
+ true
+
+ enableV2G
+ boolean
+
+ if(energyModel.b_isInitialized){
+ p_chargingManagement.setV2GActive(enableV2G);
+ c_chargers.forEach(charger -> charger.setV2GActive(enableV2G));
+ if (enableV2G){
+ f_addAssetFlow(OL_AssetFlowCategories.V2GPower_kW);
+ }
+}
+
+
+ VOID
+ double
+ 1755702594182
+ f_addChargingManagement
+ This function takes heatingType as an argument and adds the default heating management class to the GridConnection
+ 650
+ 500
+
+ false
+ true
+ true
+
+ chargingType
+ OL_ChargingAttitude
+
+ //Remove old asset management from energyModel
+if(this.p_chargingManagement != null){
+ energyModel.f_removeAssetManagement(this.p_chargingManagement);
+}
+
+if (chargingType == null) {
+ if (c_electricVehicles.size()>0){
+ throw new RuntimeException("Charging strategy needed when electric vehicles are present!");
+ }
+}
+
+if (chargingType == OL_ChargingAttitude.CUSTOM) {
+ throw new RuntimeException("f_addChargingManagementToGC called with charging type CUSTOM");
+}
+
+Class<? extends I_ChargingManagement> managementClass;
+switch (chargingType) {
+ case SIMPLE:
+ managementClass = J_ChargingManagementSimple.class;
+ break;
+ case PRICE:
+ managementClass = J_ChargingManagementPrice.class;
+ break;
+ case BALANCE_LOCAL:
+ managementClass = J_ChargingManagementLocalBalancing.class;
+ break;
+ case BALANCE_GRID:
+ managementClass = J_ChargingManagementLocalBalancing.class;
+ break;
+ case MAX_POWER:
+ managementClass = J_ChargingManagementMaxAvailablePower.class;
+ break;
+ default:
+ throw new RuntimeException("No matching charging strategy available for chargingType: " + chargingType);
+}
+
+I_ChargingManagement chargingManagement = null;
+try {
+ chargingManagement = managementClass.getDeclaredConstructor(GridConnection.class).newInstance(this);
+}
+catch (Exception e) {
+ e.printStackTrace();
+}
+
+p_chargingManagement = chargingManagement;
+
+//TEMPORARY UNTIL CHARGEPOINT MANAGEMENT AND EV CHARGING MANAGEMENT ARE COMBINED
+if (c_chargers.size()>0){
+ if (chargingType == null) {
+ throw new RuntimeException("Charging strategy needed when chargers are present!");
+ }
+ else{
+ c_chargers.forEach(charger -> charger.setChargingAttitude(chargingType));
+ }
+}
+
+//Add new asset management to energyModel
+if(this.p_chargingManagement != null){
+ energyModel.f_registerAssetManagement(this.p_chargingManagement);
+}
+
+
+ VOID
+ double
+ 1756977865503
+ f_addEnergyCarriersAndAssetCategoriesFromEA
+ 1310
+ 40
+
+ false
+ true
+ true
+
+ j_ea
+ J_EA
+
+ for (OL_EnergyCarriers EC : j_ea.getActiveConsumptionEnergyCarriers()) {
+ if (!v_liveData.activeConsumptionEnergyCarriers.contains(EC)) {
+ v_liveData.activeConsumptionEnergyCarriers.add(EC);
+ v_liveData.activeEnergyCarriers.add(EC);
+ if (energyModel.b_isInitialized && v_isActive) {
+ f_addConsumptionEnergyCarrier(EC);
+ //Add EC to energyModel
+ energyModel.f_addConsumptionEnergyCarrier(EC);
+ c_parentCoops.forEach(x -> x.f_addConsumptionEnergyCarrier(EC));
+ }
+ }
+}
+
+for (OL_EnergyCarriers EC : j_ea.getActiveProductionEnergyCarriers()) {
+ if (!v_liveData.activeProductionEnergyCarriers.contains(EC)) {
+ v_liveData.activeProductionEnergyCarriers.add(EC);
+ v_liveData.activeEnergyCarriers.add(EC);
+ if (energyModel.b_isInitialized && v_isActive) {
+ f_addProductionEnergyCarrier(EC);
+ //Add EC to energyModel
+ energyModel.f_addProductionEnergyCarrier(EC);
+ c_parentCoops.forEach(x -> x.f_addProductionEnergyCarrier(EC));
+ }
+ }
+}
+
+if(j_ea.assetFlowCategory != null &&!v_liveAssetsMetaData.activeAssetFlows.contains(j_ea.assetFlowCategory)) { // add live dataset
+ OL_AssetFlowCategories AC = j_ea.assetFlowCategory;
+ if (energyModel.b_isInitialized && v_isActive) {
+ f_addAssetFlow(AC);
+ }
+ else{
+ v_liveAssetsMetaData.activeAssetFlows.add(AC);
+ }
+}
+
+
+ VOID
+ double
+ 1762851936576
+ f_setChargingManagement
+ 650
+ 480
+
+ false
+ true
+ true
+
+ chargingManagement
+ I_ChargingManagement
+
+ //Remove old asset management from energyModel
+if(this.p_chargingManagement != null){
+ energyModel.f_removeAssetManagement(this.p_chargingManagement);
+}
+
+p_chargingManagement = chargingManagement;
+
+//Remove old asset management from energyModel
+if(this.p_chargingManagement != null){
+ energyModel.f_registerAssetManagement(this.p_chargingManagement);
+}
+
+
+ RETURNS_VALUE
+ boolean
+ 1762852865038
+ f_getHeatingTypeIsGhost
+ 630
+ 210
+
+ false
+ true
+ true
+ return p_heatingManagement instanceof J_HeatingManagementGhost;
+
+
+ VOID
+ double
+ 1762853013265
+ f_setHeatingPreferences
+ 640
+ 170
+
+ false
+ true
+ true
+
+ heatingPreferences
+ J_HeatingPreferences
+
+ this.p_heatingManagement.setHeatingPreferences(heatingPreferences);
+
+
+ RETURNS_VALUE
+ OL_ChargingAttitude
+ 1762853347370
+ f_getCurrentChargingType
+ 650
+ 520
+
+ false
+ true
+ true
+ if (p_chargingManagement != null) {
+ return p_chargingManagement.getCurrentChargingType();
+}
+else {
+ return OL_ChargingAttitude.NONE;
+}
+
+
+ RETURNS_VALUE
+ boolean
+ 1762853561122
+ f_getV2GActive
+ 650
+ 540
+
+ false
+ true
+ true
+ if (p_chargingManagement != null) {
+ return p_chargingManagement.getV2GActive();
+}
+else {
+ return false;
+}
+
+
+ RETURNS_VALUE
+ I_BatteryManagement
+ 1762853894937
+ f_getBatteryManagement
+ 650
+ 750
+
+ false
+ true
+ true
+ return p_batteryManagement;
+
+
+ VOID
+ double
+ 1762855655470
+ f_setHeatingManagement
+ 630
+ 130
+
+ false
+ true
+ true
+
+ heatingManagement
+ I_HeatingManagement
+
+ //Remove old asset management from energyModel
+if(this.p_heatingManagement != null){
+ energyModel.f_removeAssetManagement(this.p_heatingManagement);
+}
+
+p_heatingManagement = heatingManagement;
+
+//Remove old asset management from energyModel
+if(this.p_heatingManagement != null){
+ energyModel.f_registerAssetManagement(this.p_heatingManagement);
+}
+
+
+ VOID
+ double
+ 1762855733010
+ f_setBatteryManagement
+ 650
+ 730
+
+ false
+ true
+ true
+
+ batteryManagement
+ I_BatteryManagement
+
+ //Remove old asset management from energyModel
+if(this.p_batteryManagement != null){
+ energyModel.f_removeAssetManagement(this.p_batteryManagement);
+}
+
+p_batteryManagement = batteryManagement;
+
+//Remove old asset management from energyModel
+if(this.p_batteryManagement != null){
+ energyModel.f_registerAssetManagement(this.p_batteryManagement);
+}
+
+
+ RETURNS_VALUE
+ I_ChargingManagement
+ 1762940915048
+ f_getChargingManagement
+ 650
+ 560
+
+ false
+ true
+ true
+ return p_chargingManagement;
+
+
+ RETURNS_VALUE
+ I_HeatingManagement
+ 1762940962079
+ f_getHeatingManagement
+ 620
+ 250
+
+ false
+ true
+ true
+ return p_heatingManagement;
+
+
+
+
+ 1658499438198
+ connections
+ true
+ 40
+ -130
+
+ false
+ true
+ true
+ false
+ COLLECTION_OF_LINKS
+ true
+ TreeMap<Double, Double>
+ SOLID
+ 1
+ -16777216
+ UNDER_AGENTS
+ NONE
+ END
+
+
+
+
+ 1693310211914
+ energyModel
+ 40
+ -50
+
+ false
+ true
+ true
+
+ zero_engine
+ EnergyModel
+
+
+
+
+
+ 1658499438202
+ level
+ 0
+ 0
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ 0
+ DIM_NON_CURRENT
+
+
+ 1674329507571
+ rect_energyBalance
+ 0
+ 600
+
+ false
+ true
+ false
+ true
+ SHAPE_DRAW_2D3D
+ false
+ 0
+ 10
+ 1
+
+ null
+ SOLID
+ 570
+ 380
+ 0.0
+ -983041
+ null
+
+
+ 1667905599124
+ text
+ 50
+ 10
+
+ false
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ ID & connections
+
+ SansSerif
+ 11
+
+
+ LEFT
+
+
+ 1667905621972
+ line
+ 20
+ 30
+
+ false
+ true
+ false
+ SHAPE_DRAW_2D3D
+ false
+ 0
+ 10
+ 1
+ -16777216
+ null
+ SOLID
+ 1
+ 0
+ 1
+ 0
+ 140
+ 0
+ 0
+
+
+ 1667905636672
+ line1
+ 250
+ 30
+
+ false
+ true
+ false
+ SHAPE_DRAW_2D3D
+ false
+ 0
+ 10
+ 1
+ -16777216
+ null
+ SOLID
+ 1
+ 0
+ 1
+ 0
+ 140
+ 0
+ 0
+
+
+ 1667905636674
+ text1
+ 280
+ 10
+
+ false
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ Characteristics
+
+ SansSerif
+ 11
+
+
+ LEFT
+
+
+ 1667905687082
+ line2
+ 570
+ 30
+
+ false
+ true
+ false
+ SHAPE_DRAW_2D3D
+ false
+ 0
+ 10
+ 1
+ -16777216
+ null
+ SOLID
+ 1
+ 0
+ 1
+ 0
+ 140
+ 0
+ 0
+
+
+ 1667905687085
+ text2
+ 620
+ 10
+
+ false
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ Assets
+
+ SansSerif
+ 11
+
+
+ LEFT
+
+
+ 1667905952899
+ text4
+ 930
+ 10
+
+ false
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ Functions
+
+ SansSerif
+ 11
+
+
+ LEFT
+
+
+ 1667905952903
+ line4
+ 880
+ 30
+
+ false
+ true
+ false
+ SHAPE_DRAW_2D3D
+ false
+ 0
+ 10
+ 1
+ -16777216
+ null
+ SOLID
+ 1
+ 0
+ 1
+ 0
+ 140
+ 0
+ 0
+
+
+ 1667915385672
+ line5
+ 860
+ 50
+
+ false
+ true
+ false
+ SHAPE_DRAW_2D3D
+ false
+ 0
+ 10
+ 1
+ -16777216
+ null
+ DOTTED
+ 1
+ 0
+ 1
+ 0
+ 0
+ 90
+ 0
+
+
+ 1667915403157
+ text5
+ 840
+ 86
+
+ false
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 270.0
+ -16777216
+ Init
+
+ SansSerif
+ 11
+
+
+ LEFT
+
+
+ 1667915419987
+ text6
+ 840
+ 300
+
+ false
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 270.0
+ -16777216
+ Occuring
+
+ SansSerif
+ 11
+
+
+ LEFT
+
+
+ 1667915419990
+ line6
+ 860
+ 200
+
+ false
+ true
+ false
+ SHAPE_DRAW_2D3D
+ false
+ 0
+ 10
+ 1
+ -16777216
+ null
+ DOTTED
+ 1
+ 0
+ 1
+ 0
+ 0
+ 190
+ 0
+
+
+ 1668439095469
+ pl_powerFlows
+ 20
+ 1010
+
+ false
+ true
+ false
+ SHAPE_DRAW_2D3D
+ true
+
+ 1751011893811
+ true
+ 1668499200000
+
+ 0
+ HOUR
+
+
+ 15
+ MINUTE
+
+
+ false
+ 500
+ 280
+
+
+
+ 50
+ 30
+ 420
+ 160
+ -1
+ -16777216
+ -12566464
+
+
+
+ DEFAULT
+ DEFAULT
+ -12566464
+
+ true
+ MOVEMENT_WITH_TIME
+ MODEL_TIME_UNIT
+ 0
+ 1
+ AUTO
+ true
+ LINEAR
+
+ Production assets output [kW]
+ 1668439095464
+ my_dataset1
+ -3137392
+ fm_currentAssetFlows_kW.get(windProductionElectric_kW) + fm_currentAssetFlows_kW.get(pvProductionElectric_kW)
+ true
+ NONE
+ 1.0
+
+
+ Conversion assets demand [kW]
+ 1668439095465
+ my_dataset2
+ -32944
+ fm_currentAssetFlows_kW.get(heatPumpElectricityConsumption_kW)
+ true
+ NONE
+ 1.0
+
+
+ EV charging demand [kW]
+ 1668439095466
+ my_dataset3
+ -13447886
+ fm_currentAssetFlows_kW.get(evChargingPower_kW)-fm_currentAssetFlows_kW.get(OL_AssetFlowCategories.V2GPower_kW)
+ true
+ NONE
+ 2.0
+
+
+ Battery load [kW]
+ 1658477089943
+ my_dataset4
+ -8388608
+ fm_currentAssetFlows_kW.get(batteriesChargingPower_kW)
+ true
+ NONE
+ 1.0
+
+
+ GRID LOAD
+ 1658477089942
+ my_dataset5
+ -16776961
+ fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.ELECTRICITY)
+ true
+ NONE
+ 1.0
+
+
+ Grid connection limit
+ 1658477089941
+ my_dataset6
+ -65536
+ v_liveConnectionMetaData.contractedDeliveryCapacity_kW
+ true
+ NONE
+ 1.0
+
+
+ Grid connection limit
+ 1658477089940
+ my_dataset7
+ -65536
+ - v_liveConnectionMetaData.contractedFeedinCapacity_kW
+ true
+ NONE
+ 1.0
+
+ 672
+ 48
+ false
+ HH_mm
+
+
+ 1670512816306
+ text10
+ 130
+ 1010
+
+ false
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ Electricity flows within grid connection
+
+ SansSerif
+ 16
+
+
+ LEFT
+
+
+ 1674329550133
+ txt_energyBalance
+ 280
+ 610
+
+ false
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ Energy balance monitor
+
+ SansSerif
+ 20
+
+
+ CENTER
+
+
+ false
+ 1741854950232
+ button_viewData
+ 360
+ -60
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+
+ false
+ -16777216
+ true
+ energyModel.energyDataViewer.f_fillEnergyDataViewer(this);
+energyModel.energyDataViewer.viewArea.navigateTo();
+
+
+
+ View Data
+
+
+
+
+
+
+
+ 1696868322710
+ va_gridConnection
+ 0
+ 0
+
+ false
+ true
+ false
+
+ 1920
+ 980
+
+
+
+
+ 1658477288308
+ GridNode
+ public static void forceSetOwner(Agent agent, AgentArrayList pop) throws Exception {
+ Agent owner = pop.getOwner();
+ Field f = Agent.class.getDeclaredField("d");
+ f.setAccessible(true);
+ f.set(agent, owner);
+ Field ff = Agent.class.getDeclaredField("j");
+ ff.setAccessible(true);
+ ff.set(agent, pop);
+ /*Field c = Agent.class.getDeclaredField("c");
+ traceln("Field c: %s", c);
+ c.setAccessible(true);
+ c.toString();*/
+}
+ import com.fasterxml.jackson.databind.JsonNode;
+import java.lang.reflect.Field;
+import zeroPackage.ZeroMath;
+//import zeroPackage.ZeroAccumulator;
+ /*
+if (p_energyType.equals(OL_EnergyCarriers.HEAT)) {
+ double capacityHeat_kW = 1000;
+ double lossFactor_WpK = 100;
+ double InitialStateOfCharge_degC = 60;
+ double heatCapacity_JpK = 1e7;
+ double soilTemperature_degC = main.p_undergroundTemperature_degC;
+ p_transportBuffer = new J_EAStorageHeat(null, capacityHeat_kW, lossFactor_WpK, energyModel.p_timeStep_h, InitialStateOfCharge_degC, 10, 90, heatCapacity_JpK);
+ p_transportBuffer.updateAmbientTemperature(soilTemperature_degC);
+}*/
+ false
+
+ 1658477288306
+ 1658477288306
+
+ T extends Agent
+
+ Generic parameter:
+
+ ENTITY
+ 100
+ false
+ 100
+ true
+
+ -4144960
+ null
+
+ true
+ true
+ false
+
+ 10
+ MPS
+
+
+ 1
+ METER
+
+
+ 1
+ METER
+
+
+ 1
+ METER
+
+
+
+ false
+
+ 1.0
+ SECOND
+
+ CONTINUOUS
+ 500
+ 500
+ 0
+ 100
+ 100
+ MOORE
+ USER_DEF
+ USER_DEF
+ 2
+ 50
+ 0.95
+ 10
+
+
+ true
+ 1658477089938
+ true
+ 1658563200000
+
+ 0
+ HOUR
+
+
+ 1
+ HOUR
+
+
+
+ 1658477288304
+ scale
+ 0
+ -150
+ false
+ false
+ false
+ SHAPE_DRAW_2D3D
+ 100
+ 0
+ BASED_ON_LENGTH
+ 10
+ METER
+ 10
+ true
+
+ 1658477288307
+ 1658477288303
+
+
+ 1665061187538
+ v_congested
+ 50
+ 640
+
+ false
+ true
+ true
+
+ boolean
+
+ false
+
+
+
+
+ 1666594510176
+ v_congestionMode
+ 50
+ 660
+
+ false
+ true
+ true
+
+ String
+
+ "No congestion atm"
+
+
+
+
+ 1666878219776
+ v_peakLoadAbsolute_kW
+ Houdt de piekbelasting in kW over de modelrun bij (absolute waarde) voor kostenberekeningen netverzwaringen (totale gebiedskosten). Geupdate in f_calculateEnergyBalance.
+
+@author: Jorrit
+@since: 27-10-2022
+ 400
+ 500
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1666878695816
+ v_loadFactor_fr
+ In electrical engineering the load factor is defined as the average load divided by the peak load in a specified time period.[1] It is a measure of the utilization rate, or efficiency.
+geupdate vanuit
+
+@author: Jorrit
+@since: 27-10-2022
+ true
+ 400
+ 540
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1666878761221
+ v_averageAbsoluteLoadElectricity_kW
+ Average load over model runtime in kW.
+
+@author: Jorrit
+@since: 27-10-2022
+ true
+ 400
+ 520
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1667553127377
+ v_timeOfPeakPosLoadFiltered_h
+ 400
+ 560
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1668600984923
+ v_currentLoadElectricityLowPassed_kW
+ 50
+ 581
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1668603168061
+ v_lowPassFactor_fr
+ 50
+ 561
+
+ false
+ true
+ true
+
+ double
+
+ min(1, 0.8 * energyModel.p_timeStep_h) //0.2
+
+
+
+
+ 1670404847922
+ v_peakLoadFilteredElectricity_kW
+ Houdt de piekbelasting in kW over de modelrun bij (absolute waarde) voor kostenberekeningen netverzwaringen (totale gebiedskosten). Geupdate in f_calculateEnergyBalance.
+
+@author: Jorrit
+@since: 27-10-2022
+ 400
+ 660
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1670405904360
+ v_timeOfPeakLoadFiltered_h
+ 400
+ 680
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1672304003577
+ v_peakPosLoadElectricity_kW
+ Houdt de piekbelasting in kW over de modelrun bij (absolute waarde) voor kostenberekeningen netverzwaringen (totale gebiedskosten). Geupdate in f_calculateEnergyBalance.
+
+@author: Jorrit
+@since: 27-10-2022
+ 400
+ 600
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1672304030993
+ v_peakNegLoadElectricity_kW
+ Houdt de piekbelasting in kW over de modelrun bij (absolute waarde) voor kostenberekeningen netverzwaringen (totale gebiedskosten). Geupdate in f_calculateEnergyBalance.
+
+@author: Jorrit
+@since: 27-10-2022
+ 400
+ 620
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1672304151508
+ v_timeOfPeakNegLoadFiltered_h
+ 400
+ 580
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1675683578599
+ v_currentCongestionPrice_eurpkWh
+ 50
+ 680
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1689233711411
+ v_filteredLoadCongestionPricing_kW
+ 50
+ 720
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1689234315318
+ v_lowPassFactorCongestionPricing_fr
+ 50
+ 700
+
+ false
+ true
+ true
+
+ double
+
+ min(1, 0.25 * energyModel.p_timeStep_h) // smaller value results in more filtering
+
+
+
+
+ 1696857656646
+ v_totalTimeOverloaded_h
+ 400
+ 700
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1715007701783
+ v_annualExcessImport_MWh
+ 670
+ 1040
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1715007721718
+ v_annualExcessExport_MWh
+ 670
+ 1060
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1715016274487
+ v_summerWeekExcessImport_MWh
+ 990
+ 1040
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1715016274489
+ v_summerWeekExcessExport_MWh
+ 990
+ 1060
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1715016405654
+ v_winterWeekExcessImport_MWh
+ 990
+ 1140
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1715016405656
+ v_winterWeekExcessExport_MWh
+ 990
+ 1160
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1715066563206
+ v_daytimeExcessImport_MWh
+ 1330
+ 1040
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1715066563208
+ v_daytimeExcessExport_MWh
+ 1330
+ 1060
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1715066563214
+ v_nighttimeExcessImport_MWh
+ 1330
+ 1140
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1715066563216
+ v_nighttimeExcessExport_MWh
+ 1330
+ 1160
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1715066576721
+ v_weekdayExcessImport_MWh
+ 1640
+ 1040
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1715066576723
+ v_weekdayExcessExport_MWh
+ 1640
+ 1060
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1715066576729
+ v_weekendExcessImport_MWh
+ 1640
+ 1140
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1715066576731
+ v_weekendExcessExport_MWh
+ 1640
+ 1160
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1718111648009
+ acc_annualElectricityBalance_kW
+ 400
+ 790
+
+ false
+ true
+ true
+
+ ZeroAccumulator
+
+
+
+ 1718895936296
+ v_currentLocalNodalPrice_eurpkWh
+ 50
+ 770
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1718895937973
+ v_currentTotalNodalPrice_eurpkWh
+ 50
+ 790
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1718896257049
+ v_currentParentNodalPrice_eurpkWh
+ Given a default value for 'top' agents, this can be seen as average market price of electricity.
+ 50
+ 750
+
+ false
+ true
+ true
+
+ double
+
+ 0.1
+
+
+
+
+ 1719300900648
+ v_totalInstalledWindPower_kW
+ 1044
+ 344
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1719300900650
+ v_totalInstalledPVPower_kW
+ 1044
+ 364
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1719301262027
+ v_electricityYieldForecast_fr
+ 1044
+ 382
+
+ false
+ true
+ true
+
+ double
+
+ 0.0
+
+
+
+
+ 1721228582916
+ acc_DLR_kW
+ true
+ 400
+ 810
+
+ false
+ true
+ true
+
+ ZeroAccumulator
+
+ new ZeroAccumulator(true, energyModel.p_timeStep_h, 8760);
+
+
+
+
+ 1722498291003
+ v_currentDLRCapacity_kW
+ 50
+ 610
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1730975924463
+ v_currentLoad_kW
+ 50
+ 530
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1730976446471
+ v_totalImport_MWh
+ 670
+ 1000
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1730976463797
+ v_totalExport_MWh
+ 670
+ 1020
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1730976490333
+ v_summerWeekImport_MWh
+ 990
+ 1000
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1730976490335
+ v_summerWeekExport_MWh
+ 990
+ 1020
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1730976548435
+ v_winterWeekImport_MWh
+ 990
+ 1100
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1730976548437
+ v_winterWeekExport_MWh
+ 990
+ 1120
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1730976701506
+ v_daytimeImport_MWh
+ 1330
+ 1000
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1730976701508
+ v_daytimeExport_MWh
+ 1330
+ 1020
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1730976724285
+ v_weekdayImport_MWh
+ 1640
+ 1000
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1730976724287
+ v_weekdayExport_MWh
+ 1640
+ 1020
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1730976750428
+ v_nighttimeImport_MWh
+ 1330
+ 1100
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1730976750430
+ v_nighttimeExport_MWh
+ 1330
+ 1120
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1730976750432
+ v_weekendImport_MWh
+ 1640
+ 1100
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1730976750434
+ v_weekendExport_MWh
+ 1640
+ 1120
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1758209121923
+ v_currentChargingPower_kW
+ 810
+ 630
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1758209124347
+ v_currentNumberOfChargingChargePoints
+ 810
+ 650
+
+ false
+ true
+ true
+
+ int
+
+ 0
+
+
+
+
+ 1758209126431
+ v_nextNumberOfChargingChargePoints
+ true
+ 810
+ 670
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1758536215526
+ v_lowPassedLoadFilter_kW
+ 810
+ 700
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1658477613290
+ p_gridNodeID
+ 50
+ 60
+
+ false
+ true
+ true
+
+ String
+ NONE
+ false
+
+ 1658477613288
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1658480610309
+ p_parentNodeID
+ 50
+ 120
+
+ false
+ true
+ true
+
+ String
+ NONE
+ false
+
+ 1658480610307
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1658492575878
+ p_nodeType
+ 50
+ 80
+
+ false
+ true
+ true
+
+ OL_GridNodeType
+ NONE
+ false
+
+ 1658492575876
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1658492864101
+ p_energyCarrier
+ 50
+ 100
+
+ false
+ true
+ true
+
+ OL_EnergyCarriers
+ NONE
+ false
+
+ 1658492864099
+
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1658493496878
+ p_capacity_kW
+ 50
+ 160
+
+ false
+ true
+ true
+
+ double
+ NONE
+ false
+
+ 0
+
+
+ 1658493496876
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1660635056957
+ p_transportBuffer
+ 50
+ 200
+
+ false
+ true
+ true
+
+ J_EAStorageHeat
+ NONE
+ false
+
+ null
+
+
+ 1660635056955
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1664465663237
+ p_ownerGridOperator
+ 50
+ 180
+
+ false
+ true
+ true
+
+ GridOperator
+ NONE
+ false
+
+ null
+
+
+ 1664465663235
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1664466130593
+ p_gridNodeOwnerID
+ 50
+ 140
+
+ false
+ true
+ true
+
+ String
+ NONE
+ false
+
+ 1664466130591
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1683816606479
+ b_transportBufferValid
+ 50
+ 220
+
+ false
+ true
+ true
+
+ boolean
+ NONE
+ false
+
+ false
+
+
+ 1683816606477
+ CHECK_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1698752314374
+ p_longitude
+ 50
+ 240
+
+ false
+ true
+ true
+
+ double
+ NONE
+ false
+
+ 1698752314372
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1698752314385
+ p_latitude
+ 50
+ 260
+
+ false
+ true
+ true
+
+ double
+ NONE
+ false
+
+ 1698752314383
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1705581809373
+ gisRegion
+ 50
+ 280
+
+ false
+ true
+ true
+
+ GISRegion
+ NONE
+ false
+
+ 1705581809371
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1705586150313
+ p_description
+ 50
+ 380
+
+ false
+ true
+ true
+
+ String
+ NONE
+ false
+
+ 1705586150311
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1707680312891
+ p_realCapacityAvailable
+ This value is set as true in the loader if the capacity of the grid node is available, if not, it should be set as false!
+ 50
+ 400
+
+ false
+ true
+ true
+
+ boolean
+ NONE
+ false
+
+ false
+
+
+ 1707680312889
+ CHECK_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1709911209033
+ p_serviceAreaGisRegion
+ 50
+ 360
+
+ false
+ false
+ true
+
+ GISRegion
+ NONE
+ false
+
+ 1709911209031
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1718566355120
+ p_uniqueColor
+ Color used to color net neighbours. Default = gray, so all unknown net neighbours and gridnodes become gray.
+ 70
+ 300
+
+ false
+ true
+ true
+
+ Color
+ NONE
+ false
+
+ gray
+
+
+ 1718566355118
+ COLOR_PICKER
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1718896438696
+ p_localNodalPricingFactor_eurpkWh
+ 50
+ 420
+
+ false
+ true
+ true
+
+ double
+ NONE
+ false
+
+ 0.20
+
+
+ 1718896438694
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1721994587455
+ p_defaultLineColor
+ 70
+ 340
+
+ false
+ true
+ true
+
+ Color
+ NONE
+ METER
+ false
+
+ green.brighter()
+
+
+ 1721994587453
+ COLOR_PICKER
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1721994587458
+ p_defaultFillColor
+ 70
+ 320
+
+ false
+ true
+ true
+
+ Color
+ NONE
+ METER
+ false
+
+ green
+
+
+ 1721994587456
+ COLOR_PICKER
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1722268330646
+ p_localNodalPricingTreshold_fr
+ 50
+ 440
+
+ false
+ true
+ true
+
+ double
+ NONE
+ false
+
+ 0.5
+
+
+ 1722268330644
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1726583647250
+ p_originalCapacity_kW
+ 170
+ 160
+
+ false
+ true
+ true
+
+ double
+ NONE
+ false
+
+ 1726583647248
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1749630347422
+ p_hasProfileData
+ 50
+ 470
+
+ false
+ true
+ true
+
+ boolean
+ NONE
+ false
+
+ false
+
+
+ 1749630347420
+ CHECK_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1664536960213
+ c_connectedEnergyAssets
+ true
+ 290
+ 60
+
+ false
+ true
+ true
+
+ ArrayList
+ J_EA
+ String
+
+
+
+ 1664536960219
+ c_connectedStorageAssets
+ true
+ 300
+ 120
+
+ false
+ true
+ true
+
+ ArrayList
+ J_EAStorage
+ String
+
+
+
+ 1664536960221
+ c_connectedConsumptionAssets
+ true
+ 300
+ 80
+
+ false
+ true
+ true
+
+ ArrayList
+ J_EAConsumption
+ String
+
+
+
+ 1664536960223
+ c_connectedProductionAssets
+ true
+ 300
+ 100
+
+ false
+ true
+ true
+
+ ArrayList
+ J_EAProduction
+ String
+
+
+
+ 1664536960226
+ c_connectedConversionAssets
+ true
+ 300
+ 140
+
+ false
+ true
+ true
+
+ ArrayList
+ J_EAConversion
+ String
+
+
+
+ 1666560357503
+ c_connectedGridConnections
+ 540
+ 80
+
+ false
+ true
+ true
+
+ ArrayList
+ GridConnection
+ String
+
+
+
+ 1676567375230
+ c_energyCoops
+ 540
+ 100
+
+ false
+ true
+ true
+
+ ArrayList
+ EnergyCoop
+ String
+
+
+
+ 1716885463799
+ c_connectedGridNodes
+ 540
+ 60
+
+ false
+ true
+ true
+
+ ArrayList
+ GridNode
+ String
+
+
+
+
+
+ VOID
+ double
+ 1658495336616
+ f_connectToParentNode
+ 780
+ 80
+
+ false
+ true
+ true
+ GridNode myParentNode = findFirst(energyModel.pop_gridNodes, p->p.p_gridNodeID.equals(p_parentNodeID));
+if( myParentNode instanceof GridNode ) {
+ //superConnection.connectTo(myParentNode);
+ myParentNode.f_connectToChild(this);
+}
+
+GridOperator myParentGridOperator = findFirst(energyModel.pop_gridOperators, p->p.p_actorID.equals(p_gridNodeOwnerID)) ;
+if( myParentGridOperator instanceof GridOperator) {
+ p_ownerGridOperator = myParentGridOperator;
+ //superConnection.connectTo(myParentGridOperator);
+ myParentGridOperator.f_connectToChild(this, p_energyCarrier);
+}
+
+
+
+ VOID
+ double
+ 1658495630251
+ f_connectToChild
+ 780
+ 100
+
+ false
+ true
+ true
+
+ ConnectingChildNode
+ Agent
+
+ //subConnections.connectTo(ConnectingChildNode);
+
+if ( ConnectingChildNode instanceof GridNode) {
+ c_connectedGridNodes.add( (GridNode)ConnectingChildNode );
+}
+
+if ( ConnectingChildNode instanceof GridConnection) {
+ c_connectedGridConnections.add( (GridConnection)ConnectingChildNode );
+}
+
+if ( ConnectingChildNode instanceof EnergyCoop) {
+ c_energyCoops.add( (EnergyCoop)ConnectingChildNode );
+}
+
+/*if( ConnectingChildNode instanceof EnergyAsset ) {
+ J_EA j_ea = (J_EA) ConnectingChildNode;
+ c_connectedEnergyAssets.add(j_ea);
+ if (j_ea instanceof J_EAConsumption) {
+ c_connectedConsumptionAssets.add((J_EAConsumption)j_ea);
+ } else if (j_ea instanceof J_EAProduction ) {
+ c_connectedProductionAssets.add((J_EAProduction)j_ea);
+ } else if (j_ea instanceof J_EAStorage ) {
+ c_connectedStorageAssets.add((J_EAStorage)j_ea);
+ if (j_ea instanceof J_EAStorageHeat) {
+ p_transportBuffer = (J_EAStorageHeat)j_ea;
+ }
+ } else if (j_ea instanceof J_EAConversion) {
+ c_connectedConversionAssets.add((J_EAConversion)j_ea);
+// if (EA.j_ea instanceof J_EAConversionGasBurner || EA.j_ea instanceof J_EAConversionHeatPump || EA.j_ea instanceof J_EAConversionHeatDeliverySet ) {
+ // p_HeatingAsset = EA;
+// //traceln("heatingAsset class " + p_spaceHeatingAsset.getClass().toString());
+// }
+ } else {
+ traceln("f_connectToChild in EnergyAsset: Exception! EnergyAsset " + ConnectingChildNode.getId() + " is of unknown type or null! ");
+ }
+}*/
+
+
+
+ VOID
+ double
+ 1660122738707
+ f_sumLoads
+ 780
+ 180
+
+ false
+ true
+ true
+ v_currentLoad_kW = 0;
+
+// determine the net energy flows from all subconnections by nodetype
+
+for( GridNode GN : c_connectedGridNodes ) {
+ v_currentLoad_kW += GN.v_currentLoad_kW;
+}
+
+for( GridConnection GC : c_connectedGridConnections) {
+ v_currentLoad_kW += GC.fm_currentBalanceFlows_kW.get(p_energyCarrier);
+}
+
+
+/*if( p_energyType == OL_EnergyCarriers.ELECTRICITY ){
+ v_electricLoadRatioExclBattery = v_currentLoadElectricity_kW / p_capacity_kW;
+}*/
+
+
+
+
+ VOID
+ double
+ 1660216693598
+ f_nodeMetering
+ 790
+ 240
+
+ false
+ true
+ true
+ //v_averageAbsoluteLoadElectricity_kW = ( v_electricityDrawn_kWh + v_electricityDelivered_kWh ) / energyModel.t_h;
+//v_loadFactor_fr = v_averageAbsoluteLoadElectricity_kW / abs(v_peakLoadAbsoluteElectricity_kW);
+
+if (energyModel.v_isRapidRun){
+ /*if (energyModel.b_enableDLR) {
+ acc_annualElectricityBalance_kW.addStep(100*v_currentLoadElectricity_kW/ (p_capacity_kW * energyModel.v_currentDLRfactor_fr));
+ //acc_DLR_kW.addStep( p_capacity_kW * energyModel.v_currentDLRfactor_fr);
+ } else {
+ acc_annualElectricityBalance_kW.addStep(v_currentLoadElectricity_kW;
+ }*/
+
+ if ( ((Double)v_currentLoad_kW).isNaN() ){
+ traceln("v_currentLoad_kW is NaN! On GridNode %s, time %s h", this, energyModel.t_h);
+ pauseSimulation();
+ }
+
+ if (p_energyCarrier == OL_EnergyCarriers.ELECTRICITY) {
+ acc_annualElectricityBalance_kW.addStep( v_currentLoad_kW);
+ }
+
+ double currentImport_MWh = max(0, v_currentLoad_kW) * energyModel.p_timeStep_h / 1000;
+ double currentExport_MWh = max(0, -v_currentLoad_kW) * energyModel.p_timeStep_h / 1000;
+ double currentExcessImport_MWh = max(0, v_currentLoad_kW - p_capacity_kW) * energyModel.p_timeStep_h / 1000;
+ double currentExcessExport_MWh = max(0, -v_currentLoad_kW - p_capacity_kW) * energyModel.p_timeStep_h / 1000;
+
+ v_totalImport_MWh += currentImport_MWh;
+ v_totalExport_MWh += currentExport_MWh;
+ v_annualExcessImport_MWh += currentExcessImport_MWh;
+ v_annualExcessExport_MWh += currentExcessExport_MWh;
+
+ // Year
+ if (energyModel.t_h % 1 == 0) {
+ data_totalLoad_kW.add(energyModel.t_h, v_currentLoad_kW);
+ }
+ // SummerWeek
+ if (energyModel.b_isSummerWeek) {
+ v_summerWeekImport_MWh += currentImport_MWh;
+ v_summerWeekExport_MWh += currentExport_MWh;
+ v_summerWeekExcessImport_MWh += currentExcessImport_MWh;
+ v_summerWeekExcessExport_MWh += currentExcessExport_MWh;
+
+ data_summerWeekLoad_kW.add(energyModel.t_h-energyModel.p_runStartTime_h, v_currentLoad_kW);
+ }
+ // Winterweek
+ if (energyModel.b_isWinterWeek) {
+ v_winterWeekImport_MWh += currentImport_MWh;
+ v_winterWeekExport_MWh += currentExport_MWh;
+ v_winterWeekExcessImport_MWh += currentExcessImport_MWh;
+ v_winterWeekExcessExport_MWh += currentExcessExport_MWh;
+
+ data_winterWeekLoad_kW.add(energyModel.t_h-energyModel.p_runStartTime_h, v_currentLoad_kW);
+ }
+ // Daytime
+ if (energyModel.t_h % 24 > 6 && energyModel.t_h % 24 < 18) {
+ v_daytimeImport_MWh += currentImport_MWh;
+ v_daytimeExport_MWh += currentExport_MWh;
+ v_daytimeExcessImport_MWh += currentExcessImport_MWh;
+ v_daytimeExcessExport_MWh += currentExcessExport_MWh;
+ }
+ // Weekdays
+ if ((energyModel.t_h+(energyModel.v_dayOfWeek1jan-1)*24) % (24*7) < (24*5)) { // Simulation starts on a Thursday, hence the +3 day offset on t_h
+ v_weekdayImport_MWh += currentImport_MWh;
+ v_weekdayExport_MWh += currentExport_MWh;
+ v_weekdayExcessImport_MWh += currentExcessImport_MWh;
+ v_weekdayExcessExport_MWh += currentExcessExport_MWh;
+ }
+}
+
+
+ VOID
+ double
+ 1666556555538
+ f_setCongestionTariff
+ 780
+ 140
+
+ false
+ true
+ true
+
+ price_eurpkWh
+ double
+
+ for (GridConnection gc: c_connectedGridConnections){
+ //traceln("Gc "+ gc.toString() + ", price "+ price_eurpkWh + ", allowance "+ allowance_kW +".");
+ gc.p_owner.v_currentNodalPrice_eurpkWh = price_eurpkWh;
+}
+for (EnergyCoop e: c_energyCoops){
+ e.v_currentNodalPrice_eurpkWh = price_eurpkWh;
+}
+
+
+ VOID
+ double
+ 1666560316436
+ f_resetCongestionTariffs
+ Gridoperator roept deze functie alleen aan als deze node vorige tijdstap congested was maar nu niet meer.
+ true
+ 780
+ 160
+
+ false
+ true
+ true
+ for (GridConnection gc: c_connectedGridConnections){
+ ConnectionOwner owner = ((ConnectionOwner)gc.l_ownerActor.getConnectedAgent());
+ owner.v_currentNodalPrice_eurpkWh = 0;
+}
+for (EnergyCoop e: c_energyCoops){
+ e.v_currentNodalPrice_eurpkWh = 0;
+}
+
+
+ VOID
+ double
+ 1676387466304
+ f_instantiateEnergyAssets
+ true
+ 780
+ 60
+
+ false
+ true
+ true
+ //traceln("asset " + p_energyAssetList);
+
+if( p_energyAssetList != null) {
+ for( JsonNode l : p_energyAssetList ) {
+ OL_EACategories assetCategory = OL_EACategories.valueOf(l.required( "category" ).textValue());
+ switch( assetCategory ) {
+ case STORAGE:
+ //EnergyAsset storageAsset = main.add_pop_energyAssets();
+ //storageAsset.set_p_parentAgentID( this.p_gridNodeID );
+ OL_EnergyAssetType assetType = ( OL_EnergyAssetType.valueOf(l.required( "type" ).textValue()));
+ //storageAsset.set_p_defaultEnergyAssetPresetName(l.required( "name" ).textValue());
+ if( assetType == OL_EnergyAssetType.STORAGE_HEAT){
+ double capacityHeat_kW = l.path( "capacityHeat_kW").doubleValue();
+ double lossFactor_WpK = l.path( "lossFactor_WpK" ).doubleValue();
+ double heatCapacity_JpK = l.path( "heatCapacity_JpK" ).doubleValue();
+ double minTemperature_degC = l.path( "minTemp_degC" ).asDouble(40.0); // provide default values
+ double maxTemperature_degC = l.path( "maxTemp_degC" ).asDouble(90.0);
+ double setTemperature_degC = l.path( "setTemp_degC" ).asDouble(60.0);
+ double initialTemperature_degC = l.path( "initialTemperature_degC" ).doubleValue();
+ String ambientTempType2 = l.path( "ambientTempType" ).textValue();
+
+ // minTemperature_degC = 35; // TO DELETE TEMP FIX
+ // setTemperature_degC = uniform_discr(38, 45); // TO DELETE TEMP FIX
+ // initialTemperature_degC = uniform_discr(70,80) * 1.0; // TO DELETE TEMP FIX
+ // heatCapacity_JpK = heatCapacity_JpK * uniform(0.7, 1.3); // TO DELETE TEMP FIX
+ traceln("heatstorage asset initialisation check! minTemp = "+minTemperature_degC+", maxTemperature_degC = "+maxTemperature_degC+", setTemp_degC = "+ setTemperature_degC+", initialTemperature_degC = "+initialTemperature_degC);
+
+ //traceln("Heat Storage init: minTemperature = "+minTemperature_degC+", maxTemperature_degC = "+maxTemperature_degC+", setTemperature_degC = "+setTemperature_degC+", initialTemperature_degC = "+initialTemperature_degC);
+
+
+ p_transportBuffer = new J_EAStorageHeat((Agent)this, OL_EAStorageTypes.HEATBUFFER, capacityHeat_kW, lossFactor_WpK, energyModel.p_timeStep_h, initialTemperature_degC, minTemperature_degC, maxTemperature_degC, setTemperature_degC, heatCapacity_JpK, ambientTempType2);
+ //J_EAStorageHeat(Agent parentAgent, OL_EAStorageTypes heatStorageType, double capacityHeat_kW, double lossFactor_WpK, double timestep_h, double initialTemperature_degC, double minTemperature_degC, double maxTemperature_degC, double setTemperature_degC, double heatCapacity_JpK, String ambientTempType ) {
+ //p_transportBuffer = storageAsset.j_ea;
+ p_transportBuffer.updateAmbientTemperature( energyModel.p_undergroundTemperature_degC );
+ if(heatCapacity_JpK > 0 & capacityHeat_kW > 0) {
+ b_transportBufferValid = true;
+ }
+ }
+ else{
+ traceln("F_instantiateEnergyAssets: ERROR, storage asset type not available");
+ }
+ //storageAsset.f_connectToParentNode( this );
+ //main.c_storageAssets.add(storageAsset);
+
+ break;
+ default:
+ traceln("not a valid energy asset category." + assetCategory);
+ break;
+ }
+ }
+//traceln("GridConnection "+this.p_gridNodeID+" has finished initializing its energyAssets!");
+}
+
+
+ VOID
+ double
+ 1688370981599
+ f_calculateEnergyBalance
+ 780
+ 220
+
+ false
+ true
+ true
+ f_sumLoads();
+// Low-pass filtered grid load
+//double lowPassFraction = min(1,1*1.2*energyModel.p_timeStep_h); // smaller value results in more filtering
+
+if (p_energyCarrier == OL_EnergyCarriers.ELECTRICITY) {
+ v_currentLoadElectricityLowPassed_kW += v_lowPassFactor_fr * ( v_currentLoad_kW - v_currentLoadElectricityLowPassed_kW );
+ v_filteredLoadCongestionPricing_kW += v_lowPassFactorCongestionPricing_fr * ( v_currentLoad_kW - v_filteredLoadCongestionPricing_kW);
+ //v_currentLocalNodalPrice_eurpkWh = v_filteredLoadCongestionPricing_kW / p_capacity_kW * p_localNodalPricingFactor_eurpkWh;
+ v_currentDLRCapacity_kW = energyModel.v_currentDLRfactor_fr * p_capacity_kW;
+ v_currentLocalNodalPrice_eurpkWh = signum(v_filteredLoadCongestionPricing_kW) * max(0,abs(v_filteredLoadCongestionPricing_kW) - v_currentDLRCapacity_kW * p_localNodalPricingTreshold_fr) / ((1-p_localNodalPricingTreshold_fr) * v_currentDLRCapacity_kW) * p_localNodalPricingFactor_eurpkWh;
+}
+
+//v_currentLocalNodalPrice_eurpkWh = (abs(v_filteredLoadCongestionPricing_kW / currentNodeCapacity_kW) - p_localNodalPricingTreshold_fr) / (1-p_localNodalPricingTreshold_fr) * p_localNodalPricingFactor_eurpkWh;
+
+if (energyModel.v_isRapidRun) {
+ if (p_energyCarrier == OL_EnergyCarriers.ELECTRICITY) {
+ if (abs(v_currentLoadElectricityLowPassed_kW) > p_capacity_kW) {
+ //traceln("Overloaded gridNode %s! %s kW", p_gridNodeID, abs(v_currentLoadElectricityLowPassed_kW));
+ v_totalTimeOverloaded_h += energyModel.p_timeStep_h;
+ }
+ if( abs( v_currentLoadElectricityLowPassed_kW ) > abs(v_peakLoadFilteredElectricity_kW) ) { // store maximum absolute load, but retain sign!
+ v_peakLoadFilteredElectricity_kW = ( v_currentLoadElectricityLowPassed_kW );
+ v_timeOfPeakLoadFiltered_h = energyModel.t_h;
+ }
+ if( v_currentLoadElectricityLowPassed_kW < v_peakNegLoadElectricity_kW ) { // store peak negative load and time
+ v_peakNegLoadElectricity_kW = v_currentLoadElectricityLowPassed_kW ;
+ v_timeOfPeakNegLoadFiltered_h = energyModel.t_h;
+ }
+ if( v_currentLoadElectricityLowPassed_kW > v_peakPosLoadElectricity_kW ) { // store peak positive load and time
+ v_peakPosLoadElectricity_kW = v_currentLoadElectricityLowPassed_kW ;
+ v_timeOfPeakPosLoadFiltered_h = energyModel.t_h;
+ }
+ }
+
+ if( abs( v_currentLoad_kW ) > abs(v_peakLoadAbsolute_kW) ) { // store maximum absolute load, but retain sign!
+ v_peakLoadAbsolute_kW = v_currentLoad_kW;
+ //v_timeOfPeakLoad_h = energyModel.t_h;
+ }
+}
+else {
+ data_liveLoad_kW.update();
+ data_liveCapacityDemand_kW.update();
+ data_liveCapacitySupply_kW.update();
+}
+/*
+if (p_energyType.equals(OL_EnergyCarriers.HEAT) & b_transportBufferValid ) { // Thermal load unbalance goes into transportBuffer
+// double v_powerFraction_fr = Double.isNaN( -v_currentLoadHeat_kW / p_transportBuffer.getHeatCapacity_kW() )? 0 : -v_currentLoadHeat_kW / p_transportBuffer.getHeatCapacity_kW();
+ //traceln("GridNode Heat v_currentLoadHeat_kW: %s", v_currentLoadHeat_kW);
+ double v_powerFraction_fr = -v_currentLoadHeat_kW / p_transportBuffer.getHeatCapacity_kW();
+
+ //p_transportBuffer.operate(v_powerFraction_fr);
+ //traceln("DistrictHeating network heatcapacity = "+ p_transportBuffer.getHeatCapacity_kW()+" kW, water temperature " + p_transportBuffer.getCurrentTemperature() + " deg C, buffer power fraction " + v_powerFraction_fr * 100 + " %, transportbuffer HeatCapacity_kW " + p_transportBuffer.getHeatCapacity_kW());
+ p_transportBuffer.f_updateAllFlows(v_powerFraction_fr);
+ //traceln("DistrictHeating Grid temperature: %s degC", p_transportBuffer.getCurrentTemperature());
+ //traceln("DistrictHeating network water temperature " + p_transportBuffer.getCurrentTemperature() + " deg C, buffer power fraction " + v_powerFraction_fr * 100 + " %, transportbuffer HeatCapacity_kW " + p_transportBuffer.getHeatCapacity_kW());
+} else if(abs(v_currentLoadHeat_kW)>0.001) {
+ traceln("Non-zero heat-load on district heating network without valid transport buffer!");
+}
+*/
+//traceln("GridNode " + p_gridNodeID + " update at time " + time(HOUR));
+f_nodeMetering();
+
+f_getCurrentChargingInformation();
+
+
+ VOID
+ double
+ 1688372319365
+ f_addGridBatteryLoad
+ true
+ 780
+ 200
+
+ false
+ true
+ true
+ for( Agent a : subConnections.getConnections() ) {
+ if ( a instanceof GCGridBattery){
+ v_currentLoadElectricity_kW += ((GCGridBattery)a).v_currentPowerElectricity_kW;
+ }
+}
+
+
+
+ VOID
+ double
+ 1698919552330
+ f_resetStates
+ 780
+ 320
+
+ false
+ true
+ true
+ // Current status
+v_currentLoad_kW = 0;
+v_currentLoadElectricityLowPassed_kW = 0;
+v_currentDLRCapacity_kW = p_capacity_kW;
+v_congested = false;
+v_currentCongestionPrice_eurpkWh = 0;
+v_filteredLoadCongestionPricing_kW = 0;
+
+// Performance variables
+v_peakLoadAbsolute_kW = 0;
+//v_averageAbsoluteLoadElectricity_kW = 0;
+//v_loadFactor_fr = 0;
+v_timeOfPeakLoadFiltered_h = 0;
+v_timeOfPeakNegLoadFiltered_h = 0;
+v_timeOfPeakPosLoadFiltered_h = 0;
+v_peakPosLoadElectricity_kW = 0;
+v_peakNegLoadElectricity_kW = 0;
+v_peakLoadFilteredElectricity_kW = 0;
+v_timeOfPeakLoadFiltered_h = 0;
+v_totalTimeOverloaded_h = 0;
+
+v_totalImport_MWh = 0;
+v_totalExport_MWh = 0;
+v_annualExcessImport_MWh = 0;
+v_annualExcessExport_MWh = 0;
+
+v_summerWeekImport_MWh = 0;
+v_summerWeekExport_MWh = 0;
+v_summerWeekExcessImport_MWh = 0;
+v_summerWeekExcessExport_MWh = 0;
+
+v_winterWeekImport_MWh = 0;
+v_winterWeekExport_MWh = 0;
+v_winterWeekExcessImport_MWh = 0;
+v_winterWeekExcessExport_MWh = 0;
+
+v_daytimeImport_MWh = 0;
+v_daytimeExport_MWh = 0;
+v_daytimeExcessImport_MWh = 0;
+v_daytimeExcessExport_MWh = 0;
+
+v_nighttimeImport_MWh = 0;
+v_nighttimeExport_MWh = 0;
+v_nighttimeExcessImport_MWh = 0;
+v_nighttimeExcessExport_MWh = 0;
+
+v_weekdayImport_MWh = 0;
+v_weekdayExport_MWh = 0;
+v_weekdayExcessImport_MWh = 0;
+v_weekdayExcessExport_MWh = 0;
+
+v_weekendImport_MWh = 0;
+v_weekendExport_MWh = 0;
+v_weekendExcessImport_MWh = 0;
+v_weekendExcessExport_MWh = 0;
+
+// Reset Accumulators
+acc_annualElectricityBalance_kW = new ZeroAccumulator(true, energyModel.p_timeStep_h, energyModel.p_runEndTime_h - energyModel.p_runStartTime_h);
+//acc_annualElectricityBalance_kW.reset();
+
+
+ VOID
+ double
+ 1713181018774
+ f_calculateKPIs
+ 780
+ 260
+
+ false
+ true
+ true
+ // Calcs nighttime
+v_nighttimeImport_MWh = v_totalImport_MWh - v_daytimeExcessImport_MWh;
+v_nighttimeExport_MWh = v_totalExport_MWh - v_daytimeExcessExport_MWh;
+v_nighttimeExcessImport_MWh = v_annualExcessImport_MWh - v_daytimeExcessImport_MWh;
+v_nighttimeExcessExport_MWh = v_annualExcessExport_MWh - v_daytimeExcessExport_MWh;
+
+// Calcs weekend
+v_weekendImport_MWh = v_totalImport_MWh - v_weekdayImport_MWh;
+v_weekendExport_MWh = v_totalExport_MWh - v_weekdayExport_MWh;
+v_weekendExcessImport_MWh = v_annualExcessImport_MWh - v_weekdayExcessImport_MWh;
+v_weekendExcessExport_MWh = v_annualExcessExport_MWh - v_weekdayExcessExport_MWh;
+
+
+ RETURNS_VALUE
+ ArrayList<GridNode>
+ 1718290223518
+ f_getConnectedGridNodes
+ Function that gets all the directly connected grid nodes
+ 1110
+ 190
+
+ false
+ true
+ true
+ return this.c_connectedGridNodes;
+
+
+ RETURNS_VALUE
+ ArrayList<GridConnection>
+ 1718290606581
+ f_getConnectedGridConnections
+ Function that gets all the directly connected grid connections
+ 1110
+ 210
+
+ false
+ true
+ true
+ return this.c_connectedGridConnections;
+
+
+ VOID
+ double
+ 1718896086734
+ f_propagateNodalPricing
+ 780
+ 400
+
+ false
+ true
+ true
+ v_currentTotalNodalPrice_eurpkWh = v_currentParentNodalPrice_eurpkWh + v_currentLocalNodalPrice_eurpkWh;
+for (GridNode GN : c_connectedGridNodes ) {
+ GN.v_currentParentNodalPrice_eurpkWh = v_currentTotalNodalPrice_eurpkWh;
+}
+
+
+ VOID
+ double
+ 1719300860382
+ f_initializeGridnode
+ 780
+ 350
+
+ false
+ true
+ true
+ v_totalInstalledWindPower_kW = 0;
+v_totalInstalledPVPower_kW = 0;
+
+for (GridConnection GC : c_connectedGridConnections) {
+ if (GC.v_isActive) {
+ v_totalInstalledWindPower_kW += GC.v_liveAssetsMetaData.totalInstalledWindPower_kW;
+ v_totalInstalledPVPower_kW += GC.v_liveAssetsMetaData.totalInstalledPVPower_kW;
+ }
+}
+
+for (GridNode GN : c_connectedGridNodes) {
+ v_totalInstalledWindPower_kW += GN.v_totalInstalledWindPower_kW;
+ v_totalInstalledPVPower_kW += GN.v_totalInstalledPVPower_kW;
+}
+
+/*
+if ( p_energyType == OL_EnergyCarriers.HEAT ) {
+ double capacityHeat_kW = 1000000;
+ double lossFactor_WpK = 10000;
+ double heatCapacity_JpK = 10000 * 3.6e6;
+ double InitialStateOfCharge_degC = 60;
+ double soilTemperature_degC = energyModel.p_undergroundTemperature_degC;
+ p_transportBuffer = new J_EAStorageHeat(null, OL_EAStorageTypes.HEATBUFFER, capacityHeat_kW, lossFactor_WpK, energyModel.p_timeStep_h, InitialStateOfCharge_degC, 10.0, 90.0, InitialStateOfCharge_degC, heatCapacity_JpK, "AIR" );
+ p_transportBuffer.updateAmbientTemperature(soilTemperature_degC);
+ b_transportBufferValid = true;
+ energyModel.c_energyAssets.add(p_transportBuffer);
+ energyModel.c_storageAssets.add(p_transportBuffer);
+}*/
+
+
+ VOID
+ double
+ 1719302290904
+ f_updateForecasts
+ 780
+ 370
+
+ false
+ true
+ true
+ // The ElectricityYieldForecast assumes solar and wind forecasts have the same forecast time
+if ( v_totalInstalledPVPower_kW + v_totalInstalledWindPower_kW > 0 ) {
+ v_electricityYieldForecast_fr = (energyModel.pf_PVProduction35DegSouth_fr.getForecast() * v_totalInstalledPVPower_kW + energyModel.pf_windProduction_fr.getForecast() * v_totalInstalledWindPower_kW) / (v_totalInstalledPVPower_kW + v_totalInstalledWindPower_kW);
+}
+
+
+
+ VOID
+ double
+ 1722591244558
+ f_updateTotalInstalledProductionAssets
+ 1040
+ 310
+
+ false
+ true
+ true
+
+ energyAssetType
+ OL_EnergyAssetType
+
+
+ power_kw
+ double
+
+
+ increase
+ boolean
+
+ if (energyAssetType == OL_EnergyAssetType.WINDMILL) {
+ if (increase) {
+ v_totalInstalledWindPower_kW += power_kw;
+ }
+ else {
+ v_totalInstalledWindPower_kW -= power_kw;
+ }
+}
+else if (energyAssetType == OL_EnergyAssetType.PHOTOVOLTAIC) {
+ if (increase) {
+ v_totalInstalledPVPower_kW += power_kw;
+ }
+ else {
+ v_totalInstalledPVPower_kW -= power_kw;
+ }
+}
+else {
+ throw new IllegalStateException("Wrong energy asset type");
+}
+
+if (p_parentNodeID != null) {
+ GridNode myParentNode = findFirst(energyModel.pop_gridNodes, p->p.p_gridNodeID.equals(p_parentNodeID));
+ if (myParentNode != null) {
+ myParentNode.f_updateTotalInstalledProductionAssets(energyAssetType, power_kw, increase);
+ }
+}
+
+
+ RETURNS_VALUE
+ List<GridNode>
+ 1725964027407
+ f_getLowerLVLConnectedGridNodes
+ Function that gets all grid nodes and the children of those grid nodes, etc. All the way to the bottom node.
+ 1110
+ 230
+
+ false
+ true
+ true
+ List<GridNode> allConnectedGridNodes = new ArrayList<GridNode>();
+
+for(GridNode GN : c_connectedGridNodes){
+ allConnectedGridNodes.addAll(GN.f_getAllConnectedGridNodes_recursion(new ArrayList<GridNode>()));
+}
+
+return allConnectedGridNodes;
+
+
+ RETURNS_VALUE
+ List<GridNode>
+ 1725966618828
+ f_getAllConnectedGridNodes_recursion
+ Recursion Function that gets all grid nodes and the children of those grid nodes, etc. All the way to the bottom node. For basic use should be called with an empty list!
+ 1150
+ 250
+
+ false
+ true
+ true
+
+ allConnectedGridNodes
+ List<GridNode>
+
+ //Add to collection
+allConnectedGridNodes.add(this);
+
+//Recursive loop (repeat this function till bottom)
+if(c_connectedGridNodes.size() == 0){
+ return allConnectedGridNodes;
+}
+else{
+ for(GridNode GN : c_connectedGridNodes){
+ GN.f_getAllConnectedGridNodes_recursion(allConnectedGridNodes);
+ //allConnectedGridNodes.addAll(GN.f_getAllConnectedGridNodes(allConnectedGridNodes));
+ }
+ return allConnectedGridNodes;
+}
+
+
+
+ RETURNS_VALUE
+ ArrayList<GridConnection>
+ 1734617656602
+ f_getAllLowerLVLConnectedGridConnections
+ Function that gets all the directly connected grid connections
+ 1110
+ 270
+
+ false
+ true
+ true
+ ArrayList<GridConnection> AllLowerLVLConnectedGridConnections = new ArrayList<GridConnection>();
+
+for(GridNode GN : f_getLowerLVLConnectedGridNodes()){
+ AllLowerLVLConnectedGridConnections.addAll(GN.f_getConnectedGridConnections());
+}
+
+AllLowerLVLConnectedGridConnections.addAll(this.c_connectedGridConnections);
+
+return AllLowerLVLConnectedGridConnections;
+
+
+ RETURNS_VALUE
+ J_LoadDurationCurves
+ 1753341238941
+ f_getDuurkrommes
+ 780
+ 290
+
+ false
+ true
+ true
+ return new J_LoadDurationCurves(acc_annualElectricityBalance_kW.getTimeSeries_kW(), energyModel);
+
+
+ RETURNS_VALUE
+ DataSet
+ 1754461654982
+ f_getPeakImportWeekDataSet
+ 1060
+ 440
+
+ false
+ true
+ true
+ double[] elecBalance_kW = acc_annualElectricityBalance_kW.getTimeSeries_kW();
+
+Integer maxIndex = 0; // index with peak import
+for (int i = 1; i < elecBalance_kW.length; i++) {
+ if (elecBalance_kW[i] > elecBalance_kW[maxIndex]) {
+ maxIndex = i;
+ }
+}
+
+double peakTime_h = maxIndex*energyModel.p_timeStep_h;
+double duration_h = acc_annualElectricityBalance_kW.getDuration();
+double accStartTime_h = min(duration_h-7*24,max(0,peakTime_h - 3.5*24));
+DataSet ds = acc_annualElectricityBalance_kW.getDataSet(energyModel.p_runStartTime_h, accStartTime_h, accStartTime_h+24*7);
+
+return ds;
+
+
+ RETURNS_VALUE
+ DataSet
+ 1754462048041
+ f_getPeakExportWeekDataSet
+ 1060
+ 460
+
+ false
+ true
+ true
+ double[] elecBalance_kW = acc_annualElectricityBalance_kW.getTimeSeries_kW();
+
+Integer minIndex = 0; // index with peak import
+for (int i = 1; i < elecBalance_kW.length; i++) {
+ if (elecBalance_kW[i] < elecBalance_kW[minIndex]) {
+ minIndex = i;
+ }
+}
+
+double peakTime_h = minIndex*energyModel.p_timeStep_h;
+double duration_h = acc_annualElectricityBalance_kW.getDuration();
+double accStartTime_h = min(duration_h-7*24,max(0,peakTime_h - 3.5*24));
+DataSet ds = acc_annualElectricityBalance_kW.getDataSet(energyModel.p_runStartTime_h, accStartTime_h, accStartTime_h+24*7);
+
+return ds;
+
+
+ VOID
+ double
+ 1758209089894
+ f_getCurrentChargingInformation
+ 810
+ 600
+
+ false
+ true
+ true
+ v_currentChargingPower_kW = 0;
+v_currentNumberOfChargingChargePoints = 0;
+
+for(GridConnection GC : c_connectedGridConnections){
+ if(GC instanceof GCPublicCharger){
+ for(J_EAChargePoint charger : GC.c_chargers){
+ v_currentChargingPower_kW += charger.getLastFlows().get(OL_EnergyCarriers.ELECTRICITY);
+ v_currentNumberOfChargingChargePoints += charger.getCurrentNumberOfChargingSockets();
+ }
+ }
+}
+
+// Low pass filter
+double filterTimeScale_h = 5*24;
+double filterDiffGain_r = 1/(filterTimeScale_h/energyModel.p_timeStep_h);
+v_lowPassedLoadFilter_kW += (v_currentLoad_kW - v_currentChargingPower_kW - v_lowPassedLoadFilter_kW) * filterDiffGain_r;
+//v_lowPassedLoadFilter_kW += (v_currentLoad_kW - v_lowPassedLoadFilter_kW) * filterDiffGain_r;
+
+
+
+
+
+ 1705919330576
+ data_liveLoad_kW
+ 50
+ 850
+
+ false
+ true
+ true
+ false
+
+ 1751011894016
+ true
+ 1687075200000
+
+ 0
+ HOUR
+
+
+ 1
+ HOUR
+
+
+ false
+ energyModel.t_h
+ v_currentLoad_kW
+ 672
+
+
+ 1712668669449
+ data_liveCapacityDemand_kW
+ 50
+ 890
+
+ false
+ true
+ true
+ false
+
+ 1751011894018
+ true
+ 1712736000000
+
+ 0
+ HOUR
+
+
+ 1
+ HOUR
+
+
+ false
+ energyModel.t_h
+ p_capacity_kW
+ 672
+
+
+ 1712673776914
+ data_liveCapacitySupply_kW
+ 50
+ 870
+
+ false
+ true
+ true
+ false
+
+ 1751011894020
+ true
+ 1712736000000
+
+ 0
+ HOUR
+
+
+ 1
+ HOUR
+
+
+ false
+ energyModel.t_h
+ -p_capacity_kW
+ 672
+
+
+ 1715167370828
+ data_totalLoad_kW
+ 50
+ 920
+
+ false
+ true
+ true
+ false
+
+ 1751011894022
+ true
+ 1715241600000
+
+ 0
+ HOUR
+
+
+ 1
+ HOUR
+
+
+ true
+ 8760
+
+
+ 1715167392629
+ data_summerWeekLoad_kW
+ 50
+ 940
+
+ false
+ true
+ true
+ false
+
+ 1751011894024
+ true
+ 1715241600000
+
+ 0
+ HOUR
+
+
+ 1
+ HOUR
+
+
+ true
+ 672
+
+
+ 1715167408643
+ data_winterWeekLoad_kW
+ 50
+ 960
+
+ false
+ true
+ true
+ false
+
+ 1751011894026
+ true
+ 1715241600000
+
+ 0
+ HOUR
+
+
+ 1
+ HOUR
+
+
+ true
+ 672
+
+
+
+
+ 1658477288303
+ connections
+ true
+ 50
+ -50
+
+ false
+ true
+ true
+ //v_gridNodePriceBands = msg;
+subConnections.sendToAllConnected(msg);
+ false
+ COLLECTION_OF_LINKS
+ true
+ TreeMap<Double, Double>
+ SOLID
+ 1
+ -16777216
+ UNDER_AGENTS
+ NONE
+ END
+
+
+
+
+ 1658477403925
+ energyModel
+ 50
+ -100
+
+ false
+ true
+ true
+
+ zero_engine
+ EnergyModel
+
+
+
+
+
+ 1658477288307
+ level
+ 0
+ 0
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ 0
+ DIM_NON_CURRENT
+
+
+ 1670316940459
+ line
+ 10
+ 40
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ false
+ 0
+ 10
+ 1
+ -16777216
+ null
+ SOLID
+ 1
+ 0
+ 1
+ 0
+ 140
+ 0
+ 0
+
+
+ 1670316940469
+ text
+ 40
+ 20
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ Parameters
+
+ SansSerif
+ 11
+
+
+ LEFT
+
+
+ 1670316967152
+ text4
+ 820
+ 20
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ Functions
+
+ SansSerif
+ 11
+
+
+ LEFT
+
+
+ 1670316967156
+ line4
+ 770
+ 40
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ false
+ 0
+ 10
+ 1
+ -16777216
+ null
+ SOLID
+ 1
+ 0
+ 1
+ 0
+ 140
+ 0
+ 0
+
+
+ 1670317019803
+ line7
+ 400
+ 470
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ false
+ 0
+ 10
+ 1
+ -16777216
+ null
+ SOLID
+ 1
+ 0
+ 1
+ 0
+ 140
+ 0
+ 0
+
+
+ 1670317019806
+ text7
+ 450
+ 450
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ Performance
+
+ SansSerif
+ 11
+
+
+ LEFT
+
+
+ 1670317049666
+ line1
+ true
+ 300
+ 40
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ false
+ 0
+ 10
+ 1
+ -16777216
+ null
+ SOLID
+ 1
+ 0
+ 1
+ 0
+ 140
+ 0
+ 0
+
+
+ 1670317049669
+ text1
+ true
+ 350
+ 20
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ Assets
+
+ SansSerif
+ 11
+
+
+ LEFT
+
+
+ 1670317065284
+ line2
+ 50
+ 520
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ false
+ 0
+ 10
+ 1
+ -16777216
+ null
+ SOLID
+ 1
+ 0
+ 1
+ 0
+ 140
+ 0
+ 0
+
+
+ 1670317065286
+ text2
+ 80
+ 500
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ Current status
+
+ SansSerif
+ 11
+
+
+ LEFT
+
+
+ 1670317113685
+ plot
+ true
+ 270
+ 180
+
+ false
+ true
+ false
+ SHAPE_DRAW_2D3D
+ false
+
+ 1751011893992
+ true
+ 1670400000000
+
+ 0
+ HOUR
+
+
+ 0.25
+ HOUR
+
+
+ false
+ 470
+ 270
+
+
+
+ 50
+ 30
+ 390
+ 180
+ -1
+ -16777216
+ -12566464
+
+
+
+ DEFAULT
+ DEFAULT
+ -12566464
+
+ true
+ MOVEMENT_WITH_TIME
+ DAY
+ - p_capacity_kW - p_capacity_kW *0.1
+ p_capacity_kW + p_capacity_kW * 0.1
+ FIXED
+ true
+ LINEAR
+
+ Node capacity
+ 1658477089937
+ my_dataset
+ -65536
+ p_capacity_kW
+ true
+ NONE
+ 1.0
+
+
+ Current load on grid [kW]
+ 1658477089936
+ my_dataset2
+ -12004916
+ v_currentLoadElectricity_kW
+ true
+ NONE
+ 1.0
+
+
+
+ 1658477089935
+ my_dataset1
+ -65536
+ - p_capacity_kW
+ true
+ NONE
+ 1.0
+
+
+ Filtered load on grid [kW]
+ 1658477089934
+ my_dataset3
+ -8097537
+ v_currentLoadElectricityLowPassed_kW
+ true
+ NONE
+ 1.0
+
+ 1000
+ 3
+ false
+ HH_mm
+
+
+
+
+
+
+ 1698759398568
+ va_gridNode
+ 0
+ 0
+
+ false
+ true
+ false
+
+ 1920
+ 980
+
+
+
+
+ 1660731380915
+ GridOperator
+ 1752677829820
+
+ zero_engine
+ Actor
+
+
+
+ p_actorID
+
+
+ p_actorType
+
+
+ p_actorSubgroup
+
+
+ p_actorGroup
+
+
+ energyModel.c_actors.add(this);
+ false
+
+ 1660731380913
+ 1660731380913
+
+ T extends Agent
+
+ Generic parameter:
+
+ ENTITY
+ 100
+ false
+ 100
+ true
+
+ -4144960
+ null
+
+ true
+ true
+ false
+
+ 10
+ MPS
+
+
+ 1
+ METER
+
+
+ 1
+ METER
+
+
+ 1
+ METER
+
+
+
+ false
+
+ 1.0
+ SECOND
+
+ CONTINUOUS
+ 500
+ 500
+ 0
+ 100
+ 100
+ MOORE
+ USER_DEF
+ USER_DEF
+ 2
+ 50
+ 0.95
+ 10
+
+
+ true
+ 1658477089933
+ true
+ 1660809600000
+
+ 0
+ SECOND
+
+
+ 1
+ SECOND
+
+
+
+ 1660731380911
+ scale
+ 0
+ -150
+ false
+ false
+ false
+ SHAPE_DRAW_2D3D
+ 100
+ 0
+ BASED_ON_LENGTH
+ 10
+ METER
+ 10
+ true
+
+ 1660731380914
+ 1660731380910
+
+
+ 1665060534142
+ v_congestionAllowanceLevel_kW
+ true
+ 60
+ 180
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1665060582840
+ v_congestionPriceConsumption_eurpkWh
+ Euro per kW
+ true
+ 60
+ 580
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1665508504346
+ v_congestionThreshold_fr
+ 60
+ 220
+
+ false
+ true
+ true
+
+ double
+
+ 0.0
+
+
+
+
+ 1665508939525
+ b_applyCongestionPriceWithConsumption
+ true
+ 60
+ 540
+
+ false
+ true
+ true
+
+ boolean
+
+ false
+
+
+
+
+ 1665508951785
+ b_applyCongestionPriceWithProduction
+ true
+ 60
+ 560
+
+ false
+ true
+ true
+
+ boolean
+
+ false
+
+
+
+
+ 1666560746828
+ v_congestionPriceProduction_eurpkWh
+ Euro per kW
+ true
+ 60
+ 600
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1675355743791
+ j_ActorData
+ true
+ 60
+ 270
+
+ false
+ true
+ true
+
+ J_ActorData
+
+
+
+ 1690962985581
+ v_congestionPrice_eurpkWh
+ Euro per kW
+ 60
+ 200
+
+ false
+ true
+ true
+
+ double
+
+ 0.2
+
+
+
+
+ 1753281672894
+ p_hasCongestionPricing
+ Euro per kW
+ 60
+ 150
+
+ false
+ true
+ true
+
+ boolean
+
+ false
+
+
+
+
+ 1660736411315
+ p_actorID
+ Unique identifier of this actor in String format. Designated in Config-excel and used to link actors to netConnections.
+
+@since: Sprint 6
+@author: Gillis
+ true
+ -220
+ 70
+
+ false
+ true
+ true
+
+ String
+ NONE
+ false
+
+ 1660736411313
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1660736411318
+ p_actorType
+ Actor type in OL_ActorType format. Designated in Config-excel and used to determine actor-type specific functionalities later.
+
+@since: Sprint 6
+@author: Gillis
+ true
+ -220
+ 90
+
+ false
+ true
+ true
+
+ String
+ NONE
+ false
+
+ 1660736411316
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1660736411321
+ p_parentActorID
+ Unique actor identifier in String format of a designated parent actor. This may be designated in Config-excel and is used to create an agent link with a higher lying agent (e.g. a Coop or energy supplier)
+
+@since: Sprint 6
+@author: Gillis
+ true
+ -220
+ 140
+
+ false
+ true
+ true
+
+ String
+ NONE
+ false
+
+ 1660736411319
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1660736411324
+ p_parentActor
+ Pointer of the designated parent actor (e.g. a Coop or energy supplier)
+
+@since: Sprint 6
+@author: Gillis
+ true
+ -220
+ 160
+
+ false
+ true
+ true
+
+ ConnectionOwner
+ NONE
+ false
+
+ 1660736411322
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1674907095514
+ p_capacitypricing_households_kW
+ true
+ 60
+ 650
+
+ false
+ true
+ true
+
+ double
+ NONE
+ false
+
+ 1674907095512
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1674907099647
+ p_capacitypricing_households_eur
+ true
+ 60
+ 670
+
+ false
+ true
+ true
+
+ double
+ NONE
+ false
+
+ 1674907099645
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1674907106415
+ p_hasCapacityPricing
+ true
+ 60
+ 630
+
+ false
+ true
+ true
+
+ boolean
+ NONE
+ false
+
+ false
+
+
+ 1674907106413
+ CHECK_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1675688426540
+ p_hasCongestionPricing2
+ true
+ 480
+ 270
+
+ false
+ true
+ true
+
+ boolean
+ NONE
+ false
+
+ true
+
+
+ 1675688426538
+ CHECK_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1665076694603
+ c_electricityGridNodes
+ 700
+ 160
+
+ false
+ true
+ true
+
+ ArrayList
+ GridNode
+ String
+
+
+
+ 1666594012871
+ c_congestedGNProduction
+ 720
+ 180
+
+ false
+ true
+ true
+
+ ArrayList
+ GridNode
+ String
+
+
+
+ 1666594046997
+ c_congestedGNConsumption
+ 720
+ 200
+
+ false
+ true
+ true
+
+ ArrayList
+ GridNode
+ String
+
+
+
+ 1747304533257
+ c_heatGridNodes
+ 700
+ 140
+
+ false
+ true
+ true
+
+ ArrayList
+ GridNode
+ String
+
+
+
+
+
+ VOID
+ double
+ 1660736411309
+ f_connectToChild
+ 700
+ 70
+
+ false
+ true
+ true
+
+ ConnectingChildNode
+ GridNode
+
+
+ energyType
+ OL_EnergyCarriers
+
+ 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");
+}
+
+
+
+ VOID
+ double
+ 1660736411312
+ f_connectToParentActor
+ Creates an agentLink in superConnection if a parentActorID is designated in the config-excel. Called from f_configureBackBone() in main for profiling reasons, so no parameters are given.
+
+@param: none
+@return: none
+@since: Sprint 6
+@author: HOUJ
+ true
+ -220
+ 40
+
+ false
+ true
+ true
+ if ( p_parentActorID != null ) {
+ ConnectionOwner myParentActor = findFirst(main.pop_connectionOwners, p->p.p_actorID.equals(p_parentActorID)) ;
+ if( myParentActor instanceof ConnectionOwner) {
+ p_parentActor = myParentActor;
+ superConnection.connectTo(myParentActor);
+ myParentActor.f_connectToChild(this);
+ }
+}
+
+
+ VOID
+ double
+ 1664465199508
+ f_updateCongestionTariff
+ 700
+ 90
+
+ false
+ true
+ true
+ for( GridNode n : c_electricityGridNodes ){
+ double currentLoad_kW = n.v_filteredLoadCongestionPricing_kW;
+
+ if ( abs(currentLoad_kW) > v_congestionThreshold_fr * n.p_capacity_kW ){
+ n.v_congested = true;
+ n.v_currentCongestionPrice_eurpkWh = signum(currentLoad_kW)*(abs(currentLoad_kW) / n.p_capacity_kW - v_congestionThreshold_fr ) / ( 1 - v_congestionThreshold_fr) * v_congestionPrice_eurpkWh;
+ n.f_setCongestionTariff(n.v_currentCongestionPrice_eurpkWh);
+ if (currentLoad_kW > 0) {
+ n.v_congestionMode = "Overconsumption";
+ //n.f_setCongestionTariff(n.v_currentCongestionPrice_eurpkWh);
+ }
+ else {
+ n.v_congestionMode = "Overproduction";
+ //n.f_setCongestionTariff(-n.v_currentCongestionPrice_eurpkWh);
+ }
+ if (!c_congestedGNConsumption.contains(n)){ c_congestedGNConsumption.add(n); }
+ }
+ else {
+ if ( n.v_congested ){
+ n.f_setCongestionTariff(0);
+ n.v_congested = false;
+ n.v_congestionMode = "No congestion atm";
+ n.v_currentCongestionPrice_eurpkWh = 0;
+ if (c_congestedGNProduction.contains(n)){ c_congestedGNProduction.remove(c_congestedGNProduction.indexOf(n));}
+ if (c_congestedGNConsumption.contains(n)){ c_congestedGNConsumption.remove(c_congestedGNConsumption.indexOf(n));}
+ }
+ }
+
+}
+
+
+
+
+
+
+ 1660731380910
+ connections
+ 50
+ -50
+
+ false
+ true
+ true
+ false
+ COLLECTION_OF_LINKS
+ true
+ Object
+ SOLID
+ 1
+ -16777216
+ UNDER_AGENTS
+ NONE
+ END
+
+
+
+
+ 1660731855349
+ energyModel
+ 50
+ -100
+
+ false
+ true
+ true
+
+ zero_engine
+ EnergyModel
+
+
+
+
+
+ 1660731380914
+ level
+ 0
+ 0
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ 0
+ DIM_NON_CURRENT
+
+
+
+
+ 1660731384415
+ NationalEnergyMarket
+ 1752677829820
+
+ zero_engine
+ Actor
+
+
+
+ p_actorID
+
+
+ p_actorType
+
+
+ p_actorSubgroup
+
+
+ p_actorGroup
+
+
+ false
+
+ 1660731384413
+ 1660731384413
+
+ T extends Agent
+
+ Generic parameter:
+
+ ENTITY
+ 100
+ false
+ 100
+ true
+
+ -4144960
+ null
+
+ true
+ true
+ false
+
+ 10
+ MPS
+
+
+ 1
+ METER
+
+
+ 1
+ METER
+
+
+ 1
+ METER
+
+
+
+ false
+
+ 1.0
+ SECOND
+
+ CONTINUOUS
+ 500
+ 500
+ 0
+ 100
+ 100
+ MOORE
+ USER_DEF
+ USER_DEF
+ 2
+ 50
+ 0.95
+ 10
+
+
+ true
+ 1658477089932
+ true
+ 1660809600000
+
+ 0
+ SECOND
+
+
+ 1
+ SECOND
+
+
+
+ 1660731384411
+ scale
+ 0
+ -150
+ false
+ false
+ false
+ SHAPE_DRAW_2D3D
+ 100
+ 0
+ BASED_ON_LENGTH
+ 10
+ METER
+ 10
+ true
+
+ 1660731384414
+ 1660731384410
+
+
+ 1660752725660
+ v_currentVariableElectricityPrice_eurpMWh
+ 60
+ 200
+
+ false
+ true
+ true
+
+ double
+
+
+
+
+
+ RETURNS_VALUE
+ double
+ 1660738813066
+ f_getNationalElectricityPrice_eurpMWh
+ 60
+ 230
+
+ false
+ true
+ true
+ return v_currentVariableElectricityPrice_eurpMWh;
+
+
+ VOID
+ double
+ 1660752725657
+ f_updateEnergyPrice
+ 60
+ 170
+
+ false
+ true
+ true
+ //energyModel.c_gridNodesNotTopLevel.get(0).p_capacity_kW
+//double localBalanceTerm_eurpMWh = 200 * (energyModel.v_totalElectricPower_kW / energyModel.c_gridNodesNotTopLevel.get(0).p_capacity_kW);
+
+v_currentVariableElectricityPrice_eurpMWh = energyModel.pp_dayAheadElectricityPricing_eurpMWh.getValue( energyModel.t_h + energyModel.p_timeStep_h);
+
+
+
+
+
+ 1660731384410
+ connections
+ true
+ 50
+ -50
+
+ false
+ true
+ true
+ false
+ COLLECTION_OF_LINKS
+ true
+ Object
+ SOLID
+ 1
+ -16777216
+ UNDER_AGENTS
+ NONE
+ END
+
+
+
+
+ 1660731880833
+ energyModel
+ 50
+ -100
+
+ false
+ true
+ true
+
+ zero_engine
+ EnergyModel
+
+
+
+
+
+ 1660731384414
+ level
+ 0
+ 0
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ 0
+ DIM_NON_CURRENT
+
+
+
+
+ 1658499506320
+ UI_EnergyAsset
+ true
+ /*@Override
+ public String toString() {
+ return
+ "EA " + this.getIndex() + "; " +
+ p_energyAssetType.toString() + "; " +
+ "r = " + roundToDecimal(v_powerFraction_fr, 3) + "; " +
+ "kW = " + roundToDecimal((v_currentConsumptionElectricity_kW - v_currentProductionElectricity_kW
+ + v_currentConsumptionHeat_kW - v_currentProductionHeat_kW
+ + v_currentConsumptionHydrogen_kW - v_currentProductionHydrogen_kW
+ + v_currentConsumptionMethane_kW - v_currentProductionMethane_kW
+ + v_currentConsumptionDiesel_kW),2);
+ }*/
+ 1752737189062
+ // f_connectToParentNode() --> made explicit function in main to avoid nested functions for easy profiling
+//if( assetCategory == PRODUCTION){
+// main.c_productionAssets.add(this);
+//}
+
+f_setCoordinatesUIElements();
+
+ false
+
+ 1658499506318
+ 1658499506318
+
+ T extends Agent
+
+ Generic parameter:
+
+ ENTITY
+ 100
+ false
+ 100
+ true
+
+ -4144960
+ null
+
+ true
+ true
+ false
+
+ 10
+ MPS
+
+
+ 1
+ METER
+
+
+ 1
+ METER
+
+
+ 1
+ METER
+
+
+
+ false
+
+ 1.0
+ SECOND
+
+ CONTINUOUS
+ 500
+ 500
+ 0
+ 100
+ 100
+ MOORE
+ USER_DEF
+ USER_DEF
+ 2
+ 50
+ 0.95
+ 10
+
+
+ true
+ 1658477089931
+ true
+ 1658563200000
+
+ 0
+ HOUR
+
+
+ 1
+ HOUR
+
+
+
+ 1658499506316
+ scale
+ 0
+ -150
+ false
+ false
+ false
+ SHAPE_DRAW_2D3D
+ 100
+ 0
+ BASED_ON_LENGTH
+ 10
+ METER
+ 10
+ true
+
+ 1658499506319
+ 1658499506315
+
+
+ 1658750229384
+ v_currentProductionElectricity_kW
+ 90
+ 340
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1658750229388
+ v_currentPowerElectricLost_kW
+ true
+ 90
+ 550
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1659092523267
+ v_currentProductionHeat_kW
+ 90
+ 460
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1659092541428
+ v_currentConsumptionElectricity_kW
+ 90
+ 360
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1659092596831
+ v_currentConsumptionHeat_kW
+ 90
+ 480
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1659092615449
+ v_currentConsumptionMethane_kW
+ 90
+ 400
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1659342082106
+ v_powerFraction_fr
+ 90
+ 300
+
+ false
+ true
+ true
+
+ double
+
+ 0
+
+
+
+
+ 1659345815346
+ v_currentProductionMethane_kW
+ 90
+ 380
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1659365919790
+ v_currentStateOfCharge_r
+ 90
+ 280
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1659513282177
+ v_currentProductionHydrogen_kW
+ 90
+ 420
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1659513295338
+ v_currentConsumptionHydrogen_kW
+ 90
+ 440
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1668601315863
+ v_currentConsumptionDiesel_kW
+ 90
+ 500
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1659090642877
+ j_ea
+ 90
+ 70
+
+ false
+ true
+ true
+
+ J_EA
+ NONE
+ false
+
+ 1659090642875
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1660130635726
+ p_parentAgent
+ 90
+ 110
+
+ false
+ true
+ true
+
+ Agent
+ NONE
+ MPS_SQ
+ false
+
+ 1660130635724
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1659347079551
+ p_energyAssetType
+ 90
+ 90
+
+ false
+ true
+ true
+
+ OL_EnergyAssetType
+ NONE
+ false
+
+ 1659347079549
+
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1666983925485
+ p_assetName
+ 90
+ 130
+
+ false
+ true
+ true
+
+ String
+ NONE
+ false
+
+ 1666983925483
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1715953134119
+ c_EAs
+ true
+ 310
+ 70
+
+ false
+ true
+ true
+
+ ArrayList
+ J_EA
+ String
+
+
+
+
+
+ 1716200767637
+ e_calculateEnergyBalance
+ Trigger voor energieberekeningen in de model backbone. Volgorde is belangrijk voor consistente resultaten.
+
+@since: Sprint 6
+@author: Jorrit
+ true
+ 310
+ 110
+
+ false
+ true
+ true
+
+
+ 1
+ HOUR
+
+
+ 1/p_timeStep_h
+ PER_HOUR
+
+ 1658477089925
+ true
+ 1658563200000
+
+ 0
+ HOUR
+
+
+ 0.25
+ HOUR
+
+ false
+
+ f_updateStackChartData();
+
+
+
+
+ VOID
+ double
+ 1693296929778
+ f_updateData
+ 730
+ 190
+
+ false
+ true
+ true
+ if (j_ea != null) {
+ /*
+ v_currentProductionElectricity_kW = j_ea.electricityProduction_kW;
+ v_currentConsumptionElectricity_kW = j_ea.electricityConsumption_kW;
+ v_currentProductionMethane_kW = j_ea.methaneProduction_kW;
+ v_currentConsumptionMethane_kW = j_ea.methaneConsumption_kW;
+ v_currentProductionHydrogen_kW = j_ea.hydrogenProduction_kW;
+ v_currentConsumptionHydrogen_kW = j_ea.hydrogenConsumption_kW;
+ v_currentProductionHeat_kW = j_ea.heatProduction_kW;
+ v_currentConsumptionHeat_kW = j_ea.heatConsumption_kW;
+ v_currentConsumptionDiesel_kW = j_ea.dieselConsumption_kW;
+ v_currentStateOfCharge_r = j_ea.getCurrentStateOfCharge();
+ v_powerFraction_fr = j_ea.v_powerFraction_fr;
+ */
+ plot.updateData();
+ //data_currentConsumptionElectricity_kW.update();
+ //data_currentProductionElectricity_kW.update();
+}
+
+
+
+ VOID
+ double
+ 1693297254281
+ f_initializeData
+ 730
+ 70
+
+ false
+ true
+ true
+
+ EA
+ J_EA
+
+ j_ea = EA;
+p_energyAssetType = j_ea.energyAssetType;
+p_assetName = j_ea.energyAssetName;
+p_parentAgent = j_ea.parentAgent;
+
+
+
+ VOID
+ double
+ 1713969761331
+ f_addFlows
+ true
+ 730
+ 210
+
+ false
+ true
+ true
+
+ arr
+ double[]
+
+ v_currentProductionElectricity_kW = arr[0];
+v_currentConsumptionElectricity_kW = arr[4];
+v_currentProductionMethane_kW = arr[1];
+v_currentConsumptionMethane_kW = arr[5];
+v_currentProductionHydrogen_kW = arr[2];
+v_currentConsumptionHydrogen_kW = arr[6];
+v_currentProductionHeat_kW = arr[3];
+v_currentConsumptionHeat_kW = arr[7];
+v_currentConsumptionDiesel_kW = arr[8];
+
+
+ VOID
+ double
+ 1714653114094
+ f_setCoordinatesUIElements
+ 730
+ 90
+
+ false
+ true
+ true
+ //plot.setX(0);
+//plot.setY(0);
+
+
+
+ VOID
+ double
+ 1714654478601
+ f_setVisibilities
+ 730
+ 110
+
+ false
+ true
+ true
+
+ isVisible
+ boolean
+
+ plot.setVisible(isVisible);
+
+
+ VOID
+ double
+ 1715953163186
+ f_updateStackChartData
+ true
+ 90
+ 730
+
+ false
+ true
+ true
+ double totalElectricityProduction_kW = 0;
+double totalElectricityConsumption_kW = 0;
+
+for (J_EA ea : c_EAs) {
+ totalElectricityProduction_kW += ea.electricityProduction_kW;
+ totalElectricityConsumption_kW += ea.electricityConsumption_kW;
+ traceln("ea consumption: " + ea.electricityConsumption_kW);
+}
+
+data_currentProductionElectricity_kW.add(totalElectricityProduction_kW);
+data_currentConsumptionElectricity_kW.add(totalElectricityConsumption_kW);
+
+
+
+ VOID
+ double
+ 1722513456426
+ f_removeFlows
+ true
+ 830
+ 210
+
+ false
+ true
+ true
+
+ arr
+ double[]
+
+ v_currentProductionElectricity_kW += arr[0];
+v_currentConsumptionElectricity_kW += arr[4];
+v_currentProductionMethane_kW += arr[1];
+v_currentConsumptionMethane_kW += arr[5];
+v_currentProductionHydrogen_kW += arr[2];
+v_currentConsumptionHydrogen_kW += arr[6];
+v_currentProductionHeat_kW += arr[3];
+v_currentConsumptionHeat_kW += arr[7];
+v_currentConsumptionDiesel_kW += arr[8];
+
+
+ VOID
+ double
+ 1729155791230
+ f_addFlows
+ 730
+ 230
+
+ false
+ true
+ true
+
+ flowsMap
+ J_FlowsMap
+
+ v_currentProductionElectricity_kW = max(0, -flowsMap.get(OL_EnergyCarriers.ELECTRICITY));
+v_currentConsumptionElectricity_kW = max(0, flowsMap.get(OL_EnergyCarriers.ELECTRICITY));
+v_currentProductionMethane_kW = max(0, -flowsMap.get(OL_EnergyCarriers.METHANE));
+v_currentConsumptionMethane_kW = max(0, flowsMap.get(OL_EnergyCarriers.METHANE));
+v_currentProductionHydrogen_kW = max(0, -flowsMap.get(OL_EnergyCarriers.HYDROGEN));
+v_currentConsumptionHydrogen_kW = max(0, flowsMap.get(OL_EnergyCarriers.HYDROGEN));
+v_currentProductionHeat_kW = max(0, -flowsMap.get(OL_EnergyCarriers.HEAT));
+v_currentConsumptionHeat_kW = max(0, flowsMap.get(OL_EnergyCarriers.HEAT));
+v_currentConsumptionDiesel_kW = max(0, flowsMap.get(OL_EnergyCarriers.DIESEL));
+
+
+
+
+ VOID
+ double
+ 1729167663082
+ f_removeFlows
+ 830
+ 230
+
+ false
+ true
+ true
+
+ flowsMap
+ J_FlowsMap
+
+ v_currentProductionElectricity_kW = max(0, -flowsMap.get(OL_EnergyCarriers.ELECTRICITY));
+v_currentConsumptionElectricity_kW = max(0, flowsMap.get(OL_EnergyCarriers.ELECTRICITY));
+v_currentProductionMethane_kW = max(0, -flowsMap.get(OL_EnergyCarriers.METHANE));
+v_currentConsumptionMethane_kW = max(0, flowsMap.get(OL_EnergyCarriers.METHANE));
+v_currentProductionHydrogen_kW = max(0, -flowsMap.get(OL_EnergyCarriers.HYDROGEN));
+v_currentConsumptionHydrogen_kW = max(0, flowsMap.get(OL_EnergyCarriers.HYDROGEN));
+v_currentProductionHeat_kW = max(0, -flowsMap.get(OL_EnergyCarriers.HEAT));
+v_currentConsumptionHeat_kW = max(0, flowsMap.get(OL_EnergyCarriers.HEAT));
+v_currentConsumptionDiesel_kW = max(0, flowsMap.get(OL_EnergyCarriers.DIESEL));
+
+
+
+
+
+
+ 1715953048233
+ data_currentProductionElectricity_kW
+ true
+ 90
+ 800
+
+ false
+ true
+ true
+ false
+
+ 1751011894124
+ true
+ 1716019200000
+
+ 0
+ HOUR
+
+
+ 1
+ HOUR
+
+
+ true
+ v_currentProductionElectricity_kW
+ 672
+
+
+ 1715953093443
+ data_currentConsumptionElectricity_kW
+ true
+ 90
+ 830
+
+ false
+ true
+ true
+ false
+
+ 1751011894126
+ true
+ 1716019200000
+
+ 0
+ HOUR
+
+
+ 1
+ HOUR
+
+
+ true
+ v_currentConsumptionElectricity_kW
+ 672
+
+
+
+
+ 1658499506315
+ connections
+ true
+ 50
+ -50
+
+ false
+ true
+ true
+ false
+ COLLECTION_OF_LINKS
+ true
+ Object
+ SOLID
+ 1
+ -16777216
+ UNDER_AGENTS
+ NONE
+ END
+
+
+
+
+ 1658499506319
+ level
+ 0
+ 0
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ 0
+ DIM_NON_CURRENT
+
+
+ 1667919118778
+ line4
+ true
+ 710
+ 40
+
+ false
+ true
+ false
+ SHAPE_DRAW_2D3D
+ false
+ 0
+ 10
+ 1
+ -16777216
+ null
+ SOLID
+ 1
+ 0
+ 1
+ 0
+ 140
+ 0
+ 0
+
+
+ 1667919118781
+ text4
+ true
+ 760
+ 20
+
+ false
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ Functions
+
+ SansSerif
+ 11
+
+
+ LEFT
+
+
+ 1667919118783
+ line5
+ true
+ 700
+ 60
+
+ false
+ true
+ false
+ SHAPE_DRAW_2D3D
+ false
+ 0
+ 10
+ 1
+ -16777216
+ null
+ DOTTED
+ 1
+ 0
+ 1
+ 0
+ 0
+ 100
+ 0
+
+
+ 1667919118785
+ text6
+ true
+ 680
+ 234
+
+ false
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 270.0
+ -16777216
+ Occuring
+
+ SansSerif
+ 11
+
+
+ LEFT
+
+
+ 1667919118787
+ line6
+ true
+ 700
+ 180
+
+ false
+ true
+ false
+ SHAPE_DRAW_2D3D
+ false
+ 0
+ 10
+ 1
+ -16777216
+ null
+ DOTTED
+ 1
+ 0
+ 1
+ 0
+ 0
+ 70
+ 0
+
+
+ 1667919118789
+ text5
+ true
+ 680
+ 110
+
+ false
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 270.0
+ -16777216
+ Init
+
+ SansSerif
+ 11
+
+
+ LEFT
+
+
+ 1667919228650
+ line
+ 80
+ 40
+
+ false
+ true
+ false
+ SHAPE_DRAW_2D3D
+ false
+ 0
+ 10
+ 1
+ -16777216
+ null
+ SOLID
+ 1
+ 0
+ 1
+ 0
+ 140
+ 0
+ 0
+
+
+ 1667919228652
+ text1
+ 110
+ 20
+
+ false
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ ID & connections
+
+ SansSerif
+ 11
+
+
+ LEFT
+
+
+ 1667919281533
+ line1
+ 80
+ 240
+
+ false
+ true
+ false
+ SHAPE_DRAW_2D3D
+ false
+ 0
+ 10
+ 1
+ -16777216
+ null
+ SOLID
+ 1
+ 0
+ 1
+ 0
+ 140
+ 0
+ 0
+
+
+ 1667919281535
+ text2
+ 110
+ 220
+
+ false
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ Current status
+
+ SansSerif
+ 11
+
+
+ LEFT
+
+
+ 1668420180250
+ plot
+ 430
+ 300
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ true
+
+ 1751011894104
+ true
+ 1668499200000
+
+ 0
+ HOUR
+
+
+ 15
+ MINUTE
+
+
+ false
+ 500
+ 280
+
+
+
+ 50
+ 30
+ 420
+ 160
+ -1
+ -16777216
+ -12566464
+
+
+
+ DEFAULT
+ DEFAULT
+ -12566464
+
+ true
+ MOVEMENT_WITH_TIME
+ HOUR
+ 0
+ 1
+ AUTO
+ true
+ LINEAR
+
+ Electricity Consumption
+ 1658477089930
+ my_dataset
+ -2448096
+ v_currentConsumptionElectricity_kW
+ true
+ NONE
+ 1.0
+
+
+ Electricity Production
+ 1658477089929
+ my_dataset1
+ -9728477
+ v_currentProductionElectricity_kW
+ true
+ NONE
+ 1.0
+
+
+ State of Charge
+ 1658477089928
+ my_dataset2
+ -16728065
+ v_currentStateOfCharge_r
+ true
+ NONE
+ 1.0
+
+ 768
+ 168
+ false
+ dd_MM
+
+
+ 1668420196225
+ text3
+ 560
+ 300
+
+ false
+ false
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ Graph can be ignored for non-debug runs
+
+ SansSerif
+ 12
+
+
+ LEFT
+
+
+ 1676462939101
+ temperaturePlot
+ true
+ 400
+ 570
+
+ false
+ true
+ false
+ SHAPE_DRAW_2D3D
+ true
+
+ 1751011894107
+ true
+ 1676534400000
+
+ 0
+ HOUR
+
+
+ 1
+ HOUR
+
+
+ false
+ 440
+ 210
+
+
+
+ 50
+ 30
+ 360
+ 120
+ -1
+ -16777216
+ -12566464
+
+
+
+ DEFAULT
+ DEFAULT
+ -12566464
+
+ true
+ MOVEMENT_WITH_TIME
+ MODEL_TIME_UNIT
+ 0
+ 50
+ FIXED
+ true
+ LINEAR
+
+ Temperature
+ 1658477089927
+ my_dataset
+ -16728065
+ j_ea.getCurrentTemperature()
+ true
+ NONE
+ 1.0
+
+
+ Buffer SoC
+ 1658477089926
+ my_dataset1
+ -4565549
+ v_currentStateOfCharge_r
+ true
+ NONE
+ 1.0
+
+ 1000
+ 100
+ false
+ MODEL_TIME_UNITS
+
+
+ false
+ 1693296357894
+ ed_assetNr
+ true
+ 460
+ 50
+
+ false
+ true
+ false
+ SHAPE_DRAW_2D3D
+
+ false
+ -1
+ -16777216
+ true
+ int assetNr = ed_assetNr.getIntValue();
+j_ea = energyModel.c_energyAssets.get(assetNr);
+p_energyAssetType = j_ea.energyAssetType;
+p_assetName = j_ea.energyAssetName;
+p_parentAgent = j_ea.parentAgent;
+
+
+
+
+ "0"
+ false
+
+
+
+ 1693296387281
+ text7
+ true
+ 450
+ 30
+
+ false
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ Energy Asset Number
+
+ SansSerif
+ 11
+
+
+ LEFT
+
+
+ 1715953590721
+ chart
+ true
+ 930
+ 280
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ true
+
+ 1751011894111
+ true
+ 1716019200000
+
+ 0
+ HOUR
+
+
+ 1
+ HOUR
+
+
+ false
+ 500
+ 280
+
+
+
+ 50
+ 30
+ 420
+ 190
+ -1
+ -16777216
+ -12566464
+
+
+
+ DEFAULT
+ DEFAULT
+ -12566464
+
+ true
+ MOVEMENT_WITH_TIME
+ MODEL_TIME_UNIT
+ 100
+
+ 1715953592765
+ data_currentConsumptionElectricity_kW
+ -40121
+ 0
+ false
+ Consumption
+
+
+ 1715953622911
+ data_currentProductionElectricity_kW
+ -16744448
+ 0
+ false
+ Production
+
+ 100
+ 1
+ AUTO
+ MODEL_TIME_UNITS
+
+
+
+
+
+
+ 1658752913454
+ UI_GridNode
+ true
+ 1752737189062
+ f_setNodeVisual();
+ false
+
+ 1658752913452
+ 1658752913452
+
+ T extends Agent
+
+ Generic parameter:
+
+ ENTITY
+ 100
+ false
+ 100
+ true
+
+ -4144960
+ null
+
+ true
+ true
+ false
+
+ 10
+ MPS
+
+
+ 1
+ METER
+
+
+ 1
+ METER
+
+
+ 1
+ METER
+
+
+
+ false
+
+ 1.0
+ SECOND
+
+ CONTINUOUS
+ 500
+ 500
+ 0
+ 100
+ 100
+ MOORE
+ USER_DEF
+ USER_DEF
+ 2
+ 50
+ 0.95
+ 10
+
+
+ true
+ 1658477089924
+ true
+ 1658822400000
+
+ 0
+ HOUR
+
+
+ 1
+ HOUR
+
+
+
+ 1658752913450
+ scale
+ 0
+ -180
+ false
+ false
+ false
+ SHAPE_DRAW_2D3D
+ 100
+ 0
+ BASED_ON_LENGTH
+ 10
+ METER
+ 10
+ true
+
+ 1658752913453
+ 1658752913449
+
+
+ 1670933843521
+ v_localProduction_kW
+ 60
+ 300
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1670933857325
+ v_batteryProduction_kW
+ 60
+ 320
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1670933894502
+ v_vehicleConsumption_kW
+ 60
+ 370
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1670933909350
+ v_vehicleProduction_kW
+ 60
+ 340
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1670933925207
+ v_fixedConsumptionProfiles_kW
+ 60
+ 390
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1670933944857
+ v_electricHeatingConsumption_kW
+ 60
+ 430
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1670934339512
+ v_batteryConsumption_kW
+ 60
+ 450
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1675683786853
+ v_congestionPrice_eurpkWh
+ 60
+ 490
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1689596764390
+ v_electricCookingPower_kW
+ 60
+ 410
+
+ false
+ true
+ true
+
+ double
+
+
+
+ 1658753690661
+ p_nodeID
+ 60
+ 190
+
+ false
+ true
+ true
+
+ String
+ NONE
+ false
+
+ 1658753690659
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1658759460529
+ p_nodeType
+ 60
+ 210
+
+ false
+ true
+ true
+
+ OL_GridNodeType
+ NONE
+ false
+
+ 1658759460527
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+ 1670516047533
+ p_gridNode
+ 60
+ 170
+
+ false
+ true
+ true
+
+ GridNode
+ NONE
+ false
+
+ 1670516047531
+ TEXT_BOX
+ 0
+ 100
+ NO_DELIMETER
+
+
+
+
+
+
+ 1670933873241
+ e_gatherNodeInfo
+ 60
+ 260
+
+ false
+ true
+ true
+
+
+ 1
+ HOUR
+
+
+ 1
+ PER_HOUR
+
+ 1658477089917
+ true
+ 1671004800000
+
+ 1
+ MINUTE
+
+
+ energyModel.p_timeStep_h
+ HOUR
+
+ false
+
+ v_localProduction_kW = 0;
+v_batteryProduction_kW = 0;
+v_vehicleProduction_kW = 0;
+
+v_vehicleConsumption_kW = 0;
+v_fixedConsumptionProfiles_kW = 0;
+v_electricHeatingConsumption_kW = 0;
+v_batteryConsumption_kW = 0;
+v_electricCookingPower_kW = 0;
+
+for( GridConnection g : realAgent.getConnectedAgent().c_electricityGridConnections){
+ v_localProduction_kW += g.v_pvProductionElectric_kW + g.v_windProductionElectric_kW - min(0,g.v_conversionPowerElectric_kW);
+ v_batteryProduction_kW += g.v_batteryPowerElectric_kW < 0 ? -g.v_batteryPowerElectric_kW : 0;
+ v_vehicleProduction_kW += g.v_evChargingPowerElectric_kW < 0 ? g.v_evChargingPowerElectric_kW : 0;
+
+ v_vehicleConsumption_kW += g.v_evChargingPowerElectric_kW > 0 ? g.v_evChargingPowerElectric_kW : 0;
+ v_fixedConsumptionProfiles_kW += g.v_fixedConsumptionElectric_kW ;
+ v_electricCookingPower_kW += g.v_electricHobConsumption_kW;
+ v_electricHeatingConsumption_kW += max(0,g.v_conversionPowerElectric_kW - g.v_electricHobConsumption_kW);
+ v_batteryConsumption_kW += g.v_batteryPowerElectric_kW > 0 ? g.v_batteryPowerElectric_kW : 0;
+
+}
+
+v_congestionPrice_eurpkWh = p_gridNode.v_currentCongestionPrice_eurpkWh;
+ch_cumulativeSupply.updateData();
+ch_cumulativeDemand.updateData();
+pl_powerFlows.updateData();
+
+
+
+
+ VOID
+ double
+ 1658753874720
+ f_setNodeVisual
+ 60
+ 140
+
+ false
+ false
+ true
+ t_nodeID.setText(p_nodeID);
+t_nodetype.setText(p_nodeType);
+
+
+ VOID
+ double
+ 1670933638545
+ f_onClick
+ 60
+ 120
+
+ false
+ true
+ true
+ group.setY(450 - this.getY());
+group.setX(1120 - this.getX());
+
+for(UI_GridConnection g : kpiVisuals.uI_GridConnections){
+ g.pl_powerFlows.setVisible(false);
+ g.t_plotname.setVisible(false);
+ g.t_assets.setVisible(false);
+}
+for(UI_GridNode n : kpiVisuals.uI_GridNodes){
+ n.group.setVisible(false);
+ group.setVisible(true);
+}
+
+
+
+
+ 1658752913449
+ connections
+ 250
+ -80
+
+ false
+ true
+ true
+ false
+ COLLECTION_OF_LINKS
+ true
+ Object
+ true
+ DOTTED
+ 0.5
+ -16777216
+ UNDER_AGENTS
+ NONE
+ END
+
+
+ 1658760368568
+ realAgent
+ 240
+ -110
+
+ false
+ true
+ true
+ false
+ SINGLE_LINK
+ 1658477288308
+ false
+ Object
+ SOLID
+ 1
+ -16777216
+ UNDER_AGENTS
+ NONE
+ END
+
+
+
+
+ 1658752913453
+ level
+ 0
+ 0
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ 0
+ DIM_NON_CURRENT
+
+
+ 1658752947986
+ netNodeVisual
+ -110
+ -100
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ f_onClick();
+ false
+ 0
+ 10
+ 1
+ -4144960
+ null
+ DASHED
+ 230
+ 100
+ 0.0
+ -1
+ null
+
+
+ 1658753927156
+ t_nodeID
+ 16
+ -121
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ ID
+
+ SansSerif
+ 12
+
+
+ CENTER
+
+
+ 1658754055524
+ t_nodeText
+ -35
+ -121
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ -Coop:
+
+ SansSerif
+ 12
+
+
+ LEFT
+
+
+ 1658759394610
+ t_nodetype
+ -35
+ -121
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ Coop level
+
+
+ SansSerif
+ 12
+
+
+ RIGHT
+
+
+ 1658762845688
+ text
+ -90
+ -80
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ load:
+
+ SansSerif
+ 12
+
+
+ LEFT
+
+
+ 1658762845695
+ t_loadElectricText
+ -90
+ -60
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ 0 MWe
+
+ SansSerif
+ 12
+
+
+ LEFT
+
+
+ 1660136208763
+ t_loadThermalText
+ -90
+ -40
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ 0 MWth
+
+ SansSerif
+ 12
+
+
+ LEFT
+
+
+ 1670531662645
+ plot
+ -30
+ -125
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ true
+
+ 1751011894154
+ true
+ 1670400000000
+
+ 0
+ HOUR
+
+
+ 0.25
+ HOUR
+
+
+ false
+ 150
+ 130
+
+
+
+ 30
+ 30
+ 110
+ 70
+ -1
+ -16777216
+ -12566464
+
+
+
+ DEFAULT
+ DEFAULT
+ -12566464
+
+ false
+ MOVEMENT_WITH_TIME
+ DAY
+ - p_gridNode.p_capacity_kW - p_gridNode.p_capacity_kW *0.2
+ p_gridNode.p_capacity_kW + p_gridNode.p_capacity_kW * 0.2
+ FIXED
+ true
+ LINEAR
+
+ Node capacity
+ 1670531662640
+ my_dataset
+ -1468806
+ p_gridNode.p_capacity_kW
+ true
+ NONE
+ 1.0
+
+
+ Current load on grid [kW]
+ 1670531662641
+ my_dataset2
+ -8355712
+ p_gridNode.v_currentLoadElectricity_kW
+ true
+ NONE
+ 2.0
+
+
+
+ 1670531662642
+ my_dataset1
+ -1468806
+ - p_gridNode.p_capacity_kW
+ true
+ NONE
+ 1.0
+
+ 1000
+ 2
+ false
+ HH_mm
+
+
+ 1670581717233
+ oval
+ 0
+ 0
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ false
+ 0
+ 10
+ 1
+ -16777216
+ null
+ SOLID
+ 1.875
+ 40
+ 0.0
+ -1
+ null
+
+
+ 1670935352089
+ group
+ 570
+ 400
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ false
+ 0
+ 0.0
+
+
+ 1670933728177
+ ch_cumulativeSupply
+ -220
+ -140
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ false
+
+ 1751011894158
+ true
+ 1671004800000
+
+ 0
+ HOUR
+
+
+ 1
+ HOUR
+
+
+ false
+ 480
+ 210
+
+
+
+ 50
+ 30
+ 410
+ 120
+ -1
+ -16777216
+ -12566464
+
+
+
+ DEFAULT
+ DEFAULT
+ -12566464
+
+ true
+ MOVEMENT_WITH_TIME
+ HOUR
+ 48
+
+ 1658477089923
+ my_dataset
+ -6632142
+ v_vehicleProduction_kW
+ true
+ Vehicle to X
+
+
+ 1658477089922
+ my_dataset
+ -256
+ v_localProduction_kW
+ true
+ Local production [kW]
+
+
+ 1658477089921
+ my_dataset
+ -23296
+ v_batteryProduction_kW
+ true
+ Battery to X [kW]
+
+ 10000
+ 1
+ AUTO
+ HH_mm
+
+
+ 1670935101040
+ ch_cumulativeDemand
+ -220
+ -370
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ false
+
+ 1751011894160
+ true
+ 1671004800000
+
+ 0
+ HOUR
+
+
+ 1
+ HOUR
+
+
+ false
+ 490
+ 230
+
+
+
+ 50
+ 30
+ 410
+ 120
+ -1
+ -16777216
+ -12566464
+
+
+
+ DEFAULT
+ DEFAULT
+ -12566464
+
+ true
+ MOVEMENT_WITH_TIME
+ HOUR
+ 48
+
+ 1670935101036
+ my_dataset
+ -14774017
+ v_fixedConsumptionProfiles_kW
+ true
+ Consumption profiles [kW]
+
+
+ 1670935101035
+ my_dataset
+ -6632142
+ v_vehicleConsumption_kW
+ true
+ Charging vehicle [kW]
+
+
+ 1658477089920
+ my_dataset
+ -5952982
+ v_electricHeatingConsumption_kW
+ true
+ Heating assets consumption [kW]
+
+
+ 1670935101037
+ my_dataset
+ -23296
+ v_batteryConsumption_kW
+ true
+ charging Battery [kW]
+
+
+ 1658477089919
+ my_dataset
+ -2461482
+ v_electricCookingPower_kW
+ true
+ e-cooking power [kW]
+
+ 10000
+ 1
+ AUTO
+ HH_mm
+
+
+ 1670936666425
+ text1
+ -72
+ -361
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ Cumulative electricity demand
+
+ SansSerif
+ 14
+
+
+ CENTER
+
+
+ 1670936843786
+ text2
+ -80
+ -130
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ Cumulative electricity supply
+
+ SansSerif
+ 14
+
+
+ CENTER
+
+
+ 1671704217693
+ pl_powerFlows
+ -220
+ 60
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ false
+
+ 1751011894164
+ true
+ 1668499200000
+
+ 0
+ HOUR
+
+
+ 15
+ MINUTE
+
+
+ false
+ 480
+ 280
+
+
+
+ 50
+ 30
+ 400
+ 160
+ -1
+ -16777216
+ -12566464
+
+
+
+ DEFAULT
+ DEFAULT
+ -12566464
+
+ true
+ MOVEMENT_WITH_TIME
+ MODEL_TIME_UNIT
+ 0
+ 1
+ AUTO
+ true
+ LINEAR
+
+ GridNode current power [kW]
+ 1671704217684
+ my_dataset
+ -3308225
+ p_gridNode.v_currentLoadElectricity_kW
+ true
+ NONE
+ 2.0
+
+
+ EV charging demand [kW]
+ 1671704217685
+ my_dataset3
+ -6632142
+ v_vehicleConsumption_kW
+ true
+ NONE
+ 1.0
+
+
+ Battery load [kW]
+ 1671704217686
+ my_dataset4
+ -4565549
+ v_batteryConsumption_kW - v_batteryProduction_kW
+ true
+ NONE
+ 1.0
+
+
+ Total production [kW]
+ 1671704217687
+ my_dataset5
+ -14774017
+ -v_localProduction_kW
+ true
+ NONE
+ 1.0
+
+
+ Electric heating power [kW]
+ 1671704217688
+ my_dataset1
+ -256
+ v_electricHeatingConsumption_kW
+ true
+ NONE
+ 1.0
+
+
+ Consumption other [kW]
+ 1658477089918
+ my_dataset6
+ -3137392
+ v_fixedConsumptionProfiles_kW
+ true
+ NONE
+ 1.0
+
+ 1000
+ 48
+ false
+ HH_mm
+
+
+ 1675683844543
+ pl_powerFlows1
+ -220
+ -550
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ true
+
+ 1751011894166
+ true
+ 1668499200000
+
+ 0
+ HOUR
+
+
+ 15
+ MINUTE
+
+
+ false
+ 480
+ 220
+
+
+
+ 50
+ 30
+ 400
+ 100
+ -1
+ -16777216
+ -12566464
+
+
+
+ DEFAULT
+ DEFAULT
+ -12566464
+
+ true
+ MOVEMENT_WITH_TIME
+ MODEL_TIME_UNIT
+ 0
+ 1
+ AUTO
+ true
+ LINEAR
+
+ Congestion price
+ 1675683844536
+ my_dataset3
+ -8388480
+ v_congestionPrice_eurpkWh
+ true
+ NONE
+ 1.0
+
+ 1000
+ 48
+ false
+ HH_mm
+
+
+
+
+
+
+
+
+ EULER
+ RK45_NEWTON
+ MODIFIED_NEWTON
+ 1.0
+ 1.0
+ 1.0
+ 0.1
+ DEFAULT
+
+ 1658477089997
+ 1920
+ 980
+
+
+ 1658477089916
+ false
+ false
+ false
+
+
+
+
+ 1658477103163
+ RunConfiguration
+ 4096
+
+ Stop at specified date
+ 1672531200000
+ 0.0
+ 1704067200000
+ 8760.0
+
+
+ false
+ realTimeScaled
+ 10.0
+ true
+ true
+ false
+
+
+
+ 1661517220706
+ P time step h
+
+ zero_engine
+ EnergyModel
+ p_timeStep_h
+
+
+
+ 1661517213660
+ B add kpi visuals
+
+ zero_engine
+ EnergyModel
+ b_parallelizeConnectionOwners
+
+
+
+ 1663577689860
+ P parallelize
+
+ zero_engine
+ EnergyModel
+ b_parallelizeGridConnections
+
+
+
+
+
+
+
+ 1659091451342
+ J_EAProduction
+ 1752677832758
+ /**
+ * J_EAProduction
+ */
+public class J_EAProduction extends zero_engine.J_EA implements Serializable {
+ protected J_ProfilePointer profilePointer;
+ protected OL_EnergyCarriers energyCarrier = OL_EnergyCarriers.ELECTRICITY;
+ protected double totalEnergyCurtailed_kWh=0;
+ //protected double outputTemperature_degC;
+ protected double capacity_kW;
+
+ /**
+ * Default constructor
+ */
+ public J_EAProduction() {
+ }
+
+ /**
+ * Constructor initializing the fields
+ */
+ public J_EAProduction(Agent parentAgent, OL_EnergyAssetType type, String name, OL_EnergyCarriers energyCarrier, double capacity_kW, double timestep_h, J_ProfilePointer profile) {
+ this.parentAgent = parentAgent;
+ this.energyAssetType = type;
+ if (type == OL_EnergyAssetType.PHOTOVOLTAIC) {
+ this.assetFlowCategory = OL_AssetFlowCategories.pvProductionElectric_kW;
+ } else if (type == OL_EnergyAssetType.WINDMILL) {
+ this.assetFlowCategory = OL_AssetFlowCategories.windProductionElectric_kW;
+ } else if (type == OL_EnergyAssetType.PHOTOTHERMAL) {
+ this.assetFlowCategory = OL_AssetFlowCategories.ptProductionHeat_kW;
+ } else if (type == OL_EnergyAssetType.GAS_BURNER) {
+ this.assetFlowCategory = OL_AssetFlowCategories.CHPProductionElectric_kW;
+ } else {
+ throw new RuntimeException("No valid OL_EnergyAssetType, cannot assign AssetFlowCategory!");
+ }
+ this.energyAssetName = name;
+ this.energyCarrier = energyCarrier;
+ this.capacity_kW = capacity_kW;
+
+ this.timestep_h = timestep_h;
+ //this.outputTemperature_degC = outputTemperature_degC;
+ if (profile == null) {
+ profilePointer = ((GridConnection)parentAgent).energyModel.f_findProfile(name);
+ } else {
+ profilePointer = profile;
+ }
+ if (profile == null) {
+ throw new RuntimeException("J_EAProduction needs to have valid profilePointer!");
+ }
+ this.activeProductionEnergyCarriers.add(this.energyCarrier);
+ registerEnergyAsset();
+ }
+
+ public void setCapacityElectric_kW(double capacityElectric_kW) {
+ // Calculate the difference with the set and the previous capacity to update totals in GC, GN and EnergyModel
+ if (energyCarrier == OL_EnergyCarriers.ELECTRICITY) {
+ 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).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).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;
+ }
+
+ this.capacity_kW = capacityElectric_kW;
+ } else {
+ throw new RuntimeException("Production assets energy carrier is not electricity!");
+ }
+ }
+
+ public double getCapacityElectric_kW() {
+ if (energyCarrier == OL_EnergyCarriers.ELECTRICITY) {
+ return this.capacity_kW;
+ } else {
+ throw new RuntimeException("J_EAProduction is not electric!");
+ }
+ }
+
+ public double getCapacityHeat_kW() {
+ if (energyCarrier == OL_EnergyCarriers.HEAT) {
+ return capacity_kW;
+ } else {
+ throw new RuntimeException("J_EAProduction is not thermal!");
+ }
+ }
+
+ public String getName() {
+ return this.energyAssetName;
+ }
+
+ @Override
+ public void operate(double ratioOfCapacity) {
+ ratioOfCapacity = profilePointer.getCurrentValue();
+
+ //if (ratioOfCapacity>0.0) { // Skip when there is no production -> saves time?
+ double currentProduction_kW = ratioOfCapacity * this.capacity_kW;
+
+ this.energyUse_kW = -currentProduction_kW;
+ this.energyUsed_kWh += this.energyUse_kW * this.timestep_h;
+ this.flowsMap.put(this.energyCarrier, -currentProduction_kW);
+ this.assetFlowsMap.put(this.assetFlowCategory, currentProduction_kW);
+ //}
+ throw new RuntimeException("J_EAProduction operate override is called!");
+ }
+
+ @Override
+ public void f_updateAllFlows() {
+ double ratioOfCapacity = profilePointer.getCurrentValue();
+
+ if (ratioOfCapacity>0.0) { // Skip when there is no production -> saves time?
+ double currentProduction_kW = ratioOfCapacity * this.capacity_kW;
+
+ this.energyUse_kW = -currentProduction_kW;
+ this.energyUsed_kWh += this.energyUse_kW * this.timestep_h;
+ this.flowsMap.put(this.energyCarrier, -currentProduction_kW);
+ this.assetFlowsMap.put(this.assetFlowCategory, currentProduction_kW);
+ if (parentAgent instanceof GridConnection) {
+ //((GridConnection)parentAgent).f_addFlows(arr, this);
+ ((GridConnection)parentAgent).f_addFlows(flowsMap, this.energyUse_kW, assetFlowsMap, this);
+ }
+
+ }
+ this.lastFlowsMap.cloneMap(this.flowsMap);
+ this.lastEnergyUse_kW = this.energyUse_kW;
+ this.clear();
+ }
+
+ public double curtailEnergyCarrierProduction(OL_EnergyCarriers curtailedEnergyCarrier, double curtailmentAmount_kW) { // The curtailment setpoint is the requested amount of curtailment; requested reduction of production. (which may or may not be provided, depending on what the current production is)
+
+ if(this.energyCarrier != curtailedEnergyCarrier) {
+ //new RuntimeException("Trying to curtail the wrong a production asset with the wrong energyCarrier");
+ return 0;
+ }
+
+ double currentProduction_kW = -this.lastFlowsMap.get(curtailedEnergyCarrier);
+ double curtailmentPower_kW = max(0,min(currentProduction_kW, curtailmentAmount_kW)); // Can only curtail what was produced in the first place.
+ energyUsed_kWh += curtailmentPower_kW * timestep_h; // energyUsed_kWh is negative for production assets. Curtailment makes it 'less negative', so a positive number is added to energyUsed_kWh.
+ this.totalEnergyCurtailed_kWh += curtailmentPower_kW * timestep_h;
+ J_FlowsMap curtailmentFlow = new J_FlowsMap();
+ curtailmentFlow.put(curtailedEnergyCarrier, -curtailmentPower_kW); // To remove production, a negative flow must be removed. Thus this flowmap with a negative flow will be sent to GC.f_removeFlows()
+ J_ValueMap<OL_AssetFlowCategories> assetFlows_kW = new J_ValueMap(OL_AssetFlowCategories.class);
+ assetFlows_kW.put(this.assetFlowCategory, curtailmentPower_kW); // The assetFlows for production assets contain positive values for production. This assetFlows_kW will be handle bij GC.f_removeFlows(), so it should contain a positive number to remove production.
+ double curtailedEnergyUse_kW = -curtailmentPower_kW; // production is a negative flow, so to remove production, a negative value must be sent to GC.f_removeFlows().
+ this.lastFlowsMap.addFlow(curtailedEnergyCarrier, curtailmentPower_kW); // production is a negative flow, so to remove production, a positive value must be added to lastFlows.
+ this.lastEnergyUse_kW += curtailmentPower_kW; // production is a negative flow, so to remove production, a positive value must be added to lastEnergyUse_kW.
+
+ //traceln("Electricity production of asset %s curtailed by %s kW!", this, curtailmentPower_kW);
+ if (parentAgent instanceof GridConnection) {
+ ((GridConnection)parentAgent).f_removeFlows(curtailmentFlow, curtailedEnergyUse_kW, assetFlows_kW, this);
+ }
+ clear();
+
+ return curtailmentPower_kW;
+ }
+
+ public double getEnergyCurtailed_kWh() {
+ return this.totalEnergyCurtailed_kWh;
+ }
+
+ public J_ProfilePointer getProfilePointer() {
+ return this.profilePointer;
+ }
+
+ @Override
+ public void storeStatesAndReset() {
+ this.totalEnergyCurtailed_kWh = 0;
+ super.storeStatesAndReset();
+ }
+
+ @Override
+ public String toString() {
+ return
+ "type = " + this.getClass().toString() + " " +
+ "parentAgent = " + parentAgent +" " +
+ "capacity_kW = " + capacity_kW +" "+
+ "energyCarrier = " + energyCarrier +" "+
+ "energyProduced_kWh = " + (-this.energyUsed_kWh) + " ";
+ }
+
+ public String getOwnerAgent() {
+ return parentAgent.agentInfo();
+ }
+
+ /*public double getCurrentTemperature() {
+ return outputTemperature_degC;
+ }*/
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+}
+
+
+
+ 1659091479591
+ J_EAStorage
+ 1752677832758
+ /**
+ * J_EAStorage
+ */
+public abstract class J_EAStorage extends J_EA implements Serializable {
+
+ protected OL_EnergyCarriers storageMedium;
+ protected double storageCapacity_kWh;
+ protected double stateOfCharge_fr;
+ protected double initialstateOfCharge_fr;
+ protected double stateOfChargeStored_r;
+ //protected double lossFactor_r;
+ //protected double ambientTemperature_degC;
+ //protected String ambientTempType;
+ protected double discharged_kWh = 0;
+ protected double charged_kWh = 0;
+
+ /**
+ * Default constructor
+ */
+ public J_EAStorage() {
+ }
+
+ public void calculateLoss() {
+ }
+
+ protected void updateStateOfCharge( double deltaEnergy_kWh ) {
+ stateOfCharge_fr += deltaEnergy_kWh / storageCapacity_kWh;
+ }
+
+ @Override
+ public void storeStatesAndReset() {
+ // Each energy asset that has some states should overwrite this function!
+ energyUsedStored_kWh = energyUsed_kWh;
+ energyUsed_kWh = 0.0;
+ stateOfChargeStored_r = stateOfCharge_fr;
+ stateOfCharge_fr = initialstateOfCharge_fr;
+ charged_kWh = 0;
+ discharged_kWh = 0;
+ clear();
+ }
+
+ @Override
+ public void restoreStates() {
+ // Each energy asset that has some states should overwrite this function!
+ energyUsed_kWh = energyUsedStored_kWh;
+ stateOfCharge_fr = stateOfChargeStored_r;
+ }
+
+ public double getCurrentStateOfCharge_fr() {
+ return this.stateOfCharge_fr;
+ }
+
+ public double getStorageCapacity_kWh() {
+ return this.storageCapacity_kWh;
+ }
+
+ public double getCurrentStateOfCharge_kWh() {
+ return this.stateOfCharge_fr * this.storageCapacity_kWh;
+ }
+
+ @Override
+ public double getCurrentTemperature() {
+ return 0;
+ }
+
+ @Override
+ public void updateAmbientTemperature(double currentAmbientTemperature_degC) {
+ }
+
+ @Override
+ public String toString() {
+ return super.toString();
+ }
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+
+}
+
+
+ 1659091488030
+ J_EAConversion
+ 1752677832758
+ /**
+ * J_EAConversion
+ */
+public class J_EAConversion extends zero_engine.J_EA implements Serializable {
+ protected OL_EnergyCarriers energyCarrierProduced;
+ protected OL_EnergyCarriers energyCarrierConsumed;
+ protected double eta_r;
+ protected double inputCapacity_kW;
+ protected double outputCapacity_kW;
+ /**
+ * Default constructor
+ */
+ public J_EAConversion() {
+ }
+
+ /**
+ * Constructor initializing the fields
+ */
+
+ public J_EAConversion(Agent parentAgent, OL_EnergyAssetType energyAssetType, double outputCapacity_kW, double efficiency_r, OL_EnergyCarriers energyCarrierProduced, OL_EnergyCarriers energyCarrierConsumed, double timestep_h) {
+ this.parentAgent = parentAgent;
+ this.energyAssetType = energyAssetType;
+ this.outputCapacity_kW = outputCapacity_kW;
+ this.eta_r = efficiency_r;
+ this.inputCapacity_kW = this.outputCapacity_kW / this.eta_r;
+ this.energyCarrierProduced = energyCarrierProduced;
+ this.energyCarrierConsumed = energyCarrierConsumed;
+ this.timestep_h = timestep_h;
+ this.activeProductionEnergyCarriers.add(this.energyCarrierProduced);
+ this.activeConsumptionEnergyCarriers.add(this.energyCarrierConsumed);
+ registerEnergyAsset();
+ }
+
+ @Override
+ public void f_updateAllFlows(double powerFraction_fr) {
+ if ( powerFraction_fr < 0 ) {
+ throw new RuntimeException("Impossible to operate conversion asset with negative powerfraction.");
+ }
+ else if ( powerFraction_fr == 0 ) {
+ this.lastFlowsMap.clear();
+ this.lastEnergyUse_kW = 0;
+ return;
+ }
+ else {
+ super.f_updateAllFlows( powerFraction_fr );
+ }
+ }
+
+ @Override
+ public void operate(double ratioOfCapacity) {
+ this.energyUse_kW = ratioOfCapacity * this.inputCapacity_kW * (1 - this.eta_r);
+ this.energyUsed_kWh += this.energyUse_kW * this.timestep_h;
+ this.flowsMap.put(this.energyCarrierConsumed, ratioOfCapacity * this.inputCapacity_kW);
+ this.flowsMap.addFlow(this.energyCarrierProduced, -ratioOfCapacity * this.outputCapacity_kW); // We don't put here, in case the energy carrier is the same
+ if (this.assetFlowCategory != null) {
+ this.assetFlowsMap.put(this.assetFlowCategory, ratioOfCapacity * this.outputCapacity_kW);
+ }
+ }
+
+ public void setInputCapacity_kW ( double inputCapacity_kW ) {
+ this.inputCapacity_kW = inputCapacity_kW;
+ this.outputCapacity_kW = this.inputCapacity_kW * this.eta_r;
+ }
+
+ public void setOutputCapacity_kW ( double outputCapacity_kW ) {
+ this.outputCapacity_kW = outputCapacity_kW;
+ this.inputCapacity_kW = this.outputCapacity_kW / this.eta_r;
+ }
+
+ public void setEta_r( double efficiency_r) {
+ this.eta_r = efficiency_r;
+ this.inputCapacity_kW = this.outputCapacity_kW / this.eta_r;
+ }
+
+ public double getInputCapacity_kW() {
+ return this.inputCapacity_kW;
+ }
+
+ public double getOutputCapacity_kW() {
+ return this.outputCapacity_kW;
+ }
+
+ public double getEta_r() {
+ return this.eta_r;
+ }
+
+ public OL_EnergyCarriers getEnergyCarrierProduced() {
+ return this.energyCarrierProduced;
+ }
+
+ public OL_EnergyCarriers getEnergyCarrierConsumed() {
+ return this.energyCarrierConsumed;
+ }
+
+ @Override
+ public String toString() {
+ return this.energyAssetType + " in GC: " + this.parentAgent + ", "
+ + this.energyCarrierConsumed + " -> " + this.energyCarrierProduced + ", "
+ + "OutputCapacity: " + this.outputCapacity_kW + " kW, "
+ + "with efficiency: " + this.eta_r + ", "
+ + "Current output: " + -this.getLastFlows().get(this.energyCarrierProduced) + " kW";
+ }
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+
+}
+
+
+ 1659104834899
+ J_EAConsumption
+ 1752677832758
+ /**
+ * J_EAConsumption
+ */
+public class J_EAConsumption extends zero_engine.J_EA implements Serializable {
+ protected J_ProfilePointer profilePointer;
+ public double yearlyDemand_kWh;
+ protected OL_EnergyCarriers energyCarrier;
+ private double consumptionScaling_fr = 1;
+ public double loadLoad_kWh = 0;
+ //private J_profilePointer profilePointer;
+ /**
+ * Default constructor
+ */
+ public J_EAConsumption() {
+ }
+
+ /**
+ * Constructor initializing the fields
+ */
+ public J_EAConsumption(Agent parentAgent, OL_EnergyAssetType type, String name, double yearlyDemand_kWh, OL_EnergyCarriers energyCarrier, double timestep_h, J_ProfilePointer profile) {
+ /*if (yearlyDemand_kWh == 0.0) {
+ throw new RuntimeException("Unable to construct J_EAConsumption: " + name + " because consumption is zero." );
+ }*/
+
+ this.energyAssetName = name;
+ this.energyAssetType = type;
+ this.parentAgent = parentAgent;
+ this.yearlyDemand_kWh = yearlyDemand_kWh;
+ this.energyCarrier = energyCarrier;
+
+ this.timestep_h = timestep_h;
+ if (profile == null) {
+ profilePointer = ((GridConnection)parentAgent).energyModel.f_findProfile(name);
+ } else {
+ profilePointer = profile;
+ }
+ this.activeConsumptionEnergyCarriers.add(this.energyCarrier);
+ if (this.energyAssetType == OL_EnergyAssetType.ELECTRIC_HOB) {
+ this.assetFlowCategory = OL_AssetFlowCategories.electricHobConsumption_kW; //
+ }
+ else if (this.energyCarrier == OL_EnergyCarriers.ELECTRICITY) {
+ this.assetFlowCategory = OL_AssetFlowCategories.fixedConsumptionElectric_kW; //
+ }
+ else if (this.energyAssetType == OL_EnergyAssetType.HOT_WATER_CONSUMPTION) {
+ this.assetFlowCategory = OL_AssetFlowCategories.hotWaterConsumption_kW;
+ }
+ registerEnergyAsset();
+ }
+
+ public String getAssetName() {
+ return this.energyAssetName;
+ }
+
+ public void setConsumptionScaling_fr(double consumptionScaling_fr) {
+ this.consumptionScaling_fr = consumptionScaling_fr;
+ }
+
+ public double getConsumptionScaling_fr() {
+ return this.consumptionScaling_fr;
+ }
+
+ @Override
+ public void operate(double ratioOfCapacity) {
+
+ if (this.profilePointer != null) {
+ ratioOfCapacity = this.profilePointer.getCurrentValue();
+ }
+
+ double consumption_kW = ratioOfCapacity * this.yearlyDemand_kWh * this.consumptionScaling_fr;
+
+ this.energyUse_kW = consumption_kW;
+ this.energyUsed_kWh += this.energyUse_kW * this.timestep_h;
+
+ flowsMap.put(this.energyCarrier, consumption_kW);
+ if (this.assetFlowCategory != null) {
+ assetFlowsMap.put(this.assetFlowCategory, consumption_kW);
+ }
+ }
+
+ /*public Pair<J_FlowsMap, Double> curtailElectricityConsumption(double curtailmentSetpoint_kW) {
+ if (this.energyCarrier != OL_EnergyCarriers.ELECTRICITY) {
+ throw new RuntimeException("Unable to curtail the Consumption asset with energycarrier: " + this.energyCarrier);
+ }
+
+ double currentElectricityConsumption_kW = this.lastFlowsMap.get(OL_EnergyCarriers.ELECTRICITY);
+ double curtailmentPower_kW = max(0,min(currentElectricityConsumption_kW, curtailmentSetpoint_kW));
+ energyUsed_kWh -= curtailmentPower_kW * timestep_h;
+ loadLoad_kWh += curtailmentPower_kW * timestep_h;
+
+ J_FlowsMap flowsMap = new J_FlowsMap();
+ flowsMap.put(OL_EnergyCarriers.ELECTRICITY, -curtailmentPower_kW);
+ J_ValueMap<OL_AssetFlowCategories> assetFlows_kW = new J_ValueMap(OL_AssetFlowCategories.class);
+ assetFlows_kW.put(this.assetFlowCategory, -curtailmentPower_kW);
+
+ this.energyUse_kW = -curtailmentPower_kW;
+
+ this.lastFlowsMap.put(OL_EnergyCarriers.ELECTRICITY, this.lastFlowsMap.get(OL_EnergyCarriers.ELECTRICITY) - curtailmentPower_kW);
+
+ this.lastEnergyUse_kW -= curtailmentPower_kW;
+ //traceln("Electricity production of asset %s curtailed by %s kW!", this, curtailmentPower_kW);
+ if (parentAgent instanceof GridConnection) {
+ ((GridConnection)parentAgent).f_removeFlows(flowsMap, this.energyUse_kW, assetFlows_kW, this);
+ }
+ return new Pair(flowsMap, this.energyUse_kW);
+ }*/
+
+ public J_ProfilePointer getProfilePointer() {
+ return this.profilePointer;
+ }
+
+ @Override
+ public String toString() {
+ return
+ "type = " + this.getClass().toString() + " " +
+ "parentAgent = " + this.parentAgent +" " +
+ "energyCarrier = " + this.energyCarrier + " " +
+ "yearlyDemand_kWh = " + this.yearlyDemand_kWh;
+ }
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+}
+
+
+
+ 1659108919926
+ J_EA
+ 1752677832758
+ /**
+ * J_EA
+ */
+import java.util.EnumSet;
+
+import com.fasterxml.jackson.annotation.JsonIdentityInfo;
+import com.fasterxml.jackson.annotation.ObjectIdGenerators;
+
+import com.fasterxml.jackson.annotation.JsonTypeInfo;
+import com.fasterxml.jackson.annotation.JsonSubTypes;
+
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
+
+
+@JsonAutoDetect(
+ fieldVisibility = Visibility.ANY, // ✅ only public fields are serialized
+ getterVisibility = Visibility.NONE,
+ isGetterVisibility = Visibility.NONE,
+ setterVisibility = Visibility.NONE,
+ creatorVisibility = Visibility.NONE
+)
+@JsonTypeInfo(
+ use = JsonTypeInfo.Id.CLASS,
+ include = JsonTypeInfo.As.PROPERTY,
+ property = "type"
+ )
+
+@JsonIdentityInfo(generator = ObjectIdGenerators.UUIDGenerator.class, property = "@id")
+abstract public class J_EA implements Cloneable {
+
+ protected Agent parentAgent;
+ public OL_EnergyAssetType energyAssetType;
+ public OL_AssetFlowCategories assetFlowCategory;
+ public String energyAssetName;
+ protected double v_powerFraction_fr = 0; // Better to make this one protected? Public is needed to access from other packages, for example when inheriting a GC-type in your project with its own flexmanagement functions
+ protected J_FlowsMap flowsMap = new J_FlowsMap();
+ protected J_FlowsMap lastFlowsMap = new J_FlowsMap();
+ protected J_ValueMap assetFlowsMap = new J_ValueMap(OL_AssetFlowCategories.class);
+ protected double lastEnergyUse_kW = 0.0;
+
+ protected EnumSet<OL_EnergyCarriers> activeProductionEnergyCarriers = EnumSet.noneOf(OL_EnergyCarriers.class); // To fill activeProductionEnergyCarriers in GridConnections and EnergyModel
+ protected EnumSet<OL_EnergyCarriers> activeConsumptionEnergyCarriers = EnumSet.noneOf(OL_EnergyCarriers.class); // To fill activeConsumptionEnergyCarriers in GridConnections and EnergyModel
+
+ protected double energyUsed_kWh = 0.0;
+ protected double energyUse_kW = 0.0;
+ protected double energyUsedStored_kWh = 0.0;
+ protected double timestep_h;
+
+ protected boolean isRemoved = false;
+
+ // Are these needed?
+ protected double heatProduced_kWh = 0.0;
+ protected double heatConsumed_kWh = 0.0;
+ protected double electricityProduced_kWh = 0.0;
+
+ /**
+ * Default constructor
+ */
+ public J_EA() {
+ }
+
+ /**
+ * Constructor initializing the fields
+ */
+ public J_EA(Agent parentAgent, double capacityElectric_kW, double capacityHeat_kW, double capacityGas_kW) {
+ this.parentAgent = parentAgent;
+ registerEnergyAsset();
+ }
+
+ protected void registerEnergyAsset() {
+ /*if (parentAgent instanceof GridConnection) {
+ this.selectedEnergyCarriers = ((GridConnection)parentAgent).energyModel.c_selectedEnergyCarriers;
+ }
+ else if (parentAgent instanceof GridNode) {
+ this.selectedEnergyCarriers = ((GridNode)parentAgent).energyModel.c_selectedEnergyCarriers;
+ }*/
+
+ // TODO: check if EA is using an energycarrier that is not in the selectedenergycarriers. If so, throw an error!
+ if ( parentAgent instanceof GridConnection) {
+ ((GridConnection)parentAgent).f_connectToJ_EA(this);
+ } else {
+ traceln("Energy asset %s doesn't have a valid parent agent! Will not be operated!", this);
+ }
+ }
+
+ public void reRegisterEnergyAsset() {
+ if (!this.isRemoved) {
+ throw new RuntimeException("Can not register energy asset that was not removed.");
+ }
+ else {
+ this.isRemoved = false;
+ this.registerEnergyAsset();
+ }
+ }
+
+ public void removeEnergyAsset() {
+ this.isRemoved = true;
+ if ( parentAgent instanceof GridConnection) {
+ ((GridConnection)parentAgent).f_removeTheJ_EA(this);
+ } else {
+ traceln("Energy asset %s doesn't have a valid parent agent! Energy Asset not removed!", this);
+ }
+
+ }
+
+ public void f_updateAllFlows(double powerFraction_fr) {
+
+ //double powerFractionBounded_fr = min(1,max(-1, powerFraction_fr));
+ this.v_powerFraction_fr = min(1,max(-1, powerFraction_fr));
+ this.f_updateAllFlows();
+
+ }
+
+ public void f_updateAllFlows() {
+ operate(this.v_powerFraction_fr);
+ if (parentAgent instanceof GridConnection) {
+ ((GridConnection)parentAgent).f_addFlows(flowsMap, this.energyUse_kW, assetFlowsMap, this);
+ }
+
+ this.lastFlowsMap.cloneMap(this.flowsMap);
+ this.lastEnergyUse_kW = this.energyUse_kW;
+ this.clear();
+ }
+
+ public void f_setPowerFraction_fr(double powerFraction_fr) {
+ this.v_powerFraction_fr = powerFraction_fr;
+ }
+
+ public void clear() {
+ flowsMap.clear();
+ assetFlowsMap.clear();
+ energyUse_kW = 0;
+ v_powerFraction_fr = 0;
+ }
+
+ public abstract void operate(double ratioOfCapacity);
+
+ public void storeStatesAndReset() {
+ // Each energy asset that has some states should overwrite this function!
+ energyUsedStored_kWh = energyUsed_kWh;
+ energyUsed_kWh = 0.0;
+ clear();
+ }
+
+ public void restoreStates() {
+ // Each energy asset that has some states should overwrite this function!
+ energyUsed_kWh = energyUsedStored_kWh;
+ }
+
+ public double getCurrentTemperature() {
+ throw new RuntimeException("Method getCurrentTemperature() should be overridden in child class of J_EA!");
+ //return 0;
+ }
+
+ public void updateAmbientTemperature(double currentAmbientTemperature_degC) {
+ // only for storage agents. Does it belong in this superclass?
+ throw new RuntimeException("Method updateAmbientTemperature() should be overridden in child class of J_EA!");
+ }
+
+ public double getEnergyUsed_kWh() {
+ return energyUsed_kWh;
+ }
+
+ public Agent getParentAgent() {
+ return parentAgent;
+ }
+
+ public EnumSet<OL_EnergyCarriers> getActiveProductionEnergyCarriers() {
+ return this.activeProductionEnergyCarriers;
+ }
+
+ public EnumSet<OL_EnergyCarriers> getActiveConsumptionEnergyCarriers() {
+ return this.activeConsumptionEnergyCarriers;
+ }
+
+ public EnumSet<OL_EnergyCarriers> getActiveEnergyCarriers() {
+ EnumSet<OL_EnergyCarriers> allActiveEnergyCarriers = EnumSet.copyOf(this.activeProductionEnergyCarriers);
+ allActiveEnergyCarriers.addAll(this.activeConsumptionEnergyCarriers);
+ return allActiveEnergyCarriers;
+ }
+
+ //public void setUI_EnergyAsset(UI_EnergyAsset ui_energyAsset) {
+ //this.ui_energyAsset = ui_energyAsset;
+ //}
+
+ public J_FlowsMap getLastFlows() {
+ //return lastFlowsArray;
+ //return new Pair(this.lastFlowsMap, this.lastEnergyUse_kW);
+ return this.lastFlowsMap;
+ }
+
+ public OL_EnergyAssetType getEAType() {
+ return energyAssetType;
+ }
+
+ public void setEnergyAssetName(String name) {
+ this.energyAssetName = name;
+ }
+
+ public void setEnergyAssetType(OL_EnergyAssetType assetType) {
+ this.energyAssetType = assetType;
+ }
+
+ public void setAssetFlowCategory(OL_AssetFlowCategories assetFlowCat) {
+ this.assetFlowCategory = assetFlowCat;
+ }
+
+// public double getOutputTemperature_degC() {
+// return 0;
+// }
+ /*
+ @Override
+ public Object clone() {
+ try {
+ return super.clone();
+ } catch (CloneNotSupportedException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ */
+
+ @Override
+ public String toString() {
+ return
+ "ownerAgent = " + parentAgent.getIndex() +" ";
+ }
+}
+
+
+
+ 1659117174456
+ J_EAConversionGasBurner
+ 1752677832758
+ /**
+ * J_EAConversionGasBurner
+ */
+public class J_EAConversionGasBurner extends zero_engine.J_EAConversion implements Serializable, I_HeatingAsset {
+
+ protected double outputTemperature_degC;
+
+ /**
+ * Default constructor
+ */
+ public J_EAConversionGasBurner() {
+ }
+
+ /**
+ * Constructor initializing the fields
+ */
+
+ public J_EAConversionGasBurner(Agent parentAgent, double outputHeatCapacity_kW, double efficiency_r, double timestep_h, double outputTemperature_degC) {
+ this.parentAgent = parentAgent;
+ this.outputCapacity_kW = outputHeatCapacity_kW;
+ this.eta_r = efficiency_r;
+ this.inputCapacity_kW = this.outputCapacity_kW / this.eta_r;
+ this.timestep_h = timestep_h;
+ this.outputTemperature_degC = outputTemperature_degC;
+
+ this.energyAssetType = OL_EnergyAssetType.GAS_BURNER;
+
+ this.energyCarrierProduced = OL_EnergyCarriers.HEAT;
+ this.energyCarrierConsumed = OL_EnergyCarriers.METHANE;
+
+ this.activeProductionEnergyCarriers.add(this.energyCarrierProduced);
+ this.activeConsumptionEnergyCarriers.add(this.energyCarrierConsumed);
+
+ if (outputHeatCapacity_kW == 0) {
+ throw new RuntimeException(String.format("Exception: J_EAGasBurner with capacityHeat_kW = 0, invalid state! Energy Asset: %s", this));
+ }
+
+ registerEnergyAsset();
+ }
+
+ @Override
+ public void operate(double ratioOfCapacity) {
+ ((GridConnection)this.parentAgent).fm_heatFromEnergyCarrier_kW.addFlow(this.energyCarrierConsumed, ratioOfCapacity * this.outputCapacity_kW);
+ ((GridConnection)this.parentAgent).fm_consumptionForHeating_kW.addFlow(this.energyCarrierConsumed, ratioOfCapacity * this.inputCapacity_kW);
+ super.operate(ratioOfCapacity);
+ }
+
+ @Override
+ public double getCurrentTemperature() {
+ return outputTemperature_degC;
+ }
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+}
+
+
+ 1659117174457
+ J_EAConversionBiogasMethane
+ true
+ 1752677832758
+ /**
+ * J_EAConversionBiogasMethane
+ */
+public class J_EAConversionBiogasMethane extends zero_engine.J_EAConversion implements Serializable {
+
+ //private OL_EnergyCarriers energyCarrierProduced = OL_EnergyCarriers.METHANE;
+ //private OL_EnergyCarriers energyCarrierConsumed = OL_EnergyCarriers.METHANE;
+ public double capacityMethane_kW;
+ //protected double outputTemperature_degC;
+ /**
+ * Default constructor
+ */
+ public J_EAConversionBiogasMethane() {
+ }
+
+ /**
+ * Constructor initializing the fields
+ */
+ public J_EAConversionBiogasMethane(Agent parentAgent, double capacityMethane_kW, double efficiency, double timestep_h) {
+ this.parentAgent= parentAgent;
+ this.capacityMethane_kW = capacityMethane_kW;
+ this.eta_r = efficiency;
+ this.timestep_h = timestep_h;
+ registerEnergyAsset();
+ }
+
+ @Override
+ public Pair<J_FlowsMap, Double> operate(double ratioOfCapacity) {
+ //traceln("I convert now! GasBurner @ " + (ratioOfCapacity * 100) + " %");
+ this.methaneProduction_kW = capacityMethane_kW * ratioOfCapacity;
+ this.methaneConsumption_kW = methaneProduction_kW / eta_r;
+ energyUse_kW = methaneConsumption_kW - methaneProduction_kW;
+ this.energyUsed_kWh += timestep_h * energyUse_kW; // This represents losses!
+ //double[] arr = {this.electricityProduction_kW, this.methaneProduction_kW, this.hydrogenProduction_kW, this.heatProduction_kW, this.electricityConsumption_kW, this.methaneConsumption_kW, this.hydrogenConsumption_kW, this.heatConsumption_kW };
+ //return arr;
+ return returnEnergyFlows();
+ }
+
+ public double getEnergyUsed_kWh() {
+ return energyUsed_kWh;
+ }
+
+ @Override
+ public String toString() {
+ return
+ "parentAgent = " + parentAgent +", Energy consumed = " + this.energyUsed_kWh +
+ "capacityMethane_kW = " + this.capacityMethane_kW +" "+
+ "eta_r = " + this.eta_r+" " +
+ "energyUsed_kWh (losses) = " + this.energyUsed_kWh + " ";
+ }
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+
+}
+
+
+ 1659117174458
+ J_EAProfile
+ 1752677832758
+ /**
+ * J_EAProfile
+ */
+public class J_EAProfile extends zero_engine.J_EA implements Serializable {
+
+ public OL_EnergyCarriers energyCarrier = OL_EnergyCarriers.ELECTRICITY;
+ public double[] a_energyProfile_kWh;
+ private double profileTimestep_h;
+ private double profileStarTime_h = 0;
+ public double lostLoad_kWh = 0;
+ private double profileScaling_fr = 1;
+ private boolean enableProfileLooping = true;
+
+ /**
+ * Default constructor
+ */
+ public J_EAProfile() {
+ }
+
+ /**
+ * Constructor initializing the fields
+ */
+ public J_EAProfile(Agent parentAgent, OL_EnergyCarriers energyCarrier, double[] profile_kWh, OL_AssetFlowCategories assetCategory, double profileTimestep_h) {
+ this.parentAgent= parentAgent;
+ this.energyCarrier = energyCarrier;
+ this.a_energyProfile_kWh = profile_kWh;
+ //this.profileType = profileType;
+ this.profileTimestep_h = profileTimestep_h;
+ this.assetFlowCategory = assetCategory;
+
+ if (parentAgent instanceof GridConnection) {
+ this.timestep_h = ((GridConnection)parentAgent).energyModel.p_timeStep_h;
+ } else {
+ this.timestep_h = profileTimestep_h;
+ }
+
+ //this.activeProductionEnergyCarriers.add(this.energyCarrier);
+ this.activeConsumptionEnergyCarriers.add(this.energyCarrier);
+
+ registerEnergyAsset();
+ }
+
+ public void setStartTime_h(double startTime_h) {
+ this.profileStarTime_h = startTime_h;
+ }
+
+ @Override
+ //public Pair<J_FlowsMap, Double> f_updateAllFlows(double time_h) {
+ public void f_updateAllFlows(double time_h) {
+
+ operate(time_h-this.profileStarTime_h);
+
+ if (parentAgent instanceof GridConnection) {
+ ((GridConnection)parentAgent).f_addFlows(flowsMap, this.energyUse_kW, assetFlowsMap, this);
+ }
+ this.lastFlowsMap.cloneMap(flowsMap);
+ this.lastEnergyUse_kW = this.energyUse_kW;
+ this.clear();
+ }
+
+ @Override
+
+ public void operate(double time_h) {
+ if (enableProfileLooping && time_h >= a_energyProfile_kWh.length * profileTimestep_h) {
+ time_h = time_h % a_energyProfile_kWh.length * profileTimestep_h;
+ } else if ( (int)floor(time_h/profileTimestep_h) >= a_energyProfile_kWh.length ) {
+ traceln("Time out of upper bound for evaluating J_EAProfile power in profile asset %s!", this.energyAssetName);
+// time_h = a_energyProfile_kWh.length * profileTimestep_h - 1;
+ throw new RuntimeException(String.format("Time out of upper bound for evaluating J_EAProfile power! Time is: %s", time_h));
+ }
+ if ( time_h < 0 ) {
+ traceln("Time out of lower bound for evaluating J_EAProfile power in profile asset %s!", this.energyAssetName);
+ throw new RuntimeException(String.format("Time out of lower bound for evaluating J_EAProfile power! Time is: %s", time_h));
+ }
+
+ double currentPower_kW = this.profileScaling_fr * this.a_energyProfile_kWh[(int)floor(time_h/profileTimestep_h)]/profileTimestep_h;
+ this.energyUse_kW = currentPower_kW;
+ this.energyUsed_kWh += timestep_h * energyUse_kW;
+ this.flowsMap.put(this.energyCarrier, currentPower_kW);
+ if (this.assetFlowCategory != null) {
+ this.assetFlowsMap.put(this.assetFlowCategory, currentPower_kW);
+ }
+ }
+
+ public double getEnergyUsed_kWh() {
+ return energyUsed_kWh;
+ }
+
+
+ public void curtailElectricityConsumption(double curtailmentSetpoint_kW) {
+ double currentElectricityConsumption_kW = this.lastFlowsMap.get(OL_EnergyCarriers.ELECTRICITY);
+ double curtailmentPower_kW = max(0,min(currentElectricityConsumption_kW, curtailmentSetpoint_kW));
+ energyUsed_kWh -= curtailmentPower_kW * timestep_h;
+ lostLoad_kWh += curtailmentPower_kW * timestep_h;
+ J_FlowsMap flowsMap = new J_FlowsMap();
+ flowsMap.put(OL_EnergyCarriers.ELECTRICITY, curtailmentPower_kW);
+ J_ValueMap<OL_AssetFlowCategories> assetFlows_kW = new J_ValueMap(OL_AssetFlowCategories.class);
+ assetFlows_kW.put(this.assetFlowCategory, curtailmentPower_kW);
+
+ this.energyUse_kW = -curtailmentPower_kW;
+
+ this.lastFlowsMap.put(OL_EnergyCarriers.ELECTRICITY, this.lastFlowsMap.get(OL_EnergyCarriers.ELECTRICITY) - curtailmentPower_kW);
+ this.lastEnergyUse_kW -= curtailmentPower_kW;
+
+ if (parentAgent instanceof GridConnection) {
+ ((GridConnection)parentAgent).f_removeFlows(flowsMap, this.energyUse_kW, assetFlows_kW, this);
+ }
+ }
+
+
+ public double getProfileScaling_fr() {
+ return profileScaling_fr;
+ }
+
+ public void setProfileScaling_fr( double scaling_fr ) {
+ this.profileScaling_fr = scaling_fr;
+ }
+
+ public OL_EnergyCarriers getEnergyCarrier() {
+ return this.energyCarrier;
+ }
+
+ @Override
+ public String toString() {
+ return
+ "parentAgent = " + parentAgent +", Energy consumed = " + this.energyUsed_kWh +
+ "energyUsed_kWh (losses) = " + this.energyUsed_kWh + " ";
+ }
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+}
+
+
+
+ 1659446215929
+ J_EAStorageElectric
+ 1752677832758
+ /**
+ * J_EAStorageElectric
+ */
+public class J_EAStorageElectric extends J_EAStorage implements Serializable {
+
+ private OL_EnergyCarriers storageMedium = OL_EnergyCarriers.ELECTRICITY;
+
+ private double etaCharge_r; // charging efficiency
+ private double etaDischarge_r;
+ protected double capacityElectric_kW;
+
+ /**
+ * Default constructor
+ */
+ public J_EAStorageElectric() {
+ }
+
+ /**
+ * Constructor initializing the fields
+ */
+ public J_EAStorageElectric(Agent parentAgent, double capacityElectric_kW, double storageCapacity_kWh, double stateOfCharge_fr, double timestep_h ) {
+ this.parentAgent = parentAgent;
+ this.capacityElectric_kW = capacityElectric_kW;
+ this.storageCapacity_kWh = storageCapacity_kWh;
+ this.initialstateOfCharge_fr = stateOfCharge_fr;
+ this.stateOfCharge_fr = this.initialstateOfCharge_fr;
+ this.timestep_h = timestep_h;
+ this.energyAssetType = OL_EnergyAssetType.STORAGE_ELECTRIC;
+ double eta_r=0.9; // Default cycle efficiency of 90%. Add this as an argument to constructor?
+ this.etaCharge_r = Math.sqrt(eta_r);
+ this.etaDischarge_r = Math.sqrt(eta_r);
+ this.activeProductionEnergyCarriers.add(this.storageMedium);
+ this.activeConsumptionEnergyCarriers.add(this.storageMedium);
+ this.assetFlowCategory = OL_AssetFlowCategories.batteriesChargingPower_kW;
+ registerEnergyAsset();
+ }
+
+ @Override
+ public void operate(double ratioOfChargeCapacity_r) {
+ double inputPower_kW = ratioOfChargeCapacity_r * capacityElectric_kW; // Electric power going into battery, before losses.
+ double deltaEnergy_kWh; // The change in energy stored in the battery this timestep ('internal' energy)
+
+ // charging/discharging losses
+ if (inputPower_kW > 0) { // charging (the battery 'consumes' electricity)
+ deltaEnergy_kWh = etaCharge_r * inputPower_kW * timestep_h; // Actual change of energy content of battery after losses. deltaEnergy_kWh is smaller than inputPower_kW * timestep_h!
+ } else { // discharging (the battery 'produces' electricity)
+ deltaEnergy_kWh = inputPower_kW / etaDischarge_r * timestep_h; // Actual change of energy content of battery after losses. deltaEnergy_kWh is larger than inputPower_kW * timestep_h!
+ }
+
+ // Limit SoC to feasible range (0-1)
+ deltaEnergy_kWh = - min( -deltaEnergy_kWh, (stateOfCharge_fr * storageCapacity_kWh) ); // Prevent negative charge
+ deltaEnergy_kWh = min(deltaEnergy_kWh, (1 - stateOfCharge_fr) * storageCapacity_kWh ); // Prevent overcharge
+
+ double electricityConsumption_kW = 0;
+ double electricityProduction_kW = 0;
+ if (deltaEnergy_kWh > 0) { // charging, deltaEnergy_kWh and inputPower_kW positive
+ inputPower_kW = deltaEnergy_kWh / timestep_h / etaCharge_r;
+ electricityConsumption_kW = inputPower_kW;
+ electricityProduction_kW = 0;
+ energyUse_kW = (1-etaCharge_r)*inputPower_kW;
+ } else { // discharging, deltaEnergy_kWh and inputPower_kW negative
+ inputPower_kW = deltaEnergy_kWh / timestep_h * etaDischarge_r;
+ electricityConsumption_kW = 0;
+ electricityProduction_kW = -inputPower_kW;
+ energyUse_kW = -deltaEnergy_kWh / timestep_h * (1-etaDischarge_r);
+ }
+ energyUsed_kWh += energyUse_kW * timestep_h;
+
+ discharged_kWh += electricityProduction_kW * timestep_h; // Not the change-in-SoC, but the energy flowing out of the battery after losses.
+ charged_kWh += electricityConsumption_kW * timestep_h; // Not the change-in-SoC, but the energy flowing into the battery before losses.
+
+ updateStateOfCharge( deltaEnergy_kWh );
+ //traceln("Battery SoC: %s", stateOfCharge_fr);
+ flowsMap.put(OL_EnergyCarriers.ELECTRICITY, electricityConsumption_kW-electricityProduction_kW);
+ //assetFlowsMap.put(this.assetFlowCategory, electricityConsumption_kW-electricityProduction_kW);
+
+ // Split charging and discharing power 'at the source'!
+ assetFlowsMap.put(OL_AssetFlowCategories.batteriesChargingPower_kW, electricityConsumption_kW);
+ assetFlowsMap.put(OL_AssetFlowCategories.batteriesDischargingPower_kW, electricityProduction_kW);
+ }
+
+ public void setBatteryEfficiency_r(double eta_r) {
+ if (eta_r < 0 || eta_r > 1) {
+ traceln("Infeasible eta_r! Should be larger than 0 and no larger than 1! Setting eta_r=1. Input value is: %s", eta_r);
+ this.etaCharge_r = 1;
+ this.etaDischarge_r = 1;
+ } else {
+ this.etaCharge_r = Math.sqrt(eta_r);
+ this.etaDischarge_r = Math.sqrt(eta_r);
+ }
+ }
+
+ @Override
+ public String toString() {
+ return
+ "type = " + this.getClass().toString() + " " +
+ "parentAgent = " + parentAgent +" " +
+ "stateOfCharge_fr = " + this.stateOfCharge_fr+" "+
+ "storageCapacity_kWh = " + this.storageCapacity_kWh +" "+
+ "capacityElectric_kW = " + this.capacityElectric_kW +" "+
+ "discharged_kWh " + this.discharged_kWh+" "+
+ "charged_kWh " + this.charged_kWh+" ";
+ }
+
+ @Override
+ protected void updateStateOfCharge( double deltaEnergy_kWh ) {
+ stateOfCharge_fr += deltaEnergy_kWh / storageCapacity_kWh;
+ }
+
+ public double getCapacityAvailable_kW() {
+ double availableCapacity_kW;
+ if ( stateOfCharge_fr * storageCapacity_kWh > capacityElectric_kW * timestep_h) {
+ availableCapacity_kW = capacityElectric_kW;
+ }
+ else {
+ availableCapacity_kW = stateOfCharge_fr * storageCapacity_kWh / timestep_h; // Allow to drain completely
+ }
+ return availableCapacity_kW;
+ }
+
+ public double getMaxChargePower_kW() { // Always a positive number!
+ return min(capacityElectric_kW, (1-stateOfCharge_fr) * storageCapacity_kWh / timestep_h / etaCharge_r);
+ }
+
+ public double getMaxDischargePower_kW() { // Always a positive number!
+ return min(capacityElectric_kW, stateOfCharge_fr * storageCapacity_kWh / timestep_h * etaDischarge_r);
+ }
+
+ public double getCapacityElectric_kW() {
+ return this.capacityElectric_kW;
+ }
+
+ public double getTotalChargeAmount_kWh() {
+ return this.charged_kWh;
+ }
+ public double getTotalDischargeAmount_kWh() {
+ return this.discharged_kWh;
+ }
+
+ public double getChargingEfficiency_r() {
+ return this.etaCharge_r;
+ }
+
+ public double getDischargingEfficiency_r() {
+ return this.etaDischarge_r;
+ }
+
+ public void setStorageCapacity_kWh(double storageCapacity_kWh) {
+ double difference_kWh = storageCapacity_kWh - this.storageCapacity_kWh;
+ this.storageCapacity_kWh = storageCapacity_kWh;
+ if (this.parentAgent instanceof GridConnection) {
+ ((GridConnection)this.parentAgent).v_liveAssetsMetaData.totalInstalledBatteryStorageCapacity_MWh += difference_kWh/1000;
+ ((GridConnection) this.parentAgent).c_parentCoops.forEach( coop -> coop.v_liveAssetsMetaData.totalInstalledBatteryStorageCapacity_MWh += difference_kWh/1000);
+ ((GridConnection)this.parentAgent).energyModel.v_liveAssetsMetaData.totalInstalledBatteryStorageCapacity_MWh += difference_kWh/1000;
+ }
+ // TODO: Fix for new FLOWSMAP
+ //if (storageCapacity_kWh == 0) {
+ //Arrays.fill(lastFlowsArray,0);
+ //}
+ }
+
+ public void setCapacityElectric_kW(double capacityElectric_kW) {
+ this.capacityElectric_kW = capacityElectric_kW;
+ }
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+
+}
+
+
+ 1659446215929
+ J_EAStorageGas
+ 1752677832758
+ /**
+ * J_EAStorageGas
+ */
+public class J_EAStorageGas extends zero_engine.J_EAStorage implements Serializable {
+
+ private OL_EnergyCarriers energyCarrier = OL_EnergyCarriers.METHANE;
+ private double lossFactor_r = 0;
+ protected double capacityGas_kW;
+
+ /**
+ * Default constructor
+ */
+ public J_EAStorageGas() {
+ }
+
+ /**
+ * Constructor initializing the fields
+ */
+ public J_EAStorageGas(Agent parentAgent, double capacityGas_kW, double storageCapacity_kWh, double stateOfCharge_fr, double timestep_h ) {
+ this.parentAgent = parentAgent;
+ this.capacityGas_kW = capacityGas_kW;
+ this.storageCapacity_kWh = storageCapacity_kWh;
+ this.stateOfCharge_fr = stateOfCharge_fr;
+ this.timestep_h = timestep_h;
+ this.activeProductionEnergyCarriers.add(this.energyCarrier);
+ this.activeConsumptionEnergyCarriers.add(this.energyCarrier);
+ registerEnergyAsset();
+ }
+
+ @Override
+ public void calculateLoss() {
+ //no loss for gas storage modeled.
+ energyUse_kW = 0;
+ energyUsed_kWh += energyUse_kW * timestep_h;
+ }
+
+ @Override
+ public void operate(double ratioOfChargeCapacity_r) {
+ double deltaEnergy_kWh; // to check the request with the energy currently in storage
+ double inputPower_kW = ratioOfChargeCapacity_r * capacityGas_kW; // Gas power going into Storage, negative if going out.
+
+ deltaEnergy_kWh = inputPower_kW * timestep_h;
+ deltaEnergy_kWh = - min( -deltaEnergy_kWh, (stateOfCharge_fr * storageCapacity_kWh) ); // Prevent negative charge
+ deltaEnergy_kWh = min(deltaEnergy_kWh, (1 - stateOfCharge_fr) * storageCapacity_kWh ); // Prevent overcharge
+
+ inputPower_kW = deltaEnergy_kWh / timestep_h;
+
+ double methaneProduction_kW = max(-inputPower_kW, 0);
+ double methaneConsumption_kW = max(inputPower_kW, 0);
+ discharged_kWh += methaneProduction_kW * timestep_h;
+ charged_kWh += methaneConsumption_kW * timestep_h;
+
+ updateStateOfCharge( deltaEnergy_kWh );
+ flowsMap.put(OL_EnergyCarriers.METHANE, methaneConsumption_kW-methaneProduction_kW);
+ }
+
+ @Override
+ public String toString() {
+ return
+ "type = " + this.getClass().toString() + " " +
+ "parentAgent = " + parentAgent +" " +
+ "stateOfCharge_fr = " + this.stateOfCharge_fr+" "+
+ "storageCapacity_kWh = " + this.storageCapacity_kWh +" "+
+ "capacityGas_kW = " + this.capacityGas_kW +" "+
+ "discharged_kWh " + this.discharged_kWh+" "+
+ "charged_kWh " + this.charged_kWh+" ";
+ }
+
+ @Override
+ protected void updateStateOfCharge( double deltaEnergy_kWh ) {
+ stateOfCharge_fr += deltaEnergy_kWh / storageCapacity_kWh;
+ }
+
+ public double getCapacityAvailable_kW() {
+ double availableCapacity_kW;
+ if ( stateOfCharge_fr * storageCapacity_kWh > capacityGas_kW * timestep_h) {
+ availableCapacity_kW = capacityGas_kW;
+ }
+ else {
+ availableCapacity_kW = stateOfCharge_fr * storageCapacity_kWh / timestep_h; // Allow to drain completely
+ }
+ return availableCapacity_kW;
+ }
+
+ public double getCapacityGas_kW() {
+ return capacityGas_kW;
+ }
+
+ public double getTotalChargeAmount_kWh() {
+ return charged_kWh;
+ }
+ public double getTotalDischargeAmount_kWh() {
+ return discharged_kWh;
+ }
+
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+}
+
+
+
+
+ 1659447107390
+ J_EAStorageHeat
+ 1752677832758
+ /**
+ * J_EAStorageHeat
+ */
+public class J_EAStorageHeat extends zero_engine.J_EAStorage implements Serializable {
+
+ private double capacityElectric_kW = 0;
+ public OL_EnergyCarriers storageMedium = OL_EnergyCarriers.HEAT;
+ private double storageCapacity_kWh;
+
+ private double stateOfCharge_fr;
+ protected double lossFactor_WpK;
+ protected double capacityHeat_kW;
+
+ protected double temperature_degC;
+ protected double temperatureStored_degC;
+ protected double initialTemperature_degC;
+ protected double minTemperature_degC;
+ protected double maxTemperature_degC;
+ private double setTemperature_degC;
+ protected double heatCapacity_JpK;
+ protected double ambientTemperature_degC;
+ public boolean requiresHeat = false;
+ protected double energyAbsorbed_kWh=0;
+ protected double energyAbsorbedStored_kWh=0;
+ protected OL_AmbientTempType ambientTempType;
+ //Secureing updates
+ private boolean updateAmbientTemperatureHasBeenCalled = false;
+
+
+ /**
+ * Default constructor
+ */
+ public J_EAStorageHeat() {
+ }
+
+ /**
+ * Constructor initializing the fields
+ */
+ public J_EAStorageHeat(Agent parentAgent, OL_EnergyAssetType energyAssetType, double capacityHeat_kW, double lossFactor_WpK, double timestep_h, double initialTemperature_degC, double minTemperature_degC, double maxTemperature_degC, double setTemperature_degC, double heatCapacity_JpK, OL_AmbientTempType ambientTempType ) {
+ this.parentAgent = parentAgent;
+ this.energyAssetType = energyAssetType;
+ this.capacityHeat_kW = capacityHeat_kW;
+ this.lossFactor_WpK = lossFactor_WpK;
+ this.timestep_h = timestep_h;
+ this.temperature_degC = initialTemperature_degC;
+ this.initialTemperature_degC = initialTemperature_degC;
+ this.minTemperature_degC = minTemperature_degC;
+ this.maxTemperature_degC = maxTemperature_degC;
+ this.setTemperature_degC = setTemperature_degC;
+
+ if(this.initialTemperature_degC > this.maxTemperature_degC || this.initialTemperature_degC < this.minTemperature_degC) {
+ new RuntimeException("Heatbuffer initial temperature is not within the defined min/max temperature limits of the buffer");
+ }
+ if(this.setTemperature_degC > this.maxTemperature_degC || this.setTemperature_degC < this.minTemperature_degC) {
+ new RuntimeException("Heatbuffer set temperature is not within the defined min/max temperature limits of the buffer");
+ }
+
+ this.heatCapacity_JpK = heatCapacity_JpK;
+ this.ambientTempType = ambientTempType;
+ this.storageCapacity_kWh = ( maxTemperature_degC - minTemperature_degC ) * heatCapacity_JpK / 3.6e+6;
+ this.stateOfCharge_fr = (( initialTemperature_degC - minTemperature_degC ) / (maxTemperature_degC - minTemperature_degC ) );
+ this.activeProductionEnergyCarriers.add(OL_EnergyCarriers.HEAT);
+ this.activeConsumptionEnergyCarriers.add(OL_EnergyCarriers.HEAT);
+ registerEnergyAsset();
+ }
+
+ @Override
+ public void calculateLoss() {
+ if(ambientTempType != OL_AmbientTempType.FIXED && !this.updateAmbientTemperatureHasBeenCalled) {
+ new RuntimeException("Ambient temperature has not been updated for the heat storage asset, make sure to call the updateAmbientTemperature() method while using a heat storage");
+ }
+ else {
+ updateAmbientTemperatureHasBeenCalled = false;
+ }
+ double heatLoss_W = lossFactor_WpK * ( temperature_degC - ambientTemperature_degC );
+ double deltaEnergy_kWh = ( -heatLoss_W / 1000 ) * timestep_h;
+ energyUse_kW = heatLoss_W / 1000;
+ energyUsed_kWh += max(0,energyUse_kW * timestep_h); // Only heat loss! Not heat gain when outside is hotter than inside!
+ energyAbsorbed_kWh += max(0,-energyUse_kW * timestep_h); // Only heat gain when outside is hotter than inside!
+ //traceln("Ambient temperature " + ambientTemperature_degC);
+ //traceln("heatCapacity JpK " + heatCapacity_JpK );
+ //traceln("tempdelta loss"+tempDelta);
+ //traceln("lossfacter: " + lossFactor_WpK);
+
+ updateStateOfCharge( deltaEnergy_kWh );
+ }
+
+ @Override
+ public void operate(double ratioOfChargeCapacity_r) {
+ //traceln("StorageAsset Heat Operatefunctie: ambienttemperature = "+ambientTemperature_degC);
+ //traceln("StorageAsset Heat Operatefunctie: ambienttemperature = "+ambientTemperature_degC+" | powerFraction_fr = " + ratioOfChargeCapacity_r + ".");
+ //traceln("<><><><> heatstorage reset heatproduction = "+heatProduction_kW+", heatconsumption_kW = "+heatConsumption_kW+" heatProduced_kWh = "+heatProduced_kWh + "heatConsumed = "+heatConsumed_kWh + ", losses= "+energyUsed_kWh );
+
+ calculateLoss(); // Heat lost to the environment; this call also updates energyUse_kW and the 'state of charge' (temperature).
+
+ double inputPower_kW = ratioOfChargeCapacity_r * capacityHeat_kW; // positive power means adding heat to the buffer
+ double potentialTempDelta_degC = inputPower_kW * timestep_h / (heatCapacity_JpK / (3.6E6) ); // Calculate potential deltaT for check if capping of input is needed
+
+ //Cap input to the temperature limits of the buffer
+ if(inputPower_kW > 0 && temperature_degC + potentialTempDelta_degC > maxTemperature_degC) { // If it will go over max temp: cap the input power
+ inputPower_kW = (maxTemperature_degC - temperature_degC) * (heatCapacity_JpK / (3.6E6) )/timestep_h;
+ }
+ else if(inputPower_kW < 0 && temperature_degC + potentialTempDelta_degC < minTemperature_degC) {//If it will go under min temp: cap the (negative) input power
+ inputPower_kW = (minTemperature_degC - temperature_degC) * (heatCapacity_JpK / (3.6E6) )/timestep_h;
+ }
+
+ double deltaEnergy_kWh = inputPower_kW * timestep_h; // to check the request with the energy currently in storage
+
+ double heatProduction_kW = max(-inputPower_kW, 0);
+ double heatConsumption_kW = max(inputPower_kW, 0);
+ heatProduced_kWh += heatProduction_kW * timestep_h;
+ heatConsumed_kWh += heatConsumption_kW * timestep_h;
+
+ //traceln("tempdelta charge: "+deltaTemp_degC);
+ //traceln(">> Heat storage heatproduction = "+ heatProduced_kWh + ", heatconsumption_kW = "+ heatConsumption_kW +" heatConsumed_kWh = "+ heatConsumed_kWh +", heatProduced_kWh = "+ heatProduced_kWh );
+
+ updateStateOfCharge( deltaEnergy_kWh );
+ //traceln("<><><><> heatstorage <"+ownerAsset.getId()+"> calculated heatproduction = "+heatProduction_kW+", heatconsumption_kW = "+heatConsumption_kW+", heatProduced_kWh = "+heatProduced_kWh + ", heatConsumed = "+heatConsumed_kWh + ", losses= "+energyUsed_kWh );
+
+ flowsMap.put(OL_EnergyCarriers.HEAT, heatConsumption_kW-heatProduction_kW);
+
+ //return new Pair(this.flowsMap, this.energyUse_kW);
+ }
+
+ @Override
+ public void storeStatesAndReset() {
+ // Each energy asset that has some states should overwrite this function!
+ energyUsedStored_kWh = energyUsed_kWh;
+ energyAbsorbedStored_kWh = energyAbsorbed_kWh;
+ energyUsed_kWh = 0.0;
+ energyAbsorbed_kWh = 0.0;
+ temperatureStored_degC = temperature_degC;
+ temperature_degC = initialTemperature_degC;
+ clear();
+ }
+
+ @Override
+ public void restoreStates() {
+ // Each energy asset that has some states should overwrite this function!
+ energyUsed_kWh = energyUsedStored_kWh;
+ energyAbsorbed_kWh = energyAbsorbedStored_kWh;
+ temperature_degC = temperatureStored_degC;
+ }
+
+ @Override
+ public String toString() {
+ return
+ "type = " + this.getClass().toString() + " " +
+ "Energy consumed = " + this.energyUsed_kWh +
+ " temp = " + this.temperature_degC + " " +
+ "parentAgent = " + parentAgent +" " +
+ "capacityElectric_kW = " + this.capacityElectric_kW +" "+
+ "capacityHeat_kW = " + this.capacityHeat_kW +" "+
+ "stateOfCharge_fr = " + this.stateOfCharge_fr+" "+
+ "minTemperature_degC = " + this.minTemperature_degC+" "+
+ "maxTemperature_degC = " + this.maxTemperature_degC+" "+
+ "setTemperature_degC = " + this.setTemperature_degC+" "+
+ "ambientTemperature_degC = "+this.ambientTemperature_degC+" "+
+ "energyUsed_kWh (losses) = " + this.energyUsed_kWh + " "+
+ "heatProduced_kWh = "+ this.heatProduced_kWh + " "+
+ "heatConsumed_kWh = "+ this.heatConsumed_kWh + " ";
+ }
+
+ @Override
+ protected void updateStateOfCharge( double deltaEnergy_kWh ) {
+ double tempDelta_degC = deltaEnergy_kWh / (heatCapacity_JpK / 3.6E6 );
+ temperature_degC += tempDelta_degC;
+ stateOfCharge_fr = ( temperature_degC - minTemperature_degC) / (maxTemperature_degC - minTemperature_degC);
+ if (temperature_degC < setTemperature_degC) {
+ requiresHeat = true;
+ }
+ else if ( temperature_degC >= maxTemperature_degC ) {
+ requiresHeat = false;
+ }
+ }
+
+ public double getInitialTemperature_degC() {
+ return this.initialTemperature_degC;
+ }
+
+ @Override
+ public double getCurrentTemperature() {
+ return temperature_degC;
+ }
+
+ public double getSetTemperature_degC() {
+ return setTemperature_degC;
+ }
+
+ public double getMinTemperature_degC() {
+ return minTemperature_degC;
+ }
+
+ public double getMaxTemperature_degC() {
+ return maxTemperature_degC;
+ }
+
+ public double getStorageCapacity_kWh() {
+ return storageCapacity_kWh;
+ }
+
+ public double getCapacityHeat_kW() {
+ return this.capacityHeat_kW;
+ }
+
+ public double getHeatCapacity_JpK() {
+ return heatCapacity_JpK;
+ }
+
+ public double getLossFactor_WpK() {
+ return lossFactor_WpK;
+ }
+
+ public OL_AmbientTempType getAmbientTempType() {
+ return this.ambientTempType;
+ }
+
+ public double getStartingHeatStorageHeat_kWh() {
+ return (this.initialTemperature_degC - this.minTemperature_degC) * heatCapacity_JpK /3.6e6;
+ }
+
+ public double getRemainingHeatStorageHeat_kWh() {
+ return (this.temperature_degC - this.minTemperature_degC) * heatCapacity_JpK /3.6e6;
+ }
+ /*
+ @Override
+ public double getHeatCapacity_kW() {
+ return capacityHeat_kW;
+ }
+ */
+
+ /*@Override //Storage assets limiteren de opname van warmte niet met 1. Dat is nodig voor de buffer. Die kan wel maximaal zijn capaciteit leverern, maar kan meer opnemen. @Gillis is dat logisch of willen we andere oplossing?
+ public double[] operateBounded(double ratioOfCapacity) {
+ double limitedRatioOfCapacity = max(-1, ratioOfCapacity);
+ double[] arr = operate(limitedRatioOfCapacity);
+ return arr;
+ }*/
+
+ @Override
+ public void updateAmbientTemperature(double currentAmbientTemperature_degC) {
+ this.updateAmbientTemperatureHasBeenCalled = true;
+ ambientTemperature_degC = currentAmbientTemperature_degC;
+ }
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+}
+
+
+
+
+ 1659447107391
+ J_EABuilding
+ 1752677832758
+ /**
+ * J_EABuilding
+ */
+//import com.fasterxml.jackson.annotation.JsonTypeName;
+//@JsonTypeName("J_EABuilding")
+public class J_EABuilding extends zero_engine.J_EAStorageHeat implements Serializable {
+
+ private double solarAbsorptionFactor_m2;
+ private double solarRadiation_Wpm2 = 0;
+
+ //Slider scaling factor
+ private double lossScalingFactor_fr = 1;
+
+ // Optional Interior/Exterior Heat buffers
+ private double interiorDelayTime_h;
+ private double[] interiorReleaseSchedule_kWh;
+ private double[] interiorReleaseScheduleStored_kWh;
+ private int interiorReleaseScheduleIndex;
+ private double exteriorDelayTime_h;
+ private double[] exteriorReleaseSchedule_kWh;
+ private double[] exteriorReleaseScheduleStored_kWh;
+ private int exteriorReleaseScheduleIndex;
+
+ /**
+ * Default constructor
+ */
+ public J_EABuilding() {
+ }
+
+ /**
+ * Constructor initializing the fields
+ */
+ public J_EABuilding(Agent parentAgent, double capacityHeat_kW, double lossFactor_WpK, double timestep_h, double initialTemperature_degC, double heatCapacity_JpK, double solarAbsorptionFactor_m2 ) {
+ this.parentAgent = parentAgent;
+ //this.heatStorageType = OL_EAStorageTypes.HEATMODEL_BUILDING;
+ this.capacityHeat_kW = capacityHeat_kW;
+ this.lossFactor_WpK = lossFactor_WpK;
+ this.timestep_h = timestep_h;
+ this.initialTemperature_degC = initialTemperature_degC;
+ this.temperature_degC = initialTemperature_degC;
+ this.heatCapacity_JpK = heatCapacity_JpK;
+ this.ambientTempType = OL_AmbientTempType.AMBIENT_AIR;
+ //this.storageCapacity_kWh = ( maxTemperature_degC - minTemperature_degC ) * heatCapacity_JpK / 3.6e+6;
+ this.solarAbsorptionFactor_m2 = solarAbsorptionFactor_m2;
+ this.energyAssetType = OL_EnergyAssetType.BUILDINGTHERMALS;
+ if (lossFactor_WpK < 0) {
+ throw new RuntimeException(String.format("Exception: J_EABuilding with negative lossfactor! %s", lossFactor_WpK));
+ }
+
+ this.activeProductionEnergyCarriers.add(OL_EnergyCarriers.HEAT);
+ this.activeConsumptionEnergyCarriers.add(OL_EnergyCarriers.HEAT);
+ registerEnergyAsset();
+ }
+
+ @Override
+ public void calculateLoss() {
+ double heatLoss_kW = (this.lossFactor_WpK * ( this.temperature_degC - this.ambientTemperature_degC ) / 1000) * lossScalingFactor_fr;
+ //traceln("ambientTemperature_degC in J_EABuilding: %s", this.ambientTemperature_degC);
+ //traceln("heatLoss_kW: %s", heatLoss_kW);
+ double deltaEnergy_kWh = -heatLoss_kW * this.timestep_h;
+ this.energyUse_kW += heatLoss_kW;
+ //traceln("Ambient temperature " + ambientTemperature_degC);
+ //traceln("heatCapacity JpK " + heatCapacity_JpK );
+ //traceln("tempdelta loss in thermal building asset (kW) " + energyUse_kW);
+ //traceln("lossfacter: " + lossFactor_WpK);
+
+ //traceln("deltaEnergy_kWh calculateLoss: %s", deltaEnergy_kWh);
+ //traceln("temperature_degC %s", this.temperature_degC);
+ updateStateOfCharge( deltaEnergy_kWh );
+ //traceln("temperature_degC %s", this.temperature_degC);
+
+ }
+
+ public void solarHeating() {
+ //traceln("solarAbsorptionFactor_m2: %s", solarAbsorptionFactor_m2);
+ //traceln("solarRadiation_Wpm2: %s", solarRadiation_Wpm2);
+
+ double solarHeating_kW = this.solarAbsorptionFactor_m2 * this.solarRadiation_Wpm2 / 1000;
+ //traceln("solarHeating_kW: %s", solarHeating_kW);
+ this.energyUse_kW -= solarHeating_kW;
+ //traceln("solarHeating_kW: %s", solarHeating_kW);
+ //traceln("exteriorReleaseScheduleIndex: %s", exteriorReleaseScheduleIndex);
+ //traceln("exteriorReleaseSchedule_kWh: %s", Arrays.toString(exteriorReleaseSchedule_kWh));
+ double deltaEnergy_kWh;
+ if( this.exteriorDelayTime_h != 0.0) {
+ deltaEnergy_kWh = getExteriorHeatRelease( solarHeating_kW * this.timestep_h );
+ }
+ else {
+ deltaEnergy_kWh = solarHeating_kW * this.timestep_h; // Is always positive
+ }
+ //traceln("deltaEnergy_kWh: %s", deltaEnergy_kWh);
+ //traceln("exteriorReleaseSchedule_kWh: %s", Arrays.toString(exteriorReleaseSchedule_kWh));
+
+ //traceln("deltaEnergy_kWh solar heating: %s", deltaEnergy_kWh);
+ //traceln("temperature_degC %s", this.temperature_degC);
+ updateStateOfCharge( deltaEnergy_kWh );
+ //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) {
+ //traceln("Building heatCapacity_JpK: %s", this.heatCapacity_JpK);
+ //traceln("StorageAsset Heat Operatefunctie: ambienttemperature = "+ambientTemperature_degC);
+ //traceln("StorageAsset Heat Operatefunctie: ambienttemperature = "+ambientTemperature_degC+" | powerFraction_fr = " + ratioOfChargeCapacity_r + ".");
+ //traceln("<><><><> heatstorage reset heatproduction = "+heatProduction_kW+", heatconsumption_kW = "+heatConsumption_kW+" heatProduced_kWh = "+heatProduced_kWh + "heatConsumed = "+heatConsumed_kWh + ", losses= "+energyUsed_kWh );
+ 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
+
+ this.energyUsed_kWh += max(0, this.energyUse_kW * this.timestep_h); // Only heat loss! Not heat gain when outside is hotter than inside!
+ this.energyAbsorbed_kWh += max(0, -this.energyUse_kW * this.timestep_h); // Only heat gain when outside is hotter than inside!
+
+ double inputPower_kW = ratioOfChargeCapacity_r * this.capacityHeat_kW; // positive power means lowering the buffer temperature!
+ //traceln("inputPower_kW: %s", inputPower_kW);
+
+ double deltaEnergy_kWh;
+ if (this.interiorDelayTime_h != 0.0) {
+ deltaEnergy_kWh = getInteriorHeatRelease( inputPower_kW * this.timestep_h );
+ }
+ else {
+ deltaEnergy_kWh = inputPower_kW * this.timestep_h; // to check the request with the energy currently in storage
+ }
+
+ //traceln("deltaEnergy_kWh operate: %s", deltaEnergy_kWh);
+
+
+ double heatConsumption_kW = inputPower_kW;
+ this.heatConsumed_kWh += heatConsumption_kW * this.timestep_h;
+ //traceln("Heat consumption delivered by heating asset kW " + heatConsumption_kW);
+ //traceln("Heatcapacity kWh: " + (heatCapacity_JpK / 3.6E6 ));
+ //traceln("tempdelta charge: " + deltaTemp_degC);
+ //traceln(">> Heat storage heatproduction = "+ heatProduced_kWh + ", heatconsumption_kW = "+ heatConsumption_kW +" heatConsumed_kWh = "+ heatConsumed_kWh +", heatProduced_kWh = "+ heatProduced_kWh );
+
+ //traceln("temperature_degC %s", this.temperature_degC);
+ updateStateOfCharge( deltaEnergy_kWh );
+ //traceln("temperature_degC %s", this.temperature_degC);
+
+ //traceln("<><><><> heatstorage <"+ownerAsset.getId()+"> calculated heatproduction = "+heatProduction_kW+", heatconsumption_kW = "+heatConsumption_kW+", heatProduced_kWh = "+heatProduced_kWh + ", heatConsumed = "+heatConsumed_kWh + ", losses= "+energyUsed_kWh );
+
+ this.flowsMap.put(OL_EnergyCarriers.HEAT, inputPower_kW);
+ /*if (Double.isNaN(this.energyUse_kW)) {
+ throw new RuntimeException("Building thermal model energyUse_kW is NaN!");
+ }*/
+
+ }
+
+
+ @Override
+ public String toString() {
+ return
+ this.getClass().toString() + " " +
+ "Energy consumed = " + this.energyUsed_kWh + "kWh, " +
+ "temp = " + this.temperature_degC + ", " +
+ "parentAgent = " + parentAgent + ", " +
+ "capacityHeat_kW = " + this.capacityHeat_kW + ", "+
+ "ambientTemperature_degC = "+this.ambientTemperature_degC + ", " +
+ "energyUsed_kWh (losses) = " + this.energyUsed_kWh + "kWh, " +
+ "heatConsumed_kWh = "+ this.heatConsumed_kWh + "kWh";
+ }
+
+ @Override
+ protected void updateStateOfCharge( double deltaEnergy_kWh ) {
+ double tempDelta_degC = deltaEnergy_kWh / (this.heatCapacity_JpK / 3.6E6 );
+ //traceln("heatCapacity_JpK: %s", heatCapacity_JpK);
+ this.temperature_degC += tempDelta_degC;
+ //this.stateOfCharge_fr = ( this.temperature_degC - this.minTemperature_degC) / (this.maxTemperature_degC - this.minTemperature_degC);
+ //traceln("SOC: " + stateOfCharge_fr);
+
+ /*if (temperature_degC < setTemperature_degC) {
+ requiresHeat = true;
+ }
+ else if ( temperature_degC >= maxTemperature_degC ) {
+ requiresHeat = false;
+ }*/
+ }
+
+ @Override
+ public double getCurrentTemperature() {
+ return this.temperature_degC;
+ }
+
+ @Override
+ public double getLossFactor_WpK() {
+ return this.lossFactor_WpK;
+ }
+
+ public void setLossFactor_WpK( double lossFactor_WpK) {
+ this.lossFactor_WpK = lossFactor_WpK;
+ }
+
+ public void setLossScalingFactor_fr( double lossScalingFactor_fr) {
+ this.lossScalingFactor_fr = lossScalingFactor_fr;
+ }
+
+ public double getLossScalingFactor_fr() {
+ return this.lossScalingFactor_fr;
+ }
+
+ @Override
+ public void storeStatesAndReset() {
+ // Each energy asset that has some states should overwrite this function!
+ this.energyUsedStored_kWh = this.energyUsed_kWh;
+ this.energyAbsorbedStored_kWh = this.energyAbsorbed_kWh;
+ this.energyUsed_kWh = 0.0;
+ this.energyAbsorbed_kWh = 0.0;
+ this.temperatureStored_degC = this.temperature_degC;
+ this.temperature_degC = this.initialTemperature_degC;
+ if (this.interiorReleaseSchedule_kWh != null) {
+ this.interiorReleaseScheduleStored_kWh = this.interiorReleaseSchedule_kWh;
+ Arrays.fill(this.interiorReleaseSchedule_kWh, 0.0);
+ }
+ if (this.exteriorReleaseSchedule_kWh != null) {
+ this.exteriorReleaseScheduleStored_kWh = this.exteriorReleaseSchedule_kWh;
+ Arrays.fill(this.exteriorReleaseSchedule_kWh, 0.0);
+ }
+ clear();
+ }
+
+ @Override
+ public void restoreStates() {
+ // Each energy asset that has some states should overwrite this function!
+ this.energyUsed_kWh = this.energyUsedStored_kWh;
+ this.energyAbsorbed_kWh = this.energyAbsorbedStored_kWh;
+ this.temperature_degC = this.temperatureStored_degC;
+ this.interiorReleaseSchedule_kWh = this.interiorReleaseScheduleStored_kWh;
+ this.exteriorReleaseSchedule_kWh = this.exteriorReleaseScheduleStored_kWh;
+ }
+
+ /*@Override
+ public double getMinTemperature_degC() {
+ return minTemperature_degC;
+ }*/
+
+ /*@Override
+ public double getMaxTemperature_degC() {
+ return maxTemperature_degC;
+ }*/
+
+ /*public double getStorageCapacity() {
+ return storageCapacity_kWh;
+ }*/
+
+ /*public double getHeatCapacity_JpK() {
+ return heatCapacity_JpK;
+ }*/
+
+ /*
+ @Override
+ public double getHeatCapacity_kW() {
+ return capacityHeat_kW;
+ }
+ */
+
+ /*@Override //Storage assets limiteren de opname van warmte niet met 1. Dat is nodig voor de buffer. Die kan wel maximaal zijn capaciteit leverern, maar kan meer opnemen. @Gillis is dat logisch of willen we andere oplossing?
+ public double[] operateBounded(double ratioOfCapacity) {
+ double limitedRatioOfCapacity = max(-1, ratioOfCapacity);
+ double[] arr = operate(limitedRatioOfCapacity);
+ return arr;
+ }*/
+
+ @Override
+ public void updateAmbientTemperature(double currentAmbientTemperature_degC) { // TODO: Hoe zorgen we dat we deze niet vergeten aan te roepen??
+ this.ambientTemperature_degC = currentAmbientTemperature_degC;
+ }
+
+ public void updateSolarRadiation(double solarRadiation_Wpm2) { // TODO: Hoe zorgen we dat we deze niet vergeten aan te roepen??
+ this.solarRadiation_Wpm2 = solarRadiation_Wpm2;
+ //traceln("Updating solarRadiation of building to %s Wpm2!", solarRadiation_Wpm2);
+ }
+
+
+ // Methods for Optional Heat Buffer
+ // Interior heat buffer may represent the radiator or floor heating. Typical delay is 0.5 or 3 hours respectively.
+ public void addInteriorHeatBuffer(double delayTime_h) {
+ this.interiorDelayTime_h = delayTime_h;
+ this.interiorReleaseSchedule_kWh = new double[ (int)(delayTime_h / this.timestep_h) ];
+ this.interiorReleaseScheduleIndex = 0;
+ }
+
+ // Exterior heat buffer may represent the walls and roof of the building. Typical delay is 8 hours.
+ public void addExteriorHeatBuffer(double delayTime_h) {
+ this.exteriorDelayTime_h = delayTime_h;
+ this.exteriorReleaseSchedule_kWh = new double[ (int)(delayTime_h / this.timestep_h) ];
+ this.exteriorReleaseScheduleIndex = 0;
+ }
+
+ private double getInteriorHeatRelease(double heatAbsorbed_kWh) {
+ // Distribute the added energy evenly over the release schedule
+ //traceln("Interior schedule before: " + Arrays.toString(this.interiorReleaseSchedule_kWh));
+ for (int x = 0; x < this.interiorReleaseSchedule_kWh.length; x++) {
+ this.interiorReleaseSchedule_kWh[x] += heatAbsorbed_kWh / this.interiorReleaseSchedule_kWh.length;
+ }
+ // Store the current value
+ double heatReleased_kWh = this.interiorReleaseSchedule_kWh[this.interiorReleaseScheduleIndex];
+ // Reset the current value
+ this.interiorReleaseSchedule_kWh[this.interiorReleaseScheduleIndex] = 0;
+ // Shift over the index
+ this.interiorReleaseScheduleIndex++;
+ this.interiorReleaseScheduleIndex = this.interiorReleaseScheduleIndex % this.interiorReleaseSchedule_kWh.length;
+ //traceln("Interior schedule after: " + Arrays.toString(this.interiorReleaseSchedule_kWh));
+
+ return heatReleased_kWh;
+ }
+
+ private double getExteriorHeatRelease(double heatAbsorbed_kWh) {
+ // Distribute the added energy evenly over the release schedule
+ for (int x = 0; x < this.exteriorReleaseSchedule_kWh.length; x++) {
+ this.exteriorReleaseSchedule_kWh[x] += heatAbsorbed_kWh / this.exteriorReleaseSchedule_kWh.length;
+ }
+ // Store the current value
+ double heatReleased_kWh = this.exteriorReleaseSchedule_kWh[this.exteriorReleaseScheduleIndex];
+ // Reset the current value
+ this.exteriorReleaseSchedule_kWh[this.exteriorReleaseScheduleIndex] = 0;
+ // Shift over the index
+ this.exteriorReleaseScheduleIndex++;
+ this.exteriorReleaseScheduleIndex = this.exteriorReleaseScheduleIndex % this.exteriorReleaseSchedule_kWh.length;
+
+ return heatReleased_kWh;
+ }
+
+ @Override
+ public double getRemainingHeatStorageHeat_kWh() {
+ double remainingHeatStorageHeat_kWh = super.getRemainingHeatStorageHeat_kWh();
+ remainingHeatStorageHeat_kWh += getRemainingHeatBufferHeat_kWh();
+ return remainingHeatStorageHeat_kWh;
+ }
+
+ public double getRemainingHeatBufferHeat_kWh() {
+ double remainingHeatBufferHeat_kWh = 0;
+ if( this.interiorDelayTime_h != 0.0) {
+ for (int x = 0; x < this.interiorReleaseSchedule_kWh.length; x++) {
+ remainingHeatBufferHeat_kWh += this.interiorReleaseSchedule_kWh[x];
+ }
+ }
+ if( this.exteriorDelayTime_h != 0.0) {
+ for (int x = 0; x < this.exteriorReleaseSchedule_kWh.length; x++) {
+ remainingHeatBufferHeat_kWh += this.exteriorReleaseSchedule_kWh[x];
+ }
+ }
+ return remainingHeatBufferHeat_kWh;
+ }
+
+ public boolean hasHeatBuffer() {
+ if (this.exteriorDelayTime_h != 0 || this.interiorDelayTime_h != 0) {
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+}
+
+
+
+
+ 1659513814164
+ J_EAConversionHeatPump
+ 1752677832758
+ /**
+ * J_EAConversionHeatPump
+ */
+public class J_EAConversionHeatPump extends zero_engine.J_EAConversion implements Serializable, I_HeatingAsset {
+ private double COP_r;
+ private double belowZeroHeatpumpEtaReductionFactor;
+ protected double outputTemperature_degC;
+ private double baseTemperature_degC;
+ private double sourceAssetHeatPower_kW; // for water-water heatpump functionality
+ protected OL_AmbientTempType ambientTempType;
+ public double totalElectricityConsumed_kWh =0;
+ public J_EA p_linkedSourceEnergyAsset;
+ public double p_baseTemperatureReference;
+
+ /**
+ * Default constructor
+ */
+ public J_EAConversionHeatPump() {
+ }
+
+ //Agent parentAgent, double outputCapacity_kW, double efficiency_r, double timestep_h, double outputTemperature_degC) {
+
+ /**
+ * Constructor initializing the fields
+ */
+ public J_EAConversionHeatPump(Agent parentAgent, double inputElectricCapacity_kW, double eta_r, double timestep_h, double outputTemperature_degC, double baseTemperature_degC, double sourceAssetHeatPower_kW, double belowZeroHeatpumpEtaReductionFactor, OL_AmbientTempType ambientTempType ) {
+ this.parentAgent = parentAgent;
+ this.inputCapacity_kW = inputElectricCapacity_kW;
+ this.timestep_h = timestep_h;
+ this.eta_r = eta_r;
+ this.outputTemperature_degC = outputTemperature_degC;
+
+ this.ambientTempType = ambientTempType;
+ this.updateAmbientTemperature( this.baseTemperature_degC );
+
+ //this.COP_r = eta_r * ( 273.15 + outputTemperature_degC ) / ( outputTemperature_degC - baseTemperature_degC );
+ // traceln("Carnot-based Heatpump COP with parameter eta_r is no longer used! Replaced by empirical COP-curve.");
+ this.COP_r = calculateCOP(this.outputTemperature_degC, this.baseTemperature_degC);
+
+ this.sourceAssetHeatPower_kW = sourceAssetHeatPower_kW;
+ this.belowZeroHeatpumpEtaReductionFactor = belowZeroHeatpumpEtaReductionFactor;
+
+ this.energyCarrierProduced = OL_EnergyCarriers.HEAT;
+ this.energyCarrierConsumed= OL_EnergyCarriers.ELECTRICITY;
+
+ this.activeProductionEnergyCarriers.add(this.energyCarrierProduced);
+ this.activeConsumptionEnergyCarriers.add(this.energyCarrierConsumed);
+ this.assetFlowCategory = OL_AssetFlowCategories.heatPumpElectricityConsumption_kW;
+ registerEnergyAsset();
+ }
+
+ public void updateParameters(double baseTemperature_degC, double outputTemperature_degC) {
+ this.baseTemperature_degC = baseTemperature_degC;
+ this.outputTemperature_degC = outputTemperature_degC;
+ if ( this.baseTemperature_degC > this.outputTemperature_degC) {
+ traceln("**** EXCEPTION **** Heatpump baseTemperature ( " + this.baseTemperature_degC + ") > outputTemperature ( " + this.outputTemperature_degC + ") ");
+ }
+ //this.COP_r = this.eta_r * ( 273.15 + this.outputTemperature_degC ) / ( this.outputTemperature_degC - this.baseTemperature_degC );
+ this.COP_r = calculateCOP(this.outputTemperature_degC, this.baseTemperature_degC); //8.74 - 0.190 * deltaT + 0.00126 * deltaT * deltaT;
+
+ // water heatpump should take sourceAsset power transfer limitations into account (e.g. residual heat). Ugly but effectively limiting heat power output.
+
+ if( this.sourceAssetHeatPower_kW > 0) {
+ this.outputCapacity_kW = min( this.outputCapacity_kW, this.sourceAssetHeatPower_kW / (1 - (1 / COP_r )));
+ //traceln("Water water heatpump heat capacity limited from source! =" + this.capacityHeat_kW);
+ }
+ else {
+ this.outputCapacity_kW = this.inputCapacity_kW * this.COP_r;
+ //traceln("heatpump updating temp: " + baseTemperature_degC);
+ if( baseTemperature_degC < 0 ) {
+ this.COP_r = this.COP_r / this.belowZeroHeatpumpEtaReductionFactor;
+ }
+ }
+ //traceln("J_EAConversionHeatpump capacityHeat_kW = "+ this.capacityHeat_kW + ", sourceAssetHeatPower_kW " + this.sourceAssetHeatPower_kW );
+
+ }
+
+ public void updateAmbientTemperature(double baseTemperature_degC) {
+ // water heatpump should take sourceAsset power transfer limitations into account (e.g. residual heat). Ugly but effectively limiting heat power output.
+
+ //traceln("J_EAHeatpump capacityHeat_kW = " + this.capacityHeat_kW + ", baseTemperature = "+ baseTemperature_degC + ", outputtemperature = "+ outputTemperature_degC);
+ updateParameters(baseTemperature_degC, this.outputTemperature_degC);
+ this.COP_r = calculateCOP(this.outputTemperature_degC, this.baseTemperature_degC); //this.eta_r * ( 273.15 + this.outputTemperature_degC ) / ( this.outputTemperature_degC - this.baseTemperature_degC );
+ this.outputCapacity_kW = this.inputCapacity_kW * this.COP_r;
+ }
+
+ public void setCOP(double COP_r) {
+ this.COP_r = COP_r;
+ this.outputCapacity_kW = this.inputCapacity_kW * this.COP_r;
+ }
+
+ public double getCOP() {
+ //traceln("Heatpump output temperature: " + this.outputTemperature_degC);
+ return this.COP_r;
+ }
+
+ @Override
+ public void operate(double ratioOfCapacity) {
+
+ double electricityConsumption_kW = ratioOfCapacity * this.inputCapacity_kW;
+ this.totalElectricityConsumed_kWh += electricityConsumption_kW * timestep_h;
+ double heatProduction_kW = electricityConsumption_kW * this.COP_r;
+
+ /*
+ double heatConsumption_kW = 0;
+ if(this.ambientTempType.equals("WATER")) {
+ //traceln("test water heatpump EA code for heat consumption. WATER ambient temp type detected ");
+ double maxAvailableSourcePower_kW = this.sourceAssetHeatPower_kW;
+
+ heatConsumption_kW = heatProduction_kW - electricityConsumption_kW;
+ //update effective energy production of source asset!
+ this.p_linkedSourceEnergyAsset.v_powerFraction_fr += ( heatConsumption_kW / ((J_EAProduction)this.p_linkedSourceEnergyAsset).getCapacityHeat_kW() );
+// this.ownerAsset.p_linkedSourceEnergyAsset.j_ea.heatProduction_kW += this.heatConsumption_kW;
+ }
+ */
+ if (this.ambientTempType == OL_AmbientTempType.HEAT_GRID ) {
+ this.energyUse_kW = 0;
+ flowsMap.put(OL_EnergyCarriers.HEAT, -electricityConsumption_kW);
+ flowsMap.put(OL_EnergyCarriers.ELECTRICITY, electricityConsumption_kW);
+ }
+ else {
+ this.energyUse_kW = electricityConsumption_kW - heatProduction_kW;
+ flowsMap.put(OL_EnergyCarriers.HEAT, -heatProduction_kW);
+ flowsMap.put(OL_EnergyCarriers.ELECTRICITY, electricityConsumption_kW);
+ }
+ this.assetFlowsMap.addFlow (OL_AssetFlowCategories.heatPumpElectricityConsumption_kW, electricityConsumption_kW);
+ this.energyUsed_kWh += energyUse_kW * timestep_h;
+ }
+
+ public void setSourceAssetHeatPower(double sourceAssetHeatPower_kW) {
+ this.sourceAssetHeatPower_kW = 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;
+ }
+
+ private double calculateCOP(double outputTemperature_degC, double baseTemperature_degC) {
+ double deltaT = max(1,this.outputTemperature_degC - this.baseTemperature_degC); // Limit deltaT to at least 1 degree.
+ double COP_r = 8.74 - 0.190 * deltaT + 0.00126 * deltaT*deltaT;
+ return COP_r;
+ }
+ /*
+ @Override
+ public String toString() {
+ return
+ "type = " + this.getClass().toString() + " " +
+ "parentAgent = " + parentAgent +" " +
+ "capacityElectricity_kW = " + capacityElectric_kW +" "+
+ "capacityHeat_kW = " + capacityHeat_kW +" "+
+ "baseTemperature_degC = " + baseTemperature_degC + " "+
+ "ambientTempType = " + ambientTempType + " "+
+ "sourceAssetHeatPower_kW = " + sourceAssetHeatPower_kW + " " +
+ "outputTemperature_degC = " + outputTemperature_degC +" "+
+ "energyUsed_kWh = " + energyUsed_kWh + " "+
+ "heatProduced_kWh = " + heatProduced_kWh + " "+
+ "heatConsumed_kWh = " + heatConsumed_kWh + " ";
+ }
+ */
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+}
+
+
+
+ 1659534704067
+ J_EAEV
+ 1752677832758
+ /**
+* J_EAEV
+*/
+import com.fasterxml.jackson.annotation.JsonTypeName;
+
+//@JsonTypeName("J_EAEV")
+public class J_EAEV extends J_EAVehicle implements Serializable {
+
+
+ public OL_EnergyCarriers storageMedium = OL_EnergyCarriers.ELECTRICITY;
+ private double stateOfCharge_fr;
+ private double initialstateOfCharge_fr;
+ private double stateOfChargeStored_r;
+ protected double capacityElectric_kW;
+ private double storageCapacity_kWh;
+
+ private boolean V2GCapable = true; // For now default true: Add to constructor, where constructor calls: setV2GCapable(boolean isV2GCapable) to adjust min rato of capacity accordingly
+ private boolean V2GActive = false;
+ private double minimumRatioOfChargeCapacity_r = -1; // If Negative, it also allowes discharging (V2G)
+
+ // Should this be in here?
+ public double energyNeedForNextTrip_kWh;
+ //public OL_EVChargingNeed chargingNeed;
+ private double energyChargedOutsideModelArea_kWh = 0;
+ private double energyChargedOutsideModelAreaStored_kWh;
+ public double charged_kWh = 0;
+ public double discharged_kWh = 0;
+ /**
+ * Default constructor
+ */
+ public J_EAEV() {
+ }
+
+ /**
+ * Constructor initializing the fields
+ */
+ public J_EAEV(Agent parentAgent, double capacityElectricity_kW, double storageCapacity_kWh, double stateOfCharge_fr, double timestep_h, double energyConsumption_kWhpkm, double vehicleScaling, OL_EnergyAssetType energyAssetType, J_ActivityTrackerTrips tripTracker) {
+ this.parentAgent = parentAgent;
+ this.capacityElectric_kW = capacityElectricity_kW; // for EV, this is max charging power.
+ this.storageCapacity_kWh = storageCapacity_kWh;
+ this.initialstateOfCharge_fr = stateOfCharge_fr;
+ this.stateOfCharge_fr = initialstateOfCharge_fr;
+ this.timestep_h = timestep_h;
+ this.energyConsumption_kWhpkm = energyConsumption_kWhpkm;
+ this.vehicleScaling = vehicleScaling;
+ this.energyAssetType = energyAssetType; //OL_EnergyAssetType.ELECTRIC_VEHICLE; // AANPASSING ATE: VRAGEN AAN GILLIS: asset type meegeven in functie J_EAV, want scheelt switch statement in iEA functie.
+ this.tripTracker = tripTracker;
+ if (tripTracker != null) {
+ tripTracker.Vehicle=this;
+ }
+ // Validation checks
+ if (capacityElectric_kW <= 0 || storageCapacity_kWh <= 0 || timestep_h == 0 || energyConsumption_kWhpkm <= 0) {
+ throw new RuntimeException(String.format("Exception: J_EAEV in invalid state! Energy Asset: %s, capacityElectric_kW: %s, storageCapacity_kWh: %s, timestep_h: %s, energyConsumption_kWhpkm %s", this, capacityElectric_kW, storageCapacity_kWh, timestep_h, energyConsumption_kWhpkm));
+
+ }
+ this.activeProductionEnergyCarriers.add(this.storageMedium);
+ this.activeConsumptionEnergyCarriers.add(this.storageMedium);
+
+ if(V2GCapable && this.V2GActive) {
+ this.assetFlowCategory = OL_AssetFlowCategories.V2GPower_kW;
+ } else {
+ this.assetFlowCategory = OL_AssetFlowCategories.evChargingPower_kW;
+ }
+
+ registerEnergyAsset();
+ }
+
+ @Override
+ public void operate(double ratioOfChargeCapacity_r) {
+ double chargeSetpoint_kW = min(1,max(this.minimumRatioOfChargeCapacity_r ,ratioOfChargeCapacity_r)) * (capacityElectric_kW * vehicleScaling); // capped between -1 and 1. (does this already happen in f_updateAllFlows()?
+ double chargePower_kW = max(min(chargeSetpoint_kW, (1 - stateOfCharge_fr) * storageCapacity_kWh * vehicleScaling / timestep_h), -stateOfCharge_fr * storageCapacity_kWh * vehicleScaling / timestep_h); // Limit charge power to stay within SoC 0-100
+
+ //traceln("state of charge: " + stateOfCharge_fr * storageCapacity_kWh + ", charged: " + discharge_kW / 4+ " kWh, charging power kW: " + discharge_kW);
+ double electricityProduction_kW = max(-chargePower_kW, 0);
+ double electricityConsumption_kW = max(chargePower_kW, 0);
+ updateStateOfCharge( chargePower_kW );
+
+ updateChargingHistory( electricityProduction_kW, electricityConsumption_kW );
+
+ flowsMap.put(OL_EnergyCarriers.ELECTRICITY, electricityConsumption_kW - electricityProduction_kW);
+ // Split charging and discharing power 'at the source'!
+ if (chargePower_kW > 0) { // charging
+ assetFlowsMap.put(OL_AssetFlowCategories.evChargingPower_kW, electricityConsumption_kW);
+ } else if(chargePower_kW < 0){
+ if(this.V2GCapable && this.V2GActive) {
+ assetFlowsMap.put(OL_AssetFlowCategories.V2GPower_kW, electricityProduction_kW);
+ }
+ else {
+ throw new RuntimeException("Trying to discharge an EV, that does not have the capability or where v2g is not activated!");
+ }
+ }
+ }
+
+ public void updateStateOfCharge( double power_kW ) {
+ if(vehicleScaling > 0){
+ stateOfCharge_fr += ( power_kW * timestep_h ) / (storageCapacity_kWh * vehicleScaling);
+ }
+ else {
+ stateOfCharge_fr = 0;
+ }
+ }
+
+ @Override
+ public boolean startTrip() {
+ if (available) {
+ this.available = false;
+ //Update (charging) flows to zero, becausde vehicle is away.
+ this.f_updateAllFlows(0.0);
+ return true;
+ } else {
+ traceln("Trip not started because EV not available!");
+ return false; // Trip not started because EV not available!
+ }
+ }
+
+ @Override
+ public boolean endTrip(double tripDist_km) {
+
+ if(available) {
+ traceln("Trip not ended because EV never left!");
+ return false;
+ }else if (this.vehicleScaling == 0) {
+ this.available = true;
+ return true;
+ } else {
+ mileage_km += tripDist_km;
+ //traceln( "J_EAEV comes back, trip distance: " + tripDist_km + ", energy consumption: " + tripDist_km * energyConsumption_kWhpkm);
+ //traceln("EV of type: " + this.energyAssetType + "state of charge: " + stateOfCharge_fr);
+ stateOfCharge_fr -= (tripDist_km * vehicleScaling * energyConsumption_kWhpkm) / (storageCapacity_kWh * vehicleScaling);
+ //traceln("storage capacity: " + storageCapacity_kWh + ", state of charge: " + stateOfCharge_fr);
+ energyUsed_kWh += tripDist_km * vehicleScaling * energyConsumption_kWhpkm;
+ energyUse_kW += tripDist_km * vehicleScaling * energyConsumption_kWhpkm / timestep_h;
+ //traceln("EV energy use at end of trip: %s kWh", tripDist_km * vehicleScaling * energyConsumption_kWhpkm );
+ if (stateOfCharge_fr < 0) {
+ //traceln( ownerAsset.date());
+ //traceln( "Trip distance: " + tripDist_km + ", vehicle scaling: " + vehicleScaling + ", energy cons_kWhpkm: " + energyConsumption_kWhpkm );
+ traceln("EV of type: " + this.energyAssetType + " from GC " + this.parentAgent + " arrived home with negative SOC: " + roundToDecimal(100 * stateOfCharge_fr,2) + "%");
+
+ //energyChargedOutsideModelArea_kWh += -stateOfCharge_fr * storageCapacity_kWh;
+ //traceln("energyChargedOutsideModelArea_kWh: " + energyChargedOutsideModelArea_kWh);
+ //stateOfCharge_fr = 0;
+ }
+ this.available = true;
+ return true;
+ }
+ }
+
+ public double getChargeDeadline_h() {
+ double chargeNeedForNextTrip_kWh = max(0, this.getEnergyNeedForNextTrip_kWh() - this.getCurrentStateOfCharge_kWh());
+ double chargeTimeMargin_h = 0.5; // Margin to be ready with charging before start of next trip
+ double nextTripStartTime_h = getNextTripStartTime_h();
+ double chargeDeadline_h = nextTripStartTime_h - chargeNeedForNextTrip_kWh / this.capacityElectric_kW - chargeTimeMargin_h;
+ //double chargeDeadline_h = floor((this.tripTracker.v_nextEventStartTime_min / 60 - chargeNeedForNextTrip_kWh / this.getCapacityElectric_kW() / timestep_h) * timestep_h;
+ return chargeDeadline_h;
+ }
+
+ public double getNextTripStartTime_h() {
+ return this.tripTracker.v_nextEventStartTime_min / 60;
+ }
+
+ public void updateChargingHistory(double electricityProduced_kW, double electricityConsumed_kW) {
+ discharged_kWh += electricityProduced_kW * timestep_h;
+ charged_kWh += electricityConsumed_kW * timestep_h;
+ }
+
+ public double getEnergyUsed_kWh() {
+ return this.energyUsed_kWh;
+ }
+
+ public double getCurrentStateOfCharge_fr() {
+ return this.stateOfCharge_fr;
+ }
+
+ public double getStorageCapacity_kWh() {
+ return this.storageCapacity_kWh * this.vehicleScaling;
+ }
+
+ public double getCurrentStateOfCharge_kWh() {
+ return this.stateOfCharge_fr * this.getStorageCapacity_kWh();
+ }
+
+ public double getCapacityElectric_kW() {
+ return this.capacityElectric_kW * this.vehicleScaling;
+ }
+ public double getTotalChargeAmount_kWh() {
+ return this.charged_kWh;
+ }
+ public double getTotalDischargeAmount_kWh() {
+ return this.discharged_kWh;
+ }
+
+ public double getEnergyNeedForNextTrip_kWh() {
+ return this.energyNeedForNextTrip_kWh * this.vehicleScaling;
+ }
+
+ public boolean getAvailability() {
+ return this.available;
+ }
+
+ public double getChargingTimeToFull_MIN() {
+ double chargingTime_min = ceil( 60 * ((storageCapacity_kWh * vehicleScaling) - (storageCapacity_kWh * vehicleScaling) * stateOfCharge_fr) / (capacityElectric_kW * vehicleScaling) ) ;
+ return chargingTime_min;
+ }
+
+ public double getEnergyChargedOutsideModelArea_kWh() {
+ return energyChargedOutsideModelArea_kWh;
+ }
+
+ public void setV2GCapable(boolean isV2GCapable) {
+ this.V2GCapable = isV2GCapable;
+
+ setV2GActive(getV2GActive());
+
+ if(isV2GCapable) {
+ minimumRatioOfChargeCapacity_r = -1;
+ }
+ else {
+ minimumRatioOfChargeCapacity_r = 0;
+ }
+ }
+
+ public boolean getV2GCapable() {
+ return this.V2GCapable;
+ }
+
+ public boolean getV2GActive() {
+ return this.V2GActive;
+ }
+
+ protected void setV2GActive(boolean activateV2G) { // Should only be called by the chargingManagement class or J_EAEV during initialization itself. (No such thing as friend class in java, so only can put on protected).
+ this.V2GActive = activateV2G;
+ if(this.V2GCapable && activateV2G) {
+ this.assetFlowCategory = OL_AssetFlowCategories.V2GPower_kW;
+ }
+ else {
+ this.assetFlowCategory = OL_AssetFlowCategories.evChargingPower_kW;
+ }
+ }
+
+ @Override
+ public void storeStatesAndReset() {
+ // Each energy asset that has some states should overwrite this function!
+
+ energyUsedStored_kWh = energyUsed_kWh;
+ energyUsed_kWh = 0.0;
+ stateOfChargeStored_r = stateOfCharge_fr;
+ stateOfCharge_fr = initialstateOfCharge_fr;
+ availableStored = available;
+ available = true;
+ energyChargedOutsideModelAreaStored_kWh = energyChargedOutsideModelArea_kWh;
+ energyChargedOutsideModelArea_kWh = 0;
+ mileage_km = 0;
+ charged_kWh = 0;
+ discharged_kWh = 0;
+ //traceln("J_EAEV battery content at start of simulation: %s kWh", this.getCurrentStateOfCharge_kWh() );
+ clear();
+ }
+
+ @Override
+ public void restoreStates() {
+ // Each energy asset that has some states should overwrite this function!
+ energyUsed_kWh = energyUsedStored_kWh;
+ stateOfCharge_fr = stateOfChargeStored_r;
+ available = availableStored;
+ energyChargedOutsideModelArea_kWh = energyChargedOutsideModelAreaStored_kWh;
+ charged_kWh = 0;
+ discharged_kWh = 0;
+ }
+
+ @Override
+ public String toString() {
+ return
+ "SOC = " + roundToDecimal( stateOfCharge_fr, 2 ) + " " +
+ "storageCapacity_kWh = " + storageCapacity_kWh + " " +
+ "charged_kWh = " + roundToDecimal( charged_kWh, 2 ) + " " +
+ "mileage = " + roundToDecimal( mileage_km, 2 ) + " ";
+ }
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+}
+
+
+
+
+ 1660131551684
+ J_EAConversionHeatDeliverySet
+ 1752677832758
+ /**
+ * J_EAConversionHeatDeliverySet
+ */
+public class J_EAConversionHeatDeliverySet extends zero_engine.J_EAConversion implements Serializable, I_HeatingAsset {
+
+ protected double outputTemperature_degC;
+ /**
+ * Default constructor
+ */
+ public J_EAConversionHeatDeliverySet() {
+ }
+
+ /**
+ * Constructor initializing the fields
+ */
+
+ public J_EAConversionHeatDeliverySet(Agent parentAgent, double outputHeatCapacity_kW, double efficiency_r, double timestep_h, double outputTemperature_degC) {
+
+ this.parentAgent = parentAgent;
+ this.outputCapacity_kW = outputHeatCapacity_kW;
+ this.eta_r = efficiency_r;
+ this.inputCapacity_kW = this.outputCapacity_kW / this.eta_r;
+ this.timestep_h = timestep_h;
+ this.outputTemperature_degC = outputTemperature_degC;
+
+ this.energyAssetType = OL_EnergyAssetType.HEAT_DELIVERY_SET;
+ this.assetFlowCategory = OL_AssetFlowCategories.districtHeatDelivery_kW;
+
+ this.energyCarrierProduced = OL_EnergyCarriers.HEAT;
+ this.energyCarrierConsumed = OL_EnergyCarriers.HEAT;
+
+ this.activeProductionEnergyCarriers.add(this.energyCarrierProduced);
+ this.activeConsumptionEnergyCarriers.add(this.energyCarrierConsumed);
+
+ if (outputHeatCapacity_kW == 0) {
+ throw new RuntimeException(String.format("Exception: J_EAConversionHeatDeliverySet with capacityHeat_kW = 0, invalid state! Energy Asset: %s", this));
+ }
+
+ registerEnergyAsset();
+ }
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+}
+
+
+
+
+ 1661266990567
+ J_ExperimentSettingsData
+ true
+ 1752737189062
+ /**
+ * J_ExperimentSettingsData
+ */
+public class J_ExperimentSettingsData implements Serializable {
+
+ public String timeStep_h = "";
+ public String timeStepsElapsed = "";
+ public String modelHoursElapsed_h = "";
+ public String modelStartUpDuration_s = "";
+ public String modelRunDuration_s = "";
+ public String nGridNodes = "";
+ public String nGridConnections = "";
+ public String nEnergyAssets = "";
+ public String nConnectionOwners = "";
+ public String nEnergySuppliers = "";
+ public String nEnergyCoops = "";
+ public String nGridOperators = "";
+ public String nNationalEnergyMarket = "";
+ public double shareElectricvehiclesInHouseholds = 0.0;
+
+ /**
+ * Default constructor
+ */
+ public J_ExperimentSettingsData() {
+ }
+
+ /**
+ * Constructor initializing the fields
+ */
+ public J_ExperimentSettingsData(String timeStep_h) {
+ this.timeStep_h = timeStep_h;
+ }
+
+ @Override
+ public String toString() {
+ return
+ "timeStep_h = " + timeStep_h +" " +
+ "timeStepsElapsed = " + timeStepsElapsed +" " +
+ "modelHoursElapsed_h = " + modelHoursElapsed_h + " " +
+ "modelStartUpDuration_s = " + modelStartUpDuration_s + " " +
+ "modelRunDuration_s = " + modelRunDuration_s + " " +
+ "nGridNodes = " + nGridNodes + " " +
+ "nGridConnections = " + nGridConnections + " " +
+ "nEnergyAssets = " + nEnergyAssets + " " +
+ "nConnectionOwners = " + nConnectionOwners + " " +
+ "nEnergySuppliers = "+ nEnergySuppliers + " " +
+ "nEnergyCoops = " + nEnergyCoops + " " +
+ "nGridOperators = " + nGridOperators + " " +
+ "nNationalEnergyMarket = " + nNationalEnergyMarket +
+ "shareElectricvehiclesInHouseholds = " + shareElectricvehiclesInHouseholds
+ ;
+ }
+
+ public void updateData(String timeStep_h, String timeStepsElapsed, String modelHoursElapsed_h, String modelStartUpDuration_s, String modelRunDuration_s, String nGridNodes, String nGridConnections, String nEnergyAssets, String nConnectionOwners, String nEnergySuppliers, String nEnergyCoops, String nGridOperators, String nNationalEnergyMarket, double shareElectricvehiclesInHouseholds) {
+ this.timeStep_h = timeStep_h;
+ this.timeStepsElapsed = timeStepsElapsed;
+ this.modelHoursElapsed_h = modelHoursElapsed_h;
+ this.modelStartUpDuration_s = modelStartUpDuration_s;
+ this.modelRunDuration_s = modelRunDuration_s;
+ this.nGridNodes = nGridNodes;
+ this.nGridConnections = nGridConnections;
+ this.nEnergyAssets = nEnergyAssets;
+ this.nConnectionOwners = nConnectionOwners;
+ this.nEnergySuppliers = nEnergySuppliers;
+ this.nEnergyCoops = nEnergyCoops;
+ this.nGridOperators = nGridOperators;
+ this.nNationalEnergyMarket = nNationalEnergyMarket;
+ this.shareElectricvehiclesInHouseholds = shareElectricvehiclesInHouseholds;
+ }
+
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+
+}
+
+
+ 1661349111073
+ DataOut
+ true
+ 1752737189062
+ /**
+ * DataOut
+ */
+public class DataOut implements Serializable {
+
+ public ArrayList actorData = new ArrayList();
+ public ArrayList runSettingsData = new ArrayList(1);
+ public ArrayList simulationResults = new ArrayList(2);
+ public ArrayList hourlyCurvesData = new ArrayList();
+ public ArrayList contractData = new ArrayList();
+ //public DataSet dataSet = new DataSet(8760); // Test to make dataobject with simulation results per agent, universal for different agenttypes, such as model-wide, gridconnection (building), gridconnection (neighbourhood)
+
+ public void clearData() {
+ actorData.clear();
+ runSettingsData.clear();
+ simulationResults.clear();
+ hourlyCurvesData.clear();
+ contractData.clear();
+ }
+}
+
+
+ 1663238817163
+ J_ActorData
+ 1752680962144
+ /**
+ * J_ActorData
+ */
+public class J_ActorData implements Serializable {
+
+ public String actorID;
+ public String group;
+ public String gridOperator;
+ public String parentCoop;
+ public String energySupplier;
+ public String ownedGridConnection;
+ public String energySupplierDistrictHeat;
+ public String electricityVolume_kWh;
+ public String heatVolume_kWh;
+ public String methaneVolume_kWh;
+ public String hydrogenVolume_kWh;
+ public String dieselVolume_kWh;
+ //public String electricityContractType;
+ //public String heatContractType;
+ //public String methaneContractType;
+ //public String hydrogenContractType;
+ public String balanceElectricity_eur;
+ public String balanceElectricityDelivery_eur;
+ public String balanceElectricityTransport_eur;
+ public String balanceElectricityTax_eur;
+ public String deliveryContractScope;
+ public String transportContractScope;
+ public String taxContractScope;
+ public boolean b_methaneUsedWithoutContracts;
+ public boolean b_hydrogenUsedWithoutContracts;
+ /**
+ * Default constructor
+ */
+ public J_ActorData() {
+ }
+
+ /**
+ * Constructor initializing the fields
+ */
+ public J_ActorData(String actorID, String group) {
+ this.actorID = actorID;
+ this.group = group;
+ this.gridOperator = "";
+ this.parentCoop = "";
+ this.energySupplier = "";
+ this.ownedGridConnection = "";
+ this.energySupplierDistrictHeat = "";
+ this.electricityVolume_kWh = "";
+ this.heatVolume_kWh = "";
+ this.methaneVolume_kWh = "";
+ this.hydrogenVolume_kWh = "";
+ this.dieselVolume_kWh = "";
+ //this.electricityContractType = "";
+ //this.heatContractType = "";
+ //this.methaneContractType = "";
+ //this.hydrogenContractType = "";
+ this.balanceElectricity_eur = "";
+ this.balanceElectricityDelivery_eur = "";
+ this.balanceElectricityTransport_eur = "";
+ this.balanceElectricityTax_eur = "";
+ this.deliveryContractScope = "";
+ this.transportContractScope = "";
+ this.taxContractScope = "";
+ this.b_methaneUsedWithoutContracts = false;
+ this.b_hydrogenUsedWithoutContracts = false;
+
+ }
+
+ @Override
+ public String toString() {
+ return
+ "actorID = " + actorID +" " +
+ "group = " + group +" " +
+ "gridOperator = " + gridOperator +" " +
+ "parentCoop = " + parentCoop +" " +
+ "energySupplier = " + energySupplier +" " +
+ "ownedGridConnection = " + ownedGridConnection +" " +
+ "energySupplierDistrictHeat = " + energySupplierDistrictHeat +" " +
+ "electricityVolume_kWh = " + electricityVolume_kWh +" " +
+ "heatVolume_kWh = " + heatVolume_kWh +" " +
+ "methaneVolume_kWh = " + methaneVolume_kWh +" " +
+ "hydrogenVolume_kWh = " + hydrogenVolume_kWh +" " +
+ "dieselVolume_kWh = " + dieselVolume_kWh + " " +
+ //"electricityContractType = " + electricityContractType +" " +
+ //"heatContractType = " + heatContractType +" " +
+ //"methaneContractType = " + methaneContractType +" " +
+ //"hydrogenContractType = " + hydrogenContractType +" " +
+ "balanceElectricity_eur = " + balanceElectricity_eur +" " +
+ "balanceElectricityDelivery_eur = " + balanceElectricityDelivery_eur +" " +
+ "balanceElectricityTransport_eur = " + balanceElectricityTransport_eur +" " +
+ "balanceElectricityTax_eur = " + balanceElectricityTax_eur +" " +
+ "deliveryContractScope = " + deliveryContractScope +" "+
+ "transportContractScope = " + transportContractScope +" "+
+ "taxContractScope = " + taxContractScope + " ";
+ }
+
+ public void updateData(String actorID, String group, String gridOperator, String parentCoop, String energySupplier, String ownedGridConnection, String energySupplierDistrictHeat,double electricityVolume_kWh, double heatVolume_kWh, double methaneVolume_kWh, double hydrogenVolume_kWh, double dieselVolume_kWh, /*String electricityContractType, String heatContractType, String methaneContractType, String hydrogenContractType,*/ double balanceElectricity_eur, double balanceElectricityDelivery_eur, double balanceElectricityTransport_eur, double balanceElectricityTax_eur, String deliveryContractScope, String transportContractScope, String taxContractScope, boolean b_methaneUsedWithoutContracts, boolean b_hydrogenUsedWithoutContracts) {
+ this.actorID = actorID;
+ this.group = group;
+ this.gridOperator = gridOperator;
+ this.parentCoop = parentCoop;
+ this.energySupplier = energySupplier;
+ this.ownedGridConnection = ownedGridConnection;
+ this.energySupplierDistrictHeat = energySupplierDistrictHeat +"";
+ this.electricityVolume_kWh = electricityVolume_kWh + "";
+ this.heatVolume_kWh = heatVolume_kWh + "";
+ this.methaneVolume_kWh = methaneVolume_kWh + "";
+ this.hydrogenVolume_kWh = hydrogenVolume_kWh + "";
+ this.dieselVolume_kWh = dieselVolume_kWh + "";
+ //this.electricityContractType = electricityContractType + "";
+ //this.heatContractType = heatContractType + "";
+ //this.methaneContractType = methaneContractType + "";
+ //this.hydrogenContractType = hydrogenContractType + "";
+ this.balanceElectricity_eur = balanceElectricity_eur + "";
+ this.balanceElectricityDelivery_eur = balanceElectricityDelivery_eur + "";
+ this.balanceElectricityTransport_eur = balanceElectricityTransport_eur + "";
+ this.balanceElectricityTax_eur = balanceElectricityTax_eur + "";
+ this.deliveryContractScope = deliveryContractScope + "";
+ this.transportContractScope = transportContractScope + "";
+ this.taxContractScope = taxContractScope + "";
+ this.b_methaneUsedWithoutContracts = b_methaneUsedWithoutContracts;
+ this.b_hydrogenUsedWithoutContracts = b_hydrogenUsedWithoutContracts;
+ }
+ /*
+ public ArrayList returnData() {
+ ArrayList data = new ArrayList({actorID, actorType, parentActorID, energySupplier, ownedGridConnection.toString(), energySupplierDistrictHeat.toString(), electricityVolume_kWh, heatVolume_kWh, methaneVolume_kWh, hydrogenVolume_kWh, balanceElectricity_eur, balanceHeat_eur, balanceMethane_eur, balanceHydrogen_eur});
+ return data;
+
+ }*/
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+
+}
+
+
+ 1665502017804
+ J_EAConversionHydrogenBurner
+ 1752677832758
+ /**
+* J_EAConversionGasBurner
+*/
+public class J_EAConversionHydrogenBurner extends zero_engine.J_EAConversion implements Serializable, I_HeatingAsset {
+
+ protected double outputTemperature_degC;
+ /**
+ * Default constructor
+ */
+ public J_EAConversionHydrogenBurner() {
+ }
+
+ /**
+ * Constructor initializing the fields
+ */
+ public J_EAConversionHydrogenBurner(Agent parentAgent, double outputHeatCapacity_kW, double efficiency_r, double timestep_h, double outputTemperature_degC) {
+ this.parentAgent = parentAgent;
+ this.outputCapacity_kW = outputHeatCapacity_kW;
+ this.eta_r = efficiency_r;
+ this.inputCapacity_kW = this.outputCapacity_kW / this.eta_r;
+ this.timestep_h = timestep_h;
+ this.outputTemperature_degC = outputTemperature_degC;
+
+ this.energyAssetType = OL_EnergyAssetType.HYDROGEN_BURNER;
+
+ this.energyCarrierProduced = OL_EnergyCarriers.HEAT;
+ this.energyCarrierConsumed = OL_EnergyCarriers.HYDROGEN;
+
+ this.activeProductionEnergyCarriers.add(this.energyCarrierProduced);
+ this.activeConsumptionEnergyCarriers.add(this.energyCarrierConsumed);
+ registerEnergyAsset();
+ }
+
+ @Override
+ public void operate(double ratioOfCapacity) {
+ ((GridConnection)this.parentAgent).fm_heatFromEnergyCarrier_kW.addFlow(this.energyCarrierConsumed, ratioOfCapacity * this.outputCapacity_kW);
+ ((GridConnection)this.parentAgent).fm_consumptionForHeating_kW.addFlow(this.energyCarrierConsumed, ratioOfCapacity * this.inputCapacity_kW);
+ super.operate(ratioOfCapacity);
+ }
+
+ @Override
+ public double getCurrentTemperature() {
+ return outputTemperature_degC;
+ }
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+
+}
+
+
+ 1666189454452
+ J_EAConversionElectricHeater
+ 1752677832758
+ /**
+ * J_EAConversionElectricHeater
+ */
+public class J_EAConversionElectricHeater extends J_EAConversion implements Serializable, I_HeatingAsset {
+
+ protected double outputTemperature_degC;
+ /**
+ * Default constructor
+ */
+
+ public J_EAConversionElectricHeater(Agent parentAgent, double outputHeatCapacity_kW, double efficiency_r, double timestep_h, double outputTemperature_degC) {
+ this.parentAgent = parentAgent;
+ this.outputCapacity_kW = outputHeatCapacity_kW;
+ this.eta_r = efficiency_r;
+ this.inputCapacity_kW = this.outputCapacity_kW / this.eta_r;
+ this.timestep_h = timestep_h;
+ this.outputTemperature_degC = outputTemperature_degC;
+
+ this.energyAssetType = OL_EnergyAssetType.ELECTRIC_HEATER;
+
+ this.energyCarrierProduced = OL_EnergyCarriers.HEAT;
+ this.energyCarrierConsumed = OL_EnergyCarriers.ELECTRICITY;
+
+ this.activeProductionEnergyCarriers.add(this.energyCarrierProduced);
+ this.activeConsumptionEnergyCarriers.add(this.energyCarrierConsumed);
+ this.assetFlowCategory = OL_AssetFlowCategories.heatPumpElectricityConsumption_kW;
+ registerEnergyAsset();
+ }
+
+ @Override
+ public void operate(double ratioOfCapacity) {
+ ((GridConnection)this.parentAgent).fm_heatFromEnergyCarrier_kW.addFlow(this.energyCarrierConsumed, ratioOfCapacity * this.outputCapacity_kW);
+ ((GridConnection)this.parentAgent).fm_consumptionForHeating_kW.addFlow(this.energyCarrierConsumed, ratioOfCapacity * this.inputCapacity_kW);
+ super.operate(ratioOfCapacity);
+ }
+
+ @Override
+ public double getCurrentTemperature() {
+ return outputTemperature_degC;
+ }
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+}
+
+
+ 1666189454453
+ J_EAConversionCurtailer
+ true
+ 1752677832758
+ /**
+ * J_EAConversionCurtailer
+ */
+public class J_EAConversionCurtailer extends J_EAConversion implements Serializable {
+
+ private OL_EnergyCarriers energyCarrierProduced = OL_EnergyCarriers.HEAT;
+ private OL_EnergyCarriers energyCarrierConsumed = OL_EnergyCarriers.ELECTRICITY;
+ /**
+ * Default constructor
+ */
+ public J_EAConversionCurtailer(Agent parentAgent, double capacityElectric_kW, double efficiency, double timestep_h) {
+ this.parentAgent = parentAgent;
+ this.capacityElectric_kW = capacityElectric_kW;
+ this.eta_r = efficiency;
+ this.capacityHeat_kW = this.capacityElectric_kW * this.eta_r;
+ this.timestep_h = timestep_h;
+ registerEnergyAsset();
+ }
+
+ @Override
+ public double[] operate(double ratioOfCapacity) {
+ //traceln("I convert now! GasBurner @ " + (ratioOfCapacity * 100) + " %");
+ this.heatProduction_kW = capacityElectric_kW * ratioOfCapacity * eta_r;
+ this.electricityConsumption_kW = capacityElectric_kW * ratioOfCapacity;
+ this.energyUse_kW = (electricityConsumption_kW - heatProduction_kW);
+ this.energyUsed_kWh += timestep_h * (energyUse_kW); // This represents losses!
+ //double[] arr = {this.electricityProduction_kW, this.methaneProduction_kW, this.hydrogenProduction_kW, this.heatProduction_kW, this.electricityConsumption_kW, this.methaneConsumption_kW, this.hydrogenConsumption_kW, this.heatConsumption_kW };
+ //return arr;
+ return returnEnergyFlows();
+ }
+
+ public double getEnergyUsed_kWh() {
+ return energyUsed_kWh;
+ }
+
+ public void setCapacityElectric_kW(double capacityElectric_kW) {
+ this.capacityElectric_kW = capacityElectric_kW;
+ }
+ @Override
+ public String toString() {
+ return super.toString();
+ }
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+
+}
+
+
+ 1666879973864
+ J_SimulationResults
+ true
+ 1752737189062
+ /**
+ * J_SimulationResults
+ */
+public class J_SimulationResults implements Serializable {
+
+ public double HSMSPeakLoadElectricity_kW;
+ public double MSLSPeakLoadElectricity_kW;
+ public double cumulativeCapacityHS;
+ public double cumulativeCapacityLS;
+ public double netOverload_pct;
+ public Map<String,Double> timesOfNodePeakLoads_h = new LinkedHashMap<String,Double>();
+ public Map<String,Double> gridConnectionMaxLoad_fr = new LinkedHashMap<String,Double>();
+ public double MSLSnodePeakPositiveLoadElectricity_kW;
+ public double MSLSnodePeakNegativeLoadElectricity_kW;
+ //public double checkSumHourlyElectricityImport_MWh;
+ //public double checkSumHourlyElectricityExport_MWh;
+ public double totalElectricityImport_MWh;
+ public double totalElectricityExport_MWh;
+ public double totalMethaneImport_MWh;
+ public double totalMethaneExport_MWh;
+ public double totalHydrogenImport_MWh;
+ public double totalHydrogenExport_MWh;
+ public double totalDieselImport_MWh;
+ public Map<String,Double> totalBatteryUnitsInstalled = new LinkedHashMap<String,Double>();
+ public Map<String,Double> totalBatteryChargeAmount_MWh = new LinkedHashMap<String,Double>();
+ public Map<String,Double> totalBatteryDischargeAmount_MWh = new LinkedHashMap<String,Double>();
+ public Map<String,Double> totalBatteryInstalledCapacity_MWh = new LinkedHashMap<String,Double>();
+ //public Map<Integer,Double> SystemHourlyElectricityImport_MWh = new LinkedHashMap<Integer,Double>();
+ //public Map<Integer,Double> SystemHourlyElectricityExport_MWh = new LinkedHashMap<Integer,Double>();
+ //public Map<Integer,Double> totalEVHourlyChargingProfile_kWh = new LinkedHashMap<Integer,Double>();
+ //public Map<Integer,Double> totalEHGVHourlyChargingProfile_kWh = new LinkedHashMap<Integer,Double>();
+ //public Map<Integer,Double> totalBatteryHourlyChargingProfile_kWh = new LinkedHashMap<Integer, Double>();
+ public double totalSelfConsumption_fr;
+ public double totalSelfSufficiency_fr;
+ public double TotalEnergyUsed_MWh;
+ public double TotalEnergyProduced_MWh;
+ public double TotalEnergyCurtailed_MWh;
+ public double shareElectricvehiclesInHouseholds;
+
+ /**
+ * Default constructor
+ */
+ public J_SimulationResults() {
+ }
+
+ /**
+ * Constructor initializing the fields
+ */
+ public J_SimulationResults( double v_gridNodeLoadElectricityHSMS_kW, double v_gridNodeLoadElectricityMSLS_kW, double cumulativeCapacityHS, double cumulativeCapacityLS, double netOverload_pct, LinkedHashMap<String,Double> c_timesOfNodePeakLoads_h, LinkedHashMap<String,Double> gridConnectionMaxLoad_fr, double MSLSnodePeakPositiveLoadElectricity_kW, double MSLSnodePeakNegativeLoadElectricity_kW, double totalElectricityImport_MWh, double totalElectricityExport_MWh, double totalMethaneImport_MWh, double totalMethaneExport_MWh, double totalHydrogenImport_MWh, double totalHydrogenExport_MWh, double totalDieselImport_MWh, LinkedHashMap<String,Double> totalBatteryUnitsInstalled, LinkedHashMap<String,Double> totalBatteryChargeAmount_MWh, LinkedHashMap<String,Double> totalBatteryDischargeAmount_MWh, LinkedHashMap<String,Double> totalBatteryInstalledCapacity_MWh, LinkedHashMap<Integer,Double> c_globalElectricityImportProfile_MWhph, LinkedHashMap<Integer,Double> c_globalElectricityExportProfile_MWhph, LinkedHashMap<Integer,Double> totalEVHourlyChargingProfile_kWh, LinkedHashMap<Integer,Double> totalEHGVHourlyChargingProfile_kWh, LinkedHashMap<Integer,Double> totalBatteryHourlyChargingProfile_kWh, double totalSelfConsumption_fr, double totalSelfSufficiency_fr, double TotalEnergyUsed_MWh, double TotalEnergyProduced_MWh, double TotalEnergyCurtailed_MWh, double shareElectricvehiclesInHouseholds) {
+ this.HSMSPeakLoadElectricity_kW = v_gridNodeLoadElectricityHSMS_kW;
+ this.MSLSPeakLoadElectricity_kW = v_gridNodeLoadElectricityMSLS_kW;
+ this.cumulativeCapacityHS = cumulativeCapacityHS;
+ this.cumulativeCapacityLS = cumulativeCapacityLS;
+ this.netOverload_pct = netOverload_pct;
+ this.timesOfNodePeakLoads_h = c_timesOfNodePeakLoads_h;
+ this.gridConnectionMaxLoad_fr = gridConnectionMaxLoad_fr;
+ this.MSLSnodePeakPositiveLoadElectricity_kW = MSLSnodePeakPositiveLoadElectricity_kW;
+ this.MSLSnodePeakNegativeLoadElectricity_kW = MSLSnodePeakNegativeLoadElectricity_kW;
+ this.totalElectricityImport_MWh = totalElectricityImport_MWh;
+ this.totalElectricityExport_MWh = totalElectricityExport_MWh;
+ this.totalMethaneImport_MWh = totalMethaneImport_MWh;
+ this.totalMethaneExport_MWh = totalMethaneExport_MWh;
+ this.totalHydrogenImport_MWh = totalHydrogenImport_MWh;
+ this.totalHydrogenExport_MWh = totalHydrogenExport_MWh;
+ this.totalDieselImport_MWh = totalDieselImport_MWh;
+ this.totalBatteryUnitsInstalled = totalBatteryUnitsInstalled;
+ this.totalBatteryChargeAmount_MWh = totalBatteryChargeAmount_MWh;
+ this.totalBatteryDischargeAmount_MWh = totalBatteryDischargeAmount_MWh;
+ this.totalBatteryInstalledCapacity_MWh = totalBatteryInstalledCapacity_MWh;
+ //this.SystemHourlyElectricityImport_MWh = c_globalElectricityImportProfile_MWhph;
+ //this.SystemHourlyElectricityExport_MWh = c_globalElectricityExportProfile_MWhph;
+ //this.totalEVHourlyChargingProfile_kWh = totalEVHourlyChargingProfile_kWh;
+ //this.totalEHGVHourlyChargingProfile_kWh = totalEHGVHourlyChargingProfile_kWh;
+ //this.totalBatteryHourlyChargingProfile_kWh = totalBatteryHourlyChargingProfile_kWh;
+ this.totalSelfConsumption_fr = totalSelfConsumption_fr;
+ this.totalSelfSufficiency_fr = totalSelfSufficiency_fr;
+ this.TotalEnergyUsed_MWh = TotalEnergyUsed_MWh;
+ this.TotalEnergyProduced_MWh = TotalEnergyProduced_MWh;
+ this.TotalEnergyCurtailed_MWh = TotalEnergyCurtailed_MWh;
+ this.shareElectricvehiclesInHouseholds = shareElectricvehiclesInHouseholds;
+ }
+
+ @Override
+ public String toString() {
+ return
+ "HSMSPeakLoadElectricity_kW = " + HSMSPeakLoadElectricity_kW + " " +
+ "MSLSPeakLoadElectricity_kW = " + MSLSPeakLoadElectricity_kW + " " +
+ "MSLSnodePeakPositiveLoadElectricity_kW = " + MSLSnodePeakPositiveLoadElectricity_kW + " " +
+ "MSLSnodePeakNegativeLoadElectricity_kW = " + MSLSnodePeakNegativeLoadElectricity_kW + " " +
+ //"checkSumHourlyElectricityImport_MWh = " + checkSumHourlyElectricityImport_MWh + " " +
+ //"checkSumHourlyElectricityExport_MWh = " + checkSumHourlyElectricityExport_MWh + " " +
+ "totalElectricityImport_MWh = " + totalElectricityImport_MWh + " " +
+ "totalElectricityExport_MWh = " + totalElectricityExport_MWh + " " +
+ "totalMethaneImport_MWh = " + totalMethaneImport_MWh + " " +
+ "totalMethaneExport_MWh = " + totalMethaneExport_MWh + " " +
+ "totalHydrogenImport_MWh = " + totalHydrogenImport_MWh + " " +
+ "totalHydrogenExport_MWh = " + totalHydrogenExport_MWh + " "+
+ "totalDieselImport_MWh = " + totalDieselImport_MWh + " " +
+ "totalBatteryUnitsInstalled = " + totalBatteryUnitsInstalled + " "+
+ "totalBatteryChargeAmount_MWh = " + totalBatteryChargeAmount_MWh + " "+
+ "totalBatteryDischargeAmount_MWh = " + totalBatteryDischargeAmount_MWh + " "+
+ "totalBatteryInstalledCapacity_MWh = " + totalBatteryInstalledCapacity_MWh + " "+
+ //"SystemHourlyElectricityImport_MWh = " + SystemHourlyElectricityImport_MWh.toString() + " " +
+ //"SystemHourlyElectricityExport_MWh = " + SystemHourlyElectricityExport_MWh.toString() + " " +
+ //"totalEVHourlyChargingProfile_kWh = " + totalEVHourlyChargingProfile_kWh + " "+
+ //"totalEHGVHourlyChargingProfile_kWh = " + totalEHGVHourlyChargingProfile_kWh + " "+
+ //"totalBatteryHourlyChargingProfile_kWh = " + totalBatteryHourlyChargingProfile_kWh + " " +
+ "totalSelfConsumption_fr = " + totalSelfConsumption_fr*100 + " %" +
+ "totalSelfSufficiency_fr = " + totalSelfSufficiency_fr*100 + " %" +
+ "totalEnergyUsed_MWh = " + TotalEnergyUsed_MWh + " MWh" +
+ "TotalEnergyProduced_MWh = " + TotalEnergyProduced_MWh + " MWh" +
+ "TotalEnergyCurtailed_MWh = " + TotalEnergyCurtailed_MWh + " MWh" +
+ "shareElectricvehiclesInHouseholds = " + shareElectricvehiclesInHouseholds + " fr";
+ }
+
+ public void updateData( double v_gridNodePeakLoadElectricityHSMS_kW, double v_gridNodePeakLoadElectricityMSLS_kW, double cumulativeCapacityHS, double cumulativeCapacityLS, double netOverload_pct, LinkedHashMap<String,Double> c_timesOfNodePeakLoads_h, LinkedHashMap<String,Double> gridConnectionMaxLoad_fr, double MSLSnodePeakPositiveLoadElectricity_kW, double MSLSnodePeakNegativeLoadElectricity_kW, double totalElectricityImport_MWh, double totalElectricityExport_MWh, double totalMethaneImport_MWh, double totalMethaneExport_MWh, double totalHydrogenImport_MWh, double totalHydrogenExport_MWh, double totalDieselImport_MWh, LinkedHashMap<String,Double> totalBatteryUnitsInstalled, LinkedHashMap<String,Double> totalBatteryChargeAmount_MWh, LinkedHashMap<String,Double> totalBatteryDischargeAmount_MWh, LinkedHashMap<String,Double> totalBatteryInstalledCapacity_MWh, double totalSelfConsumption_fr, double totalSelfSufficiency_fr, double TotalEnergyUsed_MWh, double TotalEnergyProduced_MWh, double TotalEnergyCurtailed_MWh, double shareElectricvehiclesInHouseholds) {
+ this.HSMSPeakLoadElectricity_kW = v_gridNodePeakLoadElectricityHSMS_kW;
+ this.MSLSPeakLoadElectricity_kW = v_gridNodePeakLoadElectricityMSLS_kW;
+ this.cumulativeCapacityHS =cumulativeCapacityHS;
+ this.cumulativeCapacityLS = cumulativeCapacityLS;
+ this.netOverload_pct = netOverload_pct;
+ this.timesOfNodePeakLoads_h = c_timesOfNodePeakLoads_h;
+ this.gridConnectionMaxLoad_fr = gridConnectionMaxLoad_fr;
+ this.MSLSnodePeakPositiveLoadElectricity_kW = MSLSnodePeakPositiveLoadElectricity_kW;
+ this.MSLSnodePeakNegativeLoadElectricity_kW = MSLSnodePeakNegativeLoadElectricity_kW;
+ this.totalElectricityImport_MWh = roundToDecimal( totalElectricityImport_MWh , 2 );
+ this.totalElectricityExport_MWh = roundToDecimal( totalElectricityExport_MWh, 2 );
+ this.totalMethaneImport_MWh = roundToDecimal( totalMethaneImport_MWh, 2 );
+ this.totalMethaneExport_MWh = roundToDecimal( totalMethaneExport_MWh, 2 );
+ this.totalHydrogenImport_MWh = roundToDecimal( totalHydrogenImport_MWh, 2 );
+ this.totalHydrogenExport_MWh = roundToDecimal( totalHydrogenExport_MWh, 2 );
+ this.totalDieselImport_MWh = roundToDecimal( totalDieselImport_MWh, 2 );
+ this.totalBatteryUnitsInstalled = totalBatteryUnitsInstalled;
+ this.totalBatteryChargeAmount_MWh = totalBatteryChargeAmount_MWh;
+ this.totalBatteryDischargeAmount_MWh = totalBatteryDischargeAmount_MWh;
+ this.totalBatteryInstalledCapacity_MWh = totalBatteryInstalledCapacity_MWh;
+ //this.SystemHourlyElectricityImport_MWh = c_globalElectricityImportProfile_MWhph;
+ //this.SystemHourlyElectricityExport_MWh = c_globalElectricityExportProfile_MWhph;
+ //this.checkSumHourlyElectricityImport_MWh = SystemHourlyElectricityImport_MWh.values().stream().mapToDouble(d -> d).sum();
+ //this.checkSumHourlyElectricityExport_MWh = SystemHourlyElectricityExport_MWh.values().stream().mapToDouble(d -> d).sum();
+ //this.totalEVHourlyChargingProfile_kWh = totalEVHourlyChargingProfile_kWh;
+ //this.totalEHGVHourlyChargingProfile_kWh = totalEHGVHourlyChargingProfile_kWh;
+ //this.totalBatteryHourlyChargingProfile_kWh = totalBatteryHourlyChargingProfile_kWh;
+ this.totalSelfConsumption_fr = totalSelfConsumption_fr;
+ this.totalSelfSufficiency_fr = totalSelfSufficiency_fr;
+ this.TotalEnergyUsed_MWh = TotalEnergyUsed_MWh;
+ this.TotalEnergyProduced_MWh = TotalEnergyProduced_MWh;
+ this.TotalEnergyCurtailed_MWh = TotalEnergyCurtailed_MWh;
+ this.shareElectricvehiclesInHouseholds = shareElectricvehiclesInHouseholds;
+ }
+
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+
+}
+
+
+ 1666879973865
+ J_HourlyCurvesData
+ true
+ 1752737189062
+ /**
+ * J_HourlyCurvesData
+ */
+public class J_HourlyCurvesData implements Serializable {
+
+ public double checkSumHourlyElectricityImport_MWh;
+ public double checkSumHourlyElectricityExport_MWh;
+ public Map<Integer,Double> SystemHourlyElectricityImport_MWh = new LinkedHashMap<Integer,Double>();
+ public Map<Integer,Double> SystemHourlyElectricityExport_MWh = new LinkedHashMap<Integer,Double>();
+ public Map<Integer,Double> totalEVHourlyChargingProfile_kWh = new LinkedHashMap<Integer,Double>();
+ public Map<Integer,Double> totalEHGVHourlyChargingProfile_kWh = new LinkedHashMap<Integer,Double>();
+ public Map<Integer,Double> totalBatteryHourlyChargingProfile_kWh = new LinkedHashMap<Integer, Double>();
+
+ /**
+ * Default constructor
+ */
+ public J_HourlyCurvesData() {
+ }
+
+ /**
+ * Constructor initializing the fields
+ */
+ public J_HourlyCurvesData(LinkedHashMap<Integer,Double> c_globalElectricityImportProfile_MWhph, LinkedHashMap<Integer,Double> c_globalElectricityExportProfile_MWhph, LinkedHashMap<Integer,Double> totalEVHourlyChargingProfile_kWh, LinkedHashMap<Integer,Double> totalEHGVHourlyChargingProfile_kWh, LinkedHashMap<Integer,Double> totalBatteryHourlyChargingProfile_kWh) {
+
+ this.SystemHourlyElectricityImport_MWh = c_globalElectricityImportProfile_MWhph;
+ this.SystemHourlyElectricityExport_MWh = c_globalElectricityExportProfile_MWhph;
+ this.totalEVHourlyChargingProfile_kWh = totalEVHourlyChargingProfile_kWh;
+ this.totalEHGVHourlyChargingProfile_kWh = totalEHGVHourlyChargingProfile_kWh;
+ this.totalBatteryHourlyChargingProfile_kWh = totalBatteryHourlyChargingProfile_kWh;
+ this.checkSumHourlyElectricityImport_MWh = 0;
+ this.checkSumHourlyElectricityExport_MWh = 0;
+
+ }
+
+ @Override
+ public String toString() {
+ return
+ "SystemHourlyElectricityImport_MWh = " + SystemHourlyElectricityImport_MWh.toString() + " " +
+ "SystemHourlyElectricityExport_MWh = " + SystemHourlyElectricityExport_MWh.toString() + " " +
+ "totalEVHourlyChargingProfile_kWh = " + totalEVHourlyChargingProfile_kWh + " "+
+ "totalEHGVHourlyChargingProfile_kWh = " + totalEHGVHourlyChargingProfile_kWh + " "+
+ "totalBatteryHourlyChargingProfile_kWh = " + totalBatteryHourlyChargingProfile_kWh + " " ;
+ }
+
+ public void updateData(LinkedHashMap<Integer,Double> c_globalElectricityImportProfile_MWhph, LinkedHashMap<Integer,Double> c_globalElectricityExportProfile_MWhph, LinkedHashMap<Integer,Double> totalEVHourlyChargingProfile_kWh, LinkedHashMap<Integer,Double> totalEHGVHourlyChargingProfile_kWh, LinkedHashMap<Integer,Double> totalBatteryHourlyChargingProfile_kWh) {
+ this.SystemHourlyElectricityImport_MWh = c_globalElectricityImportProfile_MWhph;
+ this.SystemHourlyElectricityExport_MWh = c_globalElectricityExportProfile_MWhph;
+ this.totalEVHourlyChargingProfile_kWh = totalEVHourlyChargingProfile_kWh;
+ this.totalEHGVHourlyChargingProfile_kWh = totalEHGVHourlyChargingProfile_kWh;
+ this.totalBatteryHourlyChargingProfile_kWh = totalBatteryHourlyChargingProfile_kWh;
+ this.checkSumHourlyElectricityImport_MWh = SystemHourlyElectricityImport_MWh.values().stream().mapToDouble(d -> d).sum();
+ this.checkSumHourlyElectricityExport_MWh = SystemHourlyElectricityExport_MWh.values().stream().mapToDouble(d -> d).sum();
+ }
+
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+
+}
+
+
+ 1668600448637
+ J_EAHydrogenVehicle
+ 1752677832758
+ /**
+ * J_EAConversionHydrogenVehicle
+ */
+public class J_EAHydrogenVehicle extends J_EAVehicle implements Serializable {
+
+ private OL_EnergyCarriers energyCarrierConsumed = OL_EnergyCarriers.HYDROGEN;
+
+ /**
+ * Default constructor
+ */
+ public J_EAHydrogenVehicle() {
+ }
+
+ /**
+ * Constructor initializing the fields
+ */
+ public J_EAHydrogenVehicle(Agent ownerAssetAgent, double energyConsumption_kWhpkm, double timestep_h, double vehicleScaling, OL_EnergyAssetType energyAssetType, J_ActivityTrackerTrips tripTracker) {
+ this.parentAgent = ownerAssetAgent;
+ this.energyConsumption_kWhpkm = energyConsumption_kWhpkm;
+ this.timestep_h = timestep_h;
+ this.vehicleScaling = vehicleScaling;
+ this.energyAssetType = energyAssetType;
+ this.tripTracker = tripTracker;
+ if (tripTracker != null) {
+ tripTracker.Vehicle=this;
+ }
+ this.activeConsumptionEnergyCarriers.add(this.energyCarrierConsumed);
+ registerEnergyAsset();
+ }
+
+ @Override
+ public void f_updateAllFlows() {
+
+ flowsMap.put(OL_EnergyCarriers.HYDROGEN, this.energyUse_kW);
+
+ if (parentAgent instanceof GridConnection) {
+ ((GridConnection)parentAgent).f_addFlows(flowsMap, this.energyUse_kW, assetFlowsMap, this);
+ }
+ this.lastFlowsMap = flowsMap;
+ this.lastEnergyUse_kW = this.energyUse_kW;
+ //Pair<J_FlowsMap, Double> flowspair = new Pair(this.flowsMap, this.energyUse_kW);
+ clear();
+ //return this.flowsMap;
+ }
+
+ /*public double[] operate(double ratioOfChargeCapacity_r) {
+ return returnEnergyFlows();
+ }*/
+
+ @Override
+ public boolean startTrip() {
+ if (available) {
+ available = false;
+ //traceln("Hydrogen vehicle starting trip!");
+ return true;
+ } else {
+ traceln("Trip not started because vehicle not available!");
+ return false; // Trip not started because vehicle not available!
+ }
+ }
+
+ @Override
+ public boolean endTrip(double tripDist_km) {
+
+ if(available) {
+ traceln("Trip not ended because EV never left!");
+ return false;
+ } else {
+ available = true;
+ //traceln("Hydrogen vehicle finished trip!");
+ return true;
+
+ }
+ //traceln("Current milage: " + mileage + ", energy consumption per km: " + energyConsumption_kWhpkm);
+ }
+
+ public boolean progressTrip(double marginalTripDist_km) {
+ if( available) {
+ traceln("Trip not updated because vehicle never left!");
+ return false;
+ }
+ else {
+ mileage_km += marginalTripDist_km;
+ double energyUsedThisTimestep_kWh = marginalTripDist_km * vehicleScaling * energyConsumption_kWhpkm;
+ energyUsed_kWh += energyUsedThisTimestep_kWh;
+ //hydrogenConsumption_kW = energyUsedThisTimestep_kWh / timestep_h;
+ energyUse_kW += energyUsedThisTimestep_kWh / timestep_h;
+ return true;
+ }
+ }
+
+ public double getEnergyUsed_kWh() {
+ return energyUsed_kWh;
+ }
+
+ public boolean getAvailability() {
+ return available;
+ }
+
+ @Override
+ public void storeStatesAndReset() {
+ // Each energy asset that has some states should overwrite this function!
+ energyUsedStored_kWh = energyUsed_kWh;
+ energyUsed_kWh = 0.0;
+ availableStored = available;
+ available = true;
+ mileage_km = 0;
+ clear();
+ }
+
+ @Override
+ public void restoreStates() {
+ // Each energy asset that has some states should overwrite this function!
+ energyUsed_kWh = energyUsedStored_kWh;
+ available = availableStored;
+ }
+
+
+ @Override
+ public String toString() {
+ return
+ "parentAgent = " + parentAgent +" " +
+ "energyConsumption_kWhpkm =" + energyConsumption_kWhpkm +" " +
+ "vehicleScaling = " + vehicleScaling;
+ }
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+
+}
+
+
+ 1671107396262
+ J_EAConversionElektrolyser
+ true
+ 1752677832758
+ /**
+ * J_EAConversionElektrolyser
+ */
+public class J_EAConversionElektrolyser extends zero_engine.J_EAConversion implements Serializable {
+
+ /**
+ /**
+ * Default constructor
+ */
+ public J_EAConversionElektrolyser() {
+ }
+
+ /**
+ * Constructor initializing the fields
+ */
+
+ public J_EAConversionElektrolyser(Agent parentAgent, double inputElectricCapacity_kW, double efficiency_r, double timestep_h) {
+ this.parentAgent = parentAgent;
+ this.inputCapacity_kW = inputElectricCapacity_kW;
+ this.eta_r = efficiency_r;
+ this.outputCapacity_kW = this.inputCapacity_kW * this.eta_r;
+ this.timestep_h = timestep_h;
+
+ this.energyAssetType = OL_EnergyAssetType.ELECTROLYSER;
+
+ this.energyCarrierProduced = OL_EnergyCarriers.HYDROGEN;
+ this.energyCarrierConsumed = OL_EnergyCarriers.ELECTRICITY;
+
+ this.activeProductionEnergyCarriers.add(this.energyCarrierProduced);
+ this.activeConsumptionEnergyCarriers.add(this.energyCarrierConsumed);
+ registerEnergyAsset();
+ }
+
+ @Override
+ public void setEta_r( double efficiency_r) {
+ this.eta_r = efficiency_r;
+ this.outputCapacity_kW = this.inputCapacity_kW * this.eta_r;
+ }
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+
+}
+
+
+ 1671522756085
+ J_EAConversionGasCHP
+ 1752677832758
+ /**
+ * J_EAConversionGasCHP
+ */
+public class J_EAConversionGasCHP extends zero_engine.J_EAConversion implements Serializable, I_HeatingAsset {
+
+ protected double outputTemperature_degC;
+ protected double outputHeatCapacity_kW;
+ protected double outputElectricCapacity_kW;
+ protected List<OL_EnergyCarriers> energyCarriersProduced = new ArrayList<>();
+
+ /**
+ * Default constructor
+ */
+
+ public J_EAConversionGasCHP() {
+ }
+
+ /**
+ * Constructor initializing the fields
+ */
+ public J_EAConversionGasCHP(Agent parentAgent, double outputElectricCapacity_kW, double outputHeatCapacity_kW, double efficiency, double timestep_h, double outputTemperature_degC ) {
+ if (outputElectricCapacity_kW < 0 || outputHeatCapacity_kW < 0 || (outputElectricCapacity_kW == 0 && outputHeatCapacity_kW == 0)) {
+ throw new RuntimeException("Impossible capacities for J_EAConversionGasCHP. outputElectricCapacity_kW: " + outputElectricCapacity_kW + ", outputHeatCapacity_kW: " + outputHeatCapacity_kW);
+ }
+ this.parentAgent = parentAgent;
+ this.outputElectricCapacity_kW = outputElectricCapacity_kW;
+ this.outputHeatCapacity_kW = outputHeatCapacity_kW;
+ this.eta_r = efficiency;
+ this.inputCapacity_kW = (outputElectricCapacity_kW + outputHeatCapacity_kW) / this.eta_r ;
+ this.timestep_h = timestep_h;
+ this.outputTemperature_degC = outputTemperature_degC;
+
+ this.energyAssetType = OL_EnergyAssetType.METHANE_CHP;
+
+ this.energyCarriersProduced.add( OL_EnergyCarriers.ELECTRICITY );
+ this.energyCarriersProduced.add( OL_EnergyCarriers.HEAT );
+ this.energyCarrierConsumed= OL_EnergyCarriers.METHANE;
+
+ this.activeProductionEnergyCarriers.addAll(energyCarriersProduced);
+ this.activeConsumptionEnergyCarriers.add(this.energyCarrierConsumed);
+ this.assetFlowCategory = OL_AssetFlowCategories.CHPProductionElectric_kW;
+ registerEnergyAsset();
+ }
+
+ @Override
+ public void operate(double ratioOfCapacity) {
+ double electricityProduction_kW = this.outputElectricCapacity_kW * ratioOfCapacity;
+ double heatProduction_kW = this.outputHeatCapacity_kW * ratioOfCapacity;
+ double methaneConsumption_kW = this.inputCapacity_kW * ratioOfCapacity;
+
+ this.energyUse_kW = methaneConsumption_kW - heatProduction_kW - electricityProduction_kW ;
+ this.energyUsed_kWh += energyUse_kW * timestep_h;
+
+ this.heatProduced_kWh += heatProduction_kW * timestep_h;
+ this.electricityProduced_kWh += electricityProduction_kW * timestep_h;
+
+ flowsMap.put(OL_EnergyCarriers.HEAT, -heatProduction_kW);
+ flowsMap.put(OL_EnergyCarriers.ELECTRICITY, -electricityProduction_kW);
+ flowsMap.put(OL_EnergyCarriers.METHANE, methaneConsumption_kW);
+ assetFlowsMap.put(this.assetFlowCategory, electricityProduction_kW);
+ }
+
+ @Override
+ public void setInputCapacity_kW( double inputCapacity_kW) {
+ double scaling_fr = inputCapacity_kW / this.inputCapacity_kW;
+ this.inputCapacity_kW = inputCapacity_kW;
+ this.outputHeatCapacity_kW = scaling_fr * this.outputHeatCapacity_kW;
+ this.outputElectricCapacity_kW = scaling_fr * this.outputElectricCapacity_kW;
+ }
+
+ @Override
+ public void setEta_r( double efficiency) {
+ this.eta_r = efficiency;
+ this.inputCapacity_kW = (this.outputElectricCapacity_kW + this.outputHeatCapacity_kW) / this.eta_r ;
+ }
+
+ @Override
+ public OL_EnergyCarriers getEnergyCarrierProduced() {
+ throw new RuntimeException("Can not get EnergyCarrierProduced from J_EAConversionGasCHP, use getEnergyCarriersProduced() instead.");
+ }
+
+ public List<OL_EnergyCarriers> getEnergyCarriersProduced() {
+ return this.energyCarriersProduced;
+ }
+
+ @Override
+ public String toString() {
+ return this.energyAssetType + " in GC: " + this.parentAgent + ", "
+ + "OutputElectricCapacity: " + this.outputElectricCapacity_kW + " kW, "
+ + "OutputHeatCapacity: " + this.outputHeatCapacity_kW + " kW, "
+ + "with efficiency: " + this.eta_r + ", "
+ + "Current electric output: " + -this.getLastFlows().get(OL_EnergyCarriers.ELECTRICITY) + " kW, "
+ + "Current heat output: " + -this.getLastFlows().get(OL_EnergyCarriers.HEAT) + " kW";
+ }
+
+ @Override
+ public double getCurrentTemperature() {
+ return outputTemperature_degC;
+ }
+
+ public double getOutputHeatCapacity_kW() {
+ return outputHeatCapacity_kW;
+ }
+ public double getOutputElectricCapacity_kW() {
+ return outputElectricCapacity_kW;
+ }
+
+ @Override
+ public double getOutputCapacity_kW() {
+ throw new RuntimeException("Can't use the basic getOutputcapacity of this Asset, as it has 2 outputs. So You need to specify which output!");
+ }
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+}
+
+
+ 1673445448881
+ J_EAElectricHob
+ 1752677832758
+ /**
+ * J_EAElectricHob
+ */
+public class J_EAElectricHob extends J_EAConversion implements Serializable {
+
+ protected double outputTemperature_degC;
+
+ /**
+ * Default constructor
+ */
+ // The efficiency is the amount of heat that is retained within the building
+ public J_EAElectricHob(Agent ownerAgent, double inputCapacity_kW, double efficiency, double timestep_h, double outputTemperature_degC) {
+ this.parentAgent= ownerAgent;
+ this.inputCapacity_kW = inputCapacity_kW;
+ this.eta_r = efficiency;
+ this.outputCapacity_kW = inputCapacity_kW * efficiency;
+ this.timestep_h = timestep_h;
+ this.outputTemperature_degC = outputTemperature_degC;
+ this.energyCarrierProduced = OL_EnergyCarriers.HEAT;
+ this.energyCarrierConsumed = OL_EnergyCarriers.ELECTRICITY;
+ this.energyAssetType = OL_EnergyAssetType.ELECTRIC_HOB;
+ this.assetFlowCategory = OL_AssetFlowCategories.electricHobConsumption_kW;
+ this.activeProductionEnergyCarriers.add(this.energyCarrierProduced);
+ this.activeConsumptionEnergyCarriers.add(this.energyCarrierConsumed);
+ registerEnergyAsset();
+ }
+
+ @Override
+ public void operate( double ratioOfCapacity ) {
+ double heatProduction_kW = this.inputCapacity_kW * ratioOfCapacity * eta_r;
+ double electricityConsumption_kW = this.inputCapacity_kW * ratioOfCapacity;
+ this.energyUse_kW = (electricityConsumption_kW - heatProduction_kW);
+ this.energyUsed_kWh += timestep_h * (electricityConsumption_kW - heatProduction_kW); // This represents losses!
+ this.heatProduced_kWh += heatProduction_kW * timestep_h;
+ flowsMap.put(OL_EnergyCarriers.ELECTRICITY, electricityConsumption_kW);
+ flowsMap.put(OL_EnergyCarriers.HEAT, -heatProduction_kW);
+ assetFlowsMap.put(this.assetFlowCategory, electricityConsumption_kW);
+ }
+
+ @Override
+ public String toString() {
+ return
+ "AssetType = " + energyAssetType +
+ " parentAgent = " + parentAgent +", Energy consumed = " + this.energyUsed_kWh +
+ " capacityElectric_kW = " + this.inputCapacity_kW +" "+
+ "eta_r = " + this.eta_r+" " +
+ "outputTemperature_degC = " + this.outputTemperature_degC + " "+
+ "energyUsed_kWh (losses) = " + this.energyUsed_kWh + " "+
+ "heatProducted_kWh = " +this.heatProduced_kWh + " ";
+ }
+
+ @Override
+ public double getCurrentTemperature() {
+ return outputTemperature_degC;
+ }
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+
+}
+
+
+ 1673445438882
+ J_Contract
+ 1752680962144
+ import com.fasterxml.jackson.annotation.JsonTypeInfo;
+import com.fasterxml.jackson.annotation.JsonSubTypes;
+import com.fasterxml.jackson.annotation.JsonIdentityInfo;
+import com.fasterxml.jackson.annotation.ObjectIdGenerators;
+
+@JsonIdentityInfo(generator = ObjectIdGenerators.UUIDGenerator.class, property = "@id")
+@JsonTypeInfo(
+ use = JsonTypeInfo.Id.CLASS,
+ include = JsonTypeInfo.As.PROPERTY,
+ property = "type" // 👈 this will be the field name in your JSON
+ )
+/*
+@JsonSubTypes({
+ @JsonSubTypes.Type(value = J_DeliveryContract.class, name = "J_DeliveryContract"),
+ @JsonSubTypes.Type(value = J_ConnectionContract.class, name = "J_ConnectionContract"),
+ @JsonSubTypes.Type(value = J_TransportContract.class, name = "J_TransportContract"),
+ @JsonSubTypes.Type(value = J_TaxContract.class, name = "J_TaxContract"),
+})
+*/
+
+public class J_Contract implements Serializable {
+
+ public String contractScope; // Kan energySupplier of Coop zijn (dus kan niet specifieker zijn dan 'String' hier, tenzij we Interfaces gaan gebruiken. ('Implements energy supplier')
+ public OL_EnergyCarriers energyCarrier;
+ //public OL_ContractType contractType;
+ public double EnergyTransactionVolume_kWh=0;
+ public double FinancialTransactionVolume_eur=0;
+ public String contractHolder;
+ public double annualFee_eur=0;
+
+ public J_Contract() {
+ }
+ /**
+ * Constructor initializing the fields
+ */
+ public J_Contract(String contractScope, OL_EnergyCarriers energyCarrier) {
+ this.contractScope = contractScope; // ID of actor that is the other 'end' of this contract.
+ //this.contractType = contractType; // Fixed or variable energy price?
+ this.energyCarrier = energyCarrier;
+ }
+
+ @Override
+ public String toString() {
+ return
+ "type = " + this.getClass().toString() + " " +
+ "contractScope = " + contractScope +" ";
+ }
+}
+
+
+
+
+ 1673445448882
+ J_DeliveryContract
+ /**
+ * J_DeliveryContract
+ */
+
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
+
+@JsonAutoDetect(
+ fieldVisibility = Visibility.PROTECTED_AND_PUBLIC, // ✅ only public fields are serialized
+ getterVisibility = Visibility.NONE,
+ isGetterVisibility = Visibility.NONE,
+ setterVisibility = Visibility.NONE,
+ creatorVisibility = Visibility.NONE
+ )
+
+public class J_DeliveryContract extends zero_engine.J_Contract implements Serializable {
+
+ //public String contractScope; // Kan energySupplier of Coop zijn (dus kan niet specifieker zijn dan 'String' hier, tenzij we Interfaces gaan gebruiken. ('Implements energy supplier')
+ public OL_DeliveryContractType deliveryContractType; // Fixed of variable
+ public double deliveryPrice_eurpkWh;
+ public double feedinPrice_eurpkWh;
+ //public double idx;
+ //public OL_EnergyCarriers energyCarrier;
+
+ /**
+ * Constructor initializing the fields
+ */
+ public J_DeliveryContract() {
+
+ }
+
+ public J_DeliveryContract(String contractScope, OL_DeliveryContractType contractType, OL_EnergyCarriers energyCarrier, double deliveryPrice_eurpkWh, double feedinPrice_eurpkWh, double annualFee_eur ) {
+ this.contractScope = contractScope; // ID of actor that is the other 'end' of this contract.
+ this.deliveryContractType = contractType; // Fixed or variable energy price?
+ this.energyCarrier = energyCarrier;
+ this.deliveryPrice_eurpkWh = deliveryPrice_eurpkWh;
+ this.feedinPrice_eurpkWh = feedinPrice_eurpkWh;
+ //this.contractType = OL_ContractType.DELIVERY;
+ this.annualFee_eur = annualFee_eur;
+ }
+
+ @Override
+ public String toString() {
+ return
+ "type = " + this.getClass().toString() + " " +
+ "contractScope = " + contractScope +" " +
+ "deliveryContractType = " + deliveryContractType.toString() +" "+
+ "deliveryPrice_eurpkWh = " + deliveryPrice_eurpkWh +" "+
+ "feedinPrice_eurpkWh = " + feedinPrice_eurpkWh +" ";
+ }
+}
+
+
+
+
+ 1673445448883
+ J_TransportContract
+ /**
+ * J_TransportContract
+ */
+public class J_TransportContract extends zero_engine.J_Contract implements Serializable {
+
+ //public String contractScope; // Kan GridOperator of Coop zijn (dus kan niet specifieker zijn dan 'String' hier, tenzij we Interfaces gaan gebruiken. ('Implements grid operator')
+ //public OL_TransportContractType contractType; // Nodal-pricing, bandwidth, peak
+ public OL_TransportContractType transportContractType; //
+ public double bandwidthTreshold_kW;
+ public double bandwidthTariff_eurpkWh;
+ public double idx;
+ //public OL_EnergyCarriers energyCarrier;
+
+ /**
+ * Constructor initializing the fields
+ */
+
+ public J_TransportContract() {
+
+ }
+
+ public J_TransportContract(String contractScope, OL_TransportContractType transportContractType, OL_EnergyCarriers energyCarrier, double bandwidthTreshold_kW, double bandwidthTariff_eurpkWh, double annualFee_eur ) {
+ this.contractScope = contractScope; // ID of actor that is the other 'end' of this contract.
+ this.energyCarrier = energyCarrier;
+ this.transportContractType = transportContractType;
+ this.bandwidthTreshold_kW = bandwidthTreshold_kW;
+ this.bandwidthTariff_eurpkWh = bandwidthTariff_eurpkWh;
+ //this.contractType = OL_ContractType.TRANSPORT;
+ this.annualFee_eur = annualFee_eur;
+ }
+
+ @Override
+ public String toString() {
+ return
+ "type = " + this.getClass().toString() + " " +
+ "contractScope = " + contractScope +" ";
+ }
+}
+
+
+
+ 1673445448884
+ J_TaxContract
+ /**
+ * J_TaxContract
+ */
+public class J_TaxContract extends zero_engine.J_Contract implements Serializable {
+
+ //public String contractScope; // Kan energySupplier of Coop zijn
+ //public OL_ContractType contractType; // Fixed of variable
+ public double deliveryTax_eurpkWh;
+ public double feedinTax_eurpkWh;
+ public double proportionalTax_pct;
+ public double idx;
+ //public OL_EnergyCarriers energyCarrier;
+ public J_TaxContract() {
+
+ }
+
+ /**
+ * Constructor initializing the fields
+ */
+ public J_TaxContract(String contractScope, OL_EnergyCarriers energyCarrier, double deliveryTax_eurpkWh, double feedinTax_eurpkWh, double proportionalTax_pct, double annualFee_eur ) {
+ this.contractScope = contractScope; // ID of actor that is the other 'end' of this contract.
+ this.energyCarrier = energyCarrier;
+ this.deliveryTax_eurpkWh = deliveryTax_eurpkWh;
+ this.feedinTax_eurpkWh = feedinTax_eurpkWh;
+ this.proportionalTax_pct = proportionalTax_pct;
+ //this.contractType = OL_ContractType.TAX;
+ this.annualFee_eur = annualFee_eur;
+ }
+}
+
+
+ 1673445448885
+ J_ConnectionContract
+ 1752680962144
+ /**
+ * J_ConnectionContract
+ */
+public class J_ConnectionContract extends zero_engine.J_Contract implements Serializable {
+
+ //public String contractScope; // Kan energySupplier of Coop zijn
+ public OL_ConnectionContractType connectionContractType; // Fixed of variable
+ public double nfATOstart_h = 0;
+ public double nfATOend_h = 0;
+ public double nfATOpower_kW = 0;
+ public double idx;
+
+ public J_ConnectionContract() {
+ }
+ /**
+ * Constructor initializing the fields
+ */
+ public J_ConnectionContract(String contractScope, OL_ConnectionContractType contractType, OL_EnergyCarriers energyCarrier, double nfATOstart_h, double nfATOend_h, double nfATOpower_kW, double annualFee_eur ) {
+ this.contractScope = contractScope; // ID of actor that is the other 'end' of this contract.
+ this.connectionContractType = contractType; // Fixed or variable energy price?
+ this.energyCarrier = energyCarrier;
+ this.nfATOstart_h = nfATOstart_h;
+ this.nfATOend_h = nfATOend_h;
+ this.nfATOpower_kW = nfATOpower_kW;
+ //this.contractType = OL_ContractType.CONNECTION;
+ this.annualFee_eur = annualFee_eur;
+ }
+}
+
+
+ 1678469210821
+ J_EAConversionCurtailerHeat
+ true
+ 1752677832758
+ /**
+ * J_EAConversionCurtailerHeat
+ */
+public class J_EAConversionCurtailerHeat extends J_EAConversion implements Serializable {
+
+ private OL_EnergyCarriers energyCarrierProduced = OL_EnergyCarriers.HEAT;
+ private OL_EnergyCarriers energyCarrierConsumed = OL_EnergyCarriers.HEAT;
+ /**
+ * Default constructor
+ */
+ public J_EAConversionCurtailerHeat(Agent parentAgent, double capacityHeat_kW, double efficiency, double timestep_h) {
+ this.parentAgent = parentAgent;
+ this.capacityHeat_kW = capacityHeat_kW;
+ this.eta_r = efficiency;
+// this.capacityHeat_kW = this.capacityHeat_kW * this.eta_r;
+ this.timestep_h = timestep_h;
+ registerEnergyAsset();
+ }
+
+ @Override
+ public double[] operate(double ratioOfCapacity) {
+ //traceln("I convert now! GasBurner @ " + (ratioOfCapacity * 100) + " %");
+ heatProduction_kW = capacityHeat_kW * ratioOfCapacity * eta_r;
+ heatConsumption_kW = capacityHeat_kW * ratioOfCapacity;
+ energyUse_kW = (heatConsumption_kW - heatProduction_kW);
+ energyUsed_kWh += timestep_h * energyUse_kW; // This represents losses!
+ //double[] arr = {this.electricityProduction_kW, this.methaneProduction_kW, this.hydrogenProduction_kW, this.heatProduction_kW, this.electricityConsumption_kW, this.methaneConsumption_kW, this.hydrogenConsumption_kW, this.heatConsumption_kW };
+ //return arr;
+ heatConsumed_kWh += heatConsumption_kW * timestep_h;
+ heatProduced_kWh += heatProduction_kW * timestep_h;
+
+ return returnEnergyFlows();
+ }
+
+ @Override
+ public double getEnergyUsed_kWh() {
+ return energyUsed_kWh;
+ }
+
+ @Override
+ public double getHeatCapacity_kW() {
+ return capacityHeat_kW;
+ }
+
+ @Override
+ public String toString() {
+ return
+ "parentAgent = " + parentAgent +", Energy consumed = " + energyUsed_kWh + " " +
+ "capacityHeat_kW = " + capacityHeat_kW +" "+
+ "eta_r = " + eta_r+" " +
+ "energyUsed_kWh (losses) = " + energyUsed_kWh + " "+
+ "heatConsumed_kWh = " + heatConsumed_kWh + " "+
+ "heatProduced_kWh = " + heatProduced_kWh + " ";
+ }
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+
+}
+
+
+ 1692861398767
+ J_ActivityTracker
+ 1752681639768
+ /**
+ * J_ActivityTracker
+ */
+
+import com.fasterxml.jackson.annotation.JsonIdentityInfo;
+import com.fasterxml.jackson.annotation.ObjectIdGenerators;
+
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
+
+@JsonAutoDetect(
+ fieldVisibility = Visibility.ANY,
+ getterVisibility = Visibility.NONE,
+ isGetterVisibility = Visibility.NONE,
+ setterVisibility = Visibility.NONE,
+ creatorVisibility = Visibility.NONE
+ )
+@JsonIdentityInfo(generator = ObjectIdGenerators.UUIDGenerator.class, property = "@id")
+public class J_ActivityTracker implements Serializable {
+ protected EnergyModel energyModel;
+
+ // Tripdata
+ protected ArrayList<Double> starttimes_min = new ArrayList<>();
+ protected ArrayList<Double> endtimes_min = new ArrayList<>();
+ //private ArrayList<Double> eventMagnitude = new ArrayList<>();
+ public int nbActivities = 0;
+ public int v_eventIndex = 0;
+ protected int v_eventIndexStored =0;
+
+ /**
+ * Default constructor
+ */
+ public J_ActivityTracker() {
+ }
+
+ public J_ActivityTracker(EnergyModel main, int rowIndex, double time_min) {
+ }
+
+ public void storeAndResetState() {
+ v_eventIndexStored = v_eventIndex;
+ v_eventIndex = 0;
+ }
+
+ public void restoreState() {
+ v_eventIndex = v_eventIndexStored;
+ }
+
+
+ @Override
+ public String toString() {
+ return super.toString();
+ }
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+
+}
+
+
+ 1692862190945
+ J_ActivityTrackerTrips
+ 1752681639768
+ /**
+ * J_ActivityTrackerTrips
+ */
+import com.fasterxml.jackson.annotation.JsonIdentityInfo;
+import com.fasterxml.jackson.annotation.ObjectIdGenerators;
+@JsonIdentityInfo(generator = ObjectIdGenerators.UUIDGenerator.class, property = "@id")
+
+public class J_ActivityTrackerTrips extends J_ActivityTracker implements Serializable {
+
+ public ArrayList<Double> distances_km = new ArrayList<>();
+ private int rowIndex;
+ public J_EAVehicle Vehicle;
+ public double v_idleTimeToNextTrip_min;
+ public double v_tripDist_km;
+ public double v_energyNeedForNextTrip_kWh;
+ public double v_nextEventStartTime_min;
+ public double distanceScaling_fr = 1.0;
+ public double currentTripTimesteps_n;
+ public String tripPatternIdentifier;
+
+ /**
+ * Default constructor
+ */
+ public J_ActivityTrackerTrips() {
+ }
+
+ public J_ActivityTrackerTrips(EnergyModel main, TextFile tripsCsv, int rowIndex, double time_min, J_EAVehicle Vehicle) {
+ this.energyModel = main;
+ this.rowIndex = rowIndex;
+ this.Vehicle = Vehicle;
+
+ tripsCsv.close();
+ tripsCsv.canReadMore();
+
+ tripsCsv.readLine(); // Skips first line
+
+ while (roundToInt(tripsCsv.readDouble())!=rowIndex && tripsCsv.canReadMore()) { // Skip until rowIndex found
+ tripsCsv.readLine();
+ //String line = tripsCsv.readLine(); // Does this also skip to the next line?
+ //traceln("Skipping line: " + line);
+ }
+ int currentLineNb = tripsCsv.getLineNumber();
+ //traceln("rowIndex %s found on line: %s", rowIndex, currentLineNb);
+ int nbActivities = tripsCsv.readInt();
+
+ for (int i = 0; i < nbActivities; i++){
+ starttimes_min.add(tripsCsv.readDouble());
+ endtimes_min.add(tripsCsv.readDouble());
+ distances_km.add(tripsCsv.readDouble());
+ }
+
+ // If trips have in inputdata have a 1-week schedule (endtime < 10080), then duplicate activities until the end of the year
+ if (endtimes_min.get(nbActivities-1) < 10080) {
+ for (int weeks = 1; weeks < 53; weeks++) {
+ for (int eventIdx = 0; eventIdx < nbActivities; eventIdx++) {
+ starttimes_min.add(starttimes_min.get(eventIdx) + 10080*weeks);
+ endtimes_min.add(endtimes_min.get(eventIdx) + 10080*weeks);
+ distances_km.add(distances_km.get(eventIdx));
+ }
+ }
+ }
+
+ double currentAnnualDistance_km = distances_km.stream().mapToDouble(a -> a).sum();
+ //traceln("Number of trips: %s, total annual distance: %s km", nbActivities, currentAnnualDistance_km);
+ //traceln("Total annual distance: %s", currentAnnualDistance_km);
+ // 'forward' to current activity if tripTracker is instantiated not at the start of the simulation or year
+ while ( starttimes_min.get(v_eventIndex) < time_min ) {
+ v_eventIndex++;
+ if ( v_eventIndex > starttimes_min.size() - 1 ) {
+ break;
+ }
+ }
+ prepareNextActivity(time_min);
+ }
+
+ public void setVehicle(J_EAVehicle Vehicle) {
+ this.Vehicle = Vehicle;
+ }
+
+ public void setDistanceScaling_fr(double distanceScaling_fr) {
+ this.distanceScaling_fr = distanceScaling_fr;
+ }
+
+
+ public double getAnnualDistance_km() {
+ double currentAnnualDistance_km = distances_km.stream().mapToDouble(a -> a).sum();
+ return currentAnnualDistance_km;
+ }
+ public void setAnnualDistance_km(double desiredAnnualDistance_km) { // Scale trips to come to a certain total annual distance traveled. This can lead to unfeasibly long trips for EVs!!
+ /* double currentAnnualDistance_km = 0;
+ int tripNo=0;
+ // Get current annual distance
+ while (endtimes_min.get(tripNo) < 60*24*365) {
+ currentAnnualDistance_km += distances_km.get(tripNo);
+ tripNo++;
+ }
+ */
+ double currentAnnualDistance_km = getAnnualDistance_km();
+ double scalingFactor_f = desiredAnnualDistance_km / currentAnnualDistance_km;
+
+ //distances_km = (ArrayList<Double>)distances_km.stream().map(a -> scalingFactor_f*a).toList();
+ ListIterator<Double> iterator = distances_km.listIterator();
+ for (int i = 0; i<distances_km.size(); i++) {
+ //distances_km[i] = distances(i)*scalingFactor_f;
+ iterator.next();
+ iterator.set(distances_km.get(i)*scalingFactor_f);
+ }
+ //traceln("Annual distance of triptracker set to: %s km", distances_km.stream().mapToDouble(a -> a).sum());
+ //traceln("Desired annual distance was: %s km", desiredAnnualDistance_km);
+ }
+
+ public void manageActivities(double t_h) {
+ double time_min = t_h * 60;
+ if (Vehicle.getAvailability()) { // at start of timestep! check for multiple 'events' in timestep!
+ //if (time_min == roundToInt(starttimes_min.get(v_eventIndex) / (60*energyModel.p_timeStep_h)) * (energyModel.p_timeStep_h * 60) ) { // is a trip starting this timestep?
+ if ( time_min >= starttimes_min.get(v_eventIndex) ) { // is a trip starting this timestep?
+ //currentTripDuration = roundToInt(endtimes_min.get(v_eventIndex) - starttimes_min.get(v_eventIndex) / (energyModel.p_timeStep_h * 60));
+ currentTripTimesteps_n = max(1,roundToInt(((endtimes_min.get(v_eventIndex) - starttimes_min.get(v_eventIndex)) / (energyModel.p_timeStep_h * 60))));
+ Vehicle.startTrip();
+ //if (time_min == roundToInt(endtimes_min.get(v_eventIndex) / (60*energyModel.p_timeStep_h)) * (energyModel.p_timeStep_h*60) ) { // is the trip also ending this timestep?
+ if (time_min >= endtimes_min.get(v_eventIndex) ) { // is the trip also ending this timestep?
+ Vehicle.endTrip(v_tripDist_km);
+ v_eventIndex++;
+ prepareNextActivity(time_min);
+ }
+ }
+
+ } else {
+ if (Vehicle instanceof J_EADieselVehicle) {
+ J_EADieselVehicle dieselVehicle = (J_EADieselVehicle)Vehicle;
+ dieselVehicle.progressTrip(v_tripDist_km / currentTripTimesteps_n);
+ }
+ else if (Vehicle instanceof J_EAHydrogenVehicle) {
+ J_EAHydrogenVehicle hydrogenVehicle = (J_EAHydrogenVehicle)Vehicle;
+ hydrogenVehicle.progressTrip(v_tripDist_km / currentTripTimesteps_n);
+ }
+ //if (time_min == roundToInt(endtimes_min.get(v_eventIndex)/ (60*energyModel.p_timeStep_h)) * 60*energyModel.p_timeStep_h ) { // is a trip ending this timestep?
+ if (time_min >= endtimes_min.get(v_eventIndex) ) { // is a trip ending this timestep?
+ Vehicle.endTrip(v_tripDist_km);
+ v_eventIndex++;
+ prepareNextActivity(time_min);
+ //if (time_min == roundToInt(starttimes_min.get(v_eventIndex) / (60*energyModel.p_timeStep_h)) * (energyModel.p_timeStep_h*60) ) { // is the next trip also starting this timestep?
+ if (time_min >= starttimes_min.get(v_eventIndex) ) { // is the next trip also starting this timestep?
+ currentTripTimesteps_n = max(1,roundToInt(((endtimes_min.get(v_eventIndex) - starttimes_min.get(v_eventIndex)) / (energyModel.p_timeStep_h * 60))));
+ Vehicle.startTrip();
+ }
+ }
+
+ }
+ }
+
+ public void setStartIndex(double t_h) {
+ // 'forward' to current activity if tripTracker is instantiated not at the start of the simulation or year
+ double time_min = t_h * 60.0;
+ while ( starttimes_min.get(v_eventIndex) < time_min ) {
+ v_eventIndex++;
+ if ( v_eventIndex > starttimes_min.size() - 1 ) {
+ break;
+ }
+ }
+ prepareNextActivity(time_min);
+ }
+
+ public void prepareNextActivity(double time_min) {
+ if ( v_eventIndex >= starttimes_min.size() ) {
+ v_eventIndex = 0;
+ }
+
+ v_nextEventStartTime_min = starttimes_min.get(v_eventIndex);
+ v_idleTimeToNextTrip_min = v_nextEventStartTime_min - time_min;
+ v_tripDist_km = distanceScaling_fr * distances_km.get( v_eventIndex ); // Update upcoming trip distance
+
+ if (Vehicle instanceof J_EAEV ev) {
+
+ v_energyNeedForNextTrip_kWh = ev.energyConsumption_kWhpkm * v_tripDist_km;
+ if (v_idleTimeToNextTrip_min > 0 && (v_energyNeedForNextTrip_kWh-ev.getCurrentStateOfCharge_kWh())> v_idleTimeToNextTrip_min/60 * ev.capacityElectric_kW) {
+ traceln("TripTracker reports: charging need for next trip is not feasible! Time till next trip: %s hours, chargeNeed_kWh: %s", roundToDecimal(v_idleTimeToNextTrip_min/60,2), roundToDecimal(v_energyNeedForNextTrip_kWh-ev.getCurrentStateOfCharge_kWh(),2));
+ }
+ v_energyNeedForNextTrip_kWh = min(v_energyNeedForNextTrip_kWh+10,ev.getStorageCapacity_kWh()); // added 10kWh margin 'just in case'. This is actually realistic; people will charge their cars a bit more than strictly needed for the next trip, if possible.
+ // Check if more charging is needed for next trip!
+ double nextTripDist_km = 0;
+ double nextTripStartTime_min = 0;
+
+ if ( v_eventIndex == starttimes_min.size() - 1 ) {
+ nextTripDist_km = 0;//distances_km.get( 0 );
+ nextTripStartTime_min = endtimes_min.get(v_eventIndex);
+ } else {
+ nextTripDist_km = distanceScaling_fr*distances_km.get( v_eventIndex+1 );
+ nextTripStartTime_min = starttimes_min.get( v_eventIndex+1 );
+ }
+ double additionalChargingNeededForNextTrip_kWh = max(0,nextTripDist_km * ev.energyConsumption_kWhpkm - (nextTripStartTime_min - endtimes_min.get(v_eventIndex))/60*ev.getCapacityElectric_kW());
+ /*if (additionalChargingNeededForNextTrip_kWh>0) {
+ traceln("*******Additional charging required to prepare for trip after next trip!*********");
+ }*/
+ v_energyNeedForNextTrip_kWh += additionalChargingNeededForNextTrip_kWh;
+ ev.energyNeedForNextTrip_kWh = v_energyNeedForNextTrip_kWh;
+ /*if ( (v_energyNeedForNextTrip_kWh - EV.getCurrentStateOfCharge() * EV.getStorageCapacity_kWh()) / (v_idleTimeToNextTrip_min/60) > EV.capacityElectric_kW ) {
+ traceln("Infeasible trip pattern for EV, not enough time to charge for next trip! Required charging power is: " + (v_energyNeedForNextTrip_kWh - EV.getCurrentStateOfCharge() * EV.getStorageCapacity_kWh()) / (v_idleTimeToNextTrip_min/60) + " kW");
+ traceln("RowIndex: " + rowIndex + " tripDistance: " + v_tripDist_km + " km, time to next trip: " + v_idleTimeToNextTrip_min + " minutes");
+ } */
+ }
+ }
+
+ @Override
+ public String toString() {
+ return
+ "Number of trips = " + this.nbActivities + " " +
+ "Row index = " + this.rowIndex + " " +
+ "Distance Scaling = " + this.distanceScaling_fr + " ";
+ }
+
+ public double getDistanceScaling_fr( ) {
+ return this.distanceScaling_fr;
+ }
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+}
+
+
+
+ 1692862773194
+ J_EAVehicle
+ 1752677832758
+ /**
+ * J_EAVehicle
+ */
+import com.fasterxml.jackson.annotation.JsonIdentityInfo;
+import com.fasterxml.jackson.annotation.ObjectIdGenerators;
+
+
+public abstract class J_EAVehicle extends J_EA implements Serializable {
+ public boolean available = true;
+ protected boolean availableStored = true;
+ protected double energyConsumption_kWhpkm;
+ //private MobilityTracker mobilityTracker = null;
+ public double vehicleScaling;
+ public double mileage_km = 0;
+ public J_ActivityTrackerTrips tripTracker;
+ /**
+ * Default constructor
+ */
+ public J_EAVehicle() {
+ }
+
+ public boolean startTrip() {
+ return false;
+ }
+
+ public boolean endTrip(double tripDist_km) {
+ return false;
+ }
+
+ public void operate(double ratioOfCapacity) {
+ traceln("***Warning*** abstract J_EAVehicle operate! This is a dummy function, doing nothing!");
+ //return null;
+ }
+
+ public void setVehicleScaling(double vehicleScaling) {
+ this.vehicleScaling = vehicleScaling;
+ }
+
+ public void setTripTracker(J_ActivityTrackerTrips tracker) {
+ tripTracker = tracker;
+ }
+
+ public J_ActivityTrackerTrips getTripTracker() {
+ return tripTracker;
+ }
+
+ public boolean getAvailability() {
+ return available;
+ }
+
+ public double getVehicleScaling() {
+ return vehicleScaling;
+ }
+
+ public double getEnergyConsumption_kWhpkm() {
+ return energyConsumption_kWhpkm * vehicleScaling;
+ }
+
+ @Override
+ public String toString() {
+ return super.toString();
+ }
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+
+}
+
+
+ 1692876125447
+ J_ActivityTrackerCooking
+ 1752681639768
+ /**
+ * J_ActivityTrackerCooking
+ */
+
+import com.fasterxml.jackson.annotation.JsonIdentityInfo;
+import com.fasterxml.jackson.annotation.ObjectIdGenerators;
+@JsonIdentityInfo(generator = ObjectIdGenerators.UUIDGenerator.class, property = "@id")
+public class J_ActivityTrackerCooking extends zero_engine.J_ActivityTracker implements Serializable {
+ private ArrayList<Double> powerFractions_fr = new ArrayList<>();
+ public J_EAConversion HOB;
+ public double powerFraction_fr=0;
+ private int rowIndex;
+ private boolean cooking = false;
+ private double timeStep_min;
+ private ArrayList<Double> initalStarttimes_min;
+ private ArrayList<Double> initalEndtimes_min;
+ private ArrayList<Double> storedStarttimes_min;
+ private ArrayList<Double> storedEndtimes_min;
+
+ /**
+ * Default constructor
+ */
+ public J_ActivityTrackerCooking() {
+ }
+
+ public J_ActivityTrackerCooking(TextFile inputCookingActivities, int rowIndex, double time_min, J_EAConversion HOB) {
+
+ this.rowIndex = rowIndex;
+ this.HOB=HOB;
+ //int rowIndex = uniform_discr(2, 300);
+
+ this.timeStep_min = 60 * this.HOB.timestep_h;
+
+ inputCookingActivities.close();
+ inputCookingActivities.canReadMore();
+ inputCookingActivities.readLine(); // Skips first line
+
+ while (roundToInt(inputCookingActivities.readDouble())!=rowIndex && inputCookingActivities.canReadMore()) { // Skip until rowIndex found
+ inputCookingActivities.readLine();
+ //String line = tripsCsv.readLine(); // Does this also skip to the next line?
+ //traceln("Skipping line: " + line);
+ }
+ int currentLineNb = inputCookingActivities.getLineNumber();
+ traceln("rowIndex %s found on line: %s", rowIndex, currentLineNb);
+ int nbActivities = inputCookingActivities.readInt();
+ traceln("Number of trips: %s", nbActivities);
+
+
+ for (int i = 0; i < nbActivities; i++){
+ starttimes_min.add(inputCookingActivities.readDouble());
+ endtimes_min.add(inputCookingActivities.readDouble());
+
+ double ratio = inputCookingActivities.readDouble() / HOB.getOutputCapacity_kW();
+ powerFractions_fr.add(ratio);
+ }
+
+ while ( starttimes_min.get(v_eventIndex) - time_min < 0) {
+ starttimes_min.set( v_eventIndex, starttimes_min.get(v_eventIndex) + 1440 );
+ endtimes_min.set( v_eventIndex, endtimes_min.get(v_eventIndex) + 1440 );
+ v_eventIndex++;
+ if ( v_eventIndex > starttimes_min.size() - 1 ) {
+ v_eventIndex = 0;
+ }
+ }
+
+
+ initalStarttimes_min = new ArrayList<>(starttimes_min);
+ initalEndtimes_min = new ArrayList<>(endtimes_min);
+ //traceln("Current model time in minutes: " + energyModel.t_h*60 + ", nb sessions: " + nbOfCookingSessions);
+ //traceln("Starttimes: %s", starttimes_min);
+ //traceln("Endtimes: %s", endtimes_min);
+ }
+
+ public void manageActivities(double t_h) {
+ double time_min = t_h * 60;
+ //traceln("Cooking tracker current time: " + time_min);
+ //traceln("Event index: " + v_eventIndex);
+ //traceln("startTimes: " + starttimes_min);
+ //traceln("endTimes: " + endtimes_min);
+ //traceln("powerFractions_fr: " + powerFractions_fr);
+
+ if (cooking) {
+ if (time_min >= endtimes_min.get(v_eventIndex) ) { // end cooking session. Also check if a new one starts in this timestep!
+
+ //main.v_activeCookingSessions.decrementAndGet();
+ //traceln("End of cooking session, currently active cooking sessions %s", main.v_activeCookingSessions);
+ // factor to compensate for the fact that you might not be cooking for the entire timestep.
+ double fr = (time_min - this.endtimes_min.get(this.v_eventIndex)) / this.timeStep_min;
+ this.powerFraction_fr = fr * this.powerFractions_fr.get(this.v_eventIndex);
+
+ starttimes_min.set( v_eventIndex, starttimes_min.get(v_eventIndex) + 1440 );
+ endtimes_min.set( v_eventIndex, endtimes_min.get(v_eventIndex) + 1440 );
+ v_eventIndex++;
+ if ( v_eventIndex >= starttimes_min.size() ) {
+ v_eventIndex = 0;
+ }
+ cooking=false;
+
+ if (time_min >= starttimes_min.get(v_eventIndex)) {
+ // factor to compensate for the fact that you might not be cooking for the entire timestep.
+ fr = (time_min - this.starttimes_min.get(this.v_eventIndex)) / this.timeStep_min;
+ this.powerFraction_fr = fr * this.powerFractions_fr.get(this.v_eventIndex);
+ //main.v_activeCookingSessions.incrementAndGet();
+ cooking=true;
+ traceln("Starting next cooking session in same timestep as previous session ended!! Rowindex %s, eventIndex %s\", rowIndex, v_eventIndex");
+ }
+ }
+ else {
+ this.powerFraction_fr = this.starttimes_min.get(this.v_eventIndex);
+ }
+ } else if (time_min >= starttimes_min.get(v_eventIndex) ) { // start cooking session. Also check if it ends within this timestep!
+ /*if (endtimes_min.get(v_eventIndex) - starttimes_min.get(v_eventIndex) > 100) {
+ traceln("Cooking event longer than 100 minutes!! Rowindex %s, eventIndex %s.", rowIndex, v_eventIndex);
+ }*/
+
+ // factor to compensate for the fact that you might not be cooking for the entire timestep.
+ double fr = (time_min - this.starttimes_min.get(this.v_eventIndex)) / this.timeStep_min;
+ this.powerFraction_fr = fr * this.powerFractions_fr.get(this.v_eventIndex);
+ //main.v_activeCookingSessions.incrementAndGet();
+ cooking=true;
+ if (time_min >= endtimes_min.get(v_eventIndex) ) { // end cooking session in the same timestep? Still need to fix energy use for this case!!
+
+ //main.v_activeCookingSessions.decrementAndGet();
+ //traceln("End of cooking session, currently active cooking sessions %s", main.v_activeCookingSessions);
+ fr = (this.endtimes_min.get(this.v_eventIndex) - this.starttimes_min.get(this.v_eventIndex)) / this.timeStep_min;
+ this.powerFraction_fr = fr * this.powerFractions_fr.get(this.v_eventIndex);
+
+ starttimes_min.set( v_eventIndex, starttimes_min.get(v_eventIndex) + 1440 );
+ endtimes_min.set( v_eventIndex, endtimes_min.get(v_eventIndex) + 1440 );
+ v_eventIndex++;
+ if ( v_eventIndex >= starttimes_min.size() ) {
+ v_eventIndex = 0;
+ }
+ cooking=false;
+ }
+ }
+ else {
+ this.powerFraction_fr = 0;
+ }
+ //if (powerFraction_fr > 0 ) { traceln("Cooking event in progress!"); }
+ HOB.f_updateAllFlows(powerFraction_fr);
+ }
+
+ @Override
+ public void storeAndResetState() {
+ v_eventIndexStored = v_eventIndex;
+ storedStarttimes_min = new ArrayList<>(starttimes_min);
+ storedEndtimes_min = new ArrayList<>(endtimes_min);
+ starttimes_min = new ArrayList<>(initalStarttimes_min);
+ endtimes_min = new ArrayList<>(initalEndtimes_min);
+ v_eventIndex = 0;
+ }
+
+ @Override
+ public void restoreState() {
+ v_eventIndex = v_eventIndexStored;
+ starttimes_min = new ArrayList<>(storedStarttimes_min);
+ endtimes_min = new ArrayList<>(storedEndtimes_min);
+ }
+
+ @Override
+ public String toString() {
+ return super.toString();
+ }
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+
+}
+
+
+
+ 1707991094535
+ J_EAConversionElectrolyser
+ 1752677832758
+ /**
+ * J_EAConversionElektrolyser
+ */
+public class J_EAConversionElectrolyser extends zero_engine.J_EAConversion implements Serializable {
+
+ private OL_ElectrolyserState electrolyserState;
+ private int remainingPowerUpDuration_timesteps; // amount of time steps left in power up mode
+ private double startUpTimeStandby_h;
+ private double loadChangeTime_h;
+ private double startUpTimeShutdown_h;
+ private double startUpTimeIdle_h;
+ /**
+ /**
+ * Default constructor
+ */
+ public J_EAConversionElectrolyser() {
+ }
+
+ /**
+ * Constructor initializing the fields
+ */
+ public J_EAConversionElectrolyser(Agent parentAgent, double inputElectricCapacity_kW, double efficiency_r, double timestep_h, OL_ElectrolyserState electrolyserState, double loadChangeTime_s, double startUpTimeShutdown_s, double startUpTimeStandby_s, double startUpTimeIdle_s) {
+ this.parentAgent = parentAgent;
+ this.electrolyserState = electrolyserState;
+ this.inputCapacity_kW = inputElectricCapacity_kW;
+ this.eta_r = efficiency_r;
+ this.outputCapacity_kW = this.inputCapacity_kW * this.eta_r;
+ this.timestep_h = timestep_h;
+ this.startUpTimeStandby_h = startUpTimeStandby_s/3600;
+
+ this.loadChangeTime_h = loadChangeTime_s/3600;
+ this.startUpTimeShutdown_h = startUpTimeShutdown_s/3600;
+ this.startUpTimeIdle_h = startUpTimeIdle_s/3600;
+
+ this.energyAssetType = OL_EnergyAssetType.ELECTROLYSER;
+
+ this.energyCarrierProduced = OL_EnergyCarriers.HYDROGEN;
+ this.energyCarrierConsumed = OL_EnergyCarriers.ELECTRICITY;
+ this.assetFlowCategory = OL_AssetFlowCategories.electrolyserElectricityConsumption_kW;
+
+ this.activeProductionEnergyCarriers.add(this.energyCarrierProduced);
+ this.activeConsumptionEnergyCarriers.add(this.energyCarrierConsumed);
+ registerEnergyAsset();
+ }
+
+ @Override
+ public void f_updateAllFlows( double powerFraction_fr ) {
+ this.operate( min(1, max(0,powerFraction_fr)) );
+ if (parentAgent instanceof GridConnection) {
+ ((GridConnection)parentAgent).f_addFlows(flowsMap, this.energyUse_kW, assetFlowsMap, this);
+ }
+ this.lastFlowsMap.cloneMap(this.flowsMap);
+ this.lastEnergyUse_kW = this.energyUse_kW;
+ this.clear();
+ }
+
+ @Override
+ public void operate(double ratioOfCapacity) {
+ double electricityConsumption_kW = inputCapacity_kW * ratioOfCapacity;
+ double hydrogenProduction_kW = 0;
+ if (electrolyserState == OL_ElectrolyserState.POWER_UP) {
+ this.remainingPowerUpDuration_timesteps--;
+ }
+ else if (electrolyserState == OL_ElectrolyserState.IDLE) {
+ }
+ else {
+ hydrogenProduction_kW = electricityConsumption_kW * eta_r;
+ }
+
+ this.energyUse_kW = (electricityConsumption_kW - hydrogenProduction_kW);
+ this.energyUsed_kWh += energyUse_kW * timestep_h;
+
+ flowsMap.put(OL_EnergyCarriers.ELECTRICITY, electricityConsumption_kW);
+ flowsMap.put(OL_EnergyCarriers.HYDROGEN, -hydrogenProduction_kW);
+ assetFlowsMap.put(OL_AssetFlowCategories.electrolyserElectricityConsumption_kW, electricityConsumption_kW);
+ }
+
+ public void setElectrolyserState(OL_ElectrolyserState electrolyserState) { // Used for regime control
+ this.electrolyserState = electrolyserState;
+ }
+
+ public void setRemainingPowerUpDuration_timesteps(int remainingPowerUpDuration_timesteps) {
+ this.remainingPowerUpDuration_timesteps = remainingPowerUpDuration_timesteps;
+ }
+
+ public void setStartUpTimeStandby_h( double startUpTimeStandby_h ) {
+ this.startUpTimeStandby_h = startUpTimeStandby_h;
+ }
+
+ public void setLoadChangeTime_h( double loadChangeTime_h ) {
+ this.loadChangeTime_h = loadChangeTime_h;
+ }
+
+ public void setStartUpTimeShutdown_h( double startUpTimeShutdown_h ) {
+ this.startUpTimeShutdown_h = startUpTimeShutdown_h;
+ }
+
+ public void setStartUpTimeIdle_h( double startUpTimeIdle_h ) {
+ this.startUpTimeIdle_h = startUpTimeIdle_h;
+ }
+
+ @Override
+ public void setEta_r( double efficiency_r) {
+ this.eta_r = efficiency_r;
+ this.outputCapacity_kW = this.inputCapacity_kW * this.eta_r;
+ }
+
+ public OL_ElectrolyserState getState() { // Used for regime control
+ return this.electrolyserState;
+ }
+
+ public int getRemainingPowerUpDuration_timesteps() {
+ return this.remainingPowerUpDuration_timesteps;
+ }
+
+ public double getStartUpTimeStandby_h() {
+ return this.startUpTimeStandby_h;
+ }
+
+ public double getLoadChangeTime_h() {
+ return this.loadChangeTime_h;
+ }
+
+ public double getStartUpTimeShutdown_h() {
+ return this.startUpTimeShutdown_h;
+ }
+
+ public double getStartUpTimeIdle_h() {
+ return this.startUpTimeIdle_h;
+ }
+
+ @Override
+ public String toString() {
+ return this.energyAssetType + " in GC: " + this.parentAgent + ", "
+ + "Current state: " + this.electrolyserState + ", "
+ + "InputCapacity: " + this.inputCapacity_kW + " kW, "
+ + "with efficiency: " + this.eta_r + ", "
+ + "Current output: " + -this.getLastFlows().get(this.energyCarrierProduced) + " kW";
+ }
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+
+}
+
+
+ 1707992650964
+ J_EAConversionFuelCell
+ 1752677832758
+ /**
+ * J_EAConversionFuelCell
+ */
+public class J_EAConversionFuelCell extends zero_engine.J_EAConversion implements Serializable {
+
+ /**
+ /**
+ * Default constructor
+ */
+ public J_EAConversionFuelCell() {
+ }
+
+ /**
+ * Constructor initializing the fields
+ */
+
+ public J_EAConversionFuelCell(Agent parentAgent, double outputElectricCapacity_kW, double efficiency_r, double timestep_h) {
+ this.parentAgent = parentAgent;
+ this.outputCapacity_kW = outputElectricCapacity_kW;
+ this.eta_r = efficiency_r;
+ this.inputCapacity_kW = this.outputCapacity_kW / this.eta_r;
+ this.timestep_h = timestep_h;
+
+ this.energyAssetType = OL_EnergyAssetType.FUEL_CELL;
+
+ this.energyCarrierProduced = OL_EnergyCarriers.ELECTRICITY;
+ this.energyCarrierConsumed = OL_EnergyCarriers.HYDROGEN;
+ this.activeProductionEnergyCarriers.add(this.energyCarrierProduced);
+ this.activeConsumptionEnergyCarriers.add(this.energyCarrierConsumed);
+ registerEnergyAsset();
+ }
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+
+}
+
+
+ 1711009967838
+ J_EADieselVehicle
+ 1752677832758
+ /**
+ * J_EAConversionDieselVehicle
+ */
+public class J_EADieselVehicle extends J_EAVehicle implements Serializable {
+
+ private OL_EnergyCarriers energyCarrierConsumed = OL_EnergyCarriers.DIESEL;
+
+ /**
+ * Default constructor
+ */
+ public J_EADieselVehicle() {
+ }
+
+ /**
+ * Constructor initializing the fields
+ */
+ public J_EADieselVehicle(Agent ownerAssetAgent, double energyConsumption_kWhpkm, double timestep_h, double vehicleScaling, OL_EnergyAssetType energyAssetType, J_ActivityTrackerTrips tripTracker ) {
+ this.parentAgent = ownerAssetAgent;
+ this.energyConsumption_kWhpkm = energyConsumption_kWhpkm;
+ /*if (energyAssetType == OL_EnergyAssetType.DIESEL_VAN) {
+ traceln("DieselVan energyconsumption: %s", energyConsumption_kWhpkm);
+ }*/
+ this.timestep_h = timestep_h;
+ this.vehicleScaling = vehicleScaling;
+ this.energyAssetType = energyAssetType; //OL_EnergyAssetType.DIESEL_VEHICLE; // AANPASSING ATE, scheelt code in Interface
+ this.tripTracker = tripTracker;
+ if (tripTracker != null) {
+ tripTracker.Vehicle=this;
+ }
+ this.activeConsumptionEnergyCarriers.add(this.energyCarrierConsumed);
+ registerEnergyAsset();
+ }
+
+ @Override
+ public void f_updateAllFlows() {
+
+ flowsMap.put(OL_EnergyCarriers.DIESEL, this.energyUse_kW);
+
+ if (parentAgent instanceof GridConnection) {
+ ((GridConnection)parentAgent).f_addFlows(flowsMap, this.energyUse_kW, assetFlowsMap, this);
+ }
+ this.lastFlowsMap = flowsMap;
+ this.lastEnergyUse_kW = this.energyUse_kW;
+ /*if (Double.isNaN(this.energyUse_kW)) {
+ throw new RuntimeException("Diesel vehicle energyUse_kW is NaN!");
+ }*/
+ //Pair<J_FlowsMap, Double> flowspair = new Pair(this.flowsMap, this.energyUse_kW);
+ clear();
+ //return this.flowsMap;
+ }
+
+ /*public double[] operate(double ratioOfChargeCapacity_r) {
+ return returnEnergyFlows();
+ }*/
+
+ @Override
+ public boolean startTrip() {
+ if (available) {
+ this.available = false;
+ //traceln("Diesel vehicle starting trip!");
+ return true;
+ } else {
+ traceln("Trip not started because vehicle not available!");
+ return false; // Trip not started because vehicle not available!
+ }
+ }
+
+ @Override
+ public boolean endTrip(double tripDist_km) {
+
+ if(available) {
+ traceln("Trip not ended because vehicle never left!, tripIdentifier = " + tripTracker.tripPatternIdentifier);
+ return false;
+ } else {
+ this.available = true;
+ return true;
+ }
+ }
+
+ public boolean progressTrip(double marginalTripDist_km) {
+ if( available) {
+ traceln("Trip not updated because vehicle never left!");
+ return false;
+ }
+ else {
+ mileage_km += marginalTripDist_km;
+ double energyUsedThisTimestep_kWh = marginalTripDist_km * vehicleScaling * energyConsumption_kWhpkm;
+ energyUsed_kWh += energyUsedThisTimestep_kWh;
+ //dieselConsumption_kW = energyUsedThisTimestep_kWh / timestep_h;
+ energyUse_kW += energyUsedThisTimestep_kWh / timestep_h;
+ return true;
+ }
+ }
+
+ public double getEnergyUsed_kWh() {
+ return energyUsed_kWh;
+ }
+
+ @Override
+ public void storeStatesAndReset() {
+ // Each energy asset that has some states should overwrite this function!
+ energyUsedStored_kWh = energyUsed_kWh;
+ energyUsed_kWh = 0.0;
+ availableStored = available;
+ available = true;
+ mileage_km = 0;
+ clear();
+ }
+
+ @Override
+ public void restoreStates() {
+ // Each energy asset that has some states should overwrite this function!
+ energyUsed_kWh = energyUsedStored_kWh;
+ available = availableStored;
+ }
+
+
+ @Override
+ public String toString() {
+ return
+ "parentAgent = " + parentAgent +" " +
+ "energyConsumption_kWhpkm =" + energyConsumption_kWhpkm +" " +
+ "vehicleScaling = " + vehicleScaling;
+ }
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+
+}
+
+
+ 1715862850276
+ J_AVGC_data
+ 1752680962144
+ /**
+ * J_AVGC_data
+ */
+public class J_AVGC_data implements Serializable {
+ public double p_avgHouseGasConsumption_m3_yr;
+ public double p_avgHouseElectricityConsumption_kWh_yr;
+ public double p_avgEVMaxChargePowerVan_kW;
+ public double p_avgHouseConnectionCapacity_kW;
+ public OL_GridConnectionHeatingType p_avgHouseHeatingMethod;
+ public double p_avgNrOfCarsPerHouse;
+ public double p_ratioEVHousePersonalCars;
+ public double p_avgEVMaxChargePowerCar_kW;
+ public double p_avgEVMaxChargePowerTruck_kW;
+ public double p_avgEVStorageCar_kWh;
+ public double p_avgEVStorageVan_kWh;
+ public double p_avgHousePVInstallationPower_kWp;
+ public double p_avgEVStorageTruck_kWh;
+ public double p_ratioHouseInstalledPV;
+ public double p_gas_kWhpm3;
+ public double p_diesel_kWhpl;
+ public double p_gasoline_kWhpl;
+ public double p_waterHeatCapacity_JpkgK;
+ public double p_waterDensity_kgpm3;
+ public OL_GridConnectionHeatingType p_avgUtilityHeatingMethod;
+ public double p_avgUtilityConnectionCapacity_kW;
+ public double p_avgUtilityPVPower_kWp;
+ public double p_ratioElectricTrucks;
+ public OL_GridConnectionHeatingType p_avgCompanyHeatingMethod;
+
+ public double p_hydrogenEnergyDensity_kWh_Nm3;
+ public double p_hydrogenSpecificEnergy_kWh_kg;
+ public double p_hydrogenDensity_kg_Nm3;
+ public double p_oxygenDensity_kg_Nm3;
+ public double p_oxygenProduction_kgO2pkgH2;
+
+ public double p_avgEVEnergyConsumptionCar_kWhpkm;
+ public double p_avgEVEnergyConsumptionVan_kWhpkm;
+ public double p_avgEVEnergyConsumptionTruck_kWhpkm;
+ public double p_avgDieselConsumptionCar_kmpl;
+ public double p_avgGasolineConsumptionCar_kmpl;
+ public double p_avgDieselConsumptionCar_kWhpkm;
+ public double p_avgGasolineConsumptionCar_kWhpkm;
+ public double p_avgDieselConsumptionVan_kmpl;
+ public double p_avgDieselConsumptionVan_kWhpkm;
+ public double p_avgDieselConsumptionTruck_kmpl;
+ public double p_avgDieselConsumptionTruck_kWhpkm;
+ public double p_avgHydrogenConsumptionCar_kWhpkm;
+ public double p_avgHydrogenConsumptionVan_kWhpkm;
+ public double p_avgHydrogenConsumptionTruck_kWhpkm;
+
+ public double p_avgCOPHeatpump;
+ public double p_avgEfficiencyHeatpump_fr;
+ public double p_avgOutputTemperatureElectricHeatpump_degC;
+ public double p_avgOutputTemperatureHybridHeatpump_degC;
+ public double p_minHeatpumpElectricCapacity_kW;
+
+ public double p_avgEfficiencyGasBurner_fr;
+ public double p_avgOutputTemperatureGasBurner_degC;
+ public double p_minGasBurnerOutputCapacity_kW;
+
+ public double p_avgEfficiencyHydrogenBurner_fr;
+ public double p_avgOutputTemperatureHydrogenBurner_degC;
+ public double p_minHydrogenBurnerOutputCapacity_kW;
+
+ public double p_avgEfficiencyDistrictHeatingDeliverySet_fr;
+ public double p_avgOutputTemperatureDistrictHeatingDeliverySet_degC;
+ public double p_minDistrictHeatingDeliverySetOutputCapacity_kW;
+
+
+ public double p_avgPVPower_kWpm2;
+ public double p_avgAnnualProductionPV_kWhpWp;
+ public double p_avgRatioRoofPotentialPV;
+ public double p_avgRatioBatteryCapacity_v_Power;
+ public double p_avgRatioHouseBatteryStorageCapacity_v_PVPower;
+ public double p_avgSolarFieldPower_kWppha;
+ public double p_avgEfficiencyCHP_thermal_fr;
+ public double p_avgEfficiencyCHP_electric_fr;
+ public double p_avgOutputTemperatureCHP_degC;
+
+ public double p_v1gProbability;
+ public double p_v2gProbability;
+ public int p_avgEVsPerPublicCharger;
+ public double p_avgPTPower_kWpm2;
+ public double p_avgPTPanelSize_m2;
+ public double p_avgMaxHeatBufferTemperature_degC;
+ public double p_avgMinHeatBufferTemperature_degC;
+ public double p_avgHeatBufferWaterVolumePerPTSurface_m3pm2;
+ public double p_avgHeatBufferWaterVolumePerHPPower_m3pkW;
+ public double p_avgAnnualTravelDistancePrivateCar_km;
+ public double p_avgAnnualTravelDistanceCompanyCar_km;
+ public double p_avgAnnualTravelDistanceVan_km;
+ public double p_avgAnnualTravelDistanceTruck_km;
+ /**
+ * Default constructor
+ */
+ public J_AVGC_data() {
+ }
+
+ @Override
+ public String toString() {
+ return super.toString();
+ }
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+
+}
+
+
+ 1726148464063
+ J_Address
+ 1752680962144
+ /**
+ * J_Address
+ */
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
+import com.fasterxml.jackson.annotation.JsonIdentityInfo;
+import com.fasterxml.jackson.annotation.ObjectIdGenerators;
+
+@JsonAutoDetect(
+ fieldVisibility = Visibility.ANY, // ✅ only public fields are serialized
+ getterVisibility = Visibility.NONE,
+ isGetterVisibility = Visibility.NONE,
+ setterVisibility = Visibility.NONE,
+ creatorVisibility = Visibility.NONE
+)
+@JsonIdentityInfo(generator = ObjectIdGenerators.UUIDGenerator.class, property = "@id")
+
+public class J_Address implements Serializable {
+
+ private String streetName;
+ private int houseNumber;
+ private String houseLetter;
+ private String houseAddition;
+ private String postalcode;
+ private String city;
+
+ /**
+ * Default constructor
+ */
+ public J_Address() {
+ }
+
+ public String getAddress() {
+ StringBuilder sb = new StringBuilder();
+
+ if ( this.streetName != null ) {
+ sb.append(this.streetName);
+ }
+ else {
+ sb.append("Onbekend adres");
+ return sb.toString();
+ }
+ sb.append(" ");
+ sb.append(this.houseNumber);
+ if ( this.houseLetter != null ) {
+ sb.append(" ");
+ sb.append(this.houseLetter);
+ }
+ if ( this.houseAddition != null ) {
+ sb.append(" ");
+ sb.append(this.houseAddition);
+ }
+ if ( this.postalcode != null || this.city != null) {
+ sb.append(",");
+ }
+ if ( this.postalcode != null ){
+ sb.append(" ");
+ sb.append(this.postalcode);
+ }
+ if ( this.city != null ){
+ sb.append(" ");
+ sb.append(this.city);
+ }
+
+ return sb.toString();
+ }
+
+
+ public void setStreetName( String streetName ) {
+ this.streetName = streetName;
+ }
+ public void setHouseNumber( int houseNumber ) {
+ this.houseNumber = houseNumber;
+ }
+ public void setHouseLetter( String houseLetter ) {
+ this.houseLetter = houseLetter;
+ }
+ public void setHouseAddition( String houseAddition ) {
+ this.houseAddition = houseAddition;
+ }
+ public void setPostalcode( String postalcode ) {
+ this.postalcode = postalcode;
+ }
+ public void setCity( String city ) {
+ this.city = city;
+ }
+
+ public String getStreetName() {
+ return this.streetName;
+ }
+ public int getHouseNumber() {
+ return this.houseNumber;
+ }
+ public String getHouseLetter() {
+ return this.houseLetter;
+ }
+ public String getHouseAddition() {
+ return this.houseAddition;
+ }
+ public String getPostalcode() {
+ return this.postalcode;
+ }
+ public String getCity() {
+ return this.city;
+ }
+
+ @Override
+ public String toString() {
+ return "J_Address(" + getAddress() + ")";
+ }
+
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+
+}
+
+
+ 1727774738469
+ J_ProfileForecaster
+ /**
+ * J_ProfileForecaster
+ */
+public class J_ProfileForecaster implements Serializable {
+
+ public String name = "";
+ public J_ProfilePointer profilePointer;
+ public double forecastTime_h = 0;
+ public double timeStep_h = 0;
+ private double currentForecast = 0;
+
+ /**
+ * Default constructor
+ */
+ public J_ProfileForecaster() {
+
+ }
+
+ public J_ProfileForecaster(String forecastName, J_ProfilePointer pp, double forecastTime_h, double currentTime_h, double timeStep_h) {
+ if (forecastName == null) {
+ this.name = pp.name + " " + forecastTime_h + " h";
+ }
+ else {
+ this.name = forecastName;
+ }
+ this.profilePointer = pp;
+ this.forecastTime_h = forecastTime_h;
+ this.timeStep_h = timeStep_h;
+ this.initializeForecast(currentTime_h);
+ }
+
+ public void initializeForecast(double currentTime_h) {
+ this.currentForecast = 0;
+ for (double t_h = currentTime_h; t_h < currentTime_h + this.forecastTime_h; t_h += this.timeStep_h) {
+ this.currentForecast += this.profilePointer.getValue(t_h) / (this.forecastTime_h/this.timeStep_h);
+ }
+ }
+
+ public void updateForecast(double t_h) {
+ this.currentForecast += (this.profilePointer.getValue(t_h + this.forecastTime_h) - this.profilePointer.getValue(t_h)) / (this.forecastTime_h/this.timeStep_h);
+ }
+
+ public double getForecast() {
+ return this.currentForecast;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public double getForecastTime_h() {
+ return this.forecastTime_h;
+ }
+
+ @Override
+ public String toString() {
+ return "forecast name: " + this.name + ", current forecast: " + this.currentForecast;
+ }
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+
+}
+
+
+ 1727775512403
+ J_ProfilePointer
+ /**
+ * J_ProfilePointer
+ */
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
+import com.fasterxml.jackson.annotation.JsonIdentityInfo;
+import com.fasterxml.jackson.annotation.ObjectIdGenerators;
+
+@JsonAutoDetect(
+ fieldVisibility = Visibility.PROTECTED_AND_PUBLIC, // ✅ only public fields are serialized
+ getterVisibility = Visibility.NONE,
+ isGetterVisibility = Visibility.NONE,
+ setterVisibility = Visibility.NONE,
+ creatorVisibility = Visibility.NONE
+)
+@JsonIdentityInfo(generator = ObjectIdGenerators.UUIDGenerator.class, property = "@id")
+
+public class J_ProfilePointer implements Serializable {
+ public String name = "";
+ private double currentValue = 0;
+ private TableFunction tableFunction;
+
+ /**
+ * Default constructor
+ */
+ public J_ProfilePointer() {
+
+ }
+
+ public J_ProfilePointer(String name, TableFunction tableFunction) {
+ this.name = name;
+ this.tableFunction = tableFunction;
+ }
+
+ public void updateValue(double t_h) {
+ this.currentValue = this.tableFunction.get(t_h);
+ }
+
+ public double getCurrentValue() {
+ return this.currentValue;
+ }
+
+ public double getValue(double t_h) {
+ return this.tableFunction.get(t_h);
+ }
+
+ public double[] getAllValues() {
+ return this.tableFunction.getValues();
+ }
+
+ public TableFunction getTableFunction() {
+ return tableFunction;
+ }
+
+ public void setTableFunction(TableFunction tf) {
+ this.tableFunction = tf;
+ }
+
+ @Override
+ public String toString() {
+ return "profile: " + this.name + " current value: " + this.currentValue;
+ }
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+
+}
+
+
+ 1729171686537
+ J_FlowsMapEnumMap
+ true
+ 1752737189062
+ /**
+ * J_FlowsMap
+ */
+import java.util.EnumMap;
+
+public class J_FlowsMapEnumMap extends EnumMap<OL_EnergyCarriers, Double> {
+
+ /**
+ * Default constructor
+ */
+ public J_FlowsMapEnumMap() {
+ super(OL_EnergyCarriers.class);
+ }
+
+ @Override
+ public Double get(Object key) {
+ if (super.get(key) == null) {
+ return 0.0;
+ }
+ else {
+ return super.get(key);
+ }
+
+ }
+
+ public J_FlowsMap addFlows( J_FlowsMap f) {
+ for (OL_EnergyCarriers key : f.keySet()) {
+ this.addFlow(key, f.get(key));
+ }
+ return this;
+ }
+
+ public J_FlowsMap addFlow ( OL_EnergyCarriers key, double value) {
+ double currentValue = this.get(key);
+ this.put(key, currentValue + value);
+ return this;
+ }
+
+ public J_FlowsMap cloneMap(J_FlowsMap flowsMap) {
+ //J_FlowsMap flowsMap = new J_FlowsMapEnumMap();
+ this.clear();
+ //this.addFlows(flowsMap);
+ this.putAll(flowsMap);
+ return this;
+ }
+
+ /*
+ public J_FlowsMap addReducedFlows( J_FlowsMap f) {
+ for (OL_EnergyCarriers key : f.keySet()) {
+ this.put(key, this.get(key) + f.get(key));
+ }
+ return this;
+ }
+ */
+
+ @Override
+ public String toString() {
+ return super.toString();
+ }
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+
+}
+
+/**
+ * J_FlowsMap
+ */
+
+//import java.util.EnumMap;
+
+//public class J_FlowsMap extends EnumMap<OL_FlowsMapKeys, Double> {
+
+ /**
+ * Default constructor
+ */
+ /* public J_FlowsMapEnumMap() {
+ super(OL_FlowsMapKeys.class);
+ }
+
+ @Override
+ public Double get(Object key) {
+ if (super.get(key) == null) {
+ return 0.0;
+ }
+ else {
+ return super.get(key);
+ }
+
+ }
+
+ public void clear() {
+ for (OL_FlowsMapKeys key : this.keySet()) {
+ this.remove(key);
+ }
+ }
+
+ public J_FlowsMap addFlows( J_FlowsMap f) {
+ for (OL_FlowsMapKeys key : f.keySet()) {
+ this.put(key, this.get(key) + f.get(key));
+ }
+ return this;
+ }
+
+ public J_FlowsMap addFlow ( OL_FlowsMapKeys key, double value) {
+ double currentValue = this.get(key);
+ this.put(key, currentValue + value);
+ return this;
+ }
+
+ public J_FlowsMap addReducedFlows ( J_FlowsMap f) {
+ for (OL_EnergyCarriers energyCarrier : f.keySet()) {
+ if (f.get(energyCarrier) < 0 ) { //production
+ OL_FlowsMapKeys key = translateMapKeys(energyCarrier, false);
+ this.put(key, this.get(key) - f.get(energyCarrier));
+ }
+ else { // consumption
+ OL_FlowsMapKeys key = translateMapKeys(energyCarrier, true);
+ this.put(key, this.get(key) + f.get(energyCarrier));
+
+ }
+ }
+ return this;
+ }
+
+ // TODO: test if a hardcoded enummap is faster (probably place it on the energyModel canvas)
+ public OL_FlowsMapKeys translateMapKeys(OL_EnergyCarriers energyCarrier, boolean isConsumption) {
+ if (isConsumption) {
+ switch (energyCarrier) {
+ case ELECTRICITY:
+ return ELECTRICITY_CONSUMPTION_KW;
+ case HEAT:
+ return HEAT_CONSUMPTION_KW;
+ case METHANE:
+ return METHANE_CONSUMPTION_KW;
+ case DIESEL:
+ return DIESEL_CONSUMPTION_KW;
+ case HYDROGEN:
+ return HYDROGEN_CONSUMPTION_KW;
+ default:
+ throw new RuntimeException("Incorrect FlowsMapKey in translateMapKeys");
+ }
+ }
+ else {
+ switch (energyCarrier) {
+ case ELECTRICITY:
+ return ELECTRICITY_PRODUCTION_KW;
+ case HEAT:
+ return HEAT_PRODUCTION_KW;
+ case METHANE:
+ return METHANE_PRODUCTION_KW;
+ case DIESEL:
+ return DIESEL_PRODUCTION_KW;
+ case HYDROGEN:
+ return HYDROGEN_PRODUCTION_KW;
+ default:
+ throw new RuntimeException("Incorrect FlowsMapKey in translateMapKeys");
+ }
+ }
+ }
+
+ public J_FlowsMap getProductionFlows() {
+ J_FlowsMap flowsMap = new J_FlowsMapEnumMap();
+ for (OL_EnergyCarriers energyCarrier : OL_EnergyCarriers.values()) {
+ OL_FlowsMapKeys key = translateMapKeys(energyCarrier, false);
+ flowsMap.put(energyCarrier, this.get(key));
+ }
+ return flowsMap;
+ }
+
+ public J_FlowsMap getConsumptionFlows() {
+ J_FlowsMap flowsMap = new J_FlowsMapEnumMap();
+ for (OL_EnergyCarriers energyCarrier : OL_EnergyCarriers.values()) {
+ OL_FlowsMapKeys key = translateMapKeys(energyCarrier, true);
+ flowsMap.put(energyCarrier, this.get(key));
+ }
+ return flowsMap;
+ }
+
+ public double getNetFlow(OL_EnergyCarriers key) {
+ double consumptionFlow = this.get(translateMapKeys(key, true));
+ double productionFlow = this.get(translateMapKeys(key, false));
+ return consumptionFlow - productionFlow;
+ }
+
+ @Override
+ public String toString() {
+ return super.toString();
+ }
+*/
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+// private static final long serialVersionUID = 1L;
+
+//}
+
+
+ 1729262288167
+ J_DataSetMap
+ 1752679379816
+ /**
+ * J_DataSetMap
+ */
+//import java.util.EnumMap;
+import java.util.EnumSet;
+import com.fasterxml.jackson.annotation.JsonIgnoreType;
+@JsonIgnoreType
+public class J_DataSetMap <E extends Enum<E>> implements Serializable {
+ private DataSet[] datasetArray; // = new DataSet[OL_EnergyCarriers.values().length]; // Use array with size of all possible energyCarriers; more than strictly needed but memory footprint is negligable anyway.;
+ //private EnumSet<OL_EnergyCarriers> enumSet = EnumSet.noneOf(OL_EnergyCarriers.class);
+ private final EnumSet<E> enumSet;
+ private final Class<E> enumClass;
+
+ /**
+ * Default constructor
+ */
+ public J_DataSetMap(Class<E> enumClass) {
+ this.enumClass = enumClass;
+ this.enumSet = EnumSet.noneOf(enumClass);
+ this.datasetArray = new DataSet[enumClass.getEnumConstants().length];
+ //super(OL_EnergyCarriers.class);
+ }
+
+ public void createEmptyDataSets(EnumSet<E> selectedFlows, int size) {
+ for (E key : selectedFlows) {
+ this.put(key, new DataSet(size));
+ }
+ }
+
+ public DataSet get(E key) {
+ return datasetArray[key.ordinal()];
+ }
+
+
+ public void put(E key, DataSet ds) {
+ datasetArray[key.ordinal()] = ds;
+ enumSet.add(key);
+ }
+
+ public void clear() {
+ datasetArray = new DataSet[enumClass.getEnumConstants().length];
+ enumSet.clear();
+ }
+
+ public EnumSet<E> keySet() {
+ return enumSet;
+ }
+
+ @Override
+ public String toString() {
+ if (this.enumSet.size() == 0) {
+ return "{}";
+ }
+ StringBuilder sb = new StringBuilder();
+ sb.append('{');
+ for (E key : this.enumSet) {
+ DataSet value = this.get(key);
+ int len = value.toString().length();
+ sb.append(key);
+ sb.append(" = ");
+ sb.append(value.toString().substring(0,min(400, len)));
+ sb.append(", \n");
+ }
+ sb.delete(sb.length()-4, sb.length());
+ sb.append('}');
+ return sb.toString();
+ }
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+
+}
+
+
+ 1729510354900
+ J_AssetFlowsAccumulatorMap
+ true
+ 1752679379816
+ /**
+ * J_AssetFlowsAccumulatorMap
+ */
+//import java.util.EnumMap;
+import java.util.EnumSet;
+//import zeroPackage.ZeroAccumulator;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreType;
+@JsonIgnoreType
+public class J_AssetFlowsAccumulatorMap implements Serializable {
+
+ private ZeroAccumulator[] accumulatorArray = new ZeroAccumulator[OL_AssetFlowCategories.values().length]; // Use array with size of all possible energyCarriers; more than strictly needed but memory footprint is negligable anyway.;
+ private EnumSet<OL_AssetFlowCategories> assetFlowsList = EnumSet.noneOf(OL_AssetFlowCategories.class);
+
+ /**
+ * Default constructor
+ */
+ public J_AssetFlowsAccumulatorMap() {
+ //super(OL_EnergyCarriers.class);
+ }
+
+ public void createEmptyAccumulators(EnumSet<OL_AssetFlowCategories> selectedFlows, boolean hasTimeSeries, double signalResolution_h, double duration_h) {
+ for (OL_AssetFlowCategories key : selectedFlows) {
+ this.put(key, new ZeroAccumulator(hasTimeSeries, signalResolution_h, duration_h));
+ }
+ }
+
+ public J_AssetFlowsAccumulatorMap getClone() {
+ J_AssetFlowsAccumulatorMap am = new J_AssetFlowsAccumulatorMap();
+ for (var EC : this.assetFlowsList) {
+ am.put(EC, accumulatorArray[EC.ordinal()].getClone());
+ }
+ return am;
+ }
+
+ public ZeroAccumulator get(OL_AssetFlowCategories key) {
+ return accumulatorArray[key.ordinal()];
+ }
+
+
+ public void put(OL_AssetFlowCategories key, ZeroAccumulator acc) {
+ accumulatorArray[key.ordinal()] = acc;
+ assetFlowsList.add(key);
+ }
+ /*
+ public double totalSum() {
+ double totalSum = 0.0;
+ for (var EC : assetFlowsList) {
+ totalSum += accumulatorArray[EC.ordinal()].getSum();
+ }
+ return totalSum;
+ }
+ */
+ /*public double totalIntegral_kWh() {
+ double totalIntegral_kWh = 0.0;
+ for (var EC : assetFlowsList) {
+ totalIntegral_kWh += accumulatorArray[EC.ordinal()].getIntegral_kWh();
+ }
+ return totalIntegral_kWh;
+ }
+
+ public double totalIntegral_MWh() {
+ return this.totalIntegral_kWh() / 1000;
+ }
+
+ public double totalIntegralPos_kWh() {
+ double totalIntegralPos_kWh = 0.0;
+ for (var EC : assetFlowsList) {
+ totalIntegralPos_kWh += accumulatorArray[EC.ordinal()].getIntegralPos_kWh();
+ }
+ return totalIntegralPos_kWh;
+ }
+
+ public double totalIntegralPos_MWh() {
+ return this.totalIntegralPos_kWh() / 1000;
+ }
+
+ public double totalIntegralNeg_kWh() {
+ double totalIntegralNeg_kWh = 0.0;
+ for (var EC : assetFlowsList) {
+ totalIntegralNeg_kWh += accumulatorArray[EC.ordinal()].getIntegralNeg_kWh();
+ }
+ return totalIntegralNeg_kWh;
+ }
+
+ public double totalIntegralNeg_MWh() {
+ return this.totalIntegralNeg_kWh() / 1000;
+ }
+ */
+
+ public void clear() {
+ accumulatorArray = new ZeroAccumulator[OL_EnergyCarriers.values().length];
+ assetFlowsList.clear();
+ }
+
+ public void reset() {
+ for (var EC : assetFlowsList) {
+ accumulatorArray[EC.ordinal()].reset();
+ }
+ }
+
+ public J_AssetFlowsAccumulatorMap add( J_AssetFlowsAccumulatorMap accumulatorMap ) {
+ for (var EC : accumulatorMap.assetFlowsList) {
+ if (!this.assetFlowsList.contains(EC)) {
+ // make a new one?
+ throw new RuntimeException("Tried to add an AccumulatorMap with a new EnergyCarrier.");
+ }
+ this.get(EC).add(accumulatorMap.get(EC));
+ }
+ return this;
+ }
+
+ public J_AssetFlowsAccumulatorMap subtract( J_AssetFlowsAccumulatorMap accumulatorMap ) {
+ for (var EC : accumulatorMap.assetFlowsList) {
+ if (!this.assetFlowsList.contains(EC)) {
+ // make a new one?
+ throw new RuntimeException("Tried to subtract an AccumulatorMap with a new EnergyCarrier.");
+ }
+ this.get(EC).subtract(accumulatorMap.get(EC));
+ }
+ return this;
+ }
+
+ /*
+ public J_DataSetMap getDataSetMap( double startTime_h ) {
+ J_DataSetMap dsm = new J_DataSetMap();
+ for (var EC : this.assetFlowsList) {
+ dsm.put(EC, this.get(EC).getDataSet(startTime_h));
+ }
+ return dsm;
+ }
+ */
+
+ public String toString() {
+ if (this.accumulatorArray.length == 0) {
+ return "{}";
+ }
+ StringBuilder sb = new StringBuilder();
+ sb.append('{');
+ for (OL_AssetFlowCategories key : this.assetFlowsList) {
+ ZeroAccumulator acc = this.get(key);
+ //double value = this.get(key);
+ if (acc.getIntegral_kWh() == 0.0) {
+ continue;
+ }
+
+ sb.append(key);
+ sb.append(" ");
+ sb.append(acc.toString());
+ //sb.append(" = ");
+ //sb.append(value);
+ sb.append(", ");
+ }
+ //sb.delete(sb.length()-2, sb.length());
+ sb.append('}');
+ return sb.toString();
+ }
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+
+}
+
+
+ 1729586334721
+ J_ReducedFlowsMap
+ true
+ 1752737189062
+ /**
+ * J_ReducedFlowsMap
+ */
+import java.util.EnumMap;
+
+public class J_ReducedFlowsMap extends EnumMap<OL_EnergyCarriers, Double> {
+
+ /**
+ * Default constructor
+ */
+ public J_ReducedFlowsMap() {
+ super(OL_EnergyCarriers.class);
+ }
+
+ @Override
+ public Double get(Object key) {
+ if (super.get(key) == null) {
+ return 0.0;
+ }
+ else {
+ return super.get(key);
+ }
+
+ }
+
+ public void clear() {
+ for (OL_EnergyCarriers key : this.keySet()) {
+ this.remove(key);
+ }
+ }
+
+ public J_ReducedFlowsMap addFlow ( OL_EnergyCarriers key, double value) {
+ double currentValue = this.get(key);
+ this.put(key, currentValue + value);
+ return this;
+ }
+
+ public J_ReducedFlowsMap addReducedFlows( J_FlowsMap f) {
+ for (OL_EnergyCarriers key : f.keySet()) {
+ this.put(key, this.get(key) + f.get(key));
+ }
+ return this;
+ }
+
+ @Override
+ public String toString() {
+ return super.toString();
+ }
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+
+}
+
+
+ 1731483284975
+ J_FlowsMap
+ 1752679379816
+ /**
+ * J_FlowsMap
+ */
+import zeroPackage.ZeroMath;
+import java.util.EnumSet;
+import com.fasterxml.jackson.annotation.JsonIgnoreType;
+@JsonIgnoreType
+public class J_FlowsMap implements Serializable {
+
+ private double[] valuesArray = new double[OL_EnergyCarriers.values().length]; // Use array with size of all possible energyCarriers; more than strictly needed but memory footprint is negligable anyway.;
+ private EnumSet<OL_EnergyCarriers> energyCarrierList = EnumSet.noneOf(OL_EnergyCarriers.class);
+ /**
+ * Default constructor
+ */
+ public J_FlowsMap() {
+
+ }
+
+ public final double get(OL_EnergyCarriers key) {
+ return valuesArray[key.ordinal()];
+ }
+
+
+ public final void put(OL_EnergyCarriers key, double value) {
+ valuesArray[key.ordinal()] = value;
+ energyCarrierList.add(key);
+ }
+
+ public final void clear() {
+ energyCarrierList.clear();
+ Arrays.fill(valuesArray, 0.0);
+ /*for(int i=0; i<valuesArray.length; i++) {
+ valuesArray[i]=0.0;
+ }*/
+ }
+
+ //public J_FlowsMap addFlows( J_FlowsMap f) {
+ public final J_FlowsMap addFlowsSlow( J_FlowsMap f) {
+ for (OL_EnergyCarriers key : f.energyCarrierList) {
+ this.addFlow(key, f.get(key));
+ }
+ return this;
+ }
+
+ //public J_FlowsMap addToExistingFlows( J_FlowsMap f) {
+ public final J_FlowsMap addFlows( J_FlowsMap f) {
+ int len = valuesArray.length;
+ for(int i=0; i<len; i++) {
+ //this.valuesArray[i]=this.valuesArray[i]+f.valuesArray[i];
+ this.valuesArray[i]+=f.valuesArray[i];
+ }
+ this.energyCarrierList.addAll(f.energyCarrierList);
+ return this;
+ }
+
+ public final J_FlowsMap addFlow( OL_EnergyCarriers key, double value) {
+ energyCarrierList.add(key);
+ this.valuesArray[key.ordinal()]+=value;
+ //double currentValue = this.get(key);
+ //this.put(key, currentValue + value);
+ return this;
+ }
+
+ public final J_FlowsMap cloneMap(J_FlowsMap flowMap) {
+ //this.clear();
+ //this.addFlows(flowMap);
+
+ // Custom 'addflows' version that doesn't add, just 'copies'. Might be faster?
+ int len = valuesArray.length;
+ for(int i=0; i<len; i++) {
+ this.valuesArray[i]=flowMap.valuesArray[i];
+ }
+
+ //this.energyCarrierList = flowMap.energyCarrierList.clone(); // This or first clear list and then addAll? Which is faster?
+ this.energyCarrierList.clear();
+ this.energyCarrierList.addAll(flowMap.energyCarrierList);
+ return this;
+ }
+
+ public double totalSum() {
+ return ZeroMath.arraySum(valuesArray);
+ }
+
+ public final EnumSet<OL_EnergyCarriers> keySet(){
+ return energyCarrierList;
+ }
+
+ public String toString() {
+ if (this.energyCarrierList.size() == 0) {
+ return "{}";
+ }
+ StringBuilder sb = new StringBuilder();
+ sb.append('{');
+ for (OL_EnergyCarriers key : this.energyCarrierList) {
+ double value = this.get(key);
+ sb.append(key);
+ sb.append(" = ");
+ sb.append(value);
+ sb.append("\n ");
+ }
+ sb.delete(sb.length()-2, sb.length());
+ sb.append('}');
+ return sb.toString();
+ }
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+
+}
+
+
+ 1737025326025
+ J_LoadDurationCurves
+ /**
+ * J_LoadDurationCurves
+ */
+public class J_LoadDurationCurves implements Serializable {
+ private boolean firstRun = true;
+ private EnergyModel energyModel;
+
+ public int arraySize;
+ private double[] netLoadArrayAnnual_kW;
+ public double[] loadDuractionCurveTotal_kW;
+ private double[] netLoadArraySummerweek_kW;
+ private double[] netLoadArrayWinterweek_kW;
+ private double[] netLoadArrayDaytime_kW;
+ private double[] netLoadArrayNighttime_kW;
+ private double[] netLoadArrayWeekday_kW;
+ private double[] netLoadArrayWeekend_kW;
+ public DataSet ds_loadDurationCurveTotal_kW;
+ //area.v_dataNetbelastingDuurkrommeYearVorige_kW = new DataSet(roundToInt(365*24/energyModel.p_timeStep_h));
+
+ public DataSet ds_loadDurationCurveSummer_kW;// = new DataSet(roundToInt(7*24/energyModel.p_timeStep_h));
+ public DataSet ds_loadDurationCurveWinter_kW;// = new DataSet(roundToInt(7*24/energyModel.p_timeStep_h));
+ public DataSet ds_loadDurationCurveDaytime_kW;// = new DataSet(roundToInt((energyModel.p_runEndTime_h-energyModel.p_runStartTime_h)/2/energyModel.p_timeStep_h));
+ public DataSet ds_loadDurationCurveNighttime_kW;// = new DataSet(roundToInt((energyModel.p_runEndTime_h-energyModel.p_runStartTime_h)/2/energyModel.p_timeStep_h));
+ public DataSet ds_loadDurationCurveWeekday_kW;// = new DataSet(roundToInt(arraySize/7.0*5)+100);
+ public DataSet ds_loadDurationCurveWeekend_kW;// = new DataSet(roundToInt(arraySize/7.0*2)+100);
+
+ public DataSet ds_previousLoadDurationCurveTotal_kW;
+ /**
+ * Default constructor
+ */
+ public J_LoadDurationCurves() {
+ }
+
+ public J_LoadDurationCurves(double[] loadArray_kW, EnergyModel energyModel) {
+ this.energyModel = energyModel;
+ calculateLoadDurationCurves(loadArray_kW);
+ }
+
+ public void calculateLoadDurationCurves(double[] loadArray_kW) {
+ this.arraySize = loadArray_kW.length;
+ if (ds_loadDurationCurveTotal_kW != null) {
+ if (ds_previousLoadDurationCurveTotal_kW != null) { // Not second run either!
+ ds_previousLoadDurationCurveTotal_kW.reset();
+ } else {
+ ds_previousLoadDurationCurveTotal_kW = new DataSet(arraySize);
+ }
+ firstRun = false;
+ }
+
+ this.netLoadArrayAnnual_kW = Arrays.copyOf(loadArray_kW,arraySize);
+ this.loadDuractionCurveTotal_kW = new double[arraySize];
+ this.netLoadArraySummerweek_kW = new double[roundToInt(168 / energyModel.p_timeStep_h)];
+ this.netLoadArrayWinterweek_kW= new double[roundToInt(168 / energyModel.p_timeStep_h)];
+ this.netLoadArrayDaytime_kW = new double[arraySize/2];
+ this.netLoadArrayNighttime_kW = new double[arraySize/2];
+ // For different years the amount of weekdays and weekend days may be different, so the size will be variable for now
+ ArrayList<Double> listNetLoadArrayWeekday_kW = new ArrayList<>();
+ ArrayList<Double> listNetLoadArrayWeekend_kW = new ArrayList<>();
+
+ int i_winter=0;
+ int i_summer=0;
+ int i_day=0;
+ int i_night=0;
+ int i_weekday=0;
+ int i_weekend=0;
+
+ int maxIndex = 0; // index with peak import
+ for (int i = 1; i < loadArray_kW.length; i++) {
+ if (loadArray_kW[i] > loadArray_kW[maxIndex]) {
+ maxIndex = i;
+ }
+ }
+
+ int minIndex = 0; // index with peak export
+ for (int i = 1; i < loadArray_kW.length; i++) {
+ if (loadArray_kW[i] < loadArray_kW[minIndex]) {
+ minIndex = i;
+ }
+ }
+ //double[] annualElectricityBalanceTimeSeries_kW = acc_annualElectricityBalance_kW.getTimeSeries();
+ boolean replaceSummerWinterWithPeaks = true;
+
+ for(int i=0; i<arraySize ; i++) {
+ if (!firstRun) {
+ // First we make sure to store our previous Load Curve
+ ds_previousLoadDurationCurveTotal_kW.add(i*energyModel.p_timeStep_h,ds_loadDurationCurveTotal_kW.getY(i));
+ }
+
+ if (replaceSummerWinterWithPeaks) {
+ // peak weeks
+ if (i >= (minIndex - roundToInt(84 / energyModel.p_timeStep_h)) && i < (minIndex + roundToInt(84 / energyModel.p_timeStep_h)) ) {
+ netLoadArraySummerweek_kW[i_summer]=-netLoadArrayAnnual_kW[i];
+ i_summer++;
+ }
+
+ if (i >= (maxIndex - roundToInt(84 / energyModel.p_timeStep_h)) && i < (maxIndex + roundToInt(84 / energyModel.p_timeStep_h)) ) {
+ netLoadArrayWinterweek_kW[i_winter]=-netLoadArrayAnnual_kW[i];
+ i_winter++;
+ }
+ } else {
+ // summer/winter
+ if (energyModel.p_runStartTime_h + i*energyModel.p_timeStep_h > energyModel.p_startOfSummerWeek_h && energyModel.p_runStartTime_h + i*energyModel.p_timeStep_h<= energyModel.p_startOfSummerWeek_h+24*7) {
+ netLoadArraySummerweek_kW[i_summer]=-netLoadArrayAnnual_kW[i];
+ i_summer++;
+ }
+ if (energyModel.p_runStartTime_h + i*energyModel.p_timeStep_h > energyModel.p_startOfWinterWeek_h && energyModel.p_runStartTime_h + i*energyModel.p_timeStep_h<= energyModel.p_startOfWinterWeek_h+24*7) {
+ netLoadArrayWinterweek_kW[i_winter]=-netLoadArrayAnnual_kW[i];
+ i_winter++;
+ }
+ }
+
+ // day/night
+ if (i*energyModel.p_timeStep_h % 24 > 6 && i*energyModel.p_timeStep_h % 24 <= 18) { //daytime
+ netLoadArrayDaytime_kW[i_day]=-netLoadArrayAnnual_kW[i];
+ i_day++;
+ } else {
+ netLoadArrayNighttime_kW[i_night]=-netLoadArrayAnnual_kW[i];
+ i_night++;
+ }
+ //Weekday/weekend
+ if (((energyModel.p_runStartTime_h + i*energyModel.p_timeStep_h+ 24*(energyModel.v_dayOfWeek1jan-1)) % (24*7)) < (24*5)) { // Simulation starts on a Thursday, hence the +3 day offset on t_h
+ listNetLoadArrayWeekday_kW.add(-netLoadArrayAnnual_kW[i]);
+ i_weekday++;
+ } else {
+ listNetLoadArrayWeekend_kW.add(-netLoadArrayAnnual_kW[i]);
+ i_weekend++;
+ }
+
+ }
+
+ // Now we have the size of the weekday & weekend arrays.
+ this.netLoadArrayWeekday_kW = new double[listNetLoadArrayWeekday_kW.size()];
+ this.netLoadArrayWeekend_kW = new double[listNetLoadArrayWeekend_kW.size()];
+ for (int i = 0; i < listNetLoadArrayWeekday_kW.size(); i++) {
+ this.netLoadArrayWeekday_kW[i] = listNetLoadArrayWeekday_kW.get(i);
+ }
+ for (int i = 0; i < listNetLoadArrayWeekend_kW.size(); i++) {
+ this.netLoadArrayWeekend_kW[i] = listNetLoadArrayWeekend_kW.get(i);
+ }
+
+
+ // Sort all arrays
+ Arrays.sort(netLoadArrayAnnual_kW);
+
+ Arrays.sort(netLoadArraySummerweek_kW);
+ Arrays.sort(netLoadArrayWinterweek_kW);
+ Arrays.sort(netLoadArrayDaytime_kW);
+ Arrays.sort(netLoadArrayNighttime_kW);
+ Arrays.sort(netLoadArrayWeekday_kW);
+ Arrays.sort(netLoadArrayWeekend_kW);
+
+ //int arraySize;
+ // Year
+ // arraySize = netLoadArrayAnnual_kW.length;
+ //ArrayUtils.reverse(netLoadArrayAnnual_kW);
+ ds_loadDurationCurveTotal_kW = new DataSet(roundToInt(arraySize));
+ for(int i=0; i< arraySize; i++) {
+ loadDuractionCurveTotal_kW[i]=netLoadArrayAnnual_kW[arraySize-i-1];
+ ds_loadDurationCurveTotal_kW.add(i*energyModel.p_timeStep_h, loadDuractionCurveTotal_kW[i] );
+ }
+
+ // Week
+ arraySize = netLoadArraySummerweek_kW.length;
+ ds_loadDurationCurveSummer_kW = new DataSet(arraySize);
+ ds_loadDurationCurveWinter_kW = new DataSet(arraySize);
+ for(int i=0; i< arraySize; i++) {
+ ds_loadDurationCurveSummer_kW.add(i*energyModel.p_timeStep_h, -netLoadArraySummerweek_kW[i]);
+ ds_loadDurationCurveWinter_kW.add(i*energyModel.p_timeStep_h, -netLoadArrayWinterweek_kW[i]);
+ }
+ // Day / Night
+ arraySize = netLoadArrayDaytime_kW.length;
+ ds_loadDurationCurveDaytime_kW = new DataSet(arraySize);
+ ds_loadDurationCurveNighttime_kW = new DataSet(arraySize);
+ for(int i=0; i< arraySize; i++) {
+ ds_loadDurationCurveDaytime_kW.add(i*energyModel.p_timeStep_h, -netLoadArrayDaytime_kW[i]);
+ ds_loadDurationCurveNighttime_kW.add(i*energyModel.p_timeStep_h, -netLoadArrayNighttime_kW[i]);
+ }
+ // Weekday
+ arraySize = netLoadArrayWeekday_kW.length;
+ ds_loadDurationCurveWeekday_kW = new DataSet(arraySize);
+ for(int i=0; i< arraySize; i++) {
+ ds_loadDurationCurveWeekday_kW.add(i*energyModel.p_timeStep_h, -netLoadArrayWeekday_kW[i]);
+ }
+ // Weekend
+ arraySize = netLoadArrayWeekend_kW.length;
+ ds_loadDurationCurveWeekend_kW = new DataSet(arraySize);
+ for(int i=0; i< arraySize; i++) {
+ ds_loadDurationCurveWeekend_kW.add(i*energyModel.p_timeStep_h, -netLoadArrayWeekend_kW[i]);
+ }
+ }
+
+
+
+ @Override
+ public String toString() {
+ return super.toString();
+ }
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+
+}
+
+
+ 1737633433233
+ J_EADieselTractor
+ 1752677832758
+ import java.util.*;
+
+public class J_EADieselTractor extends J_EAProfile implements Serializable {
+ final static double DIESEL_ENERGY_DENSITY_KWH_PER_L = 9.7;
+
+ final double[] dieselConsumptionPerWeek_L;
+ final double workDayStart_h = 6;
+ final double workDayEnd_h = 17;
+
+ /**
+ * @param parentAgent
+ * @param yearlyDieselConsumption_l diesel consumption of a single tractor for a whole year
+ * @param dieselConsumptionPerWeek profile of a year of diesel consumption.
+ * Usually expressed in L per ha per week for a specific crop or mix of crops.
+ * For our purpose the unit doesn't matter.
+ * @param timeStep_h
+ */
+ public J_EADieselTractor(Agent parentAgent, double yearlyDieselConsumption_L, double[] dieselConsumptionPerWeek, double timeStep_h) {
+ if (parentAgent == null) {
+ throw new RuntimeException("Diesel tractor missing parent agent");
+ }
+
+ if (yearlyDieselConsumption_L <= 100.0) {
+ throw new RuntimeException(
+ String.format("Diesel tractor fuel usage conspicuously low: %d L", yearlyDieselConsumption_L)
+ );
+ }
+
+ if (dieselConsumptionPerWeek == null) {
+ throw new RuntimeException("Tractor diesel consumption profile is null");
+ }
+
+ if (dieselConsumptionPerWeek.length != 52) {
+ throw new RuntimeException(
+ String.format("Tractor diesel consumption profile has %d weeks instead of 52", dieselConsumptionPerWeek.length)
+ );
+ }
+
+ if (timeStep_h <= 0.0) {
+ throw new RuntimeException("Tractor timestep is off");
+ }
+
+ this.parentAgent = parentAgent;
+ this.dieselConsumptionPerWeek_L = calculateDieselConsumptionPerWeek_L(yearlyDieselConsumption_L, dieselConsumptionPerWeek);
+ this.timestep_h = timeStep_h;
+
+ this.activeConsumptionEnergyCarriers.add(OL_EnergyCarriers.DIESEL);
+ registerEnergyAsset();
+ }
+
+ @Override
+ public void f_updateAllFlows(double t_h) {
+ operate(t_h);
+ if (parentAgent instanceof GridConnection) {
+ ((GridConnection)parentAgent).f_addFlows(flowsMap, this.energyUse_kW, assetFlowsMap, this);
+ }
+ this.lastFlowsMap.cloneMap(this.flowsMap);
+ this.lastEnergyUse_kW = this.energyUse_kW;
+ this.clear();
+ }
+
+ @Override
+ public void operate(double t_h) {
+ if (!shouldWork(t_h)) {
+ this.flowsMap.clear();
+ return;
+ }
+
+ double currentPower_kW = currentPower_kW(t_h);
+
+ this.flowsMap.put(OL_EnergyCarriers.DIESEL, currentPower_kW);
+ this.energyUse_kW = currentPower_kW;
+ this.energyUsed_kWh += currentPower_kW * timestep_h;
+ }
+
+ private static double[] calculateDieselConsumptionPerWeek_L(double yearlyDieselConsumption_l, double[] weekProfile) {
+ var profileSum = Arrays.stream(weekProfile).sum();
+
+ return Arrays.stream(weekProfile)
+ .map(weekValue -> yearlyDieselConsumption_l * weekValue / profileSum)
+ .toArray();
+ }
+
+ private boolean shouldWork(double currentStep_h) {
+ return isWorkTime(currentStep_h) && isWorkDay();
+ }
+
+ private boolean isWorkTime(double currentStep_h) {
+ double timeOfDay = currentStep_h % 24;
+
+ return timeOfDay >= workDayStart_h && timeOfDay < workDayEnd_h;
+ }
+
+ private boolean isWorkDay() {
+ return ((GridConnection)parentAgent).energyModel.b_isWeekday;
+ }
+
+ private double workHoursPerWeek() {
+ return 5 * (workDayEnd_h - workDayStart_h);
+ }
+
+ private int workTimeStepsPerWeek() {
+ return roundToInt(workHoursPerWeek() / this.timestep_h);
+ }
+
+ private double currentPower_kW(double currentStep_h) {
+ int week = (int) Math.round(currentStep_h / (7 * 24));
+ if(week == 52) {
+ week = 51;
+ }
+ double thisWeekDieselConsumption_L = this.dieselConsumptionPerWeek_L[week];
+ double thisWeekDieselConsumption_kWh = thisWeekDieselConsumption_L * DIESEL_ENERGY_DENSITY_KWH_PER_L;
+ double power_kW = thisWeekDieselConsumption_kWh / workHoursPerWeek();
+ return power_kW;
+ }
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+}
+
+
+
+ 1740048926477
+ ZeroAccumulator
+ 1752679379816
+ /**
+ * ZeroAccumulator
+ */
+
+import zeroPackage.ZeroMath;
+import java.lang.Math;
+import java.util.Arrays;
+import java.lang.RuntimeException;
+import com.fasterxml.jackson.annotation.JsonIgnoreType;
+@JsonIgnoreType
+public class ZeroAccumulator {
+ public boolean hasTimeSeries = false;
+ private double[] timeSeries;
+ private double duration_h;
+ private double signalResolution_h = 0.25;
+ private double timeStep_h = 0.25;
+ private double sampleWeight_fr = timeStep_h / signalResolution_h;
+ private int arraySize;
+
+ private double totalEnergy_kWh = 0;
+ private double totalPositiveEnergy_kWh = 0;
+ private double totalNegativeEnergy_kWh = 0;
+ private double maxPower_kW = 0;
+ private double minPower_kW = 0;
+
+ private int numStepsAdded = 0;
+ private int numStepsAddedThisEntry = 0; // Used when signal resolution is different from the timestep
+ /**
+ * Default constructor
+ */
+ public ZeroAccumulator() {
+ }
+
+ /**
+ * Constructor initializing the fields
+ */
+ public ZeroAccumulator(boolean hasTimeSeries, double signalResolution_h, double duration_h) {
+ if (signalResolution_h < this.timeStep_h) {
+ throw new RuntimeException("Impossible to construct a ZeroAccumulator with Signal Resolution: " + signalResolution_h + " h, as it is shorter than the timestep.");
+ }
+ this.hasTimeSeries = hasTimeSeries;
+ this.signalResolution_h = signalResolution_h;
+ this.sampleWeight_fr = timeStep_h / signalResolution_h;
+ this.duration_h = duration_h;
+ this.arraySize = (int) Math.round(duration_h / signalResolution_h);
+ if (hasTimeSeries) { // Allocate memory for timeSeries, only when timeSeries is used.
+ timeSeries = new double[(int) Math.round(duration_h / signalResolution_h)];
+ }
+ }
+
+ public ZeroAccumulator getClone() {
+ ZeroAccumulator zeroAccumulator = new ZeroAccumulator(this.hasTimeSeries, this.signalResolution_h, this.duration_h);
+ zeroAccumulator.sampleWeight_fr = this.sampleWeight_fr;
+ if (hasTimeSeries) {
+ zeroAccumulator.timeSeries = this.timeSeries.clone();
+ zeroAccumulator.maxPower_kW = Arrays.stream(this.timeSeries).max().getAsDouble();
+ zeroAccumulator.minPower_kW = Arrays.stream(this.timeSeries).min().getAsDouble();
+ } else {
+ zeroAccumulator.totalEnergy_kWh = this.totalEnergy_kWh;
+ zeroAccumulator.totalNegativeEnergy_kWh = this.totalNegativeEnergy_kWh;
+ zeroAccumulator.totalPositiveEnergy_kWh = this.totalPositiveEnergy_kWh;
+ zeroAccumulator.maxPower_kW = this.maxPower_kW;
+ zeroAccumulator.minPower_kW = this.minPower_kW;
+ }
+ zeroAccumulator.numStepsAdded = this.numStepsAdded;
+ zeroAccumulator.numStepsAddedThisEntry = this.numStepsAddedThisEntry;
+ return zeroAccumulator;
+ }
+
+ public void setTimeStep_h(double timeStep_h) {
+ this.timeStep_h = timeStep_h;
+ sampleWeight_fr = timeStep_h / signalResolution_h;
+ }
+
+ public void reset() {
+ totalEnergy_kWh = 0;
+ totalPositiveEnergy_kWh = 0;
+ totalNegativeEnergy_kWh = 0;
+ numStepsAdded = 0;
+ maxPower_kW = 0;
+ minPower_kW = 0;
+ if (hasTimeSeries) { // Allocate memory for timeSeries, only when timeSeries is used.
+ timeSeries = new double[(int) Math.round(duration_h / signalResolution_h)];
+ }
+ }
+
+
+
+ public void addStep(double power_kW) {
+ if (hasTimeSeries) {
+ // averages multiple timesteps when timeSeries has longer resolution than timestep.
+ this.timeSeries[this.numStepsAdded] += power_kW * this.sampleWeight_fr;
+ } else {
+ totalEnergy_kWh += power_kW * this.timeStep_h;
+ totalPositiveEnergy_kWh += Math.max(0.0, power_kW) * this.timeStep_h;
+ totalNegativeEnergy_kWh += Math.min(0.0, power_kW) * this.timeStep_h;
+ }
+ if (power_kW > maxPower_kW) {
+ maxPower_kW = power_kW;
+ }
+ if (power_kW < minPower_kW) {
+ minPower_kW = power_kW;
+ }
+
+ this.numStepsAddedThisEntry ++;
+ if (this.numStepsAddedThisEntry == roundToInt(this.signalResolution_h / this.timeStep_h)) {
+ this.numStepsAddedThisEntry = 0;
+ this.numStepsAdded++;
+ }
+ }
+
+ public double getIntegral_kWh() { // For getting total energy when addSteps was called with power as value
+ return this.getIntegral_kWh(0, this.duration_h);
+ }
+ public double getIntegral_kWh(double startTime_h, double endTime_h) { // For getting total energy when addSteps was called with power as value
+ if (this.hasTimeSeries) {
+ if (startTime_h < 0 || endTime_h > duration_h || startTime_h > endTime_h) {
+ throw new IllegalArgumentException("Impossible to get integral of this interval, start or endtime out of range");
+ }
+ double[] interval = Arrays.copyOfRange(this.timeSeries, roundToInt(startTime_h/signalResolution_h), roundToInt(endTime_h/signalResolution_h));
+ return ZeroMath.arraySum(interval) * this.signalResolution_h;
+ } else if (startTime_h == 0 && endTime_h == duration_h) {
+ return this.totalEnergy_kWh;
+ } else {
+ throw new IllegalArgumentException("Impossible to get integral of this interval because no timeseries data is available");
+ }
+ }
+
+ public double getIntegralPos_kWh() { // For getting total energy when addSteps was called with power as value
+ return this.getIntegralPos_kWh(0, this.duration_h);
+ }
+ public double getIntegralPos_kWh(double startTime_h, double endTime_h) { // For getting total energy when addSteps was called with power as value
+ if (this.hasTimeSeries) {
+ if (startTime_h < 0 || endTime_h > duration_h || startTime_h > endTime_h) {
+ throw new IllegalArgumentException("Impossible to get integral of this interval, start or endtime out of range");
+ }
+ double[] interval = Arrays.copyOfRange(this.timeSeries, roundToInt(startTime_h/signalResolution_h), roundToInt(endTime_h/signalResolution_h));
+ return ZeroMath.arraySumPos(interval) * this.signalResolution_h;
+ } else if (startTime_h == 0 && endTime_h == duration_h) {
+ return this.totalPositiveEnergy_kWh;
+ } else {
+ throw new IllegalArgumentException("Impossible to get integral of this interval because no timeseries data is available");
+ }
+ }
+
+ public double getIntegralNeg_kWh() { // For getting total energy when addSteps was called with power as value
+ return this.getIntegralNeg_kWh(0, this.duration_h);
+ }
+ public double getIntegralNeg_kWh(double startTime_h, double endTime_h) { // For getting total energy when addSteps was called with power as value
+ if (this.hasTimeSeries) {
+ if (startTime_h < 0 || endTime_h > duration_h || startTime_h > endTime_h) {
+ throw new IllegalArgumentException("Impossible to get integral of this interval, start or endtime out of range");
+ }
+ double[] interval = Arrays.copyOfRange(this.timeSeries, roundToInt(startTime_h/signalResolution_h), roundToInt(endTime_h/signalResolution_h));
+ return ZeroMath.arraySumNeg(interval) * this.signalResolution_h;
+ } else if (startTime_h == 0 && endTime_h == duration_h) {
+ return this.totalNegativeEnergy_kWh;
+ } else {
+ throw new IllegalArgumentException("Impossible to get integral of this interval because no timeseries data is available");
+ }
+ }
+
+ public double getIntegral_MWh(double startTime_h, double endTime_h) { // For getting total energy when addSteps was called with power as value
+ return this.getIntegral_kWh(startTime_h, endTime_h)/1000;
+ }
+
+ public double getIntegralPos_MWh(double startTime_h, double endTime_h) { // For getting total energy when addSteps was called with power as value
+ return this.getIntegralPos_kWh(startTime_h, endTime_h)/1000;
+ }
+
+ public double getIntegralNeg_MWh(double startTime_h, double endTime_h) { // For getting total energy when addSteps was called with power as value
+ return this.getIntegralNeg_kWh(startTime_h, endTime_h)/1000;
+ }
+
+ public double getIntegral_MWh() { // For getting total energy when addSteps was called with power as value
+ return this.getIntegral_kWh()/1000;
+ }
+
+ public double getIntegralPos_MWh() { // For getting total energy when addSteps was called with power as value
+ return this.getIntegralPos_kWh()/1000;
+ }
+
+ public double getIntegralNeg_MWh() { // For getting total energy when addSteps was called with power as value
+ return this.getIntegralNeg_kWh()/1000;
+ }
+
+ public double[] getTimeSeries_kW() {
+ if (!hasTimeSeries) { // Fill timeseries with constant value
+ double[] timeSeriesTemp = new double[arraySize];
+ double avgValue = this.totalEnergy_kWh / this.duration_h;
+ Arrays.fill(timeSeriesTemp, avgValue);
+ return timeSeriesTemp;
+ } else {
+ return timeSeries;
+ }
+ }
+
+ /* What does this do?
+ public double[] getTimeSeriesIntegral_kWh() {
+ if (!hasTimeSeries) { // Fill timeseries with constant value
+ double[] timeSeriesTemp = new double[arraySize];
+ double avgValue = this.totalEnergy_kWh / arraySize;
+ Arrays.fill(timeSeriesTemp, avgValue);
+ return timeSeriesTemp;
+ } else {
+ return ZeroMath.arrayMultiply(timeSeries.clone(), this.signalResolution_h);
+ }
+ } */
+
+ public Double getY(int i) {
+ if (!hasTimeSeries) {
+ return null;
+ } else {
+ return timeSeries[i];
+ }
+ }
+
+ public double getMaxPower_kW() {
+ return maxPower_kW;
+ }
+
+ public double getMinPower_kW() {
+ return minPower_kW;
+ }
+
+ public double getSignalResolution_h() {
+ return this.signalResolution_h;
+ }
+
+ public double getDuration() {
+ return duration_h;
+ }
+ public ZeroAccumulator add(ZeroAccumulator acc) {
+ if (this.hasTimeSeries && acc.hasTimeSeries && this.duration_h == acc.duration_h){
+ if (this.signalResolution_h == acc.signalResolution_h) {
+ for (int i = 0; i < timeSeries.length; i++) {
+ this.timeSeries[i] += acc.timeSeries[i];
+ }
+ this.maxPower_kW = Arrays.stream(this.timeSeries).max().getAsDouble();
+ this.minPower_kW = Arrays.stream(this.timeSeries).min().getAsDouble();
+ }
+ else if(this.signalResolution_h > acc.signalResolution_h && this.signalResolution_h % acc.signalResolution_h == 0) { //Average the smaller time step acc into the bigger one
+ for (int i = 0; i < timeSeries.length; i++) {
+ double averageAddedValue_kW = 0;
+ int resolutionRatio = (int) (this.signalResolution_h / acc.signalResolution_h);
+ for (int j = 0; j < resolutionRatio; j++) {
+ int accIndex = i * resolutionRatio + j;
+ averageAddedValue_kW += acc.timeSeries[accIndex] / resolutionRatio;
+ }
+ this.timeSeries[i] += averageAddedValue_kW;
+ }
+ this.maxPower_kW = Arrays.stream(this.timeSeries).max().getAsDouble();
+ this.minPower_kW = Arrays.stream(this.timeSeries).min().getAsDouble();
+ }
+ else {
+ throw new RuntimeException("Cannot add accumulator: resolutions must be equal or an integer multiple of each other where the added accumulator resolution (timestep_h) cannot be larger than the target.");
+ }
+ }
+ else if ((!this.hasTimeSeries && !acc.hasTimeSeries) && (this.duration_h == acc.duration_h)
+ && (this.signalResolution_h == acc.signalResolution_h)) {
+ this.totalEnergy_kWh += acc.totalEnergy_kWh;
+ // These values below we can not determine since we have no timeSeries (but you can still call getSumPos()...)
+ this.totalPositiveEnergy_kWh = 0;
+ this.totalNegativeEnergy_kWh = 0;
+ this.maxPower_kW = 0;
+ this.minPower_kW = 0;
+ }
+ else {
+ throw new RuntimeException("Impossible to add these incompatible accumulators");
+ }
+ return this;
+ }
+
+ public ZeroAccumulator subtract(ZeroAccumulator acc) {
+ if (this.hasTimeSeries && acc.hasTimeSeries && this.duration_h == acc.duration_h){
+ if(this.signalResolution_h == acc.signalResolution_h) {
+ for (int i = 0; i < timeSeries.length; i++) {
+ this.timeSeries[i] -= acc.timeSeries[i];
+ }
+ this.maxPower_kW = Arrays.stream(this.timeSeries).max().getAsDouble();
+ this.minPower_kW = Arrays.stream(this.timeSeries).min().getAsDouble();
+ }
+ else if (this.signalResolution_h > acc.signalResolution_h && this.signalResolution_h % acc.signalResolution_h == 0) {
+ for (int i = 0; i < timeSeries.length; i++) {
+ double averageSubtractedValue_kW = 0;
+ int resolutionRatio = (int) (this.signalResolution_h / acc.signalResolution_h);
+ for (int j = 0; j < resolutionRatio; j++) {
+ int accIndex = i * resolutionRatio + j;
+ averageSubtractedValue_kW += acc.timeSeries[accIndex] / resolutionRatio;
+ }
+ this.timeSeries[i] -= averageSubtractedValue_kW;
+ }
+ this.maxPower_kW = Arrays.stream(this.timeSeries).max().getAsDouble();
+ this.minPower_kW = Arrays.stream(this.timeSeries).min().getAsDouble();
+ }
+ else {
+ throw new RuntimeException("Cannot subtract accumulator: resolutions must be equal or an integer multiple of each other where the added accumulator resolution (timestep_h) cannot be larger than the target.");
+ }
+ }
+ else if ((!this.hasTimeSeries && !acc.hasTimeSeries) && (this.duration_h == acc.duration_h)
+ && (this.signalResolution_h == acc.signalResolution_h)) {
+ this.totalEnergy_kWh -= acc.totalEnergy_kWh;
+ // These values below we can not determine since we have no timeSeries (but you can still call getSumPos()...)
+ this.totalPositiveEnergy_kWh = 0;
+ this.totalNegativeEnergy_kWh = 0;
+ this.maxPower_kW = 0;
+ this.minPower_kW = 0;
+ } else {
+ throw new RuntimeException("Impossible to subtract these incompatible accumulators");
+ }
+ return this;
+ }
+
+ public DataSet getDataSet(double startTime_h) {
+ if (this.hasTimeSeries) {
+ DataSet ds = new DataSet(timeSeries.length);
+ for (int i = 0; i < timeSeries.length; i++) {
+ ds.add(startTime_h + i * this.signalResolution_h, roundToDecimal(this.timeSeries[i],3) );
+ }
+ return ds;
+ } else {
+ throw new RuntimeException("Impossible to create DataSet from accumulator without timeSeries.");
+ }
+ }
+
+ public DataSet getDataSet(double startTime_h, double dataSetSignalResolution_h) {
+ if (this.hasTimeSeries) {
+ if (dataSetSignalResolution_h % this.signalResolution_h == 0) {
+ int accumulatorEntries = roundToInt(dataSetSignalResolution_h / this.signalResolution_h); // number of entries in accumulator per dataset entry
+ if (duration_h % dataSetSignalResolution_h == 0) {
+ int dataSetSize = roundToInt(duration_h / dataSetSignalResolution_h);
+ DataSet ds = new DataSet(dataSetSize);
+ for (int i = 0; i < dataSetSize; i++) {
+ double value = 0;
+ for (int j = 0; j < accumulatorEntries; j++) {
+ value += this.timeSeries[accumulatorEntries * i + j];
+ }
+ value /= accumulatorEntries;
+ ds.add(startTime_h + i * dataSetSignalResolution_h, roundToDecimal(value,3) );
+ }
+ return ds;
+ } else {
+ throw new RuntimeException("Impossible to create DataSet from accumulator: signal resolution does not divide into timeseries");
+ }
+ } else {
+ throw new RuntimeException("Impossible to create DataSet from accumulator with signal resolution that is not a multiple of the accumulator's signal resolution.");
+ }
+ } else {
+ throw new RuntimeException("Impossible to create DataSet from accumulator without timeSeries.");
+ }
+ }
+ public DataSet getDataSet(double startTime_h, double accStartTime_h, double accEndTime_h) {
+
+ double dataSetDuration_h = accEndTime_h - accStartTime_h;
+ if (dataSetDuration_h > duration_h) {
+ throw new RuntimeException("Too long dataSet interval requested from ZeroAccumulator.getDataSet().");
+ }
+ int startIdx = roundToInt(accStartTime_h / signalResolution_h);
+ int endIdx = roundToInt(accEndTime_h / signalResolution_h);
+ startIdx = max(0,startIdx);
+ //endIdx = max(endIdx, roundToInt(dataSetDuration_h/signalResolution_h));
+ endIdx = min(endIdx, arraySize);
+ //startIdx = min(startIdx, endIdx - roundToInt(dataSetDuration_h/signalResolution_h));
+
+ if (this.hasTimeSeries) {
+ DataSet ds = new DataSet(endIdx-startIdx);
+ for (int i = startIdx; i < endIdx; i++) {
+ ds.add(startTime_h + i * this.signalResolution_h, roundToDecimal(this.timeSeries[i],3) );
+ }
+ return ds;
+ } else {
+ throw new RuntimeException("Impossible to create DataSet from accumulator without timeSeries.");
+ }
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+
+ sb.append("Total Energy [kWh]: ");
+ sb.append(this.totalEnergy_kWh);
+ sb.append(System.lineSeparator());
+ sb.append("Duration [h]: ");
+ sb.append(this.duration_h);
+ sb.append(System.lineSeparator());
+ sb.append("Signal Resolution [h]:");
+ sb.append(this.signalResolution_h);
+ sb.append(System.lineSeparator());
+ sb.append("Has Timeseries: ");
+ sb.append(this.hasTimeSeries);
+
+ return sb.toString();
+ }
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+
+}
+
+
+ 1740048926478
+ ZeroTimeSeries
+ 1752679379816
+ /**
+ * ZeroTimeSeries
+ */
+
+import zeroPackage.ZeroMath;
+import java.lang.Math;
+import java.util.Arrays;
+import java.lang.RuntimeException;
+import com.fasterxml.jackson.annotation.JsonIgnoreType;
+@JsonIgnoreType
+public class ZeroTimeSeries implements Serializable {
+
+ private double[] timeSeries;
+ private double duration_h;
+ private double signalResolution_h = 0.25;
+ private double timeStep_h = 0.25;
+ private double sampleWeight = timeStep_h / signalResolution_h;
+
+ private double max = 0;
+ private double min = 0;
+
+ private int numStepsAdded = 0;
+ private int numStepsAddedThisEntry = 0; // Used when signal resolution is different from the timestep
+ /**
+ * Default constructor
+ */
+ public ZeroTimeSeries() {
+ }
+
+ /**
+ * Constructor initializing the fields
+ */
+ public ZeroTimeSeries(double signalResolution_h, double duration_h) {
+ if (signalResolution_h < this.timeStep_h) {
+ throw new RuntimeException("Impossible to construct a ZeroAccumulator with Signal Resolution: " + signalResolution_h + " h, as it is shorter than the timestep.");
+ }
+
+ this.signalResolution_h = signalResolution_h;
+ this.sampleWeight = timeStep_h / signalResolution_h;
+ this.duration_h = duration_h;
+ //this.arraySize = (int) Math.round(duration_h / signalResolution_h);
+ timeSeries = new double[(int) Math.round(duration_h / signalResolution_h)];
+ }
+
+ public void setTimeStep_h(double timeStep_h) {
+ this.timeStep_h = timeStep_h;
+ sampleWeight = timeStep_h / signalResolution_h;
+ }
+
+ public void reset() {
+
+ numStepsAdded = 0;
+ max = 0;
+ min = 0;
+ timeSeries = new double[(int) Math.round(duration_h / signalResolution_h)];
+
+ }
+
+ public ZeroTimeSeries getClone() {
+ ZeroTimeSeries ts = new ZeroTimeSeries(this.signalResolution_h, this.duration_h);
+ ts.timeStep_h = this.timeStep_h;
+ ts.timeSeries = this.timeSeries.clone();
+ ts.max = this.max;
+ ts.min = this.min;
+ ts.numStepsAdded = this.numStepsAdded;
+ ts.numStepsAddedThisEntry = this.numStepsAddedThisEntry;
+ return ts;
+ }
+
+
+ public void addStep(double value) {
+ this.timeSeries[this.numStepsAdded] += value * sampleWeight;
+
+ if (value > max) {
+ max = value;
+ }
+ if (value < min) {
+ min = value;
+ }
+
+ this.numStepsAddedThisEntry ++;
+ if (this.numStepsAddedThisEntry == roundToInt(this.signalResolution_h / this.timeStep_h)) {
+ this.numStepsAddedThisEntry = 0;
+ this.numStepsAdded++;
+ }
+ }
+
+ public double getSum() {
+ return ZeroMath.arraySum(timeSeries);
+ //return sum;
+ }
+
+ public double getSumPos() {
+ return ZeroMath.arraySumPos(timeSeries);
+ //return posSum;
+ }
+
+ public double getSumNeg() {
+ return ZeroMath.arraySumNeg(timeSeries);
+ //return negSum;
+ }
+
+ public double[] getTimeSeries() {
+ return this.timeSeries;
+ }
+
+ public void setTimeSeries(double[] timeSeries) {
+ this.timeSeries = timeSeries;
+ }
+
+ public Double getY(int i) {
+ return timeSeries[i];
+ }
+
+ public double getMax() {
+ return max;
+ }
+
+ public double getMin() {
+ return min;
+ }
+
+ public double getSignalResolution_h() {
+ return this.signalResolution_h;
+ }
+
+ public double getDuration() {
+ return duration_h;
+ }
+
+ public ZeroTimeSeries add(ZeroTimeSeries zts) {
+ if ((this.duration_h == zts.duration_h) && (this.signalResolution_h == zts.signalResolution_h)) {
+ for (int i = 0; i < this.timeSeries.length; i++) {
+ this.timeSeries[i] += zts.timeSeries[i];
+ }
+ } else {
+ throw new RuntimeException("Impossible to add these incompatible timeSeries");
+ }
+ return this;
+ }
+
+ public ZeroTimeSeries subtract(ZeroTimeSeries zts) {
+ if ((this.duration_h == zts.duration_h) && (this.signalResolution_h == zts.signalResolution_h)) {
+ for (int i = 0; i < this.timeSeries.length; i++) {
+ this.timeSeries[i] -= zts.timeSeries[i];
+ }
+ } else {
+ throw new RuntimeException("Impossible to subtract these incompatible timeSeries");
+ }
+ return this;
+ }
+
+ public DataSet getDataSet(double startTime_h) {
+ DataSet ds = new DataSet(timeSeries.length);
+ for (int i = 0; i < timeSeries.length; i++) {
+ ds.add(startTime_h + i * this.signalResolution_h, this.timeSeries[i] );
+ }
+
+ return ds;
+ }
+
+ public DataSet getDataSet(double startTime_h, double accStartTime_h, double accEndTime_h) {
+
+ double dataSetDuration_h = accEndTime_h - accStartTime_h;
+ if (dataSetDuration_h > duration_h) {
+ throw new RuntimeException("Too long dataSet interval requested from ZeroAccumulator.getDataSet().");
+ }
+ int startIdx = roundToInt(accStartTime_h / this.signalResolution_h);
+ int endIdx = roundToInt(accEndTime_h / this.signalResolution_h);
+ startIdx = max(0,startIdx);
+ //endIdx = max(endIdx, roundToInt(dataSetDuration_h/signalResolution_h));
+ endIdx = min(endIdx, roundToInt(duration_h / signalResolution_h));
+ //startIdx = min(startIdx, endIdx - roundToInt(dataSetDuration_h/signalResolution_h));
+
+ DataSet ds = new DataSet(endIdx-startIdx);
+ for (int i = startIdx; i < endIdx; i++) {
+ ds.add(startTime_h + i * this.signalResolution_h, roundToDecimal(this.timeSeries[i],3) );
+ }
+ return ds;
+
+ }
+
+ public int getLength() {
+ return timeSeries.length;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+
+ sb.append("ZeroTimeSeries, current number of steps in time-series: ");
+ sb.append(this.numStepsAdded);
+
+ return sb.toString();
+ }
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+
+ }
+
+
+ 1741163937278
+ I_EnergyData
+ import com.fasterxml.jackson.annotation.JsonIdentityInfo;
+import com.fasterxml.jackson.annotation.ObjectIdGenerators;
+@JsonIdentityInfo(generator = ObjectIdGenerators.UUIDGenerator.class, property = "@id")
+
+public interface I_EnergyData{
+ J_RapidRunData getRapidRunData();
+ J_LiveData getLiveData();
+ J_RapidRunData getPreviousRapidRunData();
+ OL_ResultScope getScope();
+}
+
+
+ 1741180550081
+ J_RapidRunData
+ 1752680962144
+ import java.util.EnumSet;
+import zeroPackage.ZeroMath;
+/**
+ * J_RapidRunData
+ */
+import com.fasterxml.jackson.annotation.JsonIgnoreType;
+@JsonIgnoreType
+public class J_RapidRunData {
+ private boolean storeTotalAssetFlows = true;
+ public Agent parentAgent;
+ private double timeStep_h;
+ public EnumSet<OL_EnergyCarriers> activeEnergyCarriers;
+ public EnumSet<OL_EnergyCarriers> activeConsumptionEnergyCarriers;
+ public EnumSet<OL_EnergyCarriers> activeProductionEnergyCarriers;
+
+ public J_AssetsMetaData assetsMetaData;
+ public J_ConnectionMetaData connectionMetaData;
+
+ ////Full simulation
+ public J_AccumulatorMap<OL_EnergyCarriers> am_totalBalanceAccumulators_kW = new J_AccumulatorMap(OL_EnergyCarriers.class);
+ public J_AccumulatorMap<OL_EnergyCarriers> am_totalHeatFromEnergyCarrier_kW = new J_AccumulatorMap(OL_EnergyCarriers.class); // exclusief warmtepomp
+ public J_AccumulatorMap<OL_EnergyCarriers> am_totalConsumptionForHeating_kW = new J_AccumulatorMap(OL_EnergyCarriers.class); // exclusief warmtepomp
+
+ public ZeroAccumulator acc_totalEnergyCurtailed_kW;
+ public ZeroAccumulator acc_totalPrimaryEnergyProductionHeatpumps_kW;
+
+ public J_AccumulatorMap<OL_EnergyCarriers> am_dailyAverageConsumptionAccumulators_kW = new J_AccumulatorMap(OL_EnergyCarriers.class);
+ public J_AccumulatorMap<OL_EnergyCarriers> am_dailyAverageProductionAccumulators_kW = new J_AccumulatorMap(OL_EnergyCarriers.class);
+
+ public ZeroAccumulator acc_dailyAverageFinalEnergyConsumption_kW;
+ public ZeroAccumulator acc_dailyAverageEnergyProduction_kW;
+
+ public J_AccumulatorMap<OL_AssetFlowCategories> am_assetFlowsAccumulators_kW = new J_AccumulatorMap(OL_AssetFlowCategories.class);
+
+ public ZeroTimeSeries ts_dailyAverageBatteriesStoredEnergy_MWh;
+ //public ZeroTimeSeries ts_dailyAverageBatteriesSOC_fr;
+
+ ////Summer week
+ public J_AccumulatorMap am_summerWeekBalanceAccumulators_kW = new J_AccumulatorMap(OL_EnergyCarriers.class);
+ public J_AccumulatorMap<OL_EnergyCarriers> am_summerWeekHeatFromEnergyCarrier_kW = new J_AccumulatorMap(OL_EnergyCarriers.class);
+ public J_AccumulatorMap<OL_EnergyCarriers> am_summerWeekConsumptionForHeating_kW = new J_AccumulatorMap(OL_EnergyCarriers.class);
+
+ public ZeroAccumulator acc_summerWeekDeliveryCapacity_kW;
+ public ZeroAccumulator acc_summerWeekFeedinCapacity_kW;
+
+ public ZeroAccumulator acc_summerWeekFinalEnergyConsumption_kW;
+ public ZeroAccumulator acc_summerWeekEnergyCurtailed_kW;
+ public ZeroAccumulator acc_summerWeekEnergyProduction_kW;
+ public ZeroAccumulator acc_summerWeekPrimaryEnergyProductionHeatpumps_kW;
+
+ public J_AccumulatorMap am_summerWeekConsumptionAccumulators_kW = new J_AccumulatorMap(OL_EnergyCarriers.class);
+ public J_AccumulatorMap am_summerWeekProductionAccumulators_kW = new J_AccumulatorMap(OL_EnergyCarriers.class);
+
+ public J_AccumulatorMap<OL_AssetFlowCategories> am_assetFlowsSummerWeek_kW = new J_AccumulatorMap(OL_AssetFlowCategories.class);
+ public ZeroTimeSeries ts_summerWeekBatteriesStoredEnergy_MWh;
+ public ZeroTimeSeries ts_summerWeekBatteriesSOC_fr;
+
+ ////Winter week
+ public J_AccumulatorMap am_winterWeekBalanceAccumulators_kW = new J_AccumulatorMap(OL_EnergyCarriers.class);
+ public J_AccumulatorMap<OL_EnergyCarriers> am_winterWeekHeatFromEnergyCarrier_kW = new J_AccumulatorMap(OL_EnergyCarriers.class);
+ public J_AccumulatorMap<OL_EnergyCarriers> am_winterWeekConsumptionForHeating_kW = new J_AccumulatorMap(OL_EnergyCarriers.class);
+
+ public ZeroAccumulator acc_winterWeekDeliveryCapacity_kW;
+ public ZeroAccumulator acc_winterWeekFeedinCapacity_kW;
+
+ public ZeroAccumulator acc_winterWeekFinalEnergyConsumption_kW;
+ public ZeroAccumulator acc_winterWeekEnergyProduction_kW;
+ public ZeroAccumulator acc_winterWeekEnergyCurtailed_kW;
+ public ZeroAccumulator acc_winterWeekPrimaryEnergyProductionHeatpumps_kW;
+
+ public J_AccumulatorMap am_winterWeekConsumptionAccumulators_kW = new J_AccumulatorMap(OL_EnergyCarriers.class);
+ public J_AccumulatorMap am_winterWeekProductionAccumulators_kW = new J_AccumulatorMap(OL_EnergyCarriers.class);
+
+ public J_AccumulatorMap<OL_AssetFlowCategories> am_assetFlowsWinterWeek_kW = new J_AccumulatorMap(OL_AssetFlowCategories.class);
+ public ZeroTimeSeries ts_winterWeekBatteriesStoredEnergy_MWh;
+ public ZeroTimeSeries ts_winterWeekBatteriesSOC_fr;
+
+ ////Daytime / Nighttime
+ public J_AccumulatorMap am_daytimeExports_kW = new J_AccumulatorMap(OL_EnergyCarriers.class);
+ public J_AccumulatorMap am_daytimeImports_kW = new J_AccumulatorMap(OL_EnergyCarriers.class);
+
+ public J_AccumulatorMap<OL_EnergyCarriers> am_daytimeHeatFromEnergyCarrier_kW = new J_AccumulatorMap(OL_EnergyCarriers.class);
+ public J_AccumulatorMap<OL_EnergyCarriers> am_daytimeConsumptionForHeating_kW = new J_AccumulatorMap(OL_EnergyCarriers.class);
+
+ public ZeroAccumulator acc_daytimeFinalEnergyConsumption_kW;
+ public ZeroAccumulator acc_daytimeEnergyProduction_kW;
+ public ZeroAccumulator acc_daytimeElectricityConsumption_kW;
+ public ZeroAccumulator acc_daytimeElectricityProduction_kW;
+
+ public ZeroAccumulator acc_daytimePrimaryEnergyProductionHeatpumps_kW;
+
+ public J_AccumulatorMap<OL_AssetFlowCategories> am_assetFlowsDaytime_kW = new J_AccumulatorMap(OL_AssetFlowCategories.class);
+
+ //Weekend/day
+ public J_AccumulatorMap am_weekendExports_kW = new J_AccumulatorMap(OL_EnergyCarriers.class);
+ public J_AccumulatorMap am_weekendImports_kW = new J_AccumulatorMap(OL_EnergyCarriers.class);
+
+ public J_AccumulatorMap<OL_EnergyCarriers> am_weekendHeatFromEnergyCarrier_kW = new J_AccumulatorMap(OL_EnergyCarriers.class);
+ public J_AccumulatorMap<OL_EnergyCarriers> am_weekendConsumptionForHeating_kW = new J_AccumulatorMap(OL_EnergyCarriers.class);
+
+ public ZeroAccumulator acc_weekendElectricityConsumption_kW;
+ public ZeroAccumulator acc_weekendElectricityProduction_kW;
+ public ZeroAccumulator acc_weekendFinalEnergyConsumption_kW;
+ public ZeroAccumulator acc_weekendEnergyProduction_kW;
+
+ public ZeroAccumulator acc_weekendPrimaryEnergyProductionHeatpumps_kW;
+
+ public J_AccumulatorMap<OL_AssetFlowCategories> am_assetFlowsWeekend_kW = new J_AccumulatorMap(OL_AssetFlowCategories.class);
+
+
+
+ /**
+ * Default constructor
+ */
+ public J_RapidRunData(Agent parentAgent) {
+ this.parentAgent = parentAgent;
+ if (parentAgent instanceof GridConnection) {
+ if (((GridConnection)parentAgent).p_owner == null) {
+ storeTotalAssetFlows = false;
+ } else {
+ if (!((GridConnection)parentAgent).p_owner.p_detailedCompany && !((GridConnection)parentAgent).v_hasQuarterHourlyValues) {
+ storeTotalAssetFlows = false;
+ }
+ }
+ }
+ }
+
+ public boolean setStoreTotalAssetFlows(boolean storeTotalAssetFlows) {
+ this.storeTotalAssetFlows = storeTotalAssetFlows;
+ return this.storeTotalAssetFlows == storeTotalAssetFlows; // Check if it has succeeded (Always for now!)
+ }
+
+ public boolean getStoreTotalAssetFlows() {
+ return this.storeTotalAssetFlows;
+ }
+
+ public void initializeAccumulators(double simDuration_h, double timeStep_h, EnumSet<OL_EnergyCarriers> v_activeEnergyCarriers, EnumSet<OL_EnergyCarriers> v_activeConsumptionEnergyCarriers, EnumSet<OL_EnergyCarriers> v_activeProductionEnergyCarriers, EnumSet<OL_AssetFlowCategories> activeAssetFlows) {
+ this.timeStep_h = timeStep_h;
+ this.activeEnergyCarriers = EnumSet.copyOf(v_activeEnergyCarriers);
+ this.activeConsumptionEnergyCarriers = EnumSet.copyOf(v_activeConsumptionEnergyCarriers);
+ this.activeProductionEnergyCarriers = EnumSet.copyOf(v_activeProductionEnergyCarriers);
+
+ //========== TOTAL ACCUMULATORS ==========//
+ am_totalBalanceAccumulators_kW.createEmptyAccumulators( this.activeEnergyCarriers, true, 24.0, simDuration_h );
+ am_totalBalanceAccumulators_kW.put( OL_EnergyCarriers.ELECTRICITY, new ZeroAccumulator(true, timeStep_h, simDuration_h) );
+ am_totalHeatFromEnergyCarrier_kW.createEmptyAccumulators( this.activeEnergyCarriers, false, timeStep_h, simDuration_h);
+ am_totalConsumptionForHeating_kW.createEmptyAccumulators( this.activeEnergyCarriers, false, timeStep_h, simDuration_h);
+
+ am_dailyAverageConsumptionAccumulators_kW.createEmptyAccumulators(this.activeConsumptionEnergyCarriers, true, 24.0, simDuration_h);
+ am_dailyAverageProductionAccumulators_kW.createEmptyAccumulators(this.activeProductionEnergyCarriers, true, 24.0, simDuration_h);
+
+ acc_dailyAverageEnergyProduction_kW = new ZeroAccumulator(true, 24.0, simDuration_h);
+ acc_dailyAverageFinalEnergyConsumption_kW = new ZeroAccumulator(true, 24.0, simDuration_h);
+
+ acc_totalEnergyCurtailed_kW = new ZeroAccumulator(true, 24.0, simDuration_h);
+ acc_totalPrimaryEnergyProductionHeatpumps_kW = new ZeroAccumulator(true, 24.0, simDuration_h);
+
+ //========== ASSET FLOWS ==========//
+
+ if (storeTotalAssetFlows) {
+ am_assetFlowsAccumulators_kW.createEmptyAccumulators( activeAssetFlows, true, timeStep_h, simDuration_h);
+ if (this.assetsMetaData.activeAssetFlows.contains(OL_AssetFlowCategories.batteriesChargingPower_kW)) {
+ ts_dailyAverageBatteriesStoredEnergy_MWh = new ZeroTimeSeries(timeStep_h, simDuration_h);
+ } /*else {
+ ts_dailyAverageBatteriesStoredEnergy_MWh = new ZeroTimeSeries(24, simDuration_h);
+ }*/
+ } else {
+ am_assetFlowsAccumulators_kW.createEmptyAccumulators( activeAssetFlows, true, 24.0, simDuration_h);
+ if (this.assetsMetaData.activeAssetFlows.contains(OL_AssetFlowCategories.batteriesChargingPower_kW)) {
+ ts_dailyAverageBatteriesStoredEnergy_MWh = new ZeroTimeSeries(24, simDuration_h);
+ } /*else {
+ ts_dailyAverageBatteriesStoredEnergy_MWh = new ZeroTimeSeries(24, simDuration_h);
+ }*/
+ }
+
+ //========== SUMMER WEEK ACCUMULATORS ==========//
+ am_summerWeekBalanceAccumulators_kW.createEmptyAccumulators(this.activeEnergyCarriers, true, timeStep_h, 168.0);
+ am_summerWeekConsumptionAccumulators_kW.createEmptyAccumulators(this.activeConsumptionEnergyCarriers, true, timeStep_h, 168.0);
+ am_summerWeekProductionAccumulators_kW.createEmptyAccumulators(this.activeProductionEnergyCarriers, true, timeStep_h, 168.0);
+
+ am_summerWeekHeatFromEnergyCarrier_kW.createEmptyAccumulators( this.activeEnergyCarriers, false, timeStep_h, simDuration_h);
+ am_summerWeekConsumptionForHeating_kW.createEmptyAccumulators( this.activeEnergyCarriers, false, timeStep_h, simDuration_h);
+
+ acc_summerWeekEnergyProduction_kW = new ZeroAccumulator(true, timeStep_h, 168.0);
+ acc_summerWeekFinalEnergyConsumption_kW = new ZeroAccumulator(true, timeStep_h, 168.0);
+
+ acc_summerWeekEnergyCurtailed_kW = new ZeroAccumulator(true, timeStep_h, 168.0);
+ acc_summerWeekPrimaryEnergyProductionHeatpumps_kW = new ZeroAccumulator(true, timeStep_h, 168.0);
+
+ acc_summerWeekFeedinCapacity_kW = new ZeroAccumulator(true, timeStep_h, 168.0);
+ acc_summerWeekDeliveryCapacity_kW = new ZeroAccumulator(true, timeStep_h, 168.0);
+
+ am_assetFlowsSummerWeek_kW.createEmptyAccumulators( this.assetsMetaData.activeAssetFlows, true, timeStep_h, 7*24);
+ ts_summerWeekBatteriesStoredEnergy_MWh = new ZeroTimeSeries(timeStep_h, 168.0);
+ ts_summerWeekBatteriesSOC_fr = new ZeroTimeSeries(timeStep_h, 168.0);
+
+ //========== WINTER WEEK ACCUMULATORS ==========//
+ am_winterWeekBalanceAccumulators_kW.createEmptyAccumulators(this.activeEnergyCarriers, true, timeStep_h, 168.0);
+ am_winterWeekConsumptionAccumulators_kW.createEmptyAccumulators(this.activeConsumptionEnergyCarriers, true, timeStep_h, 168.0);
+ am_winterWeekProductionAccumulators_kW.createEmptyAccumulators(this.activeProductionEnergyCarriers, true, timeStep_h, 168.0);
+
+ am_winterWeekHeatFromEnergyCarrier_kW.createEmptyAccumulators( this.activeEnergyCarriers, false, timeStep_h, simDuration_h);
+ am_winterWeekConsumptionForHeating_kW.createEmptyAccumulators( this.activeEnergyCarriers, false, timeStep_h, simDuration_h);
+
+ acc_winterWeekEnergyProduction_kW = new ZeroAccumulator(true, timeStep_h, 168.0);
+ acc_winterWeekFinalEnergyConsumption_kW = new ZeroAccumulator(true, timeStep_h, 168.0);
+
+ acc_winterWeekEnergyCurtailed_kW = new ZeroAccumulator(true, timeStep_h, 168.0);
+ acc_winterWeekPrimaryEnergyProductionHeatpumps_kW = new ZeroAccumulator(true, timeStep_h, 168.0);
+
+ acc_winterWeekFeedinCapacity_kW = new ZeroAccumulator(true, timeStep_h, 168.0);
+ acc_winterWeekDeliveryCapacity_kW = new ZeroAccumulator(true, timeStep_h, 168.0);
+
+ am_assetFlowsWinterWeek_kW.createEmptyAccumulators( this.assetsMetaData.activeAssetFlows, true, timeStep_h, 7*24);
+ ts_winterWeekBatteriesStoredEnergy_MWh = new ZeroTimeSeries(timeStep_h, 168.0);
+ ts_winterWeekBatteriesSOC_fr = new ZeroTimeSeries(timeStep_h, 168.0);
+
+ //========== DAYTIME ACCUMULATORS ==========//
+ am_daytimeImports_kW.createEmptyAccumulators( this.activeConsumptionEnergyCarriers, false, timeStep_h, 0.5 * (simDuration_h));
+ am_daytimeExports_kW.createEmptyAccumulators( this.activeProductionEnergyCarriers, false, timeStep_h, 0.5 * (simDuration_h));
+
+ am_daytimeHeatFromEnergyCarrier_kW.createEmptyAccumulators( this.activeEnergyCarriers, false, timeStep_h, simDuration_h);
+ am_daytimeConsumptionForHeating_kW.createEmptyAccumulators( this.activeEnergyCarriers, false, timeStep_h, simDuration_h);
+
+ acc_daytimeEnergyProduction_kW = new ZeroAccumulator(false, timeStep_h, 0.5 * (simDuration_h));
+ acc_daytimeFinalEnergyConsumption_kW = new ZeroAccumulator(false, timeStep_h,0.5 * (simDuration_h));
+ //acc_daytimeEnergyCurtailed_kW = new ZeroAccumulator(false, timeStep_h, simDuration_h);
+ acc_daytimeElectricityProduction_kW = new ZeroAccumulator(false, timeStep_h, 0.5 * (simDuration_h));
+ acc_daytimeElectricityConsumption_kW = new ZeroAccumulator(false, timeStep_h, 0.5 * (simDuration_h));
+
+ acc_daytimePrimaryEnergyProductionHeatpumps_kW = new ZeroAccumulator(false, timeStep_h, 0.5 * (simDuration_h));
+
+ am_assetFlowsDaytime_kW.createEmptyAccumulators( this.assetsMetaData.activeAssetFlows, false, timeStep_h, 0.5 * (simDuration_h));
+
+ //========== WEEKEND ACCUMULATORS ==========//
+ am_weekendImports_kW.createEmptyAccumulators( this.activeConsumptionEnergyCarriers, false, timeStep_h, 2 / 7 * (simDuration_h) + 48);
+ am_weekendExports_kW.createEmptyAccumulators( this.activeProductionEnergyCarriers, false, timeStep_h, 2 / 7 * (simDuration_h) + 48);
+
+ am_weekendHeatFromEnergyCarrier_kW.createEmptyAccumulators( this.activeEnergyCarriers, false, timeStep_h, simDuration_h);
+ am_weekendConsumptionForHeating_kW.createEmptyAccumulators( this.activeEnergyCarriers, false, timeStep_h, simDuration_h);
+
+ acc_weekendEnergyProduction_kW = new ZeroAccumulator(false, timeStep_h, 2 / 7 * (simDuration_h) + 48);
+ acc_weekendFinalEnergyConsumption_kW = new ZeroAccumulator(false, timeStep_h,2 / 7 * (simDuration_h) + 48);
+ //acc_weekendEnergyCurtailed_kW = new ZeroAccumulator(false, timeStep_h, simDuration_h);
+ acc_weekendElectricityProduction_kW = new ZeroAccumulator(false, timeStep_h, 2 / 7 * (simDuration_h) + 48);
+ acc_weekendElectricityConsumption_kW = new ZeroAccumulator(false, timeStep_h, 2 / 7 * (simDuration_h) + 48);
+
+ acc_weekendPrimaryEnergyProductionHeatpumps_kW = new ZeroAccumulator(false, timeStep_h, 2 / 7 * (simDuration_h) + 48);
+
+ am_assetFlowsWeekend_kW.createEmptyAccumulators( this.assetsMetaData.activeAssetFlows, false, timeStep_h, 2 / 7 * (simDuration_h) + 48);
+ }
+
+ public void resetAccumulators(double simDuration_h, double timeStep_h, EnumSet<OL_EnergyCarriers> v_activeEnergyCarriers, EnumSet<OL_EnergyCarriers> v_activeConsumptionEnergyCarriers, EnumSet<OL_EnergyCarriers> v_activeProductionEnergyCarriers) {
+ this.activeEnergyCarriers = EnumSet.copyOf(v_activeEnergyCarriers);
+ this.activeConsumptionEnergyCarriers = EnumSet.copyOf(v_activeConsumptionEnergyCarriers);
+ this.activeProductionEnergyCarriers = EnumSet.copyOf(v_activeProductionEnergyCarriers);
+ //Total simulation
+ am_totalBalanceAccumulators_kW.createEmptyAccumulators( this.activeEnergyCarriers, true, 24.0, simDuration_h );
+ am_totalBalanceAccumulators_kW.put( OL_EnergyCarriers.ELECTRICITY, new ZeroAccumulator(true, timeStep_h, simDuration_h) );
+ am_dailyAverageConsumptionAccumulators_kW.createEmptyAccumulators(this.activeConsumptionEnergyCarriers, true, 24.0, simDuration_h);
+ am_dailyAverageProductionAccumulators_kW.createEmptyAccumulators(this.activeProductionEnergyCarriers, true, 24.0, simDuration_h);
+
+ am_totalHeatFromEnergyCarrier_kW.createEmptyAccumulators( this.activeEnergyCarriers, false, timeStep_h, simDuration_h);
+ am_totalConsumptionForHeating_kW.createEmptyAccumulators( this.activeEnergyCarriers, false, timeStep_h, simDuration_h);
+
+ acc_dailyAverageEnergyProduction_kW.reset();
+ acc_dailyAverageFinalEnergyConsumption_kW.reset();
+
+ acc_totalEnergyCurtailed_kW.reset();
+ acc_totalPrimaryEnergyProductionHeatpumps_kW.reset();
+
+ if (storeTotalAssetFlows) {
+ am_assetFlowsAccumulators_kW.createEmptyAccumulators( this.assetsMetaData.activeAssetFlows, true, timeStep_h, simDuration_h);
+ if (this.assetsMetaData.activeAssetFlows.contains(OL_AssetFlowCategories.batteriesChargingPower_kW)) {
+ ts_dailyAverageBatteriesStoredEnergy_MWh = new ZeroTimeSeries(timeStep_h, simDuration_h);
+ }
+ } else {
+ am_assetFlowsAccumulators_kW.createEmptyAccumulators( this.assetsMetaData.activeAssetFlows, true, 24.0, simDuration_h);
+ if (this.assetsMetaData.activeAssetFlows.contains(OL_AssetFlowCategories.batteriesChargingPower_kW)) {
+ ts_dailyAverageBatteriesStoredEnergy_MWh = new ZeroTimeSeries(24, simDuration_h);
+ }
+ }
+
+ //ts_dailyAverageBatteriesStoredEnergy_MWh.reset();
+
+ //Summerweek
+ am_summerWeekBalanceAccumulators_kW.createEmptyAccumulators(this.activeEnergyCarriers, true, timeStep_h, 24*7);
+ am_summerWeekConsumptionAccumulators_kW.createEmptyAccumulators(this.activeConsumptionEnergyCarriers, true, timeStep_h, 24*7);
+ am_summerWeekProductionAccumulators_kW.createEmptyAccumulators(this.activeProductionEnergyCarriers, true, timeStep_h, 24*7);
+
+ am_summerWeekHeatFromEnergyCarrier_kW.createEmptyAccumulators( this.activeEnergyCarriers, false, timeStep_h, simDuration_h);
+ am_summerWeekConsumptionForHeating_kW.createEmptyAccumulators( this.activeEnergyCarriers, false, timeStep_h, simDuration_h);
+
+ acc_summerWeekEnergyProduction_kW.reset();
+ acc_summerWeekFinalEnergyConsumption_kW.reset();
+
+ acc_summerWeekEnergyCurtailed_kW.reset();
+ acc_summerWeekPrimaryEnergyProductionHeatpumps_kW.reset();
+
+ acc_summerWeekFeedinCapacity_kW.reset();
+ acc_summerWeekDeliveryCapacity_kW.reset();
+
+ am_assetFlowsSummerWeek_kW.createEmptyAccumulators(this.assetsMetaData.activeAssetFlows, true, timeStep_h, 24*7);
+ ts_summerWeekBatteriesStoredEnergy_MWh.reset();
+ ts_summerWeekBatteriesSOC_fr.reset();
+
+ //Winterweek
+ am_winterWeekBalanceAccumulators_kW.createEmptyAccumulators(v_activeEnergyCarriers, true, timeStep_h, 24*7);
+ am_winterWeekConsumptionAccumulators_kW.createEmptyAccumulators(this.activeConsumptionEnergyCarriers, true, timeStep_h, 24*7);
+ am_winterWeekProductionAccumulators_kW.createEmptyAccumulators(this.activeProductionEnergyCarriers, true, timeStep_h, 24*7);
+
+ am_winterWeekHeatFromEnergyCarrier_kW.createEmptyAccumulators( this.activeEnergyCarriers, false, timeStep_h, simDuration_h);
+ am_winterWeekConsumptionForHeating_kW.createEmptyAccumulators( this.activeEnergyCarriers, false, timeStep_h, simDuration_h);
+
+ acc_winterWeekEnergyProduction_kW.reset();
+ acc_winterWeekFinalEnergyConsumption_kW.reset();
+
+ acc_winterWeekEnergyCurtailed_kW.reset();
+ acc_winterWeekPrimaryEnergyProductionHeatpumps_kW.reset();
+
+ acc_winterWeekFeedinCapacity_kW.reset();
+ acc_winterWeekDeliveryCapacity_kW.reset();
+ am_assetFlowsWinterWeek_kW.createEmptyAccumulators(this.assetsMetaData.activeAssetFlows, true, timeStep_h, 24*7);
+
+ ts_winterWeekBatteriesStoredEnergy_MWh.reset();
+ ts_winterWeekBatteriesSOC_fr.reset();
+
+ // Daytime
+ am_daytimeImports_kW.createEmptyAccumulators( this.activeConsumptionEnergyCarriers, false, timeStep_h, 0.5 * (simDuration_h));
+ am_daytimeExports_kW.createEmptyAccumulators( this.activeProductionEnergyCarriers, false, timeStep_h, 0.5 * (simDuration_h));
+
+ am_daytimeHeatFromEnergyCarrier_kW.createEmptyAccumulators( this.activeEnergyCarriers, false, timeStep_h, simDuration_h);
+ am_daytimeConsumptionForHeating_kW.createEmptyAccumulators( this.activeEnergyCarriers, false, timeStep_h, simDuration_h);
+
+ acc_daytimeElectricityProduction_kW.reset();
+ acc_daytimeElectricityConsumption_kW.reset();
+ acc_daytimeEnergyProduction_kW.reset();
+ acc_daytimeFinalEnergyConsumption_kW.reset();
+
+ acc_daytimePrimaryEnergyProductionHeatpumps_kW.reset();
+
+ am_assetFlowsDaytime_kW.createEmptyAccumulators( this.assetsMetaData.activeAssetFlows, false, timeStep_h, 0.5 * (simDuration_h));
+
+ // Weekend
+ am_weekendImports_kW.createEmptyAccumulators( this.activeConsumptionEnergyCarriers, false, timeStep_h, 2 / 7 * (simDuration_h) + 48);
+ am_weekendExports_kW.createEmptyAccumulators( this.activeProductionEnergyCarriers, false, timeStep_h, 2 / 7 * (simDuration_h) + 48);
+
+ am_weekendHeatFromEnergyCarrier_kW.createEmptyAccumulators( this.activeEnergyCarriers, false, timeStep_h, simDuration_h);
+ am_weekendConsumptionForHeating_kW.createEmptyAccumulators( this.activeEnergyCarriers, false, timeStep_h, simDuration_h);
+
+ acc_weekendElectricityProduction_kW.reset();
+ acc_weekendElectricityConsumption_kW.reset();
+ acc_weekendEnergyProduction_kW.reset();
+ acc_weekendFinalEnergyConsumption_kW.reset();
+
+ acc_weekendPrimaryEnergyProductionHeatpumps_kW.reset();
+
+ am_assetFlowsWeekend_kW.createEmptyAccumulators( this.assetsMetaData.activeAssetFlows, false, timeStep_h, 2 / 7 * (simDuration_h) + 48);
+
+ }
+
+ public J_RapidRunData getClone() {
+ J_RapidRunData clone = new J_RapidRunData(this.parentAgent);
+
+ clone.activeEnergyCarriers=this.activeEnergyCarriers.clone();
+ clone.activeConsumptionEnergyCarriers=this.activeConsumptionEnergyCarriers.clone();
+ clone.activeProductionEnergyCarriers=this.activeProductionEnergyCarriers.clone();
+ ////Full simulation
+ clone.am_totalBalanceAccumulators_kW=this.am_totalBalanceAccumulators_kW.getClone();
+ clone.am_totalHeatFromEnergyCarrier_kW = this.am_totalHeatFromEnergyCarrier_kW.getClone();
+ clone.am_totalConsumptionForHeating_kW = this.am_totalConsumptionForHeating_kW.getClone();
+ clone.acc_totalEnergyCurtailed_kW=this.acc_totalEnergyCurtailed_kW.getClone();
+ clone.acc_totalPrimaryEnergyProductionHeatpumps_kW=this.acc_totalPrimaryEnergyProductionHeatpumps_kW.getClone();
+ clone.am_dailyAverageConsumptionAccumulators_kW=this.am_dailyAverageConsumptionAccumulators_kW.getClone();
+ clone.am_dailyAverageProductionAccumulators_kW=this.am_dailyAverageProductionAccumulators_kW.getClone();
+ clone.acc_dailyAverageFinalEnergyConsumption_kW=this.acc_dailyAverageFinalEnergyConsumption_kW.getClone();
+ clone.acc_dailyAverageEnergyProduction_kW=this.acc_dailyAverageEnergyProduction_kW.getClone();
+
+ clone.am_assetFlowsAccumulators_kW = this.am_assetFlowsAccumulators_kW.getClone();
+ if(this.assetsMetaData.activeAssetFlows.contains(OL_AssetFlowCategories.batteriesChargingPower_kW)) {
+ clone.ts_dailyAverageBatteriesStoredEnergy_MWh=this.ts_dailyAverageBatteriesStoredEnergy_MWh.getClone();
+ }
+ //clone.ts_dailyAverageBatteriesSOC_fr=this.ts_dailyAverageBatteriesSOC_fr.getClone();
+
+ ////Summer week
+ clone.am_summerWeekBalanceAccumulators_kW=this.am_summerWeekBalanceAccumulators_kW.getClone();
+ clone.am_summerWeekHeatFromEnergyCarrier_kW = this.am_summerWeekHeatFromEnergyCarrier_kW.getClone();
+ clone.am_summerWeekConsumptionForHeating_kW = this.am_summerWeekConsumptionForHeating_kW.getClone();
+ clone.acc_summerWeekDeliveryCapacity_kW=this.acc_summerWeekDeliveryCapacity_kW.getClone();
+ clone.acc_summerWeekFeedinCapacity_kW=this.acc_summerWeekFeedinCapacity_kW.getClone();
+ clone.acc_summerWeekFinalEnergyConsumption_kW=this.acc_summerWeekFinalEnergyConsumption_kW.getClone();
+ clone.acc_summerWeekEnergyCurtailed_kW=this.acc_summerWeekEnergyCurtailed_kW.getClone();
+ clone.acc_summerWeekEnergyProduction_kW=this.acc_summerWeekEnergyProduction_kW.getClone();
+ clone.am_summerWeekConsumptionAccumulators_kW=this.am_summerWeekConsumptionAccumulators_kW.getClone();
+ clone.am_summerWeekProductionAccumulators_kW=this.am_summerWeekProductionAccumulators_kW.getClone();
+
+ clone.am_assetFlowsSummerWeek_kW = this.am_assetFlowsSummerWeek_kW.getClone();
+ clone.acc_summerWeekPrimaryEnergyProductionHeatpumps_kW=this.acc_summerWeekPrimaryEnergyProductionHeatpumps_kW.getClone();
+ clone.ts_summerWeekBatteriesStoredEnergy_MWh=this.ts_summerWeekBatteriesStoredEnergy_MWh.getClone();
+ clone.ts_summerWeekBatteriesSOC_fr=this.ts_summerWeekBatteriesSOC_fr.getClone();
+ ////Winter week
+ clone.am_winterWeekBalanceAccumulators_kW = this.am_winterWeekBalanceAccumulators_kW.getClone();
+ clone.am_winterWeekHeatFromEnergyCarrier_kW = this.am_winterWeekHeatFromEnergyCarrier_kW.getClone();
+ clone.am_winterWeekConsumptionForHeating_kW = this.am_winterWeekConsumptionForHeating_kW.getClone();
+ clone.acc_winterWeekDeliveryCapacity_kW = this.acc_winterWeekDeliveryCapacity_kW.getClone();
+ clone.acc_winterWeekFeedinCapacity_kW = this.acc_winterWeekFeedinCapacity_kW.getClone();
+ clone.acc_winterWeekFinalEnergyConsumption_kW = this.acc_winterWeekFinalEnergyConsumption_kW.getClone();
+ clone.acc_winterWeekEnergyProduction_kW = this.acc_winterWeekEnergyProduction_kW.getClone();
+ clone.acc_winterWeekEnergyCurtailed_kW = this.acc_winterWeekEnergyCurtailed_kW.getClone();
+ clone.am_winterWeekConsumptionAccumulators_kW = this.am_winterWeekConsumptionAccumulators_kW.getClone();
+ clone.am_winterWeekProductionAccumulators_kW = this.am_winterWeekProductionAccumulators_kW.getClone();
+
+ clone.am_assetFlowsWinterWeek_kW = this.am_assetFlowsWinterWeek_kW.getClone();
+ clone.acc_winterWeekPrimaryEnergyProductionHeatpumps_kW = this.acc_winterWeekPrimaryEnergyProductionHeatpumps_kW.getClone();
+ clone.ts_winterWeekBatteriesStoredEnergy_MWh = this.ts_winterWeekBatteriesStoredEnergy_MWh.getClone();
+ clone.ts_winterWeekBatteriesSOC_fr = this.ts_winterWeekBatteriesSOC_fr.getClone();
+ ////Daytime / Nighttime
+ clone.am_daytimeExports_kW = am_daytimeExports_kW.getClone();
+ clone.am_daytimeImports_kW = am_daytimeImports_kW.getClone();
+ clone.am_daytimeHeatFromEnergyCarrier_kW = this.am_daytimeHeatFromEnergyCarrier_kW.getClone();
+ clone.am_daytimeConsumptionForHeating_kW = this.am_daytimeConsumptionForHeating_kW.getClone();
+ clone.acc_daytimeFinalEnergyConsumption_kW = acc_daytimeFinalEnergyConsumption_kW.getClone();
+ clone.acc_daytimeEnergyProduction_kW = acc_daytimeEnergyProduction_kW.getClone();
+ clone.acc_daytimeElectricityConsumption_kW = acc_daytimeElectricityConsumption_kW.getClone();
+ clone.acc_daytimeElectricityProduction_kW = acc_daytimeElectricityProduction_kW.getClone();
+ clone.acc_daytimePrimaryEnergyProductionHeatpumps_kW = acc_daytimePrimaryEnergyProductionHeatpumps_kW.getClone();
+ clone.am_assetFlowsDaytime_kW = am_assetFlowsDaytime_kW.getClone();
+ //Weekend/day
+ clone.am_weekendHeatFromEnergyCarrier_kW = this.am_weekendHeatFromEnergyCarrier_kW.getClone();
+ clone.am_weekendConsumptionForHeating_kW = this.am_weekendConsumptionForHeating_kW.getClone();
+ clone.acc_weekendElectricityConsumption_kW = this.acc_weekendElectricityConsumption_kW.getClone();
+ clone.acc_weekendElectricityProduction_kW = this.acc_weekendElectricityProduction_kW.getClone();
+ clone.acc_weekendFinalEnergyConsumption_kW = this.acc_weekendFinalEnergyConsumption_kW.getClone();
+ clone.acc_weekendEnergyProduction_kW = this.acc_weekendEnergyProduction_kW.getClone();
+ clone.am_weekendExports_kW = this.am_weekendExports_kW.getClone();
+ clone.am_weekendImports_kW = this.am_weekendImports_kW.getClone();
+ clone.acc_weekendPrimaryEnergyProductionHeatpumps_kW = acc_weekendPrimaryEnergyProductionHeatpumps_kW.getClone();
+ clone.am_assetFlowsWeekend_kW = am_assetFlowsWeekend_kW.getClone();
+
+ clone.assetsMetaData = this.assetsMetaData.getClone();
+ clone.connectionMetaData = this.connectionMetaData.getClone();
+ return clone;
+
+ }
+
+ public void addTimeStep(
+ J_FlowsMap fm_currentBalanceFlows_kW,
+ J_FlowsMap fm_currentConsumptionFlows_kW,
+ J_FlowsMap fm_currentProductionFlows_kW,
+ J_FlowsMap fm_heatFromEnergyCarrier_kW,
+ J_FlowsMap fm_consumptionForHeating_kW,
+ J_ValueMap fm_currentAssetFlows_kW,
+ double v_currentPrimaryEnergyProduction_kW,
+ double v_currentFinalEnergyConsumption_kW,
+ double v_currentPrimaryEnergyProductionHeatpumps_kW,
+ double v_currentEnergyCurtailed_kW,
+ double currentStoredEnergyBatteries_MWh,
+ EnergyModel energyModel
+ ) {
+
+ //EnergyCarrier import/exports
+ for (OL_EnergyCarriers EC : activeEnergyCarriers) {
+ this.am_totalBalanceAccumulators_kW.get(EC).addStep( fm_currentBalanceFlows_kW.get(EC) );
+ this.am_totalHeatFromEnergyCarrier_kW.get(EC).addStep( fm_heatFromEnergyCarrier_kW.get(EC) );
+ this.am_totalConsumptionForHeating_kW.get(EC).addStep( fm_consumptionForHeating_kW.get(EC) );
+ }
+
+ //AssetFlows
+ for (OL_AssetFlowCategories AC : assetsMetaData.activeAssetFlows) {
+ this.am_assetFlowsAccumulators_kW.get(AC).addStep ( fm_currentAssetFlows_kW.get(AC) );
+ }
+
+ // Daytime totals. Use overal-total minus daytime total to get nighttime totals.
+ if(energyModel.b_isDaytime) {
+
+ for (OL_EnergyCarriers EC : activeEnergyCarriers) {
+ double currentBalance_kW = fm_currentBalanceFlows_kW.get(EC);
+ if(activeConsumptionEnergyCarriers.contains(EC)){
+ am_daytimeImports_kW.get(EC).addStep(max( 0, currentBalance_kW ));
+ }
+ if(activeProductionEnergyCarriers.contains(EC)){
+ am_daytimeExports_kW.get(EC).addStep(max( 0, -currentBalance_kW ));
+ }
+ this.am_daytimeHeatFromEnergyCarrier_kW.get(EC).addStep( fm_heatFromEnergyCarrier_kW.get(EC) );
+ this.am_daytimeConsumptionForHeating_kW.get(EC).addStep( fm_consumptionForHeating_kW.get(EC) );
+ }
+
+ acc_daytimeElectricityProduction_kW.addStep(fm_currentProductionFlows_kW.get(OL_EnergyCarriers.ELECTRICITY) );
+ acc_daytimeElectricityConsumption_kW.addStep(fm_currentConsumptionFlows_kW.get(OL_EnergyCarriers.ELECTRICITY) );
+ acc_daytimeEnergyProduction_kW.addStep(v_currentPrimaryEnergyProduction_kW);
+ acc_daytimeFinalEnergyConsumption_kW.addStep(v_currentFinalEnergyConsumption_kW);
+ acc_daytimePrimaryEnergyProductionHeatpumps_kW.addStep(v_currentPrimaryEnergyProductionHeatpumps_kW);
+
+ for (OL_AssetFlowCategories AC : assetsMetaData.activeAssetFlows) {
+ this.am_assetFlowsDaytime_kW.get(AC).addStep( fm_currentAssetFlows_kW.get(AC) );
+ }
+ }
+
+ // Weekend totals. Use overal-totals minus weekend totals to get weekday totals.
+ if (!energyModel.b_isWeekday) { //
+ for (OL_EnergyCarriers EC : activeEnergyCarriers) {
+ double currentBalance_kW = fm_currentBalanceFlows_kW.get(EC);
+ if(activeConsumptionEnergyCarriers.contains(EC)){
+ am_weekendImports_kW.get(EC).addStep(max( 0, currentBalance_kW ));
+ }
+ if(activeProductionEnergyCarriers.contains(EC)){
+ am_weekendExports_kW.get(EC).addStep(max( 0, -currentBalance_kW ));
+ }
+ this.am_weekendHeatFromEnergyCarrier_kW.get(EC).addStep( fm_heatFromEnergyCarrier_kW.get(EC) );
+ this.am_weekendConsumptionForHeating_kW.get(EC).addStep( fm_consumptionForHeating_kW.get(EC) );
+ }
+
+ acc_weekendElectricityProduction_kW.addStep(fm_currentProductionFlows_kW.get(OL_EnergyCarriers.ELECTRICITY) );
+ acc_weekendElectricityConsumption_kW.addStep(fm_currentConsumptionFlows_kW.get(OL_EnergyCarriers.ELECTRICITY) );
+ acc_weekendEnergyProduction_kW.addStep(v_currentPrimaryEnergyProduction_kW);
+ acc_weekendFinalEnergyConsumption_kW.addStep(v_currentFinalEnergyConsumption_kW);
+ acc_weekendPrimaryEnergyProductionHeatpumps_kW.addStep(v_currentPrimaryEnergyProductionHeatpumps_kW);
+
+ for (OL_AssetFlowCategories AC : assetsMetaData.activeAssetFlows) {
+ this.am_assetFlowsWeekend_kW.get(AC).addStep( fm_currentAssetFlows_kW.get(AC) );
+ }
+ }
+
+ //========== SUMMER WEEK ==========//
+ if (energyModel.b_isSummerWeek){
+ for (OL_EnergyCarriers EC : activeEnergyCarriers) {
+ am_summerWeekBalanceAccumulators_kW.get(EC).addStep( fm_currentBalanceFlows_kW.get(EC) );
+ }
+ for (OL_EnergyCarriers EC : activeConsumptionEnergyCarriers) {
+ am_summerWeekConsumptionAccumulators_kW.get(EC).addStep( fm_currentConsumptionFlows_kW.get(EC) );
+ this.am_summerWeekHeatFromEnergyCarrier_kW.get(EC).addStep( fm_heatFromEnergyCarrier_kW.get(EC) );
+ this.am_summerWeekConsumptionForHeating_kW.get(EC).addStep( fm_consumptionForHeating_kW.get(EC) );
+
+ }
+ for (OL_EnergyCarriers EC : activeProductionEnergyCarriers) {
+ am_summerWeekProductionAccumulators_kW.get(EC).addStep( fm_currentProductionFlows_kW.get(EC) );
+ }
+
+ acc_summerWeekEnergyProduction_kW.addStep(v_currentPrimaryEnergyProduction_kW);
+ acc_summerWeekFinalEnergyConsumption_kW.addStep(v_currentFinalEnergyConsumption_kW);
+
+ acc_summerWeekEnergyCurtailed_kW.addStep(v_currentEnergyCurtailed_kW);
+ acc_summerWeekPrimaryEnergyProductionHeatpumps_kW.addStep(v_currentPrimaryEnergyProductionHeatpumps_kW);
+
+ acc_summerWeekDeliveryCapacity_kW.addStep( connectionMetaData.physicalCapacity_kW );
+ acc_summerWeekFeedinCapacity_kW.addStep( -connectionMetaData.physicalCapacity_kW );
+
+ //AssetFlows
+ for (OL_AssetFlowCategories AC : assetsMetaData.activeAssetFlows) {
+ this.am_assetFlowsSummerWeek_kW.get(AC).addStep ( fm_currentAssetFlows_kW.get(AC) );
+ }
+
+ ts_summerWeekBatteriesStoredEnergy_MWh.addStep(currentStoredEnergyBatteries_MWh);
+ if(assetsMetaData.totalInstalledBatteryStorageCapacity_MWh > 0){
+ ts_summerWeekBatteriesSOC_fr.addStep(currentStoredEnergyBatteries_MWh/assetsMetaData.totalInstalledBatteryStorageCapacity_MWh);
+ }
+ else{
+ ts_summerWeekBatteriesSOC_fr.addStep(0);
+ }
+ }
+
+ //========== WINTER WEEK ==========//
+ if (energyModel.b_isWinterWeek){
+ for (OL_EnergyCarriers EC : activeEnergyCarriers) {
+ am_winterWeekBalanceAccumulators_kW.get(EC).addStep( fm_currentBalanceFlows_kW.get(EC) );
+ }
+ for (OL_EnergyCarriers EC : activeConsumptionEnergyCarriers) {
+ am_winterWeekConsumptionAccumulators_kW.get(EC).addStep( fm_currentConsumptionFlows_kW.get(EC) );
+ this.am_winterWeekHeatFromEnergyCarrier_kW.get(EC).addStep( fm_heatFromEnergyCarrier_kW.get(EC) );
+ this.am_winterWeekConsumptionForHeating_kW.get(EC).addStep( fm_consumptionForHeating_kW.get(EC) );
+ }
+ for (OL_EnergyCarriers EC : activeProductionEnergyCarriers) {
+ am_winterWeekProductionAccumulators_kW.get(EC).addStep( fm_currentProductionFlows_kW.get(EC) );
+ }
+
+ acc_winterWeekEnergyProduction_kW.addStep(v_currentPrimaryEnergyProduction_kW);
+ acc_winterWeekFinalEnergyConsumption_kW.addStep(v_currentFinalEnergyConsumption_kW);
+
+ acc_winterWeekEnergyCurtailed_kW.addStep(v_currentEnergyCurtailed_kW);
+ acc_winterWeekPrimaryEnergyProductionHeatpumps_kW.addStep(v_currentPrimaryEnergyProductionHeatpumps_kW);
+
+ acc_winterWeekDeliveryCapacity_kW.addStep( connectionMetaData.physicalCapacity_kW );
+ acc_winterWeekFeedinCapacity_kW.addStep( -connectionMetaData.physicalCapacity_kW );
+ //AssetFlows
+ for (OL_AssetFlowCategories AC : assetsMetaData.activeAssetFlows) {
+ this.am_assetFlowsWinterWeek_kW.get(AC).addStep ( fm_currentAssetFlows_kW.get(AC) );
+ }
+
+
+ ts_winterWeekBatteriesStoredEnergy_MWh.addStep(currentStoredEnergyBatteries_MWh);
+
+ if(assetsMetaData.totalInstalledBatteryStorageCapacity_MWh > 0){
+ ts_winterWeekBatteriesSOC_fr.addStep(currentStoredEnergyBatteries_MWh/assetsMetaData.totalInstalledBatteryStorageCapacity_MWh);
+ }
+ else{
+ ts_winterWeekBatteriesSOC_fr.addStep(0);
+ }
+ }
+
+ //========== TOTALS / DAILY AVERAGES ==========//
+ for (OL_EnergyCarriers EC : activeConsumptionEnergyCarriers) {
+ am_dailyAverageConsumptionAccumulators_kW.get(EC).addStep( fm_currentConsumptionFlows_kW.get(EC) );
+ }
+ for (OL_EnergyCarriers EC : activeProductionEnergyCarriers) {
+ am_dailyAverageProductionAccumulators_kW.get(EC).addStep( fm_currentProductionFlows_kW.get(EC) );
+ }
+ acc_dailyAverageEnergyProduction_kW.addStep(v_currentPrimaryEnergyProduction_kW);
+ acc_dailyAverageFinalEnergyConsumption_kW.addStep(v_currentFinalEnergyConsumption_kW);
+ acc_totalEnergyCurtailed_kW.addStep(v_currentEnergyCurtailed_kW);
+ acc_totalPrimaryEnergyProductionHeatpumps_kW.addStep(v_currentPrimaryEnergyProductionHeatpumps_kW);
+
+ if(this.assetsMetaData.activeAssetFlows.contains(OL_AssetFlowCategories.batteriesChargingPower_kW)) {
+ ts_dailyAverageBatteriesStoredEnergy_MWh.addStep(currentStoredEnergyBatteries_MWh);
+ }
+
+ }
+
+
+ public J_LoadDurationCurves getLoadDurationCurves(EnergyModel energyModel) {
+ return new J_LoadDurationCurves(this.am_totalBalanceAccumulators_kW.get(OL_EnergyCarriers.ELECTRICITY).getTimeSeries_kW(), energyModel);
+ }
+
+ public double getTotalOverloadDurationDelivery_hr() {
+ double totalOverloadDurationDelivery_hr = 0.0;
+ double signalResolution_h = am_totalBalanceAccumulators_kW.get(OL_EnergyCarriers.ELECTRICITY).getSignalResolution_h();
+ for (double electricityBalance_kW : am_totalBalanceAccumulators_kW.get(OL_EnergyCarriers.ELECTRICITY).getTimeSeries_kW()) {
+ if(electricityBalance_kW > connectionMetaData.contractedDeliveryCapacity_kW){
+ totalOverloadDurationDelivery_hr += signalResolution_h;
+ }
+ }
+ return totalOverloadDurationDelivery_hr;
+ }
+
+ public double getTotalOverloadDurationFeedin_hr() {
+ double totalOverloadDurationFeedin_hr = 0.0;
+ double signalResolution_h = am_totalBalanceAccumulators_kW.get(OL_EnergyCarriers.ELECTRICITY).getSignalResolution_h();
+ for (double electricityBalance_kW : am_totalBalanceAccumulators_kW.get(OL_EnergyCarriers.ELECTRICITY).getTimeSeries_kW()) {
+ if(electricityBalance_kW < -connectionMetaData.contractedFeedinCapacity_kW){
+ totalOverloadDurationFeedin_hr += signalResolution_h;
+ }
+ }
+ return totalOverloadDurationFeedin_hr;
+ }
+
+
+ public double getPeakDelivery_kW() {
+ return max(0, getHighestBalance_kW(OL_EnergyCarriers.ELECTRICITY));
+ }
+
+ public double getPeakFeedin_kW() {
+ return max(0, -getLowestBalance_kW(OL_EnergyCarriers.ELECTRICITY));
+ }
+
+
+ public double getHighestBalance_kW(OL_EnergyCarriers EC) {
+ return max(this.am_totalBalanceAccumulators_kW.get(EC).getTimeSeries_kW());
+ }
+
+ public double getLowestBalance_kW(OL_EnergyCarriers EC) {
+ return min(this.am_totalBalanceAccumulators_kW.get(EC).getTimeSeries_kW());
+ }
+
+ public Double getHighestBalanceTime_h(OL_EnergyCarriers EC) {
+ double[] ECBalance_kW = am_totalBalanceAccumulators_kW.get(EC).getTimeSeries_kW();
+
+ Integer maxIndex = 0; // index with peak import
+ for (int i = 1; i < ECBalance_kW.length; i++) {
+ if (ECBalance_kW[i] > ECBalance_kW[maxIndex]) {
+ maxIndex = i;
+ }
+ }
+ return maxIndex*timeStep_h;
+ }
+
+ public Double getLowestBalanceTime_h(OL_EnergyCarriers EC) {
+ double[] ECBalance_kW = am_totalBalanceAccumulators_kW.get(EC).getTimeSeries_kW();
+
+ Integer minIndex = 0; // index with peak export
+ for (int i = 1; i < ECBalance_kW.length; i++) {
+ if (ECBalance_kW[i] < ECBalance_kW[minIndex]) {
+ minIndex = i;
+ }
+ }
+ return minIndex*timeStep_h;
+ }
+
+ public double getHighestBalanceWeekStart_h(OL_EnergyCarriers EC) {
+ double peakTime_h = getHighestBalanceTime_h(EC);
+ return getPeakWeekStart_h(peakTime_h);
+ }
+
+ public double getLowestBalanceWeekStart_h(OL_EnergyCarriers EC) {
+ double peakTime_h = getLowestBalanceTime_h(EC);
+ return getPeakWeekStart_h(peakTime_h);
+ }
+
+ public double getPeakWeekStart_h(double peakTime_h) {
+ double duration_h = am_totalBalanceAccumulators_kW.get(OL_EnergyCarriers.ELECTRICITY).getDuration(); // Take random balance accumulator for sim duration
+ return min(duration_h-7*24,max(0,peakTime_h - 3.5*24)); // return start of week hour, capped between 0 and simDuration_h - 7*24
+ }
+
+
+ public ZeroTimeSeries getBatteriesSOCts_fr() {
+ double[] array = this.ts_dailyAverageBatteriesStoredEnergy_MWh.getTimeSeries();
+ double factor_fr = 1/assetsMetaData.totalInstalledBatteryStorageCapacity_MWh;
+ //traceln("ts_dailyAverageBatteriesStoredEnergy_MWh.getSignalResolution_h(): %s", ts_dailyAverageBatteriesStoredEnergy_MWh.getSignalResolution_h());
+ ZeroTimeSeries ts = new ZeroTimeSeries(ts_dailyAverageBatteriesStoredEnergy_MWh.getSignalResolution_h(), ts_dailyAverageBatteriesStoredEnergy_MWh.getDuration());
+ for (int i=0; i<array.length; i++) {
+ ts.addStep(array[i]*factor_fr);
+ }
+ return ts;
+ }
+
+ public Pair<Double, Double> getFlexPotential() {
+ // Check if capacity is known
+ Double possibleGrowthFactor_fr;
+ Double requiredBatteryCapacity_kWh;
+ if (connectionMetaData.contractedDeliveryCapacityKnown) {
+ // Find day with max capacity utilisation
+ ZeroAccumulator acc_dailyAvgElectricityConsumption_kW = am_dailyAverageConsumptionAccumulators_kW.get(OL_EnergyCarriers.ELECTRICITY);
+ ZeroAccumulator acc_dailyAvgElectricityProduction_kW = am_dailyAverageProductionAccumulators_kW.get(OL_EnergyCarriers.ELECTRICITY);
+ ZeroAccumulator acc_dailyAvgNettElectricityDelivery_kW = acc_dailyAvgElectricityConsumption_kW.getClone().subtract(acc_dailyAvgElectricityProduction_kW);
+ double[] dailyAvgs_kW = acc_dailyAvgNettElectricityDelivery_kW.getTimeSeries_kW();
+
+ int maxDay = 0;
+ for (int i = 0; i < dailyAvgs_kW.length; i++) {
+ maxDay = dailyAvgs_kW[i] > dailyAvgs_kW[maxDay] ? i : maxDay;
+ }
+ //traceln("Max day: %s, average power %s kW", maxDay, dailyAvgs_kW[maxDay]);
+ // Maximum growth is when dailyAvg delivery would be equal to contracted delivery capacity.
+ possibleGrowthFactor_fr = connectionMetaData.contractedDeliveryCapacity_kW / dailyAvgs_kW[maxDay];
+ if ( possibleGrowthFactor_fr < 1.0) {
+ //traceln("Already overutilising contracted delivery capacity over one day!! Probably an infeasible results...Growth factor: %s", possibleGrowthFactor_fr);
+ requiredBatteryCapacity_kWh = 0.0;
+ } else {
+ //traceln("possibleGrowth: %s ", possibleGrowthFactor_fr);
+ double[] dayProfile_kW = Arrays.copyOfRange(am_totalBalanceAccumulators_kW.get(OL_EnergyCarriers.ELECTRICITY).getTimeSeries_kW(),roundToInt(24.0/timeStep_h * maxDay), roundToInt(24.0/timeStep_h * (maxDay+1)));
+ double[] dayProfileScaled_kW = ZeroMath.arrayMultiply(dayProfile_kW, possibleGrowthFactor_fr);
+ double[] SoC_kWh = new double[roundToInt(24/timeStep_h)+1];
+ double minSoC_kWh = 0.0;
+ double maxSoC_kWh = 0.0;
+ for(int i = 0; i < roundToInt(24/timeStep_h); i++) {
+ SoC_kWh[i+1] = SoC_kWh[i] + (dayProfileScaled_kW[i] - possibleGrowthFactor_fr * dailyAvgs_kW[maxDay] ) * timeStep_h;
+ minSoC_kWh = min(minSoC_kWh, SoC_kWh[i+1]);
+ maxSoC_kWh = max(maxSoC_kWh, SoC_kWh[i+1]);
+ }
+ requiredBatteryCapacity_kWh = maxSoC_kWh - minSoC_kWh;
+ //traceln("Battery size to allow growth: %s kWh", requiredBatteryCapacity_kWh);
+ }
+ } else {
+ traceln("Gridconnection contracted delivery capacity unknown!");
+ possibleGrowthFactor_fr = null;
+ requiredBatteryCapacity_kWh = 0.0;
+ }
+
+ return new Pair(possibleGrowthFactor_fr, requiredBatteryCapacity_kWh);
+ }
+
+ public double getTotalElectricityConsumed_MWh() {
+ return am_dailyAverageConsumptionAccumulators_kW.get(OL_EnergyCarriers.ELECTRICITY).getIntegral_MWh();
+ }
+ public double getTotalElectricityProduced_MWh() {
+ return am_dailyAverageProductionAccumulators_kW.get(OL_EnergyCarriers.ELECTRICITY).getIntegral_MWh();
+ }
+ public double getTotalElectricitySelfConsumed_MWh() {
+ return max(0, getTotalElectricityConsumed_MWh() - getTotalImport_MWh(OL_EnergyCarriers.ELECTRICITY));
+ }
+ public double getTotalEnergyConsumed_MWh() {
+ return acc_dailyAverageFinalEnergyConsumption_kW.getIntegral_MWh();
+ }
+ public double getTotalEnergyProduced_MWh() {
+ return acc_dailyAverageEnergyProduction_kW.getIntegral_MWh();
+ }
+ public double getTotalEnergyCurtailed_MWh() {
+ return acc_totalEnergyCurtailed_kW.getIntegral_MWh();
+ }
+ public double getTotalEnergyImport_MWh() {
+ return this.am_totalBalanceAccumulators_kW.totalIntegralPos_MWh();
+ }
+ public double getTotalEnergyExport_MWh() {
+ return -this.am_totalBalanceAccumulators_kW.totalIntegralNeg_MWh();
+ }
+
+ public double getTotalExport_MWh( OL_EnergyCarriers EC ) {
+ if (!this.activeEnergyCarriers.contains(EC)) {
+ throw new RuntimeException("RapidRunData class does not contain energycarrier: " + EC);
+ }
+ return -this.am_totalBalanceAccumulators_kW.get(EC).getIntegralNeg_MWh();
+ }
+ public double getTotalImport_MWh( OL_EnergyCarriers EC ) {
+ if (!this.activeEnergyCarriers.contains(EC)) {
+ throw new RuntimeException("RapidRunData class does not contain energycarrier: " + EC);
+ }
+ return this.am_totalBalanceAccumulators_kW.get(EC).getIntegralPos_MWh();
+ }
+
+ public double getTotalEnergySelfConsumed_MWh() {
+ return max(0, getTotalEnergyConsumed_MWh() - getTotalEnergyImport_MWh());
+ }
+ public double getTotalPrimaryEnergyProductionHeatpumps_MWh() {
+ return acc_totalPrimaryEnergyProductionHeatpumps_kW.getIntegral_MWh();
+ }
+ public double getTotalDistrictHeatingConsumption_MWh() {
+ if (assetsMetaData.activeAssetFlows.contains(OL_AssetFlowCategories.districtHeatDelivery_kW)) {
+ return am_assetFlowsAccumulators_kW.get(OL_AssetFlowCategories.districtHeatDelivery_kW).getIntegral_MWh();
+ } else {
+ return 0.0;
+ }
+ }
+
+ public double getTotalBatteryCycles() {
+ if (assetsMetaData.activeAssetFlows.contains(OL_AssetFlowCategories.batteriesChargingPower_kW)) {
+ return am_assetFlowsAccumulators_kW.get(OL_AssetFlowCategories.batteriesChargingPower_kW).getIntegral_MWh()/this.assetsMetaData.totalInstalledBatteryStorageCapacity_MWh;
+ } else {
+ return 0.0;
+ }
+ }
+
+// Summerweek Getters
+ public double getSummerWeekElectricityConsumed_MWh() {
+ return am_summerWeekConsumptionAccumulators_kW.get(OL_EnergyCarriers.ELECTRICITY).getIntegral_MWh();
+ }
+ public double getSummerWeekElectricityProduced_MWh() {
+ return am_summerWeekProductionAccumulators_kW.get(OL_EnergyCarriers.ELECTRICITY).getIntegral_MWh();
+ }
+ public double getSummerWeekElectricitySelfConsumed_MWh() {
+ return max(0, getSummerWeekElectricityConsumed_MWh() - getSummerWeekImport_MWh(OL_EnergyCarriers.ELECTRICITY));
+ }
+ public double getSummerWeekEnergyConsumed_MWh() {
+ return acc_summerWeekFinalEnergyConsumption_kW.getIntegral_MWh();
+ }
+ public double getSummerWeekEnergyProduced_MWh() {
+ return acc_summerWeekEnergyProduction_kW.getIntegral_MWh();
+ }
+ public double getSummerWeekEnergyCurtailed_MWh() {
+ return acc_summerWeekEnergyCurtailed_kW.getIntegral_MWh();
+ }
+ public double getSummerWeekEnergyImport_MWh() {
+ return this.am_summerWeekBalanceAccumulators_kW.totalIntegralPos_MWh();
+ }
+ public double getSummerWeekEnergyExport_MWh() {
+ return -this.am_summerWeekBalanceAccumulators_kW.totalIntegralNeg_MWh();
+ }
+
+ public double getSummerWeekExport_MWh( OL_EnergyCarriers EC ) {
+ if (!this.activeEnergyCarriers.contains(EC)) {
+ throw new RuntimeException("RapidRunData class does not contain energycarrier: " + EC);
+ }
+ return -this.am_summerWeekBalanceAccumulators_kW.get(EC).getIntegralNeg_MWh();
+ }
+ public double getSummerWeekImport_MWh( OL_EnergyCarriers EC ) {
+ if (!this.activeEnergyCarriers.contains(EC)) {
+ throw new RuntimeException("RapidRunData class does not contain energycarrier: " + EC);
+ }
+ return this.am_summerWeekBalanceAccumulators_kW.get(EC).getIntegralPos_MWh();
+ }
+
+ public double getSummerWeekEnergySelfConsumed_MWh() {
+ return max(0, getSummerWeekEnergyConsumed_MWh() - getSummerWeekEnergyImport_MWh());
+ }
+ public double getSummerWeekPrimaryEnergyProductionHeatpumps_MWh() {
+ return acc_summerWeekPrimaryEnergyProductionHeatpumps_kW.getIntegral_MWh();
+ }
+
+ public double getSummerWeekBatteryCycles() {
+ if (am_assetFlowsSummerWeek_kW.keySet().contains(OL_AssetFlowCategories.batteriesChargingPower_kW)) {
+ return am_assetFlowsSummerWeek_kW.get(OL_AssetFlowCategories.batteriesChargingPower_kW).getIntegral_MWh()/this.assetsMetaData.totalInstalledBatteryStorageCapacity_MWh;
+ } else {
+ return 0.0;
+ }
+ //return acc_summerWeekBatteriesConsumption_kW.getIntegral_MWh()/this.assetsMetaData.totalInstalledBatteryStorageCapacity_MWh;
+ }
+
+// Winterweek Getters
+ public double getWinterWeekElectricityConsumed_MWh() {
+ return am_winterWeekConsumptionAccumulators_kW.get(OL_EnergyCarriers.ELECTRICITY).getIntegral_MWh();
+ }
+ public double getWinterWeekElectricityProduced_MWh() {
+ return am_winterWeekProductionAccumulators_kW.get(OL_EnergyCarriers.ELECTRICITY).getIntegral_MWh();
+ }
+ public double getWinterWeekElectricitySelfConsumed_MWh() {
+ return max(0, getWinterWeekElectricityConsumed_MWh() - getWinterWeekImport_MWh(OL_EnergyCarriers.ELECTRICITY));
+ }
+ public double getWinterWeekEnergyConsumed_MWh() {
+ return acc_winterWeekFinalEnergyConsumption_kW.getIntegral_MWh();
+ }
+ public double getWinterWeekEnergyProduced_MWh() {
+ return acc_winterWeekEnergyProduction_kW.getIntegral_MWh();
+ }
+ public double getWinterWeekEnergyCurtailed_MWh() {
+ return acc_winterWeekEnergyCurtailed_kW.getIntegral_MWh();
+ }
+ public double getWinterWeekEnergyImport_MWh() {
+ return this.am_winterWeekBalanceAccumulators_kW.totalIntegralPos_MWh();
+ }
+ public double getWinterWeekEnergyExport_MWh() {
+ return -this.am_winterWeekBalanceAccumulators_kW.totalIntegralNeg_MWh();
+ }
+ public double getWinterWeekExport_MWh( OL_EnergyCarriers EC ) {
+ if (!this.activeEnergyCarriers.contains(EC)) {
+ throw new RuntimeException("RapidRunData class does not contain energycarrier: " + EC);
+ }
+ return -this.am_winterWeekBalanceAccumulators_kW.get(EC).getIntegralNeg_MWh();
+ }
+ public double getWinterWeekImport_MWh( OL_EnergyCarriers EC ) {
+ if (!this.activeEnergyCarriers.contains(EC)) {
+ throw new RuntimeException("RapidRunData class does not contain energycarrier: " + EC);
+ }
+ return this.am_winterWeekBalanceAccumulators_kW.get(EC).getIntegralPos_MWh();
+ }
+
+ public double getWinterWeekEnergySelfConsumed_MWh() {
+ return max(0, getWinterWeekEnergyConsumed_MWh() - getWinterWeekEnergyImport_MWh());
+ }
+ public double getWinterWeekPrimaryEnergyProductionHeatpumps_MWh() {
+ return acc_winterWeekPrimaryEnergyProductionHeatpumps_kW.getIntegral_MWh();
+ }
+
+ public double getWinterWeekBatteryCycles() {
+ if (am_assetFlowsWinterWeek_kW.keySet().contains(OL_AssetFlowCategories.batteriesChargingPower_kW)) {
+ return am_assetFlowsWinterWeek_kW.get(OL_AssetFlowCategories.batteriesChargingPower_kW).getIntegral_MWh()/this.assetsMetaData.totalInstalledBatteryStorageCapacity_MWh;
+ } else {
+ return 0.0;
+ }
+ //return acc_winterWeekBatteriesConsumption_kW.getIntegral_MWh()/this.assetsMetaData.totalInstalledBatteryStorageCapacity_MWh;
+ }
+
+// Daytime getters
+ public double getDaytimeElectricityConsumed_MWh() {
+ return acc_daytimeElectricityConsumption_kW.getIntegral_MWh();
+ }
+ public double getDaytimeElectricityProduced_MWh() {
+ return acc_daytimeElectricityProduction_kW.getIntegral_MWh();
+ }
+ public double getDaytimeElectricitySelfConsumed_MWh() {
+ return max(0, getDaytimeElectricityConsumed_MWh() - getDaytimeImport_MWh(OL_EnergyCarriers.ELECTRICITY));
+ }
+ public double getDaytimeEnergyConsumed_MWh() {
+ return acc_daytimeFinalEnergyConsumption_kW.getIntegral_MWh();
+ }
+ public double getDaytimeEnergyProduced_MWh() {
+ return acc_daytimeEnergyProduction_kW.getIntegral_MWh();
+ }
+ public double getDaytimeEnergyExport_MWh() {
+ return am_daytimeExports_kW.totalIntegral_MWh();
+ }
+ public double getDaytimeEnergyImport_MWh() {
+ return am_daytimeImports_kW.totalIntegral_MWh();
+ }
+ public double getDaytimeEnergySelfConsumed_MWh() {
+ return max(0, getDaytimeEnergyProduced_MWh() - getDaytimeEnergyExport_MWh());
+ }
+ public double getDaytimeExport_MWh( OL_EnergyCarriers EC ) {
+ if (!this.activeEnergyCarriers.contains(EC)) {
+ throw new RuntimeException("RapidRunData class does not contain energycarrier: " + EC);
+ }
+ return this.am_daytimeExports_kW.get(EC).getIntegral_MWh();
+ }
+ public double getDaytimeImport_MWh( OL_EnergyCarriers EC ) {
+ if (!this.activeEnergyCarriers.contains(EC)) {
+ throw new RuntimeException("RapidRunData class does not contain energycarrier: " + EC);
+ }
+ return this.am_daytimeImports_kW.get(EC).getIntegral_MWh();
+ }
+ public double getDaytimePrimaryEnergyProductionHeatpumps_MWh() {
+ return this.acc_daytimePrimaryEnergyProductionHeatpumps_kW.getIntegral_MWh();
+ }
+//Nighttime Getters
+ public double getNighttimeElectricityConsumed_MWh() {
+ return getTotalElectricityConsumed_MWh() - getDaytimeElectricityConsumed_MWh();
+ }
+ public double getNighttimeElectricityProduced_MWh() {
+ return getTotalElectricityProduced_MWh() - getDaytimeElectricityProduced_MWh();
+ }
+ public double getNighttimeElectricitySelfConsumed_MWh() {
+ return max(0, getNighttimeElectricityConsumed_MWh() - getNighttimeImport_MWh(OL_EnergyCarriers.ELECTRICITY));
+ }
+ public double getNighttimeEnergyConsumed_MWh() {
+ return getTotalEnergyConsumed_MWh() - getDaytimeEnergyConsumed_MWh();
+ }
+ public double getNighttimeEnergyProduced_MWh() {
+ return getTotalEnergyProduced_MWh() - getDaytimeEnergyProduced_MWh();
+ }
+ public double getNighttimeEnergyExport_MWh() {
+ return getTotalEnergyExport_MWh() - getDaytimeEnergyExport_MWh();
+ }
+ public double getNighttimeEnergyImport_MWh() {
+ return getTotalEnergyImport_MWh() - getDaytimeEnergyImport_MWh();
+ }
+ public double getNighttimeEnergySelfConsumed_MWh() {
+ return max(0, getNighttimeEnergyProduced_MWh() - getNighttimeEnergyExport_MWh());
+ }
+ public double getNighttimeExport_MWh( OL_EnergyCarriers EC ) {
+ if (!this.activeEnergyCarriers.contains(EC)) {
+ throw new RuntimeException("RapidRunData class does not contain energycarrier: " + EC);
+ }
+ return -this.am_totalBalanceAccumulators_kW.get(EC).getIntegralNeg_MWh() - this.getDaytimeExport_MWh(EC);
+ }
+ public double getNighttimeImport_MWh( OL_EnergyCarriers EC ) {
+ if (!this.activeEnergyCarriers.contains(EC)) {
+ throw new RuntimeException("RapidRunData class does not contain energycarrier: " + EC);
+ }
+ return this.am_totalBalanceAccumulators_kW.get(EC).getIntegralPos_MWh() - this.getDaytimeImport_MWh(EC);
+ }
+ public double getNighttimePrimaryEnergyProductionHeatpumps_MWh() {
+ return this.getTotalPrimaryEnergyProductionHeatpumps_MWh() - this.getDaytimePrimaryEnergyProductionHeatpumps_MWh();
+ }
+// Weekday Getters
+ public double getWeekdayElectricityConsumed_MWh() {
+ return getTotalElectricityConsumed_MWh() - getWeekendElectricityConsumed_MWh();
+ }
+ public double getWeekdayElectricityProduced_MWh() {
+ return getTotalElectricityProduced_MWh() - getWeekendElectricityProduced_MWh();
+ }
+ public double getWeekdayElectricitySelfConsumed_MWh() {
+ return max(0, getWeekdayElectricityConsumed_MWh() - getWeekdayImport_MWh(OL_EnergyCarriers.ELECTRICITY));
+ }
+ public double getWeekdayEnergyConsumed_MWh() {
+ return getTotalEnergyConsumed_MWh() - getWeekendEnergyConsumed_MWh();
+ }
+ public double getWeekdayEnergyProduced_MWh() {
+ return getTotalEnergyProduced_MWh() - getWeekendEnergyProduced_MWh();
+ }
+ public double getWeekdayEnergyExport_MWh() {
+ return getTotalEnergyExport_MWh() - getWeekendEnergyExport_MWh();
+ }
+ public double getWeekdayEnergyImport_MWh() {
+ return getTotalEnergyImport_MWh() - getWeekendEnergyImport_MWh();
+ }
+ public double getWeekdayEnergySelfConsumed_MWh() {
+ return max(0, getWeekdayEnergyProduced_MWh() - getWeekdayEnergyExport_MWh());
+ }
+ public double getWeekdayExport_MWh( OL_EnergyCarriers EC ) {
+ if (!this.activeEnergyCarriers.contains(EC)) {
+ throw new RuntimeException("RapidRunData class does not contain energycarrier: " + EC);
+ }
+ return -this.am_totalBalanceAccumulators_kW.get(EC).getIntegralNeg_MWh() - this.getWeekendExport_MWh(EC);
+ }
+ public double getWeekdayImport_MWh( OL_EnergyCarriers EC ) {
+ if (!this.activeEnergyCarriers.contains(EC)) {
+ throw new RuntimeException("RapidRunData class does not contain energycarrier: " + EC);
+ }
+ return this.am_totalBalanceAccumulators_kW.get(EC).getIntegralPos_MWh() - this.getWeekendImport_MWh(EC);
+ }
+ public double getWeekdayPrimaryEnergyProductionHeatpumps_MWh() {
+ return this.getTotalPrimaryEnergyProductionHeatpumps_MWh() - this.getWeekendPrimaryEnergyProductionHeatpumps_MWh();
+ }
+//Weekend Getters
+ public double getWeekendElectricityConsumed_MWh() {
+ return acc_weekendElectricityConsumption_kW.getIntegral_MWh();
+ }
+ public double getWeekendElectricityProduced_MWh() {
+ return acc_weekendElectricityProduction_kW.getIntegral_MWh();
+ }
+ public double getWeekendElectricitySelfConsumed_MWh() {
+ return max(0, getWeekendElectricityConsumed_MWh() - getWeekendImport_MWh(OL_EnergyCarriers.ELECTRICITY));
+ }
+ public double getWeekendEnergyConsumed_MWh() {
+ return acc_weekendFinalEnergyConsumption_kW.getIntegral_MWh();
+ }
+ public double getWeekendEnergyProduced_MWh() {
+ return acc_weekendEnergyProduction_kW.getIntegral_MWh();
+ }
+ public double getWeekendEnergyExport_MWh() {
+ return am_weekendExports_kW.totalIntegral_MWh();
+ }
+ public double getWeekendEnergyImport_MWh() {
+ return am_weekendImports_kW.totalIntegral_MWh();
+ }
+ public double getWeekendEnergySelfConsumed_MWh() {
+ return max(0, getWeekendEnergyProduced_MWh() - getWeekendEnergyExport_MWh());
+ }
+ public double getWeekendExport_MWh( OL_EnergyCarriers EC ) {
+ if (!this.activeEnergyCarriers.contains(EC)) {
+ throw new RuntimeException("RapidRunData class does not contain energycarrier: " + EC);
+ }
+ return this.am_weekendExports_kW.get(EC).getIntegral_MWh();
+ }
+ public double getWeekendImport_MWh( OL_EnergyCarriers EC ) {
+ if (!this.activeEnergyCarriers.contains(EC)) {
+ throw new RuntimeException("RapidRunData class does not contain energycarrier: " + EC);
+ }
+ return this.am_weekendImports_kW.get(EC).getIntegral_MWh();
+ }
+ public double getWeekendPrimaryEnergyProductionHeatpumps_MWh() {
+ return this.acc_weekendPrimaryEnergyProductionHeatpumps_kW.getIntegral_MWh();
+ }
+
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+
+ sb.append("Active Energy Carriers: ");
+ sb.append(this.activeEnergyCarriers);
+ sb.append(System.lineSeparator());
+ sb.append("Consumption Carriers: ");
+ sb.append(this.activeConsumptionEnergyCarriers);
+ sb.append(System.lineSeparator());
+ sb.append("Production Carriers: ");
+ sb.append(this.activeProductionEnergyCarriers);
+ sb.append(System.lineSeparator());
+ sb.append("Asset Flow Caterogies: ");
+ sb.append(this.assetsMetaData.activeAssetFlows);
+
+ return sb.toString(); }
+}
+
+
+ 1741180880935
+ J_LiveData
+ 1752680962144
+ import java.util.EnumSet;
+/**
+ * J_LiveData
+ */
+//import com.fasterxml.jackson.annotation.JsonIgnoreType;
+
+public class J_LiveData {
+
+ public Agent parentAgent;
+ public EnumSet<OL_EnergyCarriers> activeEnergyCarriers;
+ public EnumSet<OL_EnergyCarriers> activeConsumptionEnergyCarriers;
+ public EnumSet<OL_EnergyCarriers> activeProductionEnergyCarriers;
+
+ public J_AssetsMetaData assetsMetaData;
+ public J_ConnectionMetaData connectionMetaData;
+
+ public J_DataSetMap dsm_liveDemand_kW = new J_DataSetMap(OL_EnergyCarriers.class);
+ public J_DataSetMap dsm_liveSupply_kW = new J_DataSetMap(OL_EnergyCarriers.class);
+
+ public DataSet data_totalDemand_kW = new DataSet(672);
+ public DataSet data_totalSupply_kW = new DataSet(672);
+ public DataSet data_liveElectricityBalance_kW = new DataSet(672);
+ public DataSet data_gridCapacityDemand_kW = new DataSet(672);
+ public DataSet data_gridCapacitySupply_kW = new DataSet(672);
+
+ public J_DataSetMap<OL_AssetFlowCategories> dsm_liveAssetFlows_kW = new J_DataSetMap(OL_AssetFlowCategories.class);
+ public DataSet data_batteryStoredEnergyLiveWeek_MWh = new DataSet(672);
+ public DataSet data_batterySOC_fr = new DataSet(672);
+ /**
+ * Default constructor
+ */
+
+ public J_LiveData() { // needed for deserialisation
+
+ }
+
+ public J_LiveData(Agent parentAgent) {
+ this.parentAgent = parentAgent;
+ }
+
+ public void clearLiveDatasets() {
+ for(OL_EnergyCarriers EC : activeConsumptionEnergyCarriers){
+ dsm_liveDemand_kW.get(EC).reset();
+ }
+
+ for(OL_EnergyCarriers EC : activeProductionEnergyCarriers){
+ dsm_liveSupply_kW.get(EC).reset();
+ }
+
+ for (OL_AssetFlowCategories AC : assetsMetaData.activeAssetFlows) { // First add missing assetFlow datasets if there are any
+ dsm_liveAssetFlows_kW.get(AC).reset();
+ }
+
+ data_totalDemand_kW.reset();
+ data_totalSupply_kW.reset();
+ data_liveElectricityBalance_kW.reset();
+ data_gridCapacityDemand_kW.reset();
+ data_gridCapacitySupply_kW.reset();
+
+
+ data_batteryStoredEnergyLiveWeek_MWh.reset();
+ data_batterySOC_fr.reset();
+
+ }
+
+ public void resetLiveDatasets(double startTime, double endTime, double timeStep_h) {
+ for(OL_EnergyCarriers EC : activeConsumptionEnergyCarriers){
+ DataSet dsDemand = new DataSet( (int)(168 / timeStep_h) );
+ for (double t = startTime; t < endTime; t += timeStep_h) {
+ dsDemand.add( t, 0);
+ }
+ dsm_liveDemand_kW.put( EC, dsDemand);
+ }
+
+ for(OL_EnergyCarriers EC : activeProductionEnergyCarriers){
+ DataSet dsSupply = new DataSet( (int)(168 / timeStep_h) );
+ for (double t = startTime; t < endTime; t += timeStep_h) {
+ dsSupply.add( t, 0);
+ }
+ dsm_liveSupply_kW.put( EC, dsSupply);
+ }
+
+ for (OL_AssetFlowCategories AC : assetsMetaData.activeAssetFlows) { // First add missing assetFlow datasets if there are any
+ if (!dsm_liveAssetFlows_kW.keySet().contains(AC)) {
+ DataSet dsAsset = new DataSet((int)(168 / timeStep_h));
+ dsm_liveAssetFlows_kW.put(AC, dsAsset);
+ }
+ }
+
+ for (double t = startTime; t < endTime; t += timeStep_h) {
+
+ for (OL_AssetFlowCategories AC : assetsMetaData.activeAssetFlows) {
+ dsm_liveAssetFlows_kW.get(AC).add(t, 0);
+ }
+
+ data_totalDemand_kW.add( t, 0);
+ data_totalSupply_kW.add( t, 0);
+ data_liveElectricityBalance_kW.add( t, 0);
+ data_gridCapacityDemand_kW.add( t, 0);
+ data_gridCapacitySupply_kW.add( t, 0);
+
+
+ data_batteryStoredEnergyLiveWeek_MWh.add( t, 0);
+ data_batterySOC_fr.add( t, 0);
+ }
+ }
+
+ public void addTimeStep(double currentTime_h, J_FlowsMap fm_currentBalanceFlows_kW, J_FlowsMap fm_currentConsumptionFlows_kW, J_FlowsMap fm_currentProductionFlows_kW, J_ValueMap<OL_AssetFlowCategories> assetFlowsMap, double v_currentPrimaryEnergyProduction_kW, double v_currentFinalEnergyConsumption_kW, double v_currentPrimaryEnergyProductionHeatpumps_kW, double v_currentEnergyCurtailed_kW, double currentStoredEnergyBatteries_MWh) {
+
+ //Energy carrier flows
+ for (OL_EnergyCarriers EC : activeConsumptionEnergyCarriers) {
+ this.dsm_liveDemand_kW.get(EC).add( currentTime_h, roundToDecimal(fm_currentConsumptionFlows_kW.get(EC), 3) );
+ }
+ for (OL_EnergyCarriers EC : activeProductionEnergyCarriers) {
+ this.dsm_liveSupply_kW.get(EC).add( currentTime_h, roundToDecimal(fm_currentProductionFlows_kW.get(EC), 3) );
+ }
+
+ //Electricity balance
+ this.data_liveElectricityBalance_kW.add(currentTime_h, fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.ELECTRICITY));
+
+ //Total demand and supply
+ this.data_totalDemand_kW.add(currentTime_h, v_currentFinalEnergyConsumption_kW);
+ this.data_totalSupply_kW.add(currentTime_h, v_currentPrimaryEnergyProduction_kW);
+
+ //Live capacity datasets
+ this.data_gridCapacityDemand_kW.add(currentTime_h, connectionMetaData.contractedDeliveryCapacity_kW);
+ this.data_gridCapacitySupply_kW.add(currentTime_h, -connectionMetaData.contractedFeedinCapacity_kW);
+
+ //// Gather specific electricity flows from corresponding energy assets
+ //for (OL_AssetFlowCategories AC : assetFlowsMap.keySet()) {
+ for (OL_AssetFlowCategories AC : dsm_liveAssetFlows_kW.keySet()) {
+ //traceln("Assetsflows in dsm_liveAssetflows_kW: %s", dsm_liveAssetFlows_kW.keySet());
+ /*if (!dsm_liveAssetFlows_kW.keySet().contains(AC)) {
+ traceln("Trying to add assetflow: %s", AC);
+ traceln("Parent GC: %s", ((GridConnection)parentAgent).p_gridConnectionID);
+ }*/
+ dsm_liveAssetFlows_kW.get(AC).add(currentTime_h, roundToDecimal(assetFlowsMap.get(AC),3));
+ }
+
+ //Batteries
+ this.data_batteryStoredEnergyLiveWeek_MWh.add(currentTime_h, currentStoredEnergyBatteries_MWh);
+ if(assetsMetaData.totalInstalledBatteryStorageCapacity_MWh > 0){
+ this.data_batterySOC_fr.add(currentTime_h, roundToDecimal(currentStoredEnergyBatteries_MWh/assetsMetaData.totalInstalledBatteryStorageCapacity_MWh, 3) );
+ }
+ else{
+ this.data_batterySOC_fr.add(currentTime_h, 0);
+ }
+
+
+ }
+
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+
+ sb.append("Active Energy Carriers: ");
+ sb.append(this.activeEnergyCarriers);
+ sb.append(System.lineSeparator());
+ sb.append("Consumption Carriers: ");
+ sb.append(this.activeConsumptionEnergyCarriers);
+ sb.append(System.lineSeparator());
+ sb.append("Production Carriers: ");
+ sb.append(this.activeProductionEnergyCarriers);
+ sb.append(System.lineSeparator());
+ sb.append("Asset Flow Caterogies: ");
+ sb.append(this.assetsMetaData.activeAssetFlows);
+ sb.append(System.lineSeparator());
+ sb.append("Number of datapoints: ");
+ sb.append(this.data_totalDemand_kW.size());
+
+ return sb.toString();
+ }
+
+}
+
+
+ 1741361867834
+ J_AssetsMetaData
+ 1752680962144
+ /**
+ * J_AssetsMetaData
+ */
+
+import java.util.EnumSet;
+import com.fasterxml.jackson.annotation.JsonIdentityInfo;
+import com.fasterxml.jackson.annotation.ObjectIdGenerators;
+
+@JsonIdentityInfo(generator = ObjectIdGenerators.UUIDGenerator.class, property = "@id")
+public class J_AssetsMetaData {
+
+ public Agent parentAgent;
+
+ public EnumSet<OL_AssetFlowCategories> activeAssetFlows = EnumSet.noneOf(OL_AssetFlowCategories.class);
+
+ public Double totalInstalledPVPower_kW = 0.0;
+ public Double totalInstalledWindPower_kW = 0.0;
+ public Double totalInstalledBatteryStorageCapacity_MWh = 0.0;
+
+ public Double initialPV_kW = 0.0;
+ public Double PVPotential_kW = 0.0;
+ public Double windPotential_kW = 0.0;
+
+ /**
+ * Default constructor
+ */
+ public J_AssetsMetaData() {
+
+ }
+
+ public J_AssetsMetaData(Agent parentAgent) {
+ this.parentAgent = parentAgent;
+ }
+
+ public void updateActiveAssetData(ArrayList<GridConnection> gcList) {
+ activeAssetFlows.clear();
+ for(GridConnection GC : gcList){
+ if (GC.v_isActive) {
+ for (J_EA ea : GC.c_energyAssets) {
+ if (ea.assetFlowCategory!=null) {
+ activeAssetFlows.add(ea.assetFlowCategory);
+ }
+ }
+ }
+ }
+ if (activeAssetFlows.contains(OL_AssetFlowCategories.batteriesChargingPower_kW)) { activeAssetFlows.add(OL_AssetFlowCategories.batteriesDischargingPower_kW); }
+ if (activeAssetFlows.contains(OL_AssetFlowCategories.V2GPower_kW)) { activeAssetFlows.add(OL_AssetFlowCategories.evChargingPower_kW); }
+
+ }
+
+ public J_AssetsMetaData getClone() {
+ J_AssetsMetaData clone = new J_AssetsMetaData(this.parentAgent);
+ clone.activeAssetFlows = this.activeAssetFlows.clone();
+
+ clone.totalInstalledPVPower_kW = this.totalInstalledPVPower_kW.doubleValue();
+ clone.totalInstalledWindPower_kW = this.totalInstalledWindPower_kW.doubleValue();
+ clone.totalInstalledBatteryStorageCapacity_MWh = this.totalInstalledBatteryStorageCapacity_MWh.doubleValue();
+ clone.PVPotential_kW = this.PVPotential_kW.doubleValue();
+ clone.windPotential_kW = this.windPotential_kW.doubleValue();
+ return clone;
+ }
+
+
+ @Override
+ public String toString() {
+ return "totalInstalledPVPower_kW: " + totalInstalledPVPower_kW +
+ ", totalInstalledWindPower_kW: " + totalInstalledWindPower_kW +
+ ", totalInstalledBatteryStorageCapacity_MWh: " + totalInstalledBatteryStorageCapacity_MWh +
+ activeAssetFlows.toString();
+
+ }
+}
+
+
+ 1741864496371
+ J_ConnectionMetaData
+ 1752680962144
+ /**
+ * J_ConnectionMetaData
+ */
+public class J_ConnectionMetaData implements Serializable {
+
+ public Agent parentAgent;
+
+ public Double contractedDeliveryCapacity_kW = 0.0;
+ public Double contractedFeedinCapacity_kW = 0.0;
+ public Double physicalCapacity_kW = 0.0;
+ public Boolean contractedDeliveryCapacityKnown = false;
+ public Boolean contractedFeedinCapacityKnown = false;
+ public Boolean physicalCapacityKnown = false;
+
+ /**
+ * Default constructor
+ */
+ public J_ConnectionMetaData() {
+
+ }
+
+ public J_ConnectionMetaData( Agent parentAgent) {
+ this.parentAgent = parentAgent;
+ if (parentAgent instanceof GridConnection) {
+
+ }
+ //public double getDeliveryCapacity_kW(){return p_contractedDeliveryCapacity_kW;}
+ //public double getFeedinCapacity_kW(){return p_contractedFeedinCapacity_kW;}
+ //public boolean getDeliveryCapacityKnown(){return b_isRealDeliveryCapacityAvailable;}
+ //public boolean getFeedinCapacityKnown(){return b_isRealFeedinCapacityAvailable;}
+ }
+
+ public J_ConnectionMetaData getClone() {
+ J_ConnectionMetaData clone = new J_ConnectionMetaData(this.parentAgent);
+ clone.contractedDeliveryCapacity_kW = this.contractedDeliveryCapacity_kW.doubleValue();
+ clone.contractedFeedinCapacity_kW = this.contractedFeedinCapacity_kW.doubleValue();
+ if (this.physicalCapacity_kW!=null) {
+ clone.physicalCapacity_kW = this.physicalCapacity_kW.doubleValue();
+ }
+ clone.contractedDeliveryCapacityKnown = this.contractedDeliveryCapacityKnown.booleanValue();
+ clone.contractedFeedinCapacityKnown = this.contractedFeedinCapacityKnown.booleanValue();
+ if (this.physicalCapacityKnown!=null) {
+ clone.physicalCapacityKnown = this.physicalCapacityKnown.booleanValue();
+ }
+ return clone;
+ }
+
+ @Override
+ public String toString() {
+ return "ContractedDeliveryCapacity_kW: " + contractedDeliveryCapacity_kW +
+ ", ContractedFeedinCapacity_kW: " + contractedFeedinCapacity_kW +
+ ", PhysicalCapacity_kW: " + physicalCapacity_kW +
+ ", ContractedDeliveryCapacityKnown: " + contractedDeliveryCapacityKnown +
+ ", ContractedFeedinCapacityKnown: " + contractedFeedinCapacityKnown +
+ ", PhysicalCapacityKnown: " + physicalCapacityKnown;
+ }
+
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+
+}
+
+
+ 1749648342034
+ J_EAAirco
+ 1752677832758
+ /**
+ * Airco
+ */
+public class J_EAAirco extends zero_engine.J_EA implements Serializable {
+
+ double capacityElectric_kW;
+ int remainingONtimesteps = 0;
+ /**
+ * Default constructor
+ */
+ public J_EAAirco(Agent parentAgent, double capacityElectric_kW, double timestep_h) {
+ this.parentAgent = parentAgent;
+ this.capacityElectric_kW = capacityElectric_kW;
+ this.timestep_h = timestep_h;
+ this.activeConsumptionEnergyCarriers.add(OL_EnergyCarriers.ELECTRICITY);
+ //this.assetFlowCategory = OL_AssetFlowCategories.AIRCO; // bestaat nog niet!
+ this.registerEnergyAsset();
+ }
+
+
+ @Override
+ public void operate(double ratioOfCapacity) {
+ if( remainingONtimesteps > 0) {
+ this.remainingONtimesteps--;
+ double electricityConsumption_kW = ratioOfCapacity * this.capacityElectric_kW;
+ this.energyUse_kW = electricityConsumption_kW;
+ this.energyUsed_kWh += this.energyUse_kW * this.timestep_h;
+ this.flowsMap.put(OL_EnergyCarriers.ELECTRICITY, electricityConsumption_kW);
+ }
+ }
+
+ public void turnOnAirco(int nbTimesteps) {
+ this.remainingONtimesteps = nbTimesteps;
+ }
+
+ @Override
+ public String toString() {
+ return super.toString();
+ }
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+
+}
+
+
+ 1749649002419
+ J_ChargingSession
+ /**
+ * J_ChargingSession
+ */
+public class J_ChargingSession implements Serializable {
+
+ double startTime_h;
+ double endTime_h;
+ double timeStep_h;
+ double chargingDemand_kWh;
+ double avgPowerDemand_kW;
+ double batterySize_kWh;
+ double stateOfCharge_kWh;
+ double vehicleMaxChargingPower_kW;
+ int socketNb;
+
+ //boolean V1GCapable = true;
+ //boolean V2GCapable = true;
+ double chargedDuringSession_kWh = 0;
+ double dischargedDuringSession_kWh = 0;
+
+
+ /**
+ * Default constructor
+ */
+ public J_ChargingSession(double startTime_quarterhours, double endTime_quarterhours, double chargingDemand_kWh, double batterySize_kWh, double chargingPower_kW, int socketNb, double timeStep_h) {
+
+ this.startTime_h = 0.25 * startTime_quarterhours;
+ this.endTime_h = 0.25 * endTime_quarterhours;
+ this.timeStep_h = timeStep_h;
+ this.chargingDemand_kWh = chargingDemand_kWh;
+ this.avgPowerDemand_kW = this.chargingDemand_kWh / (this.endTime_h - this.startTime_h);
+ this.batterySize_kWh = batterySize_kWh;
+ this.socketNb = socketNb-1;
+ //stateOfCharge_kWh = batterySize_kWh - chargingDemand_kWh; // bold assumption... basically means every vehicle ends full. The reality is somewhere between: vehicle starts empty and vehicle ends full.
+ stateOfCharge_kWh = 0.5*(batterySize_kWh - chargingDemand_kWh); // Assumption: battery is not completely empty at start, and not completely full when leaving
+ this.vehicleMaxChargingPower_kW = chargingPower_kW;
+
+ if(this.startTime_h > this.endTime_h){
+ new RuntimeException("StartTime is later then the endtime for J_ChargingSession");
+ }
+ }
+
+ public double charge(double chargeSetpoint_kW) {
+ double actualChargePower_kW = max(min(chargeSetpoint_kW, (batterySize_kWh - stateOfCharge_kWh) / timeStep_h), -stateOfCharge_kWh / timeStep_h); // Limit charge power to stay within SoC 0-100
+ stateOfCharge_kWh += actualChargePower_kW * timeStep_h;
+ chargedDuringSession_kWh+=max(0, actualChargePower_kW*this.timeStep_h);
+ dischargedDuringSession_kWh+=max(0, -actualChargePower_kW*this.timeStep_h);
+ return actualChargePower_kW;
+ }
+
+ public double getRemainingChargeDemand_kWh() {
+ return chargingDemand_kWh - chargedDuringSession_kWh + dischargedDuringSession_kWh;
+ }
+
+ public J_ChargingSession getClone() {
+ return new J_ChargingSession((this.startTime_h*4), (this.endTime_h*4), this.chargingDemand_kWh, this.batterySize_kWh, this.vehicleMaxChargingPower_kW, this.socketNb, this.timeStep_h);
+ }
+
+
+ @Override
+ public String toString() {
+ return "StartTime_h: " + startTime_h + ", endTime_h: " + endTime_h + ", Pmax: " + vehicleMaxChargingPower_kW + "kW, demand: " + chargingDemand_kWh + "kWh";
+ }
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+
+}
+
+
+ 1749651263461
+ J_EACharger
+ true
+ 1752677832758
+ /**
+ * J_EACharger
+ */
+public class J_EACharger extends zero_engine.J_EA implements Serializable {
+ public double discharged_kWh;
+ public double charged_kWh;
+ public double capacityElectric_kW;
+ public List<J_ChargingSession> chargerProfile;
+ public boolean V1GCapable;
+ public boolean V2GCapable;
+ private boolean V2GActive = false;
+
+ private int currentChargingSessionIndexSocket1;
+ private J_ChargingSession currentChargingSessionSocket1;
+ private int currentChargingSessionIndexSocket2;
+ private J_ChargingSession currentChargingSessionSocket2;
+
+ private double totalShiftedLoadV1G_kWh;
+ private double totalShiftedLoadV2G_kWh;
+
+
+ private double dischargedStored_kWh;
+ private double chargedStored_kWh;
+ private J_ChargingSession currentChargingSessionSocket1Stored;
+ private int currentChargingSessionIndexSocket1Stored;
+ private J_ChargingSession currentChargingSessionSocket2Stored;
+ private int currentChargingSessionIndexSocket2Stored;
+ private double totalShiftedLoadV1GStored_kWh;
+ private double totalShiftedLoadV2GStored_kWh;
+
+ /**
+ * Default constructor
+ */
+ public J_EACharger(Agent parentAgent, double electricCapacity_kW, double timestep_h, List<J_ChargingSession> chargerProfile, boolean V1GCapable, boolean V2GCapable) {
+ this.parentAgent = parentAgent;
+ this.capacityElectric_kW = electricCapacity_kW;
+ this.timestep_h = timestep_h;
+ this.chargerProfile = chargerProfile;
+ this.V1GCapable = V1GCapable;
+ this.V2GCapable = V2GCapable;
+ this.activeProductionEnergyCarriers.add(OL_EnergyCarriers.ELECTRICITY);
+ this.activeConsumptionEnergyCarriers.add(OL_EnergyCarriers.ELECTRICITY);
+ if(V2GCapable && this.V2GActive) {
+ this.assetFlowCategory = OL_AssetFlowCategories.V2GPower_kW;
+ } else {
+ this.assetFlowCategory = OL_AssetFlowCategories.evChargingPower_kW;
+ }
+ this.registerEnergyAsset();
+ }
+
+ public void f_updateAllFlows( double t_h, boolean doV1G, boolean doV2G) {
+ // Powerfraction is calculated below, argument is the current time (energyModel.t_h)
+
+ // Check if the charger is capable of smart charging
+ doV1G = doV1G && this.V1GCapable;
+ doV2G = doV2G && this.V2GCapable;
+
+ // Update the J_ChargingSessions of the sockets
+ this.manageSocket1();
+ this.manageSocket2();
+
+ // Calculate the power output of the sockets
+ double power_kW = 0.0;
+ int currentTimeInQuarterHours = roundToInt(t_h * 4);
+ if ( this.currentChargingSessionSocket1 != null && currentTimeInQuarterHours >= this.currentChargingSessionSocket1.startTime && currentTimeInQuarterHours < this.currentChargingSessionSocket1.endTime ) {
+ //null check for currentChargingSessionSocket1 (and 2) is required for end of year when there are no more scheduled sessions
+ power_kW += this.operateChargerSocket1(doV1G, doV2G);
+ }
+ if ( this.currentChargingSessionSocket2 != null && currentTimeInQuarterHours >= this.currentChargingSessionSocket2.startTime && currentTimeInQuarterHours < this.currentChargingSessionSocket2.endTime ) {
+ power_kW += this.operateChargerSocket2(doV1G, doV2G);
+ }
+
+ double powerFraction_fr = power_kW / this.capacityElectric_kW;
+
+ // Call the regular J_EA updateAllFlows and operate
+ super.f_updateAllFlows( powerFraction_fr );
+ return;
+ }
+
+
+ @Override
+ public void operate(double ratioOfCapacity) {
+ double charge_kW = ratioOfCapacity * capacityElectric_kW;
+
+ double electricityProduction_kW = max(-charge_kW, 0);
+ double electricityConsumption_kW = max(charge_kW, 0);
+
+ discharged_kWh += electricityProduction_kW * timestep_h;
+ charged_kWh += electricityConsumption_kW * timestep_h;
+
+ energyUse_kW = electricityConsumption_kW - electricityProduction_kW;
+ energyUsed_kWh += energyUse_kW * timestep_h;
+
+ flowsMap.put(OL_EnergyCarriers.ELECTRICITY, electricityConsumption_kW - electricityProduction_kW);
+ // Split charging and discharing power 'at the source'!
+
+ assetFlowsMap.put(OL_AssetFlowCategories.evChargingPower_kW, electricityConsumption_kW);
+ if(V2GActive) {
+ assetFlowsMap.put(OL_AssetFlowCategories.V2GPower_kW, electricityProduction_kW);
+ }
+
+ if (charge_kW > 0) { // charging
+ assetFlowsMap.put(OL_AssetFlowCategories.evChargingPower_kW, electricityConsumption_kW);
+ } else if(charge_kW < 0){
+ if(this.V2GCapable && this.V2GActive) {
+ assetFlowsMap.put(OL_AssetFlowCategories.V2GPower_kW, electricityProduction_kW);
+ }
+ else {
+ throw new RuntimeException("Trying to discharge into a charger, that does not have the capability or where v2g is not activated!");
+ }
+ }
+
+ }
+
+ private void manageSocket1() {
+ if ( this.currentChargingSessionSocket1 == null ) { // || energyModel.t_h >= v_currentChargingSessionSocket1.endTime / 4.0) {
+ // check if we are not already past the last charging session
+ if (this.currentChargingSessionIndexSocket1 >= this.chargerProfile.size()) {
+ //v_currentChargingSessionSocket1 = null;
+ return;
+ }
+ while (this.chargerProfile.get(this.currentChargingSessionIndexSocket1).socket != 1) {
+ this.currentChargingSessionIndexSocket1++;
+ if (this.currentChargingSessionIndexSocket1 >= this.chargerProfile.size()) {
+ return;
+ }
+ }
+ this.currentChargingSessionSocket1 = this.chargerProfile.get(this.currentChargingSessionIndexSocket1).getClone();
+ this.currentChargingSessionIndexSocket1++;
+ }
+ }
+
+ private void manageSocket2() {
+ if ( this.currentChargingSessionSocket2 == null ) {
+ // check if we are not already past the last charging session
+ if (this.currentChargingSessionIndexSocket2 >= this.chargerProfile.size()) {
+ return;
+ }
+ while (this.chargerProfile.get(this.currentChargingSessionIndexSocket2).socket != 2) {
+ this.currentChargingSessionIndexSocket2++;
+ if (this.currentChargingSessionIndexSocket2 >= this.chargerProfile.size()) {
+ return;
+ }
+ }
+ this.currentChargingSessionSocket2 = this.chargerProfile.get(this.currentChargingSessionIndexSocket2).getClone();
+ this.currentChargingSessionIndexSocket2++;
+ }
+ }
+
+ private double operateChargerSocket1(boolean doV1G, boolean doV2G) {
+ double chargingPower_kW = this.currentChargingSessionSocket1.operate( doV1G, doV2G );
+ this.totalShiftedLoadV1G_kWh += this.currentChargingSessionSocket1.getShiftedLoadV1GCurrentTimestep();
+ this.totalShiftedLoadV2G_kWh += this.currentChargingSessionSocket1.getShiftedLoadV2GCurrentTimestep();
+ if ( this.currentChargingSessionSocket1.timeStepsToDisconnect == 0 ){
+ this.currentChargingSessionSocket1 = null;
+ }
+ return chargingPower_kW;
+ }
+
+ private double operateChargerSocket2(boolean doV1G, boolean doV2G) {
+ double chargingPower_kW = this.currentChargingSessionSocket2.operate( doV1G, doV2G );
+ this.totalShiftedLoadV1G_kWh += this.currentChargingSessionSocket2.getShiftedLoadV1GCurrentTimestep();
+ this.totalShiftedLoadV2G_kWh += this.currentChargingSessionSocket2.getShiftedLoadV2GCurrentTimestep();
+ if ( this.currentChargingSessionSocket2.timeStepsToDisconnect == 0 ){
+ this.currentChargingSessionSocket2 = null;
+ }
+ return chargingPower_kW;
+ }
+
+ @Override
+ public void storeStatesAndReset() {
+ energyUsedStored_kWh = energyUsed_kWh;
+ energyUsed_kWh = 0.0;
+ dischargedStored_kWh = discharged_kWh;
+ discharged_kWh = 0.0;
+ chargedStored_kWh = charged_kWh;
+ charged_kWh = 0.0;
+
+ currentChargingSessionSocket1Stored = currentChargingSessionSocket1;
+ currentChargingSessionSocket1 = null;
+ currentChargingSessionIndexSocket1Stored = currentChargingSessionIndexSocket1;
+ currentChargingSessionIndexSocket1 = 0;
+
+ currentChargingSessionSocket2Stored = currentChargingSessionSocket2;
+ currentChargingSessionSocket2 = null;
+ currentChargingSessionIndexSocket2Stored = currentChargingSessionIndexSocket2;
+ currentChargingSessionIndexSocket2 = 0;
+
+ totalShiftedLoadV1GStored_kWh = totalShiftedLoadV1G_kWh;
+ totalShiftedLoadV1G_kWh = 0.0;
+ totalShiftedLoadV2GStored_kWh = totalShiftedLoadV2G_kWh;
+ totalShiftedLoadV2G_kWh = 0.0;
+ clear();
+ }
+
+ @Override
+ public void restoreStates() {
+ energyUsed_kWh = energyUsedStored_kWh;
+ discharged_kWh = dischargedStored_kWh;
+ charged_kWh = chargedStored_kWh;
+
+ currentChargingSessionSocket1 = currentChargingSessionSocket1Stored;
+ currentChargingSessionIndexSocket1 = currentChargingSessionIndexSocket1Stored;
+
+ currentChargingSessionSocket2 = currentChargingSessionSocket2Stored;
+ currentChargingSessionIndexSocket2 = currentChargingSessionIndexSocket2Stored;
+
+ totalShiftedLoadV1G_kWh = totalShiftedLoadV1GStored_kWh;
+ totalShiftedLoadV2G_kWh = totalShiftedLoadV2GStored_kWh;
+ }
+
+ public void setV2GActive(boolean activateV2G) {
+ this.V2GActive = activateV2G;
+ if(this.V2GCapable && activateV2G) {
+ this.assetFlowCategory = OL_AssetFlowCategories.V2GPower_kW;
+ }
+ else {
+ this.assetFlowCategory = OL_AssetFlowCategories.evChargingPower_kW;
+ }
+ }
+
+ @Override
+ public String toString() {
+ return "Power: " + getLastFlows().get(OL_EnergyCarriers.ELECTRICITY) + " kW, capacity: " + capacityElectric_kW + " kW" ;
+ }
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+
+}
+
+
+
+ 1752677257516
+ I_BatteryManagement
+ 1762850659543
+ import com.fasterxml.jackson.annotation.JsonTypeInfo;
+import com.fasterxml.jackson.annotation.JsonSubTypes;
+import com.fasterxml.jackson.annotation.JsonIdentityInfo;
+import com.fasterxml.jackson.annotation.ObjectIdGenerators;
+@JsonIdentityInfo(generator = ObjectIdGenerators.UUIDGenerator.class, property = "@id")
+
+@JsonTypeInfo(
+ use = JsonTypeInfo.Id.CLASS,
+ include = JsonTypeInfo.As.PROPERTY,
+ property = "type" // 👈 this will be the field name in your JSON
+ )
+
+public interface I_BatteryManagement extends I_AssetManagement
+{
+ void manageBattery();
+}
+
+
+ 1752677992581
+ J_ChargingManagementSimple
+ 1762850586274
+ /**
+ * J_ChargingManagementSimple
+ */
+
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
+import java.util.EnumSet;
+
+@JsonAutoDetect(
+ fieldVisibility = Visibility.ANY,
+ getterVisibility = Visibility.NONE,
+ isGetterVisibility = Visibility.NONE,
+ setterVisibility = Visibility.NONE,
+ creatorVisibility = Visibility.NONE
+)
+public class J_ChargingManagementSimple implements I_ChargingManagement {
+
+ private GridConnection gc;
+ private OL_ChargingAttitude activeChargingType;
+ private double electricityPriceLowPassed_eurpkWh = 0.1;
+ private double priceFilterTimeScale_h = 5*24;
+ private double priceFilterDiffGain_r;
+ private EnumSet<OL_ChargingAttitude> supportedChargingTypes = EnumSet.noneOf(OL_ChargingAttitude.class);
+
+ private boolean V2GActive = false;
+
+ //Stored
+ private double storedElectricityPriceLowPassed_eurpkWh;
+
+
+ //private double GCdemandLowPassed_kW = 0.5;
+ //private double GCdemandFilterTimeScale_h = 5*24;
+ /**
+ * Default constructor
+ */
+ public J_ChargingManagementSimple() {
+
+ }
+
+ public J_ChargingManagementSimple( GridConnection gc ) {
+ this.gc = gc;
+ this.priceFilterDiffGain_r = 1/(priceFilterTimeScale_h/gc.energyModel.p_timeStep_h);
+ this.supportedChargingTypes.add(OL_ChargingAttitude.SIMPLE);
+ this.supportedChargingTypes.add(OL_ChargingAttitude.PRICE);
+ this.activeChargingType = OL_ChargingAttitude.SIMPLE;
+ }
+
+ public OL_ChargingAttitude getCurrentChargingType() {
+ return activeChargingType;
+ }
+
+ public void setCurrentChargingType(OL_ChargingAttitude chargeTypeRequest) {
+ if (supportedChargingTypes.contains(chargeTypeRequest)) {
+ this.activeChargingType = chargeTypeRequest;
+ } else {
+ throw new RuntimeException("Unsupported charging type for J_ChargingManagementSimple");
+ }
+ }
+ /**
+ * One of the simplest charging algorithms.
+ *
+ */
+ public void manageCharging() {
+ double t_h = gc.energyModel.t_h;
+ //double currentElectricityPriceConsumption_eurpkWh = gc.p_owner.f_getElectricityPrice(gc.v_liveConnectionMetaData.contractedDeliveryCapacity_kW);
+ double currentElectricityPriceConsumption_eurpkWh = gc.energyModel.pp_dayAheadElectricityPricing_eurpMWh.getCurrentValue() * 0.001;
+ electricityPriceLowPassed_eurpkWh += (currentElectricityPriceConsumption_eurpkWh-electricityPriceLowPassed_eurpkWh) * priceFilterDiffGain_r ;
+ /*// Little experiment, use current GC-load (so without EV charging!) as an equivalent price signal, and apply the same price-based smart charging and V2G algorithm.
+ GCdemandLowPassed_kW += (gc.fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.ELECTRICITY) - GCdemandLowPassed_kW) * priceFilterDiffGain_r;
+ electricityPriceLowPassed_eurpkWh = gc.fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.ELECTRICITY);
+ currentElectricityPriceConsumption_eurpkWh = gc.v_previousPowerElectricity_kW;
+ */
+ //traceln("Current price: %s eurpkWh, filtered price: %s eurpkWh", currentElectricityPriceConsumption_eurpkWh, electricityPriceLowPassed_eurpkWh);
+ for (J_EAEV ev : gc.c_electricVehicles) {
+ if (ev.available) {
+ if (this.activeChargingType != OL_ChargingAttitude.SIMPLE) {
+ double chargeNeedForNextTrip_kWh = ev.energyNeedForNextTrip_kWh - ev.getCurrentStateOfCharge_kWh(); // Can be negative if recharging is not needed for next trip!
+ double remainingFlexTime_h = ev.getChargeDeadline_h() - t_h; // measure of flexiblity left in current charging session.
+ double WTPoffset_eurpkW = 0.01; // Drops willingness to pay price for charging, combined with remainingFlexTime_h.
+ double chargeSetpoint_kW = 0;
+ if ( t_h >= (ev.getChargeDeadline_h()) && chargeNeedForNextTrip_kWh > 0) { // Must-charge time at max charging power
+ //traceln("Urgency charging in GC: %s! May exceed connection capacity!", gc.p_gridConnectionID));
+ chargeSetpoint_kW = ev.getCapacityElectric_kW();
+ } else {
+ double WTPCharging_eurpkWh = electricityPriceLowPassed_eurpkWh - WTPoffset_eurpkW * remainingFlexTime_h; //+ urgencyGain_eurpkWh * ( max(0,maxSpreadChargingPower_kW) / ev.getCapacityElectric_kW() ); // Scale WTP based on flexibility expressed in terms of power-fraction
+ //WTPprice_eurpkWh = WTPoffset_eurpkWh + (main.v_epexNext24hours_eurpkWh+v_electricityPriceLowPassed_eurpkWh)/2 + flexibilityGain_eurpkWh * sqrt(maxSpreadChargingPower_kW/maxChargingPower_kW);
+ double priceGain_r = 0.5; // When WTP is higher than current electricity price, ramp up charging power with this gain based on the price-delta.
+ chargeSetpoint_kW = max(0, ev.getCapacityElectric_kW() * (WTPCharging_eurpkWh / currentElectricityPriceConsumption_eurpkWh - 1) * priceGain_r);
+ //if ( chargeNeedForNextTrip_kWh < -ev.getCapacityElectric_kW()*gc.energyModel.p_timeStep_h && chargeSetpoint_kW == 0 ) { // Surpluss SOC and high energy price
+ if ( this.V2GActive && ev.getV2GCapable() && remainingFlexTime_h > 1 && chargeSetpoint_kW == 0 ) { // Surpluss SOC and high energy price
+ double V2G_WTS_offset_eurpkWh = 0.02; // Price must be at least this amount above the moving average to decide to discharge EV battery.
+ double WTSV2G_eurpkWh = V2G_WTS_offset_eurpkWh + electricityPriceLowPassed_eurpkWh; // Scale WillingnessToSell based on flexibility expressed in terms of power-fraction
+ chargeSetpoint_kW = min(0, -ev.getCapacityElectric_kW() * (currentElectricityPriceConsumption_eurpkWh / WTSV2G_eurpkWh - 1) * priceGain_r);
+ //if (chargeSetpoint_kW < 0) {traceln(" V2G Active! Power: " + chargeSetpoint_kW );}
+ }
+ }
+ ev.f_updateAllFlows( chargeSetpoint_kW / ev.getCapacityElectric_kW() );
+ } else { // just charge 'dumb', full power until full
+ ev.f_updateAllFlows(1.0);
+ }
+ }
+ }
+ }
+
+ public void setV2GActive(boolean activateV2G) {
+ // throw an exception if the management does not support V2G?
+ this.V2GActive = activateV2G;
+ this.gc.c_electricVehicles.forEach(ev -> ev.setV2GActive(activateV2G)); // not really wanted but NEEDED TO HAVE EV ASSET IN CORRECT assetFlowCatagory
+ }
+
+ public boolean getV2GActive() {
+ return this.V2GActive;
+ }
+
+
+
+ //Get parentagent
+ public Agent getParentAgent() {
+ return this.gc;
+ }
+
+ //Store and reset states
+ public void storeStatesAndReset() {
+ this.storedElectricityPriceLowPassed_eurpkWh = electricityPriceLowPassed_eurpkWh;
+ this.electricityPriceLowPassed_eurpkWh = 0;
+ }
+ public void restoreStates() {
+ this.electricityPriceLowPassed_eurpkWh = this.storedElectricityPriceLowPassed_eurpkWh;
+ }
+
+
+ @Override
+ public String toString() {
+ return "Active charging type: " + this.activeChargingType;
+
+ }
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+
+}
+
+
+ 1752678003039
+ J_BatteryManagementPrice
+ 1762850659543
+ /**
+ * J_BatteryManagementPrice
+ */
+
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
+
+@JsonAutoDetect(
+ fieldVisibility = Visibility.ANY, //
+ getterVisibility = Visibility.NONE,
+ isGetterVisibility = Visibility.NONE,
+ setterVisibility = Visibility.NONE,
+ creatorVisibility = Visibility.NONE
+)
+
+public class J_BatteryManagementPrice implements I_BatteryManagement {
+
+ private GridConnection gc;
+ // Parameters used:
+ private boolean stayWithinConnectionLimits = true; // When this flag is true the battery stays within the contracted capacity of the GC
+ private double chargeDischarge_offset_eurpkWh = 0.0; // This term determines the minimal price difference before the battery is used
+ private double WTPfeedbackGain_eurpSOC = 0.5; // This term determines the unwillingness to use the battery when it is almost full or empty
+ private double priceGain_kWhpeur = 2.0; // This term determines how strongly to ramp up power with price-delta's
+ private double lowPassFactor_fr = 0.001;
+
+ // Internal State
+ private double electricityPriceLowPassed_eurpkWh;
+ private double storedElectricityPriceLowPassed_eurpkWh;
+
+ /**
+ * Default constructor
+ */
+
+ public J_BatteryManagementPrice() {
+
+ }
+
+ public J_BatteryManagementPrice( GridConnection gc ) {
+ this.gc = gc;
+ }
+
+ public J_BatteryManagementPrice( GridConnection gc, boolean stayWithinConnectionLimits, double chargeDischarge_offset_eurpkWh, double WTPfeedbackGain_eurpSOC, double priceGain_kWhpeur, double priceTimescale_h ) {
+ this.gc = gc;
+ this.stayWithinConnectionLimits = stayWithinConnectionLimits;
+ this.chargeDischarge_offset_eurpkWh = chargeDischarge_offset_eurpkWh;
+ this.WTPfeedbackGain_eurpSOC = WTPfeedbackGain_eurpSOC;
+ this.priceGain_kWhpeur = priceGain_kWhpeur;
+ this.lowPassFactor_fr = gc.energyModel.p_timeStep_h / priceTimescale_h;
+ }
+
+ /**
+ * This algorithm determines the battery behaviour with the historical national EPEX price.
+ * It has a boolean flag wether or not to take the GC's connection capacity into account.
+ */
+ public void manageBattery() {
+ // Get the national EPEX price
+ double currentElectricityPriceCharge_eurpkWh = gc.energyModel.nationalEnergyMarket.f_getNationalElectricityPrice_eurpMWh()/1000;
+
+ // Base the WTP on a moving average price and the SOC
+ electricityPriceLowPassed_eurpkWh += lowPassFactor_fr * ( currentElectricityPriceCharge_eurpkWh - electricityPriceLowPassed_eurpkWh );
+
+ double SOC_setpoint_fr = 0.5;
+ double SOC_deficit_fr = SOC_setpoint_fr - gc.p_batteryAsset.getCurrentStateOfCharge_fr(); // How far away from desired SOC? SOC too LOW is a POSITIVE deficit
+
+ // Define WTP price for charging and discharging!
+ double WTP_charge_eurpkWh = electricityPriceLowPassed_eurpkWh - chargeDischarge_offset_eurpkWh + SOC_deficit_fr * WTPfeedbackGain_eurpSOC;
+ double WTP_discharge_eurpkWh = electricityPriceLowPassed_eurpkWh + chargeDischarge_offset_eurpkWh + SOC_deficit_fr * WTPfeedbackGain_eurpSOC;
+
+ // Choose charging power based on prices and desired SOC level
+ double chargeSetpoint_kW = 0;
+ if ( WTP_charge_eurpkWh > currentElectricityPriceCharge_eurpkWh ) {
+ chargeSetpoint_kW = gc.p_batteryAsset.getCapacityElectric_kW()*(WTP_charge_eurpkWh - currentElectricityPriceCharge_eurpkWh)*priceGain_kWhpeur;
+ }
+ else if (WTP_discharge_eurpkWh < currentElectricityPriceCharge_eurpkWh) {
+ chargeSetpoint_kW = -gc.p_batteryAsset.getCapacityElectric_kW()*(currentElectricityPriceCharge_eurpkWh - WTP_discharge_eurpkWh)*priceGain_kWhpeur;
+ }
+
+ // limit charging power to available connection capacity
+ if( stayWithinConnectionLimits ) {
+ double availableChargePower_kW = gc.v_liveConnectionMetaData.contractedDeliveryCapacity_kW - gc.fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.ELECTRICITY); // Max battery charging power within grid capacity
+ double availableDischargePower_kW = gc.v_liveConnectionMetaData.contractedFeedinCapacity_kW + gc.fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.ELECTRICITY); // Max discharging power within grid capacity
+ chargeSetpoint_kW = min(max(chargeSetpoint_kW, -availableDischargePower_kW),availableChargePower_kW); // Don't allow too much (dis)charging!
+ }
+
+ gc.p_batteryAsset.f_updateAllFlows( chargeSetpoint_kW / gc.p_batteryAsset.getCapacityElectric_kW() );
+ }
+
+
+
+
+ //Get parentagent
+ public Agent getParentAgent() {
+ return this.gc;
+ }
+
+
+ //Store and reset states
+ public void storeStatesAndReset() {
+ this.storedElectricityPriceLowPassed_eurpkWh = electricityPriceLowPassed_eurpkWh;
+ this.electricityPriceLowPassed_eurpkWh = 0;
+ }
+ public void restoreStates() {
+ this.electricityPriceLowPassed_eurpkWh = this.storedElectricityPriceLowPassed_eurpkWh;
+ }
+
+ @Override
+ public String toString() {
+ return super.toString();
+ }
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+
+}
+
+
+ 1752678015847
+ J_BatteryManagementPeakShaving
+ 1762850659543
+ /**
+ * J_BatteryManagementPeakShaving
+ */
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
+
+@JsonAutoDetect(
+ fieldVisibility = Visibility.ANY, //
+ getterVisibility = Visibility.NONE,
+ isGetterVisibility = Visibility.NONE,
+ setterVisibility = Visibility.NONE,
+ creatorVisibility = Visibility.NONE
+)
+
+public class J_BatteryManagementPeakShaving implements I_BatteryManagement {
+
+ private GridConnection gc;
+ private Agent target = gc;
+ private OL_ResultScope targetType = OL_ResultScope.GRIDCONNECTION;
+
+ // Parameters used:
+ private double SOC_setpoint_fr = 0.5; // If there are no other influences such as vehicles or production the battery will aim for this SOC_fr
+ private double feedbackGain_fr = 1.5; // This parameter determines how strongly to aim for the SOC setpoint
+
+ /**
+ * Default constructor
+ */
+ public J_BatteryManagementPeakShaving() {
+
+ }
+
+ public J_BatteryManagementPeakShaving( GridConnection gc ) {
+ this.gc = gc;
+ if (gc instanceof GCGridBattery) {
+ target = null;
+ this.targetType = null;
+ }
+ }
+
+ public J_BatteryManagementPeakShaving( GridConnection gc, double SOC_setpoint_fr, double feedbackGain_fr ) {
+ this.gc = gc;
+ this.SOC_setpoint_fr = SOC_setpoint_fr;
+ this.feedbackGain_fr = feedbackGain_fr;
+ if (gc instanceof GCGridBattery) {
+ target = null;
+ this.targetType = null;
+ }
+ }
+
+ /**
+ * This algorithm tries to aim for a fixed SOC (0.5 by default)
+ * so that it can take the connection capacity of the GC into account and prevent any peaks when they occur.
+ */
+ public void manageBattery() {
+ if (this.target == null) {
+ gc.p_batteryAsset.f_updateAllFlows(0);
+ return;
+ }
+ double feedbackGain_kWpSOC = feedbackGain_fr * gc.p_batteryAsset.getCapacityElectric_kW();
+ double chargeSetpoint_kW = (SOC_setpoint_fr - gc.p_batteryAsset.getCurrentStateOfCharge_fr()) * feedbackGain_kWpSOC;
+
+ // Try to stay within the target connection capacity
+ double v_allowedDeliveryCapacity_kW = getDeliveryCapacity_kW();
+ double v_allowedFeedinCapacity_kW = getFeedinCapacity_kW();
+ double balanceElectricity_kW = getBalanceElectricity_kW();
+ double availableChargePower_kW = v_allowedDeliveryCapacity_kW - balanceElectricity_kW; // Max battery charging power within safety margins
+ double availableDischargePower_kW = v_allowedFeedinCapacity_kW + balanceElectricity_kW; // Max discharging power within safety margins
+
+ chargeSetpoint_kW = min(max(chargeSetpoint_kW, -availableDischargePower_kW),availableChargePower_kW); // Don't allow too much (dis)charging!
+
+ gc.p_batteryAsset.f_updateAllFlows( chargeSetpoint_kW / gc.p_batteryAsset.getCapacityElectric_kW() );
+ }
+
+ public void setTarget( Agent agent ) {
+ if ( agent == null) {
+ target = null;
+ this.targetType = null;
+ }
+ else if (agent == this.gc) {
+ target = agent;
+ this.targetType = OL_ResultScope.GRIDCONNECTION;
+ }
+ else if (agent instanceof GridNode) {
+ target = agent;
+ this.targetType = OL_ResultScope.GRIDNODE;
+ }
+ else if (agent instanceof EnergyCoop) {
+ target = agent;
+ this.targetType = OL_ResultScope.ENERGYCOOP;
+ }
+ else {
+ throw new RuntimeException("Not able to set " + agent + " as a target for J_BatteryPeakShaving");
+ }
+ }
+
+ public Agent getTarget() {
+ return this.target;
+ }
+
+ public void setTargetType( OL_ResultScope targetType ) {
+ this.targetType = targetType;
+ }
+
+ public OL_ResultScope getTargetType() {
+ return this.targetType;
+ }
+
+ // TODO: Make an interface with at least these 3 functions and make the agents implement it.
+ private double getDeliveryCapacity_kW() {
+ switch (targetType) {
+ case GRIDCONNECTION:
+ return gc.v_liveConnectionMetaData.contractedDeliveryCapacity_kW;
+ case GRIDNODE:
+ return ((GridNode)target).p_capacity_kW;
+ case ENERGYCOOP:
+ return ((EnergyCoop)target).v_liveConnectionMetaData.contractedDeliveryCapacity_kW;
+ default:
+ throw new RuntimeException("Was not able to find the delivery capacity of the target of the battery in GridConnection: " + gc.p_gridConnectionID);
+ }
+ }
+
+ private double getFeedinCapacity_kW() {
+ switch (targetType) {
+ case GRIDCONNECTION:
+ return gc.v_liveConnectionMetaData.contractedFeedinCapacity_kW;
+ case GRIDNODE:
+ return ((GridNode)target).p_capacity_kW;
+ case ENERGYCOOP:
+ return ((EnergyCoop)target).v_liveConnectionMetaData.contractedFeedinCapacity_kW;
+ default:
+ throw new RuntimeException("Was not able to find the feedin capacity of the target of the battery in GridConnection: " + gc.p_gridConnectionID);
+ }
+ }
+
+ private double getBalanceElectricity_kW() {
+ switch (targetType) {
+ case GRIDCONNECTION:
+ return gc.fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.ELECTRICITY);
+ case GRIDNODE:
+ return ((GridNode)target).v_currentLoad_kW - gc.p_batteryAsset.getLastFlows().get(OL_EnergyCarriers.ELECTRICITY);
+ case ENERGYCOOP:
+ return ((EnergyCoop)target).fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.ELECTRICITY) - gc.p_batteryAsset.getLastFlows().get(OL_EnergyCarriers.ELECTRICITY);
+ default:
+ throw new RuntimeException("Was not able to find the electricity balance of the target of the battery in GridConnection: " + gc.p_gridConnectionID);
+ }
+ }
+
+
+
+
+ //Get parentagent
+ public Agent getParentAgent() {
+ return this.gc;
+ }
+
+
+ //Store and reset states
+ public void storeStatesAndReset() {
+ //Nothing to store and reset
+ }
+ public void restoreStates() {
+ //Nothing to restore
+ }
+
+ @Override
+ public String toString() {
+ return super.toString();
+ }
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+
+}
+
+
+ 1752678031327
+ J_BatteryManagementPeakShavingForecast
+ 1762850659543
+ import zeroPackage.ZeroMath;
+/**
+ * J_BatteryManagementPeakShavingForecastGrid
+ */
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
+
+@JsonAutoDetect(
+ fieldVisibility = Visibility.ANY, //
+ getterVisibility = Visibility.NONE,
+ isGetterVisibility = Visibility.NONE,
+ setterVisibility = Visibility.NONE,
+ creatorVisibility = Visibility.NONE
+)
+
+
+public class J_BatteryManagementPeakShavingForecast implements I_BatteryManagement {
+
+ private double[] batteryChargingSchedule_kW = new double[96];
+ private GridConnection parentGC;
+ private Agent target = parentGC;
+ private OL_ResultScope targetType = OL_ResultScope.GRIDCONNECTION;
+ List<GridConnection> c_targetGridConnections = new ArrayList<GridConnection>();
+ double p_timestep_h;
+
+ //Stored
+ private double[] storedBatteryChargingSchedule_kW;
+
+ public J_BatteryManagementPeakShavingForecast() {
+
+ }
+
+
+ public J_BatteryManagementPeakShavingForecast( GridConnection parentGC ) {
+ this.parentGC = parentGC;
+ p_timestep_h = parentGC.energyModel.p_timeStep_h;
+ if (parentGC instanceof GCGridBattery) {
+ this.setTarget(null);
+ } else {
+ this.setTarget(parentGC);
+ }
+ }
+
+
+
+ public void manageBattery() {
+ if (this.target == null) {
+ parentGC.p_batteryAsset.f_updateAllFlows(0);
+ return;
+ }
+ int index = roundToInt((parentGC.energyModel.t_h % 24)/p_timestep_h);
+ if(index == 0){
+ this.batteryChargingSchedule_kW = this.calculateBatteryChargingSchedule();
+ }
+ parentGC.p_batteryAsset.f_updateAllFlows( this.batteryChargingSchedule_kW[index] / parentGC.p_batteryAsset.getCapacityElectric_kW() );
+ }
+
+
+
+ private double[] getNettoBalanceForecast_kW() {
+
+ double[] nettoBalanceTotal_kW = new double[96];
+ double energyModel_time_h = parentGC.energyModel.t_h;
+
+ //For simulation that cross the year end
+ double hour_of_simulation_year = energyModel_time_h - parentGC.energyModel.p_runStartTime_h;
+
+ int startTimeDayIndex = roundToInt(hour_of_simulation_year/p_timestep_h);
+ int endTimeDayIndex = roundToInt((hour_of_simulation_year + 24)/p_timestep_h);
+
+ List<J_EAProfile> elecConsumptionProfiles = new ArrayList<J_EAProfile>(); //survey inkoop profile data
+ List<J_EAProfile> elecHeatPumpProfiles = new ArrayList<J_EAProfile>(); //survey WP profile data
+ List<J_EAProfile> elecEVProfiles = new ArrayList<J_EAProfile>(); //Custom EV profile data
+ List<J_EAProfile> surveyHeatDemandProfiles = new ArrayList<J_EAProfile>(); //survey gas to heat builing profiles
+ List<J_EAConsumption> genericHeatDemandProfiles = new ArrayList<J_EAConsumption>(); //Generic gas to heat builing profiles
+ List<J_EAConsumption> genericBuildingProfiles = new ArrayList<J_EAConsumption>(); //Generic inkoop builing profiles
+ List<J_EAProduction> productionAssetProfiles = new ArrayList<J_EAProduction>(); // Production profiles
+
+ for (GridConnection GC : c_targetGridConnections){
+ elecConsumptionProfiles.addAll(findAll(GC.c_profileAssets, profile -> profile.assetFlowCategory == OL_AssetFlowCategories.fixedConsumptionElectric_kW));
+ elecHeatPumpProfiles.addAll(findAll(GC.c_profileAssets, profile -> profile.assetFlowCategory == OL_AssetFlowCategories.heatPumpElectricityConsumption_kW));
+ elecEVProfiles.addAll(findAll(GC.c_profileAssets, profile -> profile.assetFlowCategory == OL_AssetFlowCategories.evChargingPower_kW));
+ if(GC.f_getCurrentHeatingType() == OL_GridConnectionHeatingType.ELECTRIC_HEATPUMP && !GC.f_getHeatingTypeIsGhost()) {
+ surveyHeatDemandProfiles.addAll(findAll(GC.c_profileAssets, profile -> profile.energyCarrier == OL_EnergyCarriers.HEAT));
+ genericHeatDemandProfiles.addAll(findAll(GC.c_consumptionAssets, cons -> cons.energyAssetType == OL_EnergyAssetType.HEAT_DEMAND));
+ }
+ genericBuildingProfiles.addAll(findAll(GC.c_consumptionAssets, cons -> cons.energyAssetType == OL_EnergyAssetType.ELECTRICITY_DEMAND));
+ productionAssetProfiles.addAll(findAll(GC.c_productionAssets, prod -> prod.energyAssetType == OL_EnergyAssetType.PHOTOVOLTAIC || prod.energyAssetType == OL_EnergyAssetType.WINDMILL));
+ }
+
+ for(J_EAProfile elecConsumptionProfile : elecConsumptionProfiles) {
+ if(elecConsumptionProfile != null){
+ double[] tempNettoBalance_kW = ZeroMath.arrayMultiply(Arrays.copyOfRange(elecConsumptionProfile.a_energyProfile_kWh, startTimeDayIndex, endTimeDayIndex), elecConsumptionProfile.getProfileScaling_fr()/p_timestep_h);
+ for (int i = 0; i < tempNettoBalance_kW.length; i++) {
+ nettoBalanceTotal_kW[i] += tempNettoBalance_kW[i];
+ }
+ }
+ }
+ for(J_EAProfile elecHeatPumpProfile : elecHeatPumpProfiles) {
+ if(elecHeatPumpProfile != null){
+ double[] tempNettoBalance_kW = ZeroMath.arrayMultiply(Arrays.copyOfRange(elecHeatPumpProfile.a_energyProfile_kWh, startTimeDayIndex, endTimeDayIndex), elecHeatPumpProfile.getProfileScaling_fr()/p_timestep_h);
+ for (int i = 0; i < tempNettoBalance_kW.length; i++) {
+ nettoBalanceTotal_kW[i] += tempNettoBalance_kW[i];
+ }
+ }
+ }
+ for(J_EAProfile elecEVProfile : elecEVProfiles) {
+ if(elecEVProfile != null){
+ double[] tempNettoBalance_kW = ZeroMath.arrayMultiply(Arrays.copyOfRange(elecEVProfile.a_energyProfile_kWh, startTimeDayIndex, endTimeDayIndex), elecEVProfile.getProfileScaling_fr()/p_timestep_h);
+ for (int i = 0; i < tempNettoBalance_kW.length; i++) {
+ nettoBalanceTotal_kW[i] += tempNettoBalance_kW[i];
+ }
+ }
+ }
+ for(J_EAProfile surveyHeatDemandProfile : surveyHeatDemandProfiles) {
+ if(surveyHeatDemandProfile != null){
+ double[] heatPower_kW = ZeroMath.arrayMultiply(Arrays.copyOfRange(surveyHeatDemandProfile.a_energyProfile_kWh, startTimeDayIndex, endTimeDayIndex), surveyHeatDemandProfile.getProfileScaling_fr()/p_timestep_h);
+ //traceln(heatPower_kW);
+ double eta_r = parentGC.energyModel.avgc_data.p_avgEfficiencyHeatpump_fr;
+ double outputTemperature_degC = parentGC.energyModel.avgc_data.p_avgOutputTemperatureElectricHeatpump_degC;
+ for(double time = energyModel_time_h; time < energyModel_time_h + 24; time += p_timestep_h){
+ double baseTemperature_degC = parentGC.energyModel.pp_ambientTemperature_degC.getValue(time);
+ double COP_r = eta_r * ( 273.15 + outputTemperature_degC ) / ( outputTemperature_degC - baseTemperature_degC );
+ nettoBalanceTotal_kW[roundToInt((time-energyModel_time_h)/p_timestep_h)] += heatPower_kW[roundToInt((time-energyModel_time_h)/p_timestep_h)] / COP_r;
+ }
+ }
+ }
+ for(J_EAConsumption genericHeatDemandProfile : genericHeatDemandProfiles) {
+ if(genericHeatDemandProfile != null){
+
+ double eta_r = parentGC.energyModel.avgc_data.p_avgEfficiencyHeatpump_fr;
+ double outputTemperature_degC = parentGC.energyModel.avgc_data.p_avgOutputTemperatureElectricHeatpump_degC;
+
+ for(double time = energyModel_time_h; time < energyModel_time_h + 24; time += p_timestep_h){
+ double baseTemperature_degC = parentGC.energyModel.pp_ambientTemperature_degC.getValue(time);
+ double COP_r = eta_r * ( 273.15 + outputTemperature_degC ) / ( outputTemperature_degC - baseTemperature_degC );
+
+ //traceln(genericHeatDemandProfile.getProfilePointer().getValue(time)*genericHeatDemandProfile.yearlyDemand_kWh);
+ nettoBalanceTotal_kW[roundToInt((time-energyModel_time_h)/p_timestep_h)] += genericHeatDemandProfile.getProfilePointer().getValue(time)*genericHeatDemandProfile.yearlyDemand_kWh*genericHeatDemandProfile.getConsumptionScaling_fr() / COP_r;
+ }
+ }
+ }
+ for(J_EAConsumption genericBuildingProfile : genericBuildingProfiles) {
+ if(genericBuildingProfile != null){ //table function
+ for(double time = energyModel_time_h; time < energyModel_time_h + 24; time += p_timestep_h){
+ nettoBalanceTotal_kW[roundToInt((time-energyModel_time_h)/p_timestep_h)] += genericBuildingProfile.getProfilePointer().getValue(time)*genericBuildingProfile.yearlyDemand_kWh*genericBuildingProfile.getConsumptionScaling_fr();
+ }
+ }
+ }
+ for(J_EAProduction productionAssetProfile : productionAssetProfiles) {
+ if (productionAssetProfile != null) { //table function
+ for(double time = energyModel_time_h; time < energyModel_time_h + 24; time += p_timestep_h){
+ nettoBalanceTotal_kW[roundToInt((time-energyModel_time_h)/p_timestep_h)] -= productionAssetProfile.getProfilePointer().getValue(time)*productionAssetProfile.getCapacityElectric_kW();
+ }
+ }
+ }
+
+
+ return nettoBalanceTotal_kW;
+ }
+
+
+
+ private double[] calculateBatteryChargingSchedule() {
+
+ double[] nettoBalanceTotal_kW = getNettoBalanceForecast_kW();
+ double amountOfHoursInADay = 24;
+
+ //Initialize chargepoint array
+ double[] newBatteryChargingSchedule_kW = new double[96];
+
+ //Calculate the total export over the day that can be collected by the battery
+ double totalExport_kWh = 0;
+ for(int i = 0; i < nettoBalanceTotal_kW.length; i++){
+ if(nettoBalanceTotal_kW[i] < 0){
+ totalExport_kWh += min(parentGC.p_batteryAsset.getCapacityElectric_kW(), -nettoBalanceTotal_kW[i])*p_timestep_h;
+ }
+ }
+
+ //Flatten the morning net balance while charging
+ double totalDailyImport_kWh = 0;
+ for(int i = 0; i < nettoBalanceTotal_kW.length; i++){
+ if(i< amountOfHoursInADay/p_timestep_h){
+ totalDailyImport_kWh += max(0,nettoBalanceTotal_kW[i]*p_timestep_h);
+ }
+ }
+
+ double batteryEnergyNeeded_kWh = max(0,(parentGC.p_batteryAsset.getStorageCapacity_kWh()*(1-parentGC.p_batteryAsset.getCurrentStateOfCharge_fr()))/parentGC.p_batteryAsset.getChargingEfficiency_r()-totalExport_kWh);
+ double averageDailyConsumption_kW = (totalDailyImport_kWh + batteryEnergyNeeded_kWh)/amountOfHoursInADay;
+
+ //If 24 hours
+ for(int i = 0; i < nettoBalanceTotal_kW.length; i++){
+ newBatteryChargingSchedule_kW[i] += averageDailyConsumption_kW - nettoBalanceTotal_kW[i];
+ }
+
+ return newBatteryChargingSchedule_kW;
+ }
+
+
+
+ public void setTarget( Agent agent ) {
+ if ( agent == null) {
+ target = null;
+ this.targetType = null;
+ }
+ else if (agent == this.parentGC) {
+ target = agent;
+ this.targetType = OL_ResultScope.GRIDCONNECTION;
+ c_targetGridConnections = new ArrayList<GridConnection>();
+ c_targetGridConnections.add((GridConnection)target);
+ }
+ else if (agent instanceof GridNode) {
+ target = agent;
+ this.targetType = OL_ResultScope.GRIDNODE;
+ c_targetGridConnections = new ArrayList<GridConnection>(((GridNode)target).f_getAllLowerLVLConnectedGridConnections());
+ }
+ else if (agent instanceof EnergyCoop) {
+ target = agent;
+ this.targetType = OL_ResultScope.ENERGYCOOP;
+ c_targetGridConnections = new ArrayList<GridConnection>(((EnergyCoop)target).f_getAllChildMemberGridConnections());
+ }
+ else {
+ throw new RuntimeException("Not able to set " + agent + " as a target for J_BatteryPeakShaving");
+ }
+ }
+
+
+
+ //Get parentagent
+ public Agent getParentAgent() {
+ return this.parentGC;
+ }
+
+
+ //Store and reset states
+ public void storeStatesAndReset() {
+ this.storedBatteryChargingSchedule_kW = batteryChargingSchedule_kW;
+ this.batteryChargingSchedule_kW = new double[batteryChargingSchedule_kW.length];
+ }
+ public void restoreStates() {
+ this.batteryChargingSchedule_kW = this.storedBatteryChargingSchedule_kW;
+ }
+
+ @Override
+ public String toString() {
+ return "parentGC: " + parentGC +
+ ", target: " + target +
+ ", c_targetGridConnections: " + c_targetGridConnections;
+ }
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+
+}
+
+
+ 1753169766770
+ J_BatteryManagementOff
+ 1762850659543
+ /**
+ * J_BatteryManagementOff
+ */
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
+
+@JsonAutoDetect(
+ fieldVisibility = Visibility.ANY, //
+ getterVisibility = Visibility.NONE,
+ isGetterVisibility = Visibility.NONE,
+ setterVisibility = Visibility.NONE,
+ creatorVisibility = Visibility.NONE
+)
+
+public class J_BatteryManagementOff implements I_BatteryManagement {
+
+ GridConnection gc;
+
+ /**
+ * Default constructor
+ */
+ public J_BatteryManagementOff( ) {
+
+ }
+
+ public J_BatteryManagementOff( GridConnection gc) {
+ this.gc = gc;
+ }
+
+ public void manageBattery() {
+ gc.p_batteryAsset.f_updateAllFlows(0.0);
+ }
+
+
+
+
+
+ //Get parentagent
+ public Agent getParentAgent() {
+ return this.gc;
+ }
+
+ //Store and reset states
+ public void storeStatesAndReset() {
+ //Nothing to store/reset
+ }
+ public void restoreStates() {
+ //Nothing to store/reset
+ }
+
+ @Override
+ public String toString() {
+ return super.toString();
+ }
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+
+}
+
+
+ 1753088398654
+ J_HeatingManagementBuildingSimple
+ true
+ 1762850602203
+ /**
+ * J_HeatingManagementBuildingSimple
+ */
+public class J_HeatingManagementBuildingSimple implements I_HeatingManagement {
+
+ private boolean isInitialized = false;
+ private GridConnection gc;
+ private List<OL_GridConnectionHeatingType> validHeatingTypes = Arrays.asList(
+ OL_GridConnectionHeatingType.GAS_BURNER,
+ OL_GridConnectionHeatingType.ELECTRIC_HEATPUMP,
+ OL_GridConnectionHeatingType.HYDROGENBURNER,
+ OL_GridConnectionHeatingType.DISTRICTHEAT,
+ OL_GridConnectionHeatingType.LT_DISTRICTHEAT
+ );
+ private OL_GridConnectionHeatingType currentHeatingType;
+
+ private J_EABuilding building;
+ private J_EAConversion heatingAsset;
+
+ private double startOfDay_h = 8;
+ private double startOfNight_h = 23;
+ private double dayTimeSetPoint_degC = 19;
+ private double nightTimeSetPoint_degC = 19;
+ private double heatingKickinTreshhold_degC = 1;
+
+ /**
+ * Default constructor
+ */
+ public J_HeatingManagementBuildingSimple() {
+
+ }
+
+ public J_HeatingManagementBuildingSimple( GridConnection gc, OL_GridConnectionHeatingType heatingType ) {
+ this.gc = gc;
+ this.currentHeatingType = heatingType;
+ this.building = gc.p_BuildingThermalAsset;
+ }
+
+ public J_HeatingManagementBuildingSimple( GridConnection gc, OL_GridConnectionHeatingType heatingType, double startOfDay_h, double startOfNight_h, double dayTimeSetPoint_degC, double nightTimeSetPoint_degC, double heatingKickinTreshhold_degC ) {
+ this.gc = gc;
+ this.currentHeatingType = heatingType;
+ this.building = gc.p_BuildingThermalAsset;
+ this.startOfDay_h = startOfDay_h;
+ this.startOfNight_h = startOfNight_h;
+ this.dayTimeSetPoint_degC = dayTimeSetPoint_degC;
+ this.nightTimeSetPoint_degC = nightTimeSetPoint_degC;
+ this.heatingKickinTreshhold_degC = heatingKickinTreshhold_degC;
+ }
+
+ public void manageHeating() {
+ if ( !isInitialized ) {
+ this.initializeAssets();
+ }
+ double heatDemand_kW = gc.fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.HEAT);
+ double buildingTemp_degC = building.getCurrentTemperature();
+ double timeOfDay_h = gc.energyModel.t_hourOfDay;
+ if (timeOfDay_h < startOfDay_h || timeOfDay_h >= startOfNight_h) {
+ if (buildingTemp_degC < nightTimeSetPoint_degC - heatingKickinTreshhold_degC) {
+ // Nighttime and building temperature too low
+ double buildingPowerSetpoint_kW = (nightTimeSetPoint_degC - buildingTemp_degC) * this.building.heatCapacity_JpK / 3.6e6 / gc.energyModel.p_timeStep_h;
+ double buildingPower_kW = min(heatingAsset.getOutputCapacity_kW() - heatDemand_kW, buildingPowerSetpoint_kW);
+ double assetPower_kW = buildingPower_kW + heatDemand_kW;
+ building.f_updateAllFlows( buildingPower_kW / building.getCapacityHeat_kW() );
+ heatingAsset.f_updateAllFlows( assetPower_kW / heatingAsset.getOutputCapacity_kW() );
+ return;
+ }
+ else {
+ // Nighttime and building temperature acceptable
+ building.f_updateAllFlows( 0.0 );
+ heatingAsset.f_updateAllFlows( heatDemand_kW / heatingAsset.getOutputCapacity_kW() );
+ return;
+ }
+ }
+ else {
+ if (buildingTemp_degC < dayTimeSetPoint_degC - heatingKickinTreshhold_degC) {
+ // Daytime and building temperature too low
+ double buildingPowerSetpoint_kW = (dayTimeSetPoint_degC - buildingTemp_degC) * this.building.heatCapacity_JpK / 3.6e6 / gc.energyModel.p_timeStep_h;
+ double buildingPower_kW = min(heatingAsset.getOutputCapacity_kW() - heatDemand_kW, buildingPowerSetpoint_kW);
+ double assetPower_kW = buildingPower_kW + heatDemand_kW;
+ building.f_updateAllFlows( buildingPower_kW / building.getCapacityHeat_kW() );
+ heatingAsset.f_updateAllFlows( assetPower_kW / heatingAsset.getOutputCapacity_kW() );
+ return;
+ }
+ else {
+ // Daytime and building temperature acceptable
+ building.f_updateAllFlows( 0.0 );
+ heatingAsset.f_updateAllFlows( heatDemand_kW / heatingAsset.getOutputCapacity_kW() );
+ return;
+ }
+ }
+ }
+
+ public void initializeAssets() {
+ if (!validHeatingTypes.contains(this.currentHeatingType)) {
+ throw new RuntimeException(this.getClass() + " does not support heating type: " + this.currentHeatingType);
+ }
+ if (gc.p_heatBuffer != null) {
+ throw new RuntimeException(this.getClass() + " does not support heat buffers.");
+ }
+ if (building == null) {
+ throw new RuntimeException(this.getClass() + " requires a building asset.");
+ }
+ J_EAConsumption heatConsumption = findFirst(gc.c_consumptionAssets, x -> x.getEAType() == OL_EnergyAssetType.HEAT_DEMAND && x.getEAType() != OL_EnergyAssetType.HOT_WATER_CONSUMPTION);
+ J_EAProfile heatProfile = findFirst(gc.c_profileAssets, x -> x.getEnergyCarrier() == OL_EnergyCarriers.HEAT);
+ if (heatProfile != null || heatConsumption != null) {
+ throw new RuntimeException(this.getClass() + " does not support HEAT_DEMAND profiles.");
+ }
+ if (gc.c_heatingAssets.size() == 0) {
+ throw new RuntimeException(this.getClass() + " requires at least one heating asset.");
+ }
+ if (gc.c_heatingAssets.size() > 1) {
+ throw new RuntimeException(this.getClass() + " does not support more than one heating asset.");
+ }
+ // TODO: Add a check if the power of the asset is sufficient?
+ // TODO: Add a check if the heatingAsset is of the correct type, e.g. not a hydrogen burner or not a CHP.
+ this.heatingAsset = gc.c_heatingAssets.get(0);
+ this.isInitialized = true;
+ }
+
+ public void notInitialized() {
+ this.isInitialized = false;
+ }
+
+ public List<OL_GridConnectionHeatingType> getValidHeatingTypes() {
+ return this.validHeatingTypes;
+ }
+
+ public OL_GridConnectionHeatingType getCurrentHeatingType() {
+ return this.currentHeatingType;
+ }
+
+ @Override
+ public String toString() {
+ return super.toString();
+ }
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+}
+
+
+
+ 1753090559114
+ J_HeatingManagementProfileSimple
+ true
+ 1762850602203
+ /**
+ * J_HeatingManagementProfileSimple
+ */
+public class J_HeatingManagementProfileSimple implements I_HeatingManagement {
+
+ private boolean isInitialized = false;
+ private GridConnection gc;
+ private List<OL_GridConnectionHeatingType> validHeatingTypes = Arrays.asList(
+ OL_GridConnectionHeatingType.GAS_BURNER,
+ OL_GridConnectionHeatingType.ELECTRIC_HEATPUMP,
+ OL_GridConnectionHeatingType.HYDROGENBURNER,
+ OL_GridConnectionHeatingType.DISTRICTHEAT,
+ OL_GridConnectionHeatingType.LT_DISTRICTHEAT
+ );
+ private OL_GridConnectionHeatingType currentHeatingType;
+ private J_EAConversion heatingAsset;
+
+
+ /**
+ * Default constructor
+ */
+ public J_HeatingManagementProfileSimple() {
+
+ }
+
+ public J_HeatingManagementProfileSimple( GridConnection gc, OL_GridConnectionHeatingType heatingType ) {
+ this.gc = gc;
+ this.currentHeatingType = heatingType;
+ }
+
+ public void manageHeating() {
+ if ( !isInitialized ) {
+ this.initializeAssets();
+ }
+ double heatDemand_kW = gc.fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.HEAT);
+ heatingAsset.f_updateAllFlows( heatDemand_kW / heatingAsset.getOutputCapacity_kW() );
+ }
+
+ public void initializeAssets() {
+ if (!validHeatingTypes.contains(this.currentHeatingType)) {
+ throw new RuntimeException(this.getClass() + " does not support heating type: " + this.currentHeatingType);
+ }
+ if (gc.p_heatBuffer != null) {
+ throw new RuntimeException(this.getClass() + " does not support heat buffers.");
+ }
+ if (gc.p_BuildingThermalAsset != null) {
+ throw new RuntimeException(this.getClass() + " does not support a building asset.");
+ }
+ J_EAConsumption heatConsumption = findFirst(gc.c_consumptionAssets, x -> x.getEAType() == OL_EnergyAssetType.HEAT_DEMAND && x.getEAType() != OL_EnergyAssetType.HOT_WATER_CONSUMPTION);
+ J_EAProfile heatProfile = findFirst(gc.c_profileAssets, x -> x.getEnergyCarrier() == OL_EnergyCarriers.HEAT);
+
+ if (heatConsumption == null && heatProfile == null) {
+ throw new RuntimeException(this.getClass() + " requires a HEAT_DEMAND profile.");
+ }
+ if (gc.c_heatingAssets.size() == 0) {
+ throw new RuntimeException(this.getClass() + " requires at least one heating asset.");
+ }
+ if (gc.c_heatingAssets.size() > 1) {
+ throw new RuntimeException(this.getClass() + " does not support more than one heating asset.");
+ }
+ // TODO: Add a check if the power of the asset is sufficient?
+ // TODO: Add a check if the heatingAsset is of the correct type, e.g. not a hydrogen burner or not a CHP.
+ this.heatingAsset = gc.c_heatingAssets.get(0);
+ this.isInitialized = true;
+ }
+
+ public void notInitialized() {
+ this.isInitialized = false;
+ }
+
+ public List<OL_GridConnectionHeatingType> getValidHeatingTypes() {
+ return this.validHeatingTypes;
+ }
+
+ public OL_GridConnectionHeatingType getCurrentHeatingType() {
+ return this.currentHeatingType;
+ }
+
+ public J_HeatingPreferences getHeatingPreferences() {
+ return this.heatingPreferences;
+ }
+
+ @Override
+ public String toString() {
+ return super.toString();
+ }
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+
+}
+
+
+ 1753100278618
+ J_HeatingManagementProfileHybridHeatPump
+ 1762850578079
+ /**
+ * J_HeatingManagementProfileHybridHeatPump
+ */
+
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
+
+@JsonAutoDetect(
+ fieldVisibility = Visibility.ANY, //
+ getterVisibility = Visibility.NONE,
+ isGetterVisibility = Visibility.NONE,
+ setterVisibility = Visibility.NONE,
+ creatorVisibility = Visibility.NONE
+)
+
+public class J_HeatingManagementProfileHybridHeatPump implements I_HeatingManagement {
+
+ private boolean isInitialized = false;
+ private GridConnection gc;
+ private List<OL_GridConnectionHeatingType> validHeatingTypes = Arrays.asList(
+ OL_GridConnectionHeatingType.HYBRID_HEATPUMP
+ );
+ private OL_GridConnectionHeatingType currentHeatingType;
+ private J_EAConversionHeatPump heatPumpAsset;
+ private J_EAConversionGasBurner gasBurnerAsset;
+ private J_HeatingPreferences heatingPreferences;
+ /**
+ * Default constructor
+ */
+ public J_HeatingManagementProfileHybridHeatPump() {
+
+ }
+
+ public J_HeatingManagementProfileHybridHeatPump( GridConnection gc, OL_GridConnectionHeatingType heatingType) {
+ this.gc = gc;
+ this.currentHeatingType = heatingType;
+ }
+
+ public void manageHeating() {
+ if ( !isInitialized ) {
+ this.initializeAssets();
+ }
+ double heatDemand_kW = gc.fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.HEAT);
+ if (heatPumpAsset.getCOP() > 3.0 ) {
+ if (heatDemand_kW < heatPumpAsset.getOutputCapacity_kW()) {
+ heatPumpAsset.f_updateAllFlows( heatDemand_kW / heatPumpAsset.getOutputCapacity_kW() );
+ gasBurnerAsset.f_updateAllFlows( 0.0 );
+ return;
+ }
+ else if (heatDemand_kW < heatPumpAsset.getOutputCapacity_kW() + gasBurnerAsset.getOutputCapacity_kW() ) {
+ heatPumpAsset.f_updateAllFlows( 1.0 );
+ gasBurnerAsset.f_updateAllFlows( (heatDemand_kW - heatPumpAsset.getOutputCapacity_kW()) / gasBurnerAsset.getOutputCapacity_kW() );
+ return;
+ }
+ else {
+ throw new RuntimeException(this.getClass() + " in GC: " + gc.p_gridConnectionID + " does not have enough combined capacity to fulfil the heat demand");
+ }
+ }
+ else {
+ if (heatDemand_kW < gasBurnerAsset.getOutputCapacity_kW()) {
+ gasBurnerAsset.f_updateAllFlows( heatDemand_kW / gasBurnerAsset.getOutputCapacity_kW() );
+ heatPumpAsset.f_updateAllFlows( 0.0 );
+ return;
+ }
+ else if (heatDemand_kW < gasBurnerAsset.getOutputCapacity_kW() + heatPumpAsset.getOutputCapacity_kW() ) {
+ gasBurnerAsset.f_updateAllFlows( 1.0 );
+ heatPumpAsset.f_updateAllFlows( (heatDemand_kW - gasBurnerAsset.getOutputCapacity_kW()) / heatPumpAsset.getOutputCapacity_kW() );
+ return;
+ }
+ else {
+ throw new RuntimeException(this.getClass() + " in GC: " + gc.p_gridConnectionID + " does not have enough combined capacity to fulfil the heat demand");
+ }
+ }
+ }
+
+ public void initializeAssets() {
+ if (!validHeatingTypes.contains(this.currentHeatingType)) {
+ throw new RuntimeException(this.getClass() + " does not support heating type: " + this.currentHeatingType);
+ }
+ if (gc.p_heatBuffer != null) {
+ throw new RuntimeException(this.getClass() + " does not support heat buffers.");
+ }
+ if (gc.p_BuildingThermalAsset != null) {
+ throw new RuntimeException(this.getClass() + " does not support a building asset.");
+ }
+ J_EAConsumption heatConsumption = findFirst(gc.c_consumptionAssets, x -> x.getEAType() == OL_EnergyAssetType.HEAT_DEMAND && x.getEAType() != OL_EnergyAssetType.HOT_WATER_CONSUMPTION);
+ J_EAProfile heatProfile = findFirst(gc.c_profileAssets, x -> x.energyCarrier == OL_EnergyCarriers.HEAT);
+
+ if (heatProfile == null && heatConsumption == null) {
+ throw new RuntimeException(this.getClass() + " requires a HEAT_DEMAND profile.");
+ }
+ if (gc.c_heatingAssets.size() != 2) {
+ throw new RuntimeException(this.getClass() + " requires exactly two heating assets.");
+ }
+ // TODO: Add a check if the power of the asset is sufficient?
+ if (gc.c_heatingAssets.get(0) instanceof J_EAConversionGasBurner) {
+ this.gasBurnerAsset = (J_EAConversionGasBurner)gc.c_heatingAssets.get(0);
+ }
+ else if (gc.c_heatingAssets.get(1) instanceof J_EAConversionGasBurner) {
+ this.gasBurnerAsset = (J_EAConversionGasBurner)gc.c_heatingAssets.get(1);
+ }
+ else {
+ throw new RuntimeException(this.getClass() + " requires a Gas Burner");
+ }
+ if (gc.c_heatingAssets.get(0) instanceof J_EAConversionHeatPump) {
+ this.heatPumpAsset = (J_EAConversionHeatPump)gc.c_heatingAssets.get(0);
+ }
+ else if (gc.c_heatingAssets.get(1) instanceof J_EAConversionHeatPump) {
+ this.heatPumpAsset = (J_EAConversionHeatPump)gc.c_heatingAssets.get(1);
+ }
+ else {
+ throw new RuntimeException(this.getClass() + " requires a Heat Pump");
+ }
+ this.isInitialized = true;
+ }
+
+ public void notInitialized() {
+ this.isInitialized = false;
+ }
+
+ public List<OL_GridConnectionHeatingType> getValidHeatingTypes() {
+ return this.validHeatingTypes;
+ }
+
+ public OL_GridConnectionHeatingType getCurrentHeatingType() {
+ return this.currentHeatingType;
+ }
+
+ public void setHeatingPreferences(J_HeatingPreferences heatingPreferences) {
+ this.heatingPreferences = heatingPreferences;
+ }
+
+ public J_HeatingPreferences getHeatingPreferences() {
+ return this.heatingPreferences;
+ }
+
+
+
+
+ //Get parentagent
+ public Agent getParentAgent() {
+ return this.gc;
+ }
+
+
+
+ public void storeStatesAndReset() {
+ //Nothing to store/reset
+ }
+ public void restoreStates() {
+ //Nothing to store/reset
+ }
+
+
+ @Override
+ public String toString() {
+ return super.toString();
+ }
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+
+}
+
+
+ 1753102129145
+ J_HeatingManagementDistrictHeating
+ 1762850578079
+ /**
+ * J_HeatingManagementDistrictHeating
+ */
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
+
+@JsonAutoDetect(
+ fieldVisibility = Visibility.ANY, //
+ getterVisibility = Visibility.NONE,
+ isGetterVisibility = Visibility.NONE,
+ setterVisibility = Visibility.NONE,
+ creatorVisibility = Visibility.NONE
+)
+public class J_HeatingManagementDistrictHeating implements I_HeatingManagement {
+
+ private boolean isInitialized = false;
+ private GridConnection gc;
+ private List<OL_GridConnectionHeatingType> validHeatingTypes = Arrays.asList(
+ OL_GridConnectionHeatingType.GAS_BURNER,
+ OL_GridConnectionHeatingType.ELECTRIC_HEATPUMP,
+ OL_GridConnectionHeatingType.HYDROGENBURNER
+ );
+ private OL_GridConnectionHeatingType currentHeatingType;
+ private J_EAConversion heatingAsset;
+ private J_HeatingPreferences heatingPreferences = null; //Not needed for the GCDistrictHeating.
+
+ private double previousHeatFeedin_kW = 0;
+
+
+ //Stored
+ private double storedPreviousHeatFeedin_kW;
+
+ /**
+ * Default constructor
+ */
+ public J_HeatingManagementDistrictHeating() {
+
+ }
+
+ public J_HeatingManagementDistrictHeating( GridConnection gc, OL_GridConnectionHeatingType heatingType ) {
+ if (!(gc instanceof GCDistrictHeating)) {
+ throw new RuntimeException("Impossible to connect " + this.getClass() + " to a GC that is not GCDistrictHeating");
+ }
+ this.gc = gc;
+ this.currentHeatingType = heatingType;
+ }
+
+ public void manageHeating() {
+ if ( !isInitialized ) {
+ this.initializeAssets();
+ }
+ // v_currentLoad_kW is the GN load of the previous timestep
+ double heatTransferToNetwork_kW = max(0, gc.p_parentNodeHeat.v_currentLoad_kW + previousHeatFeedin_kW);
+ if (heatTransferToNetwork_kW > heatingAsset.getOutputCapacity_kW()) {
+ throw new RuntimeException("Heating asset in " + this.getClass() + " does not have sufficient capacity.");
+ }
+ heatingAsset.f_updateAllFlows( heatTransferToNetwork_kW / heatingAsset.getOutputCapacity_kW() );
+ previousHeatFeedin_kW = -gc.fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.HEAT);
+ }
+
+ public void initializeAssets() {
+ if (!validHeatingTypes.contains(this.currentHeatingType)) {
+ throw new RuntimeException(this.getClass() + " does not support heating type: " + this.currentHeatingType);
+ }
+ if (gc.p_parentNodeHeat == null) {
+ throw new RuntimeException(this.getClass() + " requires the GC: " + gc.p_gridConnectionID + " to be connected to a GridNodeHeat");
+ }
+ if (gc.p_heatBuffer != null) {
+ throw new RuntimeException(this.getClass() + " does not support heat buffers.");
+ }
+ if (gc.p_BuildingThermalAsset != null) {
+ throw new RuntimeException(this.getClass() + " does not support a building asset.");
+ }
+ if (gc.c_heatingAssets.size() == 0) {
+ throw new RuntimeException(this.getClass() + " requires at least one heating asset.");
+ }
+ if (gc.c_heatingAssets.size() > 1) {
+ throw new RuntimeException(this.getClass() + " does not support more than one heating asset.");
+ }
+ this.heatingAsset = gc.c_heatingAssets.get(0);
+ this.isInitialized = true;
+ }
+
+ public void notInitialized() {
+ this.isInitialized = false;
+ }
+
+ public List<OL_GridConnectionHeatingType> getValidHeatingTypes() {
+ return this.validHeatingTypes;
+ }
+
+ public OL_GridConnectionHeatingType getCurrentHeatingType() {
+ return this.currentHeatingType;
+ }
+
+ public void setHeatingPreferences(J_HeatingPreferences heatingPreferences) {
+ this.heatingPreferences = heatingPreferences;
+ }
+
+ public J_HeatingPreferences getHeatingPreferences() {
+ return this.heatingPreferences;
+ }
+
+
+ //Get parentagent
+ public Agent getParentAgent() {
+ return this.gc;
+ }
+
+
+ //Store and reset states
+ public void storeStatesAndReset() {
+ this.storedPreviousHeatFeedin_kW = this.previousHeatFeedin_kW;
+ this.previousHeatFeedin_kW = 0;
+ }
+ public void restoreStates() {
+ this.previousHeatFeedin_kW = this.storedPreviousHeatFeedin_kW;
+ }
+
+ @Override
+ public String toString() {
+ return super.toString();
+ }
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+
+}
+
+
+ 1753172542012
+ J_HeatingManagementNeighborhood
+ 1762850578079
+ /**
+ * J_HeatingManagementNeighborhood
+ */
+
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
+
+@JsonAutoDetect(
+ fieldVisibility = Visibility.ANY, //
+ getterVisibility = Visibility.NONE,
+ isGetterVisibility = Visibility.NONE,
+ setterVisibility = Visibility.NONE,
+ creatorVisibility = Visibility.NONE
+)
+
+public class J_HeatingManagementNeighborhood implements I_HeatingManagement {
+
+ private boolean isInitialized = false;
+ private GridConnection gc;
+ private List<OL_GridConnectionHeatingType> validHeatingTypes = Arrays.asList(
+ OL_GridConnectionHeatingType.CUSTOM
+ );
+ private OL_GridConnectionHeatingType currentHeatingType;
+
+ private J_EAConversionGasBurner gasBurner;
+ private J_EAConversionHeatPump heatPump;
+ private J_EAConversionHeatDeliverySet heatDeliverySet;
+ private J_EAConversionHydrogenBurner hydrogenBurner;
+ private J_EAConversionHeatPump lowTempHeatGridHeatPump;
+
+ private J_HeatingPreferences heatingPreferences = null; // Not needed for neighbourhoods
+
+ private HashMap<String, J_EAConsumption> heatDemandProfiles = new HashMap<String, J_EAConsumption>();
+
+ private double thresholdCOP_hybridHeatpump = 3.5;
+
+ // Services
+ public double amountOfGasBurners_services_fr = 1;
+ public double amountOfHybridHeatpump_services_fr = 0;
+ public double amountOfElectricHeatpumps_services_fr = 0;
+ public double amountOfDistrictHeating_services_fr = 0;
+ public double amountOfLowTempHeatgrid_services_fr = 0;
+
+ // Houses
+ public double amountOfGasBurners_houses_fr = 1;
+ public double amountOfHybridHeatpump_houses_fr = 0;
+ public double amountOfElectricHeatpumps_houses_fr = 0;
+ public double amountOfDistrictHeating_houses_fr = 0;
+ public double amountOfLowTempHeatgrid_houses_fr = 0;
+
+ // Industry
+ public double amountOfGasBurners_industry_fr = 1;
+ public double amountOfHybridHeatpump_industry_fr = 0;
+ public double amountOfElectricHeatpumps_industry_fr = 0;
+ public double amountOfDistrictHeating_industry_fr = 0;
+ public double amountOfHydrogenUseForHeating_industry_fr = 0;
+
+ // Agriculture
+ public double amountOfGasBurners_agriculture_fr = 1;
+ public double amountOfHybridHeatpump_agriculture_fr = 0;
+ public double amountOfElectricHeatpumps_agriculture_fr = 0;
+ public double amountOfDistrictHeating_agriculture_fr = 0;
+
+ /**
+ * Default constructor
+ */
+ public J_HeatingManagementNeighborhood() {
+
+ }
+
+ public J_HeatingManagementNeighborhood( GridConnection gc, OL_GridConnectionHeatingType heatingType ) {
+ this.gc = gc;
+ this.currentHeatingType = heatingType;
+ }
+
+ public void manageHeating() {
+ if (!isInitialized) {
+ initializeAssets();
+ }
+
+ //Division of the power demand //{Gasburner power request, HP power request, DH power request, Hydrogenburner power request}
+ double powerDemandDivision_kW[] = this.dividePowerDemandHeatingAssets();
+
+ //Split the power fractions (powerDemandDivision[] = {Gasburner power request, HP power request, DH power request}
+ if(gasBurner.getOutputCapacity_kW() != 0){
+ double powerFraction_GASBURNER = powerDemandDivision_kW[0] / gasBurner.getOutputCapacity_kW();
+ //Gas burner control (always assigned to primary heating asset)
+ gasBurner.f_updateAllFlows(powerFraction_GASBURNER);
+ }
+ if(heatPump.getOutputCapacity_kW() != 0){
+ double powerFraction_HEATPUMP = powerDemandDivision_kW[1] / heatPump.getOutputCapacity_kW();
+ //Heatpump control (always assigned to secondary heating asset)
+ heatPump.f_updateAllFlows(powerFraction_HEATPUMP);
+ }
+ if(heatDeliverySet.getOutputCapacity_kW() != 0){
+ double powerFraction_HEATDELIVERYSET = powerDemandDivision_kW[2] / heatDeliverySet.getOutputCapacity_kW();
+ //Heat delivery set control (always assigned to tertiary heating asset)
+ heatDeliverySet.f_updateAllFlows(powerFraction_HEATDELIVERYSET);
+ }
+ if(hydrogenBurner.getOutputCapacity_kW() != 0){
+ double powerFraction_HYDROGENBURNER = powerDemandDivision_kW[3] / hydrogenBurner.getOutputCapacity_kW();
+ //Hydrogen burner(always assigned to quaternary heating asset)
+ hydrogenBurner.f_updateAllFlows(powerFraction_HYDROGENBURNER);
+ }
+ if(lowTempHeatGridHeatPump.getOutputCapacity_kW() != 0){
+ double powerFraction_LOWTEMPHEATGRID = powerDemandDivision_kW[4] / lowTempHeatGridHeatPump.getOutputCapacity_kW();
+ //Hydrogen burner(always assigned to quaternary heating asset)
+ lowTempHeatGridHeatPump.f_updateAllFlows(powerFraction_LOWTEMPHEATGRID);
+ }
+ }
+
+ public double[] dividePowerDemandHeatingAssets() {
+ //Initialize power demand division array
+ double powerDemandDivision_kW[] = {0, 0, 0, 0, 0}; // {Gasburner power request, HP power request, DH power request, Hydrogenburner power request, lowTempHeatgridPowerDemand}
+
+ //Calculate fraction of total heat demand delivered by the CHP
+ /*
+ double powerDemand_kW = fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.HEAT);
+ double fractionOfTotalHeatDemandDeliveredyByCHP = max(0,p_chpAsset.getLastFlows().get(OL_EnergyCarriers.HEAT))/powerDemand_kW;
+ double remainingFraction = fractionOfTotalHeatDemandDeliveredyByCHP;
+ */
+ //Demanded total heating power at the current time step
+ //double powerDemand_kW = fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.HEAT);
+
+ //Demanded heating power for companies and household seperatly the current time step
+ double powerDemand_households_kW = max(0,heatDemandProfiles.get("HOUSEHOLDS").getLastFlows().get(OL_EnergyCarriers.HEAT));
+ double powerDemand_agriculture_kW = max(0,heatDemandProfiles.get("AGRICULTURE").getLastFlows().get(OL_EnergyCarriers.HEAT));
+ double powerDemand_industry_kW = max(0,heatDemandProfiles.get("INDUSTRY").getLastFlows().get(OL_EnergyCarriers.HEAT));
+ double powerDemand_services_kW = max(0,heatDemandProfiles.get("SERVICES").getLastFlows().get(OL_EnergyCarriers.HEAT));
+
+ //Divide the powerdemand per heating type
+ double gasBurnerPowerDemand_kW = powerDemand_households_kW*amountOfGasBurners_houses_fr +
+ powerDemand_agriculture_kW*amountOfGasBurners_agriculture_fr +
+ powerDemand_industry_kW*amountOfGasBurners_industry_fr +
+ powerDemand_services_kW*amountOfGasBurners_services_fr;
+
+ double electricHPPowerDemand_kW = powerDemand_households_kW*amountOfElectricHeatpumps_houses_fr +
+ powerDemand_agriculture_kW*amountOfElectricHeatpumps_agriculture_fr +
+ powerDemand_industry_kW*amountOfElectricHeatpumps_industry_fr +
+ powerDemand_services_kW*amountOfElectricHeatpumps_services_fr;
+
+ double hybridHPPowerDemand_kW = powerDemand_households_kW*amountOfHybridHeatpump_houses_fr +
+ powerDemand_agriculture_kW*amountOfHybridHeatpump_agriculture_fr +
+ powerDemand_industry_kW*amountOfHybridHeatpump_industry_fr +
+ powerDemand_services_kW*amountOfHybridHeatpump_services_fr;
+
+ double districtHeatingPowerDemand_kW = powerDemand_households_kW*amountOfDistrictHeating_houses_fr +
+ powerDemand_agriculture_kW*amountOfDistrictHeating_agriculture_fr +
+ powerDemand_industry_kW*amountOfDistrictHeating_industry_fr +
+ powerDemand_services_kW*amountOfDistrictHeating_services_fr;
+
+ double hydrogenBurnerPowerDemand_kW = powerDemand_industry_kW*amountOfHydrogenUseForHeating_industry_fr;
+
+ double lowTempHeatgridPowerDemand_kW = powerDemand_households_kW*amountOfLowTempHeatgrid_houses_fr +
+ powerDemand_services_kW*amountOfLowTempHeatgrid_services_fr;
+ //double lowTempHeatgridPowerDemand_kW = (powerDemand_households_kW + powerDemand_agriculture_kW + powerDemand_industry_kW + powerDemand_services_kW) - hybridHPPowerDemand - electricHPPowerDemand - gasBurnerPowerDemand - districtHeatingPowerDemand - hydrogenBurnerPowerDemand; // To make sure all power demand is met
+
+ //Get the current Heatpump COP
+ double HP_COP = ((J_EAConversionHeatPump)heatPump).getCOP();
+
+ if ( HP_COP < thresholdCOP_hybridHeatpump ) { // switch to gasburner when HP COP is below treshold
+ powerDemandDivision_kW[0] = max(0, gasBurnerPowerDemand_kW + hybridHPPowerDemand_kW);
+ powerDemandDivision_kW[1] = max(0, electricHPPowerDemand_kW);
+ }
+ else{
+ powerDemandDivision_kW[0] = max(0, gasBurnerPowerDemand_kW);
+ powerDemandDivision_kW[1] = max(0, electricHPPowerDemand_kW + hybridHPPowerDemand_kW);
+ }
+ powerDemandDivision_kW[2] = max(0, districtHeatingPowerDemand_kW);
+ powerDemandDivision_kW[3] = max(0, hydrogenBurnerPowerDemand_kW);
+ powerDemandDivision_kW[4] = max(0, lowTempHeatgridPowerDemand_kW);
+
+ return powerDemandDivision_kW; //{Gasburner power request, HP power request, DH power request, Hydrogenburner power request, lowTempHeatgridPowerDemand};
+ }
+
+ public void initializeAssets() {
+ if (!validHeatingTypes.contains(this.currentHeatingType)) {
+ throw new RuntimeException(this.getClass() + " does not support heating type: " + this.currentHeatingType);
+ }
+ if (gc.p_heatBuffer != null) {
+ throw new RuntimeException(this.getClass() + " does not support heat buffers.");
+ }
+ if (gc.p_BuildingThermalAsset != null) {
+ throw new RuntimeException(this.getClass() + " does not support a building asset.");
+ }
+ if (gc.c_heatingAssets.size() != 5) {
+ throw new RuntimeException(this.getClass() + " requires exactly 5 heating assets");
+ }
+ if (heatDemandProfiles.size() != 4) {
+ throw new RuntimeException(this.getClass() + " requires exactly 4 heating profiles");
+ }
+
+ gasBurner = null;
+ heatPump = null;
+ lowTempHeatGridHeatPump = null;
+ heatDeliverySet = null;
+ hydrogenBurner = null;
+
+ for (J_EA heatingAsset : gc.c_heatingAssets) {
+ if (heatingAsset instanceof J_EAConversionGasBurner) {
+ if (gasBurner != null) {
+ throw new RuntimeException(this.getClass() + " does not support two gasburners");
+ }
+ gasBurner = (J_EAConversionGasBurner)heatingAsset;
+ }
+ else if (heatingAsset instanceof J_EAConversionHeatPump) {
+ if (((J_EAConversionHeatPump)heatingAsset).getAmbientTempType() == OL_AmbientTempType.AMBIENT_AIR) {
+ if (heatPump != null) {
+ throw new RuntimeException(this.getClass() + " does not support two ambient air heatpumps");
+ }
+ heatPump = (J_EAConversionHeatPump)heatingAsset;
+ }
+ else if (((J_EAConversionHeatPump)heatingAsset).getAmbientTempType() == OL_AmbientTempType.HEAT_GRID) {
+ if (lowTempHeatGridHeatPump != null) {
+ throw new RuntimeException(this.getClass() + " does not support two heat grid heatpumps");
+ }
+ lowTempHeatGridHeatPump = (J_EAConversionHeatPump)heatingAsset;
+ }
+ else {
+ throw new RuntimeException(this.getClass() + " does not support heatpumps with ambient type: " + ((J_EAConversionHeatPump)heatingAsset).getAmbientTempType());
+ }
+ }
+ else if (heatingAsset instanceof J_EAConversionHeatDeliverySet) {
+ if (heatDeliverySet != null) {
+ throw new RuntimeException(this.getClass() + " does not support two heat delivery sets");
+ }
+ heatDeliverySet = (J_EAConversionHeatDeliverySet)heatingAsset;
+ }
+ else if (heatingAsset instanceof J_EAConversionHydrogenBurner) {
+ if (hydrogenBurner != null) {
+ throw new RuntimeException(this.getClass() + " does not support two hydrogenburners");
+ }
+ hydrogenBurner = (J_EAConversionHydrogenBurner)heatingAsset;
+ }
+ else {
+ throw new RuntimeException(this.getClass() + " does not support heating assets of type: " + heatingAsset.getClass());
+ }
+ }
+ isInitialized = true;
+ }
+
+ public void notInitialized() {
+ this.isInitialized = false;
+ }
+
+ public List<OL_GridConnectionHeatingType> getValidHeatingTypes() {
+ return this.validHeatingTypes;
+ }
+
+ public OL_GridConnectionHeatingType getCurrentHeatingType() {
+ return this.currentHeatingType;
+ }
+
+ public void setHeatingMethodPct_services( double[] pctArray ) {
+ amountOfGasBurners_services_fr = pctArray[0]/100;
+ amountOfElectricHeatpumps_services_fr = pctArray[1]/100;
+ amountOfHybridHeatpump_services_fr = pctArray[2]/100;
+ amountOfDistrictHeating_services_fr = pctArray[3]/100;
+ amountOfLowTempHeatgrid_services_fr = pctArray[4]/100;
+ }
+
+ public void setHeatingMethodPct_houses( double[] pctArray ) {
+ amountOfGasBurners_houses_fr = pctArray[0]/100;
+ amountOfElectricHeatpumps_houses_fr = pctArray[1]/100;
+ amountOfHybridHeatpump_houses_fr = pctArray[2]/100;
+ amountOfDistrictHeating_houses_fr = pctArray[3]/100;
+ amountOfLowTempHeatgrid_houses_fr = pctArray[4]/100;
+ }
+
+ public void setHeatingMethodPct_industry( double[] pctArray ) {
+ //Calculate actual space heating
+ double actualHeatingDemandSpaceHeating_fr = (1 - amountOfHydrogenUseForHeating_industry_fr);
+ amountOfGasBurners_industry_fr = actualHeatingDemandSpaceHeating_fr * pctArray[0]/100;
+ amountOfElectricHeatpumps_industry_fr = actualHeatingDemandSpaceHeating_fr * pctArray[1]/100;
+ amountOfHybridHeatpump_industry_fr = actualHeatingDemandSpaceHeating_fr * pctArray[2]/100;
+ amountOfDistrictHeating_industry_fr = actualHeatingDemandSpaceHeating_fr * pctArray[3]/100;
+ }
+
+ public void setH2HeatingFr_industry( double amountOfHydrogenUseForHeating_fr ) {
+ //Get current values
+ if(amountOfHydrogenUseForHeating_fr >= 1){
+ //throw new RuntimeException("Can not replace all gas in industry with hydrogen! The model does not support this.");
+ amountOfHydrogenUseForHeating_fr = 0.999;
+ }
+ double actualHeatingDemandSpaceHeating_fr = (1 - amountOfHydrogenUseForHeating_industry_fr);
+ double[] currentPctArray = {amountOfGasBurners_industry_fr*100/actualHeatingDemandSpaceHeating_fr,
+ amountOfHybridHeatpump_industry_fr*100/actualHeatingDemandSpaceHeating_fr,
+ amountOfElectricHeatpumps_industry_fr*100/actualHeatingDemandSpaceHeating_fr,
+ amountOfDistrictHeating_industry_fr*100/actualHeatingDemandSpaceHeating_fr};
+
+ //Set new hydrogen use for heating fr
+ amountOfHydrogenUseForHeating_industry_fr = min(1, amountOfHydrogenUseForHeating_fr);
+
+
+ //Set new values
+ this.setHeatingMethodPct_industry(currentPctArray);
+ }
+
+ public void setHeatingMethodPct_agriculture( double[] pctArray ) {
+ amountOfGasBurners_agriculture_fr = pctArray[0]/100;
+ amountOfElectricHeatpumps_agriculture_fr = pctArray[1]/100;
+ amountOfHybridHeatpump_agriculture_fr = pctArray[2]/100;
+ amountOfDistrictHeating_agriculture_fr = pctArray[3]/100;
+ }
+
+ public void addHeatDemandProfile(String name, J_EAConsumption profile) {
+ heatDemandProfiles.put(name, profile);
+ }
+
+ public void setHeatingPreferences(J_HeatingPreferences heatingPreferences) {
+ this.heatingPreferences = heatingPreferences;
+ }
+
+ public J_HeatingPreferences getHeatingPreferences() {
+ return this.heatingPreferences;
+ }
+
+
+
+ //Get parentagent
+ public Agent getParentAgent() {
+ return this.gc;
+ }
+
+
+ //Store and reset states
+ public void storeStatesAndReset() {
+ //Nothing to store/reset
+ }
+ public void restoreStates() {
+ //Nothing to store/reset
+ }
+
+ @Override
+ public String toString() {
+ return super.toString();
+ }
+
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+
+}
+
+
+ 1753167599716
+ J_HeatingManagementBuildingHybridHeatPump
+ true
+ 1762850602203
+ /**
+ * J_HeatingManagementBuildingHybridHeatPump
+ */
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
+
+@JsonAutoDetect(
+ fieldVisibility = Visibility.ANY, //
+ getterVisibility = Visibility.NONE,
+ isGetterVisibility = Visibility.NONE,
+ setterVisibility = Visibility.NONE,
+ creatorVisibility = Visibility.NONE
+)
+
+public class J_HeatingManagementBuildingHybridHeatPump implements I_HeatingManagement {
+
+ private boolean isInitialized = false;
+ private GridConnection gc;
+ private List<OL_GridConnectionHeatingType> validHeatingTypes = Arrays.asList(
+ OL_GridConnectionHeatingType.HYBRID_HEATPUMP
+ );
+ private OL_GridConnectionHeatingType currentHeatingType;
+
+ private J_EABuilding building;
+ private J_EAConversionHeatPump heatPumpAsset;
+ private J_EAConversionGasBurner gasBurnerAsset;
+ private J_HeatingPreferences heatingPreferences;
+
+ /**
+ * Default constructor
+ */
+ public J_HeatingManagementBuildingHybridHeatPump() {
+
+ }
+
+ public J_HeatingManagementBuildingHybridHeatPump( GridConnection gc, OL_GridConnectionHeatingType heatingType) {
+ this.gc = gc;
+ this.currentHeatingType = heatingType;
+ }
+
+ public void manageHeating() {
+ if ( !isInitialized ) {
+ this.initializeAssets();
+ }
+
+ //Adjust the hot water and overall heat demand with the buffer and pt
+ double hotWaterDemand_kW = gc.p_DHWAsset != null ? gc.p_DHWAsset.getLastFlows().get(OL_EnergyCarriers.HEAT) : 0;
+ double remainingHotWaterDemand_kW = managePTAndHotWaterHeatBuffer(hotWaterDemand_kW);
+
+ double otherHeatDemand_kW = gc.fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.HEAT);
+
+ double buildingHeatingDemand_kW = 0;
+ double buildingTemp_degC = building.getCurrentTemperature();
+ double timeOfDay_h = gc.energyModel.t_hourOfDay;
+ if (timeOfDay_h < heatingPreferences.getStartOfDayTime_h() || timeOfDay_h >= heatingPreferences.getStartOfNightTime_h()) {
+ if (buildingTemp_degC < heatingPreferences.getNightTimeSetPoint_degC()) {
+ buildingHeatingDemand_kW = (heatingPreferences.getNightTimeSetPoint_degC() - buildingTemp_degC) * this.building.heatCapacity_JpK / 3.6e6 / gc.energyModel.p_timeStep_h;
+ }
+ }
+ else {
+ if (buildingTemp_degC < heatingPreferences.getDayTimeSetPoint_degC()) {
+ buildingHeatingDemand_kW = (heatingPreferences.getDayTimeSetPoint_degC() - buildingTemp_degC) * this.building.heatCapacity_JpK / 3.6e6 / gc.energyModel.p_timeStep_h;
+ }
+ }
+
+
+ //Set asset power based on the COP (All demand profiles (hot water, etc.) always go to the gasburner!)
+ double heatpumpAssetPower_kW = 0;
+ double gasBurnerAssetPower_kW = 0;
+ double heatIntoBuilding_kW = 0;
+
+ if (heatPumpAsset.getCOP() > 3.0 ) {
+ heatpumpAssetPower_kW = min(heatPumpAsset.getOutputCapacity_kW(), buildingHeatingDemand_kW);
+ gasBurnerAssetPower_kW = min(gasBurnerAsset.getOutputCapacity_kW(), otherHeatDemand_kW + max(0, buildingHeatingDemand_kW - heatpumpAssetPower_kW));
+ heatIntoBuilding_kW = heatpumpAssetPower_kW + max(0, gasBurnerAssetPower_kW - otherHeatDemand_kW);
+ }
+ else {
+ heatpumpAssetPower_kW = 0.0;
+ gasBurnerAssetPower_kW = min(gasBurnerAsset.getOutputCapacity_kW(), buildingHeatingDemand_kW + otherHeatDemand_kW);
+ heatIntoBuilding_kW = max(0, gasBurnerAssetPower_kW - otherHeatDemand_kW);
+ }
+
+ //Update flows with found asset powers
+ heatPumpAsset.f_updateAllFlows( heatpumpAssetPower_kW / heatPumpAsset.getOutputCapacity_kW() );
+ gasBurnerAsset.f_updateAllFlows( gasBurnerAssetPower_kW / gasBurnerAsset.getOutputCapacity_kW());
+ building.f_updateAllFlows( heatIntoBuilding_kW / building.getCapacityHeat_kW() );
+
+ }
+
+ private double managePTAndHotWaterHeatBuffer(double hotWaterDemand_kW){
+
+ //Calculate the pt production
+ double ptProduction_kW = 0;
+ List<J_EAProduction> ptAssets = findAll(gc.c_productionAssets, ea -> ea.energyAssetType == OL_EnergyAssetType.PHOTOTHERMAL);
+ for (J_EA j_ea : ptAssets) {
+ ptProduction_kW -= j_ea.getLastFlows().get(OL_EnergyCarriers.HEAT);
+ }
+
+ //Calculate the remaining hot water energy need after pt production, also calculate the remaining unused pt production
+ double remainingHotWater_kW = max(0, hotWaterDemand_kW - ptProduction_kW); // Need to do this, because pt has already compensated the hot water demand in the gc flows, so just need to update this value
+ double remainingPTProduction_kW = max(0, ptProduction_kW - hotWaterDemand_kW);
+
+ if(gc.p_heatBuffer != null){
+ double chargeSetpoint_kW = 0;
+ if(remainingHotWater_kW > 0) {
+ chargeSetpoint_kW = -remainingHotWater_kW;
+ }
+ else if(remainingPTProduction_kW > 0) {
+ chargeSetpoint_kW = remainingPTProduction_kW;
+ }
+ gc.p_heatBuffer.v_powerFraction_fr = chargeSetpoint_kW / gc.p_heatBuffer.getCapacityHeat_kW();
+ gc.p_heatBuffer.f_updateAllFlows(gc.p_heatBuffer.v_powerFraction_fr);
+
+ double heatBufferCharge_kW = gc.p_heatBuffer.getLastFlows().get(OL_EnergyCarriers.HEAT);
+
+ if(remainingHotWater_kW > 0){//Only if the current pt production, wasnt enough, adjust the hotwater demand with the buffer, cause then the buffer will have tried to discharge
+ remainingHotWater_kW = max(0, remainingHotWater_kW + heatBufferCharge_kW);
+ }
+ else {//Curtail the remaining pt that is not used for hot water
+ remainingPTProduction_kW = max(0, remainingPTProduction_kW - heatBufferCharge_kW);
+ if (remainingPTProduction_kW > 0) {//Heat (for now always curtail over produced heat!)
+ for (J_EAProduction j_ea : ptAssets) {
+ remainingPTProduction_kW -= j_ea.curtailEnergyCarrierProduction( OL_EnergyCarriers.HEAT, remainingPTProduction_kW);
+
+ if (remainingPTProduction_kW <= 0) {
+ break;
+ }
+ }
+ }
+ }
+ }
+ return remainingHotWater_kW;
+ }
+
+ public void initializeAssets() {
+ if (!validHeatingTypes.contains(this.currentHeatingType)) {
+ throw new RuntimeException(this.getClass() + " does not support heating type: " + this.currentHeatingType);
+ }
+ J_EAProduction ptAsset = findFirst(gc.c_productionAssets, ea -> ea.energyAssetType == OL_EnergyAssetType.PHOTOTHERMAL);
+ if (ptAsset != null) {
+ if(gc.p_DHWAsset == null) {
+ throw new RuntimeException(this.getClass() + " requires a hot water demand to make sense to use this heating management with PT.");
+ }
+ }
+ if (gc.p_heatBuffer != null) {
+ if(gc.p_DHWAsset == null && ptAsset == null) {
+ throw new RuntimeException(this.getClass() + " requires a hot water demand and PT to make sense to use this heating management with a heatbuffer.");
+ }
+ }
+ if (gc.p_BuildingThermalAsset != null) {
+ this.building = gc.p_BuildingThermalAsset;
+ }
+ else {
+ throw new RuntimeException(this.getClass() + " requires a building asset.");
+ }
+ if (gc.c_heatingAssets.size() != 2) {
+ throw new RuntimeException(this.getClass() + " requires exactly two heating assets.");
+ }
+ // TODO: Add a check if the power of the asset is sufficient?
+ if (gc.c_heatingAssets.get(0) instanceof J_EAConversionGasBurner) {
+ this.gasBurnerAsset = (J_EAConversionGasBurner)gc.c_heatingAssets.get(0);
+ }
+ else if (gc.c_heatingAssets.get(1) instanceof J_EAConversionGasBurner) {
+ this.gasBurnerAsset = (J_EAConversionGasBurner)gc.c_heatingAssets.get(1);
+ }
+ else {
+ throw new RuntimeException(this.getClass() + " requires a Gas Burner");
+ }
+ if (gc.c_heatingAssets.get(0) instanceof J_EAConversionHeatPump) {
+ this.heatPumpAsset = (J_EAConversionHeatPump)gc.c_heatingAssets.get(0);
+ }
+ else if (gc.c_heatingAssets.get(1) instanceof J_EAConversionHeatPump) {
+ this.heatPumpAsset = (J_EAConversionHeatPump)gc.c_heatingAssets.get(1);
+ }
+ else {
+ throw new RuntimeException(this.getClass() + " requires a Heat Pump");
+ }
+ if(this.heatingPreferences == null) {
+ heatingPreferences = new J_HeatingPreferences();
+ }
+ this.isInitialized = true;
+ }
+
+ public void notInitialized() {
+ this.isInitialized = false;
+ }
+
+ public List<OL_GridConnectionHeatingType> getValidHeatingTypes() {
+ return this.validHeatingTypes;
+ }
+
+ public OL_GridConnectionHeatingType getCurrentHeatingType() {
+ return this.currentHeatingType;
+ }
+
+ public void setHeatingPreferences(J_HeatingPreferences heatingPreferences) {
+ this.heatingPreferences = heatingPreferences;
+ }
+
+ public J_HeatingPreferences getHeatingPreferences() {
+ return this.heatingPreferences;
+ }
+
+
+
+ //Get parentagent
+ public Agent getParentAgent() {
+ return this.gc;
+ }
+
+
+ //Store and reset states
+ public void storeStatesAndReset() {
+ //Nothing to store and reset
+ }
+ public void restoreStates() {
+ //Nothing to restore
+ }
+
+ @Override
+ public String toString() {
+ return super.toString();
+ }
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+
+}
+
+
+ 1753795104493
+ I_HeatingManagement
+ 1762850578079
+ import com.fasterxml.jackson.annotation.JsonTypeInfo;
+import com.fasterxml.jackson.annotation.JsonSubTypes;
+import com.fasterxml.jackson.annotation.JsonIdentityInfo;
+import com.fasterxml.jackson.annotation.ObjectIdGenerators;
+
+@JsonIdentityInfo(generator = ObjectIdGenerators.UUIDGenerator.class, property = "@id")
+
+@JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.PROPERTY, property = "type")
+
+
+public interface I_HeatingManagement extends I_AssetManagement{
+ void manageHeating();
+ // Initiliaze throws an exception when the configuration of assets is not a valid combination
+ void initializeAssets();
+ // not initialized sets the isInitialized flag to false. Is called when the (heating) assets in the GC change
+ void notInitialized();
+ // Every implementation must have a list of all its valid heating types that it supports
+ List<OL_GridConnectionHeatingType> getValidHeatingTypes();
+ // Every implementation must choose one type that the current instance is managing
+ OL_GridConnectionHeatingType getCurrentHeatingType();
+
+ //Heating preferences
+ J_HeatingPreferences getHeatingPreferences();
+ void setHeatingPreferences(J_HeatingPreferences heatingPreferences);
+}
+
+
+
+
+ 1753972840287
+ J_HeatingManagementGhost
+ 1762850578079
+ /**
+ * J_HeatingManagementGhost
+ */
+
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
+
+@JsonAutoDetect(
+ fieldVisibility = Visibility.ANY, //
+ getterVisibility = Visibility.NONE,
+ isGetterVisibility = Visibility.NONE,
+ setterVisibility = Visibility.NONE,
+ creatorVisibility = Visibility.NONE
+)
+
+public class J_HeatingManagementGhost implements I_HeatingManagement {
+
+ private boolean isInitialized = false;
+ private GridConnection gc;
+ private List<OL_GridConnectionHeatingType> validHeatingTypes = Arrays.asList(
+ OL_GridConnectionHeatingType.GAS_BURNER,
+ OL_GridConnectionHeatingType.ELECTRIC_HEATPUMP,
+ OL_GridConnectionHeatingType.HYBRID_HEATPUMP
+ );
+ private OL_GridConnectionHeatingType currentHeatingType;
+ private J_HeatingPreferences heatingPreferences = null; //Null for ghost management, as it can not be changend anyway
+
+ /**
+ * Default constructor
+ */
+ public J_HeatingManagementGhost() {
+ }
+
+ public J_HeatingManagementGhost( GridConnection gc, OL_GridConnectionHeatingType heatingType) {
+ this.gc = gc;
+ this.currentHeatingType = heatingType;
+ }
+
+ public void manageHeating() {
+ if ( !isInitialized ) {
+ this.initializeAssets();
+ }
+ return;
+ }
+
+ public void initializeAssets() {
+ if (!validHeatingTypes.contains(this.currentHeatingType)) {
+ throw new RuntimeException(this.getClass() + " does not support heating type: " + this.currentHeatingType);
+ }
+ this.isInitialized = true;
+ }
+
+ public void notInitialized() {
+ this.isInitialized = false;
+ }
+
+ public List<OL_GridConnectionHeatingType> getValidHeatingTypes() {
+ return this.validHeatingTypes;
+ }
+
+ public OL_GridConnectionHeatingType getCurrentHeatingType() {
+ return this.currentHeatingType;
+ }
+
+ public void setHeatingPreferences(J_HeatingPreferences heatingPreferences) {
+ this.heatingPreferences = heatingPreferences;
+ }
+
+ public J_HeatingPreferences getHeatingPreferences() {
+ return this.heatingPreferences;
+ }
+
+
+
+
+ //Get parentagent
+ public Agent getParentAgent() {
+ return this.gc;
+ }
+
+
+ //Store and reset states
+ public void storeStatesAndReset() {
+ //Nothing to store and reset
+ }
+ public void restoreStates() {
+ //Nothing to restore
+ }
+
+
+ @Override
+ public String toString() {
+ return super.toString();
+ }
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+
+}
+
+
+ 1753106536266
+ J_AssetFlows
+ true
+ 1752679379816
+ /**
+ * J_AssetFlows
+ */
+public class J_AssetFlows implements Serializable {
+
+ // Further Subdivision of asset types within energy carriers
+ public double fixedConsumptionElectric_kW;
+ public double heatPumpElectricityConsumption_kW;
+ public double evChargingPowerElectric_kW;
+ public double currentBatteriesConsumption_kW;
+ public double hydrogenElectricityConsumption_kW;
+ public double electricHobConsumption_kW;
+ public double districtHeatDelivery_kW;
+ public double pvProductionElectric_kW;
+ public double windProductionElectric_kW;
+ public double ptProductionHeat_kW;
+ public double CHPProductionElectric_kW;
+ public double currentBatteriesProduction_kW;
+ public double currentV2GProduction_kW;
+ public double currentStoredEnergyBatteries_MWh;
+
+ /**
+ * Default constructor
+ */
+ public J_AssetFlows() {
+ }
+
+ public void setFlows(
+ double fixedConsumptionElectric_kW,
+ double heatPumpElectricityConsumption_kW,
+ double evChargingPowerElectric_kW,
+ double currentBatteriesConsumption_kW,
+ double hydrogenElectricityConsumption_kW,
+ double electricHobConsumption_kW,
+ double districtHeatDelivery_kW,
+ double pvProductionElectric_kW,
+ double windProductionElectric_kW,
+ double ptProductionHeat_kW,
+ double CHPProductionElectric_kW,
+ double currentBatteriesProduction_kW,
+ double currentV2GProduction_kW,
+ double currentStoredEnergyBatteries_MWh) {
+ this.fixedConsumptionElectric_kW = fixedConsumptionElectric_kW;
+ this.heatPumpElectricityConsumption_kW = heatPumpElectricityConsumption_kW;
+ this.evChargingPowerElectric_kW = evChargingPowerElectric_kW;
+ this.currentBatteriesConsumption_kW = currentBatteriesConsumption_kW;
+ this.hydrogenElectricityConsumption_kW = hydrogenElectricityConsumption_kW;
+ this.electricHobConsumption_kW = electricHobConsumption_kW;
+ this.districtHeatDelivery_kW = districtHeatDelivery_kW;
+ this.pvProductionElectric_kW = pvProductionElectric_kW;
+ this.windProductionElectric_kW = windProductionElectric_kW;
+ this.ptProductionHeat_kW = ptProductionHeat_kW;
+ this.CHPProductionElectric_kW = CHPProductionElectric_kW;
+ this.currentBatteriesProduction_kW = currentBatteriesProduction_kW;
+ this.currentV2GProduction_kW = currentV2GProduction_kW;
+ this.currentStoredEnergyBatteries_MWh = currentStoredEnergyBatteries_MWh;
+ }
+
+ public void addFlows(J_AssetFlows assetFlows){
+ this.fixedConsumptionElectric_kW += assetFlows.fixedConsumptionElectric_kW;
+ this.heatPumpElectricityConsumption_kW += assetFlows.heatPumpElectricityConsumption_kW;
+ this.evChargingPowerElectric_kW += assetFlows.evChargingPowerElectric_kW;
+ this.currentBatteriesConsumption_kW += assetFlows.currentBatteriesConsumption_kW;
+ this.hydrogenElectricityConsumption_kW += assetFlows.hydrogenElectricityConsumption_kW;
+ this.electricHobConsumption_kW += assetFlows.electricHobConsumption_kW;
+ this.districtHeatDelivery_kW += assetFlows.districtHeatDelivery_kW;
+ this.pvProductionElectric_kW += assetFlows.pvProductionElectric_kW;
+ this.windProductionElectric_kW += assetFlows.windProductionElectric_kW;
+ this.ptProductionHeat_kW += assetFlows.ptProductionHeat_kW;
+ this.CHPProductionElectric_kW += assetFlows.CHPProductionElectric_kW;
+ this.currentBatteriesProduction_kW += assetFlows.currentBatteriesProduction_kW;
+ this.currentV2GProduction_kW += assetFlows.currentV2GProduction_kW;
+ this.currentStoredEnergyBatteries_MWh += assetFlows.currentStoredEnergyBatteries_MWh;
+ }
+
+
+ public void reset() {
+ fixedConsumptionElectric_kW = 0;
+ heatPumpElectricityConsumption_kW = 0;
+ evChargingPowerElectric_kW = 0;
+ currentBatteriesConsumption_kW = 0;
+ hydrogenElectricityConsumption_kW = 0;
+ electricHobConsumption_kW = 0;
+ districtHeatDelivery_kW = 0;
+ pvProductionElectric_kW = 0;
+ windProductionElectric_kW = 0;
+ ptProductionHeat_kW = 0;
+ CHPProductionElectric_kW = 0;
+ currentBatteriesProduction_kW = 0;
+ currentV2GProduction_kW = 0;
+ currentStoredEnergyBatteries_MWh = 0;
+ }
+
+ @Override
+ public String toString() {
+ return super.toString();
+ }
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+
+}
+
+
+ 1753199813037
+ J_BatteryManagementSelfConsumptionGridNode
+ 1762850659543
+ /**
+ * J_BatteryManagementSelfConsumption1
+ */
+
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
+
+@JsonAutoDetect(
+ fieldVisibility = Visibility.ANY,
+ getterVisibility = Visibility.NONE,
+ isGetterVisibility = Visibility.NONE,
+ setterVisibility = Visibility.NONE,
+ creatorVisibility = Visibility.NONE
+)
+
+public class J_BatteryManagementSelfConsumptionGridNode implements I_BatteryManagement {
+
+ private GridConnection gc;
+
+ /**
+ * Default constructor
+ */
+ public J_BatteryManagementSelfConsumptionGridNode() {
+
+ }
+
+ public J_BatteryManagementSelfConsumptionGridNode( GridConnection gc ) {
+ this.gc = gc;
+ }
+
+ /**
+ * One of the simplest battery algorithms.
+ * This algorithm tries to steer the GridConnection load towards 0.
+ * If there is overproduction and room in the battery it will charge.
+ * If there is more consumption than production it will discharge the battery to make up for the difference untill the battery is empty.
+ */
+ public void manageBattery() {
+ double nodePreviousLoad_kW = gc.p_parentNodeElectric.v_currentLoad_kW;
+ double chargeSetpoint_kW = -(nodePreviousLoad_kW - gc.p_batteryAsset.getLastFlows().get(OL_EnergyCarriers.ELECTRICITY));
+
+ gc.p_batteryAsset.f_updateAllFlows( chargeSetpoint_kW / gc.p_batteryAsset.getCapacityElectric_kW() );
+ }
+
+
+
+ //Get parentagent
+ public Agent getParentAgent() {
+ return this.gc;
+ }
+
+
+ //Store and reset states
+ public void storeStatesAndReset() {
+ //Nothing to store and reset
+ }
+ public void restoreStates() {
+ //Nothing to restore
+ }
+
+
+ @Override
+ public String toString() {
+ return super.toString();
+ }
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+
+}
+
+
+ 1753277071863
+ AgentMixin
+ 1753342021373
+ /**
+ * AgentMixin
+ */
+import com.fasterxml.jackson.annotation.JsonIgnore;
+
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
+import com.fasterxml.jackson.annotation.JsonIdentityInfo;
+import com.fasterxml.jackson.annotation.ObjectIdGenerators;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonTypeInfo;
+import com.fasterxml.jackson.annotation.JsonSubTypes;
+@JsonTypeInfo(
+ use = JsonTypeInfo.Id.CLASS,
+ include = JsonTypeInfo.As.PROPERTY,
+ property = "type" // 👈 this will be the field name in your JSON
+ )
+
+@JsonAutoDetect(
+ fieldVisibility = Visibility.ANY,//PUBLIC_ONLY, // ✅ only public fields are serialized
+ getterVisibility = Visibility.NONE,
+ isGetterVisibility = Visibility.NONE,
+ setterVisibility = Visibility.NONE,
+ creatorVisibility = Visibility.NONE
+)
+//@JsonIgnoreProperties({"connections"})
+@JsonIgnoreProperties({
+ "_pl_powerFlows_autoUpdateEvent_xjal",
+ "_SOC_plot_autoUpdateEvent_xjal",
+ "c_defaultHeatingStrategies",
+ "connections",
+
+ // When also writing private values, these additional fields end up in the json:
+ "ik",
+ "presentation",
+ "_getLevels_xjal"
+})
+ //"line",
+ //"text",
+ //"level",
+
+ /*"icon",
+ "font",
+ "name",
+ "color"*/
+
+ //"gisRegion","p_uniqueColor","p_defaultFillColor","p_defaultLineColor",
+ /*"c_gridNodeExecutionList",
+ "c_gridNodeExecutionListReverse",
+ "c_gridNodesTopLevel",
+ "c_gridNodesNotTopLevel",*/
+
+ //"p_cookingPatternCsv","p_householdTripsCsv","p_truckTripsCsv",
+
+ /*"data_liveLoad_kW","data_liveCapacitySupply_kW", "data_liveCapacityDemand_kW",
+ "data_totalLoad_kW",
+ "data_summerWeekLoad_kW",
+ "data_winterWeekLoad_kW",*/
+ /*"va_gridNode",
+ "va_coop",
+ "va_gridConnection",
+ "va_ConnectionOwner",
+ "va_engine",
+ "_origin_VA",*/
+
+ /*"pop_gridNodes","pop_gridConnections","Houses","pop_connectionOwners","pop_energySuppliers","pop_energyCoops","pop_gridOperators","pop_GIS_Objects","pop_GIS_Parcels","pop_GIS_Buildings",
+ "DistrictHeatingSystems",
+ "GridBatteries",
+ "EnergyProductionSites",
+ "UtilityConnections",
+ "EnergyConversionSites",
+ "PublicChargers",
+ "Neighborhoods",*/
+
+
+
+@JsonIdentityInfo(generator = ObjectIdGenerators.UUIDGenerator.class, property = "@id")
+public abstract class AgentMixin implements Serializable {
+
+ /*@JsonIgnore
+ public abstract void setLocation();
+
+ @JsonIgnore
+ public abstract void getLocation();
+
+
+ @JsonIgnore
+ public abstract void setNetworkNode();
+
+ @JsonIgnore
+ public abstract void getNetworkNode();*/
+
+
+ /**
+ * Default constructor
+ */
+ /*public PopuplationMixin() {
+ }*/
+
+ @Override
+ public String toString() {
+ return super.toString();
+ }
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+
+}
+
+
+ 1753277071874
+ PopulationMixin
+ true
+ 1753342021373
+ /**
+ * PopulationMixin
+ */
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
+import com.fasterxml.jackson.annotation.JsonIdentityInfo;
+import com.fasterxml.jackson.annotation.ObjectIdGenerators;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+
+@JsonAutoDetect(
+ fieldVisibility = Visibility.ANY, // ✅ only public fields are serialized
+ getterVisibility = Visibility.NONE,
+ isGetterVisibility = Visibility.NONE,
+ setterVisibility = Visibility.NONE,
+ creatorVisibility = Visibility.NONE
+)
+@JsonIgnoreProperties({"connections"})
+@JsonIdentityInfo(generator = ObjectIdGenerators.UUIDGenerator.class, property = "@id")
+public abstract class PopulationMixin implements Serializable {
+
+ /*@JsonIgnore
+ public abstract void setLocation();
+
+ @JsonIgnore
+ public abstract void getLocation();
+
+
+ @JsonIgnore
+ public abstract void setNetworkNode();
+
+ @JsonIgnore
+ public abstract void getNetworkNode();*/
+ /**
+ * Default constructor
+ */
+ /*public PopuplationMixin() {
+ }*/
+
+ @Override
+ public String toString() {
+ return super.toString();
+ }
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+
+}
+
+
+ 1753277292016
+ IgnoreClassMixin
+ 1753342021373
+ /**
+ * IgnoreClassMixin
+ */
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
+import com.fasterxml.jackson.annotation.JsonIgnoreType;
+
+
+@JsonAutoDetect(
+ fieldVisibility = Visibility.NONE, //
+ getterVisibility = Visibility.NONE,
+ isGetterVisibility = Visibility.NONE,
+ setterVisibility = Visibility.NONE,
+ creatorVisibility = Visibility.NONE
+ )
+
+@JsonIgnoreType
+public abstract class IgnoreClassMixin implements Serializable {
+
+ /*@JsonIgnore
+ public abstract void setLocation();
+
+ @JsonIgnore
+ public abstract void getLocation();
+
+
+ @JsonIgnore
+ public abstract void setNetworkNode();
+
+ @JsonIgnore
+ public abstract void getNetworkNode();*/
+ /**
+ * Default constructor
+ */
+ /*public PopuplationMixin() {
+ }*/
+
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+
+ private static final long serialVersionUID = 1L;
+
+}
+
+
+ 1753279653467
+ DataSetMixin
+ true
+ 1753342021373
+ /**
+ * DataSetMixin
+ */
+import com.fasterxml.jackson.annotation.JsonIgnore;
+
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
+import com.fasterxml.jackson.annotation.JsonIdentityInfo;
+import com.fasterxml.jackson.annotation.ObjectIdGenerators;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+
+@JsonAutoDetect(
+ fieldVisibility = Visibility.ANY, // ✅ only public fields are serialized
+ getterVisibility = Visibility.NONE,
+ isGetterVisibility = Visibility.NONE,
+ setterVisibility = Visibility.NONE,
+ creatorVisibility = Visibility.NONE
+)
+//@JsonIgnoreProperties({"connections"})
+//@JsonIgnoreProperties({"_origin_VA", "pp_windProduction_fr","energyDataViewer"})
+
+@JsonIdentityInfo(generator = ObjectIdGenerators.UUIDGenerator.class, property = "@id")
+public abstract class DataSetMixin implements Serializable {
+
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+
+}
+
+
+ 1753279891115
+ EnergyModelMixin
+ true
+ 1753342021373
+ /**
+ * EnergyModelMixin
+ */
+import com.fasterxml.jackson.annotation.JsonIgnore;
+
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
+import com.fasterxml.jackson.annotation.JsonIdentityInfo;
+import com.fasterxml.jackson.annotation.ObjectIdGenerators;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+
+/*@JsonAutoDetect(
+ fieldVisibility = Visibility.PUBLIC_ONLY, // ✅ only public fields are serialized
+ getterVisibility = Visibility.NONE,
+ isGetterVisibility = Visibility.NONE,
+ setterVisibility = Visibility.NONE,
+ creatorVisibility = Visibility.NONE
+)
+@JsonIgnoreProperties({"p_cookingPatternCsv","p_householdTripsCsv","p_truckTripsCsv","connections",
+ "pop_gridNodes","pop_gridConnections","Houses","pop_connectionOwners","pop_energySuppliers","pop_energyCoops","pop_gridOperators","pop_GIS_Objects","pop_GIS_Parcels","pop_GIS_Buildings",
+ "DistrictHeatingSystems",
+ "GridBatteries",
+ "EnergyProductionSites",
+ "UtilityConnections",
+ "EnergyConversionSites",
+ "PublicChargers",
+ "Neighborhoods",
+ "c_defaultHeatingStrategies"
+// "_origin_VA"
+})*/
+
+//JsonIgnoreProperties({"color","VA_engine","_origin_VA","energyDataViewer"})
+
+
+public abstract class EnergyModelMixin implements Serializable {
+
+ /*@JsonIgnore
+ public abstract void setLocation();
+
+ @JsonIgnore
+ public abstract void getLocation();
+
+
+ @JsonIgnore
+ public abstract void setNetworkNode();
+
+ @JsonIgnore
+ public abstract void getNetworkNode();*/
+ /**
+ * Default constructor
+ */
+ /*public PopuplationMixin() {
+ }*/
+
+ @Override
+ public String toString() {
+ return super.toString();
+ }
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+
+}
+
+
+ 1753280103414
+ TableFunctionMixin
+ true
+ 1753342021373
+ /**
+ * TableFunctionMixin
+ */
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
+import com.fasterxml.jackson.annotation.JsonIdentityInfo;
+import com.fasterxml.jackson.annotation.ObjectIdGenerators;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+
+@JsonAutoDetect(
+ fieldVisibility = Visibility.PUBLIC_ONLY, // ✅ only public fields are serialized
+ getterVisibility = Visibility.NONE,
+ isGetterVisibility = Visibility.NONE,
+ setterVisibility = Visibility.NONE,
+ creatorVisibility = Visibility.NONE
+)
+@JsonIdentityInfo(generator = ObjectIdGenerators.UUIDGenerator.class, property = "@id")
+public abstract class TableFunctionMixin implements Serializable {
+
+ /**
+ * Default constructor
+ */
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+
+}
+
+
+ 1753342010985
+ ActorMixin
+ true
+ 1753342021373
+ /**
+ * ActorMixin
+ */
+import com.fasterxml.jackson.annotation.JsonIgnore;
+
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
+import com.fasterxml.jackson.annotation.JsonIdentityInfo;
+import com.fasterxml.jackson.annotation.ObjectIdGenerators;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+
+import com.fasterxml.jackson.annotation.JsonTypeInfo;
+import com.fasterxml.jackson.annotation.JsonSubTypes;
+@JsonTypeInfo(
+ use = JsonTypeInfo.Id.CLASS,
+ include = JsonTypeInfo.As.PROPERTY,
+ property = "type" // 👈 this will be the field name in your JSON
+ )
+/*
+@JsonSubTypes({
+ @JsonSubTypes.Type(value = ConnectionOwner.class, name = "ConnectionOwner"),
+ @JsonSubTypes.Type(value = EnergyCoop.class, name = "EnergyCoop"),
+ @JsonSubTypes.Type(value = EnergySupplier.class, name = "EnergySupplier"),
+ @JsonSubTypes.Type(value = GridOperator.class, name = "GridOperator"),
+ @JsonSubTypes.Type(value = GovernmentLayer.class, name = "GovernmentLayer"),
+ @JsonSubTypes.Type(value = NationalEnergyMarket.class, name = "NationalEnergyMarket"),
+
+ //@JsonSubTypes.Type(value = EnergyCoopL4L.class, name = "EnergyCoopL4L"),
+ // @JsonSubTypes.Type(value = J_EAConversionGasBurner.class, name = "J_EAConversionGasBurner"),
+ // @JsonSubTypes.Type(value = J_EAConversionHeatPump.class, name = "J_EAConversionHeatPump"),
+ // @JsonSubTypes.Type(value = J_EAEV.class, name = "J_EAEV"),
+ // @JsonSubTypes.Type(value = J_EADieselVehicle.class, name = "J_EADieselVehicle"),
+
+ // Add other known subtypes here if needed
+})
+*/
+//@JsonIdentityInfo(generator = ObjectIdGenerators.UUIDGenerator.class, property = "@id")
+
+public abstract class ActorMixin implements Serializable {
+
+ /*@JsonIgnore
+ public abstract void setLocation();
+
+ @JsonIgnore
+ public abstract void getLocation();
+
+
+ @JsonIgnore
+ public abstract void setNetworkNode();
+
+ @JsonIgnore
+ public abstract void getNetworkNode();*/
+ /**
+ * Default constructor
+ */
+ /*public PopuplationMixin() {
+ }*/
+
+ @Override
+ public String toString() {
+ return super.toString();
+ }
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+
+}
+
+
+ 1753968339982
+ J_ValueMap
+ 1752679379816
+ /**
+ * J_ValueMap
+ */
+import zeroPackage.ZeroMath;
+import java.util.EnumSet;
+import com.fasterxml.jackson.annotation.JsonIgnoreType;
+@JsonIgnoreType
+public class J_ValueMap <E extends Enum<E>> implements Serializable {
+
+ //
+ private final EnumSet<E> enumSet;
+ //private final Class<E> enumClass;
+ private double[] valuesArray;// = new double[OL_AssetFlowCategories.values().length]; // Use array with size of all possible energyCarriers; more than strictly needed but memory footprint is negligable anyway.;
+
+ /**
+ * Default constructor
+ */
+ public J_ValueMap(Class<E> enumClass) {
+ //this.enumClass = enumClass;
+ this.enumSet = EnumSet.noneOf(enumClass);
+ this.valuesArray = new double[enumClass.getEnumConstants().length];
+ }
+
+ public final double get(E key) {
+ return valuesArray[key.ordinal()];
+ }
+
+
+ public final void put(E key, double value) {
+ valuesArray[key.ordinal()] = value;
+ enumSet.add(key);
+ }
+
+ public final void clear() {
+ enumSet.clear();
+ Arrays.fill(valuesArray, 0.0);
+ /*for(int i=0; i<valuesArray.length; i++) {
+ valuesArray[i]=0.0;
+ }*/
+ }
+
+ //public J_AssetFlowsMap addToExistingFlows( J_AssetFlowsMap f) {
+ public final J_ValueMap addFlows( J_ValueMap f) {
+ int len = valuesArray.length;
+ for(int i=0; i<len; i++) {
+ //this.valuesArray[i]=this.valuesArray[i]+f.valuesArray[i];
+ this.valuesArray[i]+=f.valuesArray[i];
+ }
+ this.enumSet.addAll(f.enumSet);
+ return this;
+ }
+
+ public final J_ValueMap addFlow( E key, double value) {
+ enumSet.add(key);
+ this.valuesArray[key.ordinal()]+=value;
+ //double currentValue = this.get(key);
+ //this.put(key, currentValue + value);
+ return this;
+ }
+
+ public final J_ValueMap cloneMap(J_ValueMap flowMap) {
+ //this.clear();
+ //this.addFlows(flowMap);
+
+ // Custom 'addflows' version that doesn't add, just 'copies'. Might be faster?
+ int len = valuesArray.length;
+ for(int i=0; i<len; i++) {
+ this.valuesArray[i]=flowMap.valuesArray[i];
+ }
+
+ //this.flowCategories = flowMap.flowCategories.clone(); // This or first clear list and then addAll? Which is faster?
+ this.enumSet.clear();
+ this.enumSet.addAll(flowMap.enumSet);
+ return this;
+ }
+
+ public double totalSum() {
+ return ZeroMath.arraySum(valuesArray);
+ }
+
+ public final EnumSet<E> keySet(){
+ return enumSet;
+ }
+
+ public String toString() {
+ if (this.enumSet.size() == 0) {
+ return "{}";
+ }
+ StringBuilder sb = new StringBuilder();
+ sb.append('{');
+ for (E key : this.enumSet) {
+ double value = this.get(key);
+ sb.append(key);
+ sb.append(" = ");
+ sb.append(value);
+ sb.append("\n ");
+ }
+ sb.delete(sb.length()-2, sb.length());
+ sb.append('}');
+ return sb.toString();
+ }
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+
+}
+
+
+ 1754038055004
+ J_AccumulatorMap
+ 1752679379816
+ /**
+ * J_AccumulatorMap
+ */
+//import java.util.EnumMap;
+import java.util.EnumSet;
+
+//import zeroPackage.ZeroAccumulator;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreType;
+@JsonIgnoreType
+public class J_AccumulatorMap <E extends Enum<E>> implements Serializable {
+
+ private ZeroAccumulator[] accumulatorArray;
+ private final EnumSet<E> enumSet;
+ private final Class<E> enumClass;
+ //private ZeroAccumulator[] accumulatorArray = new ZeroAccumulator[OL_EnergyCarriers.values().length]; // Use array with size of all possible energyCarriers; more than strictly needed but memory footprint is negligable anyway.;
+ //private EnumSet<OL_EnergyCarriers> energyCarrierList = EnumSet.noneOf(OL_EnergyCarriers.class);
+
+
+ public J_AccumulatorMap(Class<E> enumClass) {
+ this.enumClass = enumClass;
+ this.enumSet = EnumSet.noneOf(enumClass);
+ this.accumulatorArray = new ZeroAccumulator[enumClass.getEnumConstants().length];
+ }
+
+ public void createEmptyAccumulators(EnumSet<E> selectedFlows, boolean hasTimeSeries, double signalResolution_h, double duration_h) {
+ this.clear();
+ for (E key : selectedFlows) {
+ this.put(key, new ZeroAccumulator(hasTimeSeries, signalResolution_h, duration_h));
+ }
+ }
+
+ public J_AccumulatorMap getClone() {
+ J_AccumulatorMap am = new J_AccumulatorMap(enumClass);
+ for (var EC : this.enumSet) {
+ am.put(EC, accumulatorArray[EC.ordinal()].getClone());
+ }
+ return am;
+ }
+
+ public ZeroAccumulator get(E key) {
+ return accumulatorArray[key.ordinal()];
+ }
+
+
+ public void put(E key, ZeroAccumulator acc) {
+ accumulatorArray[key.ordinal()] = acc;
+ enumSet.add(key);
+ }
+
+ public Set<E> keySet() {
+ return enumSet;
+ }
+ /*
+ public double totalSum() {
+ double totalSum = 0.0;
+ for (var EC : energyCarrierList) {
+ totalSum += accumulatorArray[EC.ordinal()].getSum();
+ }
+ return totalSum;
+ }
+ */
+ public double totalIntegral_kWh() {
+ double totalIntegral_kWh = 0.0;
+ for (var EC : enumSet) {
+ totalIntegral_kWh += accumulatorArray[EC.ordinal()].getIntegral_kWh();
+ }
+ return totalIntegral_kWh;
+ }
+
+ public double totalIntegral_MWh() {
+ return this.totalIntegral_kWh() / 1000;
+ }
+
+ public double totalIntegralPos_kWh() {
+ double totalIntegralPos_kWh = 0.0;
+ for (var EC : enumSet) {
+ totalIntegralPos_kWh += accumulatorArray[EC.ordinal()].getIntegralPos_kWh();
+ }
+ return totalIntegralPos_kWh;
+ }
+
+ public double totalIntegralPos_MWh() {
+ return this.totalIntegralPos_kWh() / 1000;
+ }
+
+ public double totalIntegralNeg_kWh() {
+ double totalIntegralNeg_kWh = 0.0;
+ for (var EC : enumSet) {
+ totalIntegralNeg_kWh += accumulatorArray[EC.ordinal()].getIntegralNeg_kWh();
+ }
+ return totalIntegralNeg_kWh;
+ }
+
+ public double totalIntegralNeg_MWh() {
+ return this.totalIntegralNeg_kWh() / 1000;
+ }
+
+ public void clear() {
+ accumulatorArray = new ZeroAccumulator[this.enumClass.getEnumConstants().length];
+ enumSet.clear();
+ }
+
+ public void reset() {
+ for (var EC : enumSet) {
+ accumulatorArray[EC.ordinal()].reset();
+ }
+ }
+
+ public J_AccumulatorMap<E> add( J_AccumulatorMap<E> accumulatorMap ) {
+ for (var EC : accumulatorMap.enumSet) {
+ if (!this.enumSet.contains(EC)) {
+ // make a new one?
+ throw new RuntimeException("Tried to add two AccumulatorMaps without matching keys.");
+ }
+ this.get(EC).add(accumulatorMap.get(EC));
+ }
+ return this;
+ }
+
+ public J_AccumulatorMap<E> subtract( J_AccumulatorMap<E> accumulatorMap ) {
+ for (var EC : accumulatorMap.enumSet) {
+ if (!this.enumSet.contains(EC)) {
+ // make a new one?
+ throw new RuntimeException("Tried to subtract two AccumulatorMaps without matching keys.");
+ }
+ this.get(EC).subtract(accumulatorMap.get(EC));
+ }
+ return this;
+ }
+
+ public J_DataSetMap getDataSetMap( double startTime_h ) {
+ J_DataSetMap dsm = new J_DataSetMap(this.enumClass);
+ for (var EC : this.enumSet) {
+ dsm.put(EC, this.get(EC).getDataSet(startTime_h));
+ }
+ return dsm;
+ }
+
+ public J_DataSetMap getDataSetMap( double startTime_h, double dataSetSignalResolution_h ) {
+ J_DataSetMap dsm = new J_DataSetMap(this.enumClass);
+ for (var EC : this.enumSet) {
+ dsm.put(EC, this.get(EC).getDataSet(startTime_h, dataSetSignalResolution_h));
+ }
+ return dsm;
+ }
+
+ public String toString() {
+ if (this.accumulatorArray.length == 0) {
+ return "{}";
+ }
+ StringBuilder sb = new StringBuilder();
+ sb.append('{');
+ for (E key : this.enumSet) {
+ ZeroAccumulator acc = this.get(key);
+ //double value = this.get(key);
+ if (acc.getIntegral_kWh() == 0.0) {
+ continue;
+ }
+
+ sb.append(key);
+ sb.append(" ");
+ sb.append(acc.toString());
+ //sb.append(" = ");
+ //sb.append(value);
+ sb.append(", ");
+ }
+ //sb.delete(sb.length()-2, sb.length());
+ sb.append('}');
+ return sb.toString();
+ }
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+
+}
+
+
+ 1754405220949
+ J_HeatingManagementBuildingWithPTBufferSimple
+ true
+ 1762850602203
+ /**
+ * J_HeatingManagementBuildingWithPTBufferSimple
+ */
+public class J_HeatingManagementBuildingWithPTBufferSimple implements I_HeatingManagement {
+
+ private boolean isInitialized = false;
+ private GridConnection gc;
+ private List<OL_GridConnectionHeatingType> validHeatingTypes = Arrays.asList(
+ OL_GridConnectionHeatingType.GAS_BURNER,
+ OL_GridConnectionHeatingType.ELECTRIC_HEATPUMP,
+ OL_GridConnectionHeatingType.HYDROGENBURNER,
+ OL_GridConnectionHeatingType.DISTRICTHEAT,
+ OL_GridConnectionHeatingType.LT_DISTRICTHEAT
+ );
+ private OL_GridConnectionHeatingType currentHeatingType;
+
+ private J_EABuilding building;
+ private J_EAConversion heatingAsset;
+
+ private double startOfDay_h = 8;
+ private double startOfNight_h = 23;
+ private double dayTimeSetPoint_degC = 19;
+ private double nightTimeSetPoint_degC = 19;
+ private double heatingKickinTreshhold_degC = 1;
+
+ /**
+ * Default constructor
+ */
+ public J_HeatingManagementBuildingWithPTBufferSimple() {
+
+ }
+
+ public J_HeatingManagementBuildingWithPTBufferSimple( GridConnection gc, OL_GridConnectionHeatingType heatingType ) {
+ this.gc = gc;
+ this.currentHeatingType = heatingType;
+ this.building = gc.p_BuildingThermalAsset;
+ }
+
+ public J_HeatingManagementBuildingWithPTBufferSimple( GridConnection gc, OL_GridConnectionHeatingType heatingType, double startOfDay_h, double startOfNight_h, double dayTimeSetPoint_degC, double nightTimeSetPoint_degC, double heatingKickinTreshhold_degC ) {
+ this.gc = gc;
+ this.currentHeatingType = heatingType;
+ this.building = gc.p_BuildingThermalAsset;
+ this.startOfDay_h = startOfDay_h;
+ this.startOfNight_h = startOfNight_h;
+ this.dayTimeSetPoint_degC = dayTimeSetPoint_degC;
+ this.nightTimeSetPoint_degC = nightTimeSetPoint_degC;
+ this.heatingKickinTreshhold_degC = heatingKickinTreshhold_degC;
+ }
+
+
+ public double managePTAndHotWaterHeatBuffer(double hotWaterDemand_kW){
+
+ //Calculate the pt production
+ double ptProduction_kW = 0;
+ List<J_EAProduction> ptAssets = findAll(gc.c_productionAssets, ea -> ea.energyAssetType == OL_EnergyAssetType.PHOTOTHERMAL);
+ for (J_EA j_ea : ptAssets) {
+ ptProduction_kW -= j_ea.getLastFlows().get(OL_EnergyCarriers.HEAT);
+ }
+
+ //Calculate the remaining hot water energy need after pt production, also calculate the remaining unused pt production
+ double remainingHotWater_kW = max(0, hotWaterDemand_kW - ptProduction_kW); // Need to do this, because pt has already compensated the hot water demand in the gc flows, so just need to update this value
+ double remainingPTProduction_kW = max(0, ptProduction_kW - hotWaterDemand_kW);
+
+ if(gc.p_heatBuffer != null){
+ double chargeSetpoint_kW = 0;
+ if(remainingHotWater_kW > 0) {
+ chargeSetpoint_kW = -remainingHotWater_kW;
+ }
+ else if(remainingPTProduction_kW > 0) {
+ chargeSetpoint_kW = remainingPTProduction_kW;
+ }
+ gc.p_heatBuffer.v_powerFraction_fr = chargeSetpoint_kW / gc.p_heatBuffer.getCapacityHeat_kW();
+ gc.p_heatBuffer.f_updateAllFlows(gc.p_heatBuffer.v_powerFraction_fr);
+
+ double heatBufferCharge_kW = gc.p_heatBuffer.getLastFlows().get(OL_EnergyCarriers.HEAT);
+
+ if(remainingHotWater_kW > 0){//Only if the current pt production, wasnt enough, adjust the hotwater demand with the buffer, cause then the buffer will have tried to discharge
+ remainingHotWater_kW = max(0, remainingHotWater_kW + heatBufferCharge_kW);
+ }
+ else {//Curtail the remaining pt
+ remainingPTProduction_kW = max(0, remainingPTProduction_kW - heatBufferCharge_kW);
+ if (remainingPTProduction_kW > 0) {//Heat (for now always curtail over produced heat!)
+ for (J_EAProduction j_ea : ptAssets) {
+ remainingPTProduction_kW -= j_ea.curtailEnergyCarrierProduction( OL_EnergyCarriers.HEAT, remainingPTProduction_kW);
+
+ if (remainingPTProduction_kW <= 0) {
+ break;
+ }
+ }
+ }
+ }
+ }
+ return remainingHotWater_kW;
+ }
+
+
+ public void manageHeating() {
+ if ( !isInitialized ) {
+ this.initializeAssets();
+ }
+ double hotWaterDemand_kW = gc.p_DHWAsset != null ? gc.p_DHWAsset.getLastFlows().get(OL_EnergyCarriers.HEAT) : 0;
+
+ //Adjust the hot water demand with the buffer and pt
+ double remainingHotWaterDemand_kW = managePTAndHotWaterHeatBuffer(hotWaterDemand_kW);
+
+ if(gc.fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.HEAT) != remainingHotWaterDemand_kW) {
+ traceln("Current balanceflow heat and remainingHotWaterDemand dif: " + (gc.fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.HEAT) - remainingHotWaterDemand_kW));
+ throw new RuntimeException("Current balance flow heat does not match remainingHotWaterDemand in BuildingWithPTBufferSimple management");
+ }
+
+ double buildingTemp_degC = building.getCurrentTemperature();
+ double timeOfDay_h = gc.energyModel.t_hourOfDay;
+ if (timeOfDay_h < startOfDay_h || timeOfDay_h >= startOfNight_h) {
+ if (buildingTemp_degC < nightTimeSetPoint_degC - heatingKickinTreshhold_degC) {
+ // Nighttime and building temperature too low
+ double buildingPowerSetpoint_kW = (nightTimeSetPoint_degC - buildingTemp_degC) * this.building.heatCapacity_JpK / 3.6e6 / gc.energyModel.p_timeStep_h;
+ double buildingPower_kW = min(heatingAsset.getOutputCapacity_kW() - remainingHotWaterDemand_kW, buildingPowerSetpoint_kW);
+ double assetPower_kW = buildingPower_kW + remainingHotWaterDemand_kW;
+ building.f_updateAllFlows( buildingPower_kW / building.getCapacityHeat_kW() );
+ heatingAsset.f_updateAllFlows( assetPower_kW / heatingAsset.getOutputCapacity_kW() );
+ return;
+ }
+ else {
+ // Nighttime and building temperature acceptable
+ building.f_updateAllFlows( 0.0 );
+ heatingAsset.f_updateAllFlows( remainingHotWaterDemand_kW / heatingAsset.getOutputCapacity_kW() );
+ return;
+ }
+ }
+ else {
+ if (buildingTemp_degC < dayTimeSetPoint_degC - heatingKickinTreshhold_degC) {
+ // Daytime and building temperature too low
+ double buildingPowerSetpoint_kW = (dayTimeSetPoint_degC - buildingTemp_degC) * this.building.heatCapacity_JpK / 3.6e6 / gc.energyModel.p_timeStep_h;
+ double buildingPower_kW = min(heatingAsset.getOutputCapacity_kW() - remainingHotWaterDemand_kW, buildingPowerSetpoint_kW);
+ double assetPower_kW = buildingPower_kW + remainingHotWaterDemand_kW;
+ building.f_updateAllFlows( buildingPower_kW / building.getCapacityHeat_kW() );
+ heatingAsset.f_updateAllFlows( assetPower_kW / heatingAsset.getOutputCapacity_kW() );
+ return;
+ }
+ else {
+ // Daytime and building temperature acceptable
+ building.f_updateAllFlows( 0.0 );
+ heatingAsset.f_updateAllFlows( remainingHotWaterDemand_kW / heatingAsset.getOutputCapacity_kW() );
+ return;
+ }
+ }
+ }
+
+
+ public void initializeAssets() {
+ if (!validHeatingTypes.contains(this.currentHeatingType)) {
+ throw new RuntimeException(this.getClass() + " does not support heating type: " + this.currentHeatingType);
+ }
+ if(gc.p_DHWAsset == null) {
+ throw new RuntimeException(this.getClass() + " requires a hot water demand to make sense to use.");
+ }
+ J_EAProduction ptAsset = findFirst(gc.c_productionAssets, ea -> ea.energyAssetType == OL_EnergyAssetType.PHOTOTHERMAL);
+ if (ptAsset == null) {
+ throw new RuntimeException(this.getClass() + " requires a pt asset.");
+ }
+ if (gc.p_heatBuffer == null) {
+ throw new RuntimeException(this.getClass() + " requires a heat buffer.");
+ }
+ if (building == null) {
+ throw new RuntimeException(this.getClass() + " requires a building asset.");
+ }
+ J_EAConsumption heatConsumption = findFirst(gc.c_consumptionAssets, x -> x.getEAType() == OL_EnergyAssetType.HEAT_DEMAND);
+ J_EAProfile heatProfile = findFirst(gc.c_profileAssets, x -> x.getEnergyCarrier() == OL_EnergyCarriers.HEAT);
+ if (heatProfile != null || heatConsumption != null) {
+ throw new RuntimeException(this.getClass() + " does not support HEAT_DEMAND profiles.");
+ }
+ if (gc.c_heatingAssets.size() == 0) {
+ throw new RuntimeException(this.getClass() + " requires at least one heating asset.");
+ }
+ if (gc.c_heatingAssets.size() > 1) {
+ throw new RuntimeException(this.getClass() + " does not support more than one heating asset.");
+ }
+ // TODO: Add a check if the power of the asset is sufficient?
+ // TODO: Add a check if the heatingAsset is of the correct type, e.g. not a hydrogen burner or not a CHP.
+ this.heatingAsset = gc.c_heatingAssets.get(0);
+ this.isInitialized = true;
+ }
+
+
+ public void notInitialized() {
+ this.isInitialized = false;
+ }
+
+ public List<OL_GridConnectionHeatingType> getValidHeatingTypes() {
+ return this.validHeatingTypes;
+ }
+
+ public OL_GridConnectionHeatingType getCurrentHeatingType() {
+ return this.currentHeatingType;
+ }
+
+ @Override
+ public String toString() {
+ return super.toString();
+ }
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+}
+
+
+
+ 1754412462104
+ J_HeatingManagementProfileWithPTBufferSimple
+ true
+ 1762850602203
+ /**
+ * J_HeatingManagementProfileWithPTBufferSimple
+ */
+public class J_HeatingManagementProfileWithPTBufferSimple implements I_HeatingManagement {
+
+ private boolean isInitialized = false;
+ private GridConnection gc;
+ private List<OL_GridConnectionHeatingType> validHeatingTypes = Arrays.asList(
+ OL_GridConnectionHeatingType.GAS_BURNER,
+ OL_GridConnectionHeatingType.ELECTRIC_HEATPUMP,
+ OL_GridConnectionHeatingType.HYDROGENBURNER,
+ OL_GridConnectionHeatingType.DISTRICTHEAT,
+ OL_GridConnectionHeatingType.LT_DISTRICTHEAT
+ );
+ private OL_GridConnectionHeatingType currentHeatingType;
+ private J_EAConversion heatingAsset;
+
+
+ /**
+ * Default constructor
+ */
+ public J_HeatingManagementProfileWithPTBufferSimple() {
+
+ }
+
+ public J_HeatingManagementProfileWithPTBufferSimple( GridConnection gc, OL_GridConnectionHeatingType heatingType ) {
+ this.gc = gc;
+ this.currentHeatingType = heatingType;
+ }
+
+
+ public void manageHeating() {
+ if ( !isInitialized ) {
+ this.initializeAssets();
+ }
+
+
+ double hotWaterDemand_kW = gc.p_DHWAsset != null ? gc.p_DHWAsset.getLastFlows().get(OL_EnergyCarriers.HEAT) : 0;
+
+ //Adjust the hot water and overall heat demand with the buffer and pt
+ double remainingHotWaterDemand_kW = managePTAndHotWaterHeatBuffer(hotWaterDemand_kW);
+
+ double heatDemand_kW = gc.fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.HEAT);
+ //heatDemand_kW = heatDemand_kW - (hotWaterDemand_kW - remainingHotWaterDemand_kW);
+
+ //Run the asset
+ heatingAsset.f_updateAllFlows( heatDemand_kW / heatingAsset.getOutputCapacity_kW() );
+ }
+
+
+ public double managePTAndHotWaterHeatBuffer(double hotWaterDemand_kW){
+
+ //Calculate the pt production
+ double ptProduction_kW = 0;
+ List<J_EAProduction> ptAssets = findAll(gc.c_productionAssets, ea -> ea.energyAssetType == OL_EnergyAssetType.PHOTOTHERMAL);
+ for (J_EA j_ea : ptAssets) {
+ ptProduction_kW -= j_ea.getLastFlows().get(OL_EnergyCarriers.HEAT);
+ }
+
+ //Calculate the remaining hot water energy need after pt production, also calculate the remaining unused pt production
+ double remainingHotWater_kW = max(0, hotWaterDemand_kW - ptProduction_kW); // Need to do this, because pt has already compensated the hot water demand in the gc flows, so just need to update this value
+ double remainingPTProduction_kW = max(0, ptProduction_kW - hotWaterDemand_kW);
+
+ if(gc.p_heatBuffer != null){
+ double chargeSetpoint_kW = 0;
+ if(remainingHotWater_kW > 0) {
+ chargeSetpoint_kW = -remainingHotWater_kW;
+ }
+ else if(remainingPTProduction_kW > 0) {
+ chargeSetpoint_kW = remainingPTProduction_kW;
+ }
+ gc.p_heatBuffer.v_powerFraction_fr = chargeSetpoint_kW / gc.p_heatBuffer.getCapacityHeat_kW();
+ gc.p_heatBuffer.f_updateAllFlows(gc.p_heatBuffer.v_powerFraction_fr);
+
+ double heatBufferCharge_kW = gc.p_heatBuffer.getLastFlows().get(OL_EnergyCarriers.HEAT);
+
+ if(remainingHotWater_kW > 0){//Only if the current pt production, wasnt enough, adjust the hotwater demand with the buffer, cause then the buffer will have tried to discharge
+ remainingHotWater_kW = max(0, remainingHotWater_kW + heatBufferCharge_kW);
+ }
+ else {//Curtail the remaining pt
+ remainingPTProduction_kW = max(0, remainingPTProduction_kW - heatBufferCharge_kW);
+ if (remainingPTProduction_kW > 0) {//Heat (for now always curtail over produced heat!)
+ for (J_EAProduction j_ea : ptAssets) {
+ remainingPTProduction_kW -= j_ea.curtailEnergyCarrierProduction( OL_EnergyCarriers.HEAT, remainingPTProduction_kW);
+
+ if (remainingPTProduction_kW <= 0) {
+ break;
+ }
+ }
+ }
+ }
+ }
+ return remainingHotWater_kW;
+ }
+
+
+ public void initializeAssets() {
+ if (!validHeatingTypes.contains(this.currentHeatingType)) {
+ throw new RuntimeException(this.getClass() + " does not support heating type: " + this.currentHeatingType);
+ }
+ if(gc.p_DHWAsset == null) {
+ throw new RuntimeException(this.getClass() + " requires a hot water demand to make sense to use.");
+ }
+ J_EAProduction ptAsset = findFirst(gc.c_productionAssets, ea -> ea.energyAssetType == OL_EnergyAssetType.PHOTOTHERMAL);
+ if (ptAsset == null) {
+ throw new RuntimeException(this.getClass() + " requires a pt asset.");
+ }
+ if (gc.p_heatBuffer == null) {
+ throw new RuntimeException(this.getClass() + " requires a heat buffer.");
+ }
+ if (gc.p_BuildingThermalAsset != null) {
+ throw new RuntimeException(this.getClass() + " does not support a building asset.");
+ }
+ J_EAConsumption heatConsumption = findFirst(gc.c_consumptionAssets, x -> x.getEAType() == OL_EnergyAssetType.HEAT_DEMAND);
+ J_EAProfile heatProfile = findFirst(gc.c_profileAssets, x -> x.getEnergyCarrier() == OL_EnergyCarriers.HEAT);
+ if (heatConsumption == null && heatProfile == null) {
+ throw new RuntimeException(this.getClass() + " requires a HEAT_DEMAND profile.");
+ }
+ if (gc.c_heatingAssets.size() == 0) {
+ throw new RuntimeException(this.getClass() + " requires at least one heating asset.");
+ }
+ if (gc.c_heatingAssets.size() > 1) {
+ throw new RuntimeException(this.getClass() + " does not support more than one heating asset.");
+ }
+ // TODO: Add a check if the power of the asset is sufficient?
+ // TODO: Add a check if the heatingAsset is of the correct type, e.g. not a hydrogen burner or not a CHP.
+ this.heatingAsset = gc.c_heatingAssets.get(0);
+ this.isInitialized = true;
+ }
+
+
+ public void notInitialized() {
+ this.isInitialized = false;
+ }
+
+ public List<OL_GridConnectionHeatingType> getValidHeatingTypes() {
+ return this.validHeatingTypes;
+ }
+
+ public OL_GridConnectionHeatingType getCurrentHeatingType() {
+ return this.currentHeatingType;
+ }
+
+ @Override
+ public String toString() {
+ return super.toString();
+ }
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+
+}
+
+
+ 1754413726650
+ J_HeatingManagementSimple
+ 1762850578079
+ /**
+ * J_HeatingManagementSimple
+ */
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
+
+@JsonAutoDetect(
+ fieldVisibility = Visibility.ANY, //
+ getterVisibility = Visibility.NONE,
+ isGetterVisibility = Visibility.NONE,
+ setterVisibility = Visibility.NONE,
+ creatorVisibility = Visibility.NONE
+)
+
+public class J_HeatingManagementSimple implements I_HeatingManagement {
+
+ private boolean isInitialized = false;
+ private GridConnection gc;
+ private List<OL_GridConnectionHeatingType> validHeatingTypes = Arrays.asList(
+ OL_GridConnectionHeatingType.GAS_BURNER,
+ OL_GridConnectionHeatingType.ELECTRIC_HEATPUMP,
+ OL_GridConnectionHeatingType.HYDROGENBURNER,
+ OL_GridConnectionHeatingType.DISTRICTHEAT,
+ OL_GridConnectionHeatingType.LT_DISTRICTHEAT
+ );
+ private OL_GridConnectionHeatingType currentHeatingType;
+
+ private J_EABuilding building;
+ private J_EAConversion heatingAsset;
+ private J_HeatingPreferences heatingPreferences;
+
+ /**
+ * Default constructor
+ */
+ public J_HeatingManagementSimple() {
+
+ }
+
+ public J_HeatingManagementSimple( GridConnection gc, OL_GridConnectionHeatingType heatingType) {
+ this.gc = gc;
+ this.currentHeatingType = heatingType;
+ }
+
+ public double managePTAndHotWaterHeatBuffer(double hotWaterDemand_kW){
+
+ //Calculate the pt production
+ double ptProduction_kW = 0;
+ List<J_EAProduction> ptAssets = findAll(gc.c_productionAssets, ea -> ea.energyAssetType == OL_EnergyAssetType.PHOTOTHERMAL);
+ for (J_EA j_ea : ptAssets) {
+ ptProduction_kW -= j_ea.getLastFlows().get(OL_EnergyCarriers.HEAT);
+ }
+
+ //Calculate the remaining hot water energy need after pt production, also calculate the remaining unused pt production
+ double remainingHotWater_kW = max(0, hotWaterDemand_kW - ptProduction_kW); // Need to do this, because pt has already compensated the hot water demand in the gc flows, so just need to update this value
+ double remainingPTProduction_kW = max(0, ptProduction_kW - hotWaterDemand_kW);
+
+ if(gc.p_heatBuffer != null){
+ double chargeSetpoint_kW = 0;
+ if(remainingHotWater_kW > 0) {
+ chargeSetpoint_kW = -remainingHotWater_kW;
+ }
+ else if(remainingPTProduction_kW > 0) {
+ chargeSetpoint_kW = remainingPTProduction_kW;
+ }
+ gc.p_heatBuffer.v_powerFraction_fr = chargeSetpoint_kW / gc.p_heatBuffer.getCapacityHeat_kW();
+ gc.p_heatBuffer.f_updateAllFlows(gc.p_heatBuffer.v_powerFraction_fr);
+
+ double heatBufferCharge_kW = gc.p_heatBuffer.getLastFlows().get(OL_EnergyCarriers.HEAT);
+
+ if(remainingHotWater_kW > 0){//Only if the current pt production, wasnt enough, adjust the hotwater demand with the buffer, cause then the buffer will have tried to discharge
+ remainingHotWater_kW = max(0, remainingHotWater_kW + heatBufferCharge_kW);
+ }
+ else {//Curtail the remaining pt that is not used for hot water
+ remainingPTProduction_kW = max(0, remainingPTProduction_kW - heatBufferCharge_kW);
+ if (remainingPTProduction_kW > 0) {//Heat (for now always curtail over produced heat!)
+ for (J_EAProduction j_ea : ptAssets) {
+ remainingPTProduction_kW -= j_ea.curtailEnergyCarrierProduction( OL_EnergyCarriers.HEAT, remainingPTProduction_kW);
+
+ if (remainingPTProduction_kW <= 0) {
+ break;
+ }
+ }
+ }
+ }
+ }
+ return remainingHotWater_kW;
+ }
+
+
+ public void manageHeating() {
+ if ( !isInitialized ) {
+ this.initializeAssets();
+ }
+
+ double hotWaterDemand_kW = gc.p_DHWAsset != null ? gc.p_DHWAsset.getLastFlows().get(OL_EnergyCarriers.HEAT) : 0;
+
+ //Adjust the hot water and overall heat demand with the buffer and pt
+ double remainingHotWaterDemand_kW = managePTAndHotWaterHeatBuffer(hotWaterDemand_kW); // also updates fm_currentBalanceFlows_kW(heat)!
+
+ double heatDemand_kW = gc.fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.HEAT);
+
+ double heatingAssetPower_kW = 0;
+
+ if(this.building != null) {
+ double buildingHeatingDemand_kW = 0;
+ double buildingTemp_degC = building.getCurrentTemperature();
+ double timeOfDay_h = gc.energyModel.t_hourOfDay;
+ if (timeOfDay_h < heatingPreferences.getStartOfDayTime_h() || timeOfDay_h >= heatingPreferences.getStartOfNightTime_h()) {
+ if (buildingTemp_degC < heatingPreferences.getNightTimeSetPoint_degC()) {
+ // Nighttime and building temperature too low
+ buildingHeatingDemand_kW = (heatingPreferences.getNightTimeSetPoint_degC() - buildingTemp_degC) * this.building.heatCapacity_JpK / 3.6e6 / gc.energyModel.p_timeStep_h;
+ }
+ else {
+ // Nighttime and building temperature acceptable
+ }
+ }
+ else {
+ if (buildingTemp_degC < heatingPreferences.getDayTimeSetPoint_degC()) {
+ // Daytime and building temperature too low
+ buildingHeatingDemand_kW = (heatingPreferences.getDayTimeSetPoint_degC() - buildingTemp_degC) * this.building.heatCapacity_JpK / 3.6e6 / gc.energyModel.p_timeStep_h;
+ }
+ else {
+ // Daytime and building temperature acceptable
+ }
+ }
+
+ heatingAssetPower_kW = min(heatingAsset.getOutputCapacity_kW(),buildingHeatingDemand_kW + heatDemand_kW); // minimum not strictly needed as asset will limit power by itself. Could be used later if we notice demand is higher than capacity of heating asset.
+ double heatIntoBuilding_kW = max(0, heatingAssetPower_kW - heatDemand_kW); // Will lead to energy(heat) imbalance when heatDemand_kW is larger than heating asset capacity.
+ building.f_updateAllFlows( heatIntoBuilding_kW / building.getCapacityHeat_kW() );
+ } else {
+ heatingAssetPower_kW = heatDemand_kW; // Will lead to energy(heat) imbalance when heatDemand_kW is larger than heating asset capacity.
+ }
+ heatingAsset.f_updateAllFlows( heatingAssetPower_kW / heatingAsset.getOutputCapacity_kW() );
+ }
+
+
+ public void initializeAssets() {
+ if (!validHeatingTypes.contains(this.currentHeatingType)) {
+ throw new RuntimeException(this.getClass() + " does not support heating type: " + this.currentHeatingType);
+ }
+ J_EAProduction ptAsset = findFirst(gc.c_productionAssets, ea -> ea.energyAssetType == OL_EnergyAssetType.PHOTOTHERMAL);
+ if (ptAsset != null) {
+ if(gc.p_DHWAsset == null) {
+ throw new RuntimeException(this.getClass() + " requires a hot water demand to make sense to use this heating management with PT.");
+ }
+ }
+ if (gc.p_heatBuffer != null) {
+ if(gc.p_DHWAsset == null && ptAsset == null) {
+ throw new RuntimeException(this.getClass() + " requires a hot water demand and PT to make sense to use this heating management with a heatbuffer.");
+ }
+ }
+ if(gc.p_BuildingThermalAsset != null) {
+ this.building = gc.p_BuildingThermalAsset;
+ if(this.heatingPreferences == null) {
+ heatingPreferences = new J_HeatingPreferences();
+ }
+ }
+ J_EAConsumption heatConsumption = findFirst(gc.c_consumptionAssets, x -> x.getEAType() == OL_EnergyAssetType.HEAT_DEMAND);
+ J_EAProfile heatProfile = findFirst(gc.c_profileAssets, x -> x.getEnergyCarrier() == OL_EnergyCarriers.HEAT);
+ if (heatProfile == null && heatConsumption == null && this.building == null) {
+ throw new RuntimeException(this.getClass() + " requires a heat demand asset.");
+ }
+ if (gc.c_heatingAssets.size() == 0) {
+ throw new RuntimeException(this.getClass() + " requires at least one heating asset.");
+ }
+ if (gc.c_heatingAssets.size() > 1) {
+ throw new RuntimeException(this.getClass() + " does not support more than one heating asset.");
+ }
+ this.heatingAsset = gc.c_heatingAssets.get(0);
+ if (heatingAsset instanceof J_EAConversionGasBurner) {
+ this.currentHeatingType = OL_GridConnectionHeatingType.GAS_BURNER;
+ } else if (heatingAsset instanceof J_EAConversionHeatPump) {
+ if (gc.p_parentNodeHeatID != null) {
+ this.currentHeatingType = OL_GridConnectionHeatingType.LT_DISTRICTHEAT;
+ } else {
+ this.currentHeatingType = OL_GridConnectionHeatingType.ELECTRIC_HEATPUMP;
+ }
+ } else if (heatingAsset instanceof J_EAConversionHeatDeliverySet) {
+ this.currentHeatingType = OL_GridConnectionHeatingType.DISTRICTHEAT;
+ } else if (heatingAsset instanceof J_EAConversionHydrogenBurner) {
+ this.currentHeatingType = OL_GridConnectionHeatingType.HYDROGENBURNER;
+ } else {
+ throw new RuntimeException(this.getClass() + " Unsupported heating asset!");
+ }
+
+ this.isInitialized = true;
+ }
+
+
+ public void notInitialized() {
+ this.isInitialized = false;
+ }
+
+ public List<OL_GridConnectionHeatingType> getValidHeatingTypes() {
+ return this.validHeatingTypes;
+ }
+
+ public OL_GridConnectionHeatingType getCurrentHeatingType() {
+ return this.currentHeatingType;
+ }
+
+ public void setHeatingPreferences(J_HeatingPreferences heatingPreferences) {
+ this.heatingPreferences = heatingPreferences;
+ }
+
+ public J_HeatingPreferences getHeatingPreferences() {
+ return this.heatingPreferences;
+ }
+
+
+
+ //Get parentagent
+ public Agent getParentAgent() {
+ return this.gc;
+ }
+
+ public void storeStatesAndReset() {
+ //Nothing to store/reset
+ }
+ public void restoreStates() {
+ //Nothing to store/reset
+ }
+
+ @Override
+ public String toString() {
+ return "HeatingManagement Simple with heating type: " + getCurrentHeatingType().toString();
+ }
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+}
+
+
+
+ 1754578019724
+ I_HeatingAsset
+ 1752677832758
+ public interface I_HeatingAsset
+{
+
+}
+
+
+ 1755154798365
+ I_ChargingManagement
+ 1762850586274
+
+import com.fasterxml.jackson.annotation.JsonTypeInfo;
+import com.fasterxml.jackson.annotation.JsonSubTypes;
+import com.fasterxml.jackson.annotation.JsonIdentityInfo;
+import com.fasterxml.jackson.annotation.ObjectIdGenerators;
+@JsonIdentityInfo(generator = ObjectIdGenerators.UUIDGenerator.class, property = "@id")
+
+@JsonTypeInfo(
+ use = JsonTypeInfo.Id.CLASS,
+ include = JsonTypeInfo.As.PROPERTY,
+ property = "type" // 👈 this will be the field name in your JSON
+ )
+
+public interface I_ChargingManagement extends I_AssetManagement
+{
+ void manageCharging();
+
+ OL_ChargingAttitude getCurrentChargingType();
+
+ void setV2GActive(boolean activateV2G);
+ boolean getV2GActive();
+}
+
+
+
+
+
+
+ 1755155286577
+ J_BatteryManagementSelfConsumption
+ 1762850659543
+ /**
+ * J_BatteryManagementSelfConsumption
+ */
+
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
+
+@JsonAutoDetect(
+ fieldVisibility = Visibility.ANY,
+ getterVisibility = Visibility.NONE,
+ isGetterVisibility = Visibility.NONE,
+ setterVisibility = Visibility.NONE,
+ creatorVisibility = Visibility.NONE
+)
+public class J_BatteryManagementSelfConsumption implements I_BatteryManagement {
+
+ private GridConnection gc;
+
+ /**
+ * Default constructor
+ */
+ public J_BatteryManagementSelfConsumption() {
+
+ }
+
+ public J_BatteryManagementSelfConsumption( GridConnection gc ) {
+ this.gc = gc;
+ }
+
+ /**
+ * One of the simplest battery algorithms.
+ * This algorithm tries to steer the GridConnection load towards 0.
+ * If there is overproduction and room in the battery it will charge.
+ * If there is more consumption than production it will discharge the battery to make up for the difference untill the battery is empty.
+ */
+ public void manageBattery() {
+ gc.p_batteryAsset.f_updateAllFlows( -gc.fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.ELECTRICITY) / gc.p_batteryAsset.getCapacityElectric_kW() );
+ }
+
+
+
+
+ //Get parentagent
+ public Agent getParentAgent() {
+ return this.gc;
+ }
+
+ //Store and reset states
+ public void storeStatesAndReset() {
+ //Nothing to store and reset
+ }
+ public void restoreStates() {
+ //Nothing to restore
+ }
+
+ @Override
+ public String toString() {
+ return super.toString();
+ }
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+
+}
+
+
+ 1755171209007
+ J_EAChargePoint
+ 1752677832758
+ /**
+ * J_EAChargePoint
+ */
+public class J_EAChargePoint extends zero_engine.J_EA implements Serializable {
+ public double discharged_kWh;
+ public double charged_kWh;
+ public double capacityElectric_kW;
+ public List<J_ChargingSession> chargeSessionList;
+ private boolean V1GCapable;
+ private boolean V2GCapable;
+ private boolean V2GActive = false;
+ private int nbSockets;
+ private int[] nextSessionIdxs;// = 0;
+
+ private J_ChargingSession[] currentChargingSessions;
+
+ private int currentNumberOfChargingSockets = 0; // Used for certain charging algorithms
+
+ // For filtered price
+ private double electricityPriceLowPassed_eurpkWh = 0.1;
+ private double priceFilterTimeScale_h = 5*24;
+
+ //
+ private double dischargedStored_kWh;
+ private double chargedStored_kWh;
+ private J_ChargingSession[] currentChargingSessionsStored;
+ private int[] nextSessionIdxsStored;
+
+ //Charging attitude
+ private OL_ChargingAttitude chargingAttitude = OL_ChargingAttitude.SIMPLE;
+
+ /**
+ * Default constructor
+ */
+ public J_EAChargePoint(Agent parentAgent, double electricCapacity_kW, double timestep_h, List<J_ChargingSession> chargeSessionList, boolean V1GCapable, boolean V2GCapable, int nbSockets) {
+ this.parentAgent = parentAgent;
+ this.capacityElectric_kW = electricCapacity_kW;
+ this.timestep_h = timestep_h;
+ this.chargeSessionList = chargeSessionList;
+ this.V1GCapable = V1GCapable;
+ this.V2GCapable = V2GCapable;
+ this.activeProductionEnergyCarriers.add(OL_EnergyCarriers.ELECTRICITY);
+ this.activeConsumptionEnergyCarriers.add(OL_EnergyCarriers.ELECTRICITY);
+ if(V2GCapable && this.V2GActive) {
+ this.assetFlowCategory = OL_AssetFlowCategories.V2GPower_kW;
+ } else {
+ this.assetFlowCategory = OL_AssetFlowCategories.evChargingPower_kW;
+ }
+ this.nbSockets = nbSockets;
+ this.currentChargingSessions = new J_ChargingSession[nbSockets];
+ this.nextSessionIdxs = new int[nbSockets];
+ this.registerEnergyAsset();
+ }
+
+ public void f_updateAllFlows( double t_h) {
+
+ double currentElectricityPriceConsumption_eurpkWh = ((GridConnection)parentAgent).energyModel.pp_dayAheadElectricityPricing_eurpMWh.getCurrentValue() * 0.001;
+ this.electricityPriceLowPassed_eurpkWh += (currentElectricityPriceConsumption_eurpkWh-electricityPriceLowPassed_eurpkWh) / (priceFilterTimeScale_h/timestep_h);
+
+ /*if (gridAwareMode) { // Add gridload-factor to current price
+ currentElectricityPriceConsumption_eurpkWh = currentElectricityPriceConsumption_eurpkWh + (max(0,((GridConnection)parentAgent).p_parentNodeElectric.v_currentLoad_kW/((GridConnection)parentAgent).p_parentNodeElectric.p_capacity_kW-0.5))*0.1;
+ if ( ((GridConnection)parentAgent).p_parentNodeElectric.v_currentLoad_kW/((GridConnection)parentAgent).p_parentNodeElectric.p_capacity_kW > 0.5) {
+ //traceln("Adding %s eurpkWh to charging price to prevent congestion", (((GridConnection)parentAgent).p_parentNodeElectric.v_currentLoad_kW/((GridConnection)parentAgent).p_parentNodeElectric.p_capacity_kW-0.5)*1);
+ }
+ }*/
+
+ // Check if V2G is activated and the charger is capable
+ boolean doV2G = this.V2GActive && this.V2GCapable;
+
+ // Update the J_ChargingSessions of the sockets
+ for (int i = 0; i<this.nbSockets; i++) {
+ this.manageSocket(i, t_h); // Should also 'remove' finished sessions.
+ }
+
+ // Calculate the power output of the sockets
+ double power_kW = 0.0;
+ currentNumberOfChargingSockets = 0;
+
+ for (int i = 0; i<this.nbSockets; i++) {
+ if (currentChargingSessions[i] != null && t_h >= currentChargingSessions[i].startTime_h) {
+ power_kW += this.operateChargerSocket(i, t_h, currentElectricityPriceConsumption_eurpkWh, doV2G);
+ discharged_kWh += min(0,-power_kW) * timestep_h;
+ charged_kWh += max(0,power_kW) * timestep_h;
+ currentNumberOfChargingSockets++;
+ }
+ }
+
+ // Call the regular J_EA updateAllFlows and operate
+ this.v_powerFraction_fr = power_kW / this.capacityElectric_kW;
+ super.f_updateAllFlows( );
+ return;
+ }
+
+ @Override
+ public void operate(double ratioOfCapacity) {
+
+ double charge_kW = ratioOfCapacity * capacityElectric_kW;
+
+ double electricityProduction_kW = max(-charge_kW, 0);
+ double electricityConsumption_kW = max(charge_kW, 0);
+
+ energyUse_kW = electricityConsumption_kW - electricityProduction_kW;
+ energyUsed_kWh += energyUse_kW * timestep_h;
+
+ flowsMap.put(OL_EnergyCarriers.ELECTRICITY, electricityConsumption_kW - electricityProduction_kW);
+ // Split charging and discharing power 'at the source'!
+
+ if (charge_kW > 0) { // charging
+ assetFlowsMap.put(OL_AssetFlowCategories.evChargingPower_kW, electricityConsumption_kW);
+ } else if(charge_kW < 0){
+ if(this.V2GCapable) { // && this.V2GActive) {
+ assetFlowsMap.put(OL_AssetFlowCategories.V2GPower_kW, electricityProduction_kW);
+ }
+ else {
+ traceln("Charge power in J_EAChargePoint negative: %s", charge_kW);
+ throw new RuntimeException("Trying to discharge into a charger, that does not have the capability or where v2g is not activated!");
+ }
+ }
+ }
+
+
+ private double operateChargerSocket(int socketNb, double t_h, double currentElectricityPriceConsumption_eurpkWh, boolean doV2G) {
+ double chargeSetpoint_kW = 0;
+ if(!this.V1GCapable) {
+ chargeSetpoint_kW = determineChargeSetpoint_simple_kW(socketNb);
+ }
+ else {
+ switch(this.chargingAttitude) {
+ case SIMPLE:
+ chargeSetpoint_kW = determineChargeSetpoint_simple_kW(socketNb);
+ break;
+ case PRICE:
+ chargeSetpoint_kW = determineChargeSetpoint_price_kW(socketNb, t_h, doV2G, currentElectricityPriceConsumption_eurpkWh);
+ break;
+ case BALANCE_LOCAL:
+ throw new RuntimeException("BALANCE LOCAL CHARGING STRATEGY HAS NOT BEEN CREATED YET FOR CHARGEPOINTS");
+ //chargeSetpoint_kW = determineChargeSetpoint_balanceLocal_kW(socketNb, t_h, doV2G);
+ case BALANCE_GRID:
+ chargeSetpoint_kW = determineChargeSetpoint_balanceGrid_kW(socketNb, t_h, doV2G);
+ break;
+ default:
+ throw new RuntimeException("UNSUPPORTED CHARGING ATTITUDE SELECTED FOR CHARGEPOINT");
+ }
+ }
+
+ return currentChargingSessions[socketNb].charge(chargeSetpoint_kW);
+ }
+
+
+ private double determineChargeSetpoint_simple_kW(int socketNb) {
+ double maxChargePower = capacityElectric_kW;//min(currentChargingSessions[socketNb].vehicleMaxChargingPower_kW, capacityElectric_kW);
+ double remainingChargeDemand_kWh = currentChargingSessions[socketNb].getRemainingChargeDemand_kWh(); // Can be negative if recharging is not needed for next trip!
+ double chargeSetpoint_kW = max(0, min(maxChargePower, remainingChargeDemand_kWh/timestep_h));
+
+ return chargeSetpoint_kW;
+ }
+
+ private double determineChargeSetpoint_price_kW(int socketNb, double t_h, boolean doV2G, double currentElectricityPriceConsumption_eurpkWh) {
+ double maxChargePower = capacityElectric_kW;//min(currentChargingSessions[socketNb].vehicleMaxChargingPower_kW, capacityElectric_kW);
+ double remainingChargeDemand_kWh = currentChargingSessions[socketNb].getRemainingChargeDemand_kWh(); // Can be negative if recharging is not needed for next trip!
+ double chargeSetpoint_kW = 0;
+
+ //traceln("Smart charging active at chargePoint");
+ double nextTripStartTime_h = currentChargingSessions[socketNb].endTime_h;
+ double chargeTimeMargin_h = 0.5; // Margin to be ready with charging before start of next trip
+ double chargeDeadline_h = nextTripStartTime_h - remainingChargeDemand_kWh / maxChargePower - chargeTimeMargin_h;
+ double remainingFlexTime_h = chargeDeadline_h - t_h; // measure of flexiblity left in current charging session.
+
+ if ( t_h >= chargeDeadline_h && remainingChargeDemand_kWh > 0) { // Must-charge time at max charging power
+ //traceln("Urgency charging on charge point GC: %s! May exceed connection capacity!", this.parentAgent);
+ chargeSetpoint_kW = min(maxChargePower, remainingChargeDemand_kWh/timestep_h);
+ } else {
+ double WTPoffset_eurpkW = 0.01; // Drops willingness to pay price for charging, combined with remainingFlexTime_h.
+ double WTPCharging_eurpkWh = electricityPriceLowPassed_eurpkWh - WTPoffset_eurpkW * remainingFlexTime_h; //+ urgencyGain_eurpkWh * ( max(0,maxSpreadChargingPower_kW) / ev.getCapacityElectric_kW() ); // Scale WTP based on flexibility expressed in terms of power-fraction
+ //WTPprice_eurpkWh = WTPoffset_eurpkWh + (main.v_epexNext24hours_eurpkWh+v_electricityPriceLowPassed_eurpkWh)/2 + flexibilityGain_eurpkWh * sqrt(maxSpreadChargingPower_kW/maxChargingPower_kW);
+ double priceGain_r = 0.5; // When WTP is higher than current electricity price, ramp up charging power with this gain based on the price-delta.
+ chargeSetpoint_kW = max(0, maxChargePower * min(1,(WTPCharging_eurpkWh / currentElectricityPriceConsumption_eurpkWh - 1) * priceGain_r)); // min(1,...) is needed to prevent devide by zero leading to infinity/NaN results.
+ if ( doV2G && remainingFlexTime_h > 1 && chargeSetpoint_kW == 0 ) { // Surpluss SOC and high energy price
+ //traceln("Conditions for V2G met in chargePoint");
+ double V2G_WTS_offset_eurpkWh = 0.02; // Price must be at least this amount above the moving average to decide to discharge EV battery.
+ double WTSV2G_eurpkWh = V2G_WTS_offset_eurpkWh + electricityPriceLowPassed_eurpkWh; // Can become zero!!
+ chargeSetpoint_kW = min(0, -maxChargePower * min(1,(currentElectricityPriceConsumption_eurpkWh / WTSV2G_eurpkWh - 1) * priceGain_r)); // min(1,...) is needed to prevent devide by zero leading to infinity/NaN results.
+ //if (chargeSetpoint_kW < 0) {traceln(" V2G Active! Power: " + chargeSetpoint_kW );}
+ }
+ }
+
+ return chargeSetpoint_kW;
+ }
+
+ private double determineChargeSetpoint_balanceLocal_kW(int socketNb, double t_h, boolean doV2G) {
+ // DOES NOT MAKE SENSE TO USE THIS FOR GCPUBLIC CHARGER, ONLY FOR GC THAT HAVE THEIR OWN CONSUMPTION -> WHICH SHOULD BE SUPPORTED EVENTUALLY
+ if( parentAgent instanceof GCPublicCharger) {
+ throw new RuntimeException("This strategy only works for GCs that have their own consumption, do not use this for GCPublicChargers");
+ }
+
+ //CREATE STRATEGY HERE
+ double chargeSetpoint_kW = 0;
+
+ return chargeSetpoint_kW;
+ }
+
+ private double determineChargeSetpoint_balanceGrid_kW(int socketNb, double t_h, boolean doV2G) {
+ double chargeSetpoint_kW = 0;
+ double maxChargePower = capacityElectric_kW;
+ double remainingChargeDemand_kWh = currentChargingSessions[socketNb].getRemainingChargeDemand_kWh(); // Can be negative if recharging is not needed for next trip!
+
+ GridNode parentNode = ((GridConnection)parentAgent).p_parentNodeElectric;
+ double currentBalanceOnGridNodeWithoutEV_kW = parentNode.v_currentLoad_kW - parentNode.v_currentChargingPower_kW;
+ double gridNodeLowPassedLoad_kW = parentNode.v_lowPassedLoadFilter_kW;
+
+ double nextTripStartTime_h = currentChargingSessions[socketNb].endTime_h;
+ double chargeTimeMargin_h = 0.5; // Margin to be ready with charging before start of next trip
+ double chargeDeadline_h = nextTripStartTime_h - remainingChargeDemand_kWh / maxChargePower - chargeTimeMargin_h;
+ double remainingFlexTime_h = chargeDeadline_h - t_h; // measure of flexiblity left in current charging session.
+ double remainingTimeToCharge = nextTripStartTime_h - t_h - chargeTimeMargin_h;
+
+ /*double avgPowerDemandTillTrip_kW = 0;
+ if(remainingTimeToCharge != 0) {
+ avgPowerDemandTillTrip_kW = remainingChargeDemand_kWh / (nextTripStartTime_h - t_h - chargeTimeMargin_h);
+ }
+ else if(remainingChargeDemand_kWh > 0) {
+ avgPowerDemandTillTrip_kW = min(maxChargePower, remainingChargeDemand_kWh/timestep_h);
+ }*/
+
+ if ( t_h >= chargeDeadline_h && remainingChargeDemand_kWh > 0) { // Must-charge time at max charging power
+ chargeSetpoint_kW = min(maxChargePower, remainingChargeDemand_kWh/timestep_h);
+ } else {
+ double flexGain_r_manual = 0.8;
+ double flexGain_r = 1/max(1, (double)parentNode.v_currentNumberOfChargingChargePoints) * flexGain_r_manual; // how strongly to 'follow' currentBalanceBeforeEV_kW -> influenced by the amount of charging chargers at this momment
+ chargeSetpoint_kW = max(0, currentChargingSessions[socketNb].avgPowerDemand_kW + (gridNodeLowPassedLoad_kW - currentBalanceOnGridNodeWithoutEV_kW) * (min(1,flexGain_r)));
+ if ( doV2G && remainingFlexTime_h > 1 && chargeSetpoint_kW == 0 ) { // Surpluss flexibility
+ chargeSetpoint_kW = min(0, currentChargingSessions[socketNb].avgPowerDemand_kW + (gridNodeLowPassedLoad_kW - currentBalanceOnGridNodeWithoutEV_kW) * (min(1,flexGain_r)));
+ }
+ }
+ return chargeSetpoint_kW;
+ }
+
+
+
+ private void manageSocket(int socketNb, double t_h) {
+ if (this.currentChargingSessions[socketNb] != null && t_h >= this.currentChargingSessions[socketNb].endTime_h) { // end session
+ if (this.currentChargingSessions[socketNb].getRemainingChargeDemand_kWh() > 0.001 ) { traceln("!!Chargesession ended but charge demand not fullfilled!! Remaining demand: %s kWh", this.currentChargingSessions[socketNb].getRemainingChargeDemand_kWh()); }
+ this.currentChargingSessions[socketNb] = null;
+ }
+
+
+ if ( this.currentChargingSessions[socketNb] == null ) { // socket currently free
+ // check if we are not already past the last charging session.
+ // Find next charging session on this socket
+
+ while (this.nextSessionIdxs[socketNb] < this.chargeSessionList.size() && this.chargeSessionList.get(this.nextSessionIdxs[socketNb]).socketNb != socketNb) {
+ this.nextSessionIdxs[socketNb]++;
+ }
+
+ if (this.nextSessionIdxs[socketNb] >= this.chargeSessionList.size()) { // no more sessions available
+ //traceln("Reached end of charging session list!");
+ return;
+ } else {
+ this.currentChargingSessions[socketNb] = this.chargeSessionList.get(this.nextSessionIdxs[socketNb]).getClone();
+
+ if (t_h > this.currentChargingSessions[socketNb].startTime_h) {
+ traceln("Chargesession %s started %s hours too late!", this.nextSessionIdxs[socketNb], t_h - this.currentChargingSessions[socketNb].startTime_h);
+ if (t_h >= this.currentChargingSessions[socketNb].endTime_h) {
+ traceln("!!Chargesession started after its endTime_h!! WTF?");
+ }
+ }
+ this.nextSessionIdxs[socketNb]++;
+ }
+ }
+ }
+
+
+ public void fastForwardCharingSessions(double t_h) {
+ for (int socketNb = 0; socketNb<this.nbSockets; socketNb++) {
+
+ //Clear current charging session
+ this.currentChargingSessions[socketNb] = null;
+
+ //Find next charging session that starts after the current time
+ while (this.nextSessionIdxs[socketNb] < this.chargeSessionList.size() && (this.chargeSessionList.get(this.nextSessionIdxs[socketNb]).socketNb != socketNb || this.chargeSessionList.get(this.nextSessionIdxs[socketNb]).startTime_h <= t_h)) {
+ this.nextSessionIdxs[socketNb]++;
+ }
+
+ if (this.nextSessionIdxs[socketNb] >= this.chargeSessionList.size()) { // no more sessions available
+ break;
+ } else { // Clone upcomming charger session and increase next session index
+ this.currentChargingSessions[socketNb] = this.chargeSessionList.get(this.nextSessionIdxs[socketNb]).getClone();
+ this.nextSessionIdxs[socketNb]++;
+ }
+ }
+ }
+
+
+ public void setV1GCapability(boolean V1GCapable) {
+ this.V1GCapable = V1GCapable;
+ }
+ public void setV2GCapability(boolean V2GCapable) {
+ this.V2GCapable = V2GCapable;
+ this.updateAssetFlowCategory();
+ }
+ public boolean getV1GCapable() {
+ return this.V1GCapable;
+
+ }
+ public boolean getV2GCapable() {
+ return this.V2GCapable;
+
+ }
+
+ public void setChargingAttitude(OL_ChargingAttitude chargingAttitude) {
+ this.chargingAttitude = chargingAttitude;
+ }
+
+ public OL_ChargingAttitude getChargingAttitude() {
+ return this.chargingAttitude;
+ }
+
+ public void setV2GActive(boolean activateV2G) {
+ this.V2GActive = activateV2G;
+ this.updateAssetFlowCategory();
+ }
+
+ public boolean getV2GActive() {
+ return this.V2GActive;
+ }
+
+ private void updateAssetFlowCategory() {
+ if(this.V2GCapable && this.V2GActive) {
+ this.assetFlowCategory = OL_AssetFlowCategories.V2GPower_kW;
+ }
+ else {
+ this.assetFlowCategory = OL_AssetFlowCategories.evChargingPower_kW;
+ }
+ }
+
+ public int getCurrentNumberOfChargingSockets() {
+ return this.currentNumberOfChargingSockets;
+ }
+
+ @Override
+ public void storeStatesAndReset() {
+ energyUsedStored_kWh = energyUsed_kWh;
+ energyUsed_kWh = 0.0;
+ dischargedStored_kWh = discharged_kWh;
+ discharged_kWh = 0.0;
+ chargedStored_kWh = charged_kWh;
+ charged_kWh = 0.0;
+
+ currentChargingSessionsStored = currentChargingSessions.clone();
+ Arrays.fill(currentChargingSessions, null);
+
+ nextSessionIdxsStored = nextSessionIdxs;
+ nextSessionIdxs = new int[nextSessionIdxsStored.length];
+
+ clear();
+ }
+
+ @Override
+ public void restoreStates() {
+ energyUsed_kWh = energyUsedStored_kWh;
+ discharged_kWh = dischargedStored_kWh;
+ charged_kWh = chargedStored_kWh;
+
+ currentChargingSessions = currentChargingSessionsStored;
+ nextSessionIdxs = nextSessionIdxsStored;
+ }
+
+
+ @Override
+ public String toString() {
+ return "Power: " + getLastFlows().get(OL_EnergyCarriers.ELECTRICITY) + " kW, capacity: " + capacityElectric_kW + " kW" +
+ ", Active charging attitude " + this.chargingAttitude +
+ ", Smart charging capable: " + this.V1GCapable +
+ ", V2G capable: " + this.V2GCapable +
+ ", V2G active: " + this.V2GActive;
+
+ }
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+
+}
+
+
+
+ 1755518393955
+ J_ChargingManagementMaxAvailablePower
+ 1762850586274
+ /**
+ * J_ChargingManagementMaxAvailablePower
+ */
+
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
+
+@JsonAutoDetect(
+ fieldVisibility = Visibility.ANY,
+ getterVisibility = Visibility.NONE,
+ isGetterVisibility = Visibility.NONE,
+ setterVisibility = Visibility.NONE,
+ creatorVisibility = Visibility.NONE
+)
+
+public class J_ChargingManagementMaxAvailablePower implements I_ChargingManagement {
+ private GridConnection gc;
+ private OL_ChargingAttitude activeChargingType = OL_ChargingAttitude.MAX_POWER;
+
+ private boolean V2GActive = false;
+ /**
+ * Default constructor
+ */
+ public J_ChargingManagementMaxAvailablePower() {
+ }
+
+ public J_ChargingManagementMaxAvailablePower( GridConnection gc ) {
+ this.gc = gc;
+ }
+
+ public OL_ChargingAttitude getCurrentChargingType() {
+ return activeChargingType;
+ }
+
+ public void manageCharging() {
+ double t_h = gc.energyModel.t_h;
+ double remainingChargingPower_kW = gc.v_liveConnectionMetaData.contractedDeliveryCapacity_kW - gc.fm_currentBalanceFlows_kW.get(ELECTRICITY);
+ if (gc.p_batteryAsset!=null) {
+ remainingChargingPower_kW += gc.p_batteryAsset.getCapacityAvailable_kW();
+ }
+ ArrayList<J_EAEV> copiedVehicleList = new ArrayList<J_EAEV>();
+ gc.c_electricVehicles.forEach(ev -> {if(ev.getAvailability() && ev.getCurrentStateOfCharge_fr()<1) { copiedVehicleList.add(ev);}}); // only vehicle that are available and not full
+ int countDeletedItems = 0;
+
+ // Sort vehicles by time until charge deadline
+ copiedVehicleList.sort((ev1, ev2) -> Double.compare(ev1.getChargeDeadline_h(), ev2.getChargeDeadline_h()));
+
+ for ( J_EAEV ev : copiedVehicleList){
+ //J_EAEV ev = copiedVehicleList.get(i);
+ if (ev.vehicleScaling != 0) {
+ double chargeNeedForNextTrip_kWh = max(0, ev.getEnergyNeedForNextTrip_kWh() - ev.getCurrentStateOfCharge_kWh());
+ //traceln("chargeNeedForNextTrip_kWh: " + chargeNeedForNextTrip_kWh);
+
+ double chargingSetpoint_kW;
+ if ( t_h >= ev.getChargeDeadline_h() && chargeNeedForNextTrip_kWh > 0) { // Must-charge time at max charging power
+ //traceln("Urgency charging! May exceed connection capacity!");
+ chargingSetpoint_kW = ev.getCapacityElectric_kW();
+ }
+ else {
+ chargingSetpoint_kW = remainingChargingPower_kW;
+ }
+
+ double chargingPower_kW = min(max(0,chargingSetpoint_kW), ev.getCapacityElectric_kW());
+ ev.f_updateAllFlows( chargingPower_kW / ev.getCapacityElectric_kW() );
+ remainingChargingPower_kW = max(0, remainingChargingPower_kW - chargingPower_kW); // Assumes the asset complies with the command!
+ }
+ }
+ }
+
+ public void setV2GActive(boolean activateV2G) {
+ this.V2GActive = activateV2G;
+ this.gc.c_electricVehicles.forEach(ev -> ev.setV2GActive(activateV2G)); // not really wanted but NEEDED TO HAVE EV ASSET IN CORRECT assetFlowCatagory
+ }
+
+ public boolean getV2GActive() {
+ return this.V2GActive;
+ }
+
+
+
+
+ //Get parentagent
+ public Agent getParentAgent() {
+ return this.gc;
+ }
+
+ //Store and reset states
+ public void storeStatesAndReset() {
+ //Nothing to store and reset
+ }
+ public void restoreStates() {
+ //Nothing to restore
+ }
+
+
+ @Override
+ public String toString() {
+ return "Active charging type: " + this.activeChargingType;
+
+ }
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+
+}
+
+
+ 1755521265097
+ J_ChargingManagementPrice
+ 1762850586274
+ /**
+ * J_ChargingManagementPrice
+ */
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
+
+@JsonAutoDetect(
+ fieldVisibility = Visibility.ANY,
+ getterVisibility = Visibility.NONE,
+ isGetterVisibility = Visibility.NONE,
+ setterVisibility = Visibility.NONE,
+ creatorVisibility = Visibility.NONE
+)
+public class J_ChargingManagementPrice implements I_ChargingManagement {
+
+ private GridConnection gc;
+ private OL_ChargingAttitude activeChargingType = OL_ChargingAttitude.PRICE;
+ private double initialValueElectricityPriceLowPassed_eurpkWh = 0.1;
+ private double electricityPriceLowPassed_eurpkWh = this.initialValueElectricityPriceLowPassed_eurpkWh;
+ private double priceFilterTimeScale_h = 5*24;
+ private double priceFilterDiffGain_r;
+
+ private boolean V2GActive = false;
+
+ //Stored
+ private double storedElectricityPriceLowPassed_eurpkWh;
+
+ /**
+ * Default constructor
+ */
+ public J_ChargingManagementPrice() {
+
+ }
+
+ public J_ChargingManagementPrice( GridConnection gc ) {
+ this.gc = gc;
+ this.priceFilterDiffGain_r = 1/(priceFilterTimeScale_h/gc.energyModel.p_timeStep_h);
+ }
+
+ public OL_ChargingAttitude getCurrentChargingType() {
+ return activeChargingType;
+ }
+ /**
+ * One of the simplest charging algorithms.
+ *
+ */
+ public void manageCharging() {
+ double t_h = gc.energyModel.t_h;
+ //double currentElectricityPriceConsumption_eurpkWh = gc.p_owner.f_getElectricityPrice(gc.v_liveConnectionMetaData.contractedDeliveryCapacity_kW);
+ double currentElectricityPriceConsumption_eurpkWh = gc.energyModel.pp_dayAheadElectricityPricing_eurpMWh.getCurrentValue() * 0.001;
+ electricityPriceLowPassed_eurpkWh += (currentElectricityPriceConsumption_eurpkWh-electricityPriceLowPassed_eurpkWh) * priceFilterDiffGain_r ;
+ /*// Little experiment, use current GC-load (so without EV charging!) as an equivalent price signal, and apply the same price-based smart charging and V2G algorithm.
+ GCdemandLowPassed_kW += (gc.fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.ELECTRICITY) - GCdemandLowPassed_kW) * priceFilterDiffGain_r;
+ electricityPriceLowPassed_eurpkWh = gc.fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.ELECTRICITY);
+ currentElectricityPriceConsumption_eurpkWh = gc.v_previousPowerElectricity_kW;
+ */
+ //traceln("Current price: %s eurpkWh, filtered price: %s eurpkWh", currentElectricityPriceConsumption_eurpkWh, electricityPriceLowPassed_eurpkWh);
+ for (J_EAEV ev : gc.c_electricVehicles) {
+ if (ev.available) {
+ double chargeNeedForNextTrip_kWh = ev.energyNeedForNextTrip_kWh - ev.getCurrentStateOfCharge_kWh(); // Can be negative if recharging is not needed for next trip!
+ double remainingFlexTime_h = ev.getChargeDeadline_h() - t_h; // measure of flexiblity left in current charging session.
+ double WTPoffset_eurpkW = 0.01; // Drops willingness to pay price for charging, combined with remainingFlexTime_h.
+ double chargeSetpoint_kW = 0;
+ if ( t_h >= (ev.getChargeDeadline_h()) && chargeNeedForNextTrip_kWh > 0) { // Must-charge time at max charging power
+ //traceln("Urgency charging in GC: %s! May exceed connection capacity!", gc.p_gridConnectionID));
+ chargeSetpoint_kW = ev.getCapacityElectric_kW();
+ } else {
+ double WTPCharging_eurpkWh = electricityPriceLowPassed_eurpkWh - WTPoffset_eurpkW * remainingFlexTime_h; //+ urgencyGain_eurpkWh * ( max(0,maxSpreadChargingPower_kW) / ev.getCapacityElectric_kW() ); // Scale WTP based on flexibility expressed in terms of power-fraction
+ //WTPprice_eurpkWh = WTPoffset_eurpkWh + (main.v_epexNext24hours_eurpkWh+v_electricityPriceLowPassed_eurpkWh)/2 + flexibilityGain_eurpkWh * sqrt(maxSpreadChargingPower_kW/maxChargingPower_kW);
+ double priceGain_r = 0.5; // When WTP is higher than current electricity price, ramp up charging power with this gain based on the price-delta.
+ chargeSetpoint_kW = max(0, ev.getCapacityElectric_kW() * (WTPCharging_eurpkWh / currentElectricityPriceConsumption_eurpkWh - 1) * priceGain_r);
+ //if ( chargeNeedForNextTrip_kWh < -ev.getCapacityElectric_kW()*gc.energyModel.p_timeStep_h && chargeSetpoint_kW == 0 ) { // Surpluss SOC and high energy price
+ if ( ev.getV2GActive() && remainingFlexTime_h > 1 && chargeSetpoint_kW == 0 ) { // Surpluss SOC and high energy price
+ double V2G_WTS_offset_eurpkWh = 0.02; // Price must be at least this amount above the moving average to decide to discharge EV battery.
+ double WTSV2G_eurpkWh = V2G_WTS_offset_eurpkWh + electricityPriceLowPassed_eurpkWh; // Scale WillingnessToSell based on flexibility expressed in terms of power-fraction
+ chargeSetpoint_kW = min(0, -ev.getCapacityElectric_kW() * (currentElectricityPriceConsumption_eurpkWh / WTSV2G_eurpkWh - 1) * priceGain_r);
+ //if (chargeSetpoint_kW < 0) {traceln(" V2G Active! Power: " + chargeSetpoint_kW );}
+ }
+ }
+ ev.f_updateAllFlows( chargeSetpoint_kW / ev.getCapacityElectric_kW() );
+ }
+ }
+ }
+
+ public void setV2GActive(boolean activateV2G) {
+ this.V2GActive = activateV2G;
+ this.gc.c_electricVehicles.forEach(ev -> ev.setV2GActive(activateV2G)); // not really wanted but NEEDED TO HAVE EV ASSET IN CORRECT assetFlowCatagory
+ }
+
+ public boolean getV2GActive() {
+ return this.V2GActive;
+ }
+
+
+
+
+ //Get parentagent
+ public Agent getParentAgent() {
+ return this.gc;
+ }
+
+
+ //Store and reset states
+ public void storeStatesAndReset() {
+ this.storedElectricityPriceLowPassed_eurpkWh = this.electricityPriceLowPassed_eurpkWh;
+ this.electricityPriceLowPassed_eurpkWh = this.initialValueElectricityPriceLowPassed_eurpkWh;
+ }
+ public void restoreStates() {
+ this.electricityPriceLowPassed_eurpkWh = this.storedElectricityPriceLowPassed_eurpkWh;
+ }
+
+
+ @Override
+ public String toString() {
+ return "Active charging type: " + this.activeChargingType;
+
+ }
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+
+}
+
+
+ 1755521425611
+ J_ChargingManagementLocalBalancing
+ 1762850586274
+ /**
+ * J_ChargingManagementLocalBalancing
+ */
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
+
+@JsonAutoDetect(
+ fieldVisibility = Visibility.ANY,
+ getterVisibility = Visibility.NONE,
+ isGetterVisibility = Visibility.NONE,
+ setterVisibility = Visibility.NONE,
+ creatorVisibility = Visibility.NONE
+)
+public class J_ChargingManagementLocalBalancing implements I_ChargingManagement {
+
+ private GridConnection gc;
+ private OL_ChargingAttitude activeChargingType = OL_ChargingAttitude.BALANCE_LOCAL;
+ private double filterTimeScale_h = 5*24;
+ private double filterDiffGain_r;
+ private double initialValueGCdemandLowPassed_kW = 0.5;
+ private double GCdemandLowPassed_kW = this.initialValueGCdemandLowPassed_kW;
+
+ private boolean V2GActive = false;
+
+ //Stored
+ private double storedGCdemandLowPassed_kW;
+ /**
+ * Default constructor
+ */
+ public J_ChargingManagementLocalBalancing() {
+
+ }
+
+ public J_ChargingManagementLocalBalancing( GridConnection gc ) {
+ this.gc = gc;
+ this.filterDiffGain_r = 1/(filterTimeScale_h/gc.energyModel.p_timeStep_h);
+ }
+
+ public OL_ChargingAttitude getCurrentChargingType() {
+ return activeChargingType;
+ }
+ /**
+ * One of the simplest charging algorithms.
+ *
+ */
+ public void manageCharging() {
+ double t_h = gc.energyModel.t_h;
+ // Use current GC-load (so without EV charging!) as an 'equivalent price' signal, and use EV battery flexibility to make local load flatter.
+ double currentBalanceBeforeEV_kW = gc.fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.ELECTRICITY);
+ GCdemandLowPassed_kW += (currentBalanceBeforeEV_kW - GCdemandLowPassed_kW) * filterDiffGain_r;
+
+ for (J_EAEV ev : gc.c_electricVehicles) {
+ if (ev.available) {
+ double chargeNeedForNextTrip_kWh = ev.energyNeedForNextTrip_kWh - ev.getCurrentStateOfCharge_kWh(); // Can be negative if recharging is not needed for next trip!
+ double remainingFlexTime_h = ev.getChargeDeadline_h() - t_h; // measure of flexiblity left in current charging session.
+ double avgPowerDemandTillTrip_kW = ev.energyNeedForNextTrip_kWh / (ev.tripTracker.v_idleTimeToNextTrip_min / 60);
+ double chargeSetpoint_kW = 0;
+ if ( t_h >= (ev.getChargeDeadline_h()) && chargeNeedForNextTrip_kWh > 0) { // Must-charge time at max charging power
+ //traceln("Urgency charging in GC: %s! May exceed connection capacity!", gc.p_gridConnectionID));
+ chargeSetpoint_kW = ev.getCapacityElectric_kW();
+ } else {
+ double flexGain_r = 0.5; // how strongly to 'follow' currentBalanceBeforeEV_kW
+ chargeSetpoint_kW = max(0, avgPowerDemandTillTrip_kW + (GCdemandLowPassed_kW - currentBalanceBeforeEV_kW) * (min(1,remainingFlexTime_h*flexGain_r)));
+ if ( ev.getV2GActive() && remainingFlexTime_h > 1 && chargeSetpoint_kW == 0 ) { // Surpluss flexibility
+ chargeSetpoint_kW = min(0, avgPowerDemandTillTrip_kW - (currentBalanceBeforeEV_kW - GCdemandLowPassed_kW) * (min(1,remainingFlexTime_h*flexGain_r)));
+ //if (chargeSetpoint_kW < 0) {traceln(" V2G Active! Power: " + chargeSetpoint_kW );}
+ }
+ }
+ ev.f_updateAllFlows( chargeSetpoint_kW / ev.getCapacityElectric_kW() );
+ }
+ }
+ }
+
+ public void setV2GActive(boolean activateV2G) {
+ this.V2GActive = activateV2G;
+ this.gc.c_electricVehicles.forEach(ev -> ev.setV2GActive(activateV2G)); // not really wanted but NEEDED TO HAVE EV ASSET IN CORRECT assetFlowCatagory
+ }
+
+ public boolean getV2GActive() {
+ return this.V2GActive;
+ }
+
+
+
+ //Get parentagent
+ public Agent getParentAgent() {
+ return this.gc;
+ }
+
+
+
+ //Store and reset states
+ public void storeStatesAndReset() {
+ this.storedGCdemandLowPassed_kW = this.GCdemandLowPassed_kW;
+ this.GCdemandLowPassed_kW = this.initialValueGCdemandLowPassed_kW;
+ }
+ public void restoreStates() {
+ this.GCdemandLowPassed_kW = this.storedGCdemandLowPassed_kW;
+ }
+
+ @Override
+ public String toString() {
+ return "Active charging type: " + this.activeChargingType;
+
+ }
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+
+}
+
+
+ 1756208281968
+ J_BatteryManagementExternalSetpoint
+ 1762850659543
+ /**
+ * J_BatteryManagementExternalSetpoint
+ */
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
+
+@JsonAutoDetect(
+ fieldVisibility = Visibility.ANY, //
+ getterVisibility = Visibility.NONE,
+ isGetterVisibility = Visibility.NONE,
+ setterVisibility = Visibility.NONE,
+ creatorVisibility = Visibility.NONE
+)
+
+public class J_BatteryManagementExternalSetpoint implements I_BatteryManagement {
+
+ GridConnection gc;
+ private double currentChargeSetpoint_kW = 0;
+ private double storedCurrentChargeSetpoint_kW;
+ /**
+ * Default constructor
+ */
+ public J_BatteryManagementExternalSetpoint( ) {
+
+ }
+
+ public J_BatteryManagementExternalSetpoint( GridConnection gc) {
+ this.gc = gc;
+ }
+
+ public double setChargeSetpoint_kW(double chargeSetpoint_kW) {
+ if (gc.p_batteryAsset!=null) {
+ this.currentChargeSetpoint_kW = max(min(chargeSetpoint_kW, gc.p_batteryAsset.getMaxChargePower_kW()), -gc.p_batteryAsset.getMaxDischargePower_kW());
+ } else {
+ this.currentChargeSetpoint_kW = 0.0;
+ }
+ return this.currentChargeSetpoint_kW;
+ }
+
+ public double getChargeSetpoint_kW() {
+ return this.currentChargeSetpoint_kW;
+ }
+
+ public void manageBattery() {
+
+ //Manage the battery with the set charge setpoint
+ gc.p_batteryAsset.f_updateAllFlows(this.currentChargeSetpoint_kW / gc.p_batteryAsset.getCapacityElectric_kW());
+
+ //Reset the value again.
+ this.currentChargeSetpoint_kW = 0;
+ }
+
+
+
+ //Get parentagent
+ public Agent getParentAgent() {
+ return this.gc;
+ }
+
+
+ //Store and reset states
+ public void storeStatesAndReset() {
+ this.storedCurrentChargeSetpoint_kW = currentChargeSetpoint_kW;
+ this.currentChargeSetpoint_kW = 0;
+ }
+ public void restoreStates() {
+ this.currentChargeSetpoint_kW = this.storedCurrentChargeSetpoint_kW;
+ }
+
+ @Override
+ public String toString() {
+ return "J_BatteryManagementExternalSetpoint with currentChargeSetpoint_kW " + this.currentChargeSetpoint_kW + " kW";
+ }
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+
+}
+
+
+ 1756210846035
+ I_AggregatorBatteryManagement
+ 1762850978631
+ import com.fasterxml.jackson.annotation.JsonTypeInfo;
+import com.fasterxml.jackson.annotation.JsonSubTypes;
+import com.fasterxml.jackson.annotation.JsonIdentityInfo;
+import com.fasterxml.jackson.annotation.ObjectIdGenerators;
+@JsonIdentityInfo(generator = ObjectIdGenerators.UUIDGenerator.class, property = "@id")
+
+@JsonTypeInfo(
+ use = JsonTypeInfo.Id.CLASS,
+ include = JsonTypeInfo.As.PROPERTY,
+ property = "type" // 👈 this will be the field name in your JSON 👈
+ )
+
+/**
+ * I_AggregatorBatteryManagement
+ */
+
+public interface I_AggregatorBatteryManagement extends I_AssetManagement
+{
+ void manageExternalSetpoints();
+}
+
+
+ 1756211095187
+ J_AggregatorBatteryManagementOff
+ 1762850978631
+
+/**
+ * J_AggregatorBatteryManagementOff
+ */
+
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
+
+@JsonAutoDetect(
+ fieldVisibility = Visibility.ANY, //
+ getterVisibility = Visibility.NONE,
+ isGetterVisibility = Visibility.NONE,
+ setterVisibility = Visibility.NONE,
+ creatorVisibility = Visibility.NONE
+)
+
+public class J_AggregatorBatteryManagementOff implements I_AggregatorBatteryManagement {
+
+ EnergyCoop energyCoop;
+
+ /**
+ * Default constructor
+ */
+ public J_AggregatorBatteryManagementOff( ) {
+
+ }
+
+ public J_AggregatorBatteryManagementOff( EnergyCoop energyCoop) {
+ this.energyCoop = energyCoop;
+ }
+
+ public void manageExternalSetpoints() {
+ //Do nothing
+ }
+
+
+
+ //Get parentagent
+ public Agent getParentAgent() {
+ return this.energyCoop;
+ }
+
+ //Store and reset states
+ public void storeStatesAndReset() {
+ //Nothing to store/reset
+ }
+ public void restoreStates() {
+ //Nothing to store/reset
+ }
+
+ @Override
+ public String toString() {
+ return super.toString();
+ }
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+
+}
+
+
+ 1756212442478
+ J_AggregatorBatteryManagementCollectiveSelfConsumption_batterySize
+ 1762850978631
+ /**
+ * J_AggregatorBatteryManagementCollectiveSelfConsumption_batterySize
+ */
+
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
+
+@JsonAutoDetect(
+ fieldVisibility = Visibility.ANY, //
+ getterVisibility = Visibility.NONE,
+ isGetterVisibility = Visibility.NONE,
+ setterVisibility = Visibility.NONE,
+ creatorVisibility = Visibility.NONE
+)
+
+public class J_AggregatorBatteryManagementCollectiveSelfConsumption_batterySize implements I_AggregatorBatteryManagement {
+
+ EnergyCoop energyCoop;
+
+ /**
+ * Default constructor
+ */
+ public J_AggregatorBatteryManagementCollectiveSelfConsumption_batterySize( ) {
+
+ }
+
+ public J_AggregatorBatteryManagementCollectiveSelfConsumption_batterySize( EnergyCoop energyCoop) {
+ this.energyCoop = energyCoop;
+ }
+
+ public void manageExternalSetpoints() {
+ //Get all members that have a battery that is put on the external setpoint mode
+ List<GridConnection> memberedGCWithSetpointBatteries = findAll(energyCoop.f_getMemberGridConnectionsCollectionPointer(), GC -> GC.p_batteryAsset != null && GC.f_getBatteryManagement() != null && GC.f_getBatteryManagement() instanceof J_BatteryManagementExternalSetpoint);
+
+ double collectiveChargeSetpoint_kW = 0;
+ double sumOfBatteryCapacities_kWh = 0;
+ for(GridConnection GC : energyCoop.f_getMemberGridConnectionsCollectionPointer()) {
+ double currentBatteryPowerElectric = 0;
+ if(memberedGCWithSetpointBatteries.contains(GC)) {
+ currentBatteryPowerElectric = GC.fm_currentAssetFlows_kW.get(OL_AssetFlowCategories.batteriesChargingPower_kW) - GC.fm_currentAssetFlows_kW.get(OL_AssetFlowCategories.batteriesDischargingPower_kW);
+
+ //Get total active usable battery capacity
+ sumOfBatteryCapacities_kWh += (GC.v_liveAssetsMetaData.totalInstalledBatteryStorageCapacity_MWh*1000);
+ }
+ collectiveChargeSetpoint_kW -= (GC.fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.ELECTRICITY) - currentBatteryPowerElectric);
+ }
+
+ // Generate setpoints and 'push' to memberGridConnections for next timestep
+ for(int i = 0; i<memberedGCWithSetpointBatteries.size(); i++) {
+ GridConnection GC = memberedGCWithSetpointBatteries.get(i);
+ if (GC.p_batteryAsset != null) {
+ ((J_BatteryManagementExternalSetpoint)GC.f_getBatteryManagement()).setChargeSetpoint_kW(collectiveChargeSetpoint_kW * ( GC.p_batteryAsset.getStorageCapacity_kWh() / sumOfBatteryCapacities_kWh)); // Divide summed charge-power proportional to battery size on each GC.
+ }
+ }
+ }
+
+
+ //Get parentagent
+ public Agent getParentAgent() {
+ return this.energyCoop;
+ }
+
+ //Store and reset states
+ public void storeStatesAndReset() {
+ //Nothing to store/reset
+ }
+ public void restoreStates() {
+ //Nothing to store/reset
+ }
+
+
+ @Override
+ public String toString() {
+ return super.toString();
+ }
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+
+}
+
+
+ 1756213000574
+ J_AggregatorBatteryManagementCollectiveSelfConsumption_exportRate
+ 1762850978631
+ /**
+ * J_AggregatorBatteryManagementCollectiveSelfConsumption_exportRate
+ */
+
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
+
+@JsonAutoDetect(
+ fieldVisibility = Visibility.ANY, //
+ getterVisibility = Visibility.NONE,
+ isGetterVisibility = Visibility.NONE,
+ setterVisibility = Visibility.NONE,
+ creatorVisibility = Visibility.NONE
+)
+
+public class J_AggregatorBatteryManagementCollectiveSelfConsumption_exportRate implements I_AggregatorBatteryManagement {
+
+ EnergyCoop energyCoop;
+
+ /**
+ * Default constructor
+ */
+ public J_AggregatorBatteryManagementCollectiveSelfConsumption_exportRate() {
+
+ }
+
+ public J_AggregatorBatteryManagementCollectiveSelfConsumption_exportRate( EnergyCoop energyCoop) {
+ this.energyCoop = energyCoop;
+ }
+
+ public void manageExternalSetpoints() {
+ //Get all members that have a battery that is put on the external setpoint mode
+ List<GridConnection> memberedGCWithSetpointBatteries = findAll(energyCoop.f_getMemberGridConnectionsCollectionPointer(), GC -> GC.p_batteryAsset != null && GC.f_getBatteryManagement() != null && GC.f_getBatteryManagement() instanceof J_BatteryManagementExternalSetpoint);
+
+ //Determine prefered charge setpoint of the battery, for maximum (collective) selfconsumption (equal to negative or positive balance)
+ double collectiveChargeSetpoint_kW = 0;
+ for(GridConnection GC : energyCoop.f_getMemberGridConnectionsCollectionPointer()) {
+ double currentBatteryPowerElectric = 0;
+ if(memberedGCWithSetpointBatteries.contains(GC)) {
+ currentBatteryPowerElectric = GC.fm_currentAssetFlows_kW.get(OL_AssetFlowCategories.batteriesChargingPower_kW) - GC.fm_currentAssetFlows_kW.get(OL_AssetFlowCategories.batteriesDischargingPower_kW);
+ }
+
+ collectiveChargeSetpoint_kW -= (GC.fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.ELECTRICITY) - currentBatteryPowerElectric);
+ }
+
+ //Initialize iterable gc list
+ List<GridConnection> memberedGCWithSetpointBatteries_withFreeCapacity = new ArrayList<GridConnection>();
+
+ //Only add the gc that have the same direction as net coop charge flow to the gc that will use their battery
+ for(GridConnection GC : memberedGCWithSetpointBatteries){
+
+ double currentBatteryPowerElectric = GC.fm_currentAssetFlows_kW.get(OL_AssetFlowCategories.batteriesChargingPower_kW) - GC.fm_currentAssetFlows_kW.get(OL_AssetFlowCategories.batteriesDischargingPower_kW);
+
+ double gc_balanceFlow = GC.fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.ELECTRICITY) - currentBatteryPowerElectric;
+ if((collectiveChargeSetpoint_kW < 0 && -gc_balanceFlow < 0) || (collectiveChargeSetpoint_kW > 0 && -gc_balanceFlow > 0)){
+ memberedGCWithSetpointBatteries_withFreeCapacity.add(GC);
+ }
+ }
+
+ //Initialize variables
+ double remainingSumOfChargeSetpoints_kW = collectiveChargeSetpoint_kW;
+ double gc_balanceFlowElectricity_kW;
+ double gc_calculatedChargeSetpoint_kW;
+ double gc_actualChargeSetpoint_kW;
+ List<GridConnection> memberedGCWithSetpointBatteries_noCapacity = new ArrayList<GridConnection>();
+
+ //Loop until no gc have battery capacity left or the setpoint is reached
+ while( Math.abs(remainingSumOfChargeSetpoints_kW) > 0.0001 && memberedGCWithSetpointBatteries_withFreeCapacity.size() > 0){
+ memberedGCWithSetpointBatteries_noCapacity.clear();
+ double removedSumOfChargedSetpoints_kW = 0;
+ double totalBalanceFlowRemainingGC_kW = 0;
+
+ //Calculate the new combined balance flow, to use for distributing the remaining chargeSetpoint
+ for(GridConnection GC : memberedGCWithSetpointBatteries_withFreeCapacity){
+ double currentBatteryPowerElectric = GC.fm_currentAssetFlows_kW.get(OL_AssetFlowCategories.batteriesChargingPower_kW) - GC.fm_currentAssetFlows_kW.get(OL_AssetFlowCategories.batteriesDischargingPower_kW);
+ totalBalanceFlowRemainingGC_kW += (GC.fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.ELECTRICITY) - currentBatteryPowerElectric);
+ }
+ if (Math.abs(totalBalanceFlowRemainingGC_kW) < 0.0001) {
+ traceln("Warning: totalBalanceFlowRemainingGC is zero, cant distribute any further, nr GC left: " + memberedGCWithSetpointBatteries_withFreeCapacity.size());
+ break;
+ }
+
+ //Iterate over the gc that still have space left in their charge capacity or battery storage
+ for(GridConnection GC : memberedGCWithSetpointBatteries_withFreeCapacity){
+ J_BatteryManagementExternalSetpoint gridConnectionBatteryAlgorithm = (J_BatteryManagementExternalSetpoint)GC.f_getBatteryManagement();
+ double currentBatteryPowerElectric = GC.fm_currentAssetFlows_kW.get(OL_AssetFlowCategories.batteriesChargingPower_kW) - GC.fm_currentAssetFlows_kW.get(OL_AssetFlowCategories.batteriesDischargingPower_kW);
+
+ gc_balanceFlowElectricity_kW = GC.fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.ELECTRICITY) - currentBatteryPowerElectric;
+ gc_calculatedChargeSetpoint_kW = gridConnectionBatteryAlgorithm.getChargeSetpoint_kW() + remainingSumOfChargeSetpoints_kW * ( gc_balanceFlowElectricity_kW / totalBalanceFlowRemainingGC_kW);
+
+ //First remove setpoint from previous iteration again
+ removedSumOfChargedSetpoints_kW -= gridConnectionBatteryAlgorithm.getChargeSetpoint_kW();
+
+ //Set and get new setpoint
+ gc_actualChargeSetpoint_kW = gridConnectionBatteryAlgorithm.setChargeSetpoint_kW(gc_calculatedChargeSetpoint_kW);
+
+ //Add new setpoint to removed setpiont total for this iteration again (netto this is increased by the additional amount compared to last iteration)
+ removedSumOfChargedSetpoints_kW += gc_actualChargeSetpoint_kW;
+
+ //If the actual setpoint that has been returned by the gc is not equal to the required setpoint, it means the gc cant charge/dis charge any further, so remove it from the pool
+ if(gc_calculatedChargeSetpoint_kW != gc_actualChargeSetpoint_kW){
+ memberedGCWithSetpointBatteries_noCapacity.add(GC);
+ }
+ }
+ //Update the remaining pool of GC and to be distributed setpoint_kW
+ memberedGCWithSetpointBatteries_withFreeCapacity.removeAll(memberedGCWithSetpointBatteries_noCapacity);
+ remainingSumOfChargeSetpoints_kW -= removedSumOfChargedSetpoints_kW;
+ }
+ }
+
+
+
+ //Get parentagent
+ public Agent getParentAgent() {
+ return this.energyCoop;
+ }
+
+ //Store and reset states
+ public void storeStatesAndReset() {
+ //Nothing to store/reset
+ }
+ public void restoreStates() {
+ //Nothing to store/reset
+ }
+
+
+ @Override
+ public String toString() {
+ return super.toString();
+ }
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+
+}
+
+
+
+
+ 1756213864971
+ J_AggregatorBatteryManagementCollectiveSelfConsumption_exportRateGH
+ 1762850978631
+ /**
+ * J_AggregatorBatteryManagementCollectiveSelfConsumption_exportRateGH
+ */
+
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
+
+@JsonAutoDetect(
+ fieldVisibility = Visibility.ANY, //
+ getterVisibility = Visibility.NONE,
+ isGetterVisibility = Visibility.NONE,
+ setterVisibility = Visibility.NONE,
+ creatorVisibility = Visibility.NONE
+)
+
+public class J_AggregatorBatteryManagementCollectiveSelfConsumption_exportRateGH implements I_AggregatorBatteryManagement {
+
+ EnergyCoop energyCoop;
+
+ /**
+ * Default constructor
+ */
+ public J_AggregatorBatteryManagementCollectiveSelfConsumption_exportRateGH() {
+
+ }
+
+ public J_AggregatorBatteryManagementCollectiveSelfConsumption_exportRateGH( EnergyCoop energyCoop) {
+ this.energyCoop = energyCoop;
+ }
+
+ public void manageExternalSetpoints() {
+ //Get all members that have a battery that is put on the external setpoint mode
+ List<GridConnection> memberedGCWithSetpointBatteries = findAll(energyCoop.f_getMemberGridConnectionsCollectionPointer(), GC -> GC.p_batteryAsset != null && GC.f_getBatteryManagement() != null && GC.f_getBatteryManagement() instanceof J_BatteryManagementExternalSetpoint);
+
+ //Determine prefered charge setpoint of the battery, for maximum (collective) selfconsumption (equal to negative or positive balance) and the total delivery and feedin
+ double collectiveChargeSetpoint_kW = 0;
+ double totalCurrentFeedin_kW = 0;
+ double totalCurrentDelivery_kW = 0;
+ double sumOfBatteryCapacities_kWh = 0;
+ for(GridConnection GC : energyCoop.f_getMemberGridConnectionsCollectionPointer()) {
+ double currentBatteryPowerElectric = 0;
+ if(memberedGCWithSetpointBatteries.contains(GC)) {
+ currentBatteryPowerElectric = GC.fm_currentAssetFlows_kW.get(OL_AssetFlowCategories.batteriesChargingPower_kW) - GC.fm_currentAssetFlows_kW.get(OL_AssetFlowCategories.batteriesDischargingPower_kW);
+
+ //Get total active usable battery capacity
+ sumOfBatteryCapacities_kWh += (GC.v_liveAssetsMetaData.totalInstalledBatteryStorageCapacity_MWh*1000);
+ }
+ collectiveChargeSetpoint_kW -= GC.fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.ELECTRICITY) - currentBatteryPowerElectric;
+ totalCurrentFeedin_kW+=max(0,-(GC.fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.ELECTRICITY) - currentBatteryPowerElectric));
+ totalCurrentDelivery_kW+=max(0,(GC.fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.ELECTRICITY) - currentBatteryPowerElectric));
+ }
+
+ // For all qualifying GCs, make balanceflow zero if possible. Also, distinguish between collective feedin and collective delivery
+ double remainingSumOfChargeSetpoints_kW = collectiveChargeSetpoint_kW;
+
+ // Divide setpoint proportional to feedin power per GC
+ for (GridConnection GC : memberedGCWithSetpointBatteries) {
+ double GC_Setpoint_kW=0;
+ if (collectiveChargeSetpoint_kW > 0) {
+ GC_Setpoint_kW = collectiveChargeSetpoint_kW * max(0,-GC.fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.ELECTRICITY))/totalCurrentFeedin_kW; // Divide summed charge-power proportional to feedin power on each GC.
+ } else if (collectiveChargeSetpoint_kW < 0){
+ GC_Setpoint_kW = collectiveChargeSetpoint_kW * max(0,GC.fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.ELECTRICITY))/totalCurrentDelivery_kW; // Divide summed charge-power proportional to delivery power on each GC.
+ }
+ remainingSumOfChargeSetpoints_kW -= ((J_BatteryManagementExternalSetpoint)GC.f_getBatteryManagement()).setChargeSetpoint_kW(GC_Setpoint_kW);
+ }
+
+ // If some of the batteries are full, try distribute remaining charge setpoint over all batteries, proportional to batterysize
+ if (Math.abs(remainingSumOfChargeSetpoints_kW) > 0.01) {
+ //traceln("Dividing positive charge power proportional to battery size");
+ double chargeSetpointToBeDevided_kW = remainingSumOfChargeSetpoints_kW;
+ for (GridConnection GC : memberedGCWithSetpointBatteries) {
+ double GC_addedSetpoint_kW = chargeSetpointToBeDevided_kW * ( GC.p_batteryAsset.getStorageCapacity_kWh() / sumOfBatteryCapacities_kWh); // Divide summed charge-power proportional to battery size on each GC.
+ double GC_currentSetpoint_kW = ((J_BatteryManagementExternalSetpoint)GC.f_getBatteryManagement()).getChargeSetpoint_kW();
+ remainingSumOfChargeSetpoints_kW -= (((J_BatteryManagementExternalSetpoint)GC.f_getBatteryManagement()).setChargeSetpoint_kW(GC_addedSetpoint_kW+GC_currentSetpoint_kW)-GC_currentSetpoint_kW);
+ }
+ }
+ }
+
+
+ //Get parentagent
+ public Agent getParentAgent() {
+ return this.energyCoop;
+ }
+
+ //Store and reset states
+ public void storeStatesAndReset() {
+ //Nothing to store/reset
+ }
+ public void restoreStates() {
+ //Nothing to store/reset
+ }
+
+
+ @Override
+ public String toString() {
+ return super.toString();
+ }
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+
+}
+
+
+
+ 1758192949084
+ J_ChargingManagementOffPeak
+ 1762850586274
+ /**
+ * J_ChargingManagementOffPeak
+ */
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
+
+@JsonAutoDetect(
+ fieldVisibility = Visibility.ANY,
+ getterVisibility = Visibility.NONE,
+ isGetterVisibility = Visibility.NONE,
+ setterVisibility = Visibility.NONE,
+ creatorVisibility = Visibility.NONE
+)
+public class J_ChargingManagementOffPeak implements I_ChargingManagement {
+
+ private GridConnection gc;
+ private OL_ChargingAttitude activeChargingType = OL_ChargingAttitude.BALANCE_GRID;
+ private double filterTimeScale_h = 5*24;
+ private double filterDiffGain_r;
+ private double initialValueGCdemandLowPassed_kW = 0.5;
+ private double GCdemandLowPassed_kW = this.initialValueGCdemandLowPassed_kW;
+
+ private double startTimeOfReducedChargingInterval_hr = 17; // Hour of the day
+ private double endTimeOfReducedChargingInterval_hr = 21; // Hour of the day
+
+ private boolean V2GActive = false;
+
+
+ //Stored
+ private double storedGCdemandLowPassed_kW;
+ /**
+ * Default constructor
+ */
+ public J_ChargingManagementOffPeak() {
+
+ }
+
+ public J_ChargingManagementOffPeak( GridConnection gc ) {
+ this.gc = gc;
+ this.filterDiffGain_r = 1/(filterTimeScale_h/gc.energyModel.p_timeStep_h);
+ }
+
+
+ public OL_ChargingAttitude getCurrentChargingType() {
+ return activeChargingType;
+ }
+ /**
+ * One of the simplest charging algorithms.
+ *
+ */
+ public void manageCharging() {
+ double t_h = gc.energyModel.t_h;
+ // Use current GC-load (so without EV charging!) as an 'equivalent price' signal, and use EV battery flexibility to make local load flatter.
+ double currentBalanceBeforeEV_kW = gc.fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.ELECTRICITY);
+ GCdemandLowPassed_kW += (currentBalanceBeforeEV_kW - GCdemandLowPassed_kW) * filterDiffGain_r;
+
+ //Determine if time is currently in reduced charging interval
+ double hourOfTheDay = t_h % 24;
+
+ double intervalLength_hr = (endTimeOfReducedChargingInterval_hr - startTimeOfReducedChargingInterval_hr + 24) % 24;
+ if(intervalLength_hr == 0) intervalLength_hr = 24; // (Start time == End time: for now defined as charge as little as possible all day.
+ double intervalEndTimeSinceModelStart_hr = t_h - ((t_h - startTimeOfReducedChargingInterval_hr + 24) % 24) + intervalLength_hr;
+ boolean timeIsInReducedChargingInterval = ((hourOfTheDay - startTimeOfReducedChargingInterval_hr + 24) % 24) < intervalLength_hr;
+
+ for (J_EAEV ev : gc.c_electricVehicles) {
+ if (ev.available) {
+ double chargeNeedForNextTrip_kWh = ev.energyNeedForNextTrip_kWh - ev.getCurrentStateOfCharge_kWh(); // Can be negative if recharging is not needed for next trip!
+ double chargeSetpoint_kW = 0;
+ if ( t_h >= (ev.getChargeDeadline_h()) && chargeNeedForNextTrip_kWh > 0) { // Must-charge time at max charging power
+ //traceln("Urgency charging in GC: %s! May exceed connection capacity!", gc.p_gridConnectionID));
+ chargeSetpoint_kW = ev.getCapacityElectric_kW();
+ } else {
+ if(timeIsInReducedChargingInterval && chargeNeedForNextTrip_kWh > 0) {
+ double chargeTimeMargin_h = 0.5; // Margin to be ready with charging before start of next trip
+ double timeBetweenEndOfIntervalAndNextTripStartTime_hr = max(0, ev.getNextTripStartTime_h() - intervalEndTimeSinceModelStart_hr - chargeTimeMargin_h);
+ double energyThatCanBeChargedAfterIntervalEnded_kWh = timeBetweenEndOfIntervalAndNextTripStartTime_hr * ev.getCapacityElectric_kW();
+ double energyThatNeedsToBeChargedDuringInterval_kWh = max(0, chargeNeedForNextTrip_kWh - energyThatCanBeChargedAfterIntervalEnded_kWh);
+
+ double avgPowerDemandTillEndOfInterval_kW = energyThatNeedsToBeChargedDuringInterval_kWh / (intervalEndTimeSinceModelStart_hr - t_h);
+ chargeSetpoint_kW = avgPowerDemandTillEndOfInterval_kW;
+ }
+ else { // Dom laden (??????) // Of max spread laden?
+ chargeSetpoint_kW = ev.getCapacityElectric_kW();
+ }
+ }
+ ev.f_updateAllFlows( chargeSetpoint_kW / ev.getCapacityElectric_kW() );
+ }
+ }
+ }
+
+ public void setStartTimeOfReducedChargingInterval_hr(double startTimeOfReducedChargingInterval_hr) {
+ this.startTimeOfReducedChargingInterval_hr = startTimeOfReducedChargingInterval_hr;
+ }
+
+ public void setEndTimeOfReducedChargingInterval_hr(double endTimeOfReducedChargingInterval_hr) {
+ this.endTimeOfReducedChargingInterval_hr = endTimeOfReducedChargingInterval_hr;
+ }
+
+ public double getStartTimeOfReducedChargingInterval_hr() {
+ return this.startTimeOfReducedChargingInterval_hr;
+ }
+
+ public double getEndTimeOfReducedChargingInterval_hr() {
+ return this.endTimeOfReducedChargingInterval_hr;
+ }
+
+ public void setV2GActive(boolean activateV2G) {
+ this.V2GActive = activateV2G;
+ this.gc.c_electricVehicles.forEach(ev -> ev.setV2GActive(activateV2G)); // not really wanted but NEEDED TO HAVE EV ASSET IN CORRECT assetFlowCatagory
+ }
+
+ public boolean getV2GActive() {
+ return this.V2GActive;
+ }
+
+
+
+ //Get parentagent
+ public Agent getParentAgent() {
+ return this.gc;
+ }
+
+
+ //Store and reset states
+ public void storeStatesAndReset() {
+ this.storedGCdemandLowPassed_kW = this.GCdemandLowPassed_kW;
+ this.GCdemandLowPassed_kW = this.initialValueGCdemandLowPassed_kW;
+ }
+ public void restoreStates() {
+ this.GCdemandLowPassed_kW = this.storedGCdemandLowPassed_kW;
+ }
+
+ @Override
+ public String toString() {
+ return "Active charging type: " + this.activeChargingType;
+ }
+
+ /**
+ * This number is here for model snapshot storing purpose<br>
+ * It needs to be changed when this class gets changed
+ */
+ private static final long serialVersionUID = 1L;
+
+}
+
+
+ 1760367525817
+ J_HeatingManagementPIcontrol
+ 1762850578079
+
+/**
+ * J_HeatingManagementPIcontrol
+ */
+
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
+
+@JsonAutoDetect(
+ fieldVisibility = Visibility.ANY, //
+ getterVisibility = Visibility.NONE,
+ isGetterVisibility = Visibility.NONE,
+ setterVisibility = Visibility.NONE,
+ creatorVisibility = Visibility.NONE
+)
+
+public class J_HeatingManagementPIcontrol implements I_HeatingManagement {
+ private boolean isInitialized = false;
+ private GridConnection gc;
+ private List<OL_GridConnectionHeatingType> validHeatingTypes = Arrays.asList(
+ OL_GridConnectionHeatingType.GAS_BURNER,
+ OL_GridConnectionHeatingType.ELECTRIC_HEATPUMP,
+ OL_GridConnectionHeatingType.HYDROGENBURNER,
+ OL_GridConnectionHeatingType.DISTRICTHEAT,
+ OL_GridConnectionHeatingType.LT_DISTRICTHEAT
+ );
+ private OL_GridConnectionHeatingType currentHeatingType;
+
+ private J_EABuilding building;
+ private J_EAConversion heatingAsset;
+ private J_HeatingPreferences heatingPreferences;
+
+ // PI control gains
+ private double P_gain_kWpDegC = 1*1;
+ private double I_gain_kWphDegC = 0.1*2;
+ private double I_state_hDegC = 0;
+ private double timeStep_h;
+
+ //Temperature setpoint low pass filter
+ private double filteredCurrentSetpoint_degC;
+ private double setpointFilterTimeScale_h = 2.0; // Smooth in X hours
+
+ //Stored parameters
+ private double storedI_state_hDegC;
+ private double storedFilteredCurrentSetpoint_degC;
+ /**
+ * Default constructor
+ */
+ public J_HeatingManagementPIcontrol() {
+ }
+
+ public J_HeatingManagementPIcontrol( GridConnection gc,OL_GridConnectionHeatingType heatingType) {
+ this.gc = gc;
+ this.currentHeatingType = heatingType;
+ this.timeStep_h = gc.energyModel.p_timeStep_h;
+ }
+
+ public void manageHeating() {
+ if ( !isInitialized ) {
+ this.initializeAssets();
+ }
+
+ double hotWaterDemand_kW = gc.p_DHWAsset != null ? gc.p_DHWAsset.getLastFlows().get(OL_EnergyCarriers.HEAT) : 0;
+
+ //Adjust the hot water and overall heat demand with the buffer and pt
+ double remainingHotWaterDemand_kW = managePTAndHotWaterHeatBuffer(hotWaterDemand_kW);
+
+ double otherHeatDemand_kW = gc.fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.HEAT);
+
+ double buildingTemp_degC = building.getCurrentTemperature();
+ double timeOfDay_h = gc.energyModel.t_hourOfDay;
+ double buildingHeatingDemand_kW = 0;
+
+ double currentSetpoint_degC = heatingPreferences.getDayTimeSetPoint_degC();
+ if (timeOfDay_h < heatingPreferences.getStartOfDayTime_h() || timeOfDay_h >= heatingPreferences.getStartOfNightTime_h()) {
+ currentSetpoint_degC = heatingPreferences.getNightTimeSetPoint_degC();
+ }
+
+ //Smooth the setpoint signal
+ this.filteredCurrentSetpoint_degC += 1/(this.setpointFilterTimeScale_h / this.timeStep_h) * (currentSetpoint_degC - this.filteredCurrentSetpoint_degC);
+
+
+ double deltaT_degC = this.filteredCurrentSetpoint_degC - building.getCurrentTemperature(); // Positive deltaT when heating is needed
+
+ I_state_hDegC = max(0,I_state_hDegC + deltaT_degC * timeStep_h); // max(0,...) to prevent buildup of negative integrator during warm periods.
+ buildingHeatingDemand_kW = max(0,deltaT_degC * P_gain_kWpDegC + I_state_hDegC * I_gain_kWphDegC);
+
+
+ double assetPower_kW = min(heatingAsset.getOutputCapacity_kW(),buildingHeatingDemand_kW + otherHeatDemand_kW); // minimum not strictly needed as asset will limit power by itself. Could be used later if we notice demand is higher than capacity of heating asset.
+ heatingAsset.f_updateAllFlows( assetPower_kW / heatingAsset.getOutputCapacity_kW() );
+
+ double heatIntoBuilding_kW = max(0, assetPower_kW - otherHeatDemand_kW);
+ building.f_updateAllFlows( heatIntoBuilding_kW / building.getCapacityHeat_kW() );
+
+ }
+
+ private double managePTAndHotWaterHeatBuffer(double hotWaterDemand_kW){
+
+ //Calculate the pt production
+ double ptProduction_kW = 0;
+ List<J_EAProduction> ptAssets = findAll(gc.c_productionAssets, ea -> ea.energyAssetType == OL_EnergyAssetType.PHOTOTHERMAL);
+ for (J_EA j_ea : ptAssets) {
+ ptProduction_kW -= j_ea.getLastFlows().get(OL_EnergyCarriers.HEAT);
+ }
+
+ //Calculate the remaining hot water energy need after pt production, also calculate the remaining unused pt production
+ double remainingHotWater_kW = max(0, hotWaterDemand_kW - ptProduction_kW); // Need to do this, because pt has already compensated the hot water demand in the gc flows, so just need to update this value
+ double remainingPTProduction_kW = max(0, ptProduction_kW - hotWaterDemand_kW);
+
+ if(gc.p_heatBuffer != null){
+ double chargeSetpoint_kW = 0;
+ if(remainingHotWater_kW > 0) {
+ chargeSetpoint_kW = -remainingHotWater_kW;
+ }
+ else if(remainingPTProduction_kW > 0) {
+ chargeSetpoint_kW = remainingPTProduction_kW;
+ }
+ gc.p_heatBuffer.v_powerFraction_fr = chargeSetpoint_kW / gc.p_heatBuffer.getCapacityHeat_kW();
+ gc.p_heatBuffer.f_updateAllFlows(gc.p_heatBuffer.v_powerFraction_fr);
+
+ double heatBufferCharge_kW = gc.p_heatBuffer.getLastFlows().get(OL_EnergyCarriers.HEAT);
+
+ if(remainingHotWater_kW > 0){//Only if the current pt production, wasnt enough, adjust the hotwater demand with the buffer, cause then the buffer will have tried to discharge
+ remainingHotWater_kW = max(0, remainingHotWater_kW + heatBufferCharge_kW);
+ }
+ else {//Curtail the remaining pt that is not used for hot water
+ remainingPTProduction_kW = max(0, remainingPTProduction_kW - heatBufferCharge_kW);
+ if (remainingPTProduction_kW > 0) {//Heat (for now always curtail over produced heat!)
+ for (J_EAProduction j_ea : ptAssets) {
+ remainingPTProduction_kW -= j_ea.curtailEnergyCarrierProduction( OL_EnergyCarriers.HEAT, remainingPTProduction_kW);
+
+ if (remainingPTProduction_kW <= 0) {
+ break;
+ }
+ }
+ }
+ }
+ }
+ return remainingHotWater_kW;
+ }
+
+ public void initializeAssets() {
+ if (!validHeatingTypes.contains(this.currentHeatingType)) {
+ throw new RuntimeException(this.getClass() + " does not support heating type: " + this.currentHeatingType);
+ }
+ J_EAProduction ptAsset = findFirst(gc.c_productionAssets, ea -> ea.energyAssetType == OL_EnergyAssetType.PHOTOTHERMAL);
+ if (ptAsset != null) {
+ if(gc.p_DHWAsset == null) {
+ throw new RuntimeException(this.getClass() + " requires a hot water demand to make sense to use this heating management with PT.");
+ }
+ }
+ if (gc.p_heatBuffer != null) {
+ if(gc.p_DHWAsset == null && ptAsset == null) {
+ throw new RuntimeException(this.getClass() + " requires a hot water demand and PT to make sense to use this heating management with a heatbuffer.");
+ }
+ }
+ if(gc.p_BuildingThermalAsset != null) {
+ this.building = gc.p_BuildingThermalAsset;
+ } else {
+ throw new RuntimeException(this.getClass() + " can only be used for temperature control of a building thermal asset.");
+ }
+ if (gc.c_heatingAssets.size() == 0) {
+ throw new RuntimeException(this.getClass() + " requires at least one heating asset.");
+ }
+ if (gc.c_heatingAssets.size() > 1) {
+ throw new RuntimeException(this.getClass() + " does not support more than one heating asset.");
+ }
+ this.heatingAsset = gc.c_heatingAssets.get(0);
+ if (heatingAsset instanceof J_EAConversionGasBurner) {
+ this.currentHeatingType = OL_GridConnectionHeatingType.GAS_BURNER;
+ } else if (heatingAsset instanceof J_EAConversionHeatPump) {
+ if (gc.p_parentNodeHeatID != null) {
+ this.currentHeatingType = OL_GridConnectionHeatingType.LT_DISTRICTHEAT;
+ } else {
+ this.currentHeatingType = OL_GridConnectionHeatingType.ELECTRIC_HEATPUMP;
+ }
+ } else if (heatingAsset instanceof J_EAConversionHeatDeliverySet) {
+ this.currentHeatingType = OL_GridConnectionHeatingType.DISTRICTHEAT;
+ } else if (heatingAsset instanceof J_EAConversionHydrogenBurner) {
+ this.currentHeatingType = OL_GridConnectionHeatingType.HYDROGENBURNER;
+ } else {
+ throw new RuntimeException(this.getClass() + " Unsupported heating asset!");
+ }
+ if(this.heatingPreferences == null) {
+ heatingPreferences = new J_HeatingPreferences();
+ }
+ this.filteredCurrentSetpoint_degC = heatingPreferences.getMinComfortTemperature_degC();
+ this.isInitialized = true;
+ }
+
+ public void notInitialized() {
+ this.isInitialized = false;
+ }
+
+ public List<OL_GridConnectionHeatingType> getValidHeatingTypes() {
+ return this.validHeatingTypes;
+ }
+
+ public OL_GridConnectionHeatingType getCurrentHeatingType() {
+ return this.currentHeatingType;
+ }
+
+ public void setHeatingPreferences(J_HeatingPreferences heatingPreferences) {
+ this.heatingPreferences = heatingPreferences;
+ }
+
+ public J_HeatingPreferences getHeatingPreferences() {
+ return this.heatingPreferences;
+ }
+
+
+
+ //Get parentagent
+ public Agent getParentAgent() {
+ return this.gc;
+ }
+
+
+ //Store and reset states
+ public void storeStatesAndReset() {
+ this.storedI_state_hDegC = this.I_state_hDegC;
+ this.storedFilteredCurrentSetpoint_degC = this.filteredCurrentSetpoint_degC;
+ this.I_state_hDegC = 0;
+ this.filteredCurrentSetpoint_degC = 0;
+ }
+ public void restoreStates() {
+ this.I_state_hDegC = this.storedI_state_hDegC;
+ this.filteredCurrentSetpoint_degC = this.storedFilteredCurrentSetpoint_degC;
+ }
+
+ @Override
+ public String toString() {
+ return super.toString();
+ }
+
+}
+
+
+ 1760603137612
+ J_HeatingManagementHeatpumpOffPeak
+ 1762850578079
+ /**
+ * J_HeatingManagementHeatpumpOffPeak
+ */
+
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
+
+@JsonAutoDetect(
+ fieldVisibility = Visibility.ANY, //
+ getterVisibility = Visibility.NONE,
+ isGetterVisibility = Visibility.NONE,
+ setterVisibility = Visibility.NONE,
+ creatorVisibility = Visibility.NONE
+)
+
+public class J_HeatingManagementHeatpumpOffPeak implements I_HeatingManagement {
+ private boolean isInitialized = false;
+ private GridConnection gc;
+ private List<OL_GridConnectionHeatingType> validHeatingTypes = Arrays.asList(
+ OL_GridConnectionHeatingType.ELECTRIC_HEATPUMP
+ );
+ private OL_GridConnectionHeatingType currentHeatingType;
+
+ private J_EABuilding building;
+ private J_EAConversion heatingAsset;
+ private J_HeatingPreferences heatingPreferences;
+
+ // PI control gains
+ private double P_gain_kWpDegC = 1*1;
+ private double I_gain_kWphDegC = 0.1*2;
+ private double I_state_hDegC = 0;
+ private double timeStep_h;
+
+ //Temperature setpoint low pass filter
+ private double filteredCurrentSetpoint_degC;
+ private double setpointFilterTimeScale_h = 2.0; // Smooth in X hours
+
+ //Off peak management
+ private double preHeatDuration_hr = 2; // Amount of hours that the heatpump has to reach the requiredTemperatureAtStartOfReducedHeatingInterval_degC
+ private double requiredTemperatureAtStartOfReducedHeatingInterval_degC = 20; // Temperature setpoint in degrees Celsius that the heatpump will have in the preheatduration time
+ private double startTimeOfReducedHeatingInterval_hr = 16; // Hour of the day
+ private double endTimeOfReducedHeatingInterval_hr = 21; // Hour of the day -> CAN NOT BE THE SAME AS THE START TIME
+ private double reducedHeatingIntervalLength_hr = (endTimeOfReducedHeatingInterval_hr - startTimeOfReducedHeatingInterval_hr + 24) % 24;
+
+
+ //Stored
+ private double storedI_state_hDegC;
+ private double storedFilteredCurrentSetpoint_degC;
+ private double storedrequiredTemperatureAtStartOfReducedHeatingInterval_degC;
+
+ /**
+ * Default constructor
+ */
+ public J_HeatingManagementHeatpumpOffPeak() {
+ }
+
+ public J_HeatingManagementHeatpumpOffPeak( GridConnection gc, OL_GridConnectionHeatingType heatingType) {
+ this.gc = gc;
+ this.currentHeatingType = heatingType;
+ this.timeStep_h = gc.energyModel.p_timeStep_h;
+ }
+
+
+ public void manageHeating() {
+ if ( !isInitialized ) {
+ this.initializeAssets();
+ calculatePreHeatParameters();
+ }
+ double t_h = gc.energyModel.t_h;
+ double timeOfDay_h = gc.energyModel.t_hourOfDay;
+
+ //Calculate preheat paramters for the next reduced heating interval
+ if(timeOfDay_h == endTimeOfReducedHeatingInterval_hr) {
+ calculatePreHeatParameters();
+ }
+
+ //Adjust the hot water and overall heat demand with the buffer and pt
+ double hotWaterDemand_kW = gc.p_DHWAsset != null ? gc.p_DHWAsset.getLastFlows().get(OL_EnergyCarriers.HEAT) : 0;
+ double remainingHotWaterDemand_kW = managePTAndHotWaterHeatBuffer(hotWaterDemand_kW);
+
+ //Get the remaining heat demand (hot water, and potential other profiles)
+ double otherHeatDemand_kW = gc.fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.HEAT);
+
+ //Determine if time is in reduced Heating interval
+ boolean timeIsInReducedHeatingInterval = ((timeOfDay_h - startTimeOfReducedHeatingInterval_hr + 24) % 24) < reducedHeatingIntervalLength_hr;
+ boolean timeIsInPreheatInterval = ((timeOfDay_h - (startTimeOfReducedHeatingInterval_hr - preHeatDuration_hr) + 24) % 24) < preHeatDuration_hr;
+
+ double startTimePreheatTime_hr = startTimeOfReducedHeatingInterval_hr - preHeatDuration_hr;
+
+ //Get the current temperature setpoint dependend on day/night time and noheat/preheat interval settings
+ double currentSetpoint_degC = heatingPreferences.getDayTimeSetPoint_degC();
+ if(timeIsInPreheatInterval) { // During preheat interval, raise the setpoint temperature step by step, to prevent overreaction by the controller
+ currentSetpoint_degC = this.requiredTemperatureAtStartOfReducedHeatingInterval_degC;
+ }
+ else if(timeIsInReducedHeatingInterval) {
+ currentSetpoint_degC = heatingPreferences.getMinComfortTemperature_degC(); // -> prevents fast response during interval if min comfort is breached
+ if(startTimeOfReducedHeatingInterval_hr == timeOfDay_h) {
+ I_state_hDegC = 0; //Reset I state at the start of no heating interval to reset the controller, so no heating power at all.
+ this.filteredCurrentSetpoint_degC = heatingPreferences.getMinComfortTemperature_degC();
+ }
+ }
+ else if (timeOfDay_h < heatingPreferences.getStartOfDayTime_h() || timeOfDay_h >= heatingPreferences.getStartOfNightTime_h()) {
+ currentSetpoint_degC = heatingPreferences.getNightTimeSetPoint_degC();
+ }
+
+
+ //Smooth the setpoint signal
+ this.filteredCurrentSetpoint_degC += 1/(this.setpointFilterTimeScale_h / this.timeStep_h) * (currentSetpoint_degC - this.filteredCurrentSetpoint_degC);
+
+ //Calculate the deltaT_degc
+ double deltaT_degC = this.filteredCurrentSetpoint_degC - building.getCurrentTemperature(); // Positive deltaT when heating is needed
+
+ //PI control
+ I_state_hDegC = max(0,I_state_hDegC + deltaT_degC * timeStep_h); // max(0,...) to prevent buildup of negative integrator during warm periods.
+ double buildingHeatingDemand_kW = max(0,deltaT_degC * P_gain_kWpDegC + I_state_hDegC * I_gain_kWphDegC);
+
+ //Set asset power
+ double assetPower_kW = min(heatingAsset.getOutputCapacity_kW(), buildingHeatingDemand_kW + otherHeatDemand_kW); // minimum not strictly needed as asset will limit power by itself. Could be used later if we notice demand is higher than capacity of heating asset.
+ heatingAsset.f_updateAllFlows( assetPower_kW / heatingAsset.getOutputCapacity_kW() );
+
+ //Set building power (other heat demand gets bias if asset does not have enough capacity)
+ double heatIntoBuilding_kW = max(0, assetPower_kW - otherHeatDemand_kW);
+ building.f_updateAllFlows( heatIntoBuilding_kW / building.getCapacityHeat_kW() );
+ }
+
+ private void calculatePreHeatParameters() {
+ double energyModel_time_h = gc.energyModel.t_h;
+ double p_timestep_h = gc.energyModel.p_timeStep_h;
+ J_ProfilePointer ambientTemperatureProfilePointer = gc.energyModel.pp_ambientTemperature_degC;
+
+ int intervalLength_timeSteps = roundToInt(this.reducedHeatingIntervalLength_hr / p_timestep_h) + 1; // + 1 to account for time step delay in losses
+
+ double[] ambientTemperatureDuringInterval_degC = new double[intervalLength_timeSteps];
+
+ double nextIntervalStart_t_h = energyModel_time_h - ((energyModel_time_h - startTimeOfReducedHeatingInterval_hr + 24) % 24);
+ if (nextIntervalStart_t_h < energyModel_time_h) {
+ nextIntervalStart_t_h += 24.0; // move to next day if already passed
+ }
+
+ // Get the ambient temperature profile for the interval
+ for (int i = 0; i < intervalLength_timeSteps; i++) {
+ double time = nextIntervalStart_t_h + i * p_timestep_h;
+ ambientTemperatureDuringInterval_degC[i] = ambientTemperatureProfilePointer.getValue(time);
+ }
+
+ // Get the building thermal properties and convert into the same units
+ double lossFactorPerTimeStep_kWhpK = this.building.getLossFactor_WpK()/1000.0 * p_timestep_h;
+ double buildingHeatCapacity_kWhpK = this.building.getHeatCapacity_JpK()/(3.6e6);
+
+ // Start calculation from the known comfort temperature that the building should minimally be at the end of the reduced heating interval
+ //-> what if ends in nighttime, should this be influenced? Complexer to make, as during the time the interval is within daytime it should also not breach the min comfort.
+ //-> For now, just taken the min comfort temperature.
+ double indoorTemperature_degC = this.heatingPreferences.getMinComfortTemperature_degC();
+
+ //Loop over temperature in reverse order and find the required building temperature at start of each timestep, so at the end of interval the minComfortTemperature is reached
+ for (int i = intervalLength_timeSteps - 1; i >= 0; i--) {
+
+ //Calculate how much the temperature will drop in this timestep (What about sun? -> neglect for now)
+ double deltaT_degC = (indoorTemperature_degC - ambientTemperatureDuringInterval_degC[i])*lossFactorPerTimeStep_kWhpK / buildingHeatCapacity_kWhpK;
+ //Note: Loop is in reverse direction, so we add the deltaT instead of subtract, as we want to find the required indoor temperature at start of interval
+ indoorTemperature_degC += deltaT_degC;
+ }
+
+ //The found indoor temperature is now equal to the required indoor temperature at the start of the no/reduced heating interval.
+
+ if(indoorTemperature_degC > this.heatingPreferences.getMaxComfortTemperature_degC()) { // Check if max comfort temperature is not breached if so, limit temperature to the max comfort temperature
+ traceln("Warning, the building is not isolated properly for the heatpump off peak heat strategy to comply to the comfort settings without turning on the heating asset at all");
+ this.requiredTemperatureAtStartOfReducedHeatingInterval_degC = this.heatingPreferences.getMaxComfortTemperature_degC();
+ }
+ else {
+ this.requiredTemperatureAtStartOfReducedHeatingInterval_degC = indoorTemperature_degC;
+ }
+
+ //Calculate needed preheat duration ??
+ //Get temperature setpoint during interval start
+ double temperatureSetPointDuringIntervalStart = heatingPreferences.getDayTimeSetPoint_degC();
+ if (startTimeOfReducedHeatingInterval_hr < heatingPreferences.getStartOfDayTime_h() || startTimeOfReducedHeatingInterval_hr >= heatingPreferences.getStartOfNightTime_h()) {
+ temperatureSetPointDuringIntervalStart = heatingPreferences.getNightTimeSetPoint_degC();
+ }
+
+ double setpointAndPreHeatDeltaT_degC = this.requiredTemperatureAtStartOfReducedHeatingInterval_degC - temperatureSetPointDuringIntervalStart;
+ if(setpointAndPreHeatDeltaT_degC <= 0 ) {
+ this.preHeatDuration_hr = 0;
+ }
+ else {
+ double totalAdditionalEnergyNeededToReachPreheatTemperature_kWh = setpointAndPreHeatDeltaT_degC * buildingHeatCapacity_kWhpK;
+ this.preHeatDuration_hr = 2; // Optional, can approximate this if needed, but then also have to account of fluctuations due to hot water demand, we can add a tolerance of 0.5 hr or something.
+ //For now, preheat duration of 2 hours is assumed.
+ }
+ }
+
+ private double managePTAndHotWaterHeatBuffer(double hotWaterDemand_kW){
+
+ //Calculate the pt production
+ double ptProduction_kW = 0;
+ List<J_EAProduction> ptAssets = findAll(gc.c_productionAssets, ea -> ea.energyAssetType == OL_EnergyAssetType.PHOTOTHERMAL);
+ for (J_EA j_ea : ptAssets) {
+ ptProduction_kW -= j_ea.getLastFlows().get(OL_EnergyCarriers.HEAT);
+ }
+
+ //Calculate the remaining hot water energy need after pt production, also calculate the remaining unused pt production
+ double remainingHotWater_kW = max(0, hotWaterDemand_kW - ptProduction_kW); // Need to do this, because pt has already compensated the hot water demand in the gc flows, so just need to update this value
+ double remainingPTProduction_kW = max(0, ptProduction_kW - hotWaterDemand_kW);
+
+ if(gc.p_heatBuffer != null){
+ double chargeSetpoint_kW = 0;
+ if(remainingHotWater_kW > 0) {
+ chargeSetpoint_kW = -remainingHotWater_kW;
+ }
+ else if(remainingPTProduction_kW > 0) {
+ chargeSetpoint_kW = remainingPTProduction_kW;
+ }
+ gc.p_heatBuffer.v_powerFraction_fr = chargeSetpoint_kW / gc.p_heatBuffer.getCapacityHeat_kW();
+ gc.p_heatBuffer.f_updateAllFlows(gc.p_heatBuffer.v_powerFraction_fr);
+
+ double heatBufferCharge_kW = gc.p_heatBuffer.getLastFlows().get(OL_EnergyCarriers.HEAT);
+
+ if(remainingHotWater_kW > 0){//Only if the current pt production, wasnt enough, adjust the hotwater demand with the buffer, cause then the buffer will have tried to discharge
+ remainingHotWater_kW = max(0, remainingHotWater_kW + heatBufferCharge_kW);
+ }
+ else {//Curtail the remaining pt that is not used for hot water
+ remainingPTProduction_kW = max(0, remainingPTProduction_kW - heatBufferCharge_kW);
+ if (remainingPTProduction_kW > 0) {//Heat (for now always curtail over produced heat!)
+ for (J_EAProduction j_ea : ptAssets) {
+ remainingPTProduction_kW -= j_ea.curtailEnergyCarrierProduction( OL_EnergyCarriers.HEAT, remainingPTProduction_kW);
+
+ if (remainingPTProduction_kW <= 0) {
+ break;
+ }
+ }
+ }
+ }
+ }
+ return remainingHotWater_kW;
+ }
+
+
+
+
+ public void setStartTimeOfReducedHeatingInterval_hr(double startTimeOfReducedHeatingInterval_hr) {
+ if(startTimeOfReducedHeatingInterval_hr == this.endTimeOfReducedHeatingInterval_hr) {
+ traceln("Start time of reduced heating interval can not be the same as the end time. Reduced heating interval starttime adjustment has been skipped.");
+ }
+ else {
+ this.startTimeOfReducedHeatingInterval_hr = startTimeOfReducedHeatingInterval_hr;
+ this.reducedHeatingIntervalLength_hr = (this.endTimeOfReducedHeatingInterval_hr - this.startTimeOfReducedHeatingInterval_hr + 24) % 24;
+ }
+ }
+ public void setEndTimeOfReducedHeatingInterval_hr(double endTimeOfReducedHeatingInterval_hr) {
+ if(endTimeOfReducedHeatingInterval_hr == this.startTimeOfReducedHeatingInterval_hr) {
+ traceln("End time of reduced heating interval can not be the same as the start time. Reduced heating interval endtime adjustment has been skipped.");
+ }
+ else {
+ this.endTimeOfReducedHeatingInterval_hr = endTimeOfReducedHeatingInterval_hr;
+ this.reducedHeatingIntervalLength_hr = (this.endTimeOfReducedHeatingInterval_hr - this.startTimeOfReducedHeatingInterval_hr + 24) % 24;
+ }
+ }
+
+ public double getStartTimeOfReducedHeatingInterval_hr() {
+ return this.startTimeOfReducedHeatingInterval_hr;
+ }
+ public double getEndTimeOfReducedHeatingInterval_hr() {
+ return this.endTimeOfReducedHeatingInterval_hr;
+ }
+
+
+ public void initializeAssets() {
+ if (!validHeatingTypes.contains(this.currentHeatingType)) {
+ throw new RuntimeException(this.getClass() + " does not support heating type: " + this.currentHeatingType);
+ }
+ J_EAProduction ptAsset = findFirst(gc.c_productionAssets, ea -> ea.energyAssetType == OL_EnergyAssetType.PHOTOTHERMAL);
+ if (ptAsset != null) {
+ if(gc.p_DHWAsset == null) {
+ throw new RuntimeException(this.getClass() + " requires a hot water demand to make sense to use this heating management with PT.");
+ }
+ }
+ if (gc.p_heatBuffer != null) {
+ if(gc.p_DHWAsset == null && ptAsset == null) {
+ throw new RuntimeException(this.getClass() + " requires a hot water demand and PT to make sense to use this heating management with a heatbuffer.");
+ }
+ }
+ if(gc.p_BuildingThermalAsset != null) {
+ this.building = gc.p_BuildingThermalAsset;
+ } else {
+ throw new RuntimeException(this.getClass() + " can only be used for temperature control of a building thermal asset.");
+ }
+ if (gc.c_heatingAssets.size() == 0) {
+ throw new RuntimeException(this.getClass() + " requires at least one heating asset.");
+ }
+ if (gc.c_heatingAssets.size() > 1) {
+ throw new RuntimeException(this.getClass() + " does not support more than one heating asset.");
+ }
+ this.heatingAsset = gc.c_heatingAssets.get(0);
+ if (heatingAsset instanceof J_EAConversionHeatPump) {
+ this.currentHeatingType = OL_GridConnectionHeatingType.ELECTRIC_HEATPUMP;
+ } else {
+ throw new RuntimeException(this.getClass() + " Unsupported heating asset!");
+ }
+ if(this.heatingPreferences == null) {
+ heatingPreferences = new J_HeatingPreferences();
+ }
+ this.filteredCurrentSetpoint_degC = heatingPreferences.getMinComfortTemperature_degC();
+ this.isInitialized = true;
+ }
+
+ public void notInitialized() {
+ this.isInitialized = false;
+ }
+
+ public List<OL_GridConnectionHeatingType> getValidHeatingTypes() {
+ return this.validHeatingTypes;
+ }
+
+ public OL_GridConnectionHeatingType getCurrentHeatingType() {
+ return this.currentHeatingType;
+ }
+
+ public void setHeatingPreferences(J_HeatingPreferences heatingPreferences) {
+ this.heatingPreferences = heatingPreferences;
+ }
+
+ public J_HeatingPreferences getHeatingPreferences() {
+ return this.heatingPreferences;
+ }
+
+
+
+ //Get parentagent
+ public Agent getParentAgent() {
+ return this.gc;
+ }
+
+
+ //Store and reset states
+ public void storeStatesAndReset() {
+ this.storedI_state_hDegC = this.I_state_hDegC;
+ this.storedFilteredCurrentSetpoint_degC = this.filteredCurrentSetpoint_degC;
+ this.storedrequiredTemperatureAtStartOfReducedHeatingInterval_degC = this.requiredTemperatureAtStartOfReducedHeatingInterval_degC;
+ this.I_state_hDegC = 0;
+ this.filteredCurrentSetpoint_degC = heatingPreferences.getMinComfortTemperature_degC();
+ this.requiredTemperatureAtStartOfReducedHeatingInterval_degC = 20;
+ this.isInitialized = false;
+ }
+ public void restoreStates() {
+ this.I_state_hDegC = this.storedI_state_hDegC;
+ this.filteredCurrentSetpoint_degC = this.storedFilteredCurrentSetpoint_degC;
+ this.requiredTemperatureAtStartOfReducedHeatingInterval_degC = storedrequiredTemperatureAtStartOfReducedHeatingInterval_degC;
+ this.isInitialized = true;
+ }
+
+ @Override
+ public String toString() {
+ return super.toString();
+ }
+}
+
+
+ 1760616857566
+ J_HeatingPreferences
+ 1752680962144
+ /**
+ * J_HeatingPreferences
+ */
+public class J_HeatingPreferences {
+
+ /**
+ * Default constructor
+ */
+ private double startOfDayTime_h = 8;
+ private double startOfNightTime_h = 23;
+ private double dayTimeSetPoint_degC = 20;
+ private double nightTimeSetPoint_degC = 18;
+
+ private double maxComfortTemperature_degC = dayTimeSetPoint_degC + 3;
+ private double minComfortTemperature_degC = dayTimeSetPoint_degC - 2;
+
+ public J_HeatingPreferences() {
+ }
+
+ public J_HeatingPreferences(double startOfDayTime_h, double startOfNightTime_h, double dayTimeSetPoint_degC, double nightTimeSetPoint_degC, double maxComfortTemperature_degC, double minComfortTemperature_degC) {
+
+ this.startOfDayTime_h = startOfDayTime_h;
+ this.startOfNightTime_h = startOfNightTime_h;
+ this.dayTimeSetPoint_degC = dayTimeSetPoint_degC;
+ this.nightTimeSetPoint_degC = nightTimeSetPoint_degC;
+ this.maxComfortTemperature_degC = maxComfortTemperature_degC;
+ this.minComfortTemperature_degC = minComfortTemperature_degC;
+ }
+
+ //Setters
+ public void setStartOfDayTime_h(double startOfDayTime_h) {
+ this.startOfDayTime_h = startOfDayTime_h;
+ }
+ public void setStartOfNightTime_h(double startOfNightTime_h) {
+ this.startOfNightTime_h = startOfNightTime_h;
+ }
+ public void setDayTimeSetPoint_degC(double dayTimeSetPoint_degC) {
+ this.dayTimeSetPoint_degC = dayTimeSetPoint_degC;
+ }
+ public void setNightTimeSetPoint_degC(double nightTimeSetPoint_degC) {
+ this.nightTimeSetPoint_degC = nightTimeSetPoint_degC;
+ }
+ public void setMaxComfortTemperature_degC(double maxComfortTemperature_degC) {
+ this.maxComfortTemperature_degC = maxComfortTemperature_degC;
+ }
+ public void setMinComfortTemperature_degC(double minComfortTemperature_degC) {
+ this.minComfortTemperature_degC = minComfortTemperature_degC;
+ }
+
+ //Getters
+ public double getStartOfDayTime_h() {
+ return this.startOfDayTime_h;
+ }
+ public double getStartOfNightTime_h() {
+ return this.startOfNightTime_h;
+ }
+ public double getDayTimeSetPoint_degC() {
+ return this.dayTimeSetPoint_degC;
+ }
+ public double getNightTimeSetPoint_degC() {
+ return this.nightTimeSetPoint_degC;
+ }
+ public double getMaxComfortTemperature_degC() {
+ return this.maxComfortTemperature_degC;
+ }
+ public double getMinComfortTemperature_degC() {
+ return this.minComfortTemperature_degC;
+ }
+
+
+
+ @Override
+ public String toString() {
+ return
+ "StartOfDayTime_h = " + this.startOfDayTime_h +
+ ", StartOfNightTime_h = " + this.startOfNightTime_h +
+ ", DayTimeSetPoint_degC = " + this.dayTimeSetPoint_degC +
+ ", NightTimeSetPoint_degC = " + this.nightTimeSetPoint_degC +
+ ", MaxComfortTemperature_degC = " + this.maxComfortTemperature_degC +
+ ", MinComfortTemperature_degC = " + this.minComfortTemperature_degC;
+ }
+
+}
+
+
+ 1762529771307
+ I_AssetManagement
+ 1762850551601
+ //This class contains all asset management classes are required to have.
+
+import com.fasterxml.jackson.annotation.JsonTypeInfo;
+import com.fasterxml.jackson.annotation.JsonSubTypes;
+import com.fasterxml.jackson.annotation.JsonIdentityInfo;
+import com.fasterxml.jackson.annotation.ObjectIdGenerators;
+@JsonIdentityInfo(generator = ObjectIdGenerators.UUIDGenerator.class, property = "@id")
+
+@JsonTypeInfo(
+ use = JsonTypeInfo.Id.CLASS,
+ include = JsonTypeInfo.As.PROPERTY,
+ property = "type" // 👈 this will be the field name in your JSON
+ )
+
+public interface I_AssetManagement
+{
+ //Get agent that contains the management
+ Agent getParentAgent();
+
+ //Store current state of live sim, and reset to initial state for rapid run
+ void storeStatesAndReset();
+
+ //Restore state to correct state of live sim after rapid run
+ void restoreStates();
+}
+
+
+ 1763394890431
+ J_HeatingManagementPIcontrolHybridHeatpump
+ 1762850578079
+ /**
+ * J_HeatingManagementPIcontrolHybridHeatpump
+ */
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
+
+@JsonAutoDetect(
+ fieldVisibility = Visibility.ANY, //
+ getterVisibility = Visibility.NONE,
+ isGetterVisibility = Visibility.NONE,
+ setterVisibility = Visibility.NONE,
+ creatorVisibility = Visibility.NONE
+)
+
+public class J_HeatingManagementPIcontrolHybridHeatpump implements I_HeatingManagement{
+ private boolean isInitialized = false;
+ private GridConnection gc;
+ private List<OL_GridConnectionHeatingType> validHeatingTypes = Arrays.asList(
+ OL_GridConnectionHeatingType.HYBRID_HEATPUMP
+ );
+ private OL_GridConnectionHeatingType currentHeatingType;
+
+ private J_EABuilding building;
+ private J_EAConversionHeatPump heatPumpAsset;
+ private J_EAConversionGasBurner gasBurnerAsset;
+ private J_HeatingPreferences heatingPreferences;
+
+ // PI control gains
+ private double P_gain_kWpDegC = 1*1;
+ private double I_gain_kWphDegC = 0.1*2;
+ private double I_state_hDegC = 0;
+ private double timeStep_h;
+
+ //Temperature setpoint low pass filter
+ private double filteredCurrentSetpoint_degC;
+ private double setpointFilterTimeScale_h = 2.0; // Smooth in X hours
+
+ //Stored parameters
+ private double storedI_state_hDegC;
+ private double storedFilteredCurrentSetpoint_degC;
+
+ /**
+ * Default constructor
+ */
+ public J_HeatingManagementPIcontrolHybridHeatpump() {
+ }
+
+ public J_HeatingManagementPIcontrolHybridHeatpump( GridConnection gc, OL_GridConnectionHeatingType heatingType) {
+ this.gc = gc;
+ this.currentHeatingType = heatingType;
+ this.timeStep_h = gc.energyModel.p_timeStep_h;
+ }
+
+ public void manageHeating() {
+ if ( !isInitialized ) {
+ this.initializeAssets();
+ }
+
+ double hotWaterDemand_kW = gc.p_DHWAsset != null ? gc.p_DHWAsset.getLastFlows().get(OL_EnergyCarriers.HEAT) : 0;
+
+ //Adjust the hot water and overall heat demand with the buffer and pt
+ double remainingHotWaterDemand_kW = managePTAndHotWaterHeatBuffer(hotWaterDemand_kW); // This function updates the buffer and curtails PT if needed -> current balanceflow is updated accordingly.
+
+ double otherHeatDemand_kW = gc.fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.HEAT);
+
+ double buildingTemp_degC = building.getCurrentTemperature();
+ double timeOfDay_h = gc.energyModel.t_hourOfDay;
+ double buildingHeatingDemand_kW = 0;
+
+ double currentSetpoint_degC = heatingPreferences.getDayTimeSetPoint_degC();
+ if (timeOfDay_h < heatingPreferences.getStartOfDayTime_h() || timeOfDay_h >= heatingPreferences.getStartOfNightTime_h()) {
+ currentSetpoint_degC = heatingPreferences.getNightTimeSetPoint_degC();
+ }
+
+ //Smooth the setpoint signal
+ this.filteredCurrentSetpoint_degC += 1/(this.setpointFilterTimeScale_h / this.timeStep_h) * (currentSetpoint_degC - this.filteredCurrentSetpoint_degC);
+
+
+ //Determine the building heat demand using the found temp setpoint and PI controller
+ double deltaT_degC = this.filteredCurrentSetpoint_degC - building.getCurrentTemperature(); // Positive deltaT when heating is needed
+
+ I_state_hDegC = max(0,I_state_hDegC + deltaT_degC * timeStep_h); // max(0,...) to prevent buildup of negative integrator during warm periods.
+ buildingHeatingDemand_kW = max(0,deltaT_degC * P_gain_kWpDegC + I_state_hDegC * I_gain_kWphDegC);
+
+
+ //Set asset power based on the COP (All demand profiles (hot water, etc.) always go to the gasburner!)
+ double heatpumpAssetPower_kW = 0;
+ double gasBurnerAssetPower_kW = 0;
+ double heatIntoBuilding_kW = 0;
+
+ if (heatPumpAsset.getCOP() > 3.0 ) {
+ heatpumpAssetPower_kW = min(heatPumpAsset.getOutputCapacity_kW(), buildingHeatingDemand_kW);
+ gasBurnerAssetPower_kW = min(gasBurnerAsset.getOutputCapacity_kW(), otherHeatDemand_kW + max(0, buildingHeatingDemand_kW - heatpumpAssetPower_kW));
+ heatIntoBuilding_kW = heatpumpAssetPower_kW + max(0, gasBurnerAssetPower_kW - otherHeatDemand_kW);
+ }
+ else {
+ heatpumpAssetPower_kW = 0.0;
+ gasBurnerAssetPower_kW = min(gasBurnerAsset.getOutputCapacity_kW(), buildingHeatingDemand_kW + otherHeatDemand_kW);
+ heatIntoBuilding_kW = max(0, gasBurnerAssetPower_kW - otherHeatDemand_kW);
+ }
+
+ //Updat flows with found asset powers
+ heatPumpAsset.f_updateAllFlows( heatpumpAssetPower_kW / heatPumpAsset.getOutputCapacity_kW() );
+ gasBurnerAsset.f_updateAllFlows( gasBurnerAssetPower_kW / gasBurnerAsset.getOutputCapacity_kW() );
+ building.f_updateAllFlows( heatIntoBuilding_kW / building.getCapacityHeat_kW() );
+ }
+
+
+ private double managePTAndHotWaterHeatBuffer(double hotWaterDemand_kW){
+
+ //Calculate the pt production
+ double ptProduction_kW = 0;
+ List<J_EAProduction> ptAssets = findAll(gc.c_productionAssets, ea -> ea.energyAssetType == OL_EnergyAssetType.PHOTOTHERMAL);
+ for (J_EA j_ea : ptAssets) {
+ ptProduction_kW -= j_ea.getLastFlows().get(OL_EnergyCarriers.HEAT);
+ }
+
+ //Calculate the remaining hot water energy need after pt production, also calculate the remaining unused pt production
+ double remainingHotWater_kW = max(0, hotWaterDemand_kW - ptProduction_kW); // Need to do this, because pt has already compensated the hot water demand in the gc flows, so just need to update this value
+ double remainingPTProduction_kW = max(0, ptProduction_kW - hotWaterDemand_kW);
+
+ if(gc.p_heatBuffer != null){
+ double chargeSetpoint_kW = 0;
+ if(remainingHotWater_kW > 0) {
+ chargeSetpoint_kW = -remainingHotWater_kW;
+ }
+ else if(remainingPTProduction_kW > 0) {
+ chargeSetpoint_kW = remainingPTProduction_kW;
+ }
+ gc.p_heatBuffer.v_powerFraction_fr = chargeSetpoint_kW / gc.p_heatBuffer.getCapacityHeat_kW();
+ gc.p_heatBuffer.f_updateAllFlows(gc.p_heatBuffer.v_powerFraction_fr);
+
+ double heatBufferCharge_kW = gc.p_heatBuffer.getLastFlows().get(OL_EnergyCarriers.HEAT);
+
+ if(remainingHotWater_kW > 0){//Only if the current pt production, wasnt enough, adjust the hotwater demand with the buffer, cause then the buffer will have tried to discharge
+ remainingHotWater_kW = max(0, remainingHotWater_kW + heatBufferCharge_kW);
+ }
+ else {//Curtail the remaining pt that is not used for hot water
+ remainingPTProduction_kW = max(0, remainingPTProduction_kW - heatBufferCharge_kW);
+ if (remainingPTProduction_kW > 0) {//Heat (for now always curtail over produced heat!)
+ for (J_EAProduction j_ea : ptAssets) {
+ remainingPTProduction_kW -= j_ea.curtailEnergyCarrierProduction( OL_EnergyCarriers.HEAT, remainingPTProduction_kW);
+
+ if (remainingPTProduction_kW <= 0) {
+ break;
+ }
+ }
+ }
+ }
+ }
+ return remainingHotWater_kW;
+ }
+
+
+ public void initializeAssets() {
+ if (!validHeatingTypes.contains(this.currentHeatingType)) {
+ throw new RuntimeException(this.getClass() + " does not support heating type: " + this.currentHeatingType);
+ }
+ J_EAProduction ptAsset = findFirst(gc.c_productionAssets, ea -> ea.energyAssetType == OL_EnergyAssetType.PHOTOTHERMAL);
+ if (ptAsset != null) {
+ if(gc.p_DHWAsset == null) {
+ throw new RuntimeException(this.getClass() + " requires a hot water demand to make sense to use this heating management with PT.");
+ }
+ }
+ if (gc.p_heatBuffer != null) {
+ if(gc.p_DHWAsset == null && ptAsset == null) {
+ throw new RuntimeException(this.getClass() + " requires a hot water demand and PT to make sense to use this heating management with a heatbuffer.");
+ }
+ }
+ if(gc.p_BuildingThermalAsset != null) {
+ this.building = gc.p_BuildingThermalAsset;
+ } else {
+ throw new RuntimeException(this.getClass() + " can only be used for temperature control of a building thermal asset.");
+ }
+ if (gc.c_heatingAssets.size() != 2) {
+ throw new RuntimeException(this.getClass() + " requires exactly two heating assets.");
+ }
+ if (gc.c_heatingAssets.get(0) instanceof J_EAConversionGasBurner) {
+ this.gasBurnerAsset = (J_EAConversionGasBurner)gc.c_heatingAssets.get(0);
+ }
+ else if (gc.c_heatingAssets.get(1) instanceof J_EAConversionGasBurner) {
+ this.gasBurnerAsset = (J_EAConversionGasBurner)gc.c_heatingAssets.get(1);
+ }
+ else {
+ throw new RuntimeException(this.getClass() + " requires a Gas Burner");
+ }
+ if (gc.c_heatingAssets.get(0) instanceof J_EAConversionHeatPump) {
+ this.heatPumpAsset = (J_EAConversionHeatPump)gc.c_heatingAssets.get(0);
+ }
+ else if (gc.c_heatingAssets.get(1) instanceof J_EAConversionHeatPump) {
+ this.heatPumpAsset = (J_EAConversionHeatPump)gc.c_heatingAssets.get(1);
+ }
+ else {
+ throw new RuntimeException(this.getClass() + " requires a Heat Pump");
+ }
+ if(this.heatingPreferences == null) {
+ heatingPreferences = new J_HeatingPreferences();
+ }
+ this.filteredCurrentSetpoint_degC = heatingPreferences.getMinComfortTemperature_degC();
+ this.isInitialized = true;
+ }
+
+
+ public void notInitialized() {
+ this.isInitialized = false;
+ }
+
+ public List<OL_GridConnectionHeatingType> getValidHeatingTypes() {
+ return this.validHeatingTypes;
+ }
+
+ public OL_GridConnectionHeatingType getCurrentHeatingType() {
+ return this.currentHeatingType;
+ }
+
+ public void setHeatingPreferences(J_HeatingPreferences heatingPreferences) {
+ this.heatingPreferences = heatingPreferences;
+ }
+
+ public J_HeatingPreferences getHeatingPreferences() {
+ return this.heatingPreferences;
+ }
+
+ //Get parentagent
+ public Agent getParentAgent() {
+ return this.gc;
+ }
+
+ //Store and reset states
+ public void storeStatesAndReset() {
+ this.storedI_state_hDegC = this.I_state_hDegC;
+ this.storedFilteredCurrentSetpoint_degC = this.filteredCurrentSetpoint_degC;
+ this.I_state_hDegC = 0;
+ this.filteredCurrentSetpoint_degC = 0;
+ }
+ public void restoreStates() {
+ this.I_state_hDegC = this.storedI_state_hDegC;
+ this.filteredCurrentSetpoint_degC = this.storedFilteredCurrentSetpoint_degC;
+ }
+
+ @Override
+ public String toString() {
+ return super.toString();
+ }
+}
+
+
+
+ com.anylogic.libraries.modules.markup_descriptors
+ 1
+ 0
+ 0
+
+
+
+ zero_engine
+ ZeroMath.jar
+
+ true
+ false
+
+ f5586290-2a06-4a7c-8c59-bd77840932c3
+
+
+ 1658477089999
+ AlbatrossProcessedVehicleTrips.xlsx
+ true
+ FILE_SYSTEM
+
+
+ 1658477089998
+ ZeroMath.jar
+ false
+ FILE_SYSTEM
+
+
+
+
+ 9f7858c9-b2c8-4ead-9244-fd08833f642b
+ 404652e6-561a-404c-aab2-ab7415f40ef5
+ 6fd6cd57-6dfe-4fc6-be0b-c74065351957
+ 3325dc48-3ad4-41e3-836f-dfd0e98fe1ed
+ 3f69ef3d-706e-41a6-8af0-11658c5eef68
+ 3f6fe405-e047-4304-91d6-6eee206d1106
+ 820d2b51-5b4a-48e7-b0b6-e46418e3c0f2
+ 630818fa-8975-4b70-976f-03180dce01db
+ 7c7e471c-004e-495e-a4ad-d840620ab38e
+ 3e38ff63-1f70-4ec0-b42c-e879b146785d
+ b1eb86e4-14b3-405c-8257-56b80f1b485d
+ d55f9fb6-86bb-45ea-9db1-79cecfa0ce91
+ ab77aafd-8f02-4354-b789-928d45b1f73c
+ e4f14fd7-1c4a-42e9-b91d-db2415f475db
+ 6d208120-6c7a-45a6-b411-402f18890d9b
+ 1816cdd0-177c-4973-9e88-dd8b95318556
+ 5c23f62f-06dc-46ad-8ead-688ec434e3e5
+ 5c7d7990-3f35-41eb-ae16-d0c16098acc6
+ 02a16c52-a834-4f30-b6af-a6aee51a294e
+ f0988929-2718-4984-a1b6-c1f2ce152f1f
+ 1c9d9cfe-ea2b-43f9-8f62-dc31d8ed3ae1
+ 34cb742a-8ba4-47a7-87e6-f2685fe69e97
+ 4fe10751-c399-4752-94b7-30113ad45070
+ c13fe5ac-6466-446e-886a-12df1431b1eb
+ 714f9ca2-426e-4bff-8569-2d18f58fdcf8
+ 045aeb5f-1087-4ac7-9702-a49404e7f7e8
+ 840e9a0a-de98-4b7d-a172-f9bbda2d6b98
+ e342358b-75ed-4812-9376-6043fb6cb473
+ f3d5ccdc-1bb3-466f-871d-f6b92a26cbb4
+ 59acb6fb-561c-4038-b722-a596a748b3c7
+ be7e6726-05c0-4228-821d-a8df91aeb5bc
+ df4a6a60-9ce8-4c6c-91c0-ad5a5d732259
+ 47491eb9-4606-42bd-8399-125a2b95fded
+ 9b2d1306-5d19-439a-8f2c-b144dd7e22fa
+ ef421152-8732-4f97-9acb-c8e9a6890d5e
+ d48f8080-25b1-44f5-8322-7bf2712ff974
+ 6c4de826-daad-4cd4-b703-51dfe803e822
+ 01af22d6-6889-4e98-a3df-e6eddc40fc92
+ ea3b3dbe-cca2-4bde-957b-feaef7e18789
+ e737c8c6-b526-4f88-b89e-554e205b0614
+ efd24e87-d7f7-425f-9cb0-3ee17c7b2116
+ a62607e6-047e-4910-a1ec-5426bf9283b5
+ 64dceb5b-de05-47c7-8e40-e9b293e80d75
+ 8d51c652-6aee-4de8-ba03-47b289a13ec5
+ 51d7b5ce-5664-4750-b1a0-fabcdc31e49a
+ 6522e3af-aa9e-421c-b667-e11db73cd8ca
+ 9ac073a0-7abf-4dff-826f-9c44d4780590
+ 2da9c21c-adc7-405a-a36e-46fbd9dfcd42
+ fe4d1053-9c84-4221-bac7-cb489a7064ff
+ 1f005f88-e6d7-4bdc-81fa-3acf4c89cf64
+ 42dc5a7c-d7b1-4653-92b9-9359b46cc2d4
+ e25721a9-34f9-479c-a4c3-31f5ec9e117d
+ 506d1de3-06df-4131-9e88-e43f1768e3d8
+ e6625695-25a2-43d0-9056-1e9a1a594b1e
+ 91990287-4edf-4e38-aa6c-66d0e906807b
+ 2216cdd0-177c-5678-9e88-dd8b95312234
+ 1737c8c6-b526-4dd8-589e-ee4e205b06f4
+ 6a43bef6-8b70-4253-a828-82c3ab399655
+
+
diff --git a/_alp/Agents/EnergyCoop/AOC.EnergyCoop.xml b/_alp/Agents/EnergyCoop/AOC.EnergyCoop.xml
index 916f2e88..2709e09d 100644
--- a/_alp/Agents/EnergyCoop/AOC.EnergyCoop.xml
+++ b/_alp/Agents/EnergyCoop/AOC.EnergyCoop.xml
@@ -52,6 +52,8 @@ energyModel.c_actors.add(this);
fm_currentProductionFlows_kW = new J_FlowsMap();
fm_currentConsumptionFlows_kW = new J_FlowsMap();
fm_currentBalanceFlows_kW = new J_FlowsMap();
+fm_heatFromEnergyCarrier_kW = new J_FlowsMap();
+fm_consumptionForHeating_kW = new J_FlowsMap();
fm_currentAssetFlows_kW = new J_ValueMap(OL_AssetFlowCategories.class);]]>
false
diff --git a/_alp/Agents/EnergyCoop/Code/Functions.java b/_alp/Agents/EnergyCoop/Code/Functions.java
index dbe69ac2..de53b091 100644
--- a/_alp/Agents/EnergyCoop/Code/Functions.java
+++ b/_alp/Agents/EnergyCoop/Code/Functions.java
@@ -189,6 +189,8 @@
fm_currentBalanceFlows_kW.addFlows(gc.fm_currentBalanceFlows_kW);
fm_currentProductionFlows_kW.addFlows(gc.fm_currentProductionFlows_kW);
fm_currentConsumptionFlows_kW.addFlows(gc.fm_currentConsumptionFlows_kW);
+ fm_heatFromEnergyCarrier_kW.addFlows(gc.fm_heatFromEnergyCarrier_kW);
+ fm_consumptionForHeating_kW.addFlows(gc.fm_consumptionForHeating_kW);
fm_currentAssetFlows_kW.addFlows(gc.fm_currentAssetFlows_kW);
v_currentFinalEnergyConsumption_kW += gc.v_currentFinalEnergyConsumption_kW;
v_currentPrimaryEnergyProduction_kW += gc.v_currentPrimaryEnergyProduction_kW;
@@ -207,6 +209,8 @@
fm_currentBalanceFlows_kW.addFlows(EC.fm_currentBalanceFlows_kW);
fm_currentProductionFlows_kW.addFlows(EC.fm_currentProductionFlows_kW);
fm_currentConsumptionFlows_kW.addFlows(EC.fm_currentConsumptionFlows_kW);
+ fm_heatFromEnergyCarrier_kW.addFlows(EC.fm_heatFromEnergyCarrier_kW);
+ fm_consumptionForHeating_kW.addFlows(EC.fm_consumptionForHeating_kW);
fm_currentAssetFlows_kW.addFlows(EC.fm_currentAssetFlows_kW);
v_currentPrimaryEnergyProduction_kW += EC.v_currentPrimaryEnergyProduction_kW;
v_currentFinalEnergyConsumption_kW += EC.v_currentFinalEnergyConsumption_kW;
@@ -1072,6 +1076,8 @@
if(gc.v_isActive){
// Totals
v_rapidRunData.am_totalBalanceAccumulators_kW.add(gc.v_rapidRunData.am_totalBalanceAccumulators_kW);
+ v_rapidRunData.am_totalHeatFromEnergyCarrier_kW.add(gc.v_rapidRunData.am_totalHeatFromEnergyCarrier_kW);
+ v_rapidRunData.am_totalConsumptionForHeating_kW.add(gc.v_rapidRunData.am_totalConsumptionForHeating_kW);
v_rapidRunData.am_dailyAverageConsumptionAccumulators_kW.add(gc.v_rapidRunData.am_dailyAverageConsumptionAccumulators_kW);
v_rapidRunData.am_dailyAverageProductionAccumulators_kW.add(gc.v_rapidRunData.am_dailyAverageProductionAccumulators_kW);
v_rapidRunData.acc_dailyAverageEnergyProduction_kW.add(gc.v_rapidRunData.acc_dailyAverageEnergyProduction_kW);
@@ -1087,7 +1093,9 @@
v_rapidRunData.acc_daytimeFinalEnergyConsumption_kW.add(gc.v_rapidRunData.acc_daytimeFinalEnergyConsumption_kW);
v_rapidRunData.am_daytimeImports_kW.add(gc.v_rapidRunData.am_daytimeImports_kW);
v_rapidRunData.am_daytimeExports_kW.add(gc.v_rapidRunData.am_daytimeExports_kW);
-
+ v_rapidRunData.am_daytimeHeatFromEnergyCarrier_kW.add(gc.v_rapidRunData.am_daytimeHeatFromEnergyCarrier_kW);
+ v_rapidRunData.am_daytimeConsumptionForHeating_kW.add(gc.v_rapidRunData.am_daytimeConsumptionForHeating_kW);
+
// Weekend
v_rapidRunData.acc_weekendElectricityConsumption_kW.add(gc.v_rapidRunData.acc_weekendElectricityConsumption_kW);
v_rapidRunData.acc_weekendElectricityProduction_kW.add(gc.v_rapidRunData.acc_weekendElectricityProduction_kW);
@@ -1095,11 +1103,15 @@
v_rapidRunData.acc_weekendFinalEnergyConsumption_kW.add(gc.v_rapidRunData.acc_weekendFinalEnergyConsumption_kW);
v_rapidRunData.am_weekendImports_kW.add(gc.v_rapidRunData.am_weekendImports_kW);
v_rapidRunData.am_weekendExports_kW.add(gc.v_rapidRunData.am_weekendExports_kW);
-
+ v_rapidRunData.am_weekendHeatFromEnergyCarrier_kW.add(gc.v_rapidRunData.am_weekendHeatFromEnergyCarrier_kW);
+ v_rapidRunData.am_weekendConsumptionForHeating_kW.add(gc.v_rapidRunData.am_weekendConsumptionForHeating_kW);
+
// Summerweek
v_rapidRunData.am_summerWeekBalanceAccumulators_kW.add(gc.v_rapidRunData.am_summerWeekBalanceAccumulators_kW);
v_rapidRunData.am_summerWeekConsumptionAccumulators_kW.add(gc.v_rapidRunData.am_summerWeekConsumptionAccumulators_kW);
v_rapidRunData.am_summerWeekProductionAccumulators_kW.add(gc.v_rapidRunData.am_summerWeekProductionAccumulators_kW);
+ v_rapidRunData.am_summerWeekHeatFromEnergyCarrier_kW.add(gc.v_rapidRunData.am_summerWeekHeatFromEnergyCarrier_kW);
+ v_rapidRunData.am_summerWeekConsumptionForHeating_kW.add(gc.v_rapidRunData.am_summerWeekConsumptionForHeating_kW);
v_rapidRunData.acc_summerWeekEnergyProduction_kW.add(gc.v_rapidRunData.acc_summerWeekEnergyProduction_kW);
v_rapidRunData.acc_summerWeekFinalEnergyConsumption_kW.add(gc.v_rapidRunData.acc_summerWeekFinalEnergyConsumption_kW);
v_rapidRunData.acc_summerWeekEnergyCurtailed_kW.add(gc.v_rapidRunData.acc_summerWeekEnergyCurtailed_kW);
@@ -1110,6 +1122,8 @@
v_rapidRunData.am_winterWeekBalanceAccumulators_kW.add(gc.v_rapidRunData.am_winterWeekBalanceAccumulators_kW);
v_rapidRunData.am_winterWeekConsumptionAccumulators_kW.add(gc.v_rapidRunData.am_winterWeekConsumptionAccumulators_kW);
v_rapidRunData.am_winterWeekProductionAccumulators_kW.add(gc.v_rapidRunData.am_winterWeekProductionAccumulators_kW);
+ v_rapidRunData.am_winterWeekHeatFromEnergyCarrier_kW.add(gc.v_rapidRunData.am_winterWeekHeatFromEnergyCarrier_kW);
+ v_rapidRunData.am_winterWeekConsumptionForHeating_kW.add(gc.v_rapidRunData.am_winterWeekConsumptionForHeating_kW);
v_rapidRunData.acc_winterWeekEnergyProduction_kW.add(gc.v_rapidRunData.acc_winterWeekEnergyProduction_kW);
v_rapidRunData.acc_winterWeekFinalEnergyConsumption_kW.add(gc.v_rapidRunData.acc_winterWeekFinalEnergyConsumption_kW);
v_rapidRunData.acc_winterWeekEnergyCurtailed_kW.add(gc.v_rapidRunData.acc_winterWeekEnergyCurtailed_kW);
@@ -1425,6 +1439,8 @@ HashSet f_getAllChildCustomerGridConnections_recursion(HashSet f_getMemberGridConnectionsCollectionPointer()
if(gc.v_isActive){
// Totals
v_originalRapidRunData.am_totalBalanceAccumulators_kW.add(gc.v_originalRapidRunData.am_totalBalanceAccumulators_kW);
+ v_originalRapidRunData.am_totalHeatFromEnergyCarrier_kW.add(gc.v_originalRapidRunData.am_totalHeatFromEnergyCarrier_kW);
+ v_originalRapidRunData.am_totalConsumptionForHeating_kW.add(gc.v_originalRapidRunData.am_totalConsumptionForHeating_kW);
v_originalRapidRunData.am_dailyAverageConsumptionAccumulators_kW.add(gc.v_originalRapidRunData.am_dailyAverageConsumptionAccumulators_kW);
v_originalRapidRunData.am_dailyAverageProductionAccumulators_kW.add(gc.v_originalRapidRunData.am_dailyAverageProductionAccumulators_kW);
v_originalRapidRunData.acc_dailyAverageEnergyProduction_kW.add(gc.v_originalRapidRunData.acc_dailyAverageEnergyProduction_kW);
@@ -1674,7 +1692,9 @@ ArrayList f_getMemberGridConnectionsCollectionPointer()
v_originalRapidRunData.acc_daytimeFinalEnergyConsumption_kW.add(gc.v_originalRapidRunData.acc_daytimeFinalEnergyConsumption_kW);
v_originalRapidRunData.am_daytimeImports_kW.add(gc.v_originalRapidRunData.am_daytimeImports_kW);
v_originalRapidRunData.am_daytimeExports_kW.add(gc.v_originalRapidRunData.am_daytimeExports_kW);
-
+ v_originalRapidRunData.am_daytimeHeatFromEnergyCarrier_kW.add(gc.v_originalRapidRunData.am_daytimeHeatFromEnergyCarrier_kW);
+ v_originalRapidRunData.am_daytimeConsumptionForHeating_kW.add(gc.v_originalRapidRunData.am_daytimeConsumptionForHeating_kW);
+
// Weekend
v_originalRapidRunData.acc_weekendElectricityConsumption_kW.add(gc.v_originalRapidRunData.acc_weekendElectricityConsumption_kW);
v_originalRapidRunData.acc_weekendElectricityProduction_kW.add(gc.v_originalRapidRunData.acc_weekendElectricityProduction_kW);
@@ -1682,11 +1702,15 @@ ArrayList f_getMemberGridConnectionsCollectionPointer()
v_originalRapidRunData.acc_weekendFinalEnergyConsumption_kW.add(gc.v_originalRapidRunData.acc_weekendFinalEnergyConsumption_kW);
v_originalRapidRunData.am_weekendImports_kW.add(gc.v_originalRapidRunData.am_weekendImports_kW);
v_originalRapidRunData.am_weekendExports_kW.add(gc.v_originalRapidRunData.am_weekendExports_kW);
-
+ v_originalRapidRunData.am_weekendHeatFromEnergyCarrier_kW.add(gc.v_originalRapidRunData.am_weekendHeatFromEnergyCarrier_kW);
+ v_originalRapidRunData.am_weekendConsumptionForHeating_kW.add(gc.v_originalRapidRunData.am_weekendConsumptionForHeating_kW);
+
// Summerweek
v_originalRapidRunData.am_summerWeekBalanceAccumulators_kW.add(gc.v_originalRapidRunData.am_summerWeekBalanceAccumulators_kW);
v_originalRapidRunData.am_summerWeekConsumptionAccumulators_kW.add(gc.v_originalRapidRunData.am_summerWeekConsumptionAccumulators_kW);
v_originalRapidRunData.am_summerWeekProductionAccumulators_kW.add(gc.v_originalRapidRunData.am_summerWeekProductionAccumulators_kW);
+ v_originalRapidRunData.am_summerWeekHeatFromEnergyCarrier_kW.add(gc.v_originalRapidRunData.am_summerWeekHeatFromEnergyCarrier_kW);
+ v_originalRapidRunData.am_summerWeekConsumptionForHeating_kW.add(gc.v_originalRapidRunData.am_summerWeekConsumptionForHeating_kW);
v_originalRapidRunData.acc_summerWeekEnergyProduction_kW.add(gc.v_originalRapidRunData.acc_summerWeekEnergyProduction_kW);
v_originalRapidRunData.acc_summerWeekFinalEnergyConsumption_kW.add(gc.v_originalRapidRunData.acc_summerWeekFinalEnergyConsumption_kW);
v_originalRapidRunData.acc_summerWeekEnergyCurtailed_kW.add(gc.v_originalRapidRunData.acc_summerWeekEnergyCurtailed_kW);
@@ -1697,6 +1721,8 @@ ArrayList f_getMemberGridConnectionsCollectionPointer()
v_originalRapidRunData.am_winterWeekBalanceAccumulators_kW.add(gc.v_originalRapidRunData.am_winterWeekBalanceAccumulators_kW);
v_originalRapidRunData.am_winterWeekConsumptionAccumulators_kW.add(gc.v_originalRapidRunData.am_winterWeekConsumptionAccumulators_kW);
v_originalRapidRunData.am_winterWeekProductionAccumulators_kW.add(gc.v_originalRapidRunData.am_winterWeekProductionAccumulators_kW);
+ v_originalRapidRunData.am_winterWeekHeatFromEnergyCarrier_kW.add(gc.v_originalRapidRunData.am_winterWeekHeatFromEnergyCarrier_kW);
+ v_originalRapidRunData.am_winterWeekConsumptionForHeating_kW.add(gc.v_originalRapidRunData.am_winterWeekConsumptionForHeating_kW);
v_originalRapidRunData.acc_winterWeekEnergyProduction_kW.add(gc.v_originalRapidRunData.acc_winterWeekEnergyProduction_kW);
v_originalRapidRunData.acc_winterWeekFinalEnergyConsumption_kW.add(gc.v_originalRapidRunData.acc_winterWeekFinalEnergyConsumption_kW);
v_originalRapidRunData.acc_winterWeekEnergyCurtailed_kW.add(gc.v_originalRapidRunData.acc_winterWeekEnergyCurtailed_kW);
diff --git a/_alp/Agents/EnergyCoop/Variables.xml b/_alp/Agents/EnergyCoop/Variables.xml
index d3d2862f..d83e5388 100644
--- a/_alp/Agents/EnergyCoop/Variables.xml
+++ b/_alp/Agents/EnergyCoop/Variables.xml
@@ -1581,6 +1581,44 @@
+
+ 1764773311957
+
+ 60
+ 1420
+
+ false
+ true
+ true
+
+
+
+
+
+ 1764773311959
+
+ 60
+ 1400
+
+ false
+ true
+ true
+
+
+
+
1669037234222
diff --git a/_alp/Agents/EnergyModel/AOC.EnergyModel.xml b/_alp/Agents/EnergyModel/AOC.EnergyModel.xml
index 74a45e5b..3386b289 100644
--- a/_alp/Agents/EnergyModel/AOC.EnergyModel.xml
+++ b/_alp/Agents/EnergyModel/AOC.EnergyModel.xml
@@ -66,6 +66,8 @@ v_liveData.assetsMetaData = v_liveAssetsMetaData;
fm_currentProductionFlows_kW = new J_FlowsMap();
fm_currentConsumptionFlows_kW = new J_FlowsMap();
fm_currentBalanceFlows_kW = new J_FlowsMap();
+fm_heatFromEnergyCarrier_kW = new J_FlowsMap();
+fm_consumptionForHeating_kW = new J_FlowsMap();
fm_currentAssetFlows_kW = new J_ValueMap(OL_AssetFlowCategories.class);]]>
false
diff --git a/_alp/Agents/EnergyModel/Code/Functions.java b/_alp/Agents/EnergyModel/Code/Functions.java
index 6ac75f6c..2008244e 100644
--- a/_alp/Agents/EnergyModel/Code/Functions.java
+++ b/_alp/Agents/EnergyModel/Code/Functions.java
@@ -158,6 +158,8 @@
fm_currentProductionFlows_kW.clear();
fm_currentConsumptionFlows_kW.clear();
fm_currentBalanceFlows_kW.clear();
+fm_heatFromEnergyCarrier_kW.clear();
+fm_consumptionForHeating_kW.clear();
fm_currentAssetFlows_kW.clear();
v_currentFinalEnergyConsumption_kW = 0;
@@ -182,6 +184,8 @@
fm_currentBalanceFlows_kW.addFlows(gc.fm_currentBalanceFlows_kW);
fm_currentProductionFlows_kW.addFlows(gc.fm_currentProductionFlows_kW);
fm_currentConsumptionFlows_kW.addFlows(gc.fm_currentConsumptionFlows_kW);
+ fm_heatFromEnergyCarrier_kW.addFlows(gc.fm_heatFromEnergyCarrier_kW);
+ fm_consumptionForHeating_kW.addFlows(gc.fm_consumptionForHeating_kW);
fm_currentAssetFlows_kW.addFlows(gc.fm_currentAssetFlows_kW);
v_currentFinalEnergyConsumption_kW += gc.v_currentFinalEnergyConsumption_kW;
v_currentPrimaryEnergyProduction_kW += gc.v_currentPrimaryEnergyProduction_kW;
@@ -356,12 +360,14 @@
v_rapidRunData.addTimeStep(fm_currentBalanceFlows_kW,
fm_currentConsumptionFlows_kW,
fm_currentProductionFlows_kW,
+ fm_heatFromEnergyCarrier_kW,
+ fm_consumptionForHeating_kW,
fm_currentAssetFlows_kW,
v_currentPrimaryEnergyProduction_kW,
v_currentFinalEnergyConsumption_kW,
v_currentPrimaryEnergyProductionHeatpumps_kW,
v_currentEnergyCurtailed_kW,
- v_batteryStoredEnergy_kWh/1000,
+ v_batteryStoredEnergy_kWh/1000,
this);
v_timeStepsElapsed++;
}
diff --git a/_alp/Agents/EnergyModel/Variables.xml b/_alp/Agents/EnergyModel/Variables.xml
index 62419e43..db6773c0 100644
--- a/_alp/Agents/EnergyModel/Variables.xml
+++ b/_alp/Agents/EnergyModel/Variables.xml
@@ -1447,6 +1447,44 @@
+
+ 1764773669987
+
+ 80
+ 1460
+
+ false
+ true
+ true
+
+
+
+
+
+ 1764773669989
+
+ 80
+ 1440
+
+ false
+ true
+ true
+
+
+
+
1658496701675
diff --git a/_alp/Agents/GridConnection/AOC.GridConnection.xml b/_alp/Agents/GridConnection/AOC.GridConnection.xml
index aadf5e8c..718abdbd 100644
--- a/_alp/Agents/GridConnection/AOC.GridConnection.xml
+++ b/_alp/Agents/GridConnection/AOC.GridConnection.xml
@@ -71,7 +71,10 @@ v_liveData.assetsMetaData = v_liveAssetsMetaData;
fm_currentProductionFlows_kW = new J_FlowsMap();
fm_currentConsumptionFlows_kW = new J_FlowsMap();
fm_currentBalanceFlows_kW = new J_FlowsMap();
-fm_currentAssetFlows_kW = new J_ValueMap(OL_AssetFlowCategories.class);]]>
+fm_currentAssetFlows_kW = new J_ValueMap(OL_AssetFlowCategories.class);
+
+fm_consumptionForHeating_kW = new J_FlowsMap();
+fm_heatFromEnergyCarrier_kW = new J_FlowsMap();]]>
false
1658499438201
diff --git a/_alp/Agents/GridConnection/Code/Functions.java b/_alp/Agents/GridConnection/Code/Functions.java
index 9ac664ae..596e5b55 100644
--- a/_alp/Agents/GridConnection/Code/Functions.java
+++ b/_alp/Agents/GridConnection/Code/Functions.java
@@ -149,6 +149,9 @@
fm_currentBalanceFlows_kW.clear();
fm_currentAssetFlows_kW.clear();
+fm_heatFromEnergyCarrier_kW.clear();
+fm_consumptionForHeating_kW.clear();
+
v_currentPrimaryEnergyProduction_kW = 0;
v_currentFinalEnergyConsumption_kW = 0;
@@ -201,6 +204,8 @@
fm_currentProductionFlows_kW.clear();
fm_currentConsumptionFlows_kW.clear();
fm_currentBalanceFlows_kW.clear();
+fm_heatFromEnergyCarrier_kW.clear();
+fm_consumptionForHeating_kW.clear();
//fm_currentAssetFlows_kW.clear(); // Why not this one??
v_previousPowerElectricity_kW = 0;
@@ -1060,6 +1065,8 @@ else if (flowsMap.get(EC) > 0){
v_rapidRunData.addTimeStep(fm_currentBalanceFlows_kW,
fm_currentConsumptionFlows_kW,
fm_currentProductionFlows_kW,
+ fm_heatFromEnergyCarrier_kW,
+ fm_consumptionForHeating_kW,
fm_currentAssetFlows_kW,
v_currentPrimaryEnergyProduction_kW,
v_currentFinalEnergyConsumption_kW,
@@ -1108,7 +1115,9 @@ else if (flowsMap.get(EC) > 0){
fm_currentConsumptionFlows_kW.clear();
fm_currentBalanceFlows_kW.clear();
fm_currentAssetFlows_kW.clear();
-
+ fm_heatFromEnergyCarrier_kW.clear();
+ fm_consumptionForHeating_kW.clear();
+
v_previousPowerElectricity_kW = 0;
v_previousPowerHeat_kW = 0;
diff --git a/_alp/Agents/GridConnection/Variables.xml b/_alp/Agents/GridConnection/Variables.xml
index 68459047..1fd7c9cb 100644
--- a/_alp/Agents/GridConnection/Variables.xml
+++ b/_alp/Agents/GridConnection/Variables.xml
@@ -625,6 +625,44 @@
+
+ 1764770171693
+
+ 30
+ 960
+
+ false
+ true
+ true
+
+
+
+
+
+ 1764770205588
+
+ 30
+ 940
+
+ false
+ true
+ true
+
+
+
+
1658500465208
diff --git a/_alp/Classes/Class.J_EABuilding.java b/_alp/Classes/Class.J_EABuilding.java
index c17188bd..601d0c9a 100644
--- a/_alp/Classes/Class.J_EABuilding.java
+++ b/_alp/Classes/Class.J_EABuilding.java
@@ -49,6 +49,7 @@ public J_EABuilding(Agent parentAgent, double capacityHeat_kW, double lossFactor
this.activeProductionEnergyCarriers.add(OL_EnergyCarriers.HEAT);
this.activeConsumptionEnergyCarriers.add(OL_EnergyCarriers.HEAT);
+ this.assetFlowCategory = OL_AssetFlowCategories.buildingHeating_kW;
registerEnergyAsset();
}
@@ -154,7 +155,9 @@ public void operate(double ratioOfChargeCapacity_r) {
/*if (Double.isNaN(this.energyUse_kW)) {
throw new RuntimeException("Building thermal model energyUse_kW is NaN!");
}*/
-
+ if (this.assetFlowCategory != null) {
+ assetFlowsMap.put(this.assetFlowCategory, inputPower_kW);
+ }
}
diff --git a/_alp/Classes/Class.J_EAConsumption.java b/_alp/Classes/Class.J_EAConsumption.java
index d7af09dc..d1f6b353 100644
--- a/_alp/Classes/Class.J_EAConsumption.java
+++ b/_alp/Classes/Class.J_EAConsumption.java
@@ -35,12 +35,24 @@ public J_EAConsumption(Agent parentAgent, OL_EnergyAssetType type, String name,
profilePointer = profile;
}
this.activeConsumptionEnergyCarriers.add(this.energyCarrier);
- if (this.energyAssetType == OL_EnergyAssetType.ELECTRIC_HOB) {
- this.assetFlowCategory = OL_AssetFlowCategories.electricHobConsumption_kW; //
+
+ if (this.energyCarrier == OL_EnergyCarriers.ELECTRICITY) {
+ if (this.energyAssetType == OL_EnergyAssetType.ELECTRIC_HOB) {
+ this.assetFlowCategory = OL_AssetFlowCategories.electricHobConsumption_kW; //
+ }
+ else {
+ this.assetFlowCategory = OL_AssetFlowCategories.fixedConsumptionElectric_kW; //
+ }
}
- else if (this.energyCarrier == OL_EnergyCarriers.ELECTRICITY) {
- this.assetFlowCategory = OL_AssetFlowCategories.fixedConsumptionElectric_kW; //
+ else if (this.energyCarrier == OL_EnergyCarriers.HEAT) {
+ if (this.energyAssetType == OL_EnergyAssetType.HOT_WATER_CONSUMPTION) {
+ this.assetFlowCategory = OL_AssetFlowCategories.hotWaterConsumption_kW;
+ }
+ else {
+ this.assetFlowCategory = OL_AssetFlowCategories.spaceHeating_kW;
+ }
}
+
registerEnergyAsset();
}
diff --git a/_alp/Classes/Class.J_EAConversionElectricHeater.java b/_alp/Classes/Class.J_EAConversionElectricHeater.java
index 69c3f2cc..e164a85f 100644
--- a/_alp/Classes/Class.J_EAConversionElectricHeater.java
+++ b/_alp/Classes/Class.J_EAConversionElectricHeater.java
@@ -27,6 +27,13 @@ public J_EAConversionElectricHeater(Agent parentAgent, double outputHeatCapacity
registerEnergyAsset();
}
+ @Override
+ public void operate(double ratioOfCapacity) {
+ ((GridConnection)this.parentAgent).fm_heatFromEnergyCarrier_kW.addFlow(this.energyCarrierConsumed, ratioOfCapacity * this.outputCapacity_kW);
+ ((GridConnection)this.parentAgent).fm_consumptionForHeating_kW.addFlow(this.energyCarrierConsumed, ratioOfCapacity * this.inputCapacity_kW);
+ super.operate(ratioOfCapacity);
+ }
+
@Override
public double getCurrentTemperature() {
return outputTemperature_degC;
diff --git a/_alp/Classes/Class.J_EAConversionGasBurner.java b/_alp/Classes/Class.J_EAConversionGasBurner.java
index 0bd6d780..e678ea7c 100644
--- a/_alp/Classes/Class.J_EAConversionGasBurner.java
+++ b/_alp/Classes/Class.J_EAConversionGasBurner.java
@@ -38,6 +38,13 @@ public J_EAConversionGasBurner(Agent parentAgent, double outputHeatCapacity_kW,
registerEnergyAsset();
}
+ @Override
+ public void operate(double ratioOfCapacity) {
+ ((GridConnection)this.parentAgent).fm_heatFromEnergyCarrier_kW.addFlow(this.energyCarrierConsumed, ratioOfCapacity * this.outputCapacity_kW);
+ ((GridConnection)this.parentAgent).fm_consumptionForHeating_kW.addFlow(this.energyCarrierConsumed, ratioOfCapacity * this.inputCapacity_kW);
+ super.operate(ratioOfCapacity);
+ }
+
@Override
public double getCurrentTemperature() {
return outputTemperature_degC;
diff --git a/_alp/Classes/Class.J_EAConversionHydrogenBurner.java b/_alp/Classes/Class.J_EAConversionHydrogenBurner.java
index a342ab22..77e0cf75 100644
--- a/_alp/Classes/Class.J_EAConversionHydrogenBurner.java
+++ b/_alp/Classes/Class.J_EAConversionHydrogenBurner.java
@@ -30,7 +30,14 @@ public J_EAConversionHydrogenBurner(Agent parentAgent, double outputHeatCapacity
this.activeConsumptionEnergyCarriers.add(this.energyCarrierConsumed);
registerEnergyAsset();
}
-
+
+ @Override
+ public void operate(double ratioOfCapacity) {
+ ((GridConnection)this.parentAgent).fm_heatFromEnergyCarrier_kW.addFlow(this.energyCarrierConsumed, ratioOfCapacity * this.outputCapacity_kW);
+ ((GridConnection)this.parentAgent).fm_consumptionForHeating_kW.addFlow(this.energyCarrierConsumed, ratioOfCapacity * this.inputCapacity_kW);
+ super.operate(ratioOfCapacity);
+ }
+
@Override
public double getCurrentTemperature() {
return outputTemperature_degC;
diff --git a/_alp/Classes/Class.J_RapidRunData.java b/_alp/Classes/Class.J_RapidRunData.java
index 30d240e2..687a6962 100644
--- a/_alp/Classes/Class.J_RapidRunData.java
+++ b/_alp/Classes/Class.J_RapidRunData.java
@@ -18,8 +18,10 @@ public class J_RapidRunData {
////Full simulation
public J_AccumulatorMap am_totalBalanceAccumulators_kW = new J_AccumulatorMap(OL_EnergyCarriers.class);
+ public J_AccumulatorMap am_totalHeatFromEnergyCarrier_kW = new J_AccumulatorMap(OL_EnergyCarriers.class); // exclusief warmtepomp
+ public J_AccumulatorMap am_totalConsumptionForHeating_kW = new J_AccumulatorMap(OL_EnergyCarriers.class); // exclusief warmtepomp
- public ZeroAccumulator acc_totalEnergyCurtailed_kW;
+ public ZeroAccumulator acc_totalEnergyCurtailed_kW;
public ZeroAccumulator acc_totalPrimaryEnergyProductionHeatpumps_kW;
public J_AccumulatorMap am_dailyAverageConsumptionAccumulators_kW = new J_AccumulatorMap(OL_EnergyCarriers.class);
@@ -35,6 +37,8 @@ public class J_RapidRunData {
////Summer week
public J_AccumulatorMap am_summerWeekBalanceAccumulators_kW = new J_AccumulatorMap(OL_EnergyCarriers.class);
+ public J_AccumulatorMap am_summerWeekHeatFromEnergyCarrier_kW = new J_AccumulatorMap(OL_EnergyCarriers.class);
+ public J_AccumulatorMap am_summerWeekConsumptionForHeating_kW = new J_AccumulatorMap(OL_EnergyCarriers.class);
public ZeroAccumulator acc_summerWeekDeliveryCapacity_kW;
public ZeroAccumulator acc_summerWeekFeedinCapacity_kW;
@@ -53,7 +57,9 @@ public class J_RapidRunData {
////Winter week
public J_AccumulatorMap am_winterWeekBalanceAccumulators_kW = new J_AccumulatorMap(OL_EnergyCarriers.class);
-
+ public J_AccumulatorMap am_winterWeekHeatFromEnergyCarrier_kW = new J_AccumulatorMap(OL_EnergyCarriers.class);
+ public J_AccumulatorMap am_winterWeekConsumptionForHeating_kW = new J_AccumulatorMap(OL_EnergyCarriers.class);
+
public ZeroAccumulator acc_winterWeekDeliveryCapacity_kW;
public ZeroAccumulator acc_winterWeekFeedinCapacity_kW;
@@ -73,6 +79,9 @@ public class J_RapidRunData {
public J_AccumulatorMap am_daytimeExports_kW = new J_AccumulatorMap(OL_EnergyCarriers.class);
public J_AccumulatorMap am_daytimeImports_kW = new J_AccumulatorMap(OL_EnergyCarriers.class);
+ public J_AccumulatorMap am_daytimeHeatFromEnergyCarrier_kW = new J_AccumulatorMap(OL_EnergyCarriers.class);
+ public J_AccumulatorMap am_daytimeConsumptionForHeating_kW = new J_AccumulatorMap(OL_EnergyCarriers.class);
+
public ZeroAccumulator acc_daytimeFinalEnergyConsumption_kW;
public ZeroAccumulator acc_daytimeEnergyProduction_kW;
public ZeroAccumulator acc_daytimeElectricityConsumption_kW;
@@ -80,16 +89,24 @@ public class J_RapidRunData {
public ZeroAccumulator acc_daytimePrimaryEnergyProductionHeatpumps_kW;
+ public J_AccumulatorMap am_assetFlowsDaytime_kW = new J_AccumulatorMap(OL_AssetFlowCategories.class);
+
//Weekend/day
public J_AccumulatorMap am_weekendExports_kW = new J_AccumulatorMap(OL_EnergyCarriers.class);
public J_AccumulatorMap am_weekendImports_kW = new J_AccumulatorMap(OL_EnergyCarriers.class);
-
+
+ public J_AccumulatorMap am_weekendHeatFromEnergyCarrier_kW = new J_AccumulatorMap(OL_EnergyCarriers.class);
+ public J_AccumulatorMap am_weekendConsumptionForHeating_kW = new J_AccumulatorMap(OL_EnergyCarriers.class);
+
public ZeroAccumulator acc_weekendElectricityConsumption_kW;
public ZeroAccumulator acc_weekendElectricityProduction_kW;
public ZeroAccumulator acc_weekendFinalEnergyConsumption_kW;
public ZeroAccumulator acc_weekendEnergyProduction_kW;
public ZeroAccumulator acc_weekendPrimaryEnergyProductionHeatpumps_kW;
+
+ public J_AccumulatorMap am_assetFlowsWeekend_kW = new J_AccumulatorMap(OL_AssetFlowCategories.class);
+
/**
@@ -126,6 +143,9 @@ public void initializeAccumulators(double simDuration_h, double timeStep_h, Enum
//========== TOTAL ACCUMULATORS ==========//
am_totalBalanceAccumulators_kW.createEmptyAccumulators( this.activeEnergyCarriers, true, 24.0, simDuration_h );
am_totalBalanceAccumulators_kW.put( OL_EnergyCarriers.ELECTRICITY, new ZeroAccumulator(true, timeStep_h, simDuration_h) );
+ am_totalHeatFromEnergyCarrier_kW.createEmptyAccumulators( this.activeEnergyCarriers, false, timeStep_h, simDuration_h);
+ am_totalConsumptionForHeating_kW.createEmptyAccumulators( this.activeEnergyCarriers, false, timeStep_h, simDuration_h);
+
am_dailyAverageConsumptionAccumulators_kW.createEmptyAccumulators(this.activeConsumptionEnergyCarriers, true, 24.0, simDuration_h);
am_dailyAverageProductionAccumulators_kW.createEmptyAccumulators(this.activeProductionEnergyCarriers, true, 24.0, simDuration_h);
@@ -157,7 +177,10 @@ public void initializeAccumulators(double simDuration_h, double timeStep_h, Enum
am_summerWeekBalanceAccumulators_kW.createEmptyAccumulators(this.activeEnergyCarriers, true, timeStep_h, 168.0);
am_summerWeekConsumptionAccumulators_kW.createEmptyAccumulators(this.activeConsumptionEnergyCarriers, true, timeStep_h, 168.0);
am_summerWeekProductionAccumulators_kW.createEmptyAccumulators(this.activeProductionEnergyCarriers, true, timeStep_h, 168.0);
-
+
+ am_summerWeekHeatFromEnergyCarrier_kW.createEmptyAccumulators( this.activeEnergyCarriers, false, timeStep_h, simDuration_h);
+ am_summerWeekConsumptionForHeating_kW.createEmptyAccumulators( this.activeEnergyCarriers, false, timeStep_h, simDuration_h);
+
acc_summerWeekEnergyProduction_kW = new ZeroAccumulator(true, timeStep_h, 168.0);
acc_summerWeekFinalEnergyConsumption_kW = new ZeroAccumulator(true, timeStep_h, 168.0);
@@ -176,6 +199,9 @@ public void initializeAccumulators(double simDuration_h, double timeStep_h, Enum
am_winterWeekConsumptionAccumulators_kW.createEmptyAccumulators(this.activeConsumptionEnergyCarriers, true, timeStep_h, 168.0);
am_winterWeekProductionAccumulators_kW.createEmptyAccumulators(this.activeProductionEnergyCarriers, true, timeStep_h, 168.0);
+ am_winterWeekHeatFromEnergyCarrier_kW.createEmptyAccumulators( this.activeEnergyCarriers, false, timeStep_h, simDuration_h);
+ am_winterWeekConsumptionForHeating_kW.createEmptyAccumulators( this.activeEnergyCarriers, false, timeStep_h, simDuration_h);
+
acc_winterWeekEnergyProduction_kW = new ZeroAccumulator(true, timeStep_h, 168.0);
acc_winterWeekFinalEnergyConsumption_kW = new ZeroAccumulator(true, timeStep_h, 168.0);
@@ -192,7 +218,10 @@ public void initializeAccumulators(double simDuration_h, double timeStep_h, Enum
//========== DAYTIME ACCUMULATORS ==========//
am_daytimeImports_kW.createEmptyAccumulators( this.activeConsumptionEnergyCarriers, false, timeStep_h, 0.5 * (simDuration_h));
am_daytimeExports_kW.createEmptyAccumulators( this.activeProductionEnergyCarriers, false, timeStep_h, 0.5 * (simDuration_h));
-
+
+ am_daytimeHeatFromEnergyCarrier_kW.createEmptyAccumulators( this.activeEnergyCarriers, false, timeStep_h, simDuration_h);
+ am_daytimeConsumptionForHeating_kW.createEmptyAccumulators( this.activeEnergyCarriers, false, timeStep_h, simDuration_h);
+
acc_daytimeEnergyProduction_kW = new ZeroAccumulator(false, timeStep_h, 0.5 * (simDuration_h));
acc_daytimeFinalEnergyConsumption_kW = new ZeroAccumulator(false, timeStep_h,0.5 * (simDuration_h));
//acc_daytimeEnergyCurtailed_kW = new ZeroAccumulator(false, timeStep_h, simDuration_h);
@@ -200,11 +229,16 @@ public void initializeAccumulators(double simDuration_h, double timeStep_h, Enum
acc_daytimeElectricityConsumption_kW = new ZeroAccumulator(false, timeStep_h, 0.5 * (simDuration_h));
acc_daytimePrimaryEnergyProductionHeatpumps_kW = new ZeroAccumulator(false, timeStep_h, 0.5 * (simDuration_h));
-
+
+ am_assetFlowsDaytime_kW.createEmptyAccumulators( this.assetsMetaData.activeAssetFlows, false, timeStep_h, 0.5 * (simDuration_h));
+
//========== WEEKEND ACCUMULATORS ==========//
am_weekendImports_kW.createEmptyAccumulators( this.activeConsumptionEnergyCarriers, false, timeStep_h, 2 / 7 * (simDuration_h) + 48);
am_weekendExports_kW.createEmptyAccumulators( this.activeProductionEnergyCarriers, false, timeStep_h, 2 / 7 * (simDuration_h) + 48);
-
+
+ am_weekendHeatFromEnergyCarrier_kW.createEmptyAccumulators( this.activeEnergyCarriers, false, timeStep_h, simDuration_h);
+ am_weekendConsumptionForHeating_kW.createEmptyAccumulators( this.activeEnergyCarriers, false, timeStep_h, simDuration_h);
+
acc_weekendEnergyProduction_kW = new ZeroAccumulator(false, timeStep_h, 2 / 7 * (simDuration_h) + 48);
acc_weekendFinalEnergyConsumption_kW = new ZeroAccumulator(false, timeStep_h,2 / 7 * (simDuration_h) + 48);
//acc_weekendEnergyCurtailed_kW = new ZeroAccumulator(false, timeStep_h, simDuration_h);
@@ -212,6 +246,8 @@ public void initializeAccumulators(double simDuration_h, double timeStep_h, Enum
acc_weekendElectricityConsumption_kW = new ZeroAccumulator(false, timeStep_h, 2 / 7 * (simDuration_h) + 48);
acc_weekendPrimaryEnergyProductionHeatpumps_kW = new ZeroAccumulator(false, timeStep_h, 2 / 7 * (simDuration_h) + 48);
+
+ am_assetFlowsWeekend_kW.createEmptyAccumulators( this.assetsMetaData.activeAssetFlows, false, timeStep_h, 2 / 7 * (simDuration_h) + 48);
}
public void resetAccumulators(double simDuration_h, double timeStep_h, EnumSet v_activeEnergyCarriers, EnumSet v_activeConsumptionEnergyCarriers, EnumSet v_activeProductionEnergyCarriers) {
@@ -224,6 +260,9 @@ public void resetAccumulators(double simDuration_h, double timeStep_h, EnumSet