A Graphical Development and Simulation Environment for TinyOS-based Wireless Sensor Networks
description
Transcript of A Graphical Development and Simulation Environment for TinyOS-based Wireless Sensor Networks
![Page 1: A Graphical Development and Simulation Environment for TinyOS-based Wireless Sensor Networks](https://reader034.fdocuments.us/reader034/viewer/2022051517/56814992550346895db6d707/html5/thumbnails/1.jpg)
A Graphical Development and Simulation Environment for TinyOS-based Wireless Sensor NetworksElaine Cheong
February 13, 2007Seventh Biennial Ptolemy MiniconferenceBerkeley, California
![Page 2: A Graphical Development and Simulation Environment for TinyOS-based Wireless Sensor Networks](https://reader034.fdocuments.us/reader034/viewer/2022051517/56814992550346895db6d707/html5/thumbnails/2.jpg)
February 13, 2007 Elaine Cheong, UC Berkeley, Ptolemy Miniconference
2
Wireless Sensor Networks
![Page 3: A Graphical Development and Simulation Environment for TinyOS-based Wireless Sensor Networks](https://reader034.fdocuments.us/reader034/viewer/2022051517/56814992550346895db6d707/html5/thumbnails/3.jpg)
February 13, 2007 Elaine Cheong, UC Berkeley, Ptolemy Miniconference
3
TinyOS and nesCconfiguration SenseToLeds {} implementation { components Main, SenseToInt, IntToLeds, TimerC, DemoSensorC as Sensor;
Main.StdControl -> SenseToInt; Main.StdControl -> IntToLeds;
SenseToInt.Timer -> TimerC.Timer[unique("Timer")];
SenseToInt.TimerControl -> TimerC;
SenseToInt.ADC -> Sensor;
SenseToInt.ADCControl -> Sensor;
SenseToInt.IntOutput -> IntToLeds;}
module SenseToInt { provides { interface StdControl; } uses { interface Timer; interface StdControl as TimerControl; interface ADC; interface StdControl as ADCControl; interface IntOutput; }} implementation { ...}
configuration TimerC { provides interface Timer[uint8_t id]; provides interface StdControl;} implementation { components TimerM, ClockC, NoLeds, HPLPowerManagementM; TimerM.Leds -> NoLeds; TimerM.Clock -> ClockC; TimerM.PowerManagement -> HPLPowerManagementM; StdControl = TimerM; Timer = TimerM;}
![Page 4: A Graphical Development and Simulation Environment for TinyOS-based Wireless Sensor Networks](https://reader034.fdocuments.us/reader034/viewer/2022051517/56814992550346895db6d707/html5/thumbnails/4.jpg)
February 13, 2007 Elaine Cheong, UC Berkeley, Ptolemy Miniconference
4
SenseToLeds in Viptos
![Page 5: A Graphical Development and Simulation Environment for TinyOS-based Wireless Sensor Networks](https://reader034.fdocuments.us/reader034/viewer/2022051517/56814992550346895db6d707/html5/thumbnails/5.jpg)
February 13, 2007 Elaine Cheong, UC Berkeley, Ptolemy Miniconference
5
Converting between nesC and MoML nc2moml
nesC component code MoML class (Ptolemy actor)
ncapp2moml nesC application code MoML entity (Ptolemy model)
![Page 6: A Graphical Development and Simulation Environment for TinyOS-based Wireless Sensor Networks](https://reader034.fdocuments.us/reader034/viewer/2022051517/56814992550346895db6d707/html5/thumbnails/6.jpg)
February 13, 2007 Elaine Cheong, UC Berkeley, Ptolemy Miniconference
6
Generating MoML for TimerC.nc – nc2moml
<?xml version="1.0"?><!DOCTYPE plot PUBLIC "-//UC Berkeley//DTD MoML 1//EN" "http://ptolemy.eecs.berkeley.edu/xml/dtd/MoML_1.dtd">
<class name="TimerC" extends="ptolemy.domains.ptinyos.lib.NCComponent"> <property name="source" value="$CLASSPATH/tos/system/TimerC.nc" /> <port name="StdControl" class="ptolemy.actor.IOPort"> <property name="input" /> <property name="_showName" class="ptolemy.kernel.util.SingletonAttribute" /> </port> <port name="Timer" class="ptolemy.actor.IOPort"> <property name="input" /> <property name="multiport" /> <property name="_showName" class="ptolemy.kernel.util.SingletonAttribute" /> </port></class>
![Page 7: A Graphical Development and Simulation Environment for TinyOS-based Wireless Sensor Networks](https://reader034.fdocuments.us/reader034/viewer/2022051517/56814992550346895db6d707/html5/thumbnails/7.jpg)
February 13, 2007 Elaine Cheong, UC Berkeley, Ptolemy Miniconference
7
Generating MoML for SenseToLeds.nc – ncapp2moml...<entity name="MicaCompositeActor" class="ptolemy.domains.ptinyos.lib.MicaCompositeActor"> <entity name="Main" class="tos.system.Main" /> <entity name="TimerC" class="tos.system.TimerC" /> <entity name="SenseToInt" class="tos.lib.Counters.SenseToInt" /> <entity name="IntToLeds" class="tos.lib.Counters.IntToLeds" /> <entity name="DemoSensorC" class="tos.sensorboards.micasb.DemoSensorC" /> ... <link relation="relation1" port="Main.StdControl" /> <link port="IntToLeds.StdControl" relation="relation2" /> <link relation1="relation2" relation2="relation1" /> <link port="SenseToInt.StdControl" relation="relation3" /> <link relation1="relation3" relation2="relation1" /> <link relation="relation4" port="SenseToInt.Timer" /> <link port="TimerC.Timer" relation="relation5" /> <link relation1="relation5" relation2="relation4" /> ...</entity>...
![Page 8: A Graphical Development and Simulation Environment for TinyOS-based Wireless Sensor Networks](https://reader034.fdocuments.us/reader034/viewer/2022051517/56814992550346895db6d707/html5/thumbnails/8.jpg)
February 13, 2007 Elaine Cheong, UC Berkeley, Ptolemy Miniconference
8
SenseToLeds – Physical Environment
![Page 9: A Graphical Development and Simulation Environment for TinyOS-based Wireless Sensor Networks](https://reader034.fdocuments.us/reader034/viewer/2022051517/56814992550346895db6d707/html5/thumbnails/9.jpg)
February 13, 2007 Elaine Cheong, UC Berkeley, Ptolemy Miniconference
9
SenseToLeds – Hardware
![Page 10: A Graphical Development and Simulation Environment for TinyOS-based Wireless Sensor Networks](https://reader034.fdocuments.us/reader034/viewer/2022051517/56814992550346895db6d707/html5/thumbnails/10.jpg)
February 13, 2007 Elaine Cheong, UC Berkeley, Ptolemy Miniconference
10
SenseToLeds – Software
![Page 11: A Graphical Development and Simulation Environment for TinyOS-based Wireless Sensor Networks](https://reader034.fdocuments.us/reader034/viewer/2022051517/56814992550346895db6d707/html5/thumbnails/11.jpg)
February 13, 2007 Elaine Cheong, UC Berkeley, Ptolemy Miniconference
11
PtinyOSDirector
![Page 12: A Graphical Development and Simulation Environment for TinyOS-based Wireless Sensor Networks](https://reader034.fdocuments.us/reader034/viewer/2022051517/56814992550346895db6d707/html5/thumbnails/12.jpg)
February 13, 2007 Elaine Cheong, UC Berkeley, Ptolemy Miniconference
12
SenseToLeds – PhotoSource
![Page 13: A Graphical Development and Simulation Environment for TinyOS-based Wireless Sensor Networks](https://reader034.fdocuments.us/reader034/viewer/2022051517/56814992550346895db6d707/html5/thumbnails/13.jpg)
February 13, 2007 Elaine Cheong, UC Berkeley, Ptolemy Miniconference
13
SenseToLeds – PhotoChannel
![Page 14: A Graphical Development and Simulation Environment for TinyOS-based Wireless Sensor Networks](https://reader034.fdocuments.us/reader034/viewer/2022051517/56814992550346895db6d707/html5/thumbnails/14.jpg)
February 13, 2007 Elaine Cheong, UC Berkeley, Ptolemy Miniconference
14
SenseToLeds – WirelessDirector
![Page 15: A Graphical Development and Simulation Environment for TinyOS-based Wireless Sensor Networks](https://reader034.fdocuments.us/reader034/viewer/2022051517/56814992550346895db6d707/html5/thumbnails/15.jpg)
February 13, 2007 Elaine Cheong, UC Berkeley, Ptolemy Miniconference
15
SenseToLeds – Simulation
![Page 16: A Graphical Development and Simulation Environment for TinyOS-based Wireless Sensor Networks](https://reader034.fdocuments.us/reader034/viewer/2022051517/56814992550346895db6d707/html5/thumbnails/16.jpg)
February 13, 2007 Elaine Cheong, UC Berkeley, Ptolemy Miniconference
16
How it worksJava (PtinyOSDirector) Java (PtinyOSLoader) C (TOSSIM)
PtinyOSDirector.preinitialize() Generate nesC code, makefile, and PtinyOSLoader Java file. Run ‘make’.Compile nesC code to a TOSSIM shared object, and PtinyOSLoader Java file to a Java class file.
PtinyOSDirector.initialize() Load PtinyOSLoader Java class into memory.Create instance of PtinyOSLoader class (_loader).Call Java _loader.load().
_loader.load() Load the TOSSIM shared object into memory.
![Page 17: A Graphical Development and Simulation Environment for TinyOS-based Wireless Sensor Networks](https://reader034.fdocuments.us/reader034/viewer/2022051517/56814992550346895db6d707/html5/thumbnails/17.jpg)
February 13, 2007 Elaine Cheong, UC Berkeley, Ptolemy Miniconference
17
How it works (cont.)Java (PtinyOSDirector) Java (PtinyOSLoader) C (TOSSIM)
PtinyOSDirector.initialize(), continued Call Java _loader.main().
_loader.main() Call JNI main_unique_name() native method.
JNI main_unique_name() Call TOSSIM main(), which contains an initialization routine:
Call TOSSIM initializeSockets()Call TOSSIM ptII_startThreads()
Call JNI _loader.startThreads().
_loader.startThreads()Create Java threads.Call Java Thread.start() on each thread.
![Page 18: A Graphical Development and Simulation Environment for TinyOS-based Wireless Sensor Networks](https://reader034.fdocuments.us/reader034/viewer/2022051517/56814992550346895db6d707/html5/thumbnails/18.jpg)
February 13, 2007 Elaine Cheong, UC Berkeley, Ptolemy Miniconference
18
How it works (cont.)
Java (PtinyOSDirector) Java (PtinyOSLoader) C (TOSSIM)
TOSSIM main() initialization routine, continued Create bootup event.Call TOSSIM ptII_queue_insert_event().
Call JNI _loader.enqueueEvent().
_loader.enqueueEvent()Call Java PtinyOSDirector.enqueueEvent().
PtinyOSDirector.enqueueEvent() Call Java Ptolemy II fireAt() on the executive director.
![Page 19: A Graphical Development and Simulation Environment for TinyOS-based Wireless Sensor Networks](https://reader034.fdocuments.us/reader034/viewer/2022051517/56814992550346895db6d707/html5/thumbnails/19.jpg)
February 13, 2007 Elaine Cheong, UC Berkeley, Ptolemy Miniconference
19
SendAndReceiveCnt
![Page 20: A Graphical Development and Simulation Environment for TinyOS-based Wireless Sensor Networks](https://reader034.fdocuments.us/reader034/viewer/2022051517/56814992550346895db6d707/html5/thumbnails/20.jpg)
February 13, 2007 Elaine Cheong, UC Berkeley, Ptolemy Miniconference
20
SendAndReceiveCnt
![Page 21: A Graphical Development and Simulation Environment for TinyOS-based Wireless Sensor Networks](https://reader034.fdocuments.us/reader034/viewer/2022051517/56814992550346895db6d707/html5/thumbnails/21.jpg)
February 13, 2007 Elaine Cheong, UC Berkeley, Ptolemy Miniconference
21
SendAndReceiveCnt
![Page 22: A Graphical Development and Simulation Environment for TinyOS-based Wireless Sensor Networks](https://reader034.fdocuments.us/reader034/viewer/2022051517/56814992550346895db6d707/html5/thumbnails/22.jpg)
February 13, 2007 Elaine Cheong, UC Berkeley, Ptolemy Miniconference
22
SendAndReceiveCnt – Simulation
![Page 23: A Graphical Development and Simulation Environment for TinyOS-based Wireless Sensor Networks](https://reader034.fdocuments.us/reader034/viewer/2022051517/56814992550346895db6d707/html5/thumbnails/23.jpg)
February 13, 2007 Elaine Cheong, UC Berkeley, Ptolemy Miniconference
23
Multihop Routing – Surge
![Page 24: A Graphical Development and Simulation Environment for TinyOS-based Wireless Sensor Networks](https://reader034.fdocuments.us/reader034/viewer/2022051517/56814992550346895db6d707/html5/thumbnails/24.jpg)
February 13, 2007 Elaine Cheong, UC Berkeley, Ptolemy Miniconference
24
Performance Evaluation – SenseToLeds
![Page 25: A Graphical Development and Simulation Environment for TinyOS-based Wireless Sensor Networks](https://reader034.fdocuments.us/reader034/viewer/2022051517/56814992550346895db6d707/html5/thumbnails/25.jpg)
February 13, 2007 Elaine Cheong, UC Berkeley, Ptolemy Miniconference
25
Performance Evaluation – SendAndReceiveCnt
![Page 26: A Graphical Development and Simulation Environment for TinyOS-based Wireless Sensor Networks](https://reader034.fdocuments.us/reader034/viewer/2022051517/56814992550346895db6d707/html5/thumbnails/26.jpg)
February 13, 2007 Elaine Cheong, UC Berkeley, Ptolemy Miniconference
26
Related Work
ns-2 OPNET Modeler, OPNET Wireless Module OMNeT++, NesCT J-Sim Prowler Em*, EmTOS TOSSIM, TinyViz
![Page 27: A Graphical Development and Simulation Environment for TinyOS-based Wireless Sensor Networks](https://reader034.fdocuments.us/reader034/viewer/2022051517/56814992550346895db6d707/html5/thumbnails/27.jpg)
February 13, 2007 Elaine Cheong, UC Berkeley, Ptolemy Miniconference
27
Conclusion
http://ptolemy.eecs.berkeley.edu/viptos
Elaine Cheong, Edward A. Lee and Yang Zhao. “Joint Modeling and Design of Wireless Networks and Sensor Node Software”, EECS Department, University of California, Berkeley, Technical Report No. UCB/EECS-2006-150, November 17, 2006.