org.flexiblepower.api.efi.bufferhelper
Q
- The quantity that describes what is stored in the buffer (e.g. temperature or electricity).public class Buffer<Q extends javax.measure.quantity.Quantity> extends java.lang.Object
Constructor and Description |
---|
Buffer(BufferRegistration<Q> br)
A Buffer may only be constructed from a complete BufferRegistration message.
|
Modifier and Type | Method and Description |
---|---|
BufferActuator<Q> |
getActuatorById(int id)
Returns the Actuator object based on the id.
|
java.util.Map<java.lang.Integer,BufferActuator<Q>> |
getActuators()
Gets all actuators indexed on their id.
|
javax.measure.Measurable<javax.measure.quantity.Duration> |
getAllocationDelay()
Gets the allocation delay.
|
double |
getCurrentFillFraction()
Gets the fill level of the buffer relative to the maximum and minimum fill level.
|
javax.measure.Measurable<Q> |
getCurrentFillLevel()
Gets the current fill level of the buffer.
|
java.util.Map<java.lang.Integer,BufferActuator<Q>> |
getElectricalActuatorMap()
Checks all the actuators for those of type electricity and returns them in an ArrayList.
|
java.util.List<BufferActuator<Q>> |
getElectricalActuators()
Checks all the actuators for those of type electricity and returns them in an ArrayList.
|
java.lang.String |
getFillLevelLabel()
Gets the label of the fill level.
|
FillLevelFunction<LeakageRate> |
getLeakageFunction()
Returns the buffer leakage function.
|
double |
getMaximumFillLevel() |
double |
getMinimumFillLevel()
For a heat pump, minimum fill level is the lowest temperature of the buffer.
|
java.lang.String |
getResourceId()
Gets the identifier of the resource.
|
javax.measure.unit.Unit<Q> |
getUnit()
Gets the default fill level unit of this buffer.
|
boolean |
hasReceivedStateUpdate()
Returns whether a state update has been received.
|
boolean |
hasReceivedSystemDescription()
Returns whether this Buffer has received a system description or not yet.
|
void |
processStateUpdate(BufferStateUpdate<Q> bsu)
BufferStateUpdate information is added to the internal model.
|
void |
processSystemDescription(BufferSystemDescription bsd)
BufferSystemDescription message's information is copied to the internal model of the buffer.
|
public Buffer(BufferRegistration<Q> br)
br
- A complete buffer registration message. (This is enforced in the message constructor).public void processSystemDescription(BufferSystemDescription bsd)
bsd
- The buffer system description message.java.lang.IllegalArgumentException
- When the ActuatorId in the BufferSystemDescription is not knownpublic void processStateUpdate(BufferStateUpdate<Q> bsu)
bsu
- The BufferStateUpdate message.java.lang.IllegalArgumentException
- Throws when the ActuatorId, RunningModeId or timerId is not known.public java.util.List<BufferActuator<Q>> getElectricalActuators()
public java.util.Map<java.lang.Integer,BufferActuator<Q>> getElectricalActuatorMap()
public double getCurrentFillFraction() throws java.lang.IllegalStateException, java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
- When minimum fill level is greater than or equal to the maximum fill level, this throws.java.lang.IllegalStateException
- When no information is available yet about the state of the buffer.public javax.measure.Measurable<Q> getCurrentFillLevel() throws java.lang.IllegalStateException
java.lang.IllegalStateException
- When no state update has been received.public boolean hasReceivedSystemDescription()
public boolean hasReceivedStateUpdate()
public double getMinimumFillLevel() throws java.lang.IllegalStateException
java.lang.IllegalStateException
- When no system description has been received, this throws.public double getMaximumFillLevel() throws java.lang.IllegalStateException
java.lang.IllegalStateException
public javax.measure.Measurable<javax.measure.quantity.Duration> getAllocationDelay()
public FillLevelFunction<LeakageRate> getLeakageFunction()
public java.lang.String getResourceId()
public java.lang.String getFillLevelLabel()
public javax.measure.unit.Unit<Q> getUnit()
public java.util.Map<java.lang.Integer,BufferActuator<Q>> getActuators()
public BufferActuator<Q> getActuatorById(int id)
id
- The id of the actuator.