Package org.openremote.manager.energy
Class EnergyOptimiser
java.lang.Object
org.openremote.manager.energy.EnergyOptimiser
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected doubleprotected double -
Constructor Summary
ConstructorsConstructorDescriptionEnergyOptimiser(double intervalSize, double financialWeighting) 24 divided by intervalSize must be a whole number -
Method Summary
Modifier and TypeMethodDescriptionvoidapplyEarningOpportunities(double[][] importCostAndPower, double[][] exportCostAndPower, double[] energyLevelMins, double[] energyLevelMaxs, double[] powerSetpoints, Function<Integer, Double> energyLevelCalculator, Function<Integer, Double> powerImportMaxCalculator, Function<Integer, Double> powerExportMaxCalculator) Will find the best earning opportunity for each interval (import or export) and will then try to apply them in chronological order (reallocating earlier import/exports if it cost beneficial).voidapplyEnergyMinImports(double[][] importCostAndPower, double[] energyLevelMins, double[] powerSetpoints, Function<Integer, Double> energyLevelCalculator, BiFunction<Integer, double[], double[]> importOptimiser, Function<Integer, Double> powerImportMaxCalculator) Will update the powerSetpoints in order to achieve the energyLevelMin values supplied.voidapplyEnergySchedule(double[] energyLevelMins, double[] energyLevelMaxs, double energyCapacity, int[][] energyLevelSchedule, LocalDateTime currentTime) Will take the supplied 24x7 energy schedule percentages and energy level min/max values and apply them to the supplied energyLevelMins also adjusting for any intervalSize difference.voidapplyExportOpportunity(double[][] importCostAndPower, double[][] exportCostAndPower, double[] energyLevelMins, double[] energyLevelMaxs, double[] powerSetpoints, Function<Integer, Double> energyLevelCalculator, Function<Integer, Double> powerImportMaxCalculator, Function<Integer, Double> powerExportMaxCalculator, int interval) Tries to apply the maximum export power as defined in the exportCostAndPower at the specified interval taking into consideration the maximum power and energy levels; if there is insufficient power or energy capacity at the interval then an earlier cost effective import opportunity will be attempted to offset the requirement.voidapplyImportOpportunity(double[][] importCostAndPower, double[][] exportCostAndPower, double[] energyLevelMins, double[] energyLevelMaxs, double[] powerSetpoints, Function<Integer, Double> energyLevelCalculator, Function<Integer, Double> powerImportMaxCalculator, Function<Integer, Double> powerExportMaxCalculator, int interval) Tries to apply the maximum import power as defined in the importCostAndPower at the specified interval taking into consideration the maximum power and energy levels; if there is insufficient power or energy capacity at the interval then an earlier cost effective export opportunity will be attempted to offset the requirement.intBiFunction<Integer, Double, double[]> getExportOptimiser(double[] powerNets, double[] powerNetLimits, double[] tariffImports, double[] tariffExports, double assetExportCost) Returns a function that can be used to calculate any export saving (per kWh) and power band needed to achieve it based on requested interval index and power export max value (negative as this is for export).doubleBiFunction<Integer, double[], double[]> getImportOptimiser(double[] powerNets, double[] powerNetLimits, double[] tariffImports, double[] tariffExports, double assetImportCost) Returns a function that can be used to calculate the optimum cost (per kWh) and power band needed to achieve it based on requested interval index, power min and power max values.doubleprotected booleanisExportOpportunity(double[] costAndPower, double powerSetpoint, int interval, Function<Integer, Double> powerExportMaxCalculator) protected booleanisImportOpportunity(double[] costAndPower, double powerSetpoint, int interval, Function<Integer, Double> powerImportMaxCalculator) voidnormaliseEnergyMinRequirements(double[] energyLevelMins, Function<Integer, Double> powerImportMaxCalculator, Function<Integer, Double> powerExportMaxCalculator, double energyLevel) Adjusts the supplied energyLevelMin values to match the physical characteristics (i.e.voidretrospectiveEnergyAllocator(double[][] importCostAndPower, double[] energyLevelMins, double[] powerSetpoints, BiFunction<Integer, double[], double[]> importOptimiser, Function<Integer, Double> powerImportMaxCalculator, double energyLevel, int fromInterval, int toInterval) Creates earlier imports between fromInterval (inclusive) and toInterval (exclusive) in order to meet min energy level requirement at the specified interval based on the provided energy level at the start of fromInterval.
-
Field Details
-
intervalSize
protected double intervalSize -
financialWeighting
protected double financialWeighting
-
-
Constructor Details
-
EnergyOptimiser
public EnergyOptimiser(double intervalSize, double financialWeighting) throws IllegalArgumentException 24 divided by intervalSize must be a whole number- Throws:
IllegalArgumentException
-
-
Method Details
-
getIntervalSize
public double getIntervalSize() -
getFinancialWeighting
public double getFinancialWeighting() -
get24HourIntervalCount
public int get24HourIntervalCount() -
applyEnergySchedule
public void applyEnergySchedule(double[] energyLevelMins, double[] energyLevelMaxs, double energyCapacity, int[][] energyLevelSchedule, LocalDateTime currentTime) Will take the supplied 24x7 energy schedule percentages and energy level min/max values and apply them to the supplied energyLevelMins also adjusting for any intervalSize difference. The energy schedule should be in UTC time. -
normaliseEnergyMinRequirements
public void normaliseEnergyMinRequirements(double[] energyLevelMins, Function<Integer, Double> powerImportMaxCalculator, Function<Integer, Double> powerExportMaxCalculator, double energyLevel) Adjusts the supplied energyLevelMin values to match the physical characteristics (i.e. the charge and discharge rates). -
applyEnergyMinImports
public void applyEnergyMinImports(double[][] importCostAndPower, double[] energyLevelMins, double[] powerSetpoints, Function<Integer, Double> energyLevelCalculator, BiFunction<Integer, double[], double[]> importOptimiser, Function<Integer, Double> powerImportMaxCalculator) Will update the powerSetpoints in order to achieve the energyLevelMin values supplied. -
retrospectiveEnergyAllocator
public void retrospectiveEnergyAllocator(double[][] importCostAndPower, double[] energyLevelMins, double[] powerSetpoints, BiFunction<Integer, double[], double[]> importOptimiser, Function<Integer, Double> powerImportMaxCalculator, double energyLevel, int fromInterval, int toInterval) Creates earlier imports between fromInterval (inclusive) and toInterval (exclusive) in order to meet min energy level requirement at the specified interval based on the provided energy level at the start of fromInterval. -
applyEarningOpportunities
public void applyEarningOpportunities(double[][] importCostAndPower, double[][] exportCostAndPower, double[] energyLevelMins, double[] energyLevelMaxs, double[] powerSetpoints, Function<Integer, Double> energyLevelCalculator, Function<Integer, Double> powerImportMaxCalculator, Function<Integer, Double> powerExportMaxCalculator) Will find the best earning opportunity for each interval (import or export) and will then try to apply them in chronological order (reallocating earlier import/exports if it cost beneficial). The powerSetpoints will be updated as a result. -
isImportOpportunity
-
isExportOpportunity
-
applyImportOpportunity
public void applyImportOpportunity(double[][] importCostAndPower, double[][] exportCostAndPower, double[] energyLevelMins, double[] energyLevelMaxs, double[] powerSetpoints, Function<Integer, Double> energyLevelCalculator, Function<Integer, Double> powerImportMaxCalculator, Function<Integer, Double> powerExportMaxCalculator, int interval) Tries to apply the maximum import power as defined in the importCostAndPower at the specified interval taking into consideration the maximum power and energy levels; if there is insufficient power or energy capacity at the interval then an earlier cost effective export opportunity will be attempted to offset the requirement. The powerSetpoints will be updated as a result. -
applyExportOpportunity
public void applyExportOpportunity(double[][] importCostAndPower, double[][] exportCostAndPower, double[] energyLevelMins, double[] energyLevelMaxs, double[] powerSetpoints, Function<Integer, Double> energyLevelCalculator, Function<Integer, Double> powerImportMaxCalculator, Function<Integer, Double> powerExportMaxCalculator, int interval) Tries to apply the maximum export power as defined in the exportCostAndPower at the specified interval taking into consideration the maximum power and energy levels; if there is insufficient power or energy capacity at the interval then an earlier cost effective import opportunity will be attempted to offset the requirement. The powerSetpoints will be updated as a result. -
getExportOptimiser
public BiFunction<Integer,Double, getExportOptimiserdouble[]> (double[] powerNets, double[] powerNetLimits, double[] tariffImports, double[] tariffExports, double assetExportCost) Returns a function that can be used to calculate any export saving (per kWh) and power band needed to achieve it based on requested interval index and power export max value (negative as this is for export). This is used to determine whether there are export opportunities for earning/saving rather than using the grid. -
getImportOptimiser
public BiFunction<Integer,double[], getImportOptimiserdouble[]> (double[] powerNets, double[] powerNetLimits, double[] tariffImports, double[] tariffExports, double assetImportCost) Returns a function that can be used to calculate the optimum cost (per kWh) and power band needed to achieve it based on requested interval index, power min and power max values. The returned power band will satisfy the requested power min value but this could mean that cost is not optimum for that interval if a lower power could be used. If possible a 0 power min should be tried first for all applicable intervals and if more energy is required then another pass can be made with a high enough min power to allow desired energy levels to be reached. This is used to determine the best times and power values for importing energy to meet the requirements.
-