diff --git a/Zero_engine.alpx b/Zero_engine.alpx index 84c5d066..1bd7fd42 100644 --- a/Zero_engine.alpx +++ b/Zero_engine.alpx @@ -1,7 +1,7 @@ 1658477103134 @@ -365,6 +365,10 @@ 1773156171459 + 1659525715752 @@ -746,20 +750,12 @@ - - 1675025163072 @@ -1084,6 +1080,10 @@ 1770132010080 + 1762354709855 @@ -1407,6 +1407,16 @@ LARGE_CONNECTION (grootverbruik, > 3x80) 1772100318398 + + 1775728951678 + + 1772100318398 + + + 1776078970513 + + 1772100318398 + EULER @@ -1587,18 +1597,6 @@ LARGE_CONNECTION (grootverbruik, > 3x80) true 1752737189062 - - 1668600448637 - - true - 1752677832758 - - - 1671107396262 - - true - 1752677832758 - 1671522756085 @@ -1641,12 +1639,6 @@ LARGE_CONNECTION (grootverbruik, > 3x80) 1752681639768 - - 1692862773194 - - true - 1752677832758 - 1692876125447 @@ -1657,12 +1649,6 @@ LARGE_CONNECTION (grootverbruik, > 3x80) 1752677832758 - - 1707992650964 - - true - 1752677832758 - 1711009967838 @@ -2193,6 +2179,36 @@ LARGE_CONNECTION (grootverbruik, > 3x80) 1772100326457 + + 1776078551110 + + 1775728951678 + + + 1776078590999 + + 1775728951678 + + + 1776078958990 + + 1775728951678 + + + 1776079040123 + + 1776078970513 + + + 1776079237990 + + 1776078970513 + + + 1776164691536 + + 1772100335412 + com.anylogic.libraries.modules.markup_descriptors diff --git a/_alp/Agents/EnergyModel/EmbeddedObjects.xml b/_alp/Agents/EnergyModel/EmbeddedObjects.xml index 4f800f66..f99c5231 100644 --- a/_alp/Agents/EnergyModel/EmbeddedObjects.xml +++ b/_alp/Agents/EnergyModel/EmbeddedObjects.xml @@ -163,9 +163,6 @@ - - - @@ -193,9 +190,6 @@ - - - @@ -918,9 +912,6 @@ - - - @@ -948,9 +939,6 @@ - - - @@ -972,9 +960,6 @@ - - - @@ -987,12 +972,6 @@ - - - - - - @@ -1077,9 +1056,6 @@ - - - @@ -1107,9 +1083,6 @@ - - - @@ -1221,9 +1194,6 @@ - - - @@ -1251,9 +1221,6 @@ - - - @@ -1362,9 +1329,6 @@ - - - @@ -1389,9 +1353,6 @@ - - - @@ -1413,48 +1374,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1551,9 +1470,6 @@ - - - @@ -1578,9 +1494,6 @@ - - - @@ -1683,9 +1596,6 @@ - - - @@ -1713,9 +1623,6 @@ - - - @@ -2154,9 +2061,6 @@ - - - @@ -2181,9 +2085,6 @@ - - - @@ -2296,9 +2197,6 @@ - - - @@ -2323,9 +2221,6 @@ - - - diff --git a/_alp/Agents/GCDistrictHeating/AOC.GCDistrictHeating.xml b/_alp/Agents/GCDistrictHeating/AOC.GCDistrictHeating.xml index 60ffdf39..c7bbebfb 100644 --- a/_alp/Agents/GCDistrictHeating/AOC.GCDistrictHeating.xml +++ b/_alp/Agents/GCDistrictHeating/AOC.GCDistrictHeating.xml @@ -24,9 +24,6 @@ - - - @@ -54,9 +51,6 @@ - - - diff --git a/_alp/Agents/GCEnergyConversion/AOC.GCEnergyConversion.xml b/_alp/Agents/GCEnergyConversion/AOC.GCEnergyConversion.xml index 3a2896ac..0d6288b0 100644 --- a/_alp/Agents/GCEnergyConversion/AOC.GCEnergyConversion.xml +++ b/_alp/Agents/GCEnergyConversion/AOC.GCEnergyConversion.xml @@ -2,7 +2,6 @@ 1663773857868 - 1752677823817 @@ -28,9 +27,6 @@ - - - @@ -55,9 +51,6 @@ - - - @@ -180,68 +173,6 @@ 1663773857867 1663773857863 - - - - - 1717063231444 - - 1610 - 390 - - false - true - true - false - - 1751011893317 - true - 1717142400000 - - - HOUR - - - - HOUR - - - false - 672 - - - 1717069403489 - - 1600 - 540 - - false - true - true - false - - 1751011893319 - true - 1717142400000 - - - HOUR - - - - HOUR - - - false - 672 - - 1663773857863 @@ -303,7 +234,6 @@ SHAPE_DRAW_2D3D 0 DIM_NON_CURRENT - diff --git a/_alp/Agents/GCEnergyConversion/Code/AdditionalClassCode.java b/_alp/Agents/GCEnergyConversion/Code/AdditionalClassCode.java deleted file mode 100644 index bdd0364a..00000000 --- a/_alp/Agents/GCEnergyConversion/Code/AdditionalClassCode.java +++ /dev/null @@ -1,14 +0,0 @@ -@Override -public void f_operateFlexAssets(J_TimeVariables timeVariables){ - f_operateFlexAssets_override(timeVariables); -} - -@Override -public void f_resetSpecificGCStates(){ - f_resetSpecificGCStates_override(); -} - -@Override -public void f_resetSpecificGCStatesAfterRapidRun(){ - f_resetSpecificGCStatesAfterRapidRun_override(); -} \ No newline at end of file diff --git a/_alp/Agents/GCEnergyConversion/Code/Functions.java b/_alp/Agents/GCEnergyConversion/Code/Functions.java deleted file mode 100644 index e0234d0d..00000000 --- a/_alp/Agents/GCEnergyConversion/Code/Functions.java +++ /dev/null @@ -1,512 +0,0 @@ -double f_manageElektrolyserOUD(J_EAConversionElektrolyser ElektrolyserAsset) -{/*ALCODESTART::1707149702398*/ -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 -} -/*ALCODEEND*/} - -double f_manageElectrolyser(J_EAConversionElectrolyser ElectrolyserAsset,J_TimeVariables timeVariables) -{/*ALCODESTART::1708089250229*/ -// TODO: add timeParameters to this function? - -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.getContractedDeliveryCapacity_kW(); - double v_allowedFeedinCapacity_kW = v_liveConnectionMetaData.getContractedFeedinCapacity_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, energyModel.p_timeParameters, timeVariables); - - data_liveWeekElectrolyserPower_kW.add(timeVariables.getT_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)); - - f_updateFlexAssetFlows(ElectrolyserAsset, electrolyserSetpointElectric_kW/ElectrolyserAsset.getInputCapacity_kW(), timeVariables); - - //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_timeParameters.getTimeStep_h(); - - /*if (b_useHydrogenLocally) { - List 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(); - } - }*/ - -} -/*ALCODEEND*/} - -double f_operateFlexAssets_override(J_TimeVariables timeVariables) -{/*ALCODESTART::1708089644411*/ -for( J_EA v : c_conversionAssets ){ - if (v instanceof J_EAConversionElectrolyser) { - f_manageElectrolyser((J_EAConversionElectrolyser)v, timeVariables); - } -} -/*ALCODEEND*/} - -double f_electrolyserRegime(double elektrolyserSetpointElectric_kW,double excessElectricPower_kW,J_EAConversionElectrolyser ElectrolyserAsset,J_TimeParameters timeParameters,J_TimeVariables timeVariables) -{/*ALCODESTART::1708447959640*/ -double solar_forecast_kW; -double wind_forecast_kW; - -double forecast_time_h = ElectrolyserAsset.getStartUpTimeStandby_h()+ 2*timeParameters.getTimeStep_h(); - -//Get current limitation values -//Pair 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(timeVariables.getT_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, timeParameters, timeVariables); - 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 + timeParameters.getTimeStep_h(); - } - break; - - case STANDBY: - elektrolyserSetpointElectric_kW = 0; - - if(energyModel.v_isRapidRun){ - v_totalDownTimeElectrolyser_hr = v_totalDownTimeElectrolyser_hr + timeParameters.getTimeStep_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 + timeParameters.getTimeStep_h(); - v_totalEnergyLossIdle_kWh = v_totalEnergyLossIdle_kWh + elektrolyserSetpointElectric_kW * timeParameters.getTimeStep_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; -/*ALCODEEND*/} - -double f_electrolyserRegimeControl_Price(double excessElectricPower_kW,J_EAConversionElectrolyser ElectrolyserAsset) -{/*ALCODESTART::1708448673879*/ -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; -} - - - -/*ALCODEEND*/} - -double f_manageFuelCell() -{/*ALCODESTART::1709045117969*/ - -//if (FuelCellAsset.getElectricCapacity_kW()>0) { - - -//} - - - - - -/*ALCODEEND*/} - -double f_electrolyserRegimeControl_Balance(double currentGridNodePowerFlow_kW,double forecast_time_h,J_EAConversionElectrolyser ElectrolyserAsset,J_TimeParameters timeParameters,J_TimeVariables timeVariables) -{/*ALCODESTART::1715611921617*/ -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/timeParameters.getTimeStep_h()); i++){ - solar_forecast_kW = - energyModel.pp_PVProduction35DegSouth_fr.getValue(timeVariables.getT_h() + i*timeParameters.getTimeStep_h()) * energyModel.v_liveAssetsMetaData.totalInstalledPVPower_kW; - wind_forecast_kW = - energyModel.pp_windProduction_fr.getValue(timeVariables.getT_h() + i*timeParameters.getTimeStep_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)/timeParameters.getTimeStep_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(timeVariables.getT_h() + forecast_time_h) * energyModel.v_liveAssetsMetaData.totalInstalledPVPower_kW; - wind_forecast_kW = - energyModel.pp_windProduction_fr.getValue(timeVariables.getT_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/timeParameters.getTimeStep_h())){ // Use last week to create the forecast - - double lastWeekGridNodePowerFlow_kW = data_liveWeekGridNoderPowerFlow_kW.getY(roundToInt(forecast_time_h/timeParameters.getTimeStep_h())) - data_liveWeekElectrolyserPower_kW.getY(roundToInt(forecast_time_h/timeParameters.getTimeStep_h())); - double solar_lastWeek_kW = - energyModel.pp_PVProduction35DegSouth_fr.getValue(timeVariables.getT_h() + forecast_time_h - 168) * energyModel.v_liveAssetsMetaData.totalInstalledPVPower_kW; - double wind_lastWeek_kW = - energyModel.pp_windProduction_fr.getValue(timeVariables.getT_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/timeParameters.getTimeStep_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/timeParameters.getTimeStep_h())-2) < v_gridNodeCongestionLimit_kW && c_forecast_gridNodePowerFlow_kW.get(roundToInt(forecast_time_h/timeParameters.getTimeStep_h())-1) < v_gridNodeCongestionLimit_kW){ - ElectrolyserAsset.setElectrolyserState(OL_ElectrolyserState.POWER_UP); - ElectrolyserAsset.setRemainingPowerUpDuration_timesteps(roundToInt(ElectrolyserAsset.getStartUpTimeStandby_h()/timeParameters.getTimeStep_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; -} - -/*ALCODEEND*/} - -double f_resetSpecificGCStates_override() -{/*ALCODESTART::1717066943639*/ -//Reset variables -v_totalDownTimeElectrolyser_hr = 0; -v_totalEnergyLossIdle_kWh = 0; -v_producedOxygen_kg = 0; -v_hydrogenInStorage_kWh = 0; - - -/*ALCODEEND*/} - -double f_resetSpecificGCStatesAfterRapidRun_override() -{/*ALCODESTART::1717068271650*/ -//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; -/*ALCODEEND*/} - -double f_electrolyserRegimeControl_AlwaysIdle(double currentGridNodePowerFlow_kW,J_EAConversionElectrolyser ElectrolyserAsset) -{/*ALCODESTART::1717139694847*/ -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; -} - -/*ALCODEEND*/} - -double f_manageFuelCell_OLD_Utility() -{/*ALCODESTART::1770636052220*/ -// 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 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); - } - } - } - } -} -/*ALCODEEND*/} - diff --git a/_alp/Agents/GCEnergyConversion/Code/Functions.xml b/_alp/Agents/GCEnergyConversion/Code/Functions.xml deleted file mode 100644 index 981d815c..00000000 --- a/_alp/Agents/GCEnergyConversion/Code/Functions.xml +++ /dev/null @@ -1,254 +0,0 @@ - - - - VOID - double - 1707149702398 - - true - 1610 - -40 - - false - true - true - - - - - - - - VOID - double - 1708089250229 - - 1610 - 60 - - false - true - true - - - - - - - - - - - - VOID - double - 1708089644411 - - 910 - 280 - - false - true - true - - - - - - - - RETURNS_VALUE - double - 1708447959640 - - 1620 - 80 - - false - true - true - - - - - - - - - - - - - - - - - - - - - - - - VOID - double - 1708448673879 - - - 1630 - 100 - - false - true - true - - - - - - - - - - - - VOID - double - 1709045117969 - - 2020 - 70 - - false - true - true - - - - VOID - double - 1715611921617 - - 1630 - 120 - - false - true - true - - - - - - - - - - - - - - - - - - - - - - - - VOID - double - 1717066943639 - - 925 - 670 - - false - true - true - - - - VOID - double - 1717068271650 - - 925 - 710 - - false - true - true - - - - VOID - double - 1717139694847 - - 1610 - -110 - - false - true - true - - - - - - - - - - - - VOID - double - 1770636052220 - - true - 2360 - 100 - - false - true - true - - - diff --git a/_alp/Agents/GCEnergyConversion/Levels/Level.level.xml b/_alp/Agents/GCEnergyConversion/Levels/Level.level.xml deleted file mode 100644 index 16c1f9ad..00000000 --- a/_alp/Agents/GCEnergyConversion/Levels/Level.level.xml +++ /dev/null @@ -1,107 +0,0 @@ - - - - 1707149618071 - - 1580 - 20 - - false - true - false - true - SHAPE_DRAW_2D3D - false - 0 - 10 - 3 - -14774017 - null - SOLID - 350 - 490 - 0.0 - -1 - null - - - 1709045045153 - - 1980 - 20 - - true - true - false - true - SHAPE_DRAW_2D3D - false - 0 - 10 - 3 - -65281 - null - SOLID - 280 - 490 - 0.0 - -1 - null - - - 1709045095108 - - 2000 - 30 - - false - true - false - SHAPE_DRAW_2D - false - 0 - 0.0 - -16777216 - - - - 14 - - - LEFT - - - 1712934875018 - - 1600 - 30 - - false - true - false - SHAPE_DRAW_2D - false - 0 - 0.0 - -16777216 - - - - 14 - - - LEFT - - diff --git a/_alp/Agents/GCEnergyConversion/Variables.xml b/_alp/Agents/GCEnergyConversion/Variables.xml deleted file mode 100644 index 2971354f..00000000 --- a/_alp/Agents/GCEnergyConversion/Variables.xml +++ /dev/null @@ -1,687 +0,0 @@ - - - - 1707149728754 - - 1610 - 350 - - false - true - true - - - - - - - - - 1708448002658 - - - 1610 - 440 - - false - true - true - - - - - - - - - 1708448456203 - - - 1610 - 490 - - false - true - true - - - - - - 1708949135932 - - 1610 - 300 - - false - true - true - - - - - - - - - 1708949154946 - - 1610 - 320 - - false - true - true - - - - - - - - - 1709045630640 - - 2010 - 400 - - false - true - true - - - - - - 1709045655596 - - 2010 - 440 - - false - true - true - - - - - - 1715597878431 - - 1610 - 410 - - false - true - true - - - - - - - - - 1715607690911 - - - 1610 - 250 - - false - true - true - - - - - - - - - 1720522233689 - - 1610 - 470 - - false - true - true - - - - - - - - - 1770636052222 - - true - 2360 - 140 - - false - true - true - - - - - - 1770636052224 - - true - 2360 - 120 - - false - true - true - - - - - - 1770636052226 - - true - 2360 - 160 - - false - true - true - - - - - - 1707860525999 - - 1610 - 160 - - false - true - true - - - NONE - false - - 1707860525997 - TEXT_BOX - 0 - 100 - NO_DELIMETER - - - - - 1707860642684 - - 1610 - 230 - - false - true - true - - - NONE - false - - 1658477089960 - TEXT_BOX - 0 - 100 - NO_DELIMETER - - - - - 1709045216547 - - 2010 - 160 - - false - true - true - - - NONE - false - - 1709045216545 - - TEXT_BOX - 0 - 100 - NO_DELIMETER - - - - - 1709045216581 - - 2010 - 180 - - false - true - true - - - NONE - false - - 1709045216579 - - TEXT_BOX - 0 - 100 - NO_DELIMETER - - - - - 1709045216603 - - 2010 - 200 - - false - true - true - - - NONE - false - - 1709045216601 - - TEXT_BOX - 0 - 100 - NO_DELIMETER - - - - - 1709045216633 - - 2010 - 220 - - false - true - true - - - NONE - false - - 1709045216631 - - TEXT_BOX - 0 - 100 - NO_DELIMETER - - - - - 1709045216658 - - 2010 - 240 - - false - true - true - - - NONE - false - - 1709045216656 - - TEXT_BOX - 0 - 100 - NO_DELIMETER - - - - - 1709045216687 - - 2010 - 260 - - false - true - true - - - NONE - false - - 1709045216685 - - TEXT_BOX - 0 - 100 - NO_DELIMETER - - - - - 1709045216711 - - - 2010 - 280 - - false - true - true - - - NONE - false - - 1709045216709 - - TEXT_BOX - 0 - 100 - NO_DELIMETER - - - - - 1709045216759 - - 2010 - 320 - - false - true - true - - - NONE - false - - 1709045216757 - - TEXT_BOX - 0 - 100 - NO_DELIMETER - - - - - 1709045216780 - - 2010 - 300 - - false - true - true - - - NONE - false - - 1709045216778 - - TEXT_BOX - 0 - 100 - NO_DELIMETER - - - - - 1709045216801 - - 2010 - 370 - - false - true - true - - - NONE - false - - - - - 1709045216799 - - TEXT_BOX - 0 - 100 - NO_DELIMETER - - - - - 1709733732105 - - - 1610 - 140 - - false - true - true - - - NONE - false - - 1709733732103 - TEXT_BOX - 0 - 100 - NO_DELIMETER - - - - - 1717070647695 - - 1600 - 560 - - false - true - true - - - NONE - false - - - - - 1717070647693 - CHECK_BOX - 0 - 100 - NO_DELIMETER - - - - - 1716916299738 - - 1610 - 180 - - false - true - true - - ArrayList - Double - String - - - - 1716993724806 - - 1610 - 200 - - false - true - true - - ArrayList - Double - String - - - diff --git a/_alp/Agents/GCEnergyProduction/AOC.GCEnergyProduction.xml b/_alp/Agents/GCEnergyProduction/AOC.GCEnergyProduction.xml index 402556cf..757153b4 100644 --- a/_alp/Agents/GCEnergyProduction/AOC.GCEnergyProduction.xml +++ b/_alp/Agents/GCEnergyProduction/AOC.GCEnergyProduction.xml @@ -23,9 +23,6 @@ - - - @@ -53,9 +50,6 @@ - - - diff --git a/_alp/Agents/GCGridBattery/AOC.GCGridBattery.xml b/_alp/Agents/GCGridBattery/AOC.GCGridBattery.xml index fef5072f..bae78a8e 100644 --- a/_alp/Agents/GCGridBattery/AOC.GCGridBattery.xml +++ b/_alp/Agents/GCGridBattery/AOC.GCGridBattery.xml @@ -23,9 +23,6 @@ - - - @@ -53,9 +50,6 @@ - - - diff --git a/_alp/Agents/GCHouse/AOC.GCHouse.xml b/_alp/Agents/GCHouse/AOC.GCHouse.xml index 6577cd04..c4dd0905 100644 --- a/_alp/Agents/GCHouse/AOC.GCHouse.xml +++ b/_alp/Agents/GCHouse/AOC.GCHouse.xml @@ -24,9 +24,6 @@ - - - @@ -54,9 +51,6 @@ - - - @@ -180,41 +174,7 @@ 1663772408666 1663772408662 - - - - 1674899624978 - - true - 2170 - 50 - - false - true - true - true - - 1751011893431 - true - 1674979200000 - - - DAY - - - - DAY - - - true - v_dailyHPConsumption_kWh - 100 - - 1663772408662 @@ -276,7 +236,6 @@ SHAPE_DRAW_2D3D 0 DIM_NON_CURRENT - diff --git a/_alp/Agents/GCHouse/Code/Events.java b/_alp/Agents/GCHouse/Code/Events.java deleted file mode 100644 index 295845d5..00000000 --- a/_alp/Agents/GCHouse/Code/Events.java +++ /dev/null @@ -1,8 +0,0 @@ -void e_measureHeatpump() -{/*ALCODESTART::1674899601674*/ -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; -} -/*ALCODEEND*/} - diff --git a/_alp/Agents/GCHouse/Code/Events.xml b/_alp/Agents/GCHouse/Code/Events.xml deleted file mode 100644 index 6aa8ec44..00000000 --- a/_alp/Agents/GCHouse/Code/Events.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - 1674899601674 - - true - 2010 - 50 - - false - true - true - - - - HOUR - - - - PER_HOUR - - 1658477089954 - true - 1674979200000 - - - DAY - - - - DAY - - false - - - - diff --git a/_alp/Agents/GCHouse/Code/Functions.java b/_alp/Agents/GCHouse/Code/Functions.java index 6144b358..374a9803 100644 --- a/_alp/Agents/GCHouse/Code/Functions.java +++ b/_alp/Agents/GCHouse/Code/Functions.java @@ -5,210 +5,6 @@ super.f_operateFlexAssets(timeVariables); /*ALCODEEND*/} -double f_createThermalStorageModel() -{/*ALCODESTART::1669203453155*/ -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 ); -} - - -/*ALCODEEND*/} - -double f_chargeOnPrice_overwrite(double currentElectricityPriceConsumption_eurpkWh,double availablePowerOnGC_kW) -{/*ALCODESTART::1674402121915*/ -//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; - - -/*ALCODEEND*/} - -double f_determineChargingDemandOfEV() -{/*ALCODESTART::1675034695162*/ -//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; -} - -/*ALCODEEND*/} - double f_manageCookingTracker(J_TimeVariables timeVariables) {/*ALCODESTART::1726334759211*/ // Add heat from cooking assets to house diff --git a/_alp/Agents/GCHouse/Code/Functions.xml b/_alp/Agents/GCHouse/Code/Functions.xml index 3c3f15b4..ac8d5d09 100644 --- a/_alp/Agents/GCHouse/Code/Functions.xml +++ b/_alp/Agents/GCHouse/Code/Functions.xml @@ -5,8 +5,8 @@ double 1664963959146 - 910 - 280 + 960 + 370