Release 11 New Features      

Real-Time Workshop 2.2

Asynchronous Processes

The Real-Time Workshop added support for asynchronous interrupt handling in VxWorks and provides templates so that you can create your own interrupt handlers for your target hardware. These blocks include:

For a discussion of asynchronous processes, see the chapter on RTWlib in the Real-Time Workshop User's Guide (online version).

RTWlib

The Real-Time Workshop now has a graphical user interface (GUI), called RTWlib, for quick access to:

The GUI is located in the "Blocksets and Toolboxes" Library in the Simulink window. For more information about RTWlib, see the Real-Time Workshop User's Guide.

Merge Block Added

The new Merge block merges multiple signals into one for reduced memory utilization and increased model flexibility.

Level 2 S-Functions

Real-Time Workshop 2.2 supports Level 2 S-functions. In particular, these Level 2 S-functions support:

Target Language Compiler (TLC) Enhancements

This section describes enhancements to the Target Language Compiler that is included as part of the Real-Time Workshop.

Passing Parameters: mdlRTW and RTWData

The Real-Time Workshop generates a model.rtw file that is a description of the model. There are two additional methods of passing user-specified information into the model.rtw file:

mdlRTW.    Level 2 S-functions can use the mdlRTW function to pass information from a C-MEX S-function into the model.rtw file for use during code generation.

The information that the mdlRTW function writes to model.rtw is used by the block target file for that block type. The writer of the block target file can use the additional identifier/value pairs as desired. For all the possible functions that you can use inside mdlRTW to generate information in the model.rtw file, see the file matlabroot/simulink/src/sfuntmpl.doc. See Chapter 8 of Using Simulink for a discussion of how to write an mdlRTW function.

Below is an example of how to use mdlRTW in a Level 2 S-function.

This code contains the resulting model.rtw information:

RTWData.    RTWData is a parameter that you can set on Simulink blocks using the set_param() command and view with the get_param() command. The parameter/value pair is saved along with the model.

The command syntax is

where gcb is the current block pathname. The variable userdata must be a MATLAB data structure where each element is a string. For example:

When attached to a nonvirtual block, the associated model.rtw information for the block is:

The block target file for that block type can process the information as desired. For example, if RTWData is attached to a S-function, the TLC inlining file for the S-function could process the information in the BlockInstanceSetup function.

Besides nonvirtual blocks, RTWData can be attached to one special case of a virtual block, an empty subsystem. This allows information the be passed into the model.rtw without it being associated with a specific nonvirtual block. This is useful when some block-independent information needs to be passed into model.rtw for use during code generation. For empty subsystems, the RTWData parameter is placed in the System record for the nonvirtual system in which the empty subsystem is contained.

Because the empty subsystem technique is used by the Custom Code block of the RTWLib, there is support built into the system target files to handle RTWData attached to empty subsystems. Specifically, if an EmptySubsysInfo record exists, all RTWdata subrecords are checked for the existence of an identifier named TLCFile. If the identifier exists, the value of TLCFile is used as a block target filename and the TLC function ProcessRTWdata in that file is called using the TLC GENERATE directive. This functionality can also be used by other (user-written) blocks if desired.



[ Previous | Next ]