Simulink Coder

Selecting and Working with Targets

The Simulink Model Explorer provides a single user interface in Simulink to configure all code generation settings. From the Model Explorer you can:

  • Select a code generation target
  • Configure the target for code generation
  • Generate code for models or subsystems

The Code Generation Advisor checks your model and code generation settings, and then offers advice on how to improve your configuration based on your needs. Once you have identified the optimal settings for your project, you can save them as a configuration set to reuse with other models.

Large aircraft system modeled using Simulink.
Large aircraft system modeled using Simulink. Simulink Coder supports advanced Simulink features for large-scale modeling, including Model Blocks, variant subsystems, and arrays of buses.

Selecting Targets

Simulink Coder uses system target files to translate your models into source code and executables. Target files specify the environment on which your generated code will run. Simulink Coder includes target files for several ready-to-run configurations, and supports third-party and custom targets as well. Built-in targets include:

Generic Real-Time Target — Generates code for interactive tuning of model parameters, logs and displays real time simulation results, and allocates data statically for efficient real-time execution

Generic Real-Time Malloc Target — Uses dynamic memory allocation in the generated code, enabling you to include multiple instances of your model or multiple models in one executable

Rapid Simulation Target (RSim) — Provides a fast, flexible test platform for performing batch or Monte Carlo simulation studies using fixed-step or variable-step solvers, and lets you save data for each run to unique output files

You can extend these targets to create customized run-time interfaces and device driver files, which enables you to target your specific environment and access Simulink Coder execution and debug capabilities in it.

Compiling and Executing Generated Code

Simulink Coder offers built-in support for compilation and execution of generated code with popular desktop environments, including:

  • Eclipse IDE
  • Microsoft® Visual C++® IDE
  • Linux® operating system
  • Windows® operating system

You can generate and deploy optimized C and C++ code in real-time embedded systems using Embedded Coder.

Next: Working with Data

Try Simulink Coder

Get trial software

Progettazione di Sistemi PLC con Simulink e B&R Automation Studio

View webinar