Post on 12-Jan-2016
description
Modular Specification of Hybrid Systems in
CHARON
R. Alur, R. Grosu, Y. Hur, V. Kumar, I. Lee
University of Pennsylvania SDRL and GRASP
Software Framework for the Deployment of Multiple
Robots
1. High-level modeling language
- platform independent– hierarchical and modular– specify modes and constraints – hierarchical and sequential composition of
modes – parallel composition of agents
Software Framework for the Deployment of Multiple
Robots
2. Tools for design, programming, and analysis
– simulation and execution – analysis and optimization– automated generation of code
3. Demonstrate on multiple coordinating robots
Challenges in Coordinating Multiple Robots
• Large number of modes– Individual modes are well understood, but not their interaction.
• Software design – modes are designed bottom up.
– coordination protocols are traditionally designed top down.
Charon Framework Architecture CHARON Code
(High level language)
Java Code
Charon to Java TranslatorCharon to Java Translator
Control Code GeneratorControl Code Generator
Java Libraries
Human InterfaceHuman InterfaceAnalysis
Simulator Code GeneratorSimulator Code Generator
Drivers
Charon Language
• Individual components described as agents– Composition, Instantiation, and Hiding
• Individual behaviors described as modes– Encapsulation, Instantiation, and Scoping
• Support for concurrency– Shared variables as well as message passing
• Support for discrete and continuous behavior
• Well-defined formal semantics
Robot Team Approaching a Target
T
Architectural Hierarchy
Robots
Monitor
pos1 pos2
write diff analog position pos1, pos2
class position { float x; float y;}
Variables Specifiers
Range: discrete/analog
Computation: diff/alg
Access: read/write/local
Architectural Hierarchy
Robot1
Robots
Robot2
pos1 pos2
r1Est1
r1Est2
r2Est1
r2Est2
Robots
Monitor
pos1 pos2
Behavioral Hierarchy
pos
r2Est1
r2Est2
r1Est1
r1Est2
Robot1
dTimer
timer = 1.
local diff analog timer
awTargetdPlaniAway
atTargetdStopiAt
arrive
pos = target
movingdSteeraOmegaiFreq
sensingdStopiConst
sense
move
arrive
timer/updateFreq = 0
omega = k * (theta – phi)
pos.x = v * cos(phi)
pos.y = v * sin(phi)
.
.
Related WorkHybrid automata [ACH+95]• Analysis, model checkers HyTech [AHH96, HHW95]
• No compositional models, no hierarchy
I/O automata [LSVW96] and Hybrid Modules [AH97]• Compositional models
• No behavioral hierarchy
SHIFT [DGS97] and HyCharts [GSB98]• Allow hierarchic specification of hybrid behavior
• No concern for modular simulation
UML [BJR97]and (hybrid) Statecharts [Har87]• Hierarchical but not modular
Stateflow• Hierchic specification but only for dynamic behavior
Charon is a modeling language for hybrid systems reflecting the current state of the art both in formal and object oriented methods (UML)
Modular Simulation
• Goal– Simulation is efficient and accurate – Integration of modes at different time scales – Integration of agents at different time scales
• Modes are simulated using local information – Submodes are regarded as black-boxes– Submodes are simulated independently of other
ones
• Agents are simulated using local information– Agents are regarded as black-boxes – Agents are simulated independently of other ones
The Simulator
time
Agents
A1 A2 A3
1. Pick up the agents with minimum
and second minimum reached time.
t
2. Compute the time round interval for the minimum agent, such that its absolute time may exceed with at most dt the time reached by the second one
t+dt
3. The agent executes a time round. This ends before if the invariants of the agent were violated. Then, an actual time increment would be .
4. The agent executes an update round to synchronize the discrete variables with the analog ones.
5. The state of the agent get visible to other agents
Time Round of a Mode (Agent)
x.
y.
z.
2. While (time t = 0; t <= do:
3. Return s and
- Increment t = t+.
1. Get integration time and invariants
from the supermode (or the scheduler).
, xInv
- Predict integration step dt based on and the invariants.
dt,
- Execute time round of the active submode and get state s and time elapsed ., sz
- Simplify all invariants. yInv
- Return s and t+ if invariants were violated.
t,
- Integrate for time and get new state s.
sy
atTargetarrive
sense move
moving
sensing
awTarget
• Innermost transitionshave higher priority
• Default transitions aretaken if all other transitions are disabled
• Group transitions startat the default exit points
• Transitions to historyare transitions to thedefault entry point
Update Round of a Mode (Agent)
Hyst
Env
u
Hysteresis Example
incdX1
decdX1
dec
inc
strMinusdY
iStrMaStrM
s2u
u2p
updYiUpaUp
strPlusdY
iStrPaStrP
x1 = u.
y = 2ux1 < ax2 = -1
.
a
a+2-a
-(a+2)-1
1
050001000015000200002500030000350004000045000
0.0005 0.001 0.0015 0.002
Integration Step
# o
f in
teg
rati
on
s
ModularGlobal
Global vs Modular Simulation
0
0.005
0.01
0.015
0.02
0.025
0.03
0.035
0 0.001 0.002 0.003 0.004 0.005
Sampling Rate
Max
imu
m E
rro
rModular Simulation Error
• Work to date– CHARON semantics– Parser for CHARON– Internal representation
• Current work– Type checker– Modular simulation
scheme– Internal representation
generator
Current Implementation Status
CHARON ParserCHARON Parser
Simulator Generator
Simulator Generator
Control Code Generator
Control Code Generator Model CheckerModel Checker
Syntax Tree
Internal Representation GeneratorInternal Representation Generator
Type Checker
Type Checker
Internal Representation
CHARON Specification
Ongoing Research
• Distributed simulation
• Accurate event detection
• And modes and And/Or hierarchies
• Exploiting the hierarchy in model checking
Wrap-Up
• Charon is a language for embedded systemsreflecting the current state of the art bothin formal and object oriented methods (UML)
• Its explicit support for a mixed visual/textual notation should improve communication among the various communities involved in an embedded system project.