Applicable Versions
NetSim Standard
NetSim Pro


Applicable Releases
v11v12
v13


The standard defines the range of a node as the distance at which the PER (packet error rate) of a 1024 Byte packet is 10%. This means that nodes even beyond the range will be able to communicate, but they may do so with high error.
There is a common misunderstanding that a range of 100 m implies that transmissions work perfectly till 99 m but suddenly stop at 100 m. This is not so. The error rate gradually increases as the range in increased if other parameters are kept constant.
However, if you wish to hardcode this behavior for your implementation, you can modify the source codes as explained below:

WLAN/MANET/VANET:

The fn_NetSim_IEEE802_11_PhyIn() function that is part of the IEEE802_11_Phy.c file in IEEE802_11 project is called whenever a packet is received at a receiver. You may set the received power to 0 if the distance is beyond the range that you want to set (Eg:  500m) and set it to a larger value if it is less than your range definition.


WSN/IoT

The case PHYSICAL_IN_EVENT which is part of the switch() statement present in fn_NetSim_Zigbee_Run() function of 802_15_4.c file in ZigBee project is triggered whenever a packet is received at the receiver.  You may set the received power to 0 if the distance is beyond the range that you want to set (Eg:  100m ) and set it to a larger value if it is less than your range definition.


You can also explicitly mark the packet as Error, No Error or Collided based on your range specifications, by setting the nPacketStatus filed of the packet in NetSim so that the packet is either sent to the MAC if successful or dropped in case of error/collision. Following are the packet status and the respective values:

PacketStatus_NoError=0
PacketStatus_Error=1
PacketStatus_Collided=2

PacketStatus_Buffer_Dropped = 3

PacketStatus_TTL_Expired = 4

PacketStatus_Dropped = 5

PacketStatus_MAC_Lifetime_Expired=6

PacketStatus_LAST


To know more about modifying and linking the source codes to NetSim, refer to the section on writing your own code in NetSim's User Manual.