TinyOS – Time to ROLL

Download Report

Transcript TinyOS – Time to ROLL

TinyOS – Time to ROLL
(Routing over Low power and Lossy Networks)
David E. Culler
1st European TinyOS Technology Exchange
TTX VI
Feb 10, 2009
A decade ago…
ETTX
2
Traditional Systems
Application
Application
User
System
Network Stack
Transport
Threads
Network
Address Space
Data Link
Files
Physical Layer
Drivers
• Well established
layers of abstractions
• Strict boundaries
• Ample resources
• Independent
Applications at
endpoints
communicate pt-pt
through routers
• Well attended
Routers
ETTX
3
by comparison, WSNs ...
• Highly Constrained resources
– processing, storage, bandwidth, power
• Applications spread over many small nodes
– self-organizing Collectives
– highly integrated with changing environment and network
– communication is fundamental
• Concurrency intensive in bursts
– streams of sensor data and
network traffic
• Robust
– inaccessible, critical operation
• Unclear where the
boundaries belong
– even HW/SW will move
=> Provide a framework for:
• Resource-constrained
concurrency
• Defining boundaries
• Appl’n-specific processing and
power management
ETTX
4
allow abstractions to emerge
Internet Research Perspective…then
• “Resource constraints may cause us to give up the
layered architecture.”
• “Sheer numbers of devices, and their unattended
deployment, will preclude reliance on broadcast
communication or the configuration currently needed
to deploy and operate networked devices.”
• “There are significant robustness and scalability
advantages to designing applications using localized
algorithms.”
• “Unlike traditional networks, a sensor node may not
need an identity (e.g. address).”
• “It is reasonable to assume that sensor networks can
be tailored to the application at hand.”
ETTX
5
And Now: Complete IPv6 in TinyOS
ROM
RAM
CC2420 Driver
3149
272
802.15.4 Encryption
1194
101
Media Access Control
330
9
Media Management Control
1348
20
6LoWPAN + IPv6
2550
0
Checksums
134
0
SLAAC
216
32
DHCPv6 Client
212
3
DHCPv6 Proxy
104
2
ICMPv6
522
0
Unicast Forwarder
1158
451
* Production implementation on TI msp430/cc2420
Multicast Forwarder
352
4
• Footprint, power,
packet size, &
bandwidth
Message Buffers
0
2048
Router
2050
106
UDP
450
6
TCP
1674
50
24038 ROM
(including
runtime)
3598 RAM
ETTX
6
… and in Open Source
ETTX
7
and Power and Reliability …
Data Rate Sensitivity
Data Rate Sensitivity
(Router)
(Edge)
Deployment Duty Cycle
Deployment Reliability
ETTX
8
Where Did We Go Wrong?
Laptop “lab kit”
Parallel Port
for programming
serial Port
for base
station
“Sensor stacks”
on central connector
1/9/2001
Endeavour Retreat
ETTX
6
9
Internet – Networks of Networks
• Networks
vs
• Peripheral
Interconnects
– Ethernet
– WiFi
– Serial links
–
–
–
–
–
• connect hosts
and devices and
other networks
together
• Horizontally
integrated
USB, Firewire
IDE / SCSI
RS232,RS485
IRDA
BlueTooth
• connect one or more
devices to a host
computer
• Vertically integrated
ethernet
– Physical link to
application
wifi
LoWPAN
ETTX
10
Which are real sensors nets like?
Trending
Monitoring
Data
Analytics
Management
Ethernet
WiFi
Operations
GPRS
RS232
RS485
Controllers
Field
Units
hartcomm.org
ETTX
11
A Network Starts with a Router
LoWPAN-Extended IP Network
IP Network
(powered)
IP/LoWPAN Router
IP Device
IP/LoWPAN Sensor Router
ETTX
12
Mote/TinyOS – let chaos reign
WINS
(UCLA/ROckwell)
Intel
rene’
LWIM-III
(UCLA)
SmartDust
WeC
zeevo BT
Intel/UCB
dot
Rene
BTNodeEyes
Intel
cf-mica
trio
Mica
Telos
XBOW
mica
XBOW
rene2
Intel
MOTE2
Intel
iMOTE
XBOW
mica2
XBOW
cc-dot
XBOW
micaZ
digital sun
rain-mica
Bosch
cc-mica
Dust Inc
blue cc-TI
ETTX
04
05
48 kB rom
10 kB ram
802.15.4
06
CyberPhysical
03
NETS/
NOSS
8 kB rom
½ kB ram
02
CENS
STC
01
NSF
00
NEST
Expedition
99
SENSIT
LWIM
DARPA
97 98
13
07
Link
1999
2000 2001
2002
PSFQ
2003
2004
ETTX
SCP-MAC
PEDAMAC
S
X-MAC
SP
2005
2006
2007
S4
Volcano
Redwoods
North Sea
Drain
Drip
Dip
Flush
Golden Gate Bridge
CTP
BVR
FPS
Deluge
GDI
GAF
Transport
WiseMAC
CODA
MintRoute
T-MAC
RMST
B-MAC
MultihopLQI
Fusion
S-MAC
Aloha PS
WooMAC
Network
SPIN
Broadcast Storm
TinyOS 0.6
And rain it did…
Application
2008
14
A Low-Power Standard Link
802.15.4
802.15.1
802.15.3
802.11
802.3
Class
WPAN
WPAN
WPAN
WLAN
LAN
Lifetime
(days)
100-1000+
1-7
Powered
0.1-5
Powered
Net Size
65535
7
243
30
1024
BW (kbps)
20-250
720
11,000+
11,000+
100,000+
Range (m)
1-75+
1-10+
10
1-100
185 (wired)
Goals
Low Power,
Large Scale,
Low Cost
Cable
Replacement
Cable
Replacement
Throughput
Throughput
• Low Transmit power, Low SNR, modest BW, Little
Frames
• Reined in the Phy Chaos, allowed MAC chaos to Reign
ETTX
15
Key Developments
• Event Driven Execution closely tied to storage mgmt
– reliable concurrency, small footprint, and low-power usage
• Idle listening
– Radio power: transmit ≈ receive ≈ just listening
– All the energy is consumed by listening for a packet to receive
» E = P*Time
=> Turn radio on only when there is something to hear
• Reliable routing on Low-Power & Lossy Links
– Power, Range, Obstructions => multi-hop
– Always at edge of SNR => loss happens
=> monitoring, retransmission, and local rerouting
• Trickle – don’t flood (tx rate < 1/density, and < info change)
– Connectivity is determined by physical points of interest, not network
designer. May have huge number of neighbors, so …
– never naively respond to a broadcast, re-broadcast very very politely
ETTX
16
Meanwhile: Key IPv6 Contributions
• Large simple address
– Network ID + Interface ID
– Plenty of addresses, easy to allocate and manage
• Autoconfiguration and Management
– ICMPv6
• Integrated bootstrap and discovery
– Neighbors, routers, DHCP
128 bits
• Protocol options framework
Prefix
IID
– Plan for extensibility
• Simplify for speed
ICMPv6
– MTU discovery with min
• 6-to-4 translation for compatibility
IPv6
Base
ETTX
HbH Opt Routing Fragment Dst Opt
17
IPv6 over 802.15.4: Not an obvious fit
UDP datagram or
TCP stream segment
…, modbus, BacNET/IP, … , HTML, XML, …, ZCL
transport header
application payload
Network packet
40 B + options
cls flow len hops NH src IP
16 B
Link frame
ctrl len src UID dst UID
net payload
dst IP
16 B
1280 Bytes MIN
link payload
chk
128 Bytes MAX
ETTX
18
6LoWPAN adaptation layer
Diverse Object and Data Models (HTML, XML, …, BacNet, …)
7: app
4: xport
Application (Telnet, FTP, SMTP, SNMP, HTTP)
Transport (UDP/IP, TCP/IP)
3: net
Network (IP)
2: link
Link
Serial
X3T9.5
Modem
FDDI
ISDN Sonet
DSL
GPRS
1: phy
802.3
802.5
802.3a Token Ring
Ethernet
802.3i
Ethernet
802.3y
Ethernet
10b2
802.3ab
Ethernet
10bT
802.3an
Ethernet
100bT
Ethernet
1000bT
1G bT
ETTX
6LoWPAN
802.11
802.11a
WiFi
802.11b
WiFi
802.11g
WiFi
802.11n
WiFi
WiFi
802.15.4
LoWPAN
19
IPv6 Header Compression
in HC byte
v6
zero
In 802.15.4 header
derive from 802.15.4 header
derive from 802.15.4 header
•
http://www.visi.com/~mjb/Drawings/IP_Header_v6.pdf
uncompressed
ETTX
20
6LoWPAN – IP Header Optimization
Network packet
40 B
cls flow len hops NH src IP
Link frame
ctrl len src UID dst UID
net payload
dst IP
3B
hops
chk
6LoWPAN adaptation header
• Eliminate all fields in the IPv6 header that can be derived from the
802.15.4 header in the common case
–
–
–
–
–
Source address
Destination address
Length
Traffic Class & Flow Label
Next header
: derived from link address
: derived from link address
: derived from link frame length
: zero
: UDP, TCP, or ICMP
• Additional IPv6 options follow as options
ETTX
21
Energy Consumption Analysis
*
*
Payload Δ
Energy Δ for
fixed payload
ETTX
22
Multi-Hop Communication => Routing
PAN
• Short-range radios & Obstructions => Multi-hop
Communication is often required
– i.e. Routing and Forwarding
– That is what IP does!
• “Mesh-under”: multi-hop communication at the link
layer
– Still needs routing to other links or other PANs
• “Route-over”: IP routing within the PAN => ROLL
ETTX
23
Embedded IPv6 in Concept
Structured Decomposition
Retain strict modularity
Some key cross-layer visibility
IP Link ⇒ Always On
Retain illusion even when always off
IP Link ⇒ “Reliable”
Retain best-effort reliability over unreliable links
IP Link ⇒ Broadcast Domain
IPv6 can support a semi-broadcast
link with few changes
ETTX
24
Autoconfiguration
Configuring Large Numbers of Interfaces
RFC 4861 – Neighbor Discovery
RFC 4862 – Stateless Addr Autoconf
RFC 3315 – DHCPv6
New Options
Existing Options
ICMPv6 Hdr
Router Adv
Prefix Info
MHop Info
Cur Hop Limit
Prefix Length
Network ID
Managed Addr Config
Autonomous Config
Other Config
Valid Lifetime
Router Lifetime
Preferred Lifetime
Reachable Time
Prefix
Sequence Number
Router Hops
Flags
Trickle
ETTX
25
Autoconfiguration
Configuring Large Numbers of Interfaces
Stateless
DHCPv6
RFC 4861 + 4862
RFC 3315
Response
L2e
00-17-3B-00-39-12-58-28
L2e
00-17-3B-00-39-12-58-28
L2s
0x0001
L2s
0x0001
L3
2001:abcd::1
L3
2001:abcd::1
Request
L2e
00-17-3B-00-57-17-58-39
L2e
L2s
0x0023
L2s
L3
2001:abcd::23
L3
00-17-3B-00-57-17-58-39
0x0023
2001:abcd::23
Request
L2e
00-17-3B-00-79-49-66-23
L2e
L2s
0x0092
L2s
L3
2001:abcd::92
L3
ETTX
00-17-3B-00-79-49-66-23
0x0092
2001:abcd::92
26
Routing & Forwarding
Delivering datagrams over multiple hops with
High reliability and Low Energy usage
Forwarder
Net
Multicast
Buffer
Router
Routing
Protocol
Unicast
Queue
Send
Manager
Send
Manager
Forwarding
TableNext
Prefix
Routing
Table
Prefix
Next
ICMPv
6
Default
Media Management Control
Remote Media
Link
Data
Link Stats
Local Media
Neighbor Table
Ack
Sample Period
Addr
Period
Phase
Pending
RSSI
PRR
Sample Phase
ETTX
27
Cross-Fertilization of WSN and IETF ideas
Discovering Links
ICMPv6 Hdr
Router Adv
MHop Info
Building a Connectivity Graph
Default Routes
Routing Table
Low Routing Cost
Prefix
Next
High Routing Cost
Selecting the Next Hop
Routing Table
Prefix
Next
Forwarding
TableNext
Prefix
• Default route
• Hop-by-hop retry
• Reroute on loss
Default
ETTX
28
Complete Embedded IPv6 Stack
App
HTTP
Tran
Telnet
SNMP
UDP
6LoWPAN Adaptation
Multicast
Buffer
Router
Queue
Send
Manager
Send
Manager
Forwarding
Table
Prefix
Autoconf
Routing
Protocol
Unicast
ICMPv
6
Routing
Table
Prefix Next
Next
Stateless
Autoconf
Default
Media Management Control
Remote Media
Link
DHCPv6
TCP
Forwarder
Net
…
DNS
Data
Ack
Link Stats
Local Media
Neighbor Table
Addr
Period
Phase
Pending
RSSI
PRR
Sample Period
Sample Phase
ETTX
29
Adding up the pieces
24038 ROM
(including
runtime)
3598 RAM
* Production implementation on TI msp430/cc2420
ROM
RAM
CC2420 Driver
3149
272
802.15.4 Encryption
1194
101
Media Access Control
330
9
Media Management Control
1348
20
6LoWPAN + IPv6
2550
0
Checksums
134
0
SLAAC
216
32
DHCPv6 Client
212
3
DHCPv6 Proxy
104
2
ICMPv6
522
0
Unicast Forwarder
1158
451
Multicast Forwarder
352
4
Message Buffers
0
2048
Router
2050
106
UDP
450
6
TCP
1674
50
ETTX
30
So what’s Next?
ETTX
31
Rein in the Chaos – by layers
App
App
HTTP
HTTP
Tran
Tran
Telnet
Telnet
SNMP
SNMP
UDP
UDP
6LoWPANAdaptation
Adaptation
6LoWPAN
Net
Net
Router
Router
Queue
Queue
Send
Send
Manager
Manager
Send
Send
Manager
Manager
Autoconf
Autoconf
Routing
Routing
Protocol
Protocol
Unicast
Unicast
Forwarding
Forwarding
TableNext
PrefixTable
ICMPv
ICMPv
66
Routing
Routing
Table
Prefix
Next
Table
Stateless
Stateless
Autoconf
Autoconf
Default
Media
MediaManagement
ManagementControl
Control
Remote
RemoteMedia
Media
Link
Link
DHCPv6
DHCPv6
TCP
TCP
Forwarder
Forwarder
Multicast
Multicast
Buffer
Buffer
…
…
DNS
DNS
Data
Data
Ack
Ack
Link
LinkStats
Stats
Local
LocalMedia
Media
Neighbor Table
Addr
Period
Phase
Pending
RSSI
PRR
Sample Period
Sample Phase
ETTX
32
Y-A-MAC?
App
App
HTTP
HTTP
Tran
Tran
Telnet
Telnet
SNMP
SNMP
UDP
UDP
6LoWPANAdaptation
Adaptation
6LoWPAN
Net
Net
DHCPv6
DHCPv6
TCP
TCP
Router
Router
Queue
Queue
Send
Send
Manager
Manager
Send
Send
Manager
Manager
Autoconf
Autoconf
Routing
Routing
Protocol
Protocol
Unicast
Unicast
Forwarding
Forwarding
TableNext
PrefixTable
ICMPv
ICMPv
66
Routing
Routing
Table
Prefix
Next
Table
Stateless
Stateless
Autoconf
Autoconf
Default
Media
MediaManagement
ManagementControl
Control
Remote
RemoteMedia
Media
Link
Link
…
…
DNS
DNS
Forwarder
Forwarder
Multicast
Multicast
Buffer
Buffer
• Yet-Another-MAC layer?
• If it is REALLY going to be a
standard
Data
Data
Ack
Ack
Link
LinkStats
Stats
Local
LocalMedia
Media
Neighbor Table
Addr
Period
Phase
Pending
RSSI
PRR
Sample Period
Sample Phase
– Interoperability ‘within the PAN’
requires compatible MACs.
– 802.15.4 left a big hole
» Beaconing doesn’t work
» No low power defined for FFD
• Perhaps the research
community should stop
“differentiating” and step
forward to make one MAC stick
• Frame formats are not “up for
debate”
• Visibility @ Link / Net Interface
ETTX
33
Routing - really
• At layer 3
– Not 2, not 7, 3!
App
App
HTTP
HTTP
Tran
Tran
Telnet
Telnet
SNMP
SNMP
UDP
UDP
6LoWPANAdaptation
Adaptation
6LoWPAN
Net
Net
Router
Router
Queue
Queue
Send
Send
Manager
Manager
Send
Send
Manager
Manager
Autoconf
Autoconf
Routing
Routing
Protocol
Protocol
Unicast
Unicast
Forwarding
Forwarding
TableNext
PrefixTable
ICMPv
ICMPv
66
Routing
Routing
Table
Prefix
Next
Table
Media
MediaManagement
ManagementControl
Control
Data
Data
Ack
Ack
Link
LinkStats
Stats
Local
LocalMedia
Media
Neighbor Table
Addr
Period
Phase
Pending
RSSI
• Implemented with routing
table, forwarder, and welldefined protocols
– Packets, States, Actions
Stateless
Stateless
Autoconf
Autoconf
Default
Remote
RemoteMedia
Media
Link
Link
DHCPv6
DHCPv6
TCP
TCP
Forwarder
Forwarder
Multicast
Multicast
Buffer
Buffer
…
…
DNS
DNS
PRR
Sample Period
Sample Phase
• ROLL working group in
IETF
• Application “requirements”
• Excellent Protocol Survey
• Entering actual work phase
ETTX
34
ROLL Internet Drafts
• draft-ietf-roll-protocols-survey -052009-01-26
• draft-ietf-roll-terminology -00 2008-10-27
•
•
•
•
draft-ietf-roll-building-routing-reqs -05 2009-02-04
draft-ietf-roll-home-routing-reqs -062008-11-19
draft-ietf-roll-indus-routing-reqs -042009-01-22
draft-ietf-roll-urban-routing-reqs -032009-01-08
ETTX
35
The Heart of ROLL
ETTX
36
Transport
App
App
HTTP
HTTP
Tran
Tran
Telnet
Telnet
SNMP
SNMP
UDP
UDP
6LoWPANAdaptation
Adaptation
6LoWPAN
Net
Net
Router
Router
Queue
Queue
Send
Send
Manager
Manager
Send
Send
Manager
Manager
Autoconf
Autoconf
Routing
Routing
Protocol
Protocol
Unicast
Unicast
Forwarding
Forwarding
TableNext
PrefixTable
ICMPv
ICMPv
66
Routing
Routing
Table
Prefix
Next
Table
Stateless
Stateless
Autoconf
Autoconf
Default
Media
MediaManagement
ManagementControl
Control
Remote
RemoteMedia
Media
Link
Link
DHCPv6
DHCPv6
TCP
TCP
Forwarder
Forwarder
Multicast
Multicast
Buffer
Buffer
…
…
DNS
DNS
Data
Data
Ack
Ack
Link
LinkStats
Stats
Local
LocalMedia
Media
Neighbor Table
Addr
Period
Phase
Pending
RSSI
PRR
Sample Period
Sample Phase
• Crazy not to support UDP
and TCP
• Do we enter a TCP for LLNs
renaissance?
• Do we define a new
transport?
• What is the “embedded
sockets API?”
ETTX
37
Issues in Communication Abstraction
• Names
–
–
–
–
What are they?
What do they mean? What is their scope?
How are they allocated?
How are they translated into useful properties
» Address? Physical Resource?
• Storage
– Transmit
» When can it be reused? How do you know? What do you
do when it is full?
– Receive
» When is it allocated? Reclaimed? By whom? What
happens when it overflows?
– Asynchronous event
» How do you know that something has arrived?
ETTX
38
Answers: Naming
• TinyOS Active Messages
– TOS_local_addr, 16 bits, only within “a network”, allocated at
program download time
– Scope limited to TOS_group, within PAN, Channel, and
physical extent.
– The standards that try to do it all with IEEE 802.15.4 16 bit
short address are not much better
• IP Architecture
– Link name: IEEE 802.15.4 => EUID64 & SA16
» EUID64 globally unique, SA16 assigned to be unique over
the PAN
– Net name: IP address
» Prefix | Interface Id
» Must be unique within routability extent
» Several IP address: Link Local, Global, Multicast, …
- Service name: Port
- Hostname Translated to IP by DNS
ETTX
39
Answers: Storage
• TinyOS Active Messages
– Sender app allocates send buffer, OS owns it till sendDone
event
– OS provides App with recv buffer, app must return it or a
replacement
• BSD Sockets
– Sender app allocate buffer, copied to kernel on send
– Receiver allocates buffer and passes pointer to kernel, kernel
copies
– Additional sets of buffer managed within the kernel
• TinyOS Sockets ???
ETTX
40
Example: UDP Interface
interface
command
command
command
Udp {
error_t bind( uint16_t port );
uint16_t getMaxPayloadLength( const sockaddr_in6_t *to );
error_t sendto( const void *buf, uint16_t len,
const sockaddr_in6_t *to );
event void recvfrom( void *buf, uint16_t len, sockaddr_in6_t *from,
link_metadata_t *metadata );
}
• Wiring to a UDP interface is enough for sendto – no allocate
• Standard Unix sockaddr_in6_t
• Bind – associates the component that uses the interface with the port
– Starts receiving whatever datagrams come in on it
• Sendto sends a datagram from a buf to an IP destination
–
–
–
–
Neighbor, intra-PAN, inter-network (wherever it needs to go!)
Linklocal address is 1-hop neighbor
Pan-wide routable prefix
Error when not in network or overrun transmit resources
• Recvfrom gets a buffer with a datagram and metadata about it
• Able to fill the 15.4 frame without knowing details of header
ETTX
compression
41
Example: UDP echo service
configuration EchoUdpC { }
implementation {
components KernelC;
components EchoUdpP as EchoP;
EchoP.Boot -> KernelC.Boot;
EchoP.Udp -> KernelC.Udp0;
}
module EchoUdpP {
uses interface Boot, Udp;
}
implementation {
event void Boot.booted() {
call Udp.bind( ECHO_PORT ); /* bind to port 7 */
}
event void Udp.recvfrom( void *buf, uint16_t len,
sockaddr_in6_t *from,
link_metadata_t *linkmsg ) {
call Udp.sendto( buf, len, from ); /* echo msg back */
}
}
ETTX
42
And what about TCP
• UDP is a datagram transport
– Essentially the same as AM
– Fits naturally in event-driven model
– Can use NesC platform independent data structure to have
unambiguous packet formats without hton / ntoh error prone
bit twiddling.
• But TCP is a stream protocol…
ETTX
43
TCP Interface
interface Tcp {
command error_t bind(uint16_t port, uint8_t *buf, uint16_t bufsize);
event
bool
accept( sockaddr_in6_t *to );
command error_t connect( const sockaddr_in6_t *to, uint8_t *buf,
uint16_t bufsize );
event void connected();
command error_t send( const void *buf, uint16_t len );
event void acked();
event uint16_t recv( void *buf, uint16_t len );
command error_t close( bool force );
event void closed();
}
•
•
•
•
Transitions of the TCP protocol reflected as events
Recv per segment
Here, appln allocates send buffer but stack manages it.
Send is not split-phase (!!!)
ETTX
44
TCP echo server
module EchoTcpP {
uses interface Boot, Tcp;
}
implementation {
uint8_t m_buf[ BUF_SIZE ];
/* Transmit buffer */
event void Boot.booted() {
call Tcp.bind( ECHO_PORT, m_buf, sizeof(m_buf) );
}
event bool Tcp.accept( sockaddr_in6_t *to ) { return TRUE; }
event void Tcp.connected() { }
event void Tcp.acked() { }
event uint16_t Tcp.recv( void *buf, uint16_t len ) {
return ( call Tcp.send( buf, len ) == SUCCESS ) : len ? 0;
}
event void Tcp.closed() {
/* setup socket for new connection */
call Tcp.bind( ECHO_PORT, m_buf, sizeof(m_buf) );
}
ETTX
45
Event-Driven Execution of Services
Web Server Application
Software
Service request
HTTP – application
protocol
Transport
recv
Data
Presentation
Kernel Fire
Network
Link
HplSignal
Phy
Hardware
Radio
Flash
Timers
MCU
Drivers
Ports ADC
ETTX
46
Split-Phase Data Acquisition
Web Server Application
Software
HTTP – application protocol
Data
Presentation
Transport
Kernel
Network
Link
HplSignal
Phy
Hardware
Radio
Flash
Timers
MCU
Ports
ETTX
Drivers
ADC
47
Examples - Tasks
Web Server Application
serviceReq
notify
Software
HTTP – application protocol
Data
Presentation
Transport
Kernel
Network
Link
fired
HplSignal
Phy
Hardware
Radio
fired
readDone
Flash
Timers
MCU
ETTX
Ports
Drivers
ADC
48
HTTP
event bool HttpTcp.accept( sockaddr_in6_t *to ) {
serverState = LISTENING; return TRUE; }
event void HttpTcp.connected() {
serverState = CONNECTED;
init_pump(); }
event uint16_t HttpTcp.recv( void *inbuf, uint16_t len )
{ if (httppump(inbuf,len)) {
switch (http_method) {
case HTTP_GET : signal Http.GETservice (url, uindex); break;
case HTTP_POST: signal Http.POSTservice(url, uindex); break;
default:
call HttpTcp.close( FALSE );
}
}
return len;
}
command error_t Http.serviceDone() {
call HttpTcp.close( FALSE ); return SUCCESS; }
command error_t Http.send( const void *buf, uint16_t len ) {
return call HttpTcp.send( buf, len );
}
event void HttpTcp.acked() {
}
ETTX
event void HttpTcp.closed(){call HttpTcp.bind(port,
resp, respLen);} 49
Resource Blueprint at the Top
configuration WebSense {
}
implementation {
components KernelC;
components WebC as WebC;
/* Web request service */
components HttpC as HttpC;
/* TCP HTTP (port 80) service */
components new TimerMilliC() as HttpTimer; /* Protocol deadman */
components Msp430Adc12C;
/* Hardware ADC abstraction */
components Msp430PortsC;
/* Hardware IO Ports */
WebC.Http
WebC.Boot
WebC.IPv6Addresses
WebC.Time
HttpC.HttpTcp
HttpC.IPv6Addresses
HttpC.Timer
-> HttpC.Http;
/* Protocol interface */
-> KernelC.Boot;
-> KernelC.IPv6Addresses;
-> KernelC.GlobalTime;
-> KernelC.Tcp0;
-> KernelC.IPv6Addresses;
-> HttpTimer;
/* Digital inputs */
components new DigitalInC("Door") as Din0;
WebC.Door
-> Din0.DigitalIn;
Din0.Pin
-> Msp430PortsC.Port1[2];
Din0.PinInt -> Msp430PortsC.Port1Interrupt[2];
/* Analog inputs */
components TempIntC;
WebC.Temp -> TempIntC.TempInt;
TempIntC.ADC
-> Msp430Adc12C.Msp430Adc12[INCH_10]; /* Internal temp */
components new AnalogInC(REFVCC, "Pot") as TrimPot;
WebC.Pot -> TrimPot.Sensor;
TrimPot.ADC -> Msp430Adc12C.Msp430Adc12[INCH_4 ];
ETTX
}
50
… or if you prefer Zigbee Profiles
• http://www.ietf.org/internet-drafts/draft-tolle-cap-00.txt
“A UDP/IP Adaptation of the ZigBee Application Protocol”
ETTX
51
what it means for sensors
• Low-Power Wireless Embedded devices can finally
be connected using familiar networking technology,
– like ethernet
– and like WiFi
(but even where wiring is not viable)
(but even where power is not plentiful)
• all of these can interoperate in real applications
• Interoperate with traditional computing infrastructure
• Utilize modern security techniques
• Application Requirements and Capacity Plan dictate
how the network is organized,
– not artifacts of the underlying technology
– Gateways and Proxies may or may not be at the media boundary
– …
ETTX
52
Web Services
XML / RPC / REST / SOAP / OSGI
HTTP / FTP / SNMP
Proxy / Gateway
Making sensor nets make sense
LoWPAN – 802.15.4
• 1% of 802.11 power, easier to
embed, as easy to use.
• 8-16 bit MCUs with KBs, not
MBs.
• Off 99% of the time
TCP / UDP
ROLL
IP
Ethernet
Sonet
802.15.4, …
802.11
IETF 6lowpan
ETTX
53
• Thanks
ETTX
54
Technology Transformation - Bottom Line
Network
Microcontroller
hartcomm.org
Flash Storage
Radio
• Sensors have become “physical information servers”
• Treat them as “information servers”
ETTX
55
Industrial Interconnects
• BACnet
Object and Data Model
– RS-232 & RS-485 => IEEE 802.3 via BACnet/IP
• LONworks
– Twisted Pair & Power Line => LonTalk/IP
Implementation
Glue
• Common Industrial Protocol (CIP)
TCP/UDP/IP
– CAN & ControlNet => EtherNet/IP
Many IP links
Specific Legacy
Physical Link
• SCADA
– Prop. RS-485 & Leased Line & Prop.
Radios => ModBUS => Ethernet =>
TCP/IP
In 2000, ODVA and CI introduced another member
of the CIP family: EtherNet/IP, where “IP” stands for
“Industrial Protocol.” In this network adaptation, CIP
runs over TCP/IP and therefore can be deployed
over any TCP/IP supported data link and physical
layers, the most popular of which is IEEE 802.311,
commonly known as Ethernet. The universal
principles of CIP easily lend themselves to possible
future implementations on new physical/ data link
layers. [The Common Industrial Protocol (CIP) and
• FieldBus
– Modbus, Profibus, Ind. Ethernet,
Foundation HSE, H1, …SP100.11a?
the Family of CIP Networks (Pub 123 )]
ETTX
56
A Decade Ago
An End-to-end Perspective
• Scalable Infrastructure
–
–
–
–
highly available
persistent state (safe)
databases, agents
service programming environment
Service
Path
• Desktops
– max out at few 100M
– in your face
– connected to the infrastructure
• Ubiquitous Devices
– billions
– sensors / actuators
– PDAs / smartphones / PCs
– heterogeneous
5/30/2000
Towards System Architecture for Tiny
Networked Devices
wireless hoo hah
2
msg_send_
done
(success)
msg_rec(type, data)
send_msg(ad
dr, type,
data)
init
David Culler
http://www.cs.berkeley.edu/~culler
U.C. Berkeley
power(mode)
TOS Component
send_msg_threadInternal State
Wireless hoo-hah
5/30/2000
5/30/2000
ETTX
TX_packet
_done
(success)
RX_packet_
done
(buffer)
init
Power(mode)
TX_packet(buf)
Messaging Component
/* Messaging Component Declaration */
//ACCEPTS:
char TOS_COMMAND(AM_SEND_MSG)(char addr,char
type, char* data);
void TOS_COMMAND(AM_POWER)(char mode);
char TOS_COMMAND(AM_INIT)();
//SIGNALS:
char AM_MSG_REC(char type, char* data);
char AM_MSG_SEND_DONE(char success);
//HANDLES:
char AM_TX_PACKET_DONE(char success);
char AM_RX_PACKET_DONE(char* packet);
//USES:
char TOS_COMMAND(AM_SUB_TX_PACKET)(char* data);
void TOS_COMMAND(AM_SUB_POWER)(char mode);
char TOS_COMMAND(AM_SUB_INIT)();
wireless hoo hah
6
57