Abstract:
Unlike the 90s, where your choices were basically C, C++ and Java, the last decade has seen a "Cambrian Explosion" of languages. Every year multiple new programming languages emerge. Many establish a well defined niche and quickly develop their own ecosystem of tooling and users. Modelica was introduced in the late 90s and has become a widely used language for mathematical modeling of engineering systems. While there are certainly other languages well suited for numerical computations, to a large extent Modelica is still the only real player in its particular niche. In this talk I will attempt to demonstrate how Modelica is different from most other programming languages, why we still need Modelica and some interesting future possibilities for mathematical modeling languages.
Bio:
Michael Tiller worked for the University of Minnesota Medical School while earning his undergraduate degree in Mechanical Engineering. There he worked on the electro-chemical modeling of nerve cells and got his first taste of mathematical modeling languages. He went on to get his PhD. from the University of Urbana-Champaign in Mechanical Engineering working on finite element modeling and sensitivity analysis of solidification processes. While working on his PhD he become increasingly interested in software architectures and convinced "Gang of Four" author Ralph Johnson to be on his thesis committee. After graduating he went to work in Powertrain Research at Ford Motor Company working on, among other things, the Ford Hybrid Escape. While there he wrote the first book on Modelica, "Introduction to Physical Modeling with Modelica", and subsequently wrote "Modelica by Example" which is a freely available book on Modelica. Since working at Ford he has held a number of positions at various companies. He joined Ricardo after Xogeny, a company he founded, was acquired by Ricardo. He is now a Technical Fellow in the Ricardo Software business unit.`
Summary:
Modelica Language:
Hybrid (continuous and discrete events) differential algebraic equations
Captures detailed physics
This representation is easy to think about for humans, hard to solve for computers
Textual language
Graph-based GUI editor
Compiler outputs C code
Not a Turing Complete, so it can be reasoned about
Open source standard library
Resources:
Free book: Modelica by Example
Modelica Playground makes it easy to try Modelica out online
Language
Expressions constrain mathematical relationships among variables, no assignment or modifying application state
Modelica is not for simple differential equations (existing good tools: Fortran, ACSL, Simulink, Python, etc.)
Compiler represents constraints as a graph, orders it by logical dependencies and then converts that into C code
E.g. for a linear system they use Block-LU factorization on the graph
Solve blocks in order
Use appropriate solver (direct, iterative) for each block
Modelica supports standard units as base types
Features
Matrix transform
Nonlinear systems
Optimizations: Index reduction, State selection, Tearing
Discrete and sampled behavior
Modelica supports discrete events via when clause: continuously checking, fires when condition is true
Standard language quality features: polymorphism, model composition, package management, annotations
Various modeling formalisms
Data flow
Acausal modeling
Streams
Discrete
Solvers
Time discretization: implicit, explicit, high/low-order
Space discretization: not supported; they focus on lumped systems, not PDEs
Has been used to create models of large systems: nuclear power plants, internal combustion engines, wastewater treatment plant, greenhouse
Alternatives:
Maple and Mathematica
Convert specification into a closed form solution
Modelica is more focused: converts specification into a form that is simpler for numerical solver
Simulink
Simulink is more focused on control systems
Modelica is much easier for physical models
Simulink does have a physical modeling system but Michael didn’t find it very capable
COMSOL: Michael hasn’t evaluated it
Many scientific computing libraries/infrastructures include simple compilers that raise the abstraction level but their interface is harder to use than Modelica