3/12/2002 - 1 modeling and controlling the caltech ducted fan vehicle steve neuendorffer, ptolemy...

21
3/12/2002 - 1 Modeling and controlling the Caltech Ducted Fan Vehicle Steve Neuendorffer, Ptolemy Group, UC Berkeley

Post on 20-Dec-2015

216 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: 3/12/2002 - 1 Modeling and controlling the Caltech Ducted Fan Vehicle Steve Neuendorffer, Ptolemy Group, UC Berkeley

3/12/2002 - 1

Modeling and controlling the Caltech Ducted Fan Vehicle

Steve Neuendorffer, Ptolemy Group, UC Berkeley

Page 2: 3/12/2002 - 1 Modeling and controlling the Caltech Ducted Fan Vehicle Steve Neuendorffer, Ptolemy Group, UC Berkeley

3/12/2002 - 2

How do we get to an implementation?

Abstract, high-level system model

Detailed low-level system implementation

Page 3: 3/12/2002 - 1 Modeling and controlling the Caltech Ducted Fan Vehicle Steve Neuendorffer, Ptolemy Group, UC Berkeley

3/12/2002 - 3

Some options…1. Don't build a high-level model…

Implement the system by hand.

2. Build a high-level model, but throw it away when implementation starts.

3. Build a high-level model, and validate implementation against it.

4. Build a low-level model, and generate an implementation from it.

5. Build a high-level model, refine it gradually into more detailed models that are more suitable for automatic code generation.

Page 4: 3/12/2002 - 1 Modeling and controlling the Caltech Ducted Fan Vehicle Steve Neuendorffer, Ptolemy Group, UC Berkeley

3/12/2002 - 4

An example of heterogenous refinement

Drive the ducted fan vehicle to a desired point.

• Continuous time vehicle and controller.• A zero-delay discrete-time controller.• A one-step delay discrete-time controller.• An arbitrary delay discrete-time controller.• A more sophisticated modal controller.• A model for automatic system

implementation.

Page 5: 3/12/2002 - 1 Modeling and controlling the Caltech Ducted Fan Vehicle Steve Neuendorffer, Ptolemy Group, UC Berkeley

3/12/2002 - 5

1: Vehicle/Controller model

(X,Y) Position, anddirection of the vehicle

Total forward thrust, and differential torque applied by the fans.

Page 6: 3/12/2002 - 1 Modeling and controlling the Caltech Ducted Fan Vehicle Steve Neuendorffer, Ptolemy Group, UC Berkeley

3/12/2002 - 6

1: Continuous Vehicle model

Specified as a differential equation,as in Simulink.

Page 7: 3/12/2002 - 1 Modeling and controlling the Caltech Ducted Fan Vehicle Steve Neuendorffer, Ptolemy Group, UC Berkeley

3/12/2002 - 7

1: Continuous controller model

A modified proportional controller…

Page 8: 3/12/2002 - 1 Modeling and controlling the Caltech Ducted Fan Vehicle Steve Neuendorffer, Ptolemy Group, UC Berkeley

3/12/2002 - 8

2: Vehicle model withDiscrete-time interface

Zero-order holdmodels the Digital -> Analog conversion.

The analog position of the vehicle is periodically sampled approximately every second.

Page 9: 3/12/2002 - 1 Modeling and controlling the Caltech Ducted Fan Vehicle Steve Neuendorffer, Ptolemy Group, UC Berkeley

3/12/2002 - 9

2: Discrete Vehicle controller

Heterogenous systemmodeling

Page 10: 3/12/2002 - 1 Modeling and controlling the Caltech Ducted Fan Vehicle Steve Neuendorffer, Ptolemy Group, UC Berkeley

3/12/2002 - 10

3: Discrete Vehicle controller with one-sample delay

SampleDelay added to modelcomputation time of controller

Page 11: 3/12/2002 - 1 Modeling and controlling the Caltech Ducted Fan Vehicle Steve Neuendorffer, Ptolemy Group, UC Berkeley

