Support : Knowledge base

Knowledge Base

Welcome to OPAL-RT’s Knowledge Base

OPAL-RT offers a repository of support information for optimal use of its technology.

Loading…

Please note that OPAL-RT knowledge base is not fully optimized for mobile platforms.

For optimal experience, use a desktop computer.

Reference Number: AA-01519// Views: AA-01519// Created: 2018-08-09 21:18:17// Last Updated: 2023-01-11 04:02:01
HowTo
Separation issue " ??? Error using OpInitFunction>CheckSimulinkError" -- How to Separate a Model in MATLAB to Troubleshoot RT-LAB Compilation Errors

How to Separate a Model in MATLAB to Troubleshoot RT-LAB Compilation Errors

The first step in RT-LAB model compilation is the separation of the model subsystems into individual Simulink .mdl files.  When model separation is successful, the console output of RT-LAB will report that the "Starting compilation" step of the compilation has been "Completed Successfully," as shown in Figure 1 below.



Figure 1: Example console output of a successful model separation


If an error is encountered during this step of the compilation, the model separation can be performed directly in MATLAB to obtain more information about the error and help for its troubleshooting.

To separate a model in MATLAB:

  1. Close all open instances of MATLAB and Simulink
  2. Open the model directory and make sure the Opcommon folder exists (as per \My_workspace\project_name\model_name\Opcommon)
  3. Make sure in the model directory there is no *.sep file, this prevent the separation to start (delete if present)
  4. Open the project in RT-LAB
  5. Right-click the model in the RT-LAB Project Explorer and click Edit to open the model in Simulink
  6. Verify that the MATLAB working directory is pointing to the location of the model file on disk, as shown in Figure 2
  7. Run the model offline, stop it, save it and close it. Your model needs to be closed for the opInitFunction to work properly.
    Otherwise, you may face the following error:

  8. In the MATLAB console, enter the command opInitFunction
  9. If the separation fails in MATLAB, please contact OPAL-RT Support and provide screenshots of the console output or error messages for assistance troubleshooting the issue



Figure 2: Successful model separation in MATLAB