Applicable Versions
NetSim StandardNetSim Pro


Applicable Releases
v10.2v11
v12


Prerequisite: Understanding of M/D/1 queuing experiment available in the NetSim experiment manual.


NetSim GUI comes with options for selecting constant and exponential distributions for packet size and interarrival time. Users can modify this by changing the code in Distribution.c file inside the Application project. 


For example, users can comment out the code under the exponential case and replace this with their code. Then a user runs simulations with exponential selected in the GUI, it would run their (custom distribution) code.


Section 9 in the NetSim user manual explains how users can write their own code.


Note that 'arrival times' is dependent on the Inter-arrival time value, while 'service time' is dependent on the packet size and link speed. However, if the packet size exceeds 1500B (approx), then the IP layer would fragment the packet. This is the reason the results of the simulations would slightly vary from exact theory.


Refer the function fn_NetSim_TrafficGenerator_Custom(), which is part of the Database_FTP_Custom.c file in Application Project. By varying the input arguments to this function you can model your own mathematical distributions for packet sizes and inter-arrival times. The function also has comments added above it, which will help you in understanding how you can make calls and what arguments it expects.


The variable associated with AppInfo which is usually passed as input for *args parameter of the function fnDistribution(DISTRIBUTION nDistributionType, double *fDistOut,  unsigned long *uSeed, unsigned long *uSeed1,double* args), is declared in Application.h file in the structure stru_Application_DataInfo, which holds the parameters such as packet size, inter arrival time, packet size distribution and inter-arrival time distribution.


Other related articles:

1. How do I trace the flow of function calls in NetSim source codes?

2. A detailed article on how to modify codes for building a M/G/1 queue in NetSim, written by Shivank Garg of IIT Kanpur is available at https://github.com/shivankgarg98/NetSim-Experiments/blob/master/General_Queuing_System_in_NetSim.md