/
Network Kernel Architectures Network Kernel Architectures

Network Kernel Architectures - PowerPoint Presentation

breezeibm
breezeibm . @breezeibm
Follow
342 views
Uploaded On 2020-08-28

Network Kernel Architectures - PPT Presentation

and Implementation 01204423 Sensor Network Programming and MoteLib Simulator Chaiporn Jaikaeo chaipornjkuacth Department of Computer Engineering Kasetsart University 2 Outline Network programming with MoteLib ID: 807132

mote sim simulator 100 sim mote 100 simulator addnode build blink elf node nodes 200 network run import motesim

Share:

Link:

Embed:

Download Presentation from below link

Download The PPT/PDF document "Network Kernel Architectures" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.


Presentation Transcript

Slide1

Network Kernel Architectures and Implementation(01204423) Sensor Network Programmingand MoteLib Simulator

Chaiporn Jaikaeo

chaiporn.j@ku.ac.th

Department of Computer Engineering

Kasetsart University

Slide2

2OutlineNetwork programming with MoteLibMoteSim – MoteLib's Simulator

Slide3

3Mote and Network Emulator

Virtual

Mote

Slide4

4Mote and Network SimulationMotes are modeled with standard C programExact same code as used for the actual hardwareNetwork is modeled with Python program

from

motesim

import

Simulator, Mote

MOTEAPP = '

build/sim/count-radio.elf

'

sim = Simulator()

sim.addNode(Mote(MOTEAPP), (100,100))

sim.addNode(Mote(MOTEAPP), (200,100))

sim.run()

Slide5

5Creating Executable for SimulatorExecutable for simulator can be built by runningExecutable will be stored under build/sim directory

make PLATFORM=

sim

Slide6

6Modeling NetworkNetwork is modeled with PythonMake sure the following directories are part of PYTHONPATHTry the following program sim-blink.pyCan be found in

examples/

directory

$MOTELIB_DIR

/platforms/sim/python

$MOTELIB_DIR

/lib/python

from

motesim

import

Simulator, Mote

sim = Simulator()

sim.addNode(Mote('build/sim/blink.elf'), (100,100))

sim.addNode(Mote('build/sim/blink.elf'), (200,100))

sim.run()

Slide7

7Virtual Mote CreationVirtual mote object can be instantiated from class MoteEach virtual mote instance must be added to the simulation using addNode method

from

motesim

import

Simulator, Mote

sim = Simulator()

m1 = Mote('build/sim/blink.elf')

m2 = Mote('build/sim/count.elf')

sim.addNode(m1, (100,100))

sim.addNode(m2, (200,100))

sim.run()

Create a mote

running

'blink

' app

Create a mote

running

'count

' app

Add m2 to the simulation

at position (200,100)

Slide8

8Enabling Python ConsoleIPython is recommended for better interaction

from

motesim

import

Simulator, Mote

sim = Simulator()

sim.addNode(Mote('build/sim/blink.elf'), (100,100))

sim.addNode(Mote('build/sim/blink.elf'), (200,100))

sim.run(script=sim.console)

$ sudo apt-get install ipython

Slide9

9Accessing Node ObjectsNode objects are stored in the node list inside sim object

>>> n = sim.nodes[2]

>>> dir(n)

Slide10

10Turning Node On and OffNode can be turned off using shutdown() methodboot() method turns node back on

>>> sim.nodes[3].shutdown()

>>> sim.nodes[3].boot()

Slide11

11Emulating ButtonButton pressing can be emulated by two methods:pressButton()releaseButton()

>>> n = sim.nodes[3]

>>> n.pressButton()

>>> n.releaseButton()

Slide12

12Emulating UARTNode's UART interface can be emulated via TCP socketNot activated by defaultUse activateSocket() inside node's uart object to activate

>>> n = sim.nodes[3]

>>> n.uart.activateSocket()

('0.0.0.0', 32345)

>>>

Listening port

$ telnet localhost 57597

Trying 0.0.0.0...

Connected to 0.

Escape character is '^]'.

^]

telnet> mode c

switch to character mode

Slide13

13Exercise: Voting MachineReimplement the wireless voting applicationAllow user to cast a vote using the USER buttonVoting choices are: Red (1),

Yellow (2)

,

Green (3)

, or No Vote (0)

When the USER button is pressed,

Set LED status accordingly

Report current vote to the base station (#0) with message type 50

Integrate base station functionality into your app

Slide14

14Exercise (cont'd)Create a virtual network with 5 nodesActivate UART at base station (node #0)Telnet to the open portEmulate button pressing at other nodes