You are on page 1of 15

RT‐LAB Solution for

R l Ti
Real‐Time Applications
A li i

Quick Start Guide : Editing a 
RT‐LAB model

Technical support 
Opal‐RT Technologies
2009

3/20/09 1
Objectives
j

Edit a Simulink model using RT‐LAB rules in 3 steps
g p

Compile, load and execute

This tutorial is just a summary of OP101 modules 1 & 2. Please 
refer to these modules for complete explanations and courses

3/20/09 2
Outline

1.
1 Set the solver and configuration parameters
Set the solver and configuration parameters
2. Separate into subsystems
3
3. Adding communication (Opcomm) blocks
Adding communication (Opcomm) blocks
4. Compile and load

3/20/09 3
Set the solver and simulation parameters 
p
(Simulation parameters menu)

Choose a fixed‐step solver

Set the stop time to inf

Set the value of your time
Set the value of your time‐step
step (if several time
(if several time‐steps
steps in your 
in your
model, take the smallest one)

In Data Import/ Export uncheck the “Save to workspace” options

In “Optimization” uncheck “Block reduction” and “Signal storage 
reuse”

4
Separate into subsystems
p y
BASIC RULE : there can be no computation at the top level of a 
model, but only subsystems
y y

Group your interface devices (scope, displays, constants) into a 
subsystem (except time‐related blocks such as sine waves pulse
subsystem (except time‐related blocks such as sine waves, pulse, 
steps…)
Name this subsystem, this will be your user interface. Name 
must begin by the prefix sc_
b i b h fi

Group computation blocks into subsystems (one can be enough 
depending on your model)

Name created subsystems :
w If only one : name it with prefix sm_
w If more than one : one must be sm_, others ss_
5
Separate into subsystems
p y
From original model… 

6
Separate into subsystems
p y
… to a model with subsystems

7
Adding
g communication (Opcomm)
( p )
blocks
Opcomm blocks must be added just after subsystems input blocks

In SM_ or SS_
w One Opcomm for all inputs coming from the sc_ subsystem
w O O
One Opcomm for all inputs coming from SM_ and/or SS_
f ll i t i f SM d/ SS

In SC_ you can put one or several Opcom (maximum number of 
25) Each Opcomm designs a unique acquisition group (see
25). Each Opcomm designs a unique acquisition group (see 
OP101 – Module 2)
Make sure each Opcomm in SC_ has a unique acquisition group 
number

8
Adding
g communication (Opcomm)
( p )
blocks
Example for sm_controller

9
Adding
g communication (Opcomm)
( p )
blocks
Example for sc_console

10
Preparing
p g your
y target
g environment
Select your target platform

11
Preparing
p g your
y target
g environment
Define your Development Node : in Configuration\Advanced\Hardware 
Configuration, click on “change
g global
g settings”,
g press ok, then add
your targets with IP addresses. Choose one of them as the
development node. This step must be done only ONCE, not at each
compilation.

12
Preparing
p g your
y target
g environment
Install RT‐LAB on the target : in the same windows select your target 
and click on “Update”. Transfer rtlab‐qnx6‐v8.x.x.tgz. This step must be 
done only ONCE, not at each compilation.

13
Compile
p

Check first that your model runs offline


Check first that your model runs offline

Select your target platform in the MainControl pop up menu

If required, register a model initialization script in  
Configuration\Advanced\Files & Commands, in the field “Before 
Opening Model”
Opening Model

You are now ready to compile

14
Load

Once your model is compiled go into the “Assign nodes”


menu and assign each subsystem to a node

You can now load and execute the model

15

You might also like