alexa Extending the Functionality of Pymote: Low Level Protocols and Simulation Result Analysis | OMICS International
ISSN: 2090-4886
International Journal of Sensor Networks and Data Communications
Make the best use of Scientific Research and information from our 700+ peer reviewed, Open Access Journals that operates with the help of 50,000+ Editorial Board Members and esteemed reviewers and 1000+ Scientific associations in Medical, Clinical, Pharmaceutical, Engineering, Technology and Management Fields.
Meet Inspiring Speakers and Experts at our 3000+ Global Conferenceseries Events with over 600+ Conferences, 1200+ Symposiums and 1200+ Workshops on
Medical, Pharma, Engineering, Science, Technology and Business

Extending the Functionality of Pymote: Low Level Protocols and Simulation Result Analysis

Farrukh Shahzad*

Information and Computer Science, King Fahd University of Petroleum and Minerals, Dhahran, Saudi Arabia

*Corresponding Author:
Farrukh Shahzad
Information and Computer Science
King Fahd University of Petroleum and
Minerals, Dhahran, Saudi Arabia
Tel: 966386000
E-mail: [email protected]

Received date: August 24, 2015; Accepted date: October 13, 2015; Published date: October 16, 2015

Citation: Shahzad F (2015) Extending the Functionality of Pymote: Low Level Protocols and Simulation Result Analysis. Sensor Netw Data Commun 4:125. doi: 10.4172/2090-4886.1000125

Copyright: © 2015 Shahzad F. This is an open-access article distributed under the terms of the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original author and source are credited.

Visit for more related articles at International Journal of Sensor Networks and Data Communications


Wireless sensor networks (WSNs) are utilized in various applications and are providing the backbone for the new pervasive Internet, or Internet of Things. The development of a reliable and robust large-scale WSN system requires that the design concepts are checked and optimized before they are implemented and tested for a specific hardware platform. Simulation provides a cost effective and feasible method of examining the correctness and scalability of the system before deployment. In this work, we study the performance of Pymote, a high level Python library for event based simulation of distributed algorithms in wireless ad-hoc networks. We extended the Pymote framework allowing it to simulate packet level performance. The extension includes radio propagation, energy consumption, mobility and other models. The extended framework also provides interactive plotting, data collection and logging facilities for improved analysis and evaluation of the simulated system.


Wireless sensor network; Simulation; Python; Distributed event modeling


Wireless Sensor Networks (WSNs) have been employed in many important applications such as intrusion detection, object tracking, industrial/home automation, smart structure and several others. The development of WSN system requires that the design concepts are checked and optimized using simulation [1].

The simulation environment for WSN can either be an adaptive development or a new development. The adaptive development includes simulation environments that already existed before the idea of WSNs emerged. These simulation environments were then extended to support wireless functionality and adapted for the use with WSNs. In contrast, new developments cover new simulators, which were created solely for simulating WSNs, considering sensor specific characteristics from the beginning [2].

Recently, several simulation tools have appeared to specifically address WSNs, varying from extensions of existing tools to application specific simulators. Although these tools have some collective objectives, they obviously differ in design goals, architecture, and applications abstraction level [3,4].

Simulators can be divided into three major categories based on the level of complexity:

• algorithm level,

• packet level, and

• instruction level.

Our work is based on Pymote [5] which an algorithm level simulator. Some other algorithm level simulators are NetTopo [6], Shawn [7], AlgoSensim [8] and Sinalgo [9].

In this work, our main contribution is the design and implementation of packet level modules for propagation, energy consumption and mobility models to extend the Pymote framework. Secondly, we also added graphing and data collection modules to enhance the Pymote base functionality and modified existing modules for node, network, algorithm and logging.

The rest of the paper is organized as follows: In section 4, we provide some background related to existing simulation tools and we discuss the python based simulation tool Pymote. We present our extension in section 5 and provide simulation examples and analysis in section 6. We conclude in section 7.

Background and Related Work

Simulation has always been very popular among network-related research. A large number of simulators have been proposed in literature in which algorithms for wireless ad hoc networks can be implemented and studied. These simulators have different design goals and largely vary in the level of complexity and included features. They support different hardware and communication layers assumptions, focus on different distributed networks implementations and environments, and come with a different set of tools for modeling, analysis, and visualization. Classical simulation tools include NS-2, OMNeT++, J-Sim, OPNET, TOSSIM, and others [2-4].

Pymote is a high level Python library for event based simulation of distributed algorithms in wireless networks [5]. The library allows the user to make implementation of their ideas using Python-a popular, easy to learn, full featured, and objects oriented programming language. Functionalities provided by the library are implemented without additional layer of abstraction, thus harnessing full power of Python’s native highly expressive syntax. Using the library, users can quickly and accurately define and simulate their algorithms. The library particularly focuses on fast and easy implementation of ideas and approaches at algorithm level without any specification overhead using formally defined distributed computing environment.

