Repository navigation
Real Time Emulation
The current simulator has been designed to run in emulation mode principally. This requires real-time processing which satisfies the chosen time granularity, typically 1 ms: all the processes happening in a single timestep should meet this deadline. Consequently, the emulator has been implemented in C++ specifically designed to efficiently allow concurrent processing.
The MAC Layer processes run first, with UEs processed immediately after. This is done as some results from the MAC Layer step are required by the UE processes. For debugging purposes, the user can choose to run the emulator with reduced threading, however, this is discouraged when the emulator must run in real-time.
As the emulator is designed to handle real traffic, the emulator should be able to precisely run a timestep every millisecond to ensure consistency between the IP packets and emulator's timing. We implemented a simple ticker module in charge of synchronizing the emulator, triggering a signal every configured period:
The main configuration parameters are:
[Global]
duration: -1
period: 1
progress_log_period_s: 10
multithreading: true
threads: 16
Which define:
-
period: signal triggering period in ms. If set to<0, simulation mode is used and the emulator runs as fast as possible. -
duration: duration of the simulation in seconds. Use-1for an indefinite real-time run. -
progress_log_period_s: period for progress logs in simulated seconds. -
multithreading: enable/disable threaded execution. -
threads: number of UE worker threads.
For actual IP traffic, use the workflow described in Run Scripts and NFQUEUE Lab. It prepares the Linux namespace topology and the NFQUEUE rules required for deterministic real-traffic experiments.
The control plane described in Runtime Control works in real time as well: commands are applied at the start of the step, before the MAC layer, and cost nothing measurable when the inbox is empty.
What is not available in real time is sync_mode: barrier. Blocking the simulation
thread until an external controller grants credit means missing the 1 ms deadline, which
is the whole point of this mode. The emulator refuses it at startup: with period > 0
the mode degrades to async and a warning is written to the log. Use the barrier in
fast mode, where simulated time is what is being gated.
Version 3.0 was checked in live mode on one 16-core, 30 GB host with the FikoRE live lab (emulator, backend with iperf3 servers, Pulpo and Polyp), four UEs and a 20 MHz cell. Traffic was iperf3 UDP (classic and ECT(1)) and TCP, plus an SBSP smoke on every start.
| Check | Result |
|---|---|
| Idle stop/start | 20 cycles, no failures |
| Stop/start under traffic (classic UDP, ECT(1) UDP, mixed overload, TCP CUBIC) | 20 cycles, no failures |
| Recreate, crash (SIGKILL) and graceful stop of the emulator under traffic | 15 cycles, no failures; Docker restarts a crashed emulator in 2 s |
| Runtime rate cap under load | capped UE at 0.54 Mbit/s, others unaffected, 98 % of the rate restored on reset |
| ECT(1) downlink | CE-marked; not-ECT traffic is never marked |
Lab down / up
|
18 s / 30 s median |
| Kernel-queue drops at half of the cell capacity | none |
| 12 h soak under mixed overload | no restarts, 20 threads and 15 descriptors from start to end, goodput and RTT stable |
| CPU of the emulator | 43 % of one core on average in the soak (p95 50 %), 66 % on a 100 MHz cell at 160 Mbit/s |
Memory grew from 35 to 42 MB over the 12 hours, mostly in the first three, and about 0.2 MB/h afterwards. Longer sessions should keep an eye on it.
Two behaviours that follow from the model and are not faults: with a 2x overload the uplink goodput collapses more than the downlink does, and a UDP flow marked ECT(1) that ignores the CE marks sees a much larger RTT than a classic one (about 455 ms against 38 ms), because nothing reacts to the marks. Next to a classic flood, ECT(1) and not-ECT pings both stay around 15 ms.
The ticker keeps its timestamps in 64 bits since 3.0. Before that a 32-bit count of microseconds
wrapped after 71.6 minutes and the emulator stopped forwarding traffic, so earlier versions
cannot run a live session longer than that. The MAC layer and the packet handlers still keep
simulated time as float seconds, whose resolution reaches one TTI after about 2.3 hours; the
12 h soak showed no visible effect, but runs much longer than that have not been verified.
fikore returns zero only after a normal completed run. Aborted and invalid runs use stable
Unix-style statuses, so a supervisor such as Docker can tell a crash from a requested stop:
| Status | Meaning |
|---|---|
| 0 | completed run |
| 64 | usage error |
| 66 | missing input |
| 70 | fatal runtime or software error |
| 74 | control peer lost in barrier mode |
| 75 | credit timeout in barrier mode |
| 76 | control-protocol integrity failure, including an event backlog |
| 78 | invalid configuration |
SIGINT and SIGTERM keep their native signal status.