Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion _alp/Agents/EnergyCoop/Code/Functions.java
Original file line number Diff line number Diff line change
Expand Up @@ -1175,7 +1175,13 @@
//Collect live datasets
f_collectGridConnectionLiveData();

if(energyModel.v_rapidRunData != null){
boolean allGCHaveRapidRun = true;
for(GridConnection GC : c_memberGridConnections){
if(GC.v_rapidRunData == null){
allGCHaveRapidRun = false;
}
}
if(allGCHaveRapidRun){
//Create rapid run data class used to collect rapid run data of other gc
v_rapidRunData = new J_RapidRunData(this);
v_rapidRunData.initializeAccumulators(energyModel.p_runEndTime_h - energyModel.p_runStartTime_h, energyModel.p_timeStep_h, EnumSet.copyOf(v_activeEnergyCarriers), EnumSet.copyOf(v_activeConsumptionEnergyCarriers), EnumSet.copyOf(v_activeProductionEnergyCarriers));
Expand Down
8 changes: 8 additions & 0 deletions _alp/Agents/GridConnection/Code/Functions.java
Original file line number Diff line number Diff line change
Expand Up @@ -2543,6 +2543,7 @@ else if (flowsMap.get(EC) > 0){
f_nfatoSetConnectionCapacity(false);

v_liveAssetsMetaData.updateActiveAssetData(new ArrayList<>(List.of(this)));

// update GN parents' wind / solar totals (will be wrong if you changed your totals while paused)
l_parentNodeElectric.getConnectedAgent().f_updateTotalInstalledProductionAssets(OL_EnergyAssetType.PHOTOVOLTAIC, v_liveAssetsMetaData.totalInstalledPVPower_kW, true);
l_parentNodeElectric.getConnectedAgent().f_updateTotalInstalledProductionAssets(OL_EnergyAssetType.WINDMILL, v_liveAssetsMetaData.totalInstalledWindPower_kW, true);
Expand All @@ -2555,6 +2556,13 @@ else if (flowsMap.get(EC) > 0){
coop.v_liveAssetsMetaData.totalInstalledWindPower_kW += v_liveAssetsMetaData.totalInstalledWindPower_kW;
coop.v_liveAssetsMetaData.totalInstalledBatteryStorageCapacity_MWh += v_liveAssetsMetaData.totalInstalledBatteryStorageCapacity_MWh;
}


//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);

}

//Update the 'isActive' variable
Expand Down
40 changes: 40 additions & 0 deletions _alp/Classes/Class.J_LiveData.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,46 @@ public J_LiveData(Agent parentAgent) {
this.parentAgent = parentAgent;
}

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 (double t = startTime; t <= endTime; t += timeStep_h) {
data_baseloadElectricityDemand_kW.add( t, 0);
data_hydrogenElectricityDemand_kW.add( t, 0);
data_heatPumpElectricityDemand_kW.add( t, 0);
data_electricVehicleDemand_kW.add( t, 0);
data_batteryCharging_kW.add( t, 0);
data_PVGeneration_kW.add( t, 0);
data_windGeneration_kW.add( t, 0);
data_batteryDischarging_kW.add( t, 0);
data_V2GSupply_kW.add( t, 0);
data_CHPElectricityProductionLiveWeek_kW.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_cookingElectricityDemand_kW.add( t, 0);
data_districtHeatDelivery_kW.add( t, 0);
data_batteryStoredEnergyLiveWeek_MWh.add( t, 0);
data_batterySOC_fr.add( t, 0);
}
}

public String toString() {
return super.toString();
}
Expand Down