pub struct Network {
pub seed: u64,
pub max_delay: u64,
pub loss_per_mille: u16,
pub topology: Topology,
pub partitions: Vec<Partition>,
pub collisions: bool,
pub clusters: Option<Clusters>,
}Expand description
How the simulated network behaves.
Fields§
§seed: u64Seeds every random choice: delays and losses.
max_delay: u64The most extra ticks a message may take, on top of the one tick every message takes.
loss_per_mille: u16The chance, per mille, that one copy of a broadcast is lost. 0 is lossless; 1000 or more loses everything.
topology: TopologyWhich agents can reach each other at all.
partitions: Vec<Partition>Intervals in which groups of agents cannot reach each other.
collisions: boolWhether broadcasts from hidden nodes collide.
Every message a sender broadcasts is a frame that waits a random backoff of one of
BACKOFF_SLOTS slots before going out, as 802.11 radios do. Two frames from
senders that cannot hear each other in the same slot are both lost to every agent
that hears both senders; their bytes still count, since they took the airtime.
Senders that hear each other take turns, as radios sensing the channel do, so on a
Topology::Complete network nothing collides. This follows the hidden-node
picture in Raja, Habibi and How (IEEE Access 10, 2022, p. 19756), with their
contention window of 16.
clusters: Option<Clusters>Clusters that talk among themselves every tick, but with each other only every
few ticks; None for one rate everywhere.