Extensions

AvroraZ provides several extensions to the Avrora emulator that gives the possibility to emulate the Texas Instruments Chipcon CC2420 radio chip, which is used in many sensor node platforms such as the Crossbow MicaZ nodes. Thus our implementation enables precise emulation of IEEE 802.15.4 based protocols without any modifications in the code developed for the real hardware. In order to enable this emulation, the following extensions have been introduced in the emulator:

The address recognition algorithm

Due to the nature of radio communications, a device with its receiver enabled will be able to receive and decode transmissions from all devices complying with the standard that are currently operating on the same channel and are in its receiving range, along with interference from other sources. The standard, therefore, defines in the MAC layer how to filter incoming frames in order to deliver only the frames that are of interest to the upper layers. Hardware support for this filtering is being carried out by standards compliant radio chips in the PHY layer. This filtering is based on the following 802.15.4 standard requirements:

    1. The frame type subfield shall not contain an illegal frame type.
    2. If the frame type indicates that the frame is a beacon frame, the source PAN identifier shall match macPANId unless macPANId is equal to     0xFFFF, in which case the beacon frame shall be accepted regardless of the source PAN identifier.
    3. If a destination PAN identifier is included in the frame, it shall match macPANId or shall be the broadcast PAN identifier (0xFFFF).
    4. If a short destination address is included in the frame, it shall match either macShortAddress or the broadcast address (0xFFFF). Otherwise, if     an extended destination address is included in the frame, it shall match aExtendedAddress.

When any of the receiving requirements defined in the standard are not satisfied, the radio chip discards the incoming frame without processing it, and flushes the data from the received FIFO queue of the rejected frame. The radio chip will start searching new frames only after the rejected frame has been completely received to avoid detecting false SFDs. It is worth noting that some standard MAC attributes (i.e. PAN identifier, 16 and 64 bit address) have to be stored in the radio chip’s RAM to perform the address recognition algorithm. Therefore, the implementation in AvroraZ emulates this RAM to compare the values stored in it to the ones in the radio chip registers.

Frame acknowledgment

Supporting acknowledgment of frames is also important in order to accomplish 802.15.4 std. compliance. A frame transmitted with the acknowledgment request flag set to one shall be acknowledged by the recipient. If the intended recipient correctly receives the frame, meaning that address recognition is passed and resulted in a valid frame check, it shall generate and send an acknowledgment frame containing the same sequence number from the data that is being acknowledged.
In order to fulfill these procedures, AvroraZ emulates the way the compliant radio chips transmit acknowledgment frames when it is requested by the sender. In addition, the emulator supports automatically sending of acknowledgments when a frame is correctly received.

Indoor radio model

AvroraZ adds an indoor radio model in order to provide LQI and CCA real-time support as offered by the standard. The model implemented follows an indoor radio model developed for Martin Klepal in the CAWS group for WiFi networks. The model is depited in lineal scale below.The transmitted power (T) in each mote is programmed and controlled by a radio chip register called TXCTRL.PA_LEVEL register. In the CC2420 data sheet, only the output power for some settings is shown. However, in real hardware, all integer values ranging from 0-31 are supported by the radio chip register. The approach we have taken is to perform cubic spline interpolation in order to obtain values not specified in the data sheet. Thus, you can programme in the avroraZ emulator the 32 power levels available in the actual cc2420 radio chip.

The path loss (L) has been computed following the log-distance path loss model L(d)=PL(d0)+10log(d/d0) where PL(d0) is the path loss for a reference distance (d0) This value can be calculated empirically or theoretically by means of the free space Path Loss formula. Reference distance (d0) usually represents the small distance in the far field and it is chosen typically to 1m in indoor scenarios. The path loss exponent η should be chosen to match the environment that a user wishes to model.