Extending the Functionality

Propagation model

We implemented two basic radio propagation models and the commonly used shadowing model for WSN in the Pymote framework. These models are used to predict the received signal power of each packet. At the physical layer of each wireless node, there is a receiving threshold (P_RX_THRESHOLD). When a packet is received, if its signal power is below the receiving threshold, it is marked as error and dropped by the MAC [10-12] layer. The free space propagation model assumes the ideal propagation condition that there is only one clear line-of-sight path between the transmitter and receiver, while the two-ray ground reflection model considers both the direct path and a ground reflection path which gives more accurate prediction at a long distance than the free space model. However, in reality, the received power is a random variable due to multipath propagation or fading (shadowing) effects. The shadowing model consists of two parts: path loss component and a Gaussian random variable with zero mean and standard deviation σDB, which represent the variation of the received power at certain distance. Table 1 lists parameters available for propagation module. The propagation model type (free space, tworay ground or shadowing) is a network level attribute, which should be selected before starting the simulation.

Description Parameter Default
Transmit Antenna gain G_TX 1
Receive Antenna gain G_RX 1
System Loss (>=1.0) L 1
Min. Received signal power threshold P_RX_THRESHOLD -70 dbm
Frequency FREQ 2.4 Ghz
Path loss exponent BETA 2.5
Gaussian noise standard deviation SIGMA_DB 4 dbm

Table 1: Propagation Model Parameters.

Energy consumption model

In our extended framework, the energy model object is implemented as a node attribute, which represents the level of energy in a node. Each node can be conFigured to be powered by external source (unlimited power), Battery (default) or energy harvesting (EH) sources [13]. The energy in a node has an initial value which is the level of energy the node has at the beginning of the simulation. It also has a given energy consumption for every packet it transmits and receives which is a function of packet size, transmission rate and transmit (receive) power. The model also supports idle or constant energy discharge due to hardware/microcontroller consumption and energy charge for energy harvesting based WSN. During simulation, each node’s available energy is recomputed every second based on the charging and/or discharging rate. If it drops below minimum energy required to operate (Emin) then that node assumed to be dead (not available for communication) until energy reaches above Emin again later in simulation (for EH nodes). Table 2 lists parameters available for energy module which can be set differently for each node. The energy object keeps track of the energy available (for battery-operated or energy harvested nodes) and total energy consumption.

Description Parameter Default
Transmit power P_TX 84 mW
Receive power P_RX 73 mW
Initial Energy E_INIT 2.0 Joules
Min. Energy required
for operation
E_MIN 0.5 Joules
Charging rate (EH nodes) P_CHARGING 2 mW/sec
Discharging rate P_IDLE 0.1 mW/sec
Transmission rate TR_RATE 250 kbps

Table 2: Energy Model Parameters.

Mobility model

Our extended framework allows nodes to be mobile during simulation. Each node can be conFigured as fixed or mobile. The mobility module support three types of motion as summarized in Table 3. During simulation, each mobile node location is recomputed every second.

Type Parameters Default
0: Fixed None
1: Mobile (uniform velocity) VELOCITY HEADING 20 m/s
45 deg
2: Mobile (uniform velocity, random heading) VELOCITY 20 m/s
3: Mobile (random motion) MAX_RANDOM_ MOVEMENT 30 m

Table 3: Mobility Parameters.

Plotting and data collection

These modules allow real-time plotting and data collection during and after simulation for interactive analysis and comparisons of useful information. The modules implements generic helper methods. The simulation script is responsible for utilizing these methods to plot/chart and collect/log appropriate information as required by the simulated algorithm and application scenario. The output files are managed by utilizing separate folder for each type of files within the current working path (Table 4). Also for each simulation run, a separate folder, prefixed with the current date time is used for all files created during that simulation run.

Type Folder Name Examples
Data files /data CSV files containing energy consumption for each node, Message received/lost counts, etc.
Charts/plots /charts Line plots and/or bar charts of energy levels.
Topology /topology Topology map of all nodes used for simulation (before/after simulation)
Logging /logs Simulation run and module level logging
Combined /yyyy-mm-ddThh-mm-ss All files generated during a specific run

Table 4: File Management.

Modified node module

Enhanced framework requires significant modification in the Node module. The Node object now contains node type, energy model object and mobility object. The modified send and receive methods check before transmission or reception whether node has enough energy to perform the operation. Also the propagation model dictates whether a packet is received without errors (i.e. when received signal power is greater than the threshold based on the distance between the sender and receiver nodes). The object also keeps track of number of messages transmitted, received, or lost.

