Skip to Main Content Skip to Search
Product Documentation

Target Environments and Applications

About Target Environments

In addition to generating source code, the code generator produces make or project files to build an executable for a specific target environment. The generated make or project files are optional. If you prefer, you can build an executable for the generated source files by using an existing target build environment, such as a third-party integrated development environment (IDE). Applications of generated code range from calling a few exported C or C++ functions on a host computer to generating a complete executable using a custom build process, for custom hardware, in an environment completely separate from the host computer running MATLAB and Simulink.

The code generator provides built-in system target files that generate, build, and execute code for specific target environments. These system target files offer varying degrees of support for interacting with the generated code to log data, tune parameters, and experiment with or without Simulink as the external interface to your generated code.

Types of Target Environments Supported By Simulink Coder

Before you select a system target file, identify the target environment on which you expect to execute your generated code. The most common target environments include those environmens listed in the following table.

Target EnvironmentDescription
Host computer

The same computer that runs MATLAB and Simulink. Typically, a host computer is a PC or UNIX®[a] environment that uses a non-real-time operating system, such as Microsoft® Windows® or Linux®[b] . Non-real-time (general purpose) operating systems are nondeterministic. For example, those operating systems might suspend code execution to run an operating system service and then, after providing the service, continue code execution. Therefore, the executable for your generated code might run faster or slower than the sample rates that you specified in your model.

Real-time simulator

A different computer than the host computer. A real-time simulator can be a PC or UNIX environment that uses a real-time operating system (RTOS), such as:

  • xPC Target™ system

  • A real-time Linux system

  • A Versa Module Eurocard (VME) chassis with PowerPC® processors running a commercial RTOS, such as VxWorks® from Wind River® Systems

The generated code runs in real time and behaves deterministically. The exact nature of execution varies based on the particular behavior of the system hardware and RTOS.

Typically, a real-time simulator connects to a host computer for data logging, interactive parameter tuning, and Monte Carlo batch execution studies.

Embedded microprocessor

A computer that you eventually disconnect from a host computer and run as a standalone computer as part of an electronics-based product. Embedded microprocessors range in price and performance, from high-end digital signal processors (DSPs) to process communication signals to inexpensive 8-bit fixed-point microcontrollers in mass production (for example, electronic parts produced in the millions of units). Embedded microprocessors can:

[a] UNIX is a registered trademark of The Open Group in the United States and other countries.

[b] Linux is a registered trademark of Linus Torvalds.

A target environment can:

In addition, you can deploy different parts of a Simulink model on different target environments. For example, it is common to separate the component (algorithm or controller) portion of a model from the environment (or plant). Using Simulink to model an entire system (plant and controller) is often referred to as closed-loop simulation and can provide many benefits, such as early verification of component correctness.

The following figure shows example target environments for code generated for a model.

Applications of Supported Target Environments

The following table lists several ways that you can apply code generation technology in the context of the different target environments.

ApplicationDescription
Host Computer
Accelerated simulationYou apply techniques to speed up the execution of model simulation in the context of the MATLAB and Simulink environments. Accelerated simulations are especially useful when run time is long compared to the time associated with compilation and checking whether the target is up to date.
Rapid simulationYou execute code generated for a model in nonreal time on the host computer, but outside the context of the MATLAB and Simulink environments.
System simulationYou integrate components into a larger system. You provide generated source code and related dependencies for building a system in another environment or in a host-based shared library to which other code can dynamically link.
Model intellectual property protectionYou generate a Simulink shareable object library for a model or subsystem for use by a third-party vendor in another Simulink simulation environment.
Real-Time Simulator
Rapid prototypingYou generate, deploy, and tune code on a real-time simulator connected to the system hardware (for example, physical plant or vehicle) being controlled. This design step is crucial for validating whether a component can control the physical system.
System simulationYou integrate generated source code and dependencies for components into a larger system that is built in another environment. You can use shared library files for intellectual property protection.
On-target rapid prototypingYou generate code for a detailed design that you can run in real time on an embedded microprocessor while tuning parameters and monitoring real-time data. This design step allows you to assess, interact with, and optimize code, using embedded compilers and hardware.
Embedded Microprocessor
Production code generationFrom a model, you generate code that is optimized for speed, memory usage, simplicity, and potentially, compliance with industry standards and guidelines.
Software-in-the-loop (SIL) testingYou execute generated code with your plant model within Simulink to verify conversion of the model to code. You might change the code to emulate target word size behavior and verify numerical results expected when the code runs on an embedded microprocessor. Or, you might use actual target word sizes and just test production code behavior.
Processor-in-the-loop (PIL) testingYou test an object code component with a plant or environment model in an open- or closed-loop simulation to verify successful model-to-code conversion, cross-compilation, and software integration.
Hardware-in-the-loop (HIL) testingYou verify an embedded system or embedded computing unit (ECU), using a real-time target environment.


[a] UNIX is a registered trademark of The Open Group in the United States and other countries.

[b] Linux is a registered trademark of Linus Torvalds.

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS