This simulation will assume the following Slotted Aloha protocol features:
We want to record the following quantities:
To do do, we will use a simple structure like the one in the following figure:
The class SAloha will setup the simulation and creates the first items: a devPkt Generator (devPktGen) and an Access Point (devAP). Then the devPktGen will generate a devPkt (a packet indeed) using a self-clocking event. Each devPkt will send a packet to the devAP managing also the retransmissions, if any; when the packet is sent, the devPkt dies.
The simulation have also a custom probe, Probe_SG, in order to record in a more useful way the S and G parameters.
CC:
the name of your C++ compiler,NEPSI:
where is your NePSing intall directory,USERPROJECT:
the name of your project, your simulation executable will have this name,USERSRC:
all the sources of your simulationDEBUG:
if the simulator should include dbugging information for the low level debugger (e.g., gdb or ddd).
After you have edited your Makefile, simply issue the make
command (or whatever you use), and the simulation should compile (hopefully).
The simulation executable can be started by passing a paramtere file to it, e.g., ./SlottedAloha params
.
To make a paramter file, launch the program itself with the right options, launching it without anything will give you a warning about the available options.
A common way to create a parameter file template is ./SlottedAloha -p -np > params
.
Edit your parameter file and you are ready to start our first simulation.
Warning: do not forget to create the Probe output directory; otherwise as soon as a Probe will try to write its data files, an exception will be raisen and the program will terminate.