|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectrouting.MessageRouter
routing.ActiveRouter
routing.EnergyAwareRouter
public class EnergyAwareRouter
Energy level-aware variant of Epidemic router.
| Field Summary | |
|---|---|
static java.lang.String |
ENERGY_VALUE_ID
ModuleCommunicationBus identifier for the "current amount of
energy left" variable. |
static java.lang.String |
INIT_ENERGY_S
Initial units of energy -setting id ("intialEnergy"). |
static java.lang.String |
SCAN_ENERGY_S
Energy usage per scanning -setting id ("scanEnergy"). |
static java.lang.String |
TRANSMIT_ENERGY_S
Energy usage per second when sending -setting id ("transmitEnergy"). |
static java.lang.String |
WARMUP_S
Energy update warmup period -setting id ("energyWarmup"). |
| Fields inherited from class routing.ActiveRouter |
|---|
DELETE_DELIVERED_S, deleteDelivered, RESPONSE_PREFIX, sendingConnections, TTL_CHECK_INTERVAL |
| Fields inherited from class routing.MessageRouter |
|---|
B_SIZE_S, DENIED_NO_SPACE, DENIED_OLD, DENIED_TTL, DENIED_UNSPECIFIED, MSG_TTL_S, msgTtl, Q_MODE_FIFO, Q_MODE_RANDOM, RCV_OK, SEND_QUEUE_MODE_S, TRY_LATER_BUSY |
| Constructor Summary | |
|---|---|
protected |
EnergyAwareRouter(EnergyAwareRouter r)
Copy constructor. |
|
EnergyAwareRouter(Settings s)
Constructor. |
| Method Summary | |
|---|---|
protected int |
checkReceiving(Message m)
Checks if router "wants" to start receiving message (i.e. |
void |
moduleValueChanged(java.lang.String key,
java.lang.Object newValue)
Called by the combus is the energy value is changed |
protected void |
reduceEnergy(double amount)
Updates the current energy so that the given amount is reduced from it. |
protected void |
reduceSendingAndScanningEnergy()
Reduces the energy reserve for the amount that is used by sending data and scanning for the other nodes. |
EnergyAwareRouter |
replicate()
Creates a replicate of this router. |
protected void |
setEnergy(double[] range)
Sets the current energy level into the given range using uniform random distribution. |
java.lang.String |
toString()
Returns a String presentation of this router |
void |
update()
Checks out all sending connections to finalize the ready ones and abort those whose connection went down. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String INIT_ENERGY_S
public static final java.lang.String SCAN_ENERGY_S
public static final java.lang.String TRANSMIT_ENERGY_S
public static final java.lang.String WARMUP_S
Report.WARMUP_S from the namespace
"Report".
public static final java.lang.String ENERGY_VALUE_ID
ModuleCommunicationBus identifier for the "current amount of
energy left" variable. Value type: double
| Constructor Detail |
|---|
public EnergyAwareRouter(Settings s)
s - The settings objectprotected EnergyAwareRouter(EnergyAwareRouter r)
r - The router prototype where setting values are copied from| Method Detail |
|---|
protected void setEnergy(double[] range)
range - The min and max values of the range, or if only one value
is given, that is used as the energy levelprotected int checkReceiving(Message m)
ActiveRouter
checkReceiving in class ActiveRouterm - The message to check
MessageRouter.receiveMessage(Message, DTNHost), i.e.
MessageRouter.RCV_OK if receiving seems to be OK,
TRY_LATER_BUSY if router is transferring, DENIED_OLD if the router
is already carrying the message or it has been delivered to
this router (as final recipient), or DENIED_NO_SPACE if the message
does not fit into bufferprotected void reduceEnergy(double amount)
amount - The amount of energy to reduceprotected void reduceSendingAndScanningEnergy()
public void update()
ActiveRouter
update in class ActiveRouterActiveRouter.addToSendingConnections(Connection)public EnergyAwareRouter replicate()
MessageRouter
replicate in class MessageRouter
public void moduleValueChanged(java.lang.String key,
java.lang.Object newValue)
moduleValueChanged in interface ModuleCommunicationListenerkey - The energy IDnewValue - The new energy valuepublic java.lang.String toString()
MessageRouter
toString in class MessageRouter
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||