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:

    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. Try alternate MATLAB invocation method. In Reactis:

    1. Select File > Global Settings…

    2. 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.

    3. Try to start Reactis Tester. If unsuccessful, goto step 3.

  3. 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 4.

  4. 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 5.

  5. 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 6.

  6. 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
    
    1. 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.

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.

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:

  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.