Whenever user makes modifications to the underlying protocol source codes in NetSim and links it with the tool, it may affect:

  1. All simulations involving the modified protocol
  2. All devices that run the modified protocol
  3. All results involving the modified protocol


In order to perform device specific code modifications (a set of routines or conditions that needs to be executed only for a specific type of devices (Eg: Gateways, Sensors, User Equipments etc)), you may use one or a combination of the following parameters:

  1. Device ID:
    • pstruEventDetails->nDeviceId - ID of the device that is part of the current EVENT that is being executed.
    • DEVICE_CONFIGID(DeviceId) - ID  of the device as specifiied in NetSim GUI and in the Configuration.netsim file.
    • For Eg: pstruEventDetails->nDeviceId==64, can be used to check if the current device has a Device ID "64"
  2. Device Name
    • DEVICE_NAME(DeviceId) - String containing the name of the device as specified in NetSim GUI.
  3. Device Type
    • pstruEventDetails->nDeviceType - Provides the type of the current device.
    • DEVICE_TYPE(DeviceId)  - Provides the type of the Device with ID "DeviceId"
    • The Device Type for various devices in NetSim is available in the Stack.h file as shown below:
    • enum enum_DeviceType
      {
       Not_Device=0,
       /* Node 5-layer device */
       NODE=1,//Wired or wireless
       CPE=1,//Wired
       MOBILESTATION=1,//Wireless
       UE=1,//Wireless LTE user equipment
       SUBSCRIBER=1,//wireless
       SENSOR=1,//Wireless
       SINKNODE=1,//Wireless
       PANCOORDINATOR=1,//Wireless
       /***Intermediate Device***/


  4. Protocol details
    • DEVICE_APPLAYER(DeviceId) - Provides the application layer related parameters of the Device with ID "DeviceId"
    • DEVICE_TRXLayer(DeviceId) - Provides the transport layer related parameters of the Device with ID "DeviceId"
    • DEVICE_NWLAYER(DeviceId) - Provides the network layer related parameters of the Device with ID "DeviceId"
    • DEVICE_MACLAYER(DeviceId,InterfaceId) - Provides the Data Link layer related parameters of the Device with ID "DeviceId"
    • DEVICE_PHYLAYER(DeviceId,InterfaceId) - Provides the Physical layer related parameters of the Device with ID "DeviceId"
    • The protocol ID's of various protocols are available in the Stack.h file as shown below:
    • enum enum_MACProtocol
      {
       MAC_PROTOCOL_NULL=0,
       /***WIRELESS***/
       MAC_PROTOCOL_IEEE802_11 = MAC_LAYER*100+1,//WLAN
       MAC_PROTOCOL_IEEE802_15_4,//Zigbee
       MAC_PROTOCOL_IEEE802_16,//Wi-Max
       MAC_PROTOCOL_IEEE802_22,//Cognitive Radio
       /***WIRED***/
       MAC_PROTOCOL_IEEE802_3,//Ethernet
       MAC_PROTOCOL_P2P,//Point to point link
      For Eg: DEVICE_MACLAYER(nDeviceID, 1)->nMacProtocolId == MAC_PROTOCOL_LTE, can be used to check if the MAC protocol of the device with ID "nDeviceID" is LTE.  


      5. Interface details

  • DEVICE_INTERFACE(DeviceId,InterfaceId) - Provides the link/interface related properties of the interface with ID "InterfaceId' belonging to a Device with ID "DeviceId"
  • For Eg: DEVICE(nDeviceID)->nNumOfInterface == 2, can be used to check if a device with ID "nDeviceID" has 2 interfaces.