13
1 PtHOMAS project, Ptolemy mini-conference '09 CR/RTC3-NA Elizabeth Latronico; UC Berkeley Jackie Mankit Leung | 4/16/2009 | © 2009 Robert Bosch LLC and affiliates. All rights reserved. Ptolemy Hierarchical Orthogonal Multi- Attribute Solver (PtHOMAS) Ptolemy mini-conference April 16 2009 Jackie Mankit Leung, Thomas Huining Feng (UC Berkeley) Thomas Mandl, Elizabeth Latronico, Charles Shelton (Bosch)

1 PtHOMAS project, Ptolemy mini-conference '09 CR/RTC3-NA Elizabeth Latronico; UC Berkeley Jackie Mankit Leung | 4/16/2009 | © 2009 Robert Bosch LLC and

  • View
    218

  • Download
    1

Embed Size (px)

Citation preview

Page 1: 1 PtHOMAS project, Ptolemy mini-conference '09 CR/RTC3-NA Elizabeth Latronico; UC Berkeley Jackie Mankit Leung | 4/16/2009 | © 2009 Robert Bosch LLC and

1

PtHOMAS project, Ptolemy mini-conference '09

CR/RTC3-NA Elizabeth Latronico; UC Berkeley Jackie Mankit Leung | 4/16/2009 | © 2009 Robert Bosch LLC and affiliates. All rights reserved.

Ptolemy Hierarchical Orthogonal Multi-Attribute Solver (PtHOMAS)

Ptolemy mini-conference April 16 2009Jackie Mankit Leung, Thomas Huining Feng (UC Berkeley)Thomas Mandl, Elizabeth Latronico, Charles Shelton (Bosch)

Page 2: 1 PtHOMAS project, Ptolemy mini-conference '09 CR/RTC3-NA Elizabeth Latronico; UC Berkeley Jackie Mankit Leung | 4/16/2009 | © 2009 Robert Bosch LLC and

2

PtHOMAS project, Ptolemy mini-conference '09

CR/RTC3-NA Elizabeth Latronico; UC Berkeley Jackie Mankit Leung | 4/16/2009 | © 2009 Robert Bosch LLC and affiliates. All rights reserved.

Motivation Cars are networked software systems

Up to 70 Electronic Control Units

Software crucial for many features Electronic stability control Parking assist Emissions control Engine Start/Stop Active and passive safety

How can we manage increasing complexity and interconnectedness?

Analysis approaches promising, but hand-annotation has drawbacks Time intensive to develop and maintain People are inconsistent, make errors Repeat for every composition

Page 3: 1 PtHOMAS project, Ptolemy mini-conference '09 CR/RTC3-NA Elizabeth Latronico; UC Berkeley Jackie Mankit Leung | 4/16/2009 | © 2009 Robert Bosch LLC and

3

PtHOMAS project, Ptolemy mini-conference '09

CR/RTC3-NA Elizabeth Latronico; UC Berkeley Jackie Mankit Leung | 4/16/2009 | © 2009 Robert Bosch LLC and affiliates. All rights reserved.

How can a computer think like a software designer? Constant / Non-constant example

All sources are constant, so Display is constant (here, 21)

If any source is non-constant, Display could be non-constant

How does a person know that?1) How are constant and

non-constant related?

2) What are the rules for each individual actor?

3) What rules govern the connections among actors?

21? ?

Page 4: 1 PtHOMAS project, Ptolemy mini-conference '09 CR/RTC3-NA Elizabeth Latronico; UC Berkeley Jackie Mankit Leung | 4/16/2009 | © 2009 Robert Bosch LLC and

4

The ontology consists of two things: A property lattice, consisting of:

Property (“Concept”) Edge (“Relationship”)

Constraints on property-able objects (actors, expressions, …) Inequality terms Monotonic functions

Implementation Re-use Ptolemy type system constraint solving algorithms New! Graphical interface (for both lattice, inequality constraints) Java class definition for special cases

