Documentation Home Page eHS Toolbox Home Page
Pour la documentation en FRANÇAIS, utilisez l'outil de traduction de votre navigateur Chrome, Edge ou Safari. Voir un exemple.

Quick start guide : Run a model on FPGA using the Simscape Electrical Specialized Power Systems (SPS) Toolbox

This workflow supports the OP45XX and OP56XX targets

Creating a new RT-LAB Project

Open RT-LAB and follow these steps to create a new RT-LAB project:

  1. In the main RT-LAB User Interface, navigate to File > New > RT-LAB Project to open a new project wizard.
  2. Enter a project name (e.g. eHS_examples), then click Next.
  3. Browse the template directory to select the model to add it to the project. Open the eFPGASIM folder and select eHS with IOs > OP4510 > eHSx64_with_IOs_on_OP4510 (Simulink).

Click Finish to create the new RT-LAB project in the project explorer.

The eHS_examples project will be created, and the corresponding RT-LAB model will be imported into the project workspace (in this example, the model is named Converter3Phase3LevelNPC_OP4510_rtlab).


Editing the model

Before building the model, verify that you can access and edit the model.

Click on Edit the model in the Preparing and Compiling pane. The model file will be opened in a new MATLAB/Simulink window.


Model description

The model is composed of two main subsystems:

  1. SC_Console: Subsystem executed by the host computer during the simulation to monitor and control the simulation.
  2. SM_Controller_eHS_IOs: Subsystem executed by the target simulator, in real-time, on the system CPU that communicates with the FPGA board and the physical system I/Os.

SC_Console

Double click on the SC_Console to open the SC_Console details window.

SM_Controller_eHS_IOs

Click on the SM_Controller_eHS_IOs to open the SM details window. This window provides a detailed diagram of the master subsystem.

eHS Gen4 CommBlk

The eHS Gen4 CommBlk communicates with the FPGA board to initialize the eHS core. During real-time operation, it provides eHS inputs (the circuit Sources / Gates control signals) and reads the eHS outputs (current and voltage measurements) at the RT-LAB model rate.

The user must provide a circuit file (SPS Simulink model) to declare the circuit that will be simulated inside the eHS core.

In this example, the circuit file is a model named Converter3Phase3LevelNPC.mdl.

Circuit File

The circuit file models an NPC converter. The eHS solver will extract the components netlist from this file and calculate the system equations before running them on the FPGA board.

Validating the Model

Run an offline simulation from the RT-LAB model to ensure that all the library links are resolved using your MATLAB instance.

Verify that the model runs properly.

  • In RT-LAB, check that your target is available in the Targets list, and is up and running (any problems with the target will be displayed by RT-LAB as an icon change and added text after the target name).
  • Right-click your target and select Set as development node

  • Click on the License tab to display the list of software licenses and make sure that XSG_EHS, RTLAB_RT, RTLAB_DEV, RTLAB_XHP and RTE_RT licenses are enabled. You must also have at least
    • RTLAB_NUM_CORES >= 1
    • RTE_NUM_CORES >= 1
    • EHS_TOTAL_PERFORMANCE >= 1
    • One of the following EHS: x128, x64, x32

Building the Model

  1. In the Preparing and Compiling window, click Build the model. The Building Model window appears.
  2. Verify that the model was successfully built by clicking Consult result in Compilation View.

        3. Assign a target to the master subsystem simulation from the Assignment page. XHP must be ON.

Execution Properties

In the Execution tab, you must set the real time simulation mode to Hardware Synchronized.

Click the arrow in the field next to Real-time simulation mode and select Hardware synchronized from the drop down menu.

Loading the Model

In the Overview tab, click on Load the model. The console will open, and the real-time code will be uploaded to the simulator. The Loading model window appears briefly during the loading process.

The Display tab in the lower portion of the window will show load progress and details.

Executing the Simulation

Click on Execute the model to start the simulation. At the beginning of the simulation, eHS will initialize (it takes about 10,000 simulation steps). During this time the eHS outputs will remain at 0.

Clicking on the Display tab shows execution details.

|

Monitoring the Simulation

As soon as you load and execute the model, the Simulink console opens (behind RT-LAB) and you should be able to see the simulation running in the console window. The following example shows the three-phase load current of the converter.

Simulation operating conditions can be modified directly from the console. Simply click the desired signal in the console to open its Block Parameters window.

Stopping the simulation

Click on Reset the model to stop the simulation.

OPAL-RT TECHNOLOGIES, Inc. | 1751, rue Richardson, bureau 1060 | Montréal, Québec Canada H3K 1G6 | opal-rt.com | +1 514-935-2323