Title: A Graphical Development and Simulation Environment for TinyOS-based Wireless Sensor Networks
1A Graphical Development and Simulation
Environment for TinyOS-based Wireless Sensor
Networks
- Elaine Cheong
- February 13, 2007
- Seventh Biennial Ptolemy Miniconference
- Berkeley, California
2Wireless Sensor Networks
3TinyOS and nesC
configuration SenseToLeds implementation
components Main, SenseToInt, IntToLeds,
TimerC, DemoSensorC as Sensor
Main.StdControl -gt SenseToInt Main.StdControl
-gt IntToLeds SenseToInt.Timer -gt
TimerC.Timerunique("Timer")
SenseToInt.TimerControl -gt TimerC
SenseToInt.ADC -gt Sensor SenseToInt.ADCControl
-gt Sensor SenseToInt.IntOutput -gt
IntToLeds
4SenseToLeds in Viptos
5Converting between nesC and MoML
- nc2moml
- nesC component code ? MoML class (Ptolemy actor)
- ncapp2moml
- nesC application code ? MoML entity (Ptolemy
model)
6Generating MoML for TimerC.nc nc2moml
lt?xml version"1.0"?gt lt!DOCTYPE plot PUBLIC
"-//UC Berkeley//DTD MoML 1//EN"
"http//ptolemy.eecs.berkeley.edu/xml/dtd/MoML_1.d
td"gt ltclass name"TimerC" extends"ptolemy.domain
s.ptinyos.lib.NCComponent"gt ltproperty
name"source" value"CLASSPATH/tos/system/TimerC.
nc" /gt ltport name"StdControl"
class"ptolemy.actor.IOPort"gt ltproperty
name"input" /gt ltproperty name"_showName"
class"ptolemy.kernel.util.SingletonAttribute"
/gt lt/portgt ltport name"Timer"
class"ptolemy.actor.IOPort"gt ltproperty
name"input" /gt ltproperty name"multiport"
/gt ltproperty name"_showName"
class"ptolemy.kernel.util.SingletonAttribute"
/gt lt/portgt lt/classgt
7Generating MoML for SenseToLeds.nc ncapp2moml
... ltentity name"MicaCompositeActor"
class"ptolemy.domains.ptinyos.lib.MicaCompositeAc
tor"gt ltentity name"Main" class"tos.system.Main
" /gt ltentity name"TimerC" class"tos.system.Tim
erC" /gt ltentity name"SenseToInt"
class"tos.lib.Counters.SenseToInt" /gt ltentity
name"IntToLeds" class"tos.lib.Counters.IntToLeds
" /gt ltentity name"DemoSensorC"
class"tos.sensorboards.micasb.DemoSensorC" /gt
... ltlink relation"relation1"
port"Main.StdControl" /gt ltlink
port"IntToLeds.StdControl" relation"relation2"
/gt ltlink relation1"relation2"
relation2"relation1" /gt ltlink
port"SenseToInt.StdControl" relation"relation3"
/gt ltlink relation1"relation3"
relation2"relation1" /gt ltlink
relation"relation4" port"SenseToInt.Timer" /gt
ltlink port"TimerC.Timer" relation"relation5"
/gt ltlink relation1"relation5"
relation2"relation4" /gt ... lt/entitygt ...
8SenseToLeds Physical Environment
9SenseToLeds Hardware
10SenseToLeds Software
11PtinyOSDirector
12SenseToLeds PhotoSource
13SenseToLeds PhotoChannel
14SenseToLeds WirelessDirector
15SenseToLeds Simulation
16How it works
Java (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.
17How 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.
18How 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.
19SendAndReceiveCnt
20SendAndReceiveCnt
21SendAndReceiveCnt
22SendAndReceiveCnt Simulation
23Multihop Routing Surge
24Performance Evaluation SenseToLeds
25Performance Evaluation SendAndReceiveCnt
26Related Work
- ns-2
- OPNET Modeler, OPNET Wireless Module
- OMNeT, NesCT
- J-Sim
- Prowler
- Em, EmTOS
- TOSSIM, TinyViz
27Conclusion
- 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.