90 likes | 203 Views
Modeling Event-Based Systems in Ptolemy II EE249: Design of Embedded Systems: Models, Validation, and Synthesis. Elaine Cheong Yang Zhao December 8, 2001. Outline. Project Goals TinyOS Architecture Demo 1 Demo 2 Conclusions. Our Goals. Problem:
E N D
Modeling Event-Based Systems in Ptolemy IIEE249: Design of Embedded Systems: Models, Validation, and Synthesis Elaine Cheong Yang Zhao December 8, 2001
Outline • Project Goals • TinyOS Architecture • Demo 1 • Demo 2 • Conclusions
Our Goals • Problem: • TinyOS applications can be difficult to program and debug. • Our Project: • Understand TinyOS architecture. • Model TinyOS in Ptolemy II. • Investigate different models of computation.
send_msg (addr, type, data) msg_send_done (success) msg_rec (type, data) power(mode) init Messaging Component Internal State send_msg_thread init Power (mode) TX_packet (buf) RX_packet_done (buffer) TX_packet_done (success) Commands Events TinyOS Architecture • Component • Frame • Command handlers • Event handlers • Tasks
Sample TinyOS Application Component B Internal State event2 Component A Internal State Task 1 event1 Component C Clock Internal State Internal State LEDs HW clock
Sample TinyOS Code // Component A char TOS_EVENT (Event_1) () { TOS_POST_TASK (Task_1); TOS_SIGNAL_EVENT (Event_2); return 1; } TOS_TASK () { delay (2s); } // Component B char TOS_EVENT (Event_2) () { TOS_CALL_COMMAND (LEDS_on)(); return 1; } // Component C char TOS_COMMAND (LEDS_on)() { VAR(LEDS_on) = 1; return 1; }
Demo 1: DE/FSM • Discrete Event (DE) domain • New actor: PreemptableTask • Inputs: Input, Interrupt • Output: Output • Finite State Machine (FSM) domain • Models component logic
Demo 2: TM/FSM • Timed Multitasking (TM) domain • Formerly known as RTOS • Priority-driven multitasking • Prioritized event queue • Preemption • Finite State Machine (FSM) domain • Models component logic
Conclusions • DE/FSM • TM/FSM • Future Work