Giotto and TMO Yerang Hur System Design Research Lab.

advertisement
Giotto and TMO
Yerang Hur
System Design Research Lab.
Dept. of Computer and Information
Science
Outline
 Giotto



overview
programming language
code generation
 TMO



overview
programming scheme
TMOSM (TMO Support Middleware)
Overview: Embedded Control
System Development
Control Engineer
decomposes
designs
simulates
Matlab!
Application
Control Design
Functionality & Timing
Software Engineer
Giotto!
decomposes
implements
tests
Giotto Program
Distributed Platform
Henzinger, Horowitz, and Kirsch, 2001
Automatic Compilation
Software Engineer
Giotto Program
Platform Annotation
Giotto Compiler
Giotto-P Program
Giotto-PS Program
Schedule Annotation
Communication Annotation
Giotto-PSC Program
Giotto Executable
Language Primitives
 Port

a physical location connected to a sensor, an
actuator, an input of a control law
 Task

a periodic task which consists of ports and a
sequential piece of code with WCET (WorstCase Execution Time)
 Connection

association an input port with an output port
 Mode

a set of tasks and mode switches
Giotto Tasks
P
Q
t
0
5
10
15
20
25
A Giotto task reads the values in its input port in invocation
and writes its results to its output ports at the end of its period
Giotto Tasks
P
Q
t
0
5
10
15
20
25
A Giotto task must finish within the task’s period.
The compiler uses a suitable scheduling mechanism
which guarantees the deadlines.
Even if P finishes its computation before the time 15
its results are buffered in P.
Giotto Mode
 A set of concurrent Giotto tasks and mode
switch predicate
 Mode switch


gets evaluated periodically.
may occur in a middle of a round.
• Example: exitfreq 2 if (sensor1 && not(sensor2))
then Stop1();
• switch predicate is evaluated every (LCM of periods
of tasks/exitfreq).
Example: robot system
Someone else’s
sensor pushed
Stop
Lead
My evasion
finished
My sensor
pushed
Someone else’s
sensor pushed
Follow
Evade
My sensor pushed
Someone else’s
evasion finished
Port Declaration
const int STOP = 0;
//command
int com = STOP;
//mode finished
bool fin = TRUE;
//TRUE means pushed
bool sensor1; // robot 1 touch sensor
bool sensor2; // robot 2 touch sensor
int motorL1 = STOP; // robot 1 left motor
int motorR1 = STOP; // robot 1 right motor
int motorL2 = STOP; // robot 2 left motor
int motorR2 = STOP; // robot 2 right motor
Giotto Program : mode Lead1Follow
command1
motorCtr1
motorCtr2
t (ms)
0
100
200
300
400
500
mode Lead1Follow() period 400ms entryfreq 1{
taskfreq 1 do int com = command1();
taskfreq 4 do (int motorL1, int motorR1) = motorCtr1(com);
taskfreq 4 do (int motorL2, int motorR2) = motorCtr2(com);
exitfreq 2 if (sensor1 && not(sensor2)) then Stop1();
exitfreq 2 if (sensor2 && not(sensor1)) then Stop2();
}
Giotto Program: mode Stop1
command1
motorCtr1
motorCtr2
t (ms)
0
100
200
300
400
500
mode Stop1() period 400ms entryfreq 2 {
taskfreq 1 do int com = command1();
taskfreq 2 do (int motorL1, int motorR1) = motorCtr1(STOP);
taskfreq 2 do (int motorL2, int motorR2) = motorCtr2(STOP);
exitfreq 1 if (TRUE) then Evade1Stop();
}
Giotto Program: mode Evade1Stop
evade1
motorCtr1
t (ms)
0
100
200
300
400
500
mode Evade1Stop() period 400ms entryfreq 1{
taskfreq 1 do (int com, bool fin) = evade1();
taskfreq 4 do (int motorL1, motorR1) = motorCr1(com);
exitfreq 1 if (fin) then Lead1Follow();
}
Period and Unit
Task P
Task Q
t
0
5
10
15
20
25
Period of mode: period of the least frequent task in a mode
Unit of mode : period of mode/ mode switch frequency
Example: mode S with task P, task Q, and mode switch frequency 4
period of S: 20 , unit of S:5
Mode Switch Example
command1
evade1
motorCtr1
motorCtr2
0
100
200
Mode switch
300
400
500
600
t (ms)
Mode switch
from Lead1Follow to Stop1 from Stop1 to Evade1Stop
Code Generation
 Users provide platform-related description
called annotation.
 Annotation



