diff --git a/_alp/Agents/UI_EnergyHub/Code/Functions.java b/_alp/Agents/UI_EnergyHub/Code/Functions.java index a4787d30..60e55a79 100644 --- a/_alp/Agents/UI_EnergyHub/Code/Functions.java +++ b/_alp/Agents/UI_EnergyHub/Code/Functions.java @@ -263,10 +263,10 @@ else if (members.size() > 8) { f_reconstructGIS_Objects(deserializedEnergyModel, saveObject.c_GISObjects); // Get profilePointer tableFunctions from 'original' energyModel - deserializedEnergyModel.c_profiles.forEach(x->{ + /* deserializedEnergyModel.c_profiles.forEach(x->{ J_ProfilePointer origProfile = zero_Interface.energyModel.f_findProfile(x.name); x.setTableFunction(origProfile.getTableFunction()); - }); + }); */ // get heatingTypeHashmap from 'old' energyModel. deserializedEnergyModel.c_defaultHeatingStrategies = zero_Interface.energyModel.c_defaultHeatingStrategies; diff --git a/_alp/Agents/UI_company/Code/Functions.java b/_alp/Agents/UI_company/Code/Functions.java index c7d50a22..b35a478d 100644 --- a/_alp/Agents/UI_company/Code/Functions.java +++ b/_alp/Agents/UI_company/Code/Functions.java @@ -243,14 +243,14 @@ //Check heating demand asset is null (shouldnt be possible) if (heatDemandAsset != null){ - capacityThermal_kW = heatDemandAsset.yearlyDemand_kWh/8760*10; // --> average hourly consumption * 10 --> to always have enough capacity + capacityThermal_kW = heatDemandAsset.getBaseConsumption_kWh()/8760*10; // --> average hourly consumption * 10 --> to always have enough capacity } else{ //Select profile heat demand asset - J_EAProfile heatDemandAsset_Profile = findFirst(GC.c_profileAssets, j_ea->j_ea.energyCarrier == OL_EnergyCarriers.HEAT); + J_EAProfile heatDemandAsset_Profile = findFirst(GC.c_profileAssets, j_ea->j_ea.getEnergyCarrier() == OL_EnergyCarriers.HEAT); if(heatDemandAsset_Profile != null){ - capacityThermal_kW = heatDemandAsset_Profile.getProfileScaling_fr() * max(heatDemandAsset_Profile.a_energyProfile_kWh)*4; + capacityThermal_kW = heatDemandAsset_Profile.getPeakConsumptionPower_kW();//heatDemandAsset_Profile.getProfileScaling_fr() * max(heatDemandAsset_Profile.a_energyProfile_kWh)*4; } else{ traceln("No heating demand asset found for GC:" + GC.p_gridConnectionID); @@ -1600,7 +1600,7 @@ else if(setAmountOfVehicles < local_HydrogenV_nb){ // Slider has decreased the a currentHeatSavings = roundToInt((consumptionEAHEAT.getConsumptionScaling_fr() - 1)*-100); } else{ - J_EAProfile profileEAHEAT = findFirst(p_gridConnection.c_profileAssets, profileAsset -> profileAsset.energyCarrier == OL_EnergyCarriers.HEAT); + J_EAProfile profileEAHEAT = findFirst(p_gridConnection.c_profileAssets, profileAsset -> profileAsset.getEnergyCarrier() == OL_EnergyCarriers.HEAT); if (profileEAHEAT != null){ currentHeatSavings = roundToInt((profileEAHEAT.getProfileScaling_fr() - 1)*-100); } diff --git a/_alp/Agents/UI_company/Levels/Level.level.xml b/_alp/Agents/UI_company/Levels/Level.level.xml index 1db3938a..28b5fe67 100644 --- a/_alp/Agents/UI_company/Levels/Level.level.xml +++ b/_alp/Agents/UI_company/Levels/Level.level.xml @@ -640,9 +640,8 @@ for (J_EA j_ea : p_gridConnection.c_energyAssets){ if (j_ea.getEAType() == OL_EnergyAssetType.HEAT_DEMAND) { ((J_EAConsumption)j_ea).setConsumptionScaling_fr(consumptionScaling_fr); } - } - if (j_ea instanceof J_EAProfile) { - if (((J_EAProfile) j_ea).energyCarrier== OL_EnergyCarriers.HEAT) { + } else if (j_ea instanceof J_EAProfile && !(j_ea instanceof J_EAProduction)) { + if (((J_EAProfile) j_ea).getEnergyCarrier()== OL_EnergyCarriers.HEAT) { ((J_EAProfile) j_ea).setProfileScaling_fr( consumptionScaling_fr ); } } @@ -818,9 +817,8 @@ for (J_EA j_ea : p_gridConnection.c_energyAssets) { if (j_ea.getEAType() == OL_EnergyAssetType.ELECTRICITY_DEMAND) { ((J_EAConsumption)j_ea).setConsumptionScaling_fr(consumptionScaling_fr); } - } - if (j_ea instanceof J_EAProfile) { - if (((J_EAProfile) j_ea).energyCarrier == OL_EnergyCarriers.ELECTRICITY) { + } else if (j_ea instanceof J_EAProfile && !(j_ea instanceof J_EAProduction)) { + if (((J_EAProfile) j_ea).getEnergyCarrier() == OL_EnergyCarriers.ELECTRICITY) { ((J_EAProfile) j_ea).setProfileScaling_fr( consumptionScaling_fr ); } } diff --git a/_alp/Agents/Zero_Interface/Code/Functions.java b/_alp/Agents/Zero_Interface/Code/Functions.java index eb2252b7..5e453537 100644 --- a/_alp/Agents/Zero_Interface/Code/Functions.java +++ b/_alp/Agents/Zero_Interface/Code/Functions.java @@ -720,7 +720,7 @@ public void write(int b) { else{ for ( J_EAConsumption consumptionAsset : gc.c_consumptionAssets){ if( consumptionAsset.getEAType() == OL_EnergyAssetType.ELECTRICITY_DEMAND ){ - yearlyElectricityConsumption_kWh += consumptionAsset.yearlyDemand_kWh; + yearlyElectricityConsumption_kWh += consumptionAsset.getBaseConsumption_kWh(); } } } diff --git a/_alp/Agents/Zero_Loader/Code/Functions.java b/_alp/Agents/Zero_Loader/Code/Functions.java index 13fd473d..808ffd00 100644 --- a/_alp/Agents/Zero_Loader/Code/Functions.java +++ b/_alp/Agents/Zero_Loader/Code/Functions.java @@ -1649,14 +1649,6 @@ else if (vehicle_type == OL_EnergyAssetType.HYDROGEN_VAN){ } /*ALCODEEND*/} -double f_addChargingDemandProfile(GCPublicCharger GC,String profileName) -{/*ALCODESTART::1726584205845*/ -J_EAProfile profile = new J_EAProfile(GC, OL_EnergyCarriers.ELECTRICITY, null, OL_AssetFlowCategories.evChargingPower_kW, energyModel.p_timeParameters.getTimeStep_h(), energyModel.p_timeParameters); -profile.setEnergyAssetName("charging profile"); -List quarterlyEnergyDemand_kWh = selectValues(double.class, "SELECT " + profileName + " FROM charging_profiles;"); -profile.a_energyProfile_kWh = quarterlyEnergyDemand_kWh.stream().mapToDouble(d -> max(0,d)).map( d -> d / 4).toArray(); -/*ALCODEEND*/} - String f_createChargerPolygon(double lat,double lon) {/*ALCODESTART::1726584205847*/ //Create shape coords and polygon string, that matches output of QGIS: Polygon(lon,lat,lon,lat, etc.) @@ -1855,29 +1847,30 @@ String f_createChargerPolygon(double lat,double lon) double f_createPreprocessedElectricityProfile_PV(GridConnection parentGC,double[] yearlyElectricityDelivery_kWh,double[] yearlyElectricityFeedin_kWh,double[] yearlyElectricityProduction_kWh,Double pvPower_kW,double[] yearlyHeatPumpElectricityConsumption_kWh) {/*ALCODESTART::1726584205861*/ -//Create the profile -J_EAProfile profile = new J_EAProfile(parentGC, OL_EnergyCarriers.ELECTRICITY, null, OL_AssetFlowCategories.fixedConsumptionElectric_kW, energyModel.p_timeParameters.getTimeStep_h(), energyModel.p_timeParameters); -profile.setStartTime_h(energyModel.p_timeParameters.getRunStartTime_h()); -profile.setEnergyAssetName(parentGC.p_ownerID + " custom profile"); double extraConsumption_kWh = 0; //Initialize parameters double nettDelivery_kWh; +double[] yearlyElectricityConsumption_kWh = new double[yearlyElectricityDelivery_kWh.length]; +double[] timeAxis_h = new double[yearlyElectricityDelivery_kWh.length]; +for (int i = 0; i 0) { // When only delivery, feedin profiles are available, in addition to PV power, make explicit consumption and production arrays using delivery profile and PV installed power [kW] - double[] yearlyElectricityConsumption_kWh = new double[yearlyElectricityDelivery_kWh.length]; + if (yearlyElectricityFeedin_kWh != null) { // Terugleveringsdata beschikbaar //traceln("Estimating electricity consumption based on delivery and feedin profiles with pv power estimate for company %s with %s kWp PV", parentGC.p_gridConnectionID, pvPower_kW); double addedConsumption_kWh = 0; @@ -1908,10 +1901,10 @@ String f_createChargerPolygon(double lat,double lon) } //traceln("Added electricity consumed compared to delivery profile: %s MWh", addedConsumption_kWh/1000); } - profile.a_energyProfile_kWh = yearlyElectricityConsumption_kWh; + nettDelivery_kWh = Arrays.stream(yearlyElectricityDelivery_kWh).sum(); } else { // No PV production - profile.a_energyProfile_kWh = yearlyElectricityDelivery_kWh; + yearlyElectricityConsumption_kWh=yearlyElectricityDelivery_kWh; nettDelivery_kWh = Arrays.stream(yearlyElectricityDelivery_kWh).sum(); } @@ -1927,16 +1920,28 @@ String f_createChargerPolygon(double lat,double lon) for(int i = 0; i < yearlyHeatPumpElectricityConsumption_kWh.length; i++){ yearlyHeatPumpElectricityConsumption_kWh[i] = max(0,yearlyHeatPumpElectricityConsumption_kWh[i]); } - double[] preProcessedDefaultConsumptionProfile = new double[profile.a_energyProfile_kWh.length]; + double[] preProcessedDefaultConsumptionProfile = new double[yearlyElectricityConsumption_kWh.length]; for(int i = 0; i < preProcessedDefaultConsumptionProfile.length; i++){ - preProcessedDefaultConsumptionProfile[i] = max(0,profile.a_energyProfile_kWh[i] - yearlyHeatPumpElectricityConsumption_kWh[i]); + preProcessedDefaultConsumptionProfile[i] = max(0,yearlyElectricityConsumption_kWh[i] - yearlyHeatPumpElectricityConsumption_kWh[i]); } - profile.a_energyProfile_kWh = preProcessedDefaultConsumptionProfile; - - J_EAProfile profileHeatPumpElectricityConsumption = new J_EAProfile(parentGC, OL_EnergyCarriers.ELECTRICITY, yearlyHeatPumpElectricityConsumption_kWh, OL_AssetFlowCategories.heatPumpElectricityConsumption_kW, energyModel.p_timeParameters.getTimeStep_h(), energyModel.p_timeParameters); - profileHeatPumpElectricityConsumption.setStartTime_h(energyModel.p_timeParameters.getRunStartTime_h()); - profileHeatPumpElectricityConsumption.setEnergyAssetName(parentGC.p_ownerID + " custom heat pump electricity consumption profile"); -} + //profile.a_energyProfile_kWh = preProcessedDefaultConsumptionProfile; + String heatpumpAssetName = parentGC.p_ownerID + " custom heat pump electricity consumption profile"; + J_ProfilePointer heatpumpProfilePointer = f_createEngineProfile(heatpumpAssetName, timeAxis_h, yearlyHeatPumpElectricityConsumption_kWh, OL_ProfileUnits.KWHPQUARTERHOUR); + J_EAProfile profileHeatPumpElectricityConsumption = new J_EAProfile(parentGC, OL_EnergyCarriers.ELECTRICITY, heatpumpProfilePointer, OL_AssetFlowCategories.heatPumpElectricityConsumption_kW, energyModel.p_timeParameters); + //profileHeatPumpElectricityConsumption.setStartTime_h(v_simStartHour_h); + profileHeatPumpElectricityConsumption.setEnergyAssetName(heatpumpAssetName); + yearlyElectricityConsumption_kWh = preProcessedDefaultConsumptionProfile; +} + +// Create the actual profile asset +String energyAssetName = parentGC.p_ownerID + " custom profile"; +J_ProfilePointer profilePointer = f_createEngineProfile(energyAssetName, timeAxis_h, yearlyElectricityConsumption_kWh, OL_ProfileUnits.KWHPQUARTERHOUR); +//Create the profile +J_EAProfile profile = new J_EAProfile(parentGC, OL_EnergyCarriers.ELECTRICITY, profilePointer, OL_AssetFlowCategories.fixedConsumptionElectric_kW, energyModel.p_timeParameters); +//profile.setStartTime_h(v_simStartHour_h); +profile.setEnergyAssetName(energyAssetName); + + /*ALCODEEND*/} double f_startUpLoader_default() @@ -2178,8 +2183,11 @@ else if(pvPower_kW != null && pvPower_kW > 0){ double fullLoadHours_h = totalProduction_kWh / pvPower_kW; double[] a_normalizedPower_fr = Arrays.stream(yearlyElectricityProduction_kWh).map(i -> 4 * i / totalProduction_kWh * fullLoadHours_h ).toArray(); -TableFunction tf_customPVproduction_fr = new TableFunction(a_arguments, a_normalizedPower_fr, TableFunction.InterpolationType.INTERPOLATION_LINEAR, 2, TableFunction.OutOfRangeAction.OUTOFRANGE_REPEAT, 0.0); -J_ProfilePointer profilePointer = new J_ProfilePointer((parentGC.p_ownerID + "_PVproduction") , tf_customPVproduction_fr); +//TableFunction tf_customPVproduction_fr = new TableFunction(a_arguments, a_normalizedPower_fr, TableFunction.InterpolationType.INTERPOLATION_LINEAR, 2, TableFunction.OutOfRangeAction.OUTOFRANGE_REPEAT, 0.0); +//J_ProfilePointer profilePointer = new J_ProfilePointer((parentGC.p_ownerID + "_PVproduction") , tf_customPVproduction_fr, OL_ProfileUnits.NORMALIZEDPOWER); +double dataTimeStep_h = 0.25; +double dataStartTime_h = 0.0; +J_ProfilePointer profilePointer = new J_ProfilePointer((parentGC.p_ownerID + "_PVproduction") , a_normalizedPower_fr, dataTimeStep_h, dataStartTime_h, OL_ProfileUnits.NORMALIZEDPOWER); energyModel.f_addProfile(profilePointer); J_EAProduction production_asset = new J_EAProduction(parentGC, OL_EnergyAssetType.PHOTOVOLTAIC, (parentGC.p_ownerID + "_rooftopPV"), OL_EnergyCarriers.ELECTRICITY, (double)pvPower_kW, energyModel.p_timeParameters, profilePointer); @@ -3100,10 +3108,31 @@ GridNode f_createHeatGridNode() } /*ALCODEEND*/} -J_ProfilePointer f_createEngineProfile(String profileID,double[] arguments,double[] values) +J_ProfilePointer f_createEngineProfile(String profileID,double[] arguments,double[] values,OL_ProfileUnits profileUnitType) {/*ALCODESTART::1749125189323*/ -TableFunction tf_profile = new TableFunction(arguments, values, TableFunction.InterpolationType.INTERPOLATION_LINEAR, 2, TableFunction.OutOfRangeAction.OUTOFRANGE_REPEAT, 0.0); -J_ProfilePointer profilePointer = new J_ProfilePointer(profileID, tf_profile); +double dataTimeStep_h = (arguments[arguments.length-1] - arguments[0])/(arguments.length-1); +double dataStartTime_h = arguments[0]; +double simTimeStep_h = settings.timeStep_h(); +double a_profile[]; +if (simTimeStep_h < dataTimeStep_h) { //Interpolate data to timeStep_h = 0.25 + //traceln("***** profilePointer using tableFunction to interpolate hourly data into quarter-hourly data ********"); + if ((dataTimeStep_h/simTimeStep_h)%1.0 != 0.0) { + throw new RuntimeException("dataTimeStep_h is not an integer multiple of modelTimeStep! Unsupported dataformat!"); + } + TableFunction tableFunction = new TableFunction(arguments, values, TableFunction.InterpolationType.INTERPOLATION_LINEAR, 2, TableFunction.OutOfRangeAction.OUTOFRANGE_REPEAT, 0.0); + a_profile = new double[values.length*(int)(dataTimeStep_h/simTimeStep_h)]; + for (int i=0; i dataTimeStep_h) { + throw new RuntimeException("dataTimeStep_h smaller than modelTimeStep! Unsupported dataformat! Need to implement downsampling to allow this"); +} else { + a_profile=values; +} + +J_ProfilePointer profilePointer = new J_ProfilePointer(profileID, a_profile, dataTimeStep_h, dataStartTime_h, profileUnitType); + energyModel.f_addProfile(profilePointer); return profilePointer; /*ALCODEEND*/} @@ -3130,25 +3159,24 @@ J_ProfilePointer f_createEngineProfile(String profileID,double[] arguments,doubl double[] a_defaultBuildingHeatDemandProfile_fr = ListUtil.doubleListToArray(defaultProfiles_data.defaultBuildingHeatDemandProfile_fr()); //Create Weather engine profiles -energyModel.pp_ambientTemperature_degC = f_createEngineProfile("ambient_temperature_degC", a_arguments_hr, a_ambientTemperatureProfile_degC); -energyModel.pp_PVProduction35DegSouth_fr = f_createEngineProfile("pv_production_south_fr", a_arguments_hr, a_PVProductionProfile35DegSouth_fr); -energyModel.pp_PVProduction15DegEastWest_fr = f_createEngineProfile("pv_production_eastwest_fr", a_arguments_hr, a_PVProductionProfile15DegEastWest_fr); -energyModel.pp_windProduction_fr = f_createEngineProfile("wind_production_fr", a_arguments_hr, a_windProductionProfile_fr); +energyModel.pp_ambientTemperature_degC = f_createEngineProfile("ambient_temperature_degC", a_arguments_hr, a_ambientTemperatureProfile_degC, OL_ProfileUnits.TEMPERATURE_DEGC); +energyModel.pp_PVProduction35DegSouth_fr = f_createEngineProfile("pv_production_south_fr", a_arguments_hr, a_PVProductionProfile35DegSouth_fr, OL_ProfileUnits.NORMALIZEDPOWER); +energyModel.pp_PVProduction15DegEastWest_fr = f_createEngineProfile("pv_production_eastwest_fr", a_arguments_hr, a_PVProductionProfile15DegEastWest_fr, OL_ProfileUnits.NORMALIZEDPOWER); +energyModel.pp_windProduction_fr = f_createEngineProfile("wind_production_fr", a_arguments_hr, a_windProductionProfile_fr, OL_ProfileUnits.NORMALIZEDPOWER); //Create Epex engine profile -energyModel.pp_dayAheadElectricityPricing_eurpMWh = f_createEngineProfile("epex_price_eurpMWh", a_arguments_hr, a_epexProfile_eurpMWh); +energyModel.pp_dayAheadElectricityPricing_eurpMWh = f_createEngineProfile("epex_price_eurpMWh", a_arguments_hr, a_epexProfile_eurpMWh, OL_ProfileUnits.PRICE_EURPMWH); //Create Consumption engine profiles: -f_createEngineProfile("default_house_electricity_demand_fr", a_arguments_hr, a_defaultHouseElectricityDemandProfile_fr); -f_createEngineProfile("default_house_hot_water_demand_fr", a_arguments_hr, a_defaultHouseHotWaterDemandProfile_fr); -f_createEngineProfile("default_house_cooking_demand_fr", a_arguments_hr, a_defaultHouseCookingDemandProfile_fr); -f_createEngineProfile("default_office_electricity_demand_fr", a_arguments_hr, a_defaultOfficeElectricityDemandProfile_fr); -f_createEngineProfile("default_building_heat_demand_fr", a_arguments_hr, a_defaultBuildingHeatDemandProfile_fr); - +f_createEngineProfile("default_house_electricity_demand_fr", a_arguments_hr, a_defaultHouseElectricityDemandProfile_fr, OL_ProfileUnits.YEARLYTOTALFRACTION); +f_createEngineProfile("default_house_hot_water_demand_fr", a_arguments_hr, a_defaultHouseHotWaterDemandProfile_fr, OL_ProfileUnits.YEARLYTOTALFRACTION); +f_createEngineProfile("default_house_cooking_demand_fr", a_arguments_hr, a_defaultHouseCookingDemandProfile_fr, OL_ProfileUnits.YEARLYTOTALFRACTION); +f_createEngineProfile("default_office_electricity_demand_fr", a_arguments_hr, a_defaultOfficeElectricityDemandProfile_fr, OL_ProfileUnits.YEARLYTOTALFRACTION); +f_createEngineProfile("default_building_heat_demand_fr", a_arguments_hr, a_defaultBuildingHeatDemandProfile_fr, OL_ProfileUnits.YEARLYTOTALFRACTION); //Create custom engine profiles for(CustomProfile_data customProfile : c_customProfiles_data){ - f_createEngineProfile(customProfile.customProfileID(), customProfile.getArgumentsArray(), customProfile.getValuesArray()); + f_createEngineProfile(customProfile.customProfileID(), customProfile.getArgumentsArray(), customProfile.getValuesArray(), customProfile.profileUnits()); // What type of profiles usually in custom profiles?? Custom production profiles? } /*ALCODEEND*/} @@ -3997,19 +4025,31 @@ else if (surveyGC.getNaturalGas().getHourlyDelivery_m3() != null && surveyGC.get double f_createGasProfileFromGasTS(GridConnection engineGC,com.zenmo.zummon.companysurvey.GridConnection surveyGC) {/*ALCODESTART::1753804393557*/ // Gas delivery profile in m3 -double[] profile_m3 = f_timeSeriesToQuarterHourlyDoubleArray(surveyGC.getNaturalGas().getHourlyDelivery_m3()); +//double[] profile_m3ph = f_convertFloatArrayToDoubleArray(surveyGC.getNaturalGas().getHourlyDelivery_m3().getFlatDataPoints()); +double[] profile_m3pqh = f_timeSeriesToQuarterHourlyDoubleArray(surveyGC.getNaturalGas().getHourlyDelivery_m3()); +// TODO: Check startdate of profile! Perhaps update vallum method to do so? + +traceln("Gas data array length: %s", profile_m3pqh.length); +double dataTimeStep_h = 0.25; +double[] a_arguments_hr = new double[profile_m3pqh.length]; +for (int i = 0; i 10000) { // if longer than 10_000 values, conclude it's quarter-hourly data, not hourly + dataTimeStep_h = 0.25; + a_arguments_hr = new double[profile_kWhpqh.length]; + for (int i = 0; i - - VOID - double - 1726584205845 - - 1320 - 600 - - false - true - true - - - - - - - - - - RETURNS_VALUE String @@ -1267,6 +1243,10 @@ verbruik = levering + productie - teruglevering]]> + + + + diff --git a/_alp/Agents/tabElectricity/Code/Functions.java b/_alp/Agents/tabElectricity/Code/Functions.java index 1446d1be..51948e68 100644 --- a/_alp/Agents/tabElectricity/Code/Functions.java +++ b/_alp/Agents/tabElectricity/Code/Functions.java @@ -135,7 +135,7 @@ } // Set Profile Assets for (J_EAProfile j_ea : gc.c_profileAssets) { - if (j_ea.energyCarrier == OL_EnergyCarriers.ELECTRICITY) { + if (j_ea.getEnergyCarrier() == OL_EnergyCarriers.ELECTRICITY) { j_ea.setProfileScaling_fr( scalingFactor ); } } @@ -386,7 +386,7 @@ else if ( gc instanceof GCUtility ) { GCHouse house = randomWhere(gcListHouses, x -> x.p_cookingMethod == OL_HouseholdCookingMethod.ELECTRIC); J_EAConsumption cookingAsset = findFirst(house.c_consumptionAssets, p -> p.getEAType() == OL_EnergyAssetType.ELECTRIC_HOB ); if (cookingAsset != null) { - double yearlyCookingDemand_kWh = cookingAsset.yearlyDemand_kWh; + double yearlyCookingDemand_kWh = cookingAsset.getBaseConsumption_kWh(); cookingAsset.removeEnergyAsset(); J_ProfilePointer pp = zero_Interface.energyModel.f_findProfile("default_house_hot_water_demand_fr"); @@ -407,7 +407,7 @@ else if ( gc instanceof GCUtility ) { else { J_EAConsumption cookingAsset = findFirst(house.c_consumptionAssets, p -> p.getEAType() == OL_EnergyAssetType.GAS_PIT ); if (cookingAsset != null) { - double yearlyCookingDemand_kWh = cookingAsset.yearlyDemand_kWh; + double yearlyCookingDemand_kWh = cookingAsset.getBaseConsumption_kWh(); cookingAsset.removeEnergyAsset(); new J_EAConsumption(house, OL_EnergyAssetType.ELECTRIC_HOB, "default_house_cooking_demand_fr", yearlyCookingDemand_kWh, OL_EnergyCarriers.ELECTRICITY, zero_Interface.energyModel.p_timeParameters, null); @@ -462,13 +462,13 @@ else if(gr_electricitySliders_residential.isVisible()){ List profileEAs = findAll(GC.c_profileAssets, profile -> profile.getAssetFlowCategory() == OL_AssetFlowCategories.fixedConsumptionElectric_kW); List consumptionEAs = findAll(GC.c_consumptionAssets, consumption -> consumption.getAssetFlowCategory() == OL_AssetFlowCategories.fixedConsumptionElectric_kW); for(J_EAProfile profileEA : profileEAs){ - double baseConsumption_kWh = ZeroMath.arraySum(profileEA.a_energyProfile_kWh); + double baseConsumption_kWh = profileEA.getBaseConsumption_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; - totalSavedConsumption_kWh += (1-consumptionEA.getConsumptionScaling_fr())*consumptionEA.yearlyDemand_kWh; + totalBaseConsumption_kWh += consumptionEA.getBaseConsumption_kWh(); + totalSavedConsumption_kWh += (1-consumptionEA.getConsumptionScaling_fr())*consumptionEA.getBaseConsumption_kWh(); } } } @@ -571,13 +571,13 @@ else if(productionEA.getEAType() == OL_EnergyAssetType.WINDMILL){ List profileEAs = findAll(GC.c_profileAssets, profile -> profile.getAssetFlowCategory() == OL_AssetFlowCategories.fixedConsumptionElectric_kW); List consumptionEAs = findAll(GC.c_consumptionAssets, consumption -> consumption.getAssetFlowCategory() == OL_AssetFlowCategories.fixedConsumptionElectric_kW); for(J_EAProfile profileEA : profileEAs){ - double baseConsumption_kWh = ZeroMath.arraySum(profileEA.a_energyProfile_kWh); + double baseConsumption_kWh = profileEA.getBaseConsumption_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; - totalSavedConsumption_kWh += (1-consumptionEA.getConsumptionScaling_fr())*consumptionEA.yearlyDemand_kWh; + totalBaseConsumption_kWh += consumptionEA.getBaseConsumption_kWh(); + totalSavedConsumption_kWh += (1-consumptionEA.getConsumptionScaling_fr())*consumptionEA.getBaseConsumption_kWh(); } } } @@ -616,13 +616,13 @@ else if(productionEA.getEAType() == OL_EnergyAssetType.WINDMILL){ List profileEAs = findAll(GC.c_profileAssets, profile -> profile.getAssetFlowCategory() == OL_AssetFlowCategories.fixedConsumptionElectric_kW); List consumptionEAs = findAll(GC.c_consumptionAssets, consumption -> consumption.getAssetFlowCategory() == OL_AssetFlowCategories.fixedConsumptionElectric_kW); for(J_EAProfile profileEA : profileEAs){ - double baseConsumption_kWh = ZeroMath.arraySum(profileEA.a_energyProfile_kWh); + double baseConsumption_kWh = profileEA.getBaseConsumption_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; - totalSavedConsumption_kWh += (1-consumptionEA.getConsumptionScaling_fr())*consumptionEA.yearlyDemand_kWh; + totalBaseConsumption_kWh += consumptionEA.getBaseConsumption_kWh(); + totalSavedConsumption_kWh += (1-consumptionEA.getConsumptionScaling_fr())*consumptionEA.getBaseConsumption_kWh(); } } } diff --git a/_alp/Agents/tabHeating/Code/Functions.java b/_alp/Agents/tabHeating/Code/Functions.java index 45854b9f..4aaec618 100644 --- a/_alp/Agents/tabHeating/Code/Functions.java +++ b/_alp/Agents/tabHeating/Code/Functions.java @@ -119,7 +119,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) { + if (j_ea.getEnergyCarrier() == OL_EnergyCarriers.HEAT) { j_ea.setProfileScaling_fr( scalingFactor ); } } @@ -216,17 +216,17 @@ int f_setHeatingSystemsWithCompanyUI(List gcList,double targetHeatPum double f_calculatePeakHeatDemand_kW(GridConnection gc) {/*ALCODESTART::1749116448649*/ double peakHeatDemand_kW = 0.0; -for (J_EAConsumption j_ea : gc.c_consumptionAssets) { +/*for (J_EAConsumption j_ea : gc.c_consumptionAssets) { if (j_ea.getEAType() == OL_EnergyAssetType.HEAT_DEMAND || j_ea.getEAType() == OL_EnergyAssetType.HOT_WATER_CONSUMPTION) { double[] profile = j_ea.getProfilePointer().getAllValues(); double maxFactor = Arrays.stream(profile).max().getAsDouble(); - peakHeatDemand_kW += maxFactor * j_ea.yearlyDemand_kWh * j_ea.getConsumptionScaling_fr(); + peakHeatDemand_kW += maxFactor * j_ea.getYearlyDemand_kWh() * j_ea.getConsumptionScaling_fr(); } -} +}*/ for (J_EAProfile j_ea : gc.c_profileAssets) { - if (j_ea.energyCarrier == OL_EnergyCarriers.HEAT) { - double maxValue = j_ea.getProfileScaling_fr() * Arrays.stream(j_ea.a_energyProfile_kWh).max().getAsDouble(); - peakHeatDemand_kW += maxValue / zero_Interface.energyModel.p_timeParameters.getTimeStep_h() * j_ea.getProfileScaling_fr(); + if (j_ea.getEnergyCarrier() == OL_EnergyCarriers.HEAT && !(j_ea instanceof J_EAProduction)) { + //double maxPower_kW = j_ea.getPeakPower_kW(); //j_ea.getProfileScaling_fr() * Arrays.stream(j_ea.a_energyProfile_kWh).max().getAsDouble(); + peakHeatDemand_kW += j_ea.getPeakConsumptionPower_kW(); //maxValue / zero_Interface.energyModel.p_timeParameters.getTimeStep_h() * j_ea.getProfileScaling_fr(); } } if (gc.p_BuildingThermalAsset != null) { @@ -297,13 +297,18 @@ int f_setHeatingSystemsWithCompanyUI(List gcList,double targetHeatPum house.f_removeAllHeatingAssets(); house.p_parentNodeHeat = null; house.p_parentNodeHeatID = null; - + //add gasburner + double peakHeatDemand_kW = f_calculatePeakHeatDemand_kW(house); + new J_EAConversionGasBurner(house, peakHeatDemand_kW, zero_Interface.energyModel.avgc_data.p_avgEfficiencyGasBurner_fr, zero_Interface.energyModel.p_timeParameters, 90); + house.f_addHeatManagement(OL_GridConnectionHeatingType.GAS_BURNER, false); + + /* J_EAConsumption heatDemandAsset = findFirst(house.c_consumptionAssets, j_ea -> j_ea.getEAType() == OL_EnergyAssetType.HEAT_DEMAND); J_EAConversionGasBurner gasBurner; //if house has follows the general heat deamnd profile if (heatDemandAsset != null) { - gasBurner = new J_EAConversionGasBurner(house, heatDemandAsset.yearlyDemand_kWh/8760*10, 0.99, zero_Interface.energyModel.p_timeParameters, 90); + gasBurner = new J_EAConversionGasBurner(house, heatDemandAsset.getYearlyDemand_kWh()/8760*10, 0.99, zero_Interface.energyModel.p_timeParameters, 90); } //if house has a thermalBuildingAsset else if (house.p_BuildingThermalAsset != null){ @@ -312,11 +317,12 @@ else if (house.p_BuildingThermalAsset != null){ } // Else house has a customprofiel else { - J_EAProfile heatDemandProfile = (J_EAProfile)findFirst(house.c_profileAssets, x->x instanceof J_EAProfile && x.energyCarrier == OL_EnergyCarriers.HEAT); - double peakHeatDemand_kW = heatDemandProfile.getProfileScaling_fr() * Arrays.stream(heatDemandProfile.a_energyProfile_kWh).max().orElseThrow(() -> new RuntimeException("Unable to find the maximum of the heat demand profile")); + J_EAProfile heatDemandProfile = (J_EAProfile)findFirst(house.c_profileAssets, x->x instanceof J_EAProfile && x.getEnergyCarrier() == OL_EnergyCarriers.HEAT && !(x instanceof J_EAProduction)); + double peakHeatDemand_kW = heatDemandProfile.getPeakPower_kW();//heatDemandProfile.getProfileScaling_fr() * Arrays.stream(heatDemandProfile.a_energyProfile_kWh).max().orElseThrow(() -> new RuntimeException("Unable to find the maximum of the heat demand profile")); gasBurner = new J_EAConversionGasBurner(house, peakHeatDemand_kW, 0.99, zero_Interface.energyModel.p_timeParameters, 90); } house.f_addHeatManagement(OL_GridConnectionHeatingType.GAS_BURNER, false); + */ } //Update variable to change to custom scenario @@ -710,13 +716,13 @@ 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 baseConsumption_kWh = ZeroMath.arraySum(profileEA.a_energyProfile_kWh); + double baseConsumption_kWh = profileEA.getBaseConsumption_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; - totalSavedConsumption_kWh += (1-consumptionEA.getConsumptionScaling_fr())*consumptionEA.yearlyDemand_kWh; + totalBaseConsumption_kWh += consumptionEA.getBaseConsumption_kWh(); + totalSavedConsumption_kWh += (1-consumptionEA.getConsumptionScaling_fr())*consumptionEA.getBaseConsumption_kWh(); } if(GC.p_BuildingThermalAsset != null){ @@ -935,13 +941,13 @@ 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.getEAType() == OL_EnergyAssetType.HEAT_DEMAND); for(J_EAProfile profileEA : profileEAs){ - double baseConsumption_kWh = ZeroMath.arraySum(profileEA.a_energyProfile_kWh); + double baseConsumption_kWh = profileEA.getBaseConsumption_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; - totalSavedConsumption_kWh += (1-consumptionEA.getConsumptionScaling_fr())*consumptionEA.yearlyDemand_kWh; + totalBaseConsumption_kWh += consumptionEA.getBaseConsumption_kWh(); + totalSavedConsumption_kWh += (1-consumptionEA.getConsumptionScaling_fr())*consumptionEA.getBaseConsumption_kWh(); } if(GC.p_BuildingThermalAsset != null){ diff --git a/_alp/Classes/Class.CustomProfile_data.java b/_alp/Classes/Class.CustomProfile_data.java index f3d17130..7f4d9eaf 100644 --- a/_alp/Classes/Class.CustomProfile_data.java +++ b/_alp/Classes/Class.CustomProfile_data.java @@ -9,6 +9,7 @@ public class CustomProfile_data { String customProfileID; List argumentsList; List valuesList; + OL_ProfileUnits profileUnits; public double[] getArgumentsArray() { return ListUtil.doubleListToArray(argumentsList); diff --git a/_alp/Classes/Class.Settings.java b/_alp/Classes/Class.Settings.java index e4d3cb21..bd3a5f36 100644 --- a/_alp/Classes/Class.Settings.java +++ b/_alp/Classes/Class.Settings.java @@ -1,25 +1,22 @@ -import lombok.Builder; -import lombok.Data; -import lombok.experimental.Accessors; - /** * Settings */ -@Data -@Builder(toBuilder = true) -@Accessors(fluent = true) +@lombok.Builder +@lombok.Value +@lombok.experimental.Accessors(fluent = true) +//@FieldDefaults(level = AccessLevel.PRIVATE) public class Settings { //Simulation settings (Time) - @Builder.Default + @lombok.Builder.Default double timeStep_h = 0.25; //Length of the simulation timestep in Hr - @Builder.Default + @lombok.Builder.Default int summerWeekNumber = 18; //Week number of the year where data will be stored for to display a 'default' summerweek - @Builder.Default + @lombok.Builder.Default int winterWeekNumber = 49; //Week number of the year where data will be stored for to display a 'default' winterweek - @Builder.Default + @lombok.Builder.Default double simDuration_h = 8760; // (Rapid sim (and Live sim before loop) duration in hours since the start time h.