FAQ: Reactis for Simulink - 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 executes the startup.m script, make sure 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 of the Reactis User's Guide. In brief, do the following:
    1. Load your model in Reactis.
    2. Select menu item Edit -> Inport Types...
    3. 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.

  1. 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.
  2. Are you using Reactis V2014 or later and MATLAB R2012a or later?
    • Yes. Goto step 3.
    • No. Goto step 4.
  3. Try alternate MATLAB invocation method. In Reactis:
    1. Select File -> Global Settings...
    2. In MATLAB tab set Invoke MATLAB via to Windows COM interface
    3. Try to start Reactis Tester. If unsuccessful, goto step 4.
  4. Unregister the MATLAB engine server.
    1. 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.
    2. In the command window, type: matlab /unregserver
    3. Try to start Reactis Tester. If unsuccessful, goto step 5.
  5. Increase the length of time Reactis will wait for response from MATLAB before timing out.
    1. In Reactis, select File -> Global Settings..., then MATLAB tab
    2. Set Invoke MATLAB via to MATLAB engine interface via C API
    3. Make sure Reuse existing MATLAB command windows is checked.
    4. Increase MATLAB startup timeout (seconds) from its default value of 120.
    5. Try to start Reactis Tester. If unsuccessful, goto step 6.
  6. Toggle setting to reuse MATLAB command windows.
    1. In Reactis, select File -> Global Settings..., then MATLAB tab
    2. Toggle the checkbox Reuse existing MATLAB command windows.
    3. Try to start Reactis Tester. If unsuccessful, goto step 7.
  7. Check for faulty MATLAB installation.
    1. 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
        
    2. 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 and C code called from Stateflow). Together, Reactis 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 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. If you are using TargetLink 3.0 or later, you can use the full blockset when working with Reactis. If you are using an older version, then you must use the standalone TargetLink blockset. To switch between the full TargetLink blockset and the standalone blockset, execute tl_switch_blockset from the MATLAB command line prompt. To query the current mode, execute tl_get_blockset_mode.


Can Reactis process multi-rate models?

Yes. Reactis interprets sample times defined in your model exactly as Simulink does.


Why do I get Reactis was unable to load MATLAB shared libraries when I try to simulate / generate tests from my model in Reactis?

For some models, Reactis needs to invoke MATLAB to evaluate expressions from the model. When you see the above error, this indicates that Reactis was unable to locate the part of the MATLAB installation (specifically, the dynamically loaded library [.dll] files) needed to evaluate the expression in question.

One source of the problem may be that you do not have MATLAB available on the machine on which you are running Reactis. You can check this by trying to invoke MATLAB by hand. If you are unable to do so, you must make arrangements to have MATLAB installed.

If MATLAB is installed, please consult the MATLAB tab of the Reactis Settings dialog (accessed by selecting File, Settings... from the top-level Reactis window) to check that the Use MATLAB version pull-down specifies the version of MATLAB that you intend for Reactis to invoke.


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:
    1. A global path set from the Reactis Settings dialog, and
    2. 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 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:

  1. Load cruise.slx in Simulink.
  2. From the Simulink window, select the File, Model Properties menu item.
  3. In the resulting dialog, select the Callbacks tab.
  4. In the Model pre-load function entry box enter cruise_constants. (note the .m suffix is omitted)
  5. 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.

  1. 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.
    1. Start Reactis.
    2. Select menu item File, Settings...
    3. Select the MATLAB tab of the Settings dialog.
    4. 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.
    5. Click Ok to save the change.
  2. 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.
    1. Start the version of MATLAB used by Reactis.
    2. Load the model.
    3. Save the model.