Transcript powerpoint

Mobies Ethereal Sting OEP
The Ptolemy II Experiment
Edward A. Lee
Professor
UC Berkeley
Ethereal Sting Working Group Meeting
June 10, 2003
Arlington, VA
E0 Implementation in Ptolemy II
Authors:
Mark Oliver (WPAFB)
Steve Neuendorffer
Edward Lee
Lee, U. C. Berkeley 2
Code Generation
Automatic code generation enables rapid implementation
from high-level component-based design.
We are developing a code generation technique based on
component specialization that transforms Ptolemy II
models into a Java system implementation.
Lee, U. C. Berkeley 3
From Model to Implementation
• Generator-based code generation
– Done in Ptolemy Classic
– Library maintenance is very expensive
• Native Java compiler
– Drags in the development environment
– Result is large, and has unpredictable timing
• Component specialization
– Produce minimized Java implementation
– Minimize or eliminate dynamic memory management
– Compile to the target platform using one of:
•
•
•
•
Java to C translation
Native Java compiler
Just-in-time compiler
Native Java platform (e.g. Dallas Tini boards)
Lee, U. C. Berkeley 4
Component Specialization
Model of Computation semantics defines communication, flow of control
Ptolemy II model
scheduler
Schedule:
- fire Gaussian0
- fire Ramp1
- fire Sine2
- fire AddSubtract5
- fire SequenceScope10
parser
Java actor
definitions are
parsed and then
specialized for
their context.
method call
if
block
method call
block
abstract syntax tree
Specialize for
 data types
 parameter values
 scheduling
By
 token unboxing
 inlining
 partial evaluation
 dead code elimination
