java.lang.Object
io.openems.edge.controller.ess.gridoptimizedcharge.DelayCharge

public class DelayCharge extends Object
  • Field Details

    • DEFAULT_TARGET_TIME

      protected static final LocalTime DEFAULT_TARGET_TIME
  • Constructor Details

  • Method Details

    • getPredictiveDelayChargeMaxCharge

      protected Integer getPredictiveDelayChargeMaxCharge() throws OpenemsError.OpenemsNamedException
      Get the maximum active power limit depending on the prediction values.

      Calculates the target minute, when the state of charge should reach 100 percent depending on the predicted production and consumption and limits the charge value of the ESS, to get full at this calculated target minute including a configured buffer.

      Returns:
      Maximum charge power
      Throws:
      OpenemsError.OpenemsNamedException - on error
    • getManualDelayChargeMaxCharge

      protected Integer getManualDelayChargeMaxCharge() throws OpenemsError.OpenemsNamedException
      Get the maximum active power limit depending the configured target time.

      Limits the charge value of the ESS, to get full at the given target minute.

      Returns:
      Maximum charge power
      Throws:
      OpenemsError.OpenemsNamedException - on error
    • parseTime

      protected static LocalTime parseTime(String time)
    • applyCalculatedLimit

      protected void applyCalculatedLimit(int rawDelayChargeMaxChargePower, int delayChargeMaxChargePower)
      Apply the calculated power limit as constraint.
      Parameters:
      rawDelayChargeMaxChargePower - raw maximum charge power (Not adapted to DC)
      delayChargeMaxChargePower - maximum power that should be charged by the ESS
      Throws:
      OpenemsException - on error
    • getCalculatedPowerLimit

      protected static Integer getCalculatedPowerLimit(int remainingCapacity, int remainingTime, Integer[] quarterHourlyProduction, Integer[] quarterHourlyConsumption, Clock clock, DelayChargeRiskLevel riskLevel, int maxApparentPower, int targetMinute, double minimumChargePower, ControllerEssGridOptimizedChargeImpl parent)
      Calculates the charging power limit.
      Parameters:
      remainingCapacity - remaining capacity of the ess
      remainingTime - remaining time till target minute in seconds
      quarterHourlyProduction - predicted production
      quarterHourlyConsumption - predicted consumption
      clock - clock
      riskLevel - risk level
      maxApparentPower - maximum apparent power of the ess
      targetMinute - target as minute of the day
      minimumChargePower - minimumChargePower configured by the user
      parent - ControllerEssGridOptimizedChargeImpl to set debug channels
      Returns:
      the calculated charging power limit or null if no limit should be applied
    • _getCalculatedPowerLimit

      @Deprecated protected static Integer _getCalculatedPowerLimit(int remainingCapacity, int remainingTime)
      Deprecated.
      Get calculated power limit.

      Deprecated method, ignoring efficient charge power and predicted energy.

      Parameters:
      remainingCapacity - remaining capacity of the ess
      remainingTime - remaining time till target minute in seconds
      Returns:
      the calculated charging power limit or null if no limit should be applied
    • calculateRemainingTime

      protected static int calculateRemainingTime(Clock clock, int targetMinute)
      Calculates the number of seconds left to the target hour.
      Parameters:
      clock - clock
      targetMinute - target as minute of the day
      Returns:
      the remaining time
    • calculateTargetMinute

      protected static Optional<Integer> calculateTargetMinute(Integer[] quarterHourlyProduction, Integer[] quarterHourlyConsumption, ZonedDateTime predictionStartQuarterHour)
      Calculates the target minute from quarter-hourly production and consumption predictions.

      Returning the last valid target minute if it is present and the new calculated target minute would be null.

      Parameters:
      quarterHourlyProduction - the production prediction
      quarterHourlyConsumption - the consumption prediction
      predictionStartQuarterHour - the prediction start quarterHour
      Returns:
      the target minute
    • calculateAvailEnergy

      protected static int calculateAvailEnergy(Integer[] quarterHourlyProduction, Integer[] quarterHourlyConsumption, Clock clock, int targetMinute)
      Calculate the available Energy.
      Parameters:
      quarterHourlyProduction - predicted production
      quarterHourlyConsumption - predicted consumption
      clock - clock
      targetMinute - target as minute of the day
      Returns:
      available energy in Wh
    • setDelayChargeStateAndLimit

      protected void setDelayChargeStateAndLimit(DelayChargeState state, Integer limit)
      Update the StateMachine and ChargePowerLimit channels.
      Parameters:
      state - the DelayChargeState
      limit - the ChargePowerLimit
    • getAsZonedDateTime

      protected static ZonedDateTime getAsZonedDateTime(int minuteOfDay, Clock clock)
    • getPredictedChargeStart

      protected static Long getPredictedChargeStart(int targetTime, int capacity, int soc, Clock clock) throws OpenemsException
      Gets the predicted charge start time as epoch seconds.
      Parameters:
      targetTime - target time
      capacity - capacity of the ess
      soc - state of charge
      clock - clock
      Returns:
      start of charging the battery as epoch seconds
      Throws:
      OpenemsException - on error