3/12/2002 - 11

4: Discrete Vehicle controller with arbitrary delay

More Heterogeneity

TimedDelay actor in Discrete Event domain models arbitrary delay.

SDF control lawCT vehicle model

Page 12: 3/12/2002 - 1 Modeling and controlling the Caltech Ducted Fan Vehicle Steve Neuendorffer, Ptolemy Group, UC Berkeley

3/12/2002 - 12

5: A modal controllerYet More Heterogeneity

Page 13: 3/12/2002 - 1 Modeling and controlling the Caltech Ducted Fan Vehicle Steve Neuendorffer, Ptolemy Group, UC Berkeley

3/12/2002 - 13

Breathe and watch the demo…A comparison of the modal controller versusthe simple proportional controller.

Page 14: 3/12/2002 - 1 Modeling and controlling the Caltech Ducted Fan Vehicle Steve Neuendorffer, Ptolemy Group, UC Berkeley

3/12/2002 - 14

Target specifics…

(X,Y) Position, anddirection of the vehicle come from video localization system.

Control values are sent to motor controller by serial port.

Page 15: 3/12/2002 - 1 Modeling and controlling the Caltech Ducted Fan Vehicle Steve Neuendorffer, Ptolemy Group, UC Berkeley

3/12/2002 - 15

6: A controller, with refined communication.

Suitable for code generation

One of the previous (possibly heterogenous)control laws

Page 16: 3/12/2002 - 1 Modeling and controlling the Caltech Ducted Fan Vehicle Steve Neuendorffer, Ptolemy Group, UC Berkeley

3/12/2002 - 16

Code GenerationTranslation from a model to an efficient implementation is a highly skilled operation that is both error-prone and time-consuming.

But, it is mostly a repeated application of well-known implementation patterns and optimization techniques.

These patterns and techniques can be automated into modeling tools.

Implementationteam

= System Modeler + Modeling Tool

Page 17: 3/12/2002 - 1 Modeling and controlling the Caltech Ducted Fan Vehicle Steve Neuendorffer, Ptolemy Group, UC Berkeley

3/12/2002 - 17

Implementation Patternsin Ptolemy II

Task 2.2: Customizing frameworks with generatorsTask 2.4: Generating embedded software from models

Page 18: 3/12/2002 - 1 Modeling and controlling the Caltech Ducted Fan Vehicle Steve Neuendorffer, Ptolemy Group, UC Berkeley

3/12/2002 - 18

Code generationThere are two parts to the generated code:

Code generated from the model of computationCode generated from individual components.

How is the code from individual actors generated?Option 1: The code generator can be implemented specifically for each component.

Option 2: The code generator can be implemented generically for all components.

However, being generic and efficient is difficult.

Page 19: 3/12/2002 - 1 Modeling and controlling the Caltech Ducted Fan Vehicle Steve Neuendorffer, Ptolemy Group, UC Berkeley

3/12/2002 - 19

Mapping Ptolemy II ActorsActors and embedded code have very different

design contraints.

Actors are:•parameterizable• reusable• reconfigurable•generic

Embedded code is:• specialized•optimized

These are inevitably in conflict!

Page 20: 3/12/2002 - 1 Modeling and controlling the Caltech Ducted Fan Vehicle Steve Neuendorffer, Ptolemy Group, UC Berkeley

3/12/2002 - 20

Mapping Java ActorsWe must avoid having a multitude of expensive, specialized implementations for each target platform.

Method: Parse the Java code for an actor and specialize it.

Page 21: 3/12/2002 - 1 Modeling and controlling the Caltech Ducted Fan Vehicle Steve Neuendorffer, Ptolemy Group, UC Berkeley

3/12/2002 - 21

Co-compilation

Two main operations:1) Optimize in the context in the model. (Inline

parameter values)2) Replace ports with communication primitives

of platform.

Actor Class file

AbstractSyntaxTree

EmbeddedClass file