NetSim is a wireless network simulator. NetSim is primarily designed for use by developers of the network stacks. It can also be used for initial design, development and debugging of the final applications, but its use in this capacity may be limited because of the way simulated peripherals are designed.
Simulated devices implement a wireless system on a chip (SoC) based on an ARMv6-M-compatible MCU (Cortex-M0) and an abstract IEEE 802.15.4 radio transceiver. By default simulated system runs at 1 MHz, which is usually fast enough for a networking stack and a simple application.
NetSim uses pseudorandom number generator with random, but repeatable output. This allows to run the same simulation over and over with predictable results.
NetSim comes with a very simple
Makefile. To build NetSim simply run
make clean all
By default NetSim is configured to use internal version of the ARMv6-M core. To enable a bit faster version of the core, set
USE_LIBCORE = 1
You will have to build libcore separately. To do this, run
make gen make all
netsim/libcore directory. After build is done, simply compile the main
Note that libcore build requires a lot of RAM and might take a while.
NetSim is a command line application. A name of the configuration file describing a simulated network must be provided as an argument. For example,
$ netsim PingPong_4x4.cfg
By default NetSim is configured to output debugging information from the simulated transcivers. This allows for monitoring of the simulation status, but on slower trminals this may slow down simulation. To disable debug output, set
#define DEBUG_TRX 0
main.h file and recompile NetSim.
Network configuration is described in a plain text file. Each line of the file
contains a declaration for a single network element. Lines starting with
treated as comments and ignored during processing.
Configuration file may include any combination of the commands described below.
Integer numbers may be written in decimal or hexadecimal format. Floating point numbers may be written in natural or scientific notation. Strings must be written as is, without quotes and should not contain spaces.
This command defines the seed value for the pseudorandom number generator used for generating all random numbers during the simulation.
seed must be an integer in the rage 0-4294967296 (unsigned 32 bit).
- seed -- seed value for the pseudorandom number generator
This command defines the simulation time.
time must be an integer in the range 0-2^64 (unsigned 64 bit).
- time -- simulation time (microseconds)
This command defines a scaling factor applied to all coordinates defined
scale command is used. This allows for easy scaling of the
physical network dimensions without updating all coordinates.
scale command may be used more than once. Scaling is applied to all the
following declarations until a new
scale command is used or until
the end of the file is reached. The default scaling factor is
- scale -- scaling factor applied to all following coordinates
This command defines a node (SoC) located at the coordinates (
Simulated program memory of the MCU is initialized with the contents of
firmware image. Firmware image must be in a raw binary format.
id parameter is an unsigned 32-bit integer that is directly available
to the application running on the MCU. This allows for the same firmware
running on different nodes behave differently. For example this parameter
might represent a network address of the node.
node <name> <x> <y> <id> <firmware>
- name -- name of the node (used for logging)
- x -- X coordinate of the transceiver (meters)
- y -- Y coordinate of the transceiver (meters)
- id -- ID of the node
- firmware -- name of the MCU firmware
node R_0 -10.0 50.0 123 PingPong.bin
This command defines a sniffer located at the coordinates (
The sniffer is capable of receiving frames on a single channel or a range of
frequency parameter must be a single integer to define
a single frequency, and two integers separated by a
- character to define
a range of frequencies.
sensitivity of the sniffer defines an effective radius at which sniffer
can receive frames. Wile having an infinite sensitivity would be a distinct
advantage of the simulated sniffer compared to a real one, having all frames
received from the entire network can be confusing and hard to analyze.
This is especially true for large networks, where parts of the network
are physically separated and can not reach each other parts directly.
Currently sensitivity of the simulated radio is
-100 dBm, so keeping
sniffer at the same sensitivity will simulate a sniffer receiver comparable
to the receiver in the node's transceiver.
More than one sniffer may be defined at the same time. This may simplify analysis of the distributed networks.
Sniffer logs are saved in the Daintree Networks SNA format (*.dcf). This format is widely used in the industry and can be opened by many free and proprietary sniffers.
sniffer <name> <x> <y> <frequency> <sensitivity> <output>
- name -- name of the sniffer (used for logging)
- x -- X coordinate of the sniffer (meters)
- y -- Y coordinate of the sniffer (meters)
- frequency -- frequency or frequency range (MHz)
- sensitivity -- receiver sensitivity (dBm)
- output -- name of the sniffer log output file
sniffer S_0 0.0 0.0 2405-2480 -100.0 sniffer.dcf
This command defines a noise source located at the coordinates (
The noise source is capable of generating an uncorrelated white noise on
a single channel or a range of channels. The
frequency parameter must
be a single integer to define a single frequency, and two integers
separated by a
- character to define a range of frequencies.
Power of the generated noise is defined by the
off_time define timing parameters of the generated noise.
off_time parameter is
0, then noise is generated constantly and the
value of the
on_time parameter does not matter.
noise <name> <x> <y> <frequency> <power> <on_time> <off_time>
- name -- name of the noise source (used for logging)
- x -- X coordinate of the noise source (meters)
- y -- Y coordinate of the noise source (meters)
- frequency -- frequency or frequency range (MHz)
- power -- power of the noise source (dBm)
- on_time -- active duration (microseconds)
- off_time -- inactive inactive (microseconds)
noise N_1 100.0 100.0 2405-2480 -10.0 2000000 1000000
Additional Path Loss
This command defines additional path loss between two nodes, a node and a noise source, or a sniffer and a node.
This command can be used to simulate obstacles (like walls and buildings), or non-uniform environments. It can also be used to artificially force certain routing configurations. Introduced path loss is symmetrical in both directions for configurations where both sides are nodes.
Additional path loss is defined by the
loss parameter. The negative values
represent additional signal amplification.
loss <receiver> <transmitter> <loss>
- receiver -- name of the receiver device (can be a node or a sniffer)
- transmitter -- name of the transmitter device (can be a node or a noise source)
- loss -- additional path loss between the devices (dBm)
noise R_0 R_1 10.0