From 422cac35bbed4a4fb6328e96a855625ceeeeac36 Mon Sep 17 00:00:00 2001 From: Luc-Sol Date: Thu, 25 Sep 2025 15:49:04 +0200 Subject: [PATCH] No longer scale internal array of J_EAProfile --- _alp/Agents/UI_company/Levels/Level.level.xml | 6 ++---- .../Agents/tabElectricity/Code/Functions.java | 21 +++++++++---------- _alp/Agents/tabHeating/Code/Functions.java | 15 +++++++------ 3 files changed, 19 insertions(+), 23 deletions(-) diff --git a/_alp/Agents/UI_company/Levels/Level.level.xml b/_alp/Agents/UI_company/Levels/Level.level.xml index e9f4765b..7476cfa4 100644 --- a/_alp/Agents/UI_company/Levels/Level.level.xml +++ b/_alp/Agents/UI_company/Levels/Level.level.xml @@ -643,8 +643,7 @@ for (J_EA j_ea : c_ownedGridConnections.get(v_currentSelectedGCnr).c_energyAsset } if (j_ea instanceof J_EAProfile) { if (((J_EAProfile) j_ea).energyCarrier== OL_EnergyCarriers.HEAT) { - ((J_EAProfile) j_ea).resetEnergyProfile(); - ((J_EAProfile) j_ea).scaleEnergyProfile(consumptionScaling_fr); + ((J_EAProfile) j_ea).setProfileScaling_fr( consumptionScaling_fr ); } } } @@ -822,8 +821,7 @@ for (J_EA j_ea : c_ownedGridConnections.get(v_currentSelectedGCnr).c_energyAsset } if (j_ea instanceof J_EAProfile) { if (((J_EAProfile) j_ea).energyCarrier == OL_EnergyCarriers.ELECTRICITY) { - ((J_EAProfile) j_ea).resetEnergyProfile(); - ((J_EAProfile) j_ea).scaleEnergyProfile(consumptionScaling_fr); + ((J_EAProfile) j_ea).setProfileScaling_fr( consumptionScaling_fr ); } } } diff --git a/_alp/Agents/tabElectricity/Code/Functions.java b/_alp/Agents/tabElectricity/Code/Functions.java index b3e309c6..bb1dfe5e 100644 --- a/_alp/Agents/tabElectricity/Code/Functions.java +++ b/_alp/Agents/tabElectricity/Code/Functions.java @@ -136,8 +136,7 @@ // Set Profile Assets for (J_EAProfile j_ea : gc.c_profileAssets) { if (j_ea.energyCarrier == OL_EnergyCarriers.ELECTRICITY) { - j_ea.resetEnergyProfile(); - j_ea.scaleEnergyProfile( scalingFactor ); + j_ea.setProfileScaling_fr( scalingFactor ); } } @@ -484,9 +483,9 @@ else if(gr_electricitySliders_residential.isVisible()){ List profileEAs = findAll(GC.c_profileAssets, profile -> profile.assetFlowCategory == OL_AssetFlowCategories.fixedConsumptionElectric_kW); List consumptionEAs = findAll(GC.c_consumptionAssets, consumption -> consumption.assetFlowCategory == OL_AssetFlowCategories.fixedConsumptionElectric_kW); for(J_EAProfile profileEA : profileEAs){ - double currentTotalEnergyConsumption_kWh = ZeroMath.arraySum(profileEA.a_energyProfile_kWh); - totalBaseConsumption_kWh += currentTotalEnergyConsumption_kWh/profileEA.getProfileScaling_fr(); - totalSavedConsumption_kWh += currentTotalEnergyConsumption_kWh/profileEA.getProfileScaling_fr() - currentTotalEnergyConsumption_kWh; + double baseConsumption_kWh = ZeroMath.arraySum(profileEA.a_energyProfile_kWh); + totalBaseConsumption_kWh += baseConsumption_kWh; + totalSavedConsumption_kWh += (1 - profileEA.getProfileScaling_fr()) * baseConsumption_kWh; } for(J_EAConsumption consumptionEA : consumptionEAs){ totalBaseConsumption_kWh += consumptionEA.yearlyDemand_kWh; @@ -602,9 +601,9 @@ else if(GC instanceof GCGridBattery){ List profileEAs = findAll(GC.c_profileAssets, profile -> profile.assetFlowCategory == OL_AssetFlowCategories.fixedConsumptionElectric_kW); List consumptionEAs = findAll(GC.c_consumptionAssets, consumption -> consumption.assetFlowCategory == OL_AssetFlowCategories.fixedConsumptionElectric_kW); for(J_EAProfile profileEA : profileEAs){ - double currentTotalEnergyConsumption_kWh = ZeroMath.arraySum(profileEA.a_energyProfile_kWh); - totalBaseConsumption_kWh += currentTotalEnergyConsumption_kWh/profileEA.getProfileScaling_fr(); - totalSavedConsumption_kWh += currentTotalEnergyConsumption_kWh/profileEA.getProfileScaling_fr() - currentTotalEnergyConsumption_kWh; + double baseConsumption_kWh = ZeroMath.arraySum(profileEA.a_energyProfile_kWh); + totalBaseConsumption_kWh += baseConsumption_kWh; + totalSavedConsumption_kWh += (1 - profileEA.getProfileScaling_fr()) * baseConsumption_kWh; } for(J_EAConsumption consumptionEA : consumptionEAs){ totalBaseConsumption_kWh += consumptionEA.yearlyDemand_kWh; @@ -641,9 +640,9 @@ else if(GC instanceof GCGridBattery){ List profileEAs = findAll(GC.c_profileAssets, profile -> profile.assetFlowCategory == OL_AssetFlowCategories.fixedConsumptionElectric_kW); List consumptionEAs = findAll(GC.c_consumptionAssets, consumption -> consumption.assetFlowCategory == OL_AssetFlowCategories.fixedConsumptionElectric_kW); for(J_EAProfile profileEA : profileEAs){ - double currentTotalEnergyConsumption_kWh = ZeroMath.arraySum(profileEA.a_energyProfile_kWh); - totalBaseConsumption_kWh += currentTotalEnergyConsumption_kWh/profileEA.getProfileScaling_fr(); - totalSavedConsumption_kWh += currentTotalEnergyConsumption_kWh/profileEA.getProfileScaling_fr() - currentTotalEnergyConsumption_kWh; + double baseConsumption_kWh = ZeroMath.arraySum(profileEA.a_energyProfile_kWh); + totalBaseConsumption_kWh += baseConsumption_kWh; + totalSavedConsumption_kWh += (1 - profileEA.getProfileScaling_fr()) * baseConsumption_kWh; } for(J_EAConsumption consumptionEA : consumptionEAs){ totalBaseConsumption_kWh += consumptionEA.yearlyDemand_kWh; diff --git a/_alp/Agents/tabHeating/Code/Functions.java b/_alp/Agents/tabHeating/Code/Functions.java index f9f9fc52..55274c18 100644 --- a/_alp/Agents/tabHeating/Code/Functions.java +++ b/_alp/Agents/tabHeating/Code/Functions.java @@ -116,8 +116,7 @@ int f_setHeatingSystemsCompanies(List gcList,ShapeSlider sliderGasbur // Set Profile Assets for (J_EAProfile j_ea : gc.c_profileAssets) { if (j_ea.energyCarrier == OL_EnergyCarriers.HEAT) { - j_ea.resetEnergyProfile(); - j_ea.scaleEnergyProfile( scalingFactor ); + j_ea.setProfileScaling_fr( scalingFactor ); } } @@ -676,9 +675,9 @@ else if(gr_heatingSliders_residential.isVisible()){ List profileEAs = findAll(GC.c_profileAssets, profile -> profile.getEnergyCarrier() == OL_EnergyCarriers.HEAT); List consumptionEAs = findAll(GC.c_consumptionAssets, consumption -> consumption.getActiveEnergyCarriers().contains(OL_EnergyCarriers.HEAT)); for(J_EAProfile profileEA : profileEAs){ - double currentTotalEnergyConsumption_kWh = ZeroMath.arraySum(profileEA.a_energyProfile_kWh); - totalBaseConsumption_kWh += currentTotalEnergyConsumption_kWh/profileEA.getProfileScaling_fr(); - totalSavedConsumption_kWh += currentTotalEnergyConsumption_kWh/profileEA.getProfileScaling_fr() - currentTotalEnergyConsumption_kWh; + double baseConsumption_kWh = ZeroMath.arraySum(profileEA.a_energyProfile_kWh); + totalBaseConsumption_kWh += baseConsumption_kWh; + totalSavedConsumption_kWh += (1 - profileEA.getProfileScaling_fr()) * baseConsumption_kWh; } for(J_EAConsumption consumptionEA : consumptionEAs){ totalBaseConsumption_kWh += consumptionEA.yearlyDemand_kWh; @@ -752,9 +751,9 @@ else if(gr_heatingSliders_residential.isVisible()){ List profileEAs = findAll(GC.c_profileAssets, profile -> profile.getEnergyCarrier() == OL_EnergyCarriers.HEAT); // FIX FOR HOT WATER/PT IN LONG RUN List consumptionEAs = findAll(GC.c_consumptionAssets, consumption -> consumption.energyAssetType == OL_EnergyAssetType.HEAT_DEMAND); for(J_EAProfile profileEA : profileEAs){ - double currentTotalEnergyConsumption_kWh = ZeroMath.arraySum(profileEA.a_energyProfile_kWh); - totalBaseConsumption_kWh += currentTotalEnergyConsumption_kWh/profileEA.getProfileScaling_fr(); - totalSavedConsumption_kWh += currentTotalEnergyConsumption_kWh/profileEA.getProfileScaling_fr() - currentTotalEnergyConsumption_kWh; + double baseConsumption_kWh = ZeroMath.arraySum(profileEA.a_energyProfile_kWh); + totalBaseConsumption_kWh += baseConsumption_kWh; + totalSavedConsumption_kWh += (1 - profileEA.getProfileScaling_fr()) * baseConsumption_kWh; } for(J_EAConsumption consumptionEA : consumptionEAs){ totalBaseConsumption_kWh += consumptionEA.yearlyDemand_kWh;