Real-Time Workshop    

Target Environments

Real-Time Workshop supports many target environments. These include ready-to-run configurations and third-party targets. You can also develop your own custom target.

This section begins with a list of available target configurations. Following the list, we summarize the characteristics of each target.

Available Target Configurations

Target Configurations Bundled with Real-Time Workshop.   The MathWorks supplies the following target configurations with Real-Time Workshop:

Target Configurations Bundled with Real-Time Workshop Embedded Coder.   The MathWorks supplies the following target configuration with Real-Time Workshop Embedded Coder (a separate product from Real-Time Workshop):

Turnkey Rapid Prototyping Target Products.   These self-contained solutions ( separate products from Real-Time Workshop) include:

DSP Target Products.   See Developer's Kit for Texas Instruments DSP User's Guide for information on this target:

Third-Party Targets.   Numerous software vendors have developed customized targets for Real-Time Workshop. For an up-to-date listing of third-party targets, visit the MATLAB Connections Web page at http://www.mathworks.com/products/connections

View Third-Party Solutions by Product Type, and then select Real-Time Workshop Target from the drop-down list.

Custom Targets.   Typically, to target custom hardware, you must write a harness (main) program for your target system to execute the generated code, and I/O device drivers to communicate with your hardware. You must also create a system target file and a template makefile.

Real-Time Workshop supplies generic harness programs as starting points for custom targeting. See Targeting Real-Time Systems in the Real-Time Workshop documentation for the information you will need to develop a custom target.

Rapid Simulation Target

Rapid Simulation Target (RSIM) consists of a set of target files for non-real-time execution on your host computer. RSIM enables you to use Real-Time Workshop to generate fast, stand-alone simulations. RSIM allows batch parameter tuning and downloading of new simulation data (signals) from a standard MATLAB MAT-file without the need to recompile the model.

The speed of the generated code also makes RSIM ideal for Monte Carlo simulations. The RSIM target enables the generated code to read and write data from or to standard MATLAB MAT-files. RSIM reads new signals and parameters from MAT-files at the start of simulation.

RSIM enables you to run stand-alone, fixed-step simulations on your host computer or on additional computers. If you need to run 100 large simulations, you can generate the RSIM model code, compile it, and run the executables on 10 identical computers. The RSIM target allows you to change the model parameters and the signal data, achieving significant speed improvements by using a compiled simulation.

S-Function and Accelerator Targets

S-Function Target provides the ability to transform a model into a Simulink S-function component. Such a component can then be used in a larger model. This allows you to speed up simulations and/or reuse code. You can include multiple instances of the same S-function in the same model, with each instance maintaining independent data structures. You can also share S-function components without exposing the details of the a proprietary source model.

The Accelerator Target is similar to the S-Function Target in that an S-function is created for a model. The Accelerator Target differs from the S-Function Target in that the generated S-function operates in the background. It provides for faster simulations while preserving all existing simulation capabilities (parameter change, signal visualization, full S-function support, etc.).

Turnkey Rapid Prototyping Targets

The Real-Time Windows Target and the xPC Target are add-on products to Real-Time Workshop. Both of these targets turn an Intel 80x86/Pentium or compatible PC into a real-time system. Both support a large selection of off-the-shelf I/O cards (both ISA and PCI).

With turnkey target systems, all you need to do is install the MathWorks software and a compiler, and insert the I/O cards. You can then use a PC as a real-time system connected to external devices via the I/O cards.

Real-Time Windows Target.   The Real-Time Windows Target brings rapid prototyping and hardware-in-the-loop simulation to your desktop. It is the most portable solution available today for rapid prototyping and hardware-in-the-loop simulation when used on a laptop outfitted with a PCMCIA I/O card. The Real-Time Windows Target is ideal since a second PC or other real-time hardware is often unnecessary, impractical or cumbersome.

This picture shows the basic components of the Real-Time Windows Target.

Figure D-7: Real-Time Windows (rtwin) Target

As a prototyping environment, the Real-Time Windows Target is exceptionally easy to use, due to tight integration with Simulink and external mode. It is much like using Simulink itself, with the added benefit of gaining real-time performance and connectivity to the real world through a wide selection of supported I/O boards. You can control your real-time execution with buttons located on the Simulink toolbar. Parameter tuning is done interactively, by simply editing Simulink blocks and changing parameter values. For viewing signals, the Real-Time Windows Target uses standard Simulink Scope blocks, without any need to alter your Simulink block diagram. Signal data can also be logged to a file or set of files for later analysis in MATLAB.