Simulation Example

We consider Internet of Things (IoT) application scenario where an energy [14] harvesting WSN (EHWSN) node is installed/embedded within the ‘Thing’ (object that need to be monitored). Several of such objects with EHWSN nodes form a cluster (in virtual star topology) around a high power coordinator node (or cluster head). EHWSN nodes can only communicate to its own coordinator (when they have enough energy). Coordinators are special wireless nodes which have sufficient power available and can send data to base station directly or via other coordinators (multi-hop) in a typical converge-cast application as illustrated in Figure 1. These objects are mobile and can move around its neighborhood or move to another neighborhood (within the range of a different coordinator). The coordinators are installed at strategic fixed locations throughout the facility.


Figure 1: Proposed deployment scheme for EHWSN system.

Figure 2 illustrates the scheme on time scale and can be summarized as follows:


Figure 2: Timing diagram of coordinator’s beaconing and node’s transmission.

• The coordinator periodically (period=Tc=t4-t0) broadcasts a beacon pulse with 10% duty cycle. The pulse contains the MAC address (48 or 64 bytes) of the radio, which is universally unique, and the number of registered nodes. After transmitting the beacon, it goes in the listening mode to receive messages from any EHWSN mode which have any packets to send.

• The neighboring EHWSN nodes (which have enough power to operate) periodically wake up (period=Tn>Tb) with a certain duty cycle to receive the beacon pulse from the coordinator (t1 in Figure 2). If the received coordinator’s MAC address is different than the last communicated coordinator or the node has not communicated recently, then the node will send a registration message containing its MAC [15] address and the power status (t2 in Figure 2); otherwise node will go back to sleep or send the data packet if any. The destination address will be set to the coordinator address so that any other neighboring nodes which are listening will ignore it.

• On receiving the node’ registration message, the coordinator record the registration information and increment the number of registered nodes (t3 in Figure 2). If coordinator receives a data message then it will buffer it for future transmission to base station or for aggregation. The coordinator will acknowledge the received packet in both cases.

• The case of multiple child nodes transmitting in response to the same beacon pulse is also shown in Figure 2 during the second beacon period. The contention is avoided by using a random back off time before transmission. The wining node will transmit first (node A transmits at t7 in Figure 2) and other nodes will wait for the channel (e.g., node B transmits at t9 in Figure 2).

Simulation setup

We only need to simulate the communication performance of one cluster formed by a coordinator and its children EHWSN nodes. The coordinator is placed in middle of n randomly deployed EHWSN nodes over a 600 m by 600 m area. We assumed that these nodes are constantly being charged during simulation and nodes are mobile (type=2, see Table 3). We consider beacon, registration and data packet sizes of 100 bytes while the acknowledgment packet size of 15 bytes. We used default parameters for different modules as listed in Tables 1-3. Some other parameters are shown in Table 5. The simulation script utilizes the plotting and data collection modules to generate image and data files for easy visualization and analysis of simulation results (Figure 3).

Parameter Name Value
Tb Beacon period 1 sec
Δb Beacon duty-cycle 10%
n No. of nodes 5 - 100
Sd Data packet size 100 bytes

Table 5: Simulation Parameters.


Figure 3: Simulation output files.

Simulation results

