`
Applicable Versions | NetSim Standard | NetSim Pro |
Applicable Releases | v13.0 |
However, new modes can be added. Energy consumption can be modeled for it by modifying the underlying protocol source codes.
- The various modes of a node for which energy consumption is currently calculated are defined in the Wireless.h file which is part of the Include directory of the source code folder. This includes modes such as RX_OFF, RX_ON_BUSY, TRX_ON_BUSY, SLEEP, etc. as shown below:
{
RX_OFF,
RX_ON_IDLE,
RX_ON_BUSY,
TRX_ON_BUSY,
SLEEP,
}PHY_TX_STATUS;
- New modes for calculating energy can be added to this enum definition.
For example,
{
RX_OFF,
RX_ON_IDLE,
RX_ON_BUSY,
TRX_ON_BUSY,
SLEEP,
}PHY_TX_STATUS;
- Further, the Battery Model API battery_add_new_mode(ptrBATTERY battery, int mode, double current, char* heading), which is defined in the BatteryModel.c file can be used to add the newly added model for calculations and to the Battery Model metrics table.
For example,
double dMode1Current = 3.4;
battery_add_new_mode(phy->battery, NEW_MODE1, dMode1Current , "New Mode1 energy(mJ)");
double dMode2Current =2.6;
battery_add_new_mode(phy->battery, NEW_MODE2, dMode2Current , "New Mode2 energy(mJ)");
- For instance, in ZigBee protocol which is used for WSN and IoT networks, the API fn_NetSim_Zigbee_ChangeRadioState(NETSIM_ID nDeviceId, PHY_TX_STATUS nOldState, PHY_TX_STATUS nNewState) also simplified as ZIGBEE_CHANGERADIOSTATE(nDeviceId,nOldState,nNewState) which is defined in the ChangeRadioState.c file of the ZigBee source code project can be called in the appropriate section of the ZigBee source code to change the state for calculation of energy consumption for the new modes.
For example,
ZIGBEE_CHANGERADIOSTATE(nDeviceId, WSN_PHY(nDeviceId)->nRadioState, NEW_MODE1 ); or
ZIGBEE_CHANGERADIOSTATE(nDeviceId, WSN_PHY(nDeviceId)->nRadioState, NEW_MODE2 );
For more information on NetSim's IoT module visit https://tetcos.com/iot-wsn.html