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-01989// Views: AA-01989// Created: 2021-01-30 22:20:36// Last Updated: 2021-02-02 14:19:42
Problem & Solution
Toolboxes : OPAL-RT/RT-LAB Toolboxes and Libraries on MATLAB

Toolboxes : OPAL-RT/RT-LAB Toolboxes and Libraries on MATLAB

This article covers multiple different situations where the user has difficulties using OPAL-RT/RT-LAB Toolboxes on MATLAB.

Problems

A) After a fresh installation of RT-LAB, when I open MATLAB and enter the command 'ver' I am not able to see the Toolboxes. 


B) When opening RT-LAB models on Simulink, some blocks doesn't appears, I get errors or "bad links" and I am not able to see the Toolboxes.

Fix Unresolved Library Links - MATLAB & Simulink

C) When opening a MATLAB model I get Undefined function or variable 'matlab.internal.environment.context.isMATLABOnline'.



Answers

First, it is recommended to install MATLAB before RT-LAB. If you installed MATLAB after or installed a new release of MATLAB on your computer we recommend to go through this article to make sure everything is set properly.

A&B General workflow :

1) Open the selected/new MATLAB version from RT-LAB.



2) From the Windows Explorer or MATLAB file explorer navigate to the paths that matches with the missing libraries :

  • ARTEMIS Blockset: C:\OPAL-RT\ARTEMIS\[ARTEMIS version]\art_m\setup_artemis.m
  • RT-LAB:                    C:\OPAL-RT\RT-LAB\[RT-Lab version]\simulink\m\setup_rtlab.m
  • RT-XSG:                    C:\OPAL-RT\RT-XSG\[RT-XSG version]\Simulink\xsg_Rxx\m\setxsgpath.m
  • RT-EVENTS:              C:\OPAL-RT\RT-EVENTS\[RT-EVENTS version]\rte_m\setup_rtevents.m
  • eFPGASIM:               C:\OPAL-RT\eFPGAsim\[eFPGASIM version]\Matlab\Setup\setup_efpgasim.m

3) Make sure your startup routine is properly set. In the MATLAB command Window : 

>> which startup

  • Should give you the result :

C:\Program Files\MATLAB\[RXXXXX version]\toolbox\local\startup.m

If you open the script it should contain the following :

try, setup_rtlab; catch, disp('Unable to setup RT-LAB correctly'); end

try, setup_artemis; catch, disp('Unable to setup ARTEMIS correctly'); end

try, setup_rtevents; catch, disp('Unable to setup RT-EVENTS correctly'); end

try, setup_rtxsg; catch, disp('Unable to setup RT-XSG correctly'); end

try, setup_efpgasim; catch, disp('Unable to setup eFPGAsim correctly'); end

  • If you get :

startup not found

Execute the MATLAB command "rehash toolboxcache" (This is equivalent to clicking the Update Toolbox Path Cache button in the General Preferences dialog box.) cf. https://www.mathworks.com/help/matlab/matlab_env/toolbox-path-caching-in-the-matlab-program.html

If persist please reapply step 2)

4) If you still do not see the libraries in the Simulink Browser after typing 'RT-LAB' or 'OPAL-RT'. You might have the following option to fix the libraries :


If not, inside the MATLAB command window, please type:

>> libBrow = LibraryBrowser.StandaloneBrowser; libBrow.refreshLibraryBrowser

Please allow a few seconds/minutes for MATLAB to make the necessary refresh.

Once it has completed, please open the Simulink library browser and you should be able to see the "Fix" option as shown previously. Please note you may need to restart MATLAB entirely to see the necessary changes.


C Workflows :

1) In MATLAB command window use : restoredefaultpath. Let the command prompt line return, this should takes few minutes. Close Matlab and open your Model again.

2) You can also try to remove pathdef.m from the "C:\Users\YOURUSERNAME\Documents\MATLAB" if there is one present.