org.flexiblepower.api.efi.bufferhelper
Q
- The quantity type of the bufferpublic class BufferActuator<Q extends javax.measure.quantity.Quantity> extends java.lang.Object
Constructor and Description |
---|
BufferActuator(Actuator ac,
Buffer<Q> parentBuffer)
Constructs a BufferActuator from the Actuator information in a message.
|
Modifier and Type | Method and Description |
---|---|
int |
getActuatorId()
Gets the identifier of this actuator.
|
java.lang.String |
getActuatorLabel()
Gets the friendly label for this actuator.
|
java.util.Collection<RunningMode<FillLevelFunction<RunningModeBehaviour>>> |
getAllRunningModes()
Gets all RunningModes of this actuator.
|
java.util.Map<java.lang.Integer,TimerModel> |
getAllTimers()
Gets all the timers of all of the transitions of all of the running modes.
|
int |
getCurrentRunningModeId()
Gets the identifier of the current running mode.
|
double |
getMaximumFillLevel()
Gets the maximum fill level of the buffer actuator expressed in the agreed upon unit.
|
double |
getMinimumFillLevel()
Gets the minimum fill level of the buffer actuator expressed in the agreed upon unit.
|
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, given this
fill level of the buffer.
|
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<FillLevelFunction<RunningModeBehaviour>>> |
getReachableRunningModes(java.util.Date now)
Returns the reachableRunning modes including the current one, if it may stay in it.
|
CommoditySet |
getSupportedCommodities()
Returns the commodities that this actuator is able to use as either input or output.
|
boolean |
hasRunningMode(int rmId)
Returns whether the RunningMode id is valid for this actuator.
|
protected void |
setAllRunningModes(java.util.Collection<RunningMode<FillLevelFunction<RunningModeBehaviour>>> runningModes)
Renews the set of RunningModes of this Actuator.
|
void |
setCurrentRunningModeId(int currentRunningModeId)
Sets the current running mode.
|
void |
updateTimer(int timerId,
java.util.Date finishedAt)
Upon receiving an update, the end time of the given timer is updated.
|
public BufferActuator(Actuator ac, Buffer<Q> parentBuffer)
ac
- The Actuator's initial information.parentBuffer
- The Parent Buffer (to gain access to the fill level).public int getCurrentRunningModeId()
public void setCurrentRunningModeId(int currentRunningModeId) throws java.lang.IllegalArgumentException
currentRunningModeId
- java.lang.IllegalArgumentException
- When running mode id is not valid.public java.util.Collection<RunningMode<FillLevelFunction<RunningModeBehaviour>>> getAllRunningModes()
protected void setAllRunningModes(java.util.Collection<RunningMode<FillLevelFunction<RunningModeBehaviour>>> runningModes)
runningModes
- public boolean hasRunningMode(int rmId)
rmId
- the Id of the RunningMode.public java.util.Collection<RunningMode<FillLevelFunction<RunningModeBehaviour>>> getReachableRunningModes(java.util.Date now) throws java.lang.IllegalArgumentException
now
- The current time.java.lang.IllegalArgumentException
- When an unknown running mode id is returned from the reachable running modes.public java.util.Set<java.lang.Integer> getReachableRunningModeIds(java.util.Date now)
now
- The current time.public java.util.Map<java.lang.Integer,TimerModel> getAllTimers()
public CommoditySet getSupportedCommodities()
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 java.util.List<javax.measure.Measurable<javax.measure.quantity.Power>> getPossibleDemands(java.util.Date moment, double fillLevel) throws java.lang.IllegalArgumentException
moment
- The moment of interest.fillLevel
- The buffer's current fill level expressed as a value where 0 is the minimum and 1 is the maximum. Its
unit is the agreed upon unit.java.lang.IllegalArgumentException
- When a FillLevelFunction of a reachable state has no range elements.public double getMinimumFillLevel() throws java.lang.IllegalStateException
java.lang.IllegalStateException
- Thrown when no running mode is known yet and a minimum fill level is requested.public double getMaximumFillLevel() throws java.lang.IllegalStateException
java.lang.IllegalStateException
- Thrown when no running mode is known yet and a maximum fill level is requested.public int getActuatorId()
public java.lang.String getActuatorLabel()