Class Prediction
java.lang.Object
io.openems.edge.predictor.api.prediction.Prediction
Holds a prediction - one value per 15 minutes.
Values have the same unit as the base Channel, i.e. if the Prediction relates to _sum/ProductionGridActivePower, the value is in unit Watt and represents the average Watt within a 15 minutes period.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final Prediction
Holds an 'empty'Prediction
object, i.e.final SortedMap
<ZonedDateTime, Integer> Unmodifiable Map of Quarters (rounded to 15 minutes) and their respective predicted values. -
Method Summary
Modifier and TypeMethodDescriptionInteger[]
asArray()
Gets the prediction values as an array ofInteger
s.protected static SortedMap
<ZonedDateTime, Integer> buildMap
(ZonedDateTime time, Integer... values) static Prediction
from
(Sum sum, ChannelAddress channelAddress, ZonedDateTime time, Integer... values) static Prediction
from
(io.openems.edge.predictor.api.prediction.Prediction.ValueRange valueRange, ZonedDateTime time, Integer... values) Constructs aPrediction
object.static Prediction
from
(io.openems.edge.predictor.api.prediction.Prediction.ValueRange valueRange, SortedMap<ZonedDateTime, Integer> map) Constructs aPrediction
object.static Prediction
from
(ZonedDateTime time, Prediction prediction) Returns aPrediction
object by deriving data from given `prediction`, but skipping values before given `time`.static Prediction
from
(ZonedDateTime time, Integer... values) Constructs aPrediction
object withPrediction.ValueRange
.static io.openems.edge.predictor.api.prediction.Prediction.ValueRange
getValueRange
(Sum sum, ChannelAddress channelAddress) Gets thePrediction.ValueRange
for the givenChannelAddress
.boolean
isEmpty()
Returnstrue
if this map contains no predictions.protected static SortedMap
<ZonedDateTime, Integer> postprocessMap
(io.openems.edge.predictor.api.prediction.Prediction.ValueRange valueRange, SortedMap<ZonedDateTime, Integer> map) static Prediction
sum
(Prediction... predictions) Sums up the givenPrediction
s.toString()
-
Field Details
-
EMPTY_PREDICTION
Holds an 'empty'Prediction
object, i.e. `valuePerQuarter` map is empty. -
valuePerQuarter
Unmodifiable Map of Quarters (rounded to 15 minutes) and their respective predicted values. Values can be null.
-
-
Method Details
-
sum
Sums up the givenPrediction
s. If any source value is null, the result value is also null.- Parameters:
predictions
- the givenPrediction
- Returns:
- a
Prediction
holding the sum of all predictions.
-
getValueRange
public static io.openems.edge.predictor.api.prediction.Prediction.ValueRange getValueRange(Sum sum, ChannelAddress channelAddress) Gets thePrediction.ValueRange
for the givenChannelAddress
.- Parameters:
sum
- theSum
channelAddress
- theChannelAddress
- Returns:
- a
Prediction.ValueRange
-
from
- Parameters:
time
- the base time of the prediction values, rounded down to 15 minutesvalues
- the quarterly prediction values.- Returns:
- a
Prediction
object
-
from
public static Prediction from(Sum sum, ChannelAddress channelAddress, ZonedDateTime time, Integer... values) Constructs aPrediction
object with the defaultPrediction.ValueRange
for the givenChannelAddress
.Trailing `nulls` are cut out.
- Parameters:
sum
- theSum
channelAddress
- theChannelAddress
time
- the base time of the prediction values, rounded down to 15 minutesvalues
- the quarterly prediction values.- Returns:
- a
Prediction
object
-
from
public static Prediction from(io.openems.edge.predictor.api.prediction.Prediction.ValueRange valueRange, ZonedDateTime time, Integer... values) Constructs aPrediction
object.Trailing `nulls` are cut out.
- Parameters:
valueRange
- thePrediction.ValueRange
time
- the base time of the prediction values, rounded down to 15 minutesvalues
- the quarterly prediction values.- Returns:
- a
Prediction
object
-
from
public static Prediction from(io.openems.edge.predictor.api.prediction.Prediction.ValueRange valueRange, SortedMap<ZonedDateTime, Integer> map) Constructs aPrediction
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:
valueRange
- thePrediction.ValueRange
map
- aSortedMap
of times and prices- Returns:
- a
Prediction
object
-
from
Returns aPrediction
object by deriving data from given `prediction`, 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 minutesprediction
- the sourcePrediction
object- Returns:
- a
Prediction
object
-
isEmpty
public boolean isEmpty()Returnstrue
if this map contains no predictions.- Returns:
true
if this map contains no predictions
-
asArray
Gets the prediction values as an array ofInteger
s.- Returns:
- values array
-
toString
-
buildMap
-
postprocessMap
protected static SortedMap<ZonedDateTime,Integer> postprocessMap(io.openems.edge.predictor.api.prediction.Prediction.ValueRange valueRange, SortedMap<ZonedDateTime, Integer> map)
-