system design research lab university of pennylvania 1/29/2002 charon modeling language

Post on 04-Jan-2016

213 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

1/29/2002

System Design Research LabUniversity of Pennylvania

CHARON modeling language

1/29/2002

System Design Research LabUniversity of Pennylvania

Outline

• Overview of language features• Example• Charon toolset• Toolset demo• Obtaining and running the toolset

1/29/2002

System Design Research LabUniversity of Pennylvania

Language features: hierarchy

• Architectural hierarchy– Autonomous agents can contain

subagents– Agents execute concurrently and

asynchronously– Communication via shared variables

• Behavioral hierarchy– Each agent is described as a state

machine• modes and transitions

– Modes can contain submodes

1/29/2002

System Design Research LabUniversity of Pennylvania

Language features: modularity

• Encapsulation– Local (private) variables restrict

communication and hide details of behavior

• Instantiation– An agent or mode defined in the model

can be instantiated multiple times– Agents and modes can have parameters

that are given values at instantiation

1/29/2002

System Design Research LabUniversity of Pennylvania

Agents: architecture and data flow

• Agents are autonomous concurrent components in the model

• An agent consists of variable definitions and may contain sub-agents

• Agent interfaces are global variables

Tank Holeleakleak

private analog real leak

levellevel

inflowinflow

LTank

Pump level

flow

flow

1/29/2002

System Design Research LabUniversity of Pennylvania

Agents: definition and instantiation// the tank agent with a hidden leakagent LTank() { private analog real leak; agent tank = Tank(); agent hole = Hole();}

// a leaky tank controlled by a pumpagent LeakyTank() { private analog real level, flow; agent tank = LTank( ) [ inflow := flow ] agent pump = Pump( 5, 10 )}

definition

instantiation

parameterizedinstantiation

1/29/2002

System Design Research LabUniversity of Pennylvania

Primitive agents

• A primitive agent does not have concurrent structure– single thread of control

• Behavior is given by a mode

agent Tank() { write analog real level; init { level = 6; } mode top = TankMode( );}

1/29/2002

System Design Research LabUniversity of Pennylvania

Modes: behavior

• A mode is a hierarchical hybrid state machine

• A primitive mode is a single-state machine• Behavior is given by constraints

mode TankMode() { read analog real inflow; read analog real leak; write analog real level;

diff { d(level) == inflow-leak } inv { 0 <= level and level <= 15 }}

inflow

leak

1/29/2002

System Design Research LabUniversity of Pennylvania

Modes: behavior + discrete control

• Composite modes have multiple submodes and discrete transitions between them

PumpMode private analog real clock

diff { d(clock) == 1 }

start

return

Compute

Maintain

on turnOff

offadjust

inv { clock <= 1 }

clock >= 1

{clock = 0}

1/29/2002

System Design Research LabUniversity of Pennylvania

Modes: behavior + discrete control

• Modes have variable declarations, same as agents

PumpMode private analog real clock

diff { d(clock) == 1 }

start

return

Compute

Maintain

on turnOff

offadjust

inv { clock <= 1 }

clock >= 1

{clock = 0}

1/29/2002

System Design Research LabUniversity of Pennylvania

Modes: behavior + discrete control

• Modes can have constraints at any level

PumpMode private analog real clock

diff { d(clock) == 1 }

start

return

Compute

Maintain

on turnOff

offadjust

inv { clock <= 1 }

clock >= 1

{clock = 0}

1/29/2002

System Design Research LabUniversity of Pennylvania

Modes: behavior + discrete control

• Transitions are instantaneous• Transitions have guards and actions

PumpMode private analog real clock

diff { d(clock) == 1 }

start

return

Compute

Maintain

on turnOff

offadjust

inv { clock <= 1 }

clock >= 1

{clock = 0}

1/29/2002

System Design Research LabUniversity of Pennylvania

Modes: behavior + discrete control

• Transition can happen when its guard is true

• Transition must happen when invariant is falsePumpMode private analog real clock

diff { d(clock) == 1 }

start

return

Compute

Maintain

on turnOff

offadjust

inv { clock <= 1 }

clock >= 1

{clock = 0}

1/29/2002

System Design Research LabUniversity of Pennylvania

Control points

• Mode interface: entry and exit points– Control enters mode via entry points and exits

via exit points

• Different paths through a mode correspond to different qualitative behaviors

slow

fast

set=25

set=65

alge { speed == set }crash

stop

1/29/2002

System Design Research LabUniversity of Pennylvania

Named vs. default control points

• Default control points allow:– preemption– history

start

return

Compute

Maintain

on turnOff

offadjust

inv { clock <= 1 }

clock >= 1

{clock = 0}

1/29/2002

System Design Research LabUniversity of Pennylvania

PumpMode textmode PumpMode( int low, int high ) { private analog real clock; private discrete real rate; write analog real flow; read analog real level;

mode m = Maintain( 0.1, low, high ); mode c = Compute();

trans from default to m when true do { clock = 0; rate = 0 }

trans from m to c.start when clock > 1 do { clock = 0; } trans from c.return to m when true do { }

diff { d(clock) == 1 }}

1/29/2002

System Design Research LabUniversity of Pennylvania

Computational modes

• Do not have continuous behavior• Instantaneous execution• Internal structure defines control flow

delta = level-past

return

rate = 0

start

delta > 0

rate = -delta

delta <= 0Compute

past = level

1/29/2002

System Design Research LabUniversity of Pennylvania

Charon toolset: visual editor

1/29/2002

System Design Research LabUniversity of Pennylvania

Charon toolset: visual editor

1/29/2002

System Design Research LabUniversity of Pennylvania

Charon toolset: control panel

1/29/2002

System Design Research LabUniversity of Pennylvania

Charon toolset: simulation

1/29/2002

System Design Research LabUniversity of Pennylvania

Charon toolset: simulation

1/29/2002

System Design Research LabUniversity of Pennylvania

DEMO

1/29/2002

System Design Research LabUniversity of Pennylvania

How to obtain and use Charon

• Download Charon from:http://www.cis.upenn.edu/mobies/charon/implementation.html

– both the toolkit and the visual editor are available as compressed archives

– see installation instructions on the web page

• Running:– Charon toolkit: run-charon.sh (Solaris/Linux) or

run-charon.bat (Win) in the directory CharonCP

– Visual editor: run.sh (Solaris/Linux) or run.bat (Win) in the directory CharonVisual

top related