1 / 28

Controller Design Using Multiple Models of Computation

Controller Design Using Multiple Models of Computation. Edward Lee Johan Eker with thanks to Paul Griffiths, Jie Liu, Xiaojun Liu, Steve Neuendorffer, and Yuhong Xiong. Overview. Mixed signal control systems The throttle control system by Paul Griffith Modal controllers

viola
Download Presentation

Controller Design Using Multiple Models of Computation

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Controller Design Using Multiple Models of Computation Edward Lee Johan Eker with thanks to Paul Griffiths, Jie Liu, Xiaojun Liu, Steve Neuendorffer, and Yuhong Xiong

  2. Overview • Mixed signal control systems • The throttle control system by Paul Griffith • Modal controllers • Extended throttle controller by Johan Eker • Design patterns • The use of domains and hierarchy • Mixed signal models • Modal models • Code generation • co-compilation

  3. discrete-time controller throttle model Input: desired throttle angle (and derivatives) A Throttle Control System Throttle controller by Paul Griffiths (Mobies Phase II, UC Berkeley) Top-level model Continuous-time (CT) domain in Ptolemy II

  4. A Throttle Control System Result of executing the model shows intial convergence phase followed by tracking with a slight phase lag. The control signal chatters to overcome friction.

  5. Synchronous dataflow director indicates a new model of computation. No director indicates no new model of computation. Design Pattern: Discrete Time in Continuous Time

  6. Control Engineer View • plant dynamics in continuous time • controller in discrete time • focus on stability, phase margins, rise time... • assume ideal sampling with no or little latency

  7. Embedded System Engineer View • dynamics modeled with RK-4, variable-step solver • controller modeled in synthesizable SDF, FRP, … • focus on scheduling, memory, communication... • assume fixed controller design

  8. A More Integrated Approach • controller design informed by software issues • domain-oriented modeling language • modeling = implementation • latency and jitter are part of the model • software design informed by controller issues • expressing timing constraints • correct-by-construction synthesis • heterogeneous modeling

  9. Elaborated Throttle Control System

  10. Design Pattern: Modal Discrete-Time Controller in Continuous Time continuous time finite-state machine discrete time Hierarchical, heterogeneous model

  11. This is Still An Idealized Model No jitter, no delays

  12. Extend the ideal model • Influence from implementation: • Jitter • Control delay • Execution: • Multitasking environment • Incorporate the behavior of the RTOS • Communication: • Shared communication links • Behavior of the network

  13. A more accurate model

  14. Software Realism • Express timing constraints • sample rates • latency • jitter tolerances • Build models in appropriate abstractions • Giotto: time-triggered • HPM: hierarhical preemptive multitasking • FRP: functional-reactive programming • … • These facilitate correct-by-construction implementation

  15. The Next Problem:Synthesizing an Implementation

  16. Jeff Tsay, Christopher Hylands, Steve Neuendorffer Outline of our Approach Model of Computation semantics defines communication, flow of control Schedule: - fire Gaussian0 - fire Ramp1 - fire Sine2 - fire AddSubtract5 - fire SequenceScope10 scheduler parser Ptolemy II model method call All actors are given in Java, then translated to embedded Java, C, VHDL, etc. if method call … 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)); } } } … block block target code abstract syntax tree

  17. Division of Responsibility • MoC semantics defines • flow of control across actors • communication protocols between actors • Actors define: • functionality of components • Actors are compiled by a MoC-aware compiler • generate specialized code for actors in context • Hierarchy: • Code generation at a level of the hierarchy produces a new actor definition We call this co-compilation. Multiple domains may be used in the same model

  18. Software Progress Build on: • First version on Titanium (UC Berkeley) • Second version on Soot (McGill) Targeting: • Simulation acceleration • Embedded software synthesis • Maryland subcontract • Configurable hardware synthesis • delegated to Brigham Young

  19. Our Generator Approach • Actor libraries are built and maintained in Java • more maintainable, easier to write • polymorphic libraries are rich and small • Java + MoC translates to target language • concurrent and imperative semantics • Efficiency gotten through code transformations • specialization of polymorphic types • code substitution using MoC semantics • removal of unnecessary code

  20. Code transformations (data types) // Original actor source Token t1 = in.get(0); Token t2 = in.get(1); out.send(0, t1.multiply(t2)); specialization of Token declarations The Ptolemy II type system supports polymorphic actors with propagating type constraints and static type resolution. The resolved types can be used in optimized generated code. // With specialized types IntMatrixToken t1 = in.get(0); IntMatrixToken t2 = in.get(1); out.send(0, t1.multiply(t2)); See Jeff Tsay, A Code Generation Framework for Ptolemy II

  21. Type system by Yuhong Xiong Type System Input of general type - anything will do Output of type general - pure event with no value general Polymorphic output - type depends on the parameters double double double general Polymorphic actor uses late binding in Java to determine implementation of addition. int Opaque port - types propagated from inside Lossless runtime type conversion

  22. Type System • Extensible type lattice • Knowledgeable users can add full-featured types • Unification infrastructure • Finds a least fixed point • Composite types • records, arrays, matrices • Higher-order types planned • model = data • Experiments with dependent types • encoding MoC constraints

  23. Code transformations (MoC-informed) MoC-polymorphic code is replaced with specialized code. // With specialized types IntMatrixToken t1 = in.get(0); IntMatrixToken t2 = in.get(1); out.send(0, t1.multiply(t2)); transformation using MoC semantics // Extended Java with specialized communication int[][] t1 = _inbuf[0][_inOffset = (_inOffset+1)%5]; int[][] t2 = _inbuf[1][_inOffset = (_inOffset+1)%5]; _outbuf[_outOffset = (_outOffset+1)%8] = t1 * t2; See Jeff Tsay, A Code Generation Framework for Ptolemy II

  24. Synchronous Dataflow (SDF) Domain • Balance equations (one for each channel): FAN = FBM • Scheduled statically • Decidable resource requirements Available optimizations: • eliminate checks for input data • statically allocate communication buffers • statically sequence actor invocations (and inline?) get(0) send(0,t) B N M A token t

  25. A C B Synchronous/Reactive Domain • A discrete model of time progresses as a sequence of “ticks.” At a tick, the signals are defined by a fixed point equation: • Available optimizations: • Statically sequence fixed-point iteration • Communication via registers

  26. Other Domains with Useful Properties for Code Generation • Strong static analyzability • Giotto (time triggered) • HPM (hierarchical preemptive multitasking) • FRP (functional reactive programming – Yale) • Finite state machines • Discrete time • Good for hardware descriptions • Discrete events • Process networks • Continuous time (analog hardware)

  27. Hierarchical Heterogeneity Ptolemy II composes domains hierarchically, where components in a model can be refined into subcomponents where the component interactions follow distinct semantics. Transparent Opaque Composite Composite Actor Actor M: Manager E0 D1: local director D2: local director E2 E3 E1 E4 E5 P3 P2 P4 P1 P5 P7 P6

  28. Conclusions • Hierarchically heterogenous modeling matches the applications well… • Hierarchically heterogenous modeling appears to be suited to high-quality sythesis

More Related