1. Catalogs
  2. The MathWorks
  3. Simulink Coder

Simulink Coder

Simulink Coder

Simulink Coder

Product catalog summary
Overview
Simulink Coder, formerly known as Real-Time Workshop, is a tool that generates C and C++ code from Simulink diagrams, Stateflow charts, and MATLAB functions. This code can be used for both real-time and non-real-time applications, such as simulation acceleration, rapid prototyping, and hardware-in-the-loop testing. Users can interact with the generated code within or outside MATLAB and Simulink environments.
Key Features
  • Generates ANSI/ISO C and C++ code for discrete, continuous, or hybrid models.
  • Supports incremental code generation for large models and various data types including integer, floating-point, and fixed-point.
  • Facilitates code generation for single-rate, multirate, and asynchronous models.
  • Allows single-task, multitask, and multicore code execution with or without an RTOS.
  • Enables external mode simulation for parameter tuning and signal monitoring.
Target Selection and Configuration
The Simulink Model Explorer provides a unified interface for configuring code generation settings. Users can select and configure code generation targets, generate code for models or subsystems, and save optimal settings for reuse. Simulink Coder supports built-in, third-party, and custom targets, including Generic Real-Time Target and Rapid Simulation Target (RSim).
Compilation and Execution
Simulink Coder supports code compilation and execution in popular desktop environments like Eclipse IDE, Microsoft Visual C++ IDE, Linux, and Windows. It also supports real-time embedded systems using Embedded Coder.
Data Management
Users can define and control model data in the generated code, manage data types, and specify storage for tuning, calibration, and signal monitoring. Code can be redeployed across multiple targets using different data dictionary sets.
Code Generation Support
Simulink Coder supports various Simulink and Stateflow features, including model blocks, atomic subsystems, bus objects, and MATLAB function blocks. It also supports fixed-point modeling, signal processing, and rapid prototyping.
Execution Modes
  • Single-Tasking Mode: Executes code in a single thread, preventing preemption.
  • Multitasking Mode: Uses a rate-monotonic scheduler for preemption between rates.
  • Asynchronous Mode: Handles nonperiodic rates using Simulink S-functions.
Real-Time Deployment
Simulink Coder provides capabilities for real-time deployment, including task priorities, counters, timers, and overrun detection. It supports legacy code integration and customization of the generated code and runtime environment.
Parameter Tuning and Data Logging
Simulink Coder allows users to optimize algorithm performance and code execution by interacting with the generated executable. It supports target-based C API, host-based ASAP2 data exchange, and Simulink External mode for parameter tuning and signal monitoring.
Additional Resources
See more

Catalog excerpts

Simulink Coder-1

Simulink Coder Generate C and C++ code from Simulink and Stateflow models Simulink Coder™ (formerly Real-Time Workshop ) generates and executes C and C++ code from Simulink diagrams, Stateflow® charts, and MATLAB® functions. The generated source code can be used for real-time and nonreal-time applications, including simulation acceleration, rapid prototyping, and hardware-in-the-loop testing. You can tune and monitor the generated code using Simulink or run and interact with the code outside MATLAB ■ ANSI/ISO C and C++ code and executables for discrete, continuous, or hybrid Simulink and Stateflow ■ Incremental code generation for large models ■ Integer, floating-point, and fixed-point data type support ■ Code generation for single-rate, multirate, and asynchronous models ■ Single-task, multitask, and multicore code execution with or without an RTOS ■ External mode simulation for parameter tuning and signal monitoring File Edit View Simulation Format Tools Help pdotiqdot; rdor^ 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: Accelerating the pace of engineering and science

 Open the catalog to page 1
Simulink Coder-2

■ 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. File Edit View Display Diagram Simulation Analysis Code Tools Help & Radv AHmtter Patiwns Demands Airdata SysiEmop Guidance System Large aircraft system modeled using Simulink. Simulink Coder...

 Open the catalog to page 2
Simulink Coder-3

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: ■ 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. Defining and Controlling...

 Open the catalog to page 3
Simulink Coder-4

Generating Code Simulink Coder offers comprehensive code generation support for Simulink and Stateflow features and components, including: ■ Model blocks for generating code incrementally ■ Atomic subsystems and atomic subcharts for reusing code via reentrant C functions ■ Bus objects and arrays of buses for generating structures in your code ■ S-functions for simulating and interfacing with legacy code ■ MATLAB function blocks in Simulink and MATLAB functions in Stateflow for generating code from models with MATLAB components Simulink Coder also supports the Simulink product family, including...

 Open the catalog to page 4
Simulink Coder-5

Executing Code in a Real-Time Environment Simulink Coder provides a complete framework for executing the generated code in real time and incorporating it into your execution environment. It generates single-rate or multirate code based on the periodic sample times you specify in the model. Execution Modes Code can be deployed with or without an RTOS, and in single-tasking, multitasking, or asynchronous mode. Single-Tasking Mode In single-tasking mode, a simple scheduler invokes the generated code in a single thread of execution, preventing preemption between rates. Multitasking Mode In multitasking...

 Open the catalog to page 5
Simulink Coder-6

Tuning Parameters and Logging Data Simulink Coder helps you optimize your algorithm’s performance and improve code execution behavior by enabling you to interact with and analyze the generated executable. Simulink Coder lets you monitor and tune block signals and parameters using the following data interfaces: Target-based C API — Enables user-written code to access block outputs and parameters outside MATLAB and Simulink Host-based ASAP2 data exchange file — Lets you use the ASAP2 standard data description for data measurement, calibration, and diagnostic systems outside MATLAB and Simulink...

 Open the catalog to page 6

All The MathWorks catalogs and technical brochures

  1. Stateflow

    8  Pages

  2. SimEvents

    7  Pages

  3. SimDriveline

    7  Pages

  4. SimHydraulics

    7  Pages

  5. SimRF

    6  Pages

  6. MATLAB Coder

    5  Pages

  7. OPC Toolbox

    5  Pages

  8. SimBiology

    6  Pages

  9. xPC Target

    5  Pages

  10. SimMechanics

    7  Pages

  11. Simscape

    7  Pages

  12. Simulink

    6  Pages

  13. MATLAB®

    6  Pages

*Prices are pre-tax. They exclude delivery charges and customs duties and do not include additional charges for installation or activation options. Prices are indicative only and may vary by country, with changes to the cost of raw materials and exchange rates.