org.flexiblepower.api.efi.unconstrainedhelper
public class Unconstrained extends java.lang.Object
Constructor and Description |
---|
Unconstrained(UnconstrainedRegistration registration)
Constructs a Unconstrained object that keeps the state of the Unconstrained device and provides helper function
for the matcher, like which states are reachable.
|
Modifier and Type | Method and Description |
---|---|
int |
getCurrentRunningModeId()
The current running mode.
|
java.util.List<javax.measure.Measurable<javax.measure.quantity.Power>> |
getPossibleDemands(java.util.Date moment)
Gets the electrical demands of all reachable RunningModes at this moment including the current one.
|
java.util.List<javax.measure.Measurable<javax.measure.quantity.Power>> |
getPossibleDemands(java.util.Date moment,
double fillLevel)
Gets the electrical demands of all reachable RunningModes at this moment including the current one.
|
java.util.Set<java.lang.Integer> |
getReachableRunningModeIds(java.util.Date now)
Returns the reachableRunning mode ids including the current one, if it may stay in it.
|
java.util.Collection<RunningMode<RunningModeBehaviour>> |
getReachableRunningModes(java.util.Date now)
Returns the reachableRunning modes including the current one, if it may stay in it.
|
java.lang.String |
getResourceId()
The ResourceId of this Unconstrained device
|
CommoditySet |
getSupportedCommodities() |
boolean |
hasReceivedStateUpdate()
Indicates whether this Unconstrained has seen a SystemDescription yet.
|
boolean |
hasReceivedSystemDescription()
Indicates whether this Unconstrained device has seen a SystemDescription yet.
|
boolean |
hasRunningMode(int rmId)
Returns whether this Unconstrained device has this running mode or not.
|
void |
processStateUpdate(UnconstrainedStateUpdate stateUpdate)
Updates the current running mode and the timers.
|
void |
processSystemDescription(UnconstrainedSystemDescription description)
Takes a system description and inserts the running modes and the timers.
|
void |
updateTimer(int timerId,
java.util.Date finishedAt)
Upon receiving an update, the end time of the given timer is updated.
|
public Unconstrained(UnconstrainedRegistration registration)
registration
- The complete and correct initial registration message.public void processSystemDescription(UnconstrainedSystemDescription description)
description
- The description message with Timers and RunningModes.public void processStateUpdate(UnconstrainedStateUpdate stateUpdate)
stateUpdate
- Contains an update for the timers that have a new finishedAt time. No timer information means no
updated information and the previously known finishedAt remains true.java.lang.IllegalArgumentException
- StateUpdate contains not known RunningMode.public java.util.Collection<RunningMode<RunningModeBehaviour>> getReachableRunningModes(java.util.Date now) throws java.lang.IllegalArgumentException
now
- The current time.java.lang.IllegalArgumentException
- The RunningModeId is not known.public java.util.Set<java.lang.Integer> getReachableRunningModeIds(java.util.Date now)
now
- The current time.public java.util.List<javax.measure.Measurable<javax.measure.quantity.Power>> getPossibleDemands(java.util.Date moment)
moment
- The moment of interest.java.lang.IllegalArgumentException
- When a RunningMode is empty.public java.util.List<javax.measure.Measurable<javax.measure.quantity.Power>> getPossibleDemands(java.util.Date moment, double fillLevel)
moment
- The moment of interest.fillLevel
- The current fillLeveljava.lang.IllegalArgumentException
- When a RunningMode is empty.public void updateTimer(int timerId, java.util.Date finishedAt)
timerId
- The id of the timer.finishedAt
- The new finishedAt time that overwrites the old one.public boolean hasRunningMode(int rmId)
rmId
- The Id of the RunningModepublic boolean hasReceivedStateUpdate()
public boolean hasReceivedSystemDescription()
public int getCurrentRunningModeId()
public java.lang.String getResourceId()
public CommoditySet getSupportedCommodities()