Loading Models in Reactis#
What model preparation needs to be done to run Tester?#
In brief, you should:
All workspace data items used by a model are automatically loaded when loading the model in Simulink. There are several ways to automatically load the data items:
From a callback function of the model that gets automatically executed by Simulink when loading or running the model (for example the model’s PreLoadFcn)
From a startup.m script located in the directory in which the model is located. To make Reactis execute the startup.m script, make sure to check the Execute startup.m and pathdef.m scripts in model folder option on the MATLAB tab in Reactis’ Global Settings dialog.
From the “Pre-Load Function” setting in Reactis. Load your model in Reactis and then select the Edit > Callbacks… menu. You can enter MATLAB code in either of the text boxes available on that page.
Ensure that the model does not use unsupported Simulink blocks or other MATLAB or Stateflow features currently not supported by Reactis. For a list of features supported by Reactis, see Chapter Preparing Models for Use with Reactis of the Reactis User’s Guide. Alternatively, you can just try to run Tester (or start Simulator) at which time any unsupported blocks in your model will be flagged.
Optionally, you may restrict the values that may arrive at top-level inports of the model during test-generation. For details on how to do this please see Chapter The Reactis Info File Editor. In brief, do the following:
Load your model in Reactis.
Select menu item Edit > Inport Types…
In the resulting window, double-click on the row corresponding to the inport you wish to constrain. A dialog will appear for specifying the set of values the inport may assume.
Why do I get Reactis was unable to invoke MATLAB when I try to simulate or generate tests in Reactis?#
When importing models for test generation or simulation, Reactis invokes MATLAB in the background to perform various tasks. When you see the above error, this indicates that Reactis encountered a problem when it attempted to invoke MATLAB. If this occurs, try the following troubleshooting steps.
What type of MATLAB license do you have?
Floating. Is license available?
Yes. Goto step 2.
No. Wait for MATLAB license to become available.
Not floating. Goto step 2.
Try alternate MATLAB invocation method. In Reactis:
Select File > Global Settings…
In MATLAB tab, change the Invoke MATLAB via setting. We currently recommend the Full MATLAB window setting, but if that does not work try the others.
Try to start Reactis Tester. If unsuccessful, goto step 3.
Unregister the MATLAB engine server.
Open a DOS command window in administrator mode. You can do this by right-clicking on the Command Prompt entry in the Windows Start Menu and selecting Run as Administrator.
In the command window, type: matlab /unregserver
Try to start Reactis Tester. If unsuccessful, goto step 4.
Increase the length of time Reactis will wait for response from MATLAB before timing out.
In Reactis, select File > Global Settings…, then MATLAB tab
Set Invoke MATLAB via to MATLAB engine interface via C API
Make sure Reuse existing MATLAB command windows is checked.
Increase MATLAB startup timeout (seconds) from its default value of 120.
Try to start Reactis Tester. If unsuccessful, goto step 5.
Toggle setting to reuse MATLAB command windows.
In Reactis, select File > Global Settings…, then MATLAB tab
Toggle the checkbox Reuse existing MATLAB command windows.
Try to start Reactis Tester. If unsuccessful, goto step 6.
Check for faulty MATLAB installation.
Create a text file named MATLAB_automation.vbs and enter the following lines in the file:
Option Explicit DIM MATLAB_Shell DIM var_version set MATLAB_Shell=CreateObject("Matlab.Application") var_version=MATLAB_Shell.Execute("ver") Wscript.Echo var_version
Start the script by double-clicking on the file’s icon. Does a small dialog appear listing the MATLAB version and installed toolboxes?
Yes. MATLAB installation is not faulty. Please send email to help@reactive-systems.com and include the error message you get when you try to start Reactis Tester.
No. Indicates a faulty MATLAB installation. Please contact MathWorks technical support and tell them that the script does not run.
Can Reactis process models containing S-Functions?#
Yes. In the base Reactis product, S-Functions can be executed, but they are treated as black boxes, and coverage of targets within S-Functions (for example, branches) is not tracked.
The Reactis for C Plugin integrates seamlessly with Reactis to offer white-box testing and validation of the C-code portions of models (S-Functions, C Caller blocks, and C code called from Stateflow). Together, Reactis for Simulink and Reactis for C Plugin automate the generation of test data from, and validation of models constructed with Simulink, Stateflow, and C code.
A separate license is required to use the Reactis for C Plugin. If your organization does not yet own such a license please contact sales@reactive-systems.com to inquire about purchase options or to obtain a demo license for the product. Reactis for C Plugin requires base Reactis for Simulink to run.
Can Reactis process models containing embedded MATLAB?#
Yes. Reactis V2012 added support for Embedded MATLAB (EML) code. Note, currently a subset of the full language is supported, i.e. not all functions, data types and features of the EML language are supported. Support for additional features of the language are gradually being added. Please see Section 15.4 of the Reactis User’s Guide for a list of currently supported features.
Embedded MATLAB support in the base Reactis for Simulink product is black-box only, meaning Reactis can execute the code but it is not possible to track coverage or to single-step through the code within Reactis. If you purchase the Reactis for EML Plugin, you obtain white-box support including coverage tracking and stepping through EML code.
Does Reactis support Simulink block “X”?#
Chapter Preparing Models for Use with Reactis of the Reactis User’s Guide contains a description of which MATLAB/Simulink/Stateflow features are supported by Reactis. Please see Section 15.2.3 of the Reactis User’s Guide for a table detailing which blocks are supported specifically.
Can Reactis process models containing TargetLink blocks?#
Yes. TargetLink is an automatic code generator produced by dSPACE GmbH. Reactis for Simulink can generate tests for models constructed with the TargetLink blockset and these tests can be run on TargetLink-generated code in Reactis for C. Reactis currenlty supports TargetLink versions 3.0 through 2023-B.
Can Reactis process multi-rate models?#
Yes. Reactis interprets sample times defined in your model exactly as Simulink does.
When I try to load my model file I get an error message like Couldn’t find library file simulink.mdl. Why?#
In order to process Simulink models, Reactis needs access to the block libraries included in the Simulink distribution. These libraries are not libraries in the traditional, systems-programming sense of the word (i.e. they are not .dll files); rather, they are plain-text files that Simulink treats as libraries. For this reason, the MATLAB installer does not add the folders containing these files to the Windows search path. Reactis therefore must maintain its own search path for these folders. The likely source of the error is that your Reactis search path does not contain the relevant entry. To check whether or not this is the case, select the File > Settings… menu from the top-level Reactis window. The Path tab of the resulting dialog includes a list of folders. One of the entries should have the form
MATLABHOME\toolbox\simulink\blocks
(for MATLAB R2010b or earlier), or
MATLABHOME\toolbox\simulink\blocks\library
(for MATLAB R2011a or later) where MATLABHOME is the name of the main MATLAB installation folder. The default name for the installation folder is:
c:\Program Files\MATLAB\R2017b
For 32-bit installations the location is:
c:\Program Files (x86)\MATLAB\R2015b
If the relevant entry is missing from your Reactis library path, then click the Add button and add the missing folder.
Note that the Reactis installer automatically adds the necessary directories to the search path, so re-installing Reactis should resolve the problem.
I get errors loading my model into Reactis, even though the model loads without problem into Simulink. Why?#
There are two possible causes of this problem.
Some required folders are missing from your Reactis path. To resolve the problem, add the missing folders to the Reactis path. Note that the Reactis path consists of two parts:
A global path set from the Reactis Settings dialog, and
A model-specific path set from the Reactis Info File Editor.
Note that the dialogs for setting both the global and model-specific paths include an Import button that allows the MATLAB path to be imported into Reactis. This can be useful in the case where the model already loads properly in MATLAB.
You have multiple versions of MATLAB installed and the version of MATLAB that Reactis is invoking is different from the version of MATLAB in which the model is working. To resolve the problem, consult the MATLAB tab of the Reactis Settings dialog to check that the Use MATLAB version pulldown specifies the version of MATLAB that you intend for Reactis to invoke.
Why doesn’t Reactis recognize a workspace variable in my model?#
Although Reactis may invoke MATLAB to perform some tasks, Reactis does not directly interact with an executing MATLAB session in the same way that Simulink does. Consequently, any workspace data items that a model uses must be attached to a model in a way such that they are automatically initialized when the model is loaded. There are several ways to automatically load the data items:
From a callback function of the model that gets automatically executed by Simulink when loading or running the model (for example the model’s PreLoadFcn)
From a startup.m script located in the directory in which the model is located. To make sure Reactis executes the startup.m script, make sure to check the Execute startup.m and pathdef.m scripts in model folder option on the MATLAB page in Reactis’ settings dialog.
From the Pre-Load Function setting in Reactis. Load your model in Reactis and then select the Edit > Callbacks… menu. You can enter MATLAB code in either of the text boxes available on that page.
For example: for the cruise-control model included in the Reactis release, the file cruise_constants.m defines two workspace variables that are used in cruise.slx. One attaches cruise_constants.m to cruise.slx as follows:
Load cruise.slx in Simulink.
From the Simulink window, select the File > Model Properties menu item.
In the resulting dialog, select the Callbacks tab.
In the Model pre-load function entry box enter cruise_constants. (note the .m suffix is omitted)
Save the model.
Why do I get a Mismatched Simulink version warning?#
This warning is issued when you load a model that was created with a version of Simulink that differs from the version that Reactis is configured to use. There are a couple of ways to eliminate the warning.
Configure Reactis to use the version of Simulink with which the model was created. Note, however that this solution changes the Simulink version used by Reactis for all models. Change the Simulink version used by Reactis as follows.
Start Reactis.
Select menu item File > Settings…
Select the MATLAB tab of the Settings dialog.
In the Use MATLAB version menu, select the version of MATLAB/Simulink used by the model. The versions of Simulink installed on your machine are listed in the menu.
Click Ok to save the change.
If the Simulink version used to create the model is older than the version used by Reactis, then you can convert the model to the version of Simulink that Reactis is configured to use. Do this as follows.
Start the version of MATLAB used by Reactis.
Load the model.
Save the model.