public interface Connector extends Node
changeBuffer(double)
, i.e. on whether you
fill up the connectors buffer or drain it.
To feed power into the network, simply fill up the buffer, to consume power
take power from the buffer. The network will balance the power between all
buffers connected to it. The algorithm goes as follows: if there was a change
to some buffer, computer the average power available in all buffers. Build
two sets: those of buffers with above-average level, and those with below-
average fill. From all above-average buffers take so much energy that they
remain just above average fill (but only take integral values - this is to
avoid floating point errors causing trouble). Distribute the collected energy
equally among the below-average buffers (as good as possible).Modifier and Type | Method and Description |
---|---|
double |
changeBuffer(double delta)
Try to apply the specified delta to the global buffer.
|
double |
globalBuffer()
The accumulative energy stored across all buffers in the node's network.
|
double |
globalBufferSize()
The accumulative size of all buffers in the node's network.
|
double |
localBuffer()
The energy stored in the local buffer.
|
double |
localBufferSize()
The size of the local buffer.
|
void |
setLocalBufferSize(double size)
Change the size of the connectors local buffer.
|
boolean |
tryChangeBuffer(double delta)
Like
changeBuffer(double) , but will only store/consume the specified
amount of energy if there is enough capacity/energy available. |
address, canBeReachedFrom, connect, disconnect, host, isNeighborOf, neighbors, network, reachability, reachableNodes, remove, sendToAddress, sendToNeighbors, sendToReachable, sendToVisible
load, save
double localBuffer()
double localBufferSize()
double globalBuffer()
double globalBufferSize()
double changeBuffer(double delta)
delta
- the amount of energy to consume or store.boolean tryChangeBuffer(double delta)
changeBuffer(double)
, but will only store/consume the specified
amount of energy if there is enough capacity/energy available.delta
- the amount of energy to consume or store.void setLocalBufferSize(double size)
size
- the new size of the local buffer. Note that this is capped
to a minimum of zero, i.e. if a negative value is passed the
size will be set to zero.