P annotation (Platform): specifies names, IP
addresses, and priorities for each host.
S annotation (Schedule): specifies task-to-host
mappings and the priorities of the tasks.
C annotation (Communication): specifies portto-network mappings and the time slots of the
ports.
Example: P annotation (Platform)
Two hosts bot1 and bot2 are connected
by a network net12.
[ host bot1 address 192.168.0.1 priorities p0 > p1;
host bot2 address 192.168.0.2 priorities q0 > q1;
net n12 address 192.168.0.0 connects bot1, bot2; ]
Example: S annotation (Schedule)
Task command1 is mapped to host bot1 with priority p1.
Task motorCtr1 is mapped to host bot1 with priority p0.
Task motorCtr2 is mapped to host bot2 with priority q0.
mode Lead1Follow() period 400ms entryfreq 1{
taskfreq 1 do int com = command1(); [host bot1 priority p1]
taskfreq 4 do (int motorL1, int motorR1) =
motorCtr1(com); [host bot1 priority p0]
taskfreq 4 do (int motorL2, int motorR2) =
motorCtr2(com); [host bot2 prioty q0]
...
}
Example: C annotation (Communication)
SensorX ports are exchanged between the robots twice per round,
because he mode switch predicate is evaluated every 200ms.
Signals from sensor1 is delivered from bot1 to bot2.
Signals from sensor2 is delivered from bot2 to bot1.
mode Lead1Follow() period 400ms entryfreq 1{
...
[net n12 slots s0 (0,20), s1 (20,40), s2 (200,220), s3 (220,240),
s4 (340, 360);
push sensor1 from bot1 to bot2 in net n12 slots s0, s2;
push sensor2 from bot2 to bot1 in net n12 slots s1, s3;
push com from bot1 to bot2 in net n12 slots s4;]
}
Putting It Together:
Lead1Follow Mode with Annotation Details
sensor1
sensor2
com
command1
motorCtr1
motorCtr2
0
100
200
300
400
500
Summary: Giotto
 Giotto is a design methodology for
embedded control systems.
 The programmer specifies the platformindependent programmer’s model in the
time-triggered programming language.
 The Giotto compiler produces executables
combined with run-time library for a
particular platform.
TMO (Time-triggered Messagetriggered Objects)
 Overview
 Programming Scheme
 TMOSM (TMO Support Middleware)
Overview: Real-Time Extension
of Conventional Objects
 Spontaneous Method (SpM): SpM executions are
triggered when the clock reaches specific values
determined at design time.
 Service Method (SvM): SvM executions are
triggered by service request messages.
 Basic Concurrency Constraint (BCC): SpM
executions have the higher priority over SvM
executions.
 Deadline: A deadline is associated with an output
action and completion of a method.
Time-triggered Spontaneous
Methods (SpM’s)
Example of AAC
(Autonomous Activation Control)
AAC
SpM 1
AAC
SpM 2
Reservation Q
for t = from 10am to 10:50 am
every 30 min
start-during (t, t+5 min)
finish-by t+10 min
{start-during (10am, 10:05am)
finish-by 10:10 am,
start-during (10:30am, 10:35am)
finish-by 10:40 am}
Programming Schme
Object Data Store
(ODS)
AAC
AAC
SpM 1
SpM 2
Reservation Q
Capabilities for
accessing other TMOs,
channels,
and I/O devices
Time-triggered
spontaneous
messages
Service request Q
SvM 1
SvM 2
Message-triggered
service methods
Example: CAMIN (Coordinated
Anti-Missile Interceptor Network)
Theater TMO
Alien TMO
Example: CAMIN Theater
Step 0: high-level specification Step 1: high-level design of
of the initial application
application environment such as
environment
incorporation of sensors, actuators,
and control strategy
ODS
Theater Space = sky + land + sea
Defense target in land = command post
Defense target in sea = command ship
(0-n) v’s
Radar in land
Interceptor launcher in land
Fighter airplanes
Example (continued)
SpM
Update the state of the defense target in land
Update the state of defense target in sea
Update the state of the radar in land
Update the state of the interceptor launcher in land
Update the state of the fighter airplanes
SvM
Accept v’s (invoked by Alien TMO)
TMOSM (TMO Support
Middleware)
 A middleware architecture for TMO
execution
 Windows NT implementation
 User-friendly C++ API called TMOSL
 UDP-based communication
 CORBA is also supported
TMOSM
 Timer interrupts activate middleware thread WTST
(Watchdog Timer and Scheduler Thread).
 WTST: manages and scheduling and activation all other
threads in TMOSM.
 Allocates a time slice for every thread.
 Checks for deadline violation of threads associated
with each TMO’s methods.
 LIIT (Local I/O Interface Thread): a periodic middleware
thread processing I/O functions.
 ICT (Incoming Communication Thread): a periodic
middleware thread managing the distribution of messages
coming through the communication network.
TMOSM
TMO
TMO
TMOSM
SvM thread
ICT
SpM thread
LIIT
WTST
timer interrupt
Windows NT
Communication Networks
TMOSM Scheduling Cycle
ICT
VMST
LIIT ICT
VMST
LIIT
- VMST (Virtual Machine System Thread): time-slices not
allocated to middleware threads are called a VMST time-slice.
- A VMST time-slice is distributed to application threads associated
with TMOs
SpM Activation
 WTST periodically examines the registered
SpM’s and put it to SpM reservationQ.
 WTST moves a SpM to readyQ when the
time for its execution arrives.
 The application scheduler selects a thread
from readyQ according to the scheduling
policy during a time-slice for VMST.
SvM Execution
 When receiving a service request message,
ICT places an identified SvM thread to SvM
waitingQ.
 WTST checks for a possible conflict with
SpM execution and moves it to readyQ.
 The application scheduler selects a thread
from readyQ according to the scheduling
policy during a time-slice for VMST.
Other Works Related TMO
 DREAM (Distributed Real-time Ever
Available Microcomputing) kernel:

operating system kernel supporting real-time
processes
 TMOSL (TMO Support Library)


Collection of C++ classes
Interface between TMOSM and applications
 CORBA-compliant TMO
Summary: TMO
 TMO is a programming scheme based on
both time-triggered and message-triggered
executions.
 TMO applications are distributed real-time
systems.
Download