Class TimeOfUsePrices
java.lang.Object
io.openems.edge.timeofusetariff.api.TimeOfUsePrices
Holds individual Time-of-Use prices - one value per 15 minutes.
Values have unit '_meta/Currency'/MWh.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final TimeOfUsePrices
Holds an 'empty'TimeOfUsePrices
object, i.e.final SortedMap
<ZonedDateTime, Double> Unmodifiable Map of Quarters (rounded to 15 minutes) and their respective prices. -
Method Summary
Modifier and TypeMethodDescriptionDouble[]
asArray()
Gets the prices as an array ofDouble
s.protected static SortedMap
<ZonedDateTime, Double> buildMap
(ZonedDateTime time, Double... values) static TimeOfUsePrices
from
(ZonedDateTime time, TimeOfUsePrices prices) Returns aTimeOfUsePrices
object by deriving data from given `prices`, but skipping values before given `time`.static TimeOfUsePrices
from
(ZonedDateTime time, Double... values) Constructs aTimeOfUsePrices
object.static TimeOfUsePrices
from
(SortedMap<ZonedDateTime, Double> map) Constructs aTimeOfUsePrices
object.getFirst()
Gets the first price in the map; or null if the map is empty.boolean
isEmpty()
Returnstrue
if this map contains no prices.protected static SortedMap
<ZonedDateTime, Double>
-
Field Details
-
EMPTY_PRICES
Holds an 'empty'TimeOfUsePrices
object, i.e. `pricePerQuarter` map is empty. -
pricePerQuarter
Unmodifiable Map of Quarters (rounded to 15 minutes) and their respective prices. Values can be null.
-
-
Method Details
-
from
Constructs aTimeOfUsePrices
object.Trailing `nulls` are cut out.
- Parameters:
time
- the base time of the prices, rounded down to 15 minutesvalues
- the quarterly price values.- Returns:
- a
TimeOfUsePrices
object
-
from
Constructs aTimeOfUsePrices
object.Postprocessing is applied:
- Map keys are rounded down to full quarters (15 minutes)
- Gaps in keys are filled (value = null)
- Trailing null values are removed
- Parameters:
map
- aSortedMap
of times and prices- Returns:
- a
TimeOfUsePrices
object
-
from
Returns aTimeOfUsePrices
object by deriving data from given `prices`, but skipping values before given `time`.If time of given object is still valid, the object is returned. Otherwise a new object is created.
- Parameters:
time
- the base time of the prices, rounded down to 15 minutesprices
- the sourceTimeOfUsePrices
object- Returns:
- a
TimeOfUsePrices
object
-
isEmpty
public boolean isEmpty()Returnstrue
if this map contains no prices.- Returns:
true
if this map contains no prices
-
getFirst
Gets the first price in the map; or null if the map is empty.- Returns:
- price or null
-
asArray
Gets the prices as an array ofDouble
s.- Returns:
- prices array
-
buildMap
-
postprocesMap
-