2 Working with TargetLink Models in ReactisAs shown in Figure 2, some preparation steps are necessary
before working with a TargetLink model in Reactis. After performing these steps,
users can manipulate TargetLink models in Reactis in the same way native
Simulink models are processed. Namely it is easy to: -
Generate tests from a model with Reactis Tester.
- Simulate and debug models in Reactis Simulator.
- Check that a model meets its requirements with Reactis Validator.
Reactis is compatible with a number of different TargetLink versions including
2.1.6, 2.2.1, 2.3.0, 3.0, 3.1, and 3.2. Most of the model-preparation steps are similar
for the different versions. When differences exist, they are described below.
The biggest difference is that when using version 3.0 or later of the TargetLink
blockset, it is not necessary to switch to the stand-alone blockset as is
required to work with previous versions of the TargetLink blocks in Reactis.
| Figure 2: Preparing TargetLink models for use with Reactis. |
2.1 Reactis-Friendly TargetLink SettingsA few TargetLink settings may need adjustment before working with a model
in Reactis. We describe those settings in this section. 2.1.1 Disabling Block LoggingTargetLink provides a useful mechanism for logging and graphing the output
signals of blocks selected by the user. During or shortly after a simulation
(depending on the version of Targetlink) a window with graphs will appear that
displays the selected signals. This feature is not compatible with Reactis, so
the user should disable the feature as follows:
-
Double-click on the TargetLink block at the top of your model to open
the TargetLink Main Dialog.
- In the Simulation Frame Options section of the
Code Generation tab, select “Do not log anything” as the
“Global logging option”.
Reactis provides alternative ways to view signal graphs when running a model in
Reactis Simulator. 2.1.2 Making Ports VirtualTargetLink inports and outports are used to augment its code generation
capability. The ports frequently serve to define various interface boundaries.
Most of the functionality is interpreted only by the TargetLink code generator,
but in certain situations, the blocks can affect simulation behavior. Certain
settings will cause the dynamic insertion of Data Type Conversion blocks that
are typically invisible to the user (as shown in Figure 3),
but cause problems for Reactis. To prevent this problem, one should configure the block as a pass-through.
This is done as follows:
-
Load the model in Simulink
- Double-click on the TargetLink Inport (or Outport)
- Select the Logging & Autoscaling tab
- Under Simulation Behavior, check the box Virtual Port.
| Figure 3: TargetLink ports should be set to virtual. |
2.2 TargetLink Full-Featured and Stand-alone InstallationsdSPACE offers two ways to install TargetLink on your computer:
full-featured and stand-alone. The full-featured version is intended to be used in the main TargetLink
environment when the objective is code generation or Software-in-the-Loop (SIL)
simulation. The stand-alone installation enables users to simulate TargetLink models in the
Simulink environment, but not generate code or access many of the advanced
TargetLink features. Use of the stand-alone installation does not require a
TargetLink license. When using a full installation it is possible to switch a model back and forth
between the full and stand-alone versions of the TargetLink blocks. Prior to
TargetLink Version 3.0, it was necessary to switch to the stand-alone blockset to
work with a model in Reactis. As of TargetLink 3.0, Reactis is compatible with
both the full-featured and the stand-alone blockset. When using the full blockset, prepare a model for use with Reactis as follows: - Start MATLAB (the version paired with TargetLink)
- At the MATLAB command prompt enter:
tl_switch_blockset
- Load the model in Simulink
- Save the model
To switch back to the full-featured blockset, just enter the
tl_switch_blockset command a second time and save the model.
To determine which blockset is currently active, at the MATLAB
command prompt enter: tl_get_blockset_mode.
The blockset setting is persistent over different MATLAB sessions,
so this step need not be performed each time a model is opened in
Reactis. 2.3 Selecting the MATLAB Version in ReactisReactis can be configured to use a specific version of MATLAB/Simulink as follows: -
Start Reactis
- Select File->Settings...
- In the resulting Settings dialog, select the MATLAB tab and then
select the appropriate MATLAB version using the pulldown menu.
- Click OK to dismiss the Settings dialog.
2.4 Configuring the Reactis PathLike MATLAB, Reactis maintains a path variable consisting of a list of folders to be searched
for various files used by a model. These files include libraries, including the TargetLink libraries.
Unlike MATLAB, Reactis maintains both a global and a model-specific path. The model-specific path
is prepended to the global path to construct the full search path used with a model. When using Reactis with TargetLink, we recommend updating the model-specific
path to include the folders containing the TargetLink libraries. The following
steps set the model-specific path:
-
Make sure the model loads and simulates properly in the Simulink environment.
- Start Reactis and load the model.
- Select Edit->Search Path...
- Click the Import button. This will cause Reactis to:
-
load the model in Simulink (executing any initialization files that might update the path),
- query Simulink for the resulting path for the model,
- add the returned MATLAB path to the model-specific Reactis path for the model.
- Select File->Save to save the updated path into the .rsi file maintained by
Reactis for the model.
The model-specific path should now include the dSPACE directories required to simulate
a TargetLink model. 2.5 Pitfalls to Avoid2.5.1 Nonstandard Switching Between TargetLink VersionsEach time a user installs TargetLink, it is mapped to one distinct
MATLAB® 1 installation. Additionally, TargetLink must be activated for
one specific MATLAB installation before using it. Before using TargetLink
models in Reactis, the user should make sure TargetLink is activated for the
version of MATLAB intended for use with Reactis. To select the desired TargetLink version, use the dSPACE Installation Manager
application. A reboot of the computer may be required to complete the process.
Some users create scripts to quickly switch between installations of TargetLink.
Unfortunately, these scripts are not compatible with Reactis, so the user should
use the normal TargetLink activation procedure with the dSPACE Installation
Manager. 2.5.2 Incidental TargetLink DialogsBecause Reactis reads and interprets TargetLink models, occasionally a
TargetLink dialog will appear that requires user interaction. Typically, the
user will only need to close the dialog or click OK. But it is important the
user remain attentive to these dialogs as they may suspend further processing of
the model.
| Figure 4: Some warning dialogs might appear, but can be dismissed. |
|