Code Generation - MapleSim Features - System-Level Modeling and Simulation

Optimized Code Generation

Optimized code generation produces high-performance, royalty-free code suitable even for repeated optimization runs and complex real-time simulations, including hardware-in-the-loop (HIL) applications. With MapleSim, you do not have to choose between model fidelity and real-time performance.

  • The symbolic techniques that lie at the heart of MapleSim generate efficient system equations, without loss of fidelity, eliminating the need to simplify the model manually to reduce its computational complexity.
  • Equation simplification steps include index reduction for DAEs, eliminating algebraic loops, and algebraically manipulating the system to produce a smaller, computationally simpler set of equivalent equations.
  • MapleSim code generation tools convert these simplified equations to source code while applying symbolic optimization steps that dramatically speed up execution times. The optimizing tools extract common subexpressions and replace them with a single variable whose value is computed in advance. By removing expensive calculations from inside iteration loops, MapleSim can decrease the number of calculations for a single common subexpression from thousands to one in a typical application.
  • Automatic code generation is available for all models, including those that contain custom components, eliminating the need for error-prone hand-coding.
  • Available code generation targets, using MapleSim or MapleSim with a connectivity add-on, include:
    • Standalone C code
    • Simulink®/Simulink® Coder™
    • Functional Mockup Interface (FMI), for connectivity with FMI-compliant tools, including dSPACE SCALEXIO, LMS Amesim, QTronic Silver, IPG CarMaker, VI-CarRealTime, B&R Automation Studio, and more
    • Maple: You can speed up your analysis computations by running compiled MapleSim models from your analysis documents
  • The resulting code can be seamlessly incorporated into popular real-time toolchains and other applications, royalty-free.

Learn more about optimized code generation in MapleSim