System-level Modeling for Wireless Sensor Networks Jan Madsen Kashif Virk, Knud Hansen Informatics and Mathematical Modelling Technical University of Denmark Richard Petersens Plads, Building 321 DK2800 Lyngby, Denmark jan@imm.dtu.dk Funded by Hogthrob (STVF 2059-03-0027 )
Sensor networks? The Hogthrob project � Developing a sensor network infrastructure for sow monitoring � Functionalities � Tracking The real HOGTHROB � Detecting heat period � … � Low Cost (~1 €) � Low Energy (2 years lifetime) � Consortium: � DTU, DIKU, KVL � National Committee for Pig Production � IO Technologies www.hogthrob.dk MPSoC 2004 2
Sensor networks S P C S P C idle S P C S P C S P C receiving S P C sending MPSoC 2004 3
Sensor networks S P C S P C idle S P C S P C S P C sending S P C receiving MPSoC 2004 4
Sensor node S P C rtos cpu sensor radio battery sensing communicating processing MPSoC 2004 5
Sensor node � Ultra low energy � Low flexibility � Ultra low cost (1€) � Small size (1..10 Mtr) rtos � Low clock frequency cpu sensor radio � CPU/DSP and RF dominated � Limited memory battery � Hardware/software codesign MPSoC 2004 6
Sensor node design sensor sensor radio rtos rtos asic cpu cpu sensor radio battery sensing processing communicating MPSoC 2004 7
Sensor node: Uni-processor ... Framework to experiment with different RTOS strategies Focus on analysis of timing , energy and resource sharing rtos a Abstract software model, i.e. no behavior/functionality Easy to create tasks and implement RTOS models Based on SystemC MPSoC 2004 8
System model rtos a MPSoC 2004 9
System model rtos MPSoC 2004 10
System model rtos MPSoC 2004 11
System model � Task messages: � ready � finished � RTOS commands: � run � preemept � Resume rtos MPSoC 2004 12
System model - SystemC pa = new task("task_a",1,50,3,12,0,ready); registerTask(pa); pb = new task("task_b",2,40,2,10,0,ready); registerTask(pb); pc = new task("task_c",3,30,1,10,0,ready); registerTask(pc); rtos identifier offset period WCET priority MPSoC 2004 13
Link model clock � Aim: Adding tasks without having to create seperate communication links � Uses the SystemC master- slave library � If two tasks send a message at the same time – they are executed in sequence, but in rtos undefined order � Global ”clock” is used to keep track of time MPSoC 2004 14
Task model 1 r 1 s 1 e 1 d 1 T 1 o 1 r 1 = time at which task becomes released (or active) s 1 = time at which task starts its execution e 1 = worst case execution time (WCET) d 1 = deadline , task should complete before this! T 1 = period , minimum time between task releases o 1 = offset (or phase) for first release MPSoC 2004 15
Task model MPSoC 2004 16
Sensor network model MPSoC 2004 17
Sensor node model MPSoC 2004 18
Energy modeling MPSoC 2004 19
Communication example Send node τ 1 Receive node Wireless s τ 2 r τ 3 Network τ 4 τ 5 synch. synch. allocator allocator scheduler scheduler MPSoC 2004 20
Modeling radio communication Modeling the CSMA protocol Sender: idle idle send Protocol cs bo bo cs cs Txp Txp Txp Txd Txd Txd Txd Txd carrier sense preamble data CPU Transeiver radio request transmission preparation data ready tramitting bit reading radio MPSoC 2004 21
CSMA Protocol for sending bo_counter>0 cs_counter>0 !send bo_counter==0 send back carrier idle off sense !channel clear channel clear & cs_counter==0 pr_counter>0 Tx pre- data_counter==0 amble pr_counter==0 Tx data data_counter>0 MPSoC 2004 22
Modeling radio communication Sender: Protocol cs bo bo cs cs Txp Txp Txp Txd Txd Txd Txd Txd carrier sense preamble data CPU Transiver Receiver: Protocol poll idle poll idle poll syn syn Rxd Rxd Rxd Rxd Rxd poll channel synchronize data CPU Transiver MPSoC 2004 23
Sensor network example MPSoC 2004 24
Example 1: Simple broadcast Sending task Receiving task Application task 0 = idle 0 = idle 0 = idle 1 = carrier sensing 1 = polling 1 = ready 2 = back-off 2 = synchronize 2 = running 3 = transmit preamble 3 = receive data 3 = preempted 4 = transmit data 4 = self-preempted 0us 100us 200us 300us 400us 500us 600us 700us 800us 900us Node1_Processing_Task 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 Node1_Receive_Protocol 1 0 1 0 1 0 1 0 1 0 1 0 1 0 Node1_Receive_Task 0 0 0 0 0 0 0 0 Node1_Send_Protocol 2 1 3 4 0 Node1_Send_Task 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 0 Node2_Receive_Protocol 1 0 1 0 1 0 1 0 1 2 3 0 1 0 1 0 1 0 1 0 1 0 1 0 Node2_Receive_Task 0 0 0 0 0 4 4 4 4 4 0 0 0 0 0 0 0 Node3_Receive_Protocol 1 0 1 0 1 0 1 0 1 2 3 0 1 0 1 0 1 0 1 0 1 0 1 0 Node3_Receive_Task 0 0 0 0 0 4 4 4 4 4 0 0 0 0 0 0 0 MPSoC 2004 25
Example 2: Radio interference Sending task Receiving task Application task 0 = idle 0 = idle 0 = idle 1 = carrier sensing 1 = polling 1 = ready 2 = synchronize 2 = running 2 = back-off 3 = transmit preamble 3 = receive data 3 = preempted 4 = transmit data 4 = self-preempted 0us 100us 200us 300us 400us 500us 600us 700us 800us 900us Node1_Receive_Protocol 1 0 1 0 1 0 1 0 1 2 3 0 Node1_Receive_Task 0 0 0 0 0 4 4 4 4 4 4 4 4 0 Node1_Send_Protocol 2 1 3 4 0 Node1_Send_Task 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 0 Node2_Receive_Protocol 1 Node2_Receive_Task 0 Node2_Send_Protocol 2 1 2 1 2 1 3 4 0 Node2_Send_Task 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 0 Node3_Receive_Protocol 1 0 1 0 1 0 1 0 1 2 3 0 1 0 1 0 1 0 1 0 1 2 3 0 Node3_Receive_Task 0 0 0 0 0 4 4 4 4 4 0 0 0 0 0 4 4 4 4 4 0 Node4_Receive_Protocol 1 0 1 0 1 0 1 0 1 2 3 0 1 0 1 0 1 0 1 0 1 2 3 0 Node4_Receive_Task 0 0 0 0 0 4 4 4 4 4 0 0 0 0 0 4 4 4 4 4 0 Node5_Receive_Protocol 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 2 3 0 Node5_Receive_Task 0 0 0 0 0 0 0 0 0 0 0 4 4 4 4 4 4 0 MPSoC 2004 26
Example 3: Network routing MPSoC 2004 27
Example 3: Routing Sending task Receiving task Application task 0 = idle 0 = idle 0 = idle 1 = carrier sensing 1 = polling 1 = ready 2 = back-off 2 = synchronize 2 = running 3 = transmit preamble 3 = receive data 3 = preempted 4 = transmit data 4 = self-preempted MPSoC 2004 28
Example 3: Battery shortage Sending task Receiving task Application task 0 = idle 0 = idle 0 = idle 1 = carrier sensing 1 = polling 1 = ready 2 = back-off 2 = synchronize 2 = running 3 = transmit preamble 3 = receive data 3 = preempted 4 = transmit data 4 = self-preempted Node 2 runs out of battery MPSoC 2004 29
Summary � SystemC based framework to study the dynamic behavior of a sensor network � Exploring global effects of sensor node design � Example sensor network based on Mica-nodes and TinyOS from UC Berkeley � Work in progress � Power/energy models for power management � Mobile sensor nodes � Detailed component models � To be used in the Hogthrob project MPSoC 2004 30
Hogthrob MPSoC 2004 31
Recommend
More recommend