AntHocNet 2.0.0
Paper-faithful ant-colony ad hoc routing: the shared core and its adapters
Loading...
Searching...
No Matches
ahn_web::World Class Reference

The whole simulation: nodes, radio, mobility, traffic and the event queue. More...

#include <ahn_web/sim.h>

Public Member Functions

 World (std::uint64_t seed)
 An empty world; seed derives every random stream in it.
 
void setArea (double x, double y, double z)
 Field size in metres (z > 0 enables altitude).
 
void setDiskChannel (double range)
 Unit-disk links of radius range metres.
 
void setUrbanChannel (double range, int blocksX, int blocksY, double streetWidth)
 Unit disk cut by the buildings of a blocksX x blocksY street grid.
 
void setIslChannel ()
 Links only where addIslLink() says, delay tracking distance.
 
void addIslLink (int a, int b)
 Add an inter-satellite link (ChannelKind::Isl).
 
void setBitrate (double bps)
 Transmitter bit rate (default 2 Mbit/s).
 
void setLossProbability (double p)
 Independent per-reception loss probability (default 0).
 
int addNode (double x, double y, double z)
 Add a node at (x, y, z); returns its address.
 
void setMobility (int node, const Mobility &m)
 Give node a mobility model (Manhattan snaps it to an intersection).
 
int addFlow (int src, int dst, double rate, double start, double stop)
 Add a CBR flow; returns its index.
 
anthocnet::core::Config & config ()
 The protocol Config every node is built with – the core defaults.
 
void start ()
 Build the nodes' core logic and arm their timers and the flows.
 
void advanceTo (double t)
 Process every event up to simulated time t (starts if needed).
 
double now () const
 Current simulated time (s).
 
std::uint64_t seed () const
 The seed this world was built from.
 
void moveNode (int node, double x, double y, double z)
 Drag node to (x, y, z) and pin it there (it stops moving).
 
void setNodeUp (int node, bool up)
 Switch node off (its held packets are dropped) or back on.
 
void cutIslLink (int a, int b)
 Remove an inter-satellite link.
 
int nodeCount () const
 Number of nodes.
 
Vec3 position (int node) const
 Where node is now.
 
bool nodeUp (int node) const
 Whether node is switched on.
 
bool linkUp (int a, int b) const
 Whether a and b can hear each other now.
 
const Node & node (int i) const
 Node i (for read-only inspection of its core state).
 
const std::vector< Flow > & flows () const
 The flows and their running totals.
 
int pendingCount (int node) const
 Data packets node holds waiting for a route.
 
const std::vector< LogEvent > & log () const
 Events since the last clearLog().
 
void clearLog ()
 Forget the logged events (the front end drains them every frame).
 
std::uint64_t antTransmissions () const
 Ant transmissions so far (control overhead).
 
int urbanBlocksX () const
 Street grid blocks along x (Urban).
 
int urbanBlocksY () const
 Street grid blocks along y (Urban).
 
double streetWidth () const
 Street width in metres (Urban).
 
double range () const
 Radio range in metres (Disk, Urban).
 
ChannelKind channel () const
 The link rule in use.
 
Vec3 area () const
 Field size in metres.
 

Static Public Member Functions

static std::string formatEvent (const LogEvent &e)
 One trace line per logged event (the parity format).
 

Friends

class Node
 

Detailed Description

The whole simulation: nodes, radio, mobility, traffic and the event queue.

Definition at line 221 of file sim.h.

Constructor & Destructor Documentation

◆ World()

ahn_web::World::World ( std::uint64_t  seed)
explicit

An empty world; seed derives every random stream in it.

Member Function Documentation

◆ setArea()

void ahn_web::World::setArea ( double  x,
double  y,
double  z 
)

Field size in metres (z > 0 enables altitude).

◆ setDiskChannel()

void ahn_web::World::setDiskChannel ( double  range)

Unit-disk links of radius range metres.

◆ setUrbanChannel()

void ahn_web::World::setUrbanChannel ( double  range,
int  blocksX,
int  blocksY,
double  streetWidth 
)

Unit disk cut by the buildings of a blocksX x blocksY street grid.

◆ setIslChannel()

void ahn_web::World::setIslChannel ( )

Links only where addIslLink() says, delay tracking distance.

◆ addIslLink()

void ahn_web::World::addIslLink ( int  a,
int  b 
)

Add an inter-satellite link (ChannelKind::Isl).

◆ setBitrate()

void ahn_web::World::setBitrate ( double  bps)
inline

Transmitter bit rate (default 2 Mbit/s).

Definition at line 238 of file sim.h.

◆ setLossProbability()

void ahn_web::World::setLossProbability ( double  p)
inline

