Real-Time Workshop Release Notes |
New Features
This section introduces the new features and enhancements added in the Real-Time Workshop 4.1 since the Real-Time Workshop 4.0.
For information about Real-Time Workshop features that are incorporated from recent releases, see Release Summary.
Note For information about closely related products that extend the Real-Time Workshop, see the Release Notes sections about the Real-Time Workshop Embedded Coder and xPC Target. |
Block Reduction Option On by Default
The Block reduction option (on the Advanced page of the Simulation Parameters dialog box) is now turned on by default. In prior releases, this option was off by default.
Block reduction collapses certain groups of blocks into a single, more efficient block, or removes them entirely. This results in faster model execution during simulation and in generated code.
See Block Reduction Option in the Real-Time Workshop User's Guide for further information.
Buffer Reuse Code Generation Option
The Buffer reuse option is now available via the General Code Generation Options (cont.) category of the Real-Time Workshop page. When the Buffer reuse option is selected, signal storage is reused whenever possible.
In previous releases, this option was available only through MATLAB set_param
and get_param
commands, such as:
The set_param
and get_param
commands are still supported.
See Buffer Reuse Option and Signals: Storage, Optimization, and Interfacing in the Real-Time Workshop User's Guide for further information.
Build Directory Validation
The build process now disallows building programs in the MATLAB directory tree. If you attempt to generate code in the MATLAB directory tree, an error message will be displayed prompting you to change to a working directory that is not in the MATLAB directory tree. On a PC, you can continue to build in the directory matlabroot
/Work
.
The build process also prevents building programs when matlabroot
has a dollar sign ($
) in its MATLAB directory name.
Build Subsystem Enhancements
The Build Subsystem feature, introduced in Real-Time Workshop 4.0, lets you generate code and build an executable from any nonvirtual subsystem within a model. In Real-Time Workshop 4.1, the Build Subsystem feature has been enhanced as follows:
See Generating Code and Executables from Subsystems in the Real-Time Workshop User's Guide for further information.
C API for Parameter Tuning Documented
The Real-Time Workshop provides data structures and a C API that enable a running program to access model parameters without use of external mode. This API has now been fully documented.
To access model parameters via the C API, you generate a model-specific parameter mapping file, model_pt.c
. This file contains parameter mapping arrays containing information required for parameter tuning.
See C API for Parameter Tuning in the Real-Time Workshop User's Guide for information on how to generate and use the parameter mapping file.
Code Readability Improvements
Improvements to the readability of generated code include:
Control Flow Blocks Support
Simulink 4.1 implements a number of blocks that support logic constructs such as if-else and switch, and looping constructs such as do-while, for, and while. The Real-Time Workshop 4.1 supports code generation from these blocks.
For further information on the flow control blocks, see Control Flow Statements in Using Simulink.
Expression Folding
Expression folding is a code optimization technique that minimizes the computation of intermediate results at block outputs, and the storage of such results in temporary buffers or variables. Wherever possible, the Real-Time Workshop collapses, or "folds," block computations into single expressions, instead of generating separate code statements and storage declarations for each block in the model.
Expression folding dramatically improves the efficiency of generated code, frequently achieving results that compare favorably to hand-optimized code. In many cases, model computations fold into a single highly optimized line of code.
Most Simulink blocks support expression folding.
For further information, see Expression Folding in the Real-Time Workshop User's Guide.
Inline Parameters Support
The Real-Time Workshop now lets you use the Inline parameters code generation option when building an external mode target program. When you inline parameters, you can use the Model Parameter Configuration dialog to remove individual parameters from inlining and declare them to be tunable. This allows you to improve overall efficiency by inlining most parameters, while at the same time retaining the flexibility of run-time tuning for selected parameters that are important to your application. In addition, the Model Parameter Configuration dialog offers you options for controlling how parameters are represented in the generated code.
Each time Simulink connects to a target program that was generated with Inline parameters on, the target program uploads the current value of its tunable parameters (if any) to the host. These values are assigned to the corresponding MATLAB workspace variables. This procedure ensures that the host and target are synchronized with respect to parameter values.
All targets that support external mode (i.e., grt
, grt_malloc
, and Tornado) now allow inline parameters.
See Overview of External Mode Communications in the Real-Time Workshop User's Guide for further information.
Status Bar Display
When Simulink is connected to a running external mode target program, the simulation time and other status bar information is now displayed and updated just as it would be in normal mode.
Generate Comments Option
This option lets you control whether or not comments are written in the generated code. See Generate Comments in the Real-Time Workshop User's Guide for further information.
Include System Hierarchy in Identifiers
When this option is on, the Real-Time Workshop inserts system identification tags in the generated code (in addition to tags included in comments). The tags help you to identify the nesting level, within your source model, of the block that generated a given line of code.
See Include System Hierarchy in Identifiers in the Real-Time Workshop User's Guide for further information.
Rapid Simulation Target Supports Inline Parameters
The Rapid Simulation Target now works with Inline parameters on. Note that when Inline parameters is on, the storage class for all parameters and signals is silently forced to auto
.
S-Function Target Enhancements
The S-Function Target Generate S-function feature, introduced in Real-Time Workshop 4.0, lets you generate an S-function from a subsystem. This feature has been enhanced as follows:
See Automated S-Function Generation in the Real-Time Workshop User's Guide for details.
Storage Classes for Block States
For certain block types, the Real-Time Workshop lets you control how block states in your model are stored and represented in the generated code. Using the State Properties dialog, you can:
For further information, see Block States: Storing and Interfacing in the Real-Time Workshop User's Guide.
Support for tilde (~) in Filenames on UNIX Platforms
All filename fields in Simulink now support the mapping of the tilde (~) character in filenames. For example, in a To File block you can specify <code>~/outdir/file.mat</code>
. On most systems, this will expand to /home/$USER/outdir/file.mat
. The Real-Time Workshop uses the expanded names.
Target Language Compiler 4.1
This section summarizes changes that have been made to the Target Language Compiler in this release. See also TLC Compatibility Issues.
New TLC Debugger
The TLC debugger helps you identify programming errors in your TLC code. The debugger lets you set breakpoints in your TLC code, execute TLC code line-by-line, examine and change variables, and perform many other useful operations.
The TLC debugger operates during code generation, incurring almost no overhead in the code generation process. You can invoke the debugger:
%breakpoint
statements in your TLC file.
tlc
command, as in
For further information, see Debugging TLC in the Target Language Compiler Reference Guide.
model.rtw File Format Changes
The format of the model
.rtw
file has changed. See TLC Compatibility Issues.
Cleanup of Block I/O Connection Handling in TLC
The handling of signal connections in rtw/c/tlc/blkiolib.tlc
and rtw/ada/tlc/blkiolib.tlc
was reworked. See the discussion of LibBlockInputSignal
in TLC Function Library Reference in the Target Language Compiler Reference Guide.
Literal String Support
If a string constant is prefixed by the L
format specifier, then no escape character processing is performed on that string. This is useful for specifying PC style path or directory names, as in this example.
New TLC Library Functions
The following functions have been added to the TLC Function Library:
LibBlockInputSignalConnected
LibBlockInputSignalLocalSampleTimeIndex
LibBlockInputSignalOffsetTime
LibBlockInputSignalSampleTime
LibBlockInputSignalSampleTimeIndex
LibBlockOutputSignalOffsetTime
LibBlockOutputSignalSampleTime
LibBlockOutputSignalSampleTimeIndex
LibBlockMatrixParameterBaseAddr
LibBlockParameterBaseAddr
LibBlockNonSampledZC
See TLC Function Library Reference in the Target Language Compiler Reference Guide for information on these functions.
TLC Bug Fixes
ISINF
, ISNAN
, and ISFINITE
functions now work for complex values.
%filescope
directive now works as documented.
ROLL_ITERATIONS
was called outside of a %roll
construct. ROLL_ITERATIONS
returns NULL
if called outside of a %roll
construct.
\
or /
as a path separator character on Unix or Windows).
0.0
now compares equal to -0.0
.
Real-Time Workshop 4.1 Release Notes | Bug Fixes |