390 likes | 554 Views
The Acumen Modeling Language. Edwin Westbrook, Angela Zhu, Jun Inoue, Marisa Peralta, Travis Martin, Cherif Salama, Walid Taha, Corky Cartwright, Marcie O’Malley Rice University Aaron Ames, Raktim Bhattacharya Texas A&M. Funding. NSF SOD award (device drivers)
E N D
The Acumen Modeling Language Edwin Westbrook, Angela Zhu, Jun Inoue, Marisa Peralta, Travis Martin, Cherif Salama, Walid Taha, Corky Cartwright, Marcie O’Malley Rice University Aaron Ames, Raktim Bhattacharya Texas A&M
Funding • NSF • SOD award (device drivers) • CPS award (physically safe computing) • CAREER award (program generation) • Nationational Instruments • Building device drivers (EFRP) • Schlumberger • Modeling vertical drilling tractor robots
What is CPS Design? • Traditional design methods: • Control design • Physical system model is known • Physical system design • Cyber technology is known • CPS design • BOTH are unknown • Prime example: novel robotic systems
What is CPS Design? • A highly iterative process: • Model discrete components (CS) • Model continuous system (Physics) • Test models • Build a prototype • Validate in physical setting • Repeat until stars align (n-body problem :))
Testing Requires Simulation • Testing is a key tool for ensuring quality • Often also reduces cost and time • Discrete systems: Test suite is fixed • Reactive systems: Suite of streams • CPS: Reactions change test environment • Simulating physical context is part of test • Testing cannot separate continuous and discrete
Building Simulation Codes • If well-understood physical system • then use existing package • else build model, and write code • Second branch is surprisingly frequent • Virtually all robotics research • Molecular mechanics • Nano structures • and many others
Symbolic Algebra Tools Today • Time to get accustomed to tool • Need to export result to other tools • Control over tool is difficult (termination) • Surprising problems with performance
Our Starting Point • Biped robot (Aaron Ames) • Novel mechanics • Must be modeled analytically • Control theory being developed • 8x8 Lagrangian • Mathematica produces 13MB derivative • Immediate problem: Poor code • More seriously: Can’t refine model
Running Code Analytical Models
The Rest of this Talk • How simulations are built today • The language of mechanical models • Automating the mapping to code • Implemented in Acumen • Integrated with E-FRP (discrete modeling) • Symbolic differentiation • Conclusions
How Simulations are Built Today, engineers • Study system to write equations • Eliminate complex mathematical operations • “Generate equations” • Eliminate partial derivatives • Use an ODE solver (or simply code)
Mechanical Modeling • Newtonian • Write equations using Newton’s laws • Lagrangian • Focus on energy in system. More systematic • Hamiltonian • Another systematic method, better suited for different types of analyses
Language of Models • Real-valued variables • Derivatives w.r.t time
Language of Models • Real-valued variables • Derivatives w.r.t time • Partial derivatives
Language of Models • Real-valued variables • Derivatives w.r.t time • Partial derivatives • Tuples • Families of equations (finite quantifiers)
Language of Models • Real-valued variables • Derivatives w.r.t time • Partial derivatives • Tuples • Families of equations (finite quantifiers) • Vectors, Matrices
Language of Models • Real-valued variables • Derivatives w.r.t time • Partial derivatives • Tuples • Families of equations (finite quantifiers) • Vectors, Matrices • Recursive functions
Implementation • Add to existing discrete modeling language • Any language would work
Discrete Acumen • E-FRP [Wan, Taha, & Hudak] • Models controllers as event-driven difference equations • Generates efficient code for event handlers • Provably space and time bounded • Real-bounds active research [Cheng]
Continuous Acumen • Syntax: • You have already seen it. All those examples are pretty-printed from Acumen source • In ASCII, you can type in:
Continuous Acumen • Semantics: A series of analysis and transformation steps • Defined variable analysis • Binding time analysis and specialization • “Partial evaluation” • Symbolic differentiation • Algebraic solving • Discretization (implementation detail)
The Code Explosion Problem • First, names enable compact expressions: • a = x-y • b = a+a • c = b*b • d = c^c • Inlining all intermediates produces d = ((x-y)+(x-y)*(x-y)+(x-y))^((x-y)+(x-y)*(x-y)+(x-y)) • Symbolic algorithms 1) inline definitions in source 2) do not avoid duplication
The Chain Rule • Central to symbolic differentiation • Tell us how to differentiate composite expressions (f o g)’ = (f’ o g) + (f o g’) • A terrific source of duplication!
Conclusions • Building simulation codes can be made much easier than it is today • Existing tools have surprising limitations • Predictability and speed of tools are key
Future Work • From prototype to tool • Re-factoring, testing, release infrastructure • Interoperation with clients and numerical solvers • Parallelizing and alternative solver technologies • Applications • Robotics, automotive, circuits, EMF, biology • Semantics • Formalization using Exact Real Arithmetic • Alternative computational models • Increasing expressivity from ODEs to PDEs