28
Verification and Power Analysis of TinyOS with Hybrid Automata Sinem Coleri Mustafa Ergen EECS EECS [email protected] [email protected]

Verification and Power Analysis of TinyOS with Hybrid Automata Sinem Coleri Mustafa Ergen EECS [email protected] [email protected]

  • View
    235

  • Download
    1

Embed Size (px)

Citation preview

Page 1: Verification and Power Analysis of TinyOS with Hybrid Automata Sinem Coleri Mustafa Ergen EECS csinem@eecs.berkeley.edu ergen@eecs.berkeley.edu

Verification and Power Analysis of TinyOS with Hybrid Automata

Sinem Coleri Mustafa Ergen

EECS EECS

[email protected] [email protected]

Page 2: Verification and Power Analysis of TinyOS with Hybrid Automata Sinem Coleri Mustafa Ergen EECS csinem@eecs.berkeley.edu ergen@eecs.berkeley.edu

EE291E Hybrid Systems – T. John Koo and Shankar Sastry 2

Outline

Introduction TinyOS

TinyOS characteristics Hytech

Hytech Description Verification of TinyOS Power Analysis of a TinyOS sensor node

SHIFT SHIFT description Power Analysis of a Sensor Network

Conclusion

Page 3: Verification and Power Analysis of TinyOS with Hybrid Automata Sinem Coleri Mustafa Ergen EECS csinem@eecs.berkeley.edu ergen@eecs.berkeley.edu

EE291E Hybrid Systems – T. John Koo and Shankar Sastry 3

Introduction Why need sensor networks?

Monitoring environment What is the characteristic of sensor networks?

Deploy once and leave without future maintenance Why need verification?

Guaranteed correct operation in every circumstance. Why need power analysis?

Predict the lifetime. What type of modelling?

Discrete events and continuous activities: Hybrid Automata What are the tools?

HyTech for verification, SHIFT for simulation What are the metrics?

Power consumption of a single node Lifetime of the network

Page 4: Verification and Power Analysis of TinyOS with Hybrid Automata Sinem Coleri Mustafa Ergen EECS csinem@eecs.berkeley.edu ergen@eecs.berkeley.edu

EE291E Hybrid Systems – T. John Koo and Shankar Sastry 4

TinyOS

Component-based Modularity by assembling just the software components

to synthesize app. from hardware components Components as reentrant cooperating state machines

Event-based Components communicating through events and

commands Power efficient

Spending unused CPU cycles in sleep Turning radio off when not is use

Page 5: Verification and Power Analysis of TinyOS with Hybrid Automata Sinem Coleri Mustafa Ergen EECS csinem@eecs.berkeley.edu ergen@eecs.berkeley.edu

EE291E Hybrid Systems – T. John Koo and Shankar Sastry 5

Complete TinyOS application

Scheduler Graph of components

Each component has Interface(.comp) Internal Implementation(.c)

Page 6: Verification and Power Analysis of TinyOS with Hybrid Automata Sinem Coleri Mustafa Ergen EECS csinem@eecs.berkeley.edu ergen@eecs.berkeley.edu

EE291E Hybrid Systems – T. John Koo and Shankar Sastry 6

Complete TinyOS application: Component

Interface comprises of synchronous commands and asynchronous events Upper Interface

Commands it implements Events it signals

Lower Interface Commands it uses Events it handles

Internal Storage Fixed-size frame containing the state of component

Internal Implementation Light-weight threads – tasks Command and event handlers

Page 7: Verification and Power Analysis of TinyOS with Hybrid Automata Sinem Coleri Mustafa Ergen EECS csinem@eecs.berkeley.edu ergen@eecs.berkeley.edu

EE291E Hybrid Systems – T. John Koo and Shankar Sastry 7

Description of Application

Describes the wiring of the interfaces Efficient modularity

Optimization by static info

Page 8: Verification and Power Analysis of TinyOS with Hybrid Automata Sinem Coleri Mustafa Ergen EECS csinem@eecs.berkeley.edu ergen@eecs.berkeley.edu

EE291E Hybrid Systems – T. John Koo and Shankar Sastry 8

Application Graph of Components

RFM

Radio byte

Radio Packet

photo

clocksbit

byte

packet

sensing applicationapplication

HW

SW

ADC

Page 9: Verification and Power Analysis of TinyOS with Hybrid Automata Sinem Coleri Mustafa Ergen EECS csinem@eecs.berkeley.edu ergen@eecs.berkeley.edu

EE291E Hybrid Systems – T. John Koo and Shankar Sastry 9

Scheduling

Events have higher priority Events preempt tasks Almost instantaneous event execution

Not wait for long latency actions Small amount of work related to component state

Page 10: Verification and Power Analysis of TinyOS with Hybrid Automata Sinem Coleri Mustafa Ergen EECS csinem@eecs.berkeley.edu ergen@eecs.berkeley.edu

EE291E Hybrid Systems – T. John Koo and Shankar Sastry 10

Scheduling

Tasks have lower priority Tasks do not preempt events or other tasks Scheduled by FIFO scheduler Handled rapidly without blocking or polling

