Overview of Code Generation

Learn the basics about code generation and its applications.

Code generation is the process of automatically generating a code that captures the behavior of a designated part of an Activate model. In most cases, C code is generated for a Super Block and has many applications including:
  • Replacing a Super Block with a basic block that has better performance.
  • Creating FMUs for model exchange and for co-simulation with other simulation tools.
  • Creating independent executables, particularly for embedded applications such as Arduino.
  • Distributing the code in binary form when you want to avoid exposing the content of the code.
The generated code, which represents the behavior of the original Super Block in the Activate model, provides the functions needed to compute output signals based on input signals; these signals correspond to the inputs and the outputs of the Super Block. In many applications, it is desirable to preserve some of the parameters of the Super Block in the generated code as well. Such parameters are known as exposable parameters.