…
for (int i = 0; i < plus.getWidth(); i++) {
if (plus.hasToken(i)) {
if (sum == null) {
sum = plus.get(i);
} else {
sum = sum.add(plus.get(i));
}
}
}
…
target code
Lee, U. C. Berkeley 5
Limitations Exposed by the Experiment
• No actor for array maximum
– Added later by Mark Oliver, built into library
– Easy workaround used very wide signal busses
• Type resolution was very slow when using very
wide signal busses
– Fixed by Steve Neuendorffer
• AudioReader actor was unfinished
– Didn’t use FileAttribute
– Didn’t correctly deliver stereo signals
• FFT actor performs only radix-2 FFTs
– Could use MATLAB interface to generalize
• Component specialization framework limitations
– Didn’t handle FileAttributes
– Error handling the absolute() function
– Error specializing AudioReader
Lee, U. C. Berkeley 6
Log of Effort
• Three active participants, plus some spectators:
– 0.5 hours examining EtherealSting website and figuring
out what to do.
– 2 hours constructing and experimenting with the model
to detect the baud rate. This was built by modifying a
model constructed by Edward Lee at the Mobies PI
meeting (which took, perhaps, 1.5 hours to build).
– 1 hour fixing bug in AudioReader actor to use
FileAttribute.
– 4 hours experimenting with component specialization.
– Total time: 9 hours
• 6.5 hours fixing bugs exposed by the experiment.
• The experiment stimulated further work on
comm/signal processing libraries.
Lee, U. C. Berkeley 7
Actor Libraries – Signal Processing
domains
actor
sdf
actor.lib
AbsoluteValue
Accumulator
actor.lib.comm
AddSubtract
ArrayAppend
ConvolutionalCoder
ArrayElement
DeScrambler
ArrayExtract
HadamardCode
ArrayLength
Scrambler
ArrayMaximum
ViterbiDecoder
ArrayMinimum
Average
Bernoulli
actor.lib.jai
Const
Counter
DoubleMatrixToJAI
DB
JAIAffineTransform
Differential
JAIBMPWriter
DiscreteRandomSource
JAIBandCombine
Expression
JAIBandSelect
Gaussian
JAIBorder
IIR
JAIBoxFilter
Interpolator
JAIConvolve
Lattice
JAICrop
LevinsonDurbin
JAIDCT
Limiter
JAIDFT
LinearDifferenceEquationSystem JAIDataCaster
LookupTable
JAIEdgeDetection
MathFunction
JAIIDCT
MaxIndex
JAIIDFT
Maximum
JAIImageReader
Minimum
JAIImageToken
MultiplyDivide
JAIInvert
PhaseUnwrap
JAIJPEGWriter
PoissonClock
JAILog
Pulse
JAIMagnitude
Quantizer
JAIMedianFilter
RandomSource
JAIPNMWriter
RecursiveLattice
JAIPeriodicShift
Rician
JAIPhase
Scale
JAIPolarToComplex
TrigFunction
JAIRotate
Uniform
JAIScale
JAITIFFWriter
JAIToDoubleMatrix
JAITranslate
JAITranspose
Capabilities:
•
filtering
–
lib
actor.lib.gui
ArrayToSequence
Autocorrelation
DelayLine
DotProduct
DownSample
FFT
FIR
IFFT
LMSAdaptive
LineCoder
MatrixToSequence
RaisedCosine
Repeat
SampleDelay
SequenceToArray
SequenceToMatrix
UpSample
VariableFIR
VariableLattice
VariableRecursiveLattice
multirate polyphase FIR, IIR, lattice,
LMS adaptive filter, dot product,
up/downsample
•
random numbers/signals
•
•
linear system generators
spectral estimation library
•
comm functions:
•
•
array and matrix operations
rich expression language / actor
ColorFinder
JMFImageToken
PlaySound
VideoCamera
•
actor.lib.javasound
•
•
interpolator, phase unwrap, lookup
table, signal generators, trig functions
signal plotters
extensive image processing library
•
audio interfaces
ArrayPlotter
ArrowKeySensor
BarGraph
Display
HistogramPlotter
InteractiveShell
KeystrokeSensor
MatrixViewer
Plotter
PlotterBase
RealTimePlotter
SequencePlotter
SequenceScope
SketchedSource
SliderSource
TimedPlotter
TimedScope
XYPlotter
XYScope
actor.lib.image
ImageDisplay
ImageReader
ImageRotate
ImageToString
Transform
URLToImage
actor.lib.jmf
AudioCapture
AudioPlayer
AudioReadBuffer
AudioReader
AudioWriteBuffer
AudioWriter
UML package
diagram of key
actor libraries
included with
Ptolemy II.
–
Bernouli, Gaussian, Rician, Rayleigh,
Uniform, arbitrary discrete
distributions.
–
FFT, periodogram, maximum entropy
–
Viterbi decoder (MLSE),
convolutional/block coder/decoders, PN
sequence generation,
scrambling/descrambling, raised cosine
–
–
–
–
extensive function library
MATLAB-like matrix comprehension
higher-order functional semantics
sophisticated, integrated type system
–
based on Java JAI, JMF
Lee, U. C. Berkeley 8
Supervisory Structure
Experimental SA Compute Resource
Model-based compute resource:
Authors:
Yang Zhao
Steve Neuendorffer
Xiaojun Liu
PushConsumer actor receives
pushed data provided via CORBA,
where the data is an XML model of an
SA algorithm.
MobileModel actor accepts a
StringToken containing an XML
description of a model. It then
executes that model on a stream of
input data.
Lee, U. C. Berkeley 9
Supervisory Structure
Experimental Task Manager
Model-based task manager:
Authors:
Yang Zhao
Steve Neuendorffer
Xiaojun Liu
PushSupplier send an
XML representation of an
SA model via CORBA
PushConsumer actor
receives pushed data
provided via CORBA,
where the data is a user
request for signal
analysis.
Supervisor state
machine has resource
allocation logic
Lee, U. C. Berkeley 10
Supervisory Structure
Experimental User Model
User model:
PullSupplier
actor
provides
signal data
on demand
from SA
algorithm
Model supplying
signal data
PushSupplier actor
sends a request for
signal analysis to
the task manager.
Authors:
Yang Zhao
Steve Neuendorffer
Xiaojun Liu
Lee, U. C. Berkeley 11
To Do
• Handle failures of mobile model
– use “model error handler” mechanism in Ptolemy II
• Secure execution of mobile model
– all Java code executed is locally defined
– mark actors and directors that convey no authority
– set MobileModel security level to restrict actors
• Encrypted communication of models & data
– currently XML plain text
• Authenticated access to MobileModels
– consider using “capability” mechanisms
– use peer-to-peer technology to “discover”
capabilities.
Lee, U. C. Berkeley 12
Another Application: Controlling
the Caltech Ducted Fan Vehicle
This effort is
applying Mobies
technology to the
SEC program
Lee, U. C. Berkeley 13
Caltech Vehicles
Difficulties:
1) Complex control problem
2) Complex implementation
platform
Command computer:
Waypoints, trajectories,
Control changes
30 feet
Localization
computer estimates
vehicle
locations
Vehicles with onboard controllers and 802.11b
Lee, U. C. Berkeley 14
A Detailed Heterogenous Model
Measured Physical Parameters
Author:
Steve Neuendorffer
Discrete Event
model convenient
for events that
do not occur at
the same time.
Model of
computation and
communication
delay.
Array of 3 Bytes:
{85, Left, Right}
Sent immediately after
controller computes value
Array of 50 Bytes:
{TimeStamp, ID, X, Y, Angle}
60 times a second
Lee, U. C. Berkeley 15
A Detailed Heterogenous Model
Continuous time model of
Author:
vehicle dynamics
Steve Neuendorffer
Fan Thrust Map
Data formatting
Lee, U. C. Berkeley 16
A Detailed Heterogenous Model
Author:
Steve Neuendorffer
Discrete-state
model of vehicle
software
Encapsulated
Control Law
Lee, U. C. Berkeley 17
Towards Implementation
802.11b
RS-232
Lee, U. C. Berkeley 18
Hardware-in-the-loop
Replace hardware-true simulation model with actual
vehicle.
Allows validation of continuous dynamics model, and
hardware/software interface.
802.11b
RS-232
Lee, U. C. Berkeley 19
Simulation-in-the-loop
Code generation of the controller onto an
embedded platform.
Allows validation of generated code, and
execution delay.
802.11b
RS-232
Embedded Java Platform
Lee, U. C. Berkeley 20
System Implementation
The generated code forms the final
system implementation.
802.11b
RS-232
Embedded Java Platform
Lee, U. C. Berkeley 21
Controller Updates
Simplified model of
base station
Mobile model allows
substitution of different
controllers
Controller component
transmitted over
publish/subscribe
network
Authors:
Steve Neuendorffer
Yang Zhao
Lee, U. C. Berkeley 22