Independent per-reception loss probability (default 0).

Definition at line 240 of file sim.h.

◆ addNode()

int ahn_web::World::addNode ( double  x,
double  y,
double  z 
)

Add a node at (x, y, z); returns its address.

◆ setMobility()

void ahn_web::World::setMobility ( int  node,
const Mobility &  m 
)

Give node a mobility model (Manhattan snaps it to an intersection).

◆ addFlow()

int ahn_web::World::addFlow ( int  src,
int  dst,
double  rate,
double  start,
double  stop 
)

Add a CBR flow; returns its index.

◆ config()

anthocnet::core::Config & ahn_web::World::config ( )
inline

The protocol Config every node is built with – the core defaults.

Worlds never change it (ADR-0019); a mission's labelled knob may.

Definition at line 249 of file sim.h.

◆ start()

void ahn_web::World::start ( )

Build the nodes' core logic and arm their timers and the flows.

◆ advanceTo()

void ahn_web::World::advanceTo ( double  t)

Process every event up to simulated time t (starts if needed).

◆ now()

double ahn_web::World::now ( ) const
inline

Current simulated time (s).

Definition at line 258 of file sim.h.

◆ seed()

std::uint64_t ahn_web::World::seed ( ) const
inline

The seed this world was built from.

Definition at line 260 of file sim.h.

◆ moveNode()

void ahn_web::World::moveNode ( int  node,
double  x,
double  y,
double  z 
)

Drag node to (x, y, z) and pin it there (it stops moving).

◆ setNodeUp()

void ahn_web::World::setNodeUp ( int  node,
bool  up 
)

Switch node off (its held packets are dropped) or back on.

◆ cutIslLink()

void ahn_web::World::cutIslLink ( int  a,
int  b 
)

Remove an inter-satellite link.

◆ nodeCount()

int ahn_web::World::nodeCount ( ) const
inline

Number of nodes.

Definition at line 272 of file sim.h.

◆ position()

Vec3 ahn_web::World::position ( int  node) const
inline

Where node is now.

Definition at line 274 of file sim.h.

References node().

◆ nodeUp()

bool ahn_web::World::nodeUp ( int  node) const
inline

Whether node is switched on.

Definition at line 276 of file sim.h.

References node().

◆ linkUp()

bool ahn_web::World::linkUp ( int  a,
int  b 
) const
inline

Whether a and b can hear each other now.

Definition at line 278 of file sim.h.

◆ node()

const Node & ahn_web::World::node ( int  i) const
inline

Node i (for read-only inspection of its core state).

Definition at line 280 of file sim.h.

Referenced by nodeUp(), pendingCount(), and position().

◆ flows()

const std::vector< Flow > & ahn_web::World::flows ( ) const
inline

The flows and their running totals.

Definition at line 282 of file sim.h.

◆ pendingCount()

int ahn_web::World::pendingCount ( int  node) const
inline

Data packets node holds waiting for a route.

Definition at line 284 of file sim.h.

References node().

◆ log()

const std::vector< LogEvent > & ahn_web::World::log ( ) const
inline

Events since the last clearLog().

Definition at line 286 of file sim.h.

◆ clearLog()

void ahn_web::World::clearLog ( )
inline

Forget the logged events (the front end drains them every frame).

Definition at line 288 of file sim.h.

◆ antTransmissions()

std::uint64_t ahn_web::World::antTransmissions ( ) const
inline

Ant transmissions so far (control overhead).

Definition at line 290 of file sim.h.

◆ urbanBlocksX()

int ahn_web::World::urbanBlocksX ( ) const
inline

Street grid blocks along x (Urban).

Definition at line 292 of file sim.h.

◆ urbanBlocksY()

int ahn_web::World::urbanBlocksY ( ) const
inline

Street grid blocks along y (Urban).

Definition at line 294 of file sim.h.

◆ streetWidth()

double ahn_web::World::streetWidth ( ) const
inline

Street width in metres (Urban).

Definition at line 296 of file sim.h.

◆ range()

double ahn_web::World::range ( ) const
inline

Radio range in metres (Disk, Urban).

Definition at line 298 of file sim.h.

◆ channel()

ChannelKind ahn_web::World::channel ( ) const
inline

The link rule in use.

Definition at line 300 of file sim.h.

◆ area()

Vec3 ahn_web::World::area ( ) const
inline

Field size in metres.

Definition at line 302 of file sim.h.

◆ formatEvent()

static std::string ahn_web::World::formatEvent ( const LogEvent &  e)
static

One trace line per logged event (the parity format).

Friends And Related Symbol Documentation

◆ Node

friend class Node
friend

Definition at line 308 of file sim.h.


The documentation for this class was generated from the following file: