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-02106// Views: AA-02106// Created: 2022-10-26 15:43:27// Last Updated: 2022-10-28 07:05:24
General Article
Execution without Windows | Compilation using Virtual Machine | Execution using Python on the target directly

This article will explain how to:

   - compile a project using a virtual machine

   - transfer the compiled project onto a simulator manually 

   - execute the project using Python 


This article points out a workaround for Linux Host-PC, so the real-time simulation executing PC does not require Windows OS in seven steps:

   1. Installation of a VM

   2. Confirm the VM is working correctly with

   3. Use RT-LAB as advanced User

   4. Compile project via Python script on VM

   5. Create a package out of compiled project

   6. Transfer the package.zip onto your target

   7. Execute python script



    1. Install a VM on the PC, which is compiling the project using Matlab Simulink Compile

       This article is explaining the installation of a Linux Redhat OS into a VM:  Virtual machine with OPAL-RT Redhat Linux

       a. Installation of the OS as described in the guide: 

          - The redhat OS image can be requested via support ticket

          - A VM with opallinux3 can be accomplished as well, please contact support for that.

          - However, this is the most common OS yet, it is worth to check if this is the OS installed on your simulator.

          - The VM OS must match the Simulator OS in order to execute the project later via Python.

          - Please run the following command to check it:

             uname -a

          - And your expected result is opalrt-6.2.1 as shown below:

             

       b. Installation of RT-LAB as described in the guide:

          - RT-LAB on your host-pc will not the detect the VM as a target before having RT-LAB installed.

          - The RT-LAB installation file for Linux targets can be found here:

            C:\OPAL-RT\RT-LAB\20XX.X\target\redhawk\rtlab-redhawk-v20XX.X.0.rpm

           - follow APPENDIX 1 of the Guide to configure the VM as "stand-alone"

          - link the VM as a new target in RT-LAB

          - Request a license file for RT-LAB

    2. Confirm the VM is working correctly

       - use the commands and check expected results:

          uname -a

          

          ps -A | grep MetaController

          

       - VM is added as target in RT-LAB

       - VM state: Up

       - VM License: activated

       - VM IP adress equals ifconfig in VM terminal

       

    3. Use RT-LAB as advanced User

       - Window > Preferences > RT-LAB > Capabilities > check Advanced User 

         

       Advanced Users, you can display the line numbers in Python scripts. Usefull debugging feature!

         

    4. Compile project via Python script on VM

       Setup the RT-LAB project to be executed without Host-PC

          a. Set compiler to gcc by deactivating Intel compiler via the Variables Tab in RT-LAB

            

          b. Uncheck "Handle Console automatically"

            

          c. Disable "automatic file retrieval

            

          d. Make the VM your development node, so the build process will be assigned to the VM

            

          e. Copy paste compilation.py into the project folder and execute the script

              - compilation.py  can be found under: 

                C:\OPAL-RT\RT-LAB\2022.1\Examples\Api\compilation\python\

            - Paste into the script folder of your project C:\RT-LAB_workspace\compile_VM_execute_simulator\scripts

              - Double clicking on the script and execute it via menu band

                

               Expected result in console:

               

             - Another "run" of the python script will overwrite package.zip

    5 .Create a package out of compiled project:

       a. follow the guide on creating a package: https://www.opal-rt.com/support-knowledge-base/?article=AA-01862

        - The example project contains the script create_package.py

        - Execute the script

           Expected result

          

       b. Transfer the package.zip onto your target:

          - Create new directory: mkdir /usr/test 

          - Go into new directory: cd /usr/test

          - Upload package.zip to: usr/test

          - Unzip the package: unzip package.zip

       c. Execute python script:

          - Execute the script using: python2 scripts/3_execute.py

              - script must be executed from /usr/test, as here lies the projet.llp file

              - The script is executing the model for 200 seconds, resets it and closes the project

              - This script forces the model in "software synchronized mode"

              - Expected output: