Applicable versions | NetSim Standard | NetSim Pro |
In order to add an additional Modulation technique the existing set of Modulation techniques that are available in the Physical layer, the BER table has to be created and provided as input to the BER calculations as explained below:
1. Go to <NetSim_Install_Directory>/src/Simulation path and copy the folders DTDMA, Include and lib along with the NetSim.sln solution file.
2. Create a new folder for the project and paste the copied items in it.
3. Goto NetSim Homescreen-> Your Work-> workspace options-> Open Code (in older versions of NetSim, use the NetSim.sln file that is present in the newly created project folder) to load the source codes in Visual Studio IDE.
4. Once the source codes are loaded in Visual Studio. Now expand the DTDMA project and double click on DTDMA_Phy.c file to open it.
5. Add the custom BER table and a variable that holds the table length. Following is a simple example:
6. In the function fn_NetSim_DTDMA_CalculatePacketError() comment the existing call to calculate_BER() and make a call to calculate_ber() with the parameters SNR, TABLE and TABLE_LENGTH.
Refer ErrorModel.h file present in the Include directory that was copied initially, which has the following functions defined.
calculate_ber(snr,berTable,tableLen)
calculate_snr(rxpower,bandwidth)
7. Save changes made to DTDMA_Phy.c and build DTDMA project by right clicking on the DTDMA Project header in the solution explorer and selecting Rebuild.
8. Upon successful build, the dll of the DTDMA module will automatically get updated in the binary folder of the current workspace (in older versions of NetSim, a new libDTDMA.dll file will get created in the DLL directory inside your project folder that was created initially. Rename the original libDTDMA.dll file that is present in <NetSim_Install_Directory>/bin folder to say libDTDMA_original.dll as a backup, and copy-paste the newly built libDTDMA.dll file over there to run the simulation with the custom modulation technique).
Note: Now upon running simulations with any modulation scheme provided in device properties, NetSim will run using the custom modulation scheme for which source code was modified. In order to restore changes and run NetSim without the code modifications done, delete the modified DLL file (libDTDMA.dll) from the bin folder and rename the original DLL back to the name libDTDMA.dll.