PtHOMAS project, Ptolemy mini-conference '09

CR/RTC3-NA Elizabeth Latronico; UC Berkeley Jackie Mankit Leung | 4/16/2009 | © 2009 Robert Bosch LLC and affiliates. All rights reserved.

Frame the problem with an ontology

For example:

P(output) >= P(input)

PropertyEdge

Page 5: 1 PtHOMAS project, Ptolemy mini-conference '09 CR/RTC3-NA Elizabeth Latronico; UC Berkeley Jackie Mankit Leung | 4/16/2009 | © 2009 Robert Bosch LLC and

5

PtHOMAS project, Ptolemy mini-conference '09

CR/RTC3-NA Elizabeth Latronico; UC Berkeley Jackie Mankit Leung | 4/16/2009 | © 2009 Robert Bosch LLC and affiliates. All rights reserved.

Property lattice example Complete partial ordering of

our properties

Common bottom element

Common top element

Can promote higher in lattice, but not lower

Type system is a familiar example Integer to Double is OK

3 to 3.0

Double to Integer is not! 3.14 to 3

General

Boolean

Not a Type

Integer

Double

Complex

Scalar

Long

3

3.03.14

3

Simplified Ptolemy type system

Page 6: 1 PtHOMAS project, Ptolemy mini-conference '09 CR/RTC3-NA Elizabeth Latronico; UC Berkeley Jackie Mankit Leung | 4/16/2009 | © 2009 Robert Bosch LLC and

6

PtHOMAS project, Ptolemy mini-conference '09

CR/RTC3-NA Elizabeth Latronico; UC Berkeley Jackie Mankit Leung | 4/16/2009 | © 2009 Robert Bosch LLC and affiliates. All rights reserved.

Constant / Non-constant lattice How are constant and non-constant related?

Define a new lattice: Constant: Value is always the same Non-constant: Value might change

(but, perhaps does not) Correct but conservative

In this case, since there are no branches, Non-constant is the common top element

Can define your own lattice for your properties!

Constant

Non-Constant

Unknown

Page 7: 1 PtHOMAS project, Ptolemy mini-conference '09 CR/RTC3-NA Elizabeth Latronico; UC Berkeley Jackie Mankit Leung | 4/16/2009 | © 2009 Robert Bosch LLC and

7

PtHOMAS project, Ptolemy mini-conference '09

CR/RTC3-NA Elizabeth Latronico; UC Berkeley Jackie Mankit Leung | 4/16/2009 | © 2009 Robert Bosch LLC and affiliates. All rights reserved.

Constraint analysis process Ptolemy has a scalable and efficient solver

algorithm Linear with the number of constraints Static analysis, so no execution required

Accepts a list of pairwise inequalities

Solves for least (what we want) or greatest upper bound

Constraint generation Need rules for each object

in library; sharing possible

Map objects to inequality terms (ports for most actors)

Set of rules for finite state machines and expressions

Constraint lista >= Constant

b >= ac >= a

Solver

Resulta, b, c == Constant

Ruleoutput >= input

Constraint listActor.out >= Actor.in1Actor.out >= Actor.in2

Actor2.out >= Actor2.in1

Page 8: 1 PtHOMAS project, Ptolemy mini-conference '09 CR/RTC3-NA Elizabeth Latronico; UC Berkeley Jackie Mankit Leung | 4/16/2009 | © 2009 Robert Bosch LLC and

8

PtHOMAS project, Ptolemy mini-conference '09

CR/RTC3-NA Elizabeth Latronico; UC Berkeley Jackie Mankit Leung | 4/16/2009 | © 2009 Robert Bosch LLC and affiliates. All rights reserved.

Property constraints for actors in example Const actor:

output >= Constant

Sequence actor: output >= Non-constant

Math actors (AddSubtract, MultiplyDivide, Maximum) output >= input, for all input signals

output >= input1 output >= input2 Extends to multiple

channels for multiport