The Real-Time Windows Target is often called the "one-box rapid prototyping system," since both Simulink and the generated code run on the same PC. A run-time interface enables you to run generated code on the same processor that runs Windows The generated code executes in real time, allowing Windows to execute when there are free CPU cycles. The Real-Time Windows Target supports over 100 I/O boards, including ISA, PCI, CompactPCI, and PCMCIA. Sample rates in excess of 10 to 20 kHz can be achieved on Pentium PCs.

In universities, the Real-Time Windows Target provides a cost effective solution since only a single computer is required. In commercial applications, the Real-Time Windows Target is often used at an engineer's desk prior to taking a project to an expensive dedicated real-time testing environment. Its portability is unrivaled, allowing you to use your laptop as a real-time test bed for applications in the field.

Figure D-8 illustrates the use of the Real-Time Windows Target in a model using magnetic levitation to suspend a metal ball in midair. The system is controlled by the model shown in Figure D-9.

Figure D-8: Magnetic Levitation System

Figure D-9: Model for Controlling Magnetic Levitation System

Rapid Prototyping Targets

There are two classes of rapid prototyping targets: those using the real-time code format and those using the real-time malloc code format. These differ in the way they allocate memory (statically versus dynamically). Most rapid prototyping targets use the real-time code format.

We define two forms of rapid prototyping environments:

Homogeneous rapid prototyping environments eliminate uncertainty because the rapid prototyping environment is closer to the final production system. However, a turnkey system for your specific hardware may not exist. In this case, you must weigh the advantages and disadvantages of using one of the existing turnkey systems for heterogeneous rapid prototyping, versus creating a homogeneous rapid prototyping environment.

Several rapid prototyping targets are bundled with Real-Time Workshop.

Generic Real-Time (GRT) Target.   This target uses the real-time code format and supports external mode communication. It is designed to be used as a starting point when creating a custom rapid prototyping target, or for validating the generated code on your workstation.

Generic Real-Time Malloc (GRTM) Target.   This target is similar to the GRT target but it uses the real-time malloc code format. This format uses the C malloc and free routines to manage all data. With this code format, you can have multiple instances of your model and/or multiple models in one executable.

Tornado Target.   The Tornado target uses the real-time or real-time malloc code format. A set of run-time interface files are provided to execute your models on the Wind River System's real-time operating system, VxWorks. The Tornado target supports singletasking, multitasking, and hybrid continuous and discrete-time models.

The Tornado run-time interface and device driver files can also be used as a starting point when targeting other real-time operating system environments. The run-time interface provides full support for external mode, enabling you to take full advantage of the debugging capabilities for parameter tuning and data monitoring via graphical devices.

DOS Target.   The DOS target (provided as an example only) uses the real-time code format to turn a PC running the DOS operating system into a real-time system. This target includes a set of run-time interface files for executing the generated code. This run-time interface installs interrupt service routines to execute the generated code and handle other interrupts. While the DOS target is running, the user does not have access to the DOS operating system. Sample device drivers are provided.

The MathWorks recommends that you use the Real-Time Windows Target or the xPC Target as alternatives to the DOS Target. The DOS target is provided only as an example and its support will be discontinued in the future.

OSEK Targets.   The OSEK target (provided as an example only) lets you use the automotive standard open real-time operating system. The run-time interface and OSEK configuration files that are included with this target make it easy to port applications to a wide range of OSEK environments.

Embedded Targets

The embedded real-time target is the main component of the Real-Time Workshop Embedded Coder. It consists of a set of run-time interface files that drive code, generated in the embedded code format, on your workstation. This target is ideal for memory-constrained embedded applications. Real-Time Workshop supports generation of embedded code in C.

In its default configuration, the embedded real-time target is designed for use as a starting point for targeting custom embedded applications, and as a means by which you can validate the generated code. To create a custom embedded target, you start with the embedded real-time target run-time interface files and edit them as needed for your application.

In the terminology of Real-Time Workshop, an embedded target is a deeply embedded system. Note that it is possible to use a rapid prototyping target in an embedded (production) environment. This may make more sense in your application.


  Code Formats Code Generation Optimizations