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

Preparing and Building the Model

Now that there is a model in your project, here’s how to prepare and build it for real-time simulation.

  • Preparing the build configuration
  • Selecting the development node.
  • Editing the model
  • Building the model
  • Assigning subsystems

Selecting the Development Node

Before compiling your model for real-time simulation, you must select the target node on which your model is compiled. This target node is called the development node. Normally this step is performed once, when configuring RT-LAB for the first time.

To change the development node do the following:

  • Activate the Project Explorer view.
  • Select the target MyTarget in the Project Explorer view.
  • To set this target as the development node, use one of the following methods:
  • From the the view’s popup menu choose Set as development node or
  • Open the RT-LAB preferences using the Window > Preferences menu, select the RT-LAB → Simulation Tools -> RT-LAB preference page, and then select for the desired target platform the target node you want to use as development node.
  • A small letter appears on the target node indicating that this target node is used a development node.

Editing the model

Now that your model and RT-LAB are configured, here how to edit your model with RT-LAB.

  • Activate the Project Explorer view.
  • Select the model MyModel in the Project Explorer view.
  • To edit your model, use one of the following methods:
  • From the the view’s popup menu choose Edit
  • From the menu bar, select Tools > Open MatLab, drag and drop the model MyModel in MatLab command windows.
  • Open sm_computation subsystem and add a Gain block between OpComm block and output of the subsystem.



Note: Step corresponds to the edition of your model.




Save the model and close MatLab.

Preparing the Build Configuration

Before building your model for real-time, it is necessary to prepare the build configuration of the model.

  • Activate the Project Explorer view.
  • Select the model MyModel in the Project Explorer view.
  • Double-click the model to open its editor.
  • Select the Development page of the editor.
  • Select the target platform (or operating system) corresponding to your target node.



Note: The tabs of the Development page configure the compiler and linker options.



Building the Model

Now that your model and RT-LAB are configured, this is how to build your model with RT-LAB.

  • Activate the Project Explorer view.
  • Select the model MyModel in the Project Explorer view.
  • To start the complete build process, use one of the following methods:
  • From the menu bar, select Simulation > Build,
  • From the view’s popup menu choose Simulation > Build or
  • From the main toolbar, click the build button.
  • It is also possible to start the build process using the Build Configuration dialog box. This window allows you to change RT-LAB configurations. For example, it allows you to select the development node, the Matlab version used when compiling a Simulink model and the steps to perform while compiling. To open the Build Configuration dialog box, do the following:
  • From the menu bar, select Simulation > Build Configurations ...,
  • From the view’s popup menu choose Simulation > Build Configurations ... or
  • From the main toolbar, select the Build button drop-down menu, then click the Build configurations ...
  • After starting the build process, the Compilation view displays compilation results.



Note: To build a model, your target must have a developer license. If your target has only a runtime license, the build process displays the following message: “The license on target does not allow you to compile a model".

For more information about requesting licenses and about license features, please see License Page.


Assigning Subsystems

The last step before executing the model in real-time is to select which target nodes each subsystem is executed.

This step is called the assignation.

  • Activate the Project Explorer view.
  • Select the model MyModel in the Project Explorer view.
  • Double-click the model to open its editor.
  • Select the Assignation page of the editor.
  • In the subsystems table, for each subsystem, select the Assigned Node cell and then select the desired target node from the drop-down menu.

Executing the Model

Now that there is a built model in your project, here’s how to make a typical simulation (load, execute, change parameter, reset...).

  • Selecting the simulation mode
  • Loading the model
  • Running the model
  • Using the Console
  • Resetting the model

Selecting the Simulation Mode

Before loading your model for real-time simulation, you must select the simulation model of your model. You can choose between four simulation modes: Simulation, Simulation with low priority, Software Synchronized and Hardware Synchronized.

The model does not contain any I/O card, so you could choose Software Synchronized mode; the model runs in real-time and is synchronized on an internal timer. If you have an I/O card, choose Hardware Synchronized; in this mode, the model runs in real-time and is synchronized on an external timer (for example synchronized on I/O card timer).


To set the simulation mode:

  • Activate the Project Explorer view.
  • Select the model MyModel in the Project Explorer view.
  • Double-click the model to open its editor.
  • Select the Execution page of the editor.
  • Select Software Synchronized from Real-Time simulation mode.



Note: The Execution page allows configuring the real-time options and performance options.



Loading the model

Now that your model and RT-LAB are configured, here is how to load your model with RT-LAB.

  • Activate the Project Explorer view.
  • Select the model MyModel in the Project Explorer view.
  • To start the load process, use one of the following methods:
  • From the menu bar, select Simulation > Load,
  • From the view’s popup menu choose Simulation > Load or
  • From the main toolbar, click the load button.

Running the model

Now that your model is loaded, here is how to execute your model with RT-LAB.

  • Activate the Project Explorer view.
  • Select the model MyModel in the Project Explorer view.
  • To start the run process, use one of the following methods:
  • From the menu bar, select Simulation > Execute,
  • From the view’s popup menu choose Simulation > Execute or
  • From the main toolbar, click the execute button.

Using the Console

Now that your model and RT-LAB are running, here is how to interact with your model by using the Simulink Console.

  • Activate the Project Explorer view.
  • Select the model MyModel in the Project Explorer view.
  • Under the model MyModel, the list of MyModel subsystems appears

To open the Simulink Console, use one of the following methods:

  • Select and double-click the subsystem corresponding to the console subsystem. (For your model: double-click sc_user_interface subsystem) or
  • Before the model loading step, double-click the model to open its editor, select the Simulation tools page and check the Handle Console automatically.

The Simulink Console opens.

To start the Simulink Console, press Start Simulation in MatLab. You can interact with the model through the Simulink Console by changing Adjust reference, and observe effect your change in the Simulink scope.

Resetting the model

When you finish the simulation of your model, here is how to reset your model with RT-LAB.

  • Activate the Project Explorer view.
  • Select the model MyModel in the Project Explorer view.
  • To start the reset process, use one of the following methods:
  • From the menu bar, select Simulation > Reset,
  • From the view’s popup menu choose Simulation > Reset or
  • From the main toolbar, click the reset button.
  • Close the Simulink Console.

Closing an editor

Now that there is an editor open, here's how to close it.

  • Select the MyScript.py editor tab.
  • To close the editor, choose one of the following options:
  • Click the close button ("X") in the tab of the editor.

  • Select File > Close from the menu bar.
  • Note the prompt to save the file before the editor is closed.
  • Click OK to save any changes and close the editor.

If the editor was closed using File > Close, notice that the option File > Close All was also displayed. This is a quick way to close all of the open editors. If File > Close All is chosen, a prompt appears to choose which editors with unsaved changes should be saved.

Navigating resources

This section works with the Project Explorer view. This view is initially part of the RT-LAB Edition perspective. To experiment with other views, they can be displayed by using the Window > Show View menu.

One important view to become familiar with is the Project Explorer view, which displays information about the contents of the Workbench and how the resources relate to each other in a hierarchy. In the Workbench, all resources reside in projects. Projects can contain Model, folders and/or individual files.

Opening resources in the Project Explorer

Using the Project Explorer there are several ways to open an editor.

  • In the Project Explorer view select the file MyScript.py
  • To open an editor on the file, choose one of the following approaches:
  • To edit a resource using the default editor for that resource, either double click the resource, or select the resource and choose Open from its popup menu.
  • To use a specific editor to edit the resource, start by selecting the resource, and choose the Open With option from the popup menu.
  • The Workbench remembers the last editor that was used for editing a specific file. This makes it easier to use the same editor down the road. The default editors can be configured using the General > Editors > File Associations preference page. Using the Project Explorer there is also a simple way to open an editor of a model.
  • In the Project Explorer view select the model MyModel.
  • To open an editor on the model double click the resource, or select the resource and choose Open from its popup menu.
  • To edit the block diagram of the model using Simulink or EMTP-Works, select the resource and choose Edit from its popup menu.

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