java.lang.Object
io.openems.edge.controller.ess.timeofusetariff.optimizer.Simulator

public class Simulator extends Object
  • Field Details

    • EFFICIENCY_FACTOR

      public static final double EFFICIENCY_FACTOR
      Used to incorporate charge/discharge efficiency.
      See Also:
  • Constructor Details

    • Simulator

      public Simulator()
  • Method Details

    • calculateCost

      protected static double calculateCost(Params p, StateMachine[] schedule)
      Simulates a Schedule and calculates the cost.
      Parameters:
      p - the Params
      schedule - the StateMachine states of the Schedule
      Returns:
      the cost, lower is better; always positive
    • simulate

      protected static com.google.common.collect.ImmutableSortedMap<ZonedDateTime,Simulator.Period> simulate(Params p, StateMachine[] schedule)
      Simulates a Schedule in quarterly periods.
      Parameters:
      p - the Params
      schedule - the StateMachine states of the Schedule
      Returns:
      a Map of Simulator.Periods
    • simulatePeriod

      protected static double simulatePeriod(Params p, Params.OptimizePeriod op, StateMachine state, AtomicInteger nextEssInitial, Consumer<Simulator.Period> collect)
      Calculates the cost of one Period under the given Schedule.
      Parameters:
      p - the Params
      op - the current Params.OptimizePeriod
      state - the StateMachine of the current period
      nextEssInitial - the initial SoC-Energy; also used as return value
      collect - a Consumer to collect the simulation results if required. We are not always collecting results to reduce workload during simulation.
      Returns:
      the cost, lower is better; always positive
    • getBestSchedule

      protected static StateMachine[] getBestSchedule(Params p, long executionLimitSeconds)
      Runs the optimization with default settings.
      Parameters:
      p - the Params
      executionLimitSeconds - limit.byExecutionTime.ofSeconds
      Returns:
      the best schedule
    • getBestSchedule

      protected static StateMachine[] getBestSchedule(Params p, long executionLimitSeconds, Integer populationSize, Integer limit)