Fading (F) has been modeled following the indoor radio model depicted in the right figure below. This model has been adopted considering that motes are usually placed on ceilings, walls or sometimes even on desks to sense light, temperature, and humidity inside buildings. This typically corresponds with WLAN access point placement. Therefore, the adoption of a radio model developed for WiFi networks for radio channel modeling in wireless sensor networks makes sense. The chosen radio model considers that rapid and frequent transitions between line of sight (LOS) and non line of sight (NLOS) occur in typical node locations due to movement of obstacles in the radio path such as people.
If you focus in the radio channel parameters figure, where ρ (m-2) is the number of people or obstacles over an occupied area and l (m) is the length of the ray over that area, you can see that the definition of these two parameters will depend on the mean µ (dB), deviation σ (dB) and time sharing A (-) values. The higher the number of obstacles (ρ) and/or the distance between motes (l) the higher is the influence of the shadowing in the model (A is lower so more time in bad state, shadowing mean and deviation are higher so lesser and more variant is the received signal strength)

parameters.jpg radiomodel.jpg

The two radio channel parameters ρ, l can be set in the simulator by defining network topology and the density of people in the environment inside the topology file that is going to be feed into the emulator. For that the -topology option must be set and text file indicating the distance between and density of obstacles nodes should be passed to it. Here there is an example of how the user could create this topology file: topology.top

Interference (I) from others sensor motes in the wireless sensor network is computed in AvroraZ following the simple approach of summing any power received, at the specific 3D position and time, to the receiver mote. On the other hand,the noise (N) can be created in the simulator by means of real measurements of a radio channel. For that, RSSISample application from the Tinyos-2.x operative system is suggested to be used. This firmware generates a text file with readings from the RSSI register. Afterwards, the file can be feed into the emulator using the -noise option to generate a Noise time trace that will be used by the radio model.

Finally, it is worth noting that the radio model has been implemented with an awareness of not decreasing the performance of Avrora. As explained before, the AVR emulator is based on an event queue that enables sleep optimization. This means that the emulator only needs to process events in the queue in order, skipping large amounts of idle simulation time. Following this approach, values in the radio model are updated every symbol but only on a packet basis. This allows to maintain the same performance in Avrora since in receive mode Java threads can sleep while not receiving a packet.

Link quality indicator (LQI)

The LQI measurement defined in the IEEE802.15.4 standard is a characterization of the strength and/or quality of a received packet. This measurement may be implemented using receiver RSSI, a signal-to-noise ratio estimation, or a combination of these methods. LQI result can be then used by the network or application layers to choose the best route between two motes, although its use is not specified in the standard.
Following the standard, LQI measurement shall be performed for each received packet, and the result shall be reported to the MAC sub layer as an integer ranging from 0 to 255, with at least
8 unique values. The minimum and maximum LQI values (0 and 255) should be associated with the lowest and highest quality compliant signals detectable by the receiver, and LQI values in between should be uniformly distributed between these two limits. In order to comply with the IEEE802.15.4 standard, avroraZ following the CC2420 radio chip appends in each receive frame two values in order to calculate the LQI. Assuming that the user is normally only interested in the correctness of the Frame Check Sequence (FCS) and not the FCS sequence itself. The two FCS bytes are replaced by the RSSI value and an average correlation value. Afterwards, higher layers should be responsible for generating the appropriate scaling of the LQI value by means of these two values.

frame.jpg

Users therefore can get RSSI and correlation values from the last two bytes of every received packet. This should enable them to emulate link estimation algorithms in higher layes as has been recommended by the standard.

Clear channel assessment (CCA)

The CCA operation from the 802.15.4 std, determines whether the channel is busy or idle by comparing the energy in the channel with a threshold. This threshold can be set according to three different methods:

  • Energy Detection Mode. CCA reports a busy medium if the detected energy is above the ED threshold.
  • Carrier Sense Mode. CCA reports a busy medium if a signal with the modulation and spreading characteristics of IEEE 802.15.4 is detected. This signal may be higher or lower than the ED threshold.
  • Carrier Sense with Energy Detection Mode. This is a combination of both modes. The CCA reports a busy medium if it detects a signal with same characteristics of IEEE 802.15.4. with energy above the ED threshold.

The clear channel assessment signal is based on the measured RSSI value and a programmable threshold. This clear channel assessment value is used to implement the CSMA-CA functionality specified in the MAC layer of the IEEE802.15.4 standard in which a transmission will only start if the channel is clear. The radio chip status register may be used to detect the result of the CCA. All three CCA modes specified by the standard are implemented in the CC2420. However, AvroraZ assumes that all devices are considered to be 802.15.4 compliant and therefore the carrier sense mode is not really necessary.