Figure 4 shows a simple topology generated for simulation using the Pymote. The center node (#1) acts as the coordinator for the EHWSN nodes (numbered 2 to 26). The node in lighter color means that its available energy [16,17] is below E_MIN (=0.5 J).


Figure 4: 25 EHWSN nodes around a coordinator.

We arbitrarily selected node 5 and node 10 as borderline in terms of energy available (i.e., the initial energy at start of simulation). Node 5 doesn’t have enough energy to transmit in the beginning but charged up above E_MIN (Table 2) during the simulation and start communicating. On the other hand, Node 10 just has enough energy [18] to send few messages before its energy level dropped below E_MIN. We set the charging rate to 0 for Node 10. The energy level change during the simulation run is shown in Figure 5.


Figure 5: Energy level change for Node 5 and 10.

Figure 6 shows the net node displacement during the simulation as they move around with constant speed but in random direction. Figure 7 illustrates the energy consumption of all EHWSN nodes. We can notice that some nodes never communicated due to low energy (like node 2, 4, 11, 15, 20, 21 and 26) whereas node 5 and 10 were only active during some part of the simulation as we discussed earlier. Finally Figure 8 shows the location of nodes at the end of simulation.


Figure 6: Node displacement during the simulation.


Figure 7: Energy consumption during the simulation.


Figure 8: Final position of nodes at the end of simulation.

Secondly, we vary the number of EHWSN nodes in the network from 10 to 100 in the increment of 5. The extended framework generates simulation output files for each iteration. The output files also include the overall summary. Figure 9 shows the generated topology for 100 EHWSN nodes (2 to 101). Figure 10 shows energy consumption plots for coordinator and other nodes combined (sum of energy consumption for all EHWSN nodes). The chart also shows number of messages (packets) received and lost at coordinator for each iteration.


Figure 9: 100 EHWSN nodes around a coordinator.


Figure 10: Overall summary.

Table 6 presented the overall simulation summary for all iterations. Node displacement and energy level change during the simulation for 100 nodes are shown in Figure 11 and 12 respectively.

Nodes Coordinator Energy consumption
Total EHWSN consumption
Received Packets at Coordinator Lost Packets at Coordinator
11 15 45 44 18
16 38 104 110 64
21 48 134 98 124
26 65 178 237 65
31 73 203 213 125
36 92 253 254 176
41 105 290 265 229
46 122 335 306 268
51 126 349 409 181
56 139 386 432 222
61 142 401 398 272
66 180 491 652 194
71 159 454 502 248
76 186 521 464 414
81 192 541 495 412
86 203 573 594 365
91 240 662 699 435
96 244 678 689 464
101 264 729 866 380

Table 6: Simulation Statistics.


Figure 11: Node displacement during the simulation for 100 nodes.


Figure 12: Energy level change for Node 5 and 10 with network size = 100.


The development of a reliable and robust large-scale WSN system requires that the design concepts are checked and optimized before they are implemented and tested for a specific hardware platform. Simulation provides a cost effective and feasible method of examining the correctness and scalability of the system before deployment.

In this work, we utilized and extended the Python based Pymote framework to allow packet level simulation. We implemented modules for propagation, energy consumption and mobility models. We also added graphing and data collection modules to enhance the Pymote base functionality and modified existing modules for node, network, algorithm and logging to support the extended framework. Finally, we performed an example simulation for a scheme to efficiently utilize EHWSN in an IoT application. The simulation results presented include topology maps, plots for available energy, bar charts for node displacement and energy consumption and comparison of received and lost packets at the coordinator node.


I would like to acknowledge the support provided by College of Computer Science and Engineering (CCSE) and the Deanship of Scientific Research at King Fahd University of Petroleum and Minerals (KFUPM).


Select your language of interest to view the total content in your interested language
Post your comment

Share This Article

Relevant Topics

Article Usage

  • Total views: 13603
  • [From(publication date):
    December-2015 - May 22, 2018]
  • Breakdown by view type
  • HTML page views : 9580
  • PDF downloads : 4023

Post your comment

captcha   Reload  Can't read the image? click here to refresh

Peer Reviewed Journals
Make the best use of Scientific Research and information from our 700 + peer reviewed, Open Access Journals
International Conferences 2018-19
Meet Inspiring Speakers and Experts at our 3000+ Global Annual Meetings

Contact Us

Agri & Aquaculture Journals

Dr. Krish

[email protected]

1-702-714-7001Extn: 9040

Biochemistry Journals

Datta A

[email protected]

1-702-714-7001Extn: 9037

Business & Management Journals


[email protected]

1-702-714-7001Extn: 9042

Chemistry Journals

Gabriel Shaw

[email protected]

1-702-714-7001Extn: 9040

Clinical Journals

Datta A

[email protected]

1-702-714-7001Extn: 9037

Engineering Journals

James Franklin

[email protected]

1-702-714-7001Extn: 9042

Food & Nutrition Journals

Katie Wilson

[email protected]

1-702-714-7001Extn: 9042

General Science

Andrea Jason

[email protected]

1-702-714-7001Extn: 9043

Genetics & Molecular Biology Journals

Anna Melissa

[email protected]

1-702-714-7001Extn: 9006

Immunology & Microbiology Journals

David Gorantl

[email protected]

1-702-714-7001Extn: 9014

Materials Science Journals

Rachle Green

[email protected]

1-702-714-7001Extn: 9039

Nursing & Health Care Journals

Stephanie Skinner

[email protected]

1-702-714-7001Extn: 9039

Medical Journals

Nimmi Anna

[email protected]

1-702-714-7001Extn: 9038

Neuroscience & Psychology Journals

Nathan T

[email protected]

1-702-714-7001Extn: 9041

Pharmaceutical Sciences Journals

Ann Jose

[email protected]

1-702-714-7001Extn: 9007

Social & Political Science Journals

Steve Harry

[email protected]

1-702-714-7001Extn: 9042

© 2008- 2018 OMICS International - Open Access Publisher. Best viewed in Mozilla Firefox | Google Chrome | Above IE 7.0 version
Leave Your Message 24x7