Class Simulator
java.lang.Object
io.openems.edge.controller.ess.timeofusetariff.optimizer.Simulator
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionstatic final double
Used to incorporate charge/discharge efficiency. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected static double
calculateCost
(Params p, StateMachine[] schedule) Simulates a Schedule and calculates the cost.protected static StateMachine[]
getBestSchedule
(Params p, long executionLimitSeconds) Runs the optimization with default settings.protected static StateMachine[]
getBestSchedule
(Params p, long executionLimitSeconds, Integer populationSize, Integer limit) protected static com.google.common.collect.ImmutableSortedMap
<ZonedDateTime, Simulator.Period> simulate
(Params p, StateMachine[] schedule) Simulates a Schedule in quarterly periods.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.
-
Field Details
-
EFFICIENCY_FACTOR
public static final double EFFICIENCY_FACTORUsed to incorporate charge/discharge efficiency.- See Also:
-
-
Constructor Details
-
Simulator
public Simulator()
-
-
Method Details
-
calculateCost
Simulates a Schedule and calculates the cost.- Parameters:
p
- theParams
schedule
- theStateMachine
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
- theParams
schedule
- theStateMachine
states of the Schedule- Returns:
- a Map of
Simulator.Period
s
-
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
- theParams
op
- the currentParams.OptimizePeriod
state
- theStateMachine
of the current periodnextEssInitial
- the initial SoC-Energy; also used as return valuecollect
- aConsumer
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
Runs the optimization with default settings.- Parameters:
p
- theParams
executionLimitSeconds
- limit.byExecutionTime.ofSeconds- Returns:
- the best schedule
-
getBestSchedule
protected static StateMachine[] getBestSchedule(Params p, long executionLimitSeconds, Integer populationSize, Integer limit)
-