AntHocNet 2.0.0
Paper-faithful ant-colony ad hoc routing: the shared core and its adapters
Loading...
Searching...
No Matches
sim.h
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-only
2// Copyright (C) 2026 Daniel Henrique Joppi
3
4/**
5 * The browser adapter (#544, ADR-0021): an adapter for the shared AntHocNet
6 * core, next to the ns-3 one (and NS-2's, through v1.9.0). It owns what an adapter owns -- the
7 * clock, the RNGs, the timers, the pending-packet queue, a radio -- and
8 * carries out the RouteDecisions the core returns. It never decides a route.
9 *
10 * The radio is a *teaching* model: unit disk (optionally cut by buildings,
11 * or a fixed ISL adjacency), a FIFO transmitter per node with a fixed bit
12 * rate, and a MAC transmit-failure report when a unicast's receiver is out of
13 * range. It is not ns-3 and nothing measured on it is a benchmark number.
14 *
15 * Everything here is plain C++14 on top of core/, so the same sources build
16 * natively and with Emscripten; the native-vs-WASM decision-trace parity test
17 * (web/test/parity.sh) holds the two builds byte-identical.
18 */
19#ifndef AHN_WEB_SIM_H
20#define AHN_WEB_SIM_H
21
22#include <cstdint>
23#include <deque>
24#include <functional>
25#include <map>
26#include <memory>
27#include <queue>
28#include <set>
29#include <string>
30#include <vector>
31
35
36namespace ahn_web {
37
39
40/// SplitMix64: tiny, portable, and bit-identical on every platform (integer
41/// arithmetic only; the double is an exact 53-bit scaling).
43public:
44 /// A stream starting from `seed` (every seed is valid).
45 explicit SplitMix64(std::uint64_t seed) : state_(seed) {}
46 /// Next raw 64-bit value.
47 std::uint64_t next();
48 /// Uniform double in [0, 1), from the top 53 bits.
49 double uniform();
50 /// Uniform double in [lo, hi).
51 double uniform(double lo, double hi) { return lo + (hi - lo) * uniform(); }
52 /// Uniform integer in [0, n); 0 when n <= 0.
53 int uniformInt(int n);
54
55private:
56 std::uint64_t state_;
57};
58
59/// A position in metres (z = altitude; 0 on planar worlds).
60struct Vec3 {
61 double x = 0; ///< east
62 double y = 0; ///< north
63 double z = 0; ///< up
64};
65
66/// One straight leg of a node's trajectory: p0 at t0 to p1 at t1.
67struct Leg {
68 double t0; ///< start time (s)
69 double t1; ///< end time (s); 1e18 = forever
70 Vec3 p0; ///< position at t0
71 Vec3 p1; ///< position at t1 (linear in between)
72};
73
74/// How a node moves. Values are part of the JS API (setMobility's `kind`).
75enum class MobilityKind {
76 Static, ///< never moves (until dragged)
77 RandomWaypoint, ///< straight legs to uniform waypoints, optional pause
78 GaussMarkov, ///< correlated speed and heading, 1 s steps, optionally 3-D
79 Manhattan, ///< street grid: straight 0.5, left/right 0.25 at each corner
80 Orbit, ///< circular orbit around the field's centre (satellites)
81};
82
83/// A node's mobility model and its parameters.
84struct Mobility {
86 double speedMin = 1; ///< RWP / Manhattan: leg speed lower bound (m/s)
87 double speedMax = 10; ///< RWP / Manhattan: leg speed upper bound (m/s)
88 double pause = 0; ///< RWP: pause at each waypoint (s)
89 double gmMeanSpeed = 10; ///< Gauss-Markov: mean speed (m/s)
90 double gmAlpha = 0.85; ///< Gauss-Markov: memory (0 = random walk, 1 = straight line)
91 bool threeD = false; ///< Gauss-Markov: also move in z
92 double orbitRadius = 0; ///< Orbit: distance from the field's centre (m)
93 double orbitInc = 0; ///< Orbit: inclination (rad)
94 double orbitRaan = 0; ///< Orbit: right ascension of the ascending node (rad)
95 double orbitPhase = 0; ///< Orbit: argument of latitude at t = 0 (rad)
96 double orbitRate = 0; ///< Orbit: angular speed (rad/s)
97};
98
99/// sin / cos from arithmetic only (range reduction + Taylor series), so the
100/// native and WASM builds compute bit-identical orbits: libm's transcendental
101/// functions are not guaranteed to round the same on both.
102double detSin(double x);
103double detCos(double x);
104
105/// Where an Orbit puts a node at time t (centre = the field's centre, z = 0).
106Vec3 orbitPosition(const Mobility& m, const Vec3& centre, double t);
107
108/// Which link rule the teaching radio uses.
109enum class ChannelKind {
110 Disk, ///< linked iff within range()
111 Urban, ///< within range() and no building on the line of sight
112 Isl, ///< linked iff an inter-satellite link was added (and not cut)
113};
114
115/// Event kinds of the log the front end animates and the parity test diffs.
116/// Append only: the JS front end and the trace format index these numerically.
117enum class Ev : int {
118 TxAnt = 1, ///< node -> peer (-1 = broadcast); a=AntType, b=dir, v=arrival time
119 RxAnt = 2, ///< node received from peer; a=AntType, b=dir
120 TxData = 3, ///< node -> peer; a=flow, b=seq, v=arrival time
121 Deliver = 4, ///< node = destination; a=flow, b=seq, v=end-to-end delay
122 Drop = 5, ///< node; a=flow, b=seq, peer=DropReason
123 RouteAdd = 6, ///< node; peer=next hop, a=destination
124 RouteDel = 7, ///< node; peer=next hop, a=destination
125 Queue = 8, ///< node; a=flow, b=seq, peer=destination
126 TxFail = 9, ///< node -> peer unicast failed (out of range)
127 NodeDown = 10, ///< node switched off
128 NodeUp = 11, ///< node switched on
129};
130
131/// Why a data packet was lost (the `peer` field of an Ev::Drop event).
132enum class DropReason : int {
133 Ttl = 1, ///< hop limit reached (a loop)
134 QueueTimeout = 2, ///< waited QueueTimeout (3 s) for a route, or queue full
135 HoldCap = 3, ///< a reconvergence hold outlived ReconvHoldCap (200 ms)
136 RepairDiscard = 4, ///< a local repair expired: the core's DiscardPending
137 NodeOff = 5, ///< the holding or receiving node was switched off
138};
139
140/// One entry of the event log (see Ev for what each field means per kind).
141struct LogEvent {
142 double t; ///< simulated time (s)
143 Ev kind; ///< what happened
144 int node; ///< where it happened
145 int peer; ///< the other node, -1 for broadcast, or a DropReason
146 int a; ///< kind-specific (AntType, flow, destination)
147 int b; ///< kind-specific (AntDirection, sequence number)
148 double v; ///< kind-specific (arrival time, end-to-end delay)
149};
150
151/// A constant-bit-rate data flow and its running totals.
152struct Flow {
153 int src; ///< source node
154 int dst; ///< destination node
155 double rate; ///< packets per second
156 double start; ///< first packet (s)
157 double stop; ///< no packets after this (s)
158 int sent = 0; ///< packets originated
159 int delivered = 0; ///< packets that reached dst
160 double delaySum = 0; ///< sum of end-to-end delays of delivered packets (s)
161};
162
163class World;
164
165/// One AntHocNet node: the core logic plus the adapter state around it.
169public:
170 /// Created by World::addNode(); `seed` derives the node's streams.
171 Node(World& w, int id, std::uint64_t seed);
172
173 /// IClock: the world's simulated time.
174 anthocnet::core::Time now() const override;
175 /// IRng: this node's own stream (independent of every other node's).
176 double uniform() override { return rng_.uniform(); }
177 /// IRng: uniform integer in [0, n).
178 int uniformInt(int n) override { return rng_.uniformInt(n); }
179
180 /// IRouterObserver: report-only -- route changes feed the event log.
181 void onRouteChanged(NodeAddress dest, NodeAddress nb, bool added) override;
182
183 /// This node's address (its index in the World).
184 int id() const { return id_; }
185 /// The core state machine (valid after World::start()).
187 /// The core state machine, read-only (inspection).
188 const anthocnet::core::AntRouterLogic& logic() const { return *logic_; }
189
190private:
191 friend class World;
192 /// A data packet, in flight or held in the pending queue.
193 struct Pending {
194 int flow, seq, src, dst, ttl, hops;
195 NodeAddress prev; ///< previous hop (A1 loop exclusion; re-injection)
196 double created, firstQueued, expire;
197 bool reconv; ///< held while a known route re-forms (#21 HOLD_RECONV)
198 };
199
200 World& w_;
201 int id_;
202 SplitMix64 rng_; ///< the core's IRng
203 SplitMix64 timerRng_; ///< adapter timer jitter (as ns-3's m_timerRng)
204 // Mobility is generated lazily but from a per-node stream, so a node's
205 // trajectory never depends on when (or whether) another node was queried.
206 mutable SplitMix64 mobRng_;
207 mutable double gmSpeed_ = 0;
208 mutable Vec3 gmDir_{1, 0, 0};
209 mutable int mhDir_ = 0;
210 mutable bool rwpPaused_ = false;
211 std::unique_ptr<anthocnet::core::AntRouterLogic> logic_;
212 bool up_ = true;
213 double busyUntil_ = 0; ///< FIFO transmitter
214 std::deque<Pending> pending_;
215 std::set<NodeAddress> everRouted_;
216 Mobility mob_;
217 mutable std::vector<Leg> legs_;
218};
219
220/// The whole simulation: nodes, radio, mobility, traffic and the event queue.
221class World {
222public:
223 /// An empty world; `seed` derives every random stream in it.
224 explicit World(std::uint64_t seed);
225
226 // --- scenario construction (before start()) ---------------------------
227 /// Field size in metres (z > 0 enables altitude).
228 void setArea(double x, double y, double z);
229 /// Unit-disk links of radius `range` metres.
230 void setDiskChannel(double range);
231 /// Unit disk cut by the buildings of a blocksX x blocksY street grid.
232 void setUrbanChannel(double range, int blocksX, int blocksY, double streetWidth);
233 /// Links only where addIslLink() says, delay tracking distance.
235 /// Add an inter-satellite link (ChannelKind::Isl).
236 void addIslLink(int a, int b);
237 /// Transmitter bit rate (default 2 Mbit/s).
238 void setBitrate(double bps) { bitrate_ = bps; }
239 /// Independent per-reception loss probability (default 0).
240 void setLossProbability(double p) { loss_ = p; }
241 /// Add a node at (x, y, z); returns its address.
242 int addNode(double x, double y, double z);
243 /// Give `node` a mobility model (Manhattan snaps it to an intersection).
244 void setMobility(int node, const Mobility& m);
245 /// Add a CBR flow; returns its index.
246 int addFlow(int src, int dst, double rate, double start, double stop);
247 /// The protocol Config every node is built with -- the core defaults.
248 /// Worlds never change it (ADR-0019); a mission's labelled knob may.
249 anthocnet::core::Config& config() { return config_; }
250
251 /// Build the nodes' core logic and arm their timers and the flows.
252 void start();
253
254 // --- running ----------------------------------------------------------
255 /// Process every event up to simulated time `t` (starts if needed).
256 void advanceTo(double t);
257 /// Current simulated time (s).
258 double now() const { return now_; }
259 /// The seed this world was built from.
260 std::uint64_t seed() const { return seed_; }
261
262 // --- interaction (any time) -------------------------------------------
263 /// Drag `node` to (x, y, z) and pin it there (it stops moving).
264 void moveNode(int node, double x, double y, double z);
265 /// Switch `node` off (its held packets are dropped) or back on.
266 void setNodeUp(int node, bool up);
267 /// Remove an inter-satellite link.
268 void cutIslLink(int a, int b);
269
270 // --- inspection (read-only) -------------------------------------------
271 /// Number of nodes.
272 int nodeCount() const { return static_cast<int>(nodes_.size()); }
273 /// Where `node` is now.
274 Vec3 position(int node) const { return positionAt(node, now_); }
275 /// Whether `node` is switched on.
276 bool nodeUp(int node) const { return nodes_[node]->up_; }
277 /// Whether a and b can hear each other now.
278 bool linkUp(int a, int b) const { return linkUpAt(a, b, now_); }
279 /// Node `i` (for read-only inspection of its core state).
280 const Node& node(int i) const { return *nodes_[i]; }
281 /// The flows and their running totals.
282 const std::vector<Flow>& flows() const { return flows_; }
283 /// Data packets `node` holds waiting for a route.
284 int pendingCount(int node) const { return static_cast<int>(nodes_[node]->pending_.size()); }
285 /// Events since the last clearLog().
286 const std::vector<LogEvent>& log() const { return log_; }
287 /// Forget the logged events (the front end drains them every frame).
288 void clearLog() { log_.clear(); }
289 /// Ant transmissions so far (control overhead).
290 std::uint64_t antTransmissions() const { return antTx_; }
291 /// Street grid blocks along x (Urban).
292 int urbanBlocksX() const { return blocksX_; }
293 /// Street grid blocks along y (Urban).
294 int urbanBlocksY() const { return blocksY_; }
295 /// Street width in metres (Urban).
296 double streetWidth() const { return streetWidth_; }
297 /// Radio range in metres (Disk, Urban).
298 double range() const { return range_; }
299 /// The link rule in use.
300 ChannelKind channel() const { return channel_; }
301 /// Field size in metres.
302 Vec3 area() const { return area_; }
303
304 /// One trace line per logged event (the parity format).
305 static std::string formatEvent(const LogEvent& e);
306
307private:
308 friend class Node;
309 struct Scheduled {
310 double t;
311 std::uint64_t seq;
312 std::function<void()> fn;
313 };
314 struct Later {
315 bool operator()(const Scheduled& a, const Scheduled& b) const {
316 return a.t > b.t || (a.t == b.t && a.seq > b.seq);
317 }
318 };
319
320 void schedule(double t, std::function<void()> fn);
321 void emit(double t, Ev kind, int node, int peer, int a, int b, double v);
322
323 // mobility
324 void extendLegs(Node& n, double until) const;
325 void armTimers(Node& n);
326 Vec3 positionAt(int node, double t) const;
327 bool linkUpAt(int a, int b, double t) const;
328 bool lineOfSight(const Vec3& a, const Vec3& b) const;
329
330 // timers
331 void helloTimer(int node);
332 void proactiveTimer(int node);
333 void retryTimer(int node);
334 void flowTick(int flow);
335 double jittered(Node& n, double base, bool first);
336
337 // the adapter contract
338 void execute(Node& n, const std::vector<anthocnet::core::RouteDecision>& ds);
339 void sendAnt(Node& n, const anthocnet::core::AntMessage& m, int to);
340 void recvAnt(int node, int from, const std::vector<std::uint8_t>& bytes);
341 void routeData(Node& n, Node::Pending p, int prevHop);
342 void sendData(Node& n, Node::Pending p, int next);
343 void recvData(int node, int from, Node::Pending p);
344 void enqueue(Node& n, Node::Pending p);
345 void flushQueue(Node& n, NodeAddress dst);
346 void discardQueue(Node& n, NodeAddress dst, DropReason why);
347 void purge(Node& n);
348 double txDuration(std::size_t bytes) const { return bytes * 8.0 / bitrate_; }
349 double propagation(int a, int b, double t) const;
350
351 SplitMix64 lossRng_; ///< channel loss draws only
352 std::uint64_t seed_;
354 Vec3 area_{1000, 1000, 0};
356 double range_ = 250;
357 int blocksX_ = 4, blocksY_ = 4;
358 double streetWidth_ = 20;
359 std::set<std::pair<int, int>> isl_;
360 double bitrate_ = 2e6;
361 double loss_ = 0;
362 std::vector<std::unique_ptr<Node>> nodes_;
363 std::vector<Flow> flows_;
364 std::priority_queue<Scheduled, std::vector<Scheduled>, Later> events_;
365 std::uint64_t seq_ = 0;
366 double now_ = 0;
367 bool started_ = false;
368 std::vector<LogEvent> log_;
369 std::uint64_t antTx_ = 0;
370
371 // adapter constants: the ns-3 attribute defaults (anthocnet-routing-protocol.cc)
372 static constexpr double kTimerJitter = 0.05; // TimerJitter
373 static constexpr double kQueueTimeout = 3.0; // QueueTimeout
374 static constexpr double kReconvHoldCap = 0.2; // ReconvHoldCap
375 static constexpr double kRetryInterval = 0.25; // ReactiveRetryInterval
376 static constexpr std::size_t kQueueLen = 64; // RequestQueue maxLen
377 static constexpr int kTtl = 64;
378 static constexpr std::size_t kDataBytes = 64 + 28; // payload + IP/UDP
379 static constexpr int kMacRetries = 7; // failure known after 7 tries
380};
381
382} // namespace ahn_web
383
384#endif // AHN_WEB_SIM_H
One AntHocNet node: the core logic plus the adapter state around it.
Definition sim.h:168
int uniformInt(int n) override
IRng: uniform integer in [0, n).
Definition sim.h:178
void onRouteChanged(NodeAddress dest, NodeAddress nb, bool added) override
IRouterObserver: report-only – route changes feed the event log.
anthocnet::core::AntRouterLogic & logic()
The core state machine (valid after World::start()).
Definition sim.h:186
int id() const
This node's address (its index in the World).
Definition sim.h:184
Node(World &w, int id, std::uint64_t seed)
Created by World::addNode(); seed derives the node's streams.
double uniform() override
IRng: this node's own stream (independent of every other node's).
Definition sim.h:176
anthocnet::core::Time now() const override
IClock: the world's simulated time.
const anthocnet::core::AntRouterLogic & logic() const
The core state machine, read-only (inspection).
Definition sim.h:188
SplitMix64: tiny, portable, and bit-identical on every platform (integer arithmetic only; the double ...
Definition sim.h:42
double uniform()
Uniform double in [0, 1), from the top 53 bits.
double uniform(double lo, double hi)
Uniform double in [lo, hi).
Definition sim.h:51
std::uint64_t next()
Next raw 64-bit value.
SplitMix64(std::uint64_t seed)
A stream starting from seed (every seed is valid).
Definition sim.h:45
int uniformInt(int n)
Uniform integer in [0, n); 0 when n <= 0.
The whole simulation: nodes, radio, mobility, traffic and the event queue.
Definition sim.h:221
void start()
Build the nodes' core logic and arm their timers and the flows.
void addIslLink(int a, int b)
Add an inter-satellite link (ChannelKind::Isl).
void setNodeUp(int node, bool up)
Switch node off (its held packets are dropped) or back on.
std::uint64_t seed() const
The seed this world was built from.
Definition sim.h:260
int urbanBlocksX() const
Street grid blocks along x (Urban).
Definition sim.h:292
Vec3 area() const
Field size in metres.
Definition sim.h:302
void setIslChannel()
Links only where addIslLink() says, delay tracking distance.
bool nodeUp(int node) const
Whether node is switched on.
Definition sim.h:276
void setUrbanChannel(double range, int blocksX, int blocksY, double streetWidth)
Unit disk cut by the buildings of a blocksX x blocksY street grid.
void setLossProbability(double p)
Independent per-reception loss probability (default 0).
Definition sim.h:240
static std::string formatEvent(const LogEvent &e)
One trace line per logged event (the parity format).
friend class Node
Definition sim.h:308
void clearLog()
Forget the logged events (the front end drains them every frame).
Definition sim.h:288
void setDiskChannel(double range)
Unit-disk links of radius range metres.
double range() const
Radio range in metres (Disk, Urban).
Definition sim.h:298
int pendingCount(int node) const
Data packets node holds waiting for a route.
Definition sim.h:284
double now() const
Current simulated time (s).
Definition sim.h:258
int urbanBlocksY() const
Street grid blocks along y (Urban).
Definition sim.h:294
const std::vector< Flow > & flows() const
The flows and their running totals.
Definition sim.h:282
std::uint64_t antTransmissions() const
Ant transmissions so far (control overhead).
Definition sim.h:290
double streetWidth() const
Street width in metres (Urban).
Definition sim.h:296
void advanceTo(double t)
Process every event up to simulated time t (starts if needed).
ChannelKind channel() const
The link rule in use.
Definition sim.h:300
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.
Definition sim.h:249
int nodeCount() const
Number of nodes.
Definition sim.h:272
void setMobility(int node, const Mobility &m)
Give node a mobility model (Manhattan snaps it to an intersection).
const Node & node(int i) const
Node i (for read-only inspection of its core state).
Definition sim.h:280
void setBitrate(double bps)
Transmitter bit rate (default 2 Mbit/s).
Definition sim.h:238
bool linkUp(int a, int b) const
Whether a and b can hear each other now.
Definition sim.h:278
Vec3 position(int node) const
Where node is now.
Definition sim.h:274
void cutIslLink(int a, int b)
Remove an inter-satellite link.
void moveNode(int node, double x, double y, double z)
Drag node to (x, y, z) and pin it there (it stops moving).
const std::vector< LogEvent > & log() const
Events since the last clearLog().
Definition sim.h:286
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).
int addNode(double x, double y, double z)
Add a node at (x, y, z); returns its address.
Source of simulation time (seconds).
Definition ports.h:24
Source of randomness.
Definition ports.h:33
Optional observer the core notifies of routing events (item 15).
Definition ports.h:90
Built-in teaching scenarios: one per network family, shaped like the repo's presets but scaled down t...
Definition scenarios.h:18
MobilityKind
How a node moves. Values are part of the JS API (setMobility's kind).
Definition sim.h:75
@ Manhattan
street grid: straight 0.5, left/right 0.25 at each corner
@ Orbit
circular orbit around the field's centre (satellites)
@ GaussMarkov
correlated speed and heading, 1 s steps, optionally 3-D
@ Static
never moves (until dragged)
@ RandomWaypoint
straight legs to uniform waypoints, optional pause
Vec3 orbitPosition(const Mobility &m, const Vec3 &centre, double t)
Where an Orbit puts a node at time t (centre = the field's centre, z = 0).
Ev
Event kinds of the log the front end animates and the parity test diffs.
Definition sim.h:117
@ NodeDown
node switched off
@ NodeUp
node switched on
@ RouteAdd
node; peer=next hop, a=destination
@ Drop
node; a=flow, b=seq, peer=DropReason
@ Deliver
node = destination; a=flow, b=seq, v=end-to-end delay
@ TxData
node -> peer; a=flow, b=seq, v=arrival time
@ Queue
node; a=flow, b=seq, peer=destination
@ RxAnt
node received from peer; a=AntType, b=dir
@ TxAnt
node -> peer (-1 = broadcast); a=AntType, b=dir, v=arrival time
@ TxFail
node -> peer unicast failed (out of range)
@ RouteDel
node; peer=next hop, a=destination
DropReason
Why a data packet was lost (the peer field of an Ev::Drop event).
Definition sim.h:132
@ HoldCap
a reconvergence hold outlived ReconvHoldCap (200 ms)
@ RepairDiscard
a local repair expired: the core's DiscardPending
@ Ttl
hop limit reached (a loop)
@ NodeOff
the holding or receiving node was switched off
@ QueueTimeout
waited QueueTimeout (3 s) for a route, or queue full
double detSin(double x)
sin / cos from arithmetic only (range reduction + Taylor series), so the native and WASM builds compu...
ChannelKind
Which link rule the teaching radio uses.
Definition sim.h:109
@ Disk
linked iff within range()
@ Urban
within range() and no building on the line of sight
@ Isl
linked iff an inter-satellite link was added (and not cut)
double detCos(double x)
double Time
Simulation time, in seconds.
Definition types.h:24
std::int32_t NodeAddress
Network-layer node address.
Definition types.h:21
A constant-bit-rate data flow and its running totals.
Definition sim.h:152
double rate
packets per second
Definition sim.h:155
int dst
destination node
Definition sim.h:154
double stop
no packets after this (s)
Definition sim.h:157
int sent
packets originated
Definition sim.h:158
double start
first packet (s)
Definition sim.h:156
double delaySum
sum of end-to-end delays of delivered packets (s)
Definition sim.h:160
int delivered
packets that reached dst
Definition sim.h:159
int src
source node
Definition sim.h:153
One straight leg of a node's trajectory: p0 at t0 to p1 at t1.
Definition sim.h:67
double t1
end time (s); 1e18 = forever
Definition sim.h:69
Vec3 p0
position at t0
Definition sim.h:70
double t0
start time (s)
Definition sim.h:68
Vec3 p1
position at t1 (linear in between)
Definition sim.h:71
One entry of the event log (see Ev for what each field means per kind).
Definition sim.h:141
int peer
the other node, -1 for broadcast, or a DropReason
Definition sim.h:145
int b
kind-specific (AntDirection, sequence number)
Definition sim.h:147
int node
where it happened
Definition sim.h:144
int a
kind-specific (AntType, flow, destination)
Definition sim.h:146
double v
kind-specific (arrival time, end-to-end delay)
Definition sim.h:148
double t
simulated time (s)
Definition sim.h:142
Ev kind
what happened
Definition sim.h:143
A node's mobility model and its parameters.
Definition sim.h:84
MobilityKind kind
which model
Definition sim.h:85
double orbitRate
Orbit: angular speed (rad/s)
Definition sim.h:96
double orbitInc
Orbit: inclination (rad)
Definition sim.h:93
double orbitRaan
Orbit: right ascension of the ascending node (rad)
Definition sim.h:94
bool threeD
Gauss-Markov: also move in z.
Definition sim.h:91
double gmAlpha
Gauss-Markov: memory (0 = random walk, 1 = straight line)
Definition sim.h:90
double speedMin
RWP / Manhattan: leg speed lower bound (m/s)
Definition sim.h:86
double gmMeanSpeed
Gauss-Markov: mean speed (m/s)
Definition sim.h:89
double pause
RWP: pause at each waypoint (s)
Definition sim.h:88
double speedMax
RWP / Manhattan: leg speed upper bound (m/s)
Definition sim.h:87
double orbitPhase
Orbit: argument of latitude at t = 0 (rad)
Definition sim.h:95
double orbitRadius
Orbit: distance from the field's centre (m)
Definition sim.h:92
A position in metres (z = altitude; 0 on planar worlds).
Definition sim.h:60
double x
east
Definition sim.h:61
double y
north
Definition sim.h:62
double z
up
Definition sim.h:63
Complete, copyable description of an ant packet.
Definition ant_message.h:48