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-02284// Views: AA-02284// Created: 2024-03-06 09:12:54// Last Updated: 2024-03-06 09:53:23
HowTo
How to do Carsim RT-LAB eHS co-simulation

 Software installation

Software version:

RT-LAB 2023.1

Matlab 2020b

Eclipse 2017 (For Carsim)

Carsim 2022.1

(NI Platform Carsim PE Addon co-simulation https://www.opal-rt.com/support-knowledge-base/?article=AA-02282)

Carsim 


  1. create database with selected groups, in our case, RT_RT-LAB.cpar are necessary:

2. Build Database from selected items will ask where do you want the database to be.

  • Install Carsim solver to OPAL-RT RT-LAB system target (Tools - install RT solvers to target)



Set Matlab version used with Carsim:


Default Demo Test

    Carsim + RT-LAB

    • Open Carsim demo
    • "Pre-run" in Carsim
    • ''Open" in Carsim, check and run Simulink model offline
    • Open model in RT-LAB to make sure there's no bad link, which Carsim S-function should exist. Run model offline and save. (edit from RT-LAB opens one more Matlab, it might not updated in time after saving from Carsim)
    • Once it is validate that model is build in RT-LAB, it can also be "run" directly from Carsim (or "start the live video" in Carsim and run from RT-LAB)



    Carsim + RT-LAB eHS Co-simulation Model Creation

    Carsim 

    1. Take out the motor and power management control from the powertrain.


     

    2. Make IO channels

    • Create IO ports from the Micellanse, create new dataset and link to the current model dataset to update the available variables
    • To check the available input/output variables and their descriptions, we can also view from the Excel 


    Example: For driver in the loop test model, driver and the torque controller is outside Carsim. The Carsim input ports interact with the rest of the model (Simulink, eHS) are:

    3. Import Carsim to RT-LAB model

    After modeling done in Carsim, including the I/O settings

    "Pre-Run" will send Carsim run files to Simulink model path.

    In the Simulink model, we just need to add the Carsim S-function Block and connect the ports to the rest of the model



     Frequent problems and solution

     1. Model works offline and passed code generation in Simulink. It somehow related to RT-LAB and Carsim. Close and reopen RT-LAB

    2. "Pre-run" and open model from Carsim. Then build again in RT-LAB