Page 9: 1 PtHOMAS project, Ptolemy mini-conference '09 CR/RTC3-NA Elizabeth Latronico; UC Berkeley Jackie Mankit Leung | 4/16/2009 | © 2009 Robert Bosch LLC and

9

PtHOMAS project, Ptolemy mini-conference '09

CR/RTC3-NA Elizabeth Latronico; UC Berkeley Jackie Mankit Leung | 4/16/2009 | © 2009 Robert Bosch LLC and affiliates. All rights reserved.

Model-wide property constraints for connections Model-wide constraints are specified in new “solver box” actor

Here, sink >= source for connections Add1.input >= C1.output Add1.input >= C2.output Multiply3.input >= Add1.output

Add1.input

C2.output

C1.output

Add1.output

Multiply3.input

Page 10: 1 PtHOMAS project, Ptolemy mini-conference '09 CR/RTC3-NA Elizabeth Latronico; UC Berkeley Jackie Mankit Leung | 4/16/2009 | © 2009 Robert Bosch LLC and

10

PtHOMAS project, Ptolemy mini-conference '09

CR/RTC3-NA Elizabeth Latronico; UC Berkeley Jackie Mankit Leung | 4/16/2009 | © 2009 Robert Bosch LLC and affiliates. All rights reserved.

Results for the example

Property annotation at every point in large models with minimal user effort

All constant sources One non-constant source

Page 11: 1 PtHOMAS project, Ptolemy mini-conference '09 CR/RTC3-NA Elizabeth Latronico; UC Berkeley Jackie Mankit Leung | 4/16/2009 | © 2009 Robert Bosch LLC and

11

PtHOMAS project, Ptolemy mini-conference '09

CR/RTC3-NA Elizabeth Latronico; UC Berkeley Jackie Mankit Leung | 4/16/2009 | © 2009 Robert Bosch LLC and affiliates. All rights reserved.

Future topics Ontologies

New lattices for a variety of properties and use cases Learn about existing ontologies from different communities What ontology concepts are expressible in a lattice?

Model transformation Use property annotations to guide and simplify model transformation

Property correctness and extraction Verify hand-written rules Automatically extract rules for new objects Relate to partial evaluation / program specialization

For a more interesting demo, see us at the break!

Thanks! [email protected]

Page 12: 1 PtHOMAS project, Ptolemy mini-conference '09 CR/RTC3-NA Elizabeth Latronico; UC Berkeley Jackie Mankit Leung | 4/16/2009 | © 2009 Robert Bosch LLC and

12

PtHOMAS project, Ptolemy mini-conference '09

CR/RTC3-NA Elizabeth Latronico; UC Berkeley Jackie Mankit Leung | 4/16/2009 | © 2009 Robert Bosch LLC and affiliates. All rights reserved.

Backup slides

Page 13: 1 PtHOMAS project, Ptolemy mini-conference '09 CR/RTC3-NA Elizabeth Latronico; UC Berkeley Jackie Mankit Leung | 4/16/2009 | © 2009 Robert Bosch LLC and

13

PtHOMAS project, Ptolemy mini-conference '09

CR/RTC3-NA Elizabeth Latronico; UC Berkeley Jackie Mankit Leung | 4/16/2009 | © 2009 Robert Bosch LLC and affiliates. All rights reserved.

package ptolemy.data.properties.lattice.logicalAND;

public class Lattice extends PropertyLattice {

public Property TRUE = new True(this); public Property FALSE = new False(this); public Property UNKNOWN = new Unknown(this);

public Lattice() {

addNodeWeight(TRUE); addNodeWeight(FALSE); addNodeWeight(UNKNOWN);

addEdge(UNKNOWN, TRUE); addEdge(TRUE, FALSE);

if (!isLattice()) { throw new Exception("The PropertyLattice is not a lattice."); } }}

Lattice Java ClassThe package

defines the use-case / ontology for

this lattice.

Properties are defined as

public fields.

Relationship is specified by adding edges from

one element to another.