Cross-Platform Protocol Development Based on OMNeT++ Stefan Unterschütz, Andreas Weigel and Volker Turau SIMUTools 2012: OMNeT++ Workshop 23 rd March, 2012 Institute of Telematics TUHH Institute of Telematics TUHH Hamburg University of Technology Hamburg University of Technology
1 Introduction
Introduction Introduction Motivation Simulation is indispensable for the development of (wireless) network protocols. OMNeT++ is a powerful tool for simulations of network protocols. Base Station Andreas Weigel Cross-Platform Protocol Development Based on OMNeT++ Andreas Weigel Cross-Platform Protocol Development Based on OMNeT++ 1 1
Introduction Introduction Motivation Simulation is indispensable for the development of (wireless) network protocols. OMNeT++ is a powerful tool for simulations of network protocols. Base Station However: Re-implementation of protocols for a target platform is time-consuming and error-prone Andreas Weigel Cross-Platform Protocol Development Based on OMNeT++ Andreas Weigel Cross-Platform Protocol Development Based on OMNeT++ 1 1
Introduction Introduction Introduction CometOS, a component-based, extensible, tiny “operating system” Design Goals � Single code base for protocols, whether running simulations or executing on target hardware � “Lightweight enough” for resource constrained hardware � Flexibility, extensibility, avoidance of code redundancy � Thereby: speed up protocol development and produce safe code Andreas Weigel Cross-Platform Protocol Development Based on OMNeT++ Andreas Weigel Cross-Platform Protocol Development Based on OMNeT++ 2 2
Introduction Introduction Introduction 1 Architecture and Concepts 2 Feasibility 3 Conclusion 4 Andreas Weigel Cross-Platform Protocol Development Based on OMNeT++ Andreas Weigel Cross-Platform Protocol Development Based on OMNeT++ 3 3
2 Architecture and Concepts
Architecture and Concepts Architecture and Concepts Architecture User Code CometOS Core Module completely independent platform independent Appl. InputGate Rout. Rout. OutputGate NBH Fork Message CSMA Object CometOS MAC AL Scheduler HIL ATmega128RFA1 other platforms platform dependent Hardware platform Andreas Weigel Cross-Platform Protocol Development Based on OMNeT++ Andreas Weigel Cross-Platform Protocol Development Based on OMNeT++ 4 4
Architecture and Concepts Architecture and Concepts Architecture User Code CometOS Core User Code Module Module completely independent Appl. completely independent platform independent Appl. InputGate InputGate Rout. Rout. Rout. Rout. OutputGate OutputGate OMNeT++ NBH Fork Message NBH Fork Message Object CSMA CSMA Object CometOS CometOS Adapter MAC AL MAC AL Scheduler HIL OMNeT++ simulation ATmega128RFA1 other platforms platform dependent Hardware platform Andreas Weigel Cross-Platform Protocol Development Based on OMNeT++ Andreas Weigel Cross-Platform Protocol Development Based on OMNeT++ 4 4
Architecture and Concepts Architecture and Concepts Gates and Message Passing Message handlers are executed non-preemptively (millisecond precision) � Adoption of OMNeT++ message and gate concept � Added type safety � Gates instantiated with a certain message type � Connections between gates are checked at compile time ⇒ dynamic_cast s can be avoided � Decrease of boilerplate code � Gates and self-messages directly bound to handler methods � No handleMessage() dispatch code necessary � User-defined messages � Created by deriving from base class � Basic message types provided: Request/Confirm, Indication Andreas Weigel Cross-Platform Protocol Development Based on OMNeT++ Andreas Weigel Cross-Platform Protocol Development Based on OMNeT++ 5 5
Architecture and Concepts Architecture and Concepts Message Passing (2) class MyMsg: public Message { } ; class MySender : public Module { class MyReceiver : public : public Module { OutputGate<MyMsg> gateOut ; public : InputGate <MyMsg> gateIn ; MySender ( ) : gateOut ( this , " gateOut " ) MyReceiver ( ) : { } gateIn ( this , void i n i t i a l i z e ( ) { &MyReceiver : : handle , schedule ( new Message , " gateIn " ) &MySender : : t r a f f i c ,500); { } } void t r a f f i c ( Message ∗ msg) { void handle (MyMsg ∗ msg) { gateOut . send ( new MyMsg ) ; delete msg; delete msg; } } } ; } ; Andreas Weigel Cross-Platform Protocol Development Based on OMNeT++ Andreas Weigel Cross-Platform Protocol Development Based on OMNeT++ 6 6
Architecture and Concepts Architecture and Concepts MAC abstraction layer � Goal: Basis for arbitrary, platform-independent MAC protocols (CSMA, TDMA, LPL, LPP) � Should support Link-Layer ACKs, CCA, Random Backoffs � Hardware-supported functions of 802.15.4 transceivers MAL . . . CSMA TDMA BoxMAC Andreas Weigel Cross-Platform Protocol Development Based on OMNeT++ Andreas Weigel Cross-Platform Protocol Development Based on OMNeT++ 7 7
Architecture and Concepts Architecture and Concepts Airframes and Serialization � Actual over-the-air packet: Managed byte array (Airframe) � Support for serialization of simple types � User-defined types (structs, classes): ⇒ serialization user-provided struct NwkHeader { uint16_t dst ; uint16_t source ; } void s e r i a l i z e ( ByteVector &buffer , const NwkHeader &value ) { s e r i a l i z e ( buffer , value . dst ) ; s e r i a l i z e ( buffer , value . source ) ; } . . . NwkHeader nwk(SINK_ADDR, getId ( ) ) ; request − >getAirframe ( ) . s e r i a l i z e (nwk ) ; Andreas Weigel Cross-Platform Protocol Development Based on OMNeT++ Andreas Weigel Cross-Platform Protocol Development Based on OMNeT++ 8 8
Architecture and Concepts Architecture and Concepts Initialization / / Setup f o r OMNeT++ in NED language / / ( skipped declaration of modules ) network Network { submodules : s : MySender ; For OMNeT++ r : MyReceiver ; ⇒ .ned, .ini files connections : s . gateOut −− > r . gateIn ; } / / Setup f o r Hardware MySender s ; MyReceiver r ; For Hardware Platforms: int main ( ) { ⇒ C++ initialization file s . gateOut . connectTo ( r . gateIn ) ; cometos : : i n i t i a l i z e ( ) ; cometos : : run ( ) ; return 0; } Andreas Weigel Cross-Platform Protocol Development Based on OMNeT++ Andreas Weigel Cross-Platform Protocol Development Based on OMNeT++ 9 9
Architecture and Concepts Architecture and Concepts Base Station Support � Currently under development � Python wrapper for existing CometOS C++ code (SWIG) � Reuse protocol implementation for a base station � Usable with real testbed or OMNeT++ real-time simulation and TCP/IP connector � Integration of powerful remote access methodology � Read/write of variables � Remote execution of methods � Subscribe to events Andreas Weigel Cross-Platform Protocol Development Based on OMNeT++ Andreas Weigel Cross-Platform Protocol Development Based on OMNeT++ 10 10
Architecture and Concepts Architecture and Concepts Base Station Support class MyModule : r=RemoteModule ( "myModule" ) ; public RemoteModule { r . declareRemote ( " add " , public : uint16_t , MyModule ( const char ∗ name) : uint8_t , RemoteModule (name) { } u int 8 _ t ) print r . add(18 , 11) void i n i t i a l i z e ( ) { >>> 29 declareRemote(&MyModule : : add , " add " ) ; ↑ Python console } uint16_t add ( uint8_t &a , ← CometOS-Module uint8_t &b ) { return a+b ; } } ; MyModule m( "myModule" ) ; Andreas Weigel Cross-Platform Protocol Development Based on OMNeT++ Andreas Weigel Cross-Platform Protocol Development Based on OMNeT++ 10 10
Architecture and Concepts Architecture and Concepts Typical Development Steps OMNeT++ Simulation OMNeT++ Simulation Real-World Deployment C++/Python C++/Python Base Station Base Station Base Station Andreas Weigel Cross-Platform Protocol Development Based on OMNeT++ Andreas Weigel Cross-Platform Protocol Development Based on OMNeT++ 11 11
3 Feasibility
Feasibility Feasibility Resource Demand � Minimum example (MySender, MyReceiver) MCU Flash RAM ATmega128RFA1 4148 Bytes 145 Bytes LPC1763 3136 Bytes 120 Bytes � 7 modules, forked protocol stack MCU Flash RAM ATmega128RFA1 10 kB 649 Bytes LPC1763 7 kB 580 Bytes Andreas Weigel Cross-Platform Protocol Development Based on OMNeT++ Andreas Weigel Cross-Platform Protocol Development Based on OMNeT++ 12 12
Feasibility Feasibility Simulation Accuracy � Comparison of RTTs from field installation (93 nodes at heliostat power plant in Jülich) and simulation for different number of hops Fieldtest Sim 40 round-trip time [ms] 30 20 10 1 2 3 4 hops Andreas Weigel Cross-Platform Protocol Development Based on OMNeT++ Andreas Weigel Cross-Platform Protocol Development Based on OMNeT++ 13 13
4 Conclusion
Recommend
More recommend