You are on page 1of 11

Implementation in Castalia

Castalia contains various protocols and its configurations like Mac802.15.4, TMAC, Tunable
MAC, Baseline BANMAC, and SMAC.

Default Configuration in Castalia –

1) Protocol : Mac802.15.4 configuration for ZIGBEE.

2) Topology : Star topology also called as single hop.

3) Sensor Nodes : 6

4) Application : Throughput application

5.1 Comparison of MAC Protocols in terms of Consumed Energy

We have simulated TMAC, SMAC and ZigBeeMAC configuration in Castalia by carrying out
the changes in Omnetpp.ini files and analysed that TMAC presents an effective way to address
the idle listening problem and decreases the energy consumption in a volatile environment
where the message rate fluctuates, either in time or in location.

Steps to simulate Protocols in Castalia simulator are –


Open terminal by typing Ctrl+Alt+T
1. Open Castalia by navigating to Castalia folder
pramod@CARMA :~/cd Castalia-3.2
pramod@CARMA/Castlia-3.2 :~/
pramod@CARMA/Castlia-3.2 :~/ ./makemake
pramod@CARMA/Castlia-3.2 :~/ make
pramod@CARMA :~/ cd Castalia-3.2/Simulations/BANTest/
2. For comparing the different protocols we have to make changes in Castalia-
3.2/Simulations/BAN Test/omnetpp.ini file
Here
configuration is
set to TMAC

Figure 5.1 Omnetpp Configuration file

We can change the number of Nodes here itself –


Number of nodes -SN.numnodes = 6
Topology – single hop (star topology)
Application – ThroughputTest
Interference Models
Interference Model 0- No Collision (No interference)
Interference Model 1-Simple Collision (More than one transmission heard by a receiver, leads
to collision)
Interference Model 2-Additive Collision (Transmission seen as interference)
3. Run the specific configuration by writing the command
pramod@CARMA :~/cd Castalia-3.2
pramod@CARMA/Castlia-3.2 :~/
pramod@CARMA/Castlia-3.2 :~/ ./makemake
pramod@CARMA/Castlia-3.2 :~/ make
pramod@CARMA :~/ cd Castalia-3.2/Simulations/BANTest/
pramod@CARMA/Castlia-3.2 /Simulations/BANtest:~/ Castalia –c ZigBeeMAC –o tmac.txt
pramod@CARMA/Castlia-3.2 /Simulations/BANtest:~/ CastaliaResults –i tmac.txt
It shows the output of Application, MAC, Radio layer, and energy consumed in Resource
Manager .

Figure 5.2 Running the configuration

Latency: defined as how much time is required to send the data from source node to
destination node.

4. To see the consumed energy write the command


pramod@CARMA/Castlia-3.2 /Simulations/BANtest:~/ CastaliaResults –i Zig.txt –s energy

Figure 5.3 Simulation for Consumed Energy

We can see the consumed energy in ZigBeeMAC(TMAC) protocol is 0.061,0.061and 0.06


respectively.

5. To see the packets received write the command


pramod@CARMA/Castlia-3.2 /Simulations/BANtest:~/ CastaliaResults –i Zig.txt –s packets
We can see the packets received by the respective models as 227,227and 231.
Figure 5.4 Simulation of S-MAC Protocol

This shows the simulation results for S-Mac in which we can see the consumed energy is more
as compared to ZigBeeMAC protocol.

Figure 5.5 Simulation of T-MAC Protocol

This shows simulation results for T-Mac protocols in which we observe the energy consumed is
further reduced to 0.018.
Now we have made a comparison of these three protocols in tabular form in order to analyse
the best protocol.
Table4. Comparison table of MAC Protocols

Protocols TMAC IEEE 802.15.4 SMAC


Energy Consumed (mW) 0.018 0.061 0.158
Energy consumed ( mW ) Comparison in terms of Energy Consumed

Protocols

Figure 5.6 Comparative graph of MAC Protocols

Finally, looking at the graph we can conclude that T-MAC consumes the least energy because
T-MAC introduces the concept of turning off the radio when a certain time-out occurs, which
presents an effective way to address the idle listening problem and decreases the energy
consumption in a volatile environment where the message rate fluctuates, either in time or in
location. So, we have tried to enhance the TMAC protocol by varying the parameters i.e
Contention Access Period and Listen Timeout.

T-MAC protocol solves the early sleeping problem by introducing future request to send and
taking priority on the buffers. By solving the problem of early sleeping, T-MAC protocol can be
applied to network when the data flows from the nodes to the sink node.

5.2 Improving TMAC Energy Efficiency

The main reasons are the employments of slotted carrier sense multiple access-collision
avoidance and the mechanism that if a frame transmission cannot be completed before the end
of the CAP, it has to wait until the start of the next CAP. So, we are varying the contention
Access period which range from which is by default is 10ms, we set the value of 5, 15 it shows
that energy consumption is very less if the contention period is increased.
Effect of Contention Acess Period on Energy
Consumed Energy

Energy CAP(7)
Energy CAP(10 Default)
Energy CAP(14)

Collison Models

Figure 5.7 Effect of CAP on Energy in TMAC

Now after performing an analysis of T-MAC, IEEE802.15.4 and Tunable MAC we made a
conclusion that TMAC is more energy efficient so, we further tried to make it more efficient by
changing the parameter CAP and now we will implement Multihopping in it because now the
no of sensor nodes are more so using single hop they would not be able to communicate.

5.3 Implementation of Multihopping in TMAC

We started with a simple multihop network consisting of 4 nodes where they were directly
connected to one cluster head and then that routed the packets to sink. After that we simulated it
for 9 nodes and we kept on doing it up to 50 nodes which consisted of 6 cluster heads having 8
cluster members.

Implementation of multihopping in Castalia simulator


Navigate to Castalia folder with the help of terminal by pressing Ctrl+Alt+T.
1. For carrying out multihopping we have to make changes in Castalia-
3.2/Simulations/MyMAC/omnetpp.ini file
Figure 5.8 Omnetpp file for Multihopping

We have changed the no of Nodes=29


Application Name=Throughput Test
Application. IsSink=True
Radio model=CC2420

2. Define the protocol type as TMAC by writing MAC protocol Name=TMAC and packet
rate =50.
Figure 5.9 Defining TMAC Protocol Configuration

3. Now define the node architecture by assigning the next recipient.

Figure 5.10 Node Architecture for Multihopping

4. Deploy the sensor node by assigning the x coordinate and y coordinate value.

Figure 5.11 Coordinates Definition for deployment of Sensor Nodes

5. Run the specific configuration by writing the command


pramod@CARMA :~/cd Castalia-3.2
pramod@CARMA/Castlia-3.2 :~/
pramod@CARMA/Castlia-3.2 :~/ ./makemake
pramod@CARMA/Castlia-3.2 :~/ make
pramod@CARMA :~/ cd Castalia-3.2/Simulations/MyMAC/ pramod@CARMA/Castlia-3.2
/Simulations/MyMAC:~/ Castalia –c TMAC –o 28.txt
pramod@CARMA/Castlia-3.2 /Simulations/MyMAC:~/ CastaliaResults –i
28.txt

Figure 5.12 Simulation of TMAC Configuration for Multihopping

Each output has its dimensions NxM.


N is the number of modules that produced this output. Modules that are instantiated only once
(e.g., the wireless Channel) will always have N=1.
M, is the number of different indices, an output from a single module has.

6. To see the consumed energy per node write the command


pramod@CARMA/Castlia-3.2 /Simulations/MyMAC:~/ CastaliaResults –i 28.txt –s energy - n
Figure 5.13 Screenshot for Energy Consumed by each Node

-s switch (s‟ standing for show‟) to select among the possible outputs.

7. To see the packets received per node write the command


pramod@CARMA/Castlia-3.2 /Simulations/MyMAC:~/ CastaliaResults –i 28.txt –s packets–
n

Figure 5.14 Screenshot for Packet Received by each node

8. To see the packets transmitted per node write the command


pramod@CARMA/Castlia-3.2 /Simulations/MyMAC:~/ CastaliaResults –i 28.txt –s TXed packets

Figure 5.15 Screenshot of Packet Transmitted by Radio

You might also like