-
- All Implemented Interfaces:
-
java.io.Serializable,org.protelis.vm.NetworkManager
public final class AlchemistNetworkManager implements NetworkManager, Serializable
Emulates a NetworkManager. This particular network manager does not send messages instantly. Instead, it records the last message to send, and only when simulateMessageArrival is called the transfer is actually done.
-
-
Field Summary
Fields Modifier and Type Field Description private final doubleretentionTimeprivate ImmutableMap<DeviceUID, Map<CodePath, Object>>neighborState
-
Constructor Summary
Constructors Constructor Description AlchemistNetworkManager(Reaction<Object> executionTime, RunProtelisProgram<out Object> program)AlchemistNetworkManager(Reaction<Object> executionTime, RunProtelisProgram<out Object> program, double retentionTime)AlchemistNetworkManager(Reaction<Object> executionTime, RunProtelisProgram<out Object> program, double retentionTime, RealDistribution distanceLossDistribution)
-
Method Summary
Modifier and Type Method Description doublegetRetentionTime()ImmutableMap<DeviceUID, Map<CodePath, Object>>getNeighborState()RealDistributiongetDistancePacketLossDistribution()voidshareState(Map<CodePath, Object> toSend)voidsimulateMessageArrival(double currentTime)Simulates the arrival of the message to other nodes. -
-
Constructor Detail
-
AlchemistNetworkManager
AlchemistNetworkManager(Reaction<Object> executionTime, RunProtelisProgram<out Object> program)
- Parameters:
executionTime- the reaction hosting the NetworkManagerprogram- the RunProtelisProgram
-
AlchemistNetworkManager
AlchemistNetworkManager(Reaction<Object> executionTime, RunProtelisProgram<out Object> program, double retentionTime)
- Parameters:
executionTime- the reaction hosting the NetworkManagerprogram- the RunProtelisProgramretentionTime- how long the messages will be stored.
-
AlchemistNetworkManager
AlchemistNetworkManager(Reaction<Object> executionTime, RunProtelisProgram<out Object> program, double retentionTime, RealDistribution distanceLossDistribution)
- Parameters:
executionTime- the reaction hosting the NetworkManagerprogram- the RunProtelisProgramretentionTime- how long the messages will be stored.distanceLossDistribution- the package loss probability, scaling with distance.
-
-
Method Detail
-
getRetentionTime
double getRetentionTime()
-
getNeighborState
ImmutableMap<DeviceUID, Map<CodePath, Object>> getNeighborState()
-
getDistancePacketLossDistribution
RealDistribution getDistancePacketLossDistribution()
-
shareState
void shareState(Map<CodePath, Object> toSend)
-
simulateMessageArrival
void simulateMessageArrival(double currentTime)
Simulates the arrival of the message to other nodes.
- Parameters:
currentTime- the current simulation time (used to understand when a message should get dropped).
-
-
-
-