Unused CPU cycles in sleep state

Page 11: Verification and Power Analysis of TinyOS with Hybrid Automata Sinem Coleri Mustafa Ergen EECS csinem@eecs.berkeley.edu ergen@eecs.berkeley.edu

EE291E Hybrid Systems – T. John Koo and Shankar Sastry 11

Ex. Communication

RFM Bit Level

Byte Level

Packet Level

Event handling

Task handling

Put processor sleep

post a task

Page 12: Verification and Power Analysis of TinyOS with Hybrid Automata Sinem Coleri Mustafa Ergen EECS csinem@eecs.berkeley.edu ergen@eecs.berkeley.edu

EE291E Hybrid Systems – T. John Koo and Shankar Sastry 12

Hytech

Hytech inputs System description

Composition of linear hybrid automata Temporal Logic Requirement

Hytech outputs Safety check Debugging traces

Page 13: Verification and Power Analysis of TinyOS with Hybrid Automata Sinem Coleri Mustafa Ergen EECS csinem@eecs.berkeley.edu ergen@eecs.berkeley.edu

EE291E Hybrid Systems – T. John Koo and Shankar Sastry 13

From TinyOS to Hytech

TinyOS component-> Hytech automaton

TinyOS event, commands-> Hytech discrete events

TinyOS clock cycle-> Hytech discrete time step

TinyOS energy -> Hytech variable

Page 14: Verification and Power Analysis of TinyOS with Hybrid Automata Sinem Coleri Mustafa Ergen EECS csinem@eecs.berkeley.edu ergen@eecs.berkeley.edu

EE291E Hybrid Systems – T. John Koo and Shankar Sastry 14

Overall View of TinyOS Automata

RFM

Radio byte

Radio Packet

bit

byte

packet

sensing applicationapplication

Task handler

Packet generation

rfm_clock

transmit_pack

rfm_rx_ev

rfm_tx_ev

rfm_rx_comp

rfm_tx_comp

rx_byte_ready

tx_byte_ready

tx_byte

packet_done_neg

packet_done_pos post_encode

post_decode

receive_pack

rfm_clock

rfm_rx_comp

rfm_tx_comp

Page 15: Verification and Power Analysis of TinyOS with Hybrid Automata Sinem Coleri Mustafa Ergen EECS csinem@eecs.berkeley.edu ergen@eecs.berkeley.edu

EE291E Hybrid Systems – T. John Koo and Shankar Sastry 15

Packet Generation and Application Automata

rt<=cbit_timept<=cidle drt=1

rt<=cbit_timept<=cgeneration drt=1

rt>=cbit_time/rt’=0, pt’=pt+1,sync rfm_clock

rt>=cbit_time/rt’=0, pt’=pt+1,sync rfm_clock

pt>=cidle/rt’=0, bit’=1,pt’=0,sync rfm_clock

pt>=cgeneration/rt’=0, bit’=0,pt’=0,sync rfm_clock

Packet_generation Application

rt=0,pt=0at=0

idle

generate

at<=cbetween dat=1

at>=cbetween/at’=0, sync transmit_pack

sync receive_pack/sync trans_packet

Page 16: Verification and Power Analysis of TinyOS with Hybrid Automata Sinem Coleri Mustafa Ergen EECS csinem@eecs.berkeley.edu ergen@eecs.berkeley.edu

EE291E Hybrid Systems – T. John Koo and Shankar Sastry 16

RFM AutomataRFM

drfmt=0

sync rfm_clock/rfmt’=0,energy’=energy+crec

rfmt<=crec_handler drfmt=1

rfmt>=crec_handler/sync rfm_rx_ev

drfmt=0

sync rfm_rx_comp/

drfmt=0

sync rfm_clock/rfmt’=0,energy’=energy+ctrans

rfmt<=ctrans_handler drfmt=1

rfmt>=crec_handler/sync rfm_tx_ev

drfmt=0

syncrfm_tx_comp/

sync rfm_tx_comp/

sync rfm_rx_comp/

receive

rec_energy rec_wait

transmit

trans_waittrans_energy

Page 17: Verification and Power Analysis of TinyOS with Hybrid Automata Sinem Coleri Mustafa Ergen EECS csinem@eecs.berkeley.edu ergen@eecs.berkeley.edu

EE291E Hybrid Systems – T. John Koo and Shankar Sastry 17

Task Handler AutomataTask Handler

dht=0dct=0denergy=cinactive

sync encode/ht’=cencode,ct’=0

sync decode/ht’=cdecode,ct’=0

ct<=ctask_post dht=0 dct=1 denergy=cactive

ct>=ctask_post/sync post_task_done

dht=0 dct=0denergy=cactive

sync rfm_rx_comp |sync rfm_tx_comp /

ht>=0dht=-1dct=0denergy=cactive

ht<=0/

sync rfm_clock/

sync rfm_clock/

sync rfm_rx_comp |sync rfm_tx_comp /

dht=0dct=0denergy=cactive

sync encode/ht’=ht+cencode,ct’=0

sync decode/ht’=ht+cdecode,ct’=0

idleop

op_waitop_exec

exec

Page 18: Verification and Power Analysis of TinyOS with Hybrid Automata Sinem Coleri Mustafa Ergen EECS csinem@eecs.berkeley.edu ergen@eecs.berkeley.edu

EE291E Hybrid Systems – T. John Koo and Shankar Sastry 18

Verification of TinyOS with Hytech: Motivation

RFM Bit Level

Byte Level

Packet Level

idle packet level

byte levelreceiving

idle

Application

transmitting

Application assumes that packet is sent successfully

receiving

Page 19: Verification and Power Analysis of TinyOS with Hybrid Automata Sinem Coleri Mustafa Ergen EECS csinem@eecs.berkeley.edu ergen@eecs.berkeley.edu

EE291E Hybrid Systems – T. John Koo and Shankar Sastry 19

Verification of TinyOS with Hytech

Analysis commands for verification:init_reg := …..;

final_reg := loc[rpacket]=transmit & loc[rbyte]=receive;

reached := reach forward from init_reg endreach;

if empty(reached & final_reg)

then prints “working fine”

else print trace to final_reg using reached;

endif;

Page 20: Verification and Power Analysis of TinyOS with Hybrid Automata Sinem Coleri Mustafa Ergen EECS csinem@eecs.berkeley.edu ergen@eecs.berkeley.edu

EE291E Hybrid Systems – T. John Koo and Shankar Sastry 20

Power Analysis of TinyOS with Hytech

Power analysis through variable energy by using trace generation feature of Hytech by setting

final_reg = t>300000; by checking variable energy at the end

Page 21: Verification and Power Analysis of TinyOS with Hybrid Automata Sinem Coleri Mustafa Ergen EECS csinem@eecs.berkeley.edu ergen@eecs.berkeley.edu

EE291E Hybrid Systems – T. John Koo and Shankar Sastry 21

Power Analysis of TinyOS with Hytech

As the number of children increases, time to wait before

transmitting increases due to backoff

number of packets to be forwarded increases

BS

Page 22: Verification and Power Analysis of TinyOS with Hybrid Automata Sinem Coleri Mustafa Ergen EECS csinem@eecs.berkeley.edu ergen@eecs.berkeley.edu

EE291E Hybrid Systems – T. John Koo and Shankar Sastry 22

Power Consumption vs. # of Children

Page 23: Verification and Power Analysis of TinyOS with Hybrid Automata Sinem Coleri Mustafa Ergen EECS csinem@eecs.berkeley.edu ergen@eecs.berkeley.edu

EE291E Hybrid Systems – T. John Koo and Shankar Sastry 23

SHIFT

Describes dynamic networks of hybrid automata Components created, interconnected, destroyed as the system

evolves Components interact through their inputs, outputs and exported

events

Page 24: Verification and Power Analysis of TinyOS with Hybrid Automata Sinem Coleri Mustafa Ergen EECS csinem@eecs.berkeley.edu ergen@eecs.berkeley.edu

EE291E Hybrid Systems – T. John Koo and Shankar Sastry 24

Clustering of the Network

Uniform Distribution

100 node 100m x 100m 4 Macro Clusters Children

determined according to position distribution

Page 25: Verification and Power Analysis of TinyOS with Hybrid Automata Sinem Coleri Mustafa Ergen EECS csinem@eecs.berkeley.edu ergen@eecs.berkeley.edu

EE291E Hybrid Systems – T. John Koo and Shankar Sastry 25

Modeling of a sensor network

4 Types of Node Automata. Create an instance for each node. Destroy the instance when the node dies. Distribute the load to its group. Notify upper group when there is a death.

Page 26: Verification and Power Analysis of TinyOS with Hybrid Automata Sinem Coleri Mustafa Ergen EECS csinem@eecs.berkeley.edu ergen@eecs.berkeley.edu

EE291E Hybrid Systems – T. John Koo and Shankar Sastry 26

Model of a node

X – EnergyF – from the HyTech result.

Page 27: Verification and Power Analysis of TinyOS with Hybrid Automata Sinem Coleri Mustafa Ergen EECS csinem@eecs.berkeley.edu ergen@eecs.berkeley.edu

EE291E Hybrid Systems – T. John Koo and Shankar Sastry 27

Result

Need powerful nodes in group 1.

Group 1 suffers from high load and backoff time.

Group 4 dies at the same time.

Page 28: Verification and Power Analysis of TinyOS with Hybrid Automata Sinem Coleri Mustafa Ergen EECS csinem@eecs.berkeley.edu ergen@eecs.berkeley.edu

EE291E Hybrid Systems – T. John Koo and Shankar Sastry 28

Conclusion

Sensor nodes are aimed to be left without maintenance.

Power is a detrimental concern in sensor world. Verification is needed for reliability.

Power analysis is needed for the lifetime of the node. Network power analysis is needed for the lifetime of the

network.

Verification and Power analysis with HyTech . Network power analysis with SHIFT.