diff --git a/Zero_engine.alpx b/Zero_engine.alpx index f0ee1273..1b452e7b 100644 --- a/Zero_engine.alpx +++ b/Zero_engine.alpx @@ -1252,6 +1252,62 @@ + + 1753968826411 + + + + + + + + + + + + + + + @@ -1505,6 +1561,7 @@ 1671107396262 + true 1752677832758 @@ -1611,7 +1668,8 @@ 1729510354900 - + + true 1752679379816 @@ -1755,6 +1813,8 @@ 1753106536266 + true + 1752679379816 1753199813037 @@ -1796,6 +1856,16 @@ 1753342021373 + + 1753968339982 + + 1752679379816 + + + 1754038055004 + + 1752679379816 + 1754405220949 diff --git a/_alp/Agents/EnergyCoop/Code/Functions.java b/_alp/Agents/EnergyCoop/Code/Functions.java index 60448c50..70f005c4 100644 --- a/_alp/Agents/EnergyCoop/Code/Functions.java +++ b/_alp/Agents/EnergyCoop/Code/Functions.java @@ -176,26 +176,28 @@ 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; -v_assetFlows.reset(); for(GridConnection gc : c_memberGridConnections) { // 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_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); - v_assetFlows.addFlows(gc.v_assetFlows); + } // gather electricity flows @@ -206,15 +208,16 @@ 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_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); + //v_assetFlows.addFlows(EC.v_assetFlows); } } @@ -224,6 +227,7 @@ 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); @@ -238,7 +242,7 @@ 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; } @@ -589,6 +593,7 @@ //========== LIVE WEEK DATASETS ==========// v_liveData.dsm_liveDemand_kW.createEmptyDataSets(v_activeConsumptionEnergyCarriers, roundToInt(168/energyModel.p_timeStep_h)); v_liveData.dsm_liveSupply_kW.createEmptyDataSets(v_activeProductionEnergyCarriers, roundToInt(168/energyModel.p_timeStep_h)); +v_liveData.dsm_liveAssetFlows_kW.createEmptyDataSets(v_liveData.assetsMetaData.activeAssetFlows, (int)(168 / energyModel.p_timeStep_h)); // Initializing Live Data Class v_liveAssetsMetaData.updateActiveAssetData(new ArrayList<>(f_getAllChildMemberGridConnections())); @@ -768,11 +773,12 @@ 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_assetFlows + v_batteryStoredEnergy_kWh/1000 ); /* //Current timestep @@ -1121,7 +1127,7 @@ f_getTotalInstalledCapacityOfAssets_rapidRun(); //Recalculate SOC ts for energycoop -f_recalculateSOC_rapidrun(); +//f_recalculateSOC_rapidrun(); /*ALCODEEND*/} @@ -1309,6 +1315,11 @@ HashSet f_getAllChildCustomerGridConnections_recursion(HashSet f_getAllChildCustomerGridConnections_recursion(HashSet f_getAllChildCustomerGridConnections_recursion(HashSet fm_currentAssetFlows_kW = new J_ValueMap(OL_AssetFlowCategories.class); double electricityDemandCapacityLiveWeek_kW = 0; double electricitySupplyCapacityLiveWeek_kW = 0; double netLoadLiveWeek_kW = 0; - - double baseloadElectricityDemandLiveWeek_kW = 0; - double electricityForHeatDemandLiveWeek_kW = 0; - double electricityForTransportDemandLiveWeek_kW = 0; - double petroleumProductsDemandLiveWeek_kW = 0; - double naturalGasDemandLiveWeek_kW = 0; - double electricityForStorageDemandLiveWeek_kW = 0; - double electricityForHydrogenDemandLiveWeek_kW = 0; - double electricityForCookingConsumptionLiveWeek_kW = 0; - + double districtHeatingDemandLiveWeek_kW = 0; // Supply J_FlowsMap fm_supply_kW = new J_FlowsMap(); - double PVElectricitySupplyLiveWeek_kW = 0; - double windElectricitySupplyLiveWeek_kW = 0; - double PTHeatSupplyLiveWeek_kW = 0; - double storageElectricitySupplyLiveWeek_kW = 0; - double V2GElectricitySupplyLiveWeek_kW = 0; - double hydrogenSupplyLiveWeek_kW = 0; - double CHPElectricitySupplyLiveWeek_kW = 0; - //Other double batteryStoredEnergyLiveWeek_MWh = 0; for (GridConnection gc : gcList){ for (OL_EnergyCarriers EC_consumption : gc.v_activeConsumptionEnergyCarriers) { - fm_demand_kW.addFlow( EC_consumption, gc.v_liveData.dsm_liveDemand_kW.get(EC_consumption).getY(i)); + fm_demand_kW.addFlow( EC_consumption, gc.v_liveData.dsm_liveDemand_kW.get(EC_consumption).getY(i)); } for (OL_EnergyCarriers EC_production : gc.v_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); - - baseloadElectricityDemandLiveWeek_kW += gc.v_liveData.data_baseloadElectricityDemand_kW.getY(i); - electricityForHeatDemandLiveWeek_kW += gc.v_liveData.data_heatPumpElectricityDemand_kW.getY(i); - electricityForTransportDemandLiveWeek_kW += gc.v_liveData.data_electricVehicleDemand_kW.getY(i); - electricityForStorageDemandLiveWeek_kW += gc.v_liveData.data_batteryCharging_kW.getY(i); - electricityForHydrogenDemandLiveWeek_kW += gc.v_liveData.data_hydrogenElectricityDemand_kW.getY(i); - electricityForCookingConsumptionLiveWeek_kW += gc.v_liveData.data_cookingElectricityDemand_kW.getY(i); - districtHeatingDemandLiveWeek_kW += gc.v_liveData.data_districtHeatDelivery_kW.getY(i); - - // Supply - windElectricitySupplyLiveWeek_kW += gc.v_liveData.data_windGeneration_kW.getY(i); - PVElectricitySupplyLiveWeek_kW += gc.v_liveData.data_PVGeneration_kW.getY(i); - PTHeatSupplyLiveWeek_kW += gc.v_liveData.data_PTGeneration_kW.getY(i); - storageElectricitySupplyLiveWeek_kW += gc.v_liveData.data_batteryDischarging_kW.getY(i); - V2GElectricitySupplyLiveWeek_kW += gc.v_liveData.data_V2GSupply_kW.getY(i); - CHPElectricitySupplyLiveWeek_kW += gc.v_liveData.data_CHPElectricityProductionLiveWeek_kW.getY(i); - + //Other batteryStoredEnergyLiveWeek_MWh += gc.v_liveData.data_batteryStoredEnergyLiveWeek_MWh.getY(i); } @@ -1438,27 +1421,14 @@ HashSet f_getAllChildCustomerGridConnections_recursion(HashSet f_getAllChildCustomerGridConnections_recursion(HashSet f_getAllChildCustomerGridConnections_recursion(HashSet f_getAllChildCustomerGridConnections_recursion(HashSetdouble 1744211126429 + true 1010 270