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-02282// Views: AA-02282// Created: 2024-03-06 08:29:43// Last Updated: 2024-03-06 09:37:23
HowTo
How To do Carsim + Simulink + PE Addon co-simulation

Software installation

Software version:

VeriStand 2020 R6/PEA v1.10 Getting Started

LabView 2020SP1

Matlab 2020b

Eclipse 2017 (For Carsim)

Carsim 2022.1

(RT-LAB Platform Carsim eHS cosimulation: https://www.opal-rt.com/support-knowledge-base/?article=AA-02284)



Unit Test

VeriStand

  1. Engine demo on NI linux

             2. PEA demo Examples

Carsim 

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

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


  • Install Carsim solver to NI target

*Set Matlab version used with Carsim:

Demo test

  1. Quick start baseline (Carsim on localhost)


2. NI-RT Basline (FMU)

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 PEA are:

VeriStand

  • Import Carsim to VeriStand (.fmu or .so file for NI Linux) 

The corresponding file will be generated/build to the .fmu file path or .so file will be under the VeriStand project.

  1. .so


2. .fmu

In VeriStand, it can then be added to the Simulation same as Simulink model.

  • Add the .so/.fmu to VeriStand project:


  • Make connections between PEA and Carsim/Simulink in Veristand
  • After all settings done, deploy to run the model.

Tips on how to determine the output variables while replacing motor and power management system from Carsim demo:

  1. run the Carsim demo offline first and get the reference data/variables waveform
  2. change the demo to run on NI Platform, add IO outputs for variables that insterested in or related to the component. (This is useful for one that is not familiar with Carsim variables and Vehicles) Run the model in Veristand project and check the variables
  3. Take out the motor, power management system or any other that is needed, run the model again to check and verify what variables remains the command signals from the driver system to output to control the motor

Example: replacing motor and power management system of the Carsim demo "CrossWind, Low Mu" 

  1. run Carsim demo offline and NI Platform 

2. Add output IOs and run in VS

3..Take out the motor/power manage system and run to check outputs. In our case to use the exsiting model, the powertrain of the car is changed to electrical.

It is noticed the car still have forward speed with motor and power management system absent. It happens when the target forward speed is constant at the very beginning. It is equivalent of no motivation and the begining and the car will slowly proceed with initial speed. We can specify 0  at begining and ramp to a constant.

Or since for co-sim the PEA motor is existing at the beginning, it can also be set as a constant as initial. It is recommended to do so in our case.

We can see the speed control use the parameter Ax_SCrq. And it remains without motor/power management system. This will then be the command signals to interact with external motor and controller. (The relationship between Ax_SCrq and Iqref is not yet investigated in details. For now a number with trial and error is used to achieve the target speed. The gain mainly affect the accelerate speed)

4. Add input ports to interact with external motor and power management, keep as "add" first to run the model and make sure there's no errors.

5. Add PEA model in Veristand and the extra controller, which in this case build in Simulink.

6. Map the connections and change the inports of Carsim model to "replace"



Frequent problems and solution

Veristand Deploy issue Power Electronics Add-On for VeriStand: Error 8302 with Exit Code -1 when Loading SPS Circuit Model

    NI-RT_Guide.pdf 1.6 Mb 1.6 Mb