37
1 A REPORT ON Working on Opal-RT Wanda RTOS Simulator ABHISHEK SYAL BHEL CORP. R&D, HYDERABAD 2011

Opal-RT_Working_Report_abhishek_syal

Embed Size (px)

Citation preview

Page 1: Opal-RT_Working_Report_abhishek_syal

1

A

REPORT

ON

Working on Opal-RT Wanda RTOS Simulator

ABHISHEK SYAL

BHEL CORP. R&D, HYDERABAD

2011

Page 2: Opal-RT_Working_Report_abhishek_syal

2

Page 3: Opal-RT_Working_Report_abhishek_syal

3

A

REPORT

ON

Working on Opal-RT Wanda RTOS Simulator

Prepared on the basis of work experience on Opal-RT Hardware and

MATLAB SIMULINK

Prepared By

ABHISHEK SYAL

Engineer, 6121713

BHEL CORP. R&D, HYDERABAD

November, 2010 – April, 2011

Page 4: Opal-RT_Working_Report_abhishek_syal

4

Dedicated to all the users of Opal-RT in the past,

present and future.

Page 5: Opal-RT_Working_Report_abhishek_syal

5

Page 6: Opal-RT_Working_Report_abhishek_syal

6

PREFACE

This report is written with the aim of aiding a novice working on Opal-RT hardware and using

MATLAB Simulink software. It assumes a basic level of familiarity with the Opal-RT hardware.

The report shows in a chronological order of set of steps to be followed to run your programs

successfully. It also explains some test demo models that are used to understand and validate

the functioning of the Opal-RT RTOS Wanda Simulator.

In Chapter-I, I talk about how to go about setting up the system after installation of the

software and the license file on your target and before running your first SIMULINK model.

Chapter-II shows the steps you need to take to run your first model. A demo model has been

taken up for the exercise. Chapter-III talks about configuring the outputs on the Analog Card,

and checking them with a DSO. Chapter-IV explains how to use the Analog Input Card. Both

Analog and Digital Loopbacks are briefly explained in Chapter-V.

The text is developed with omitting some of the required steps in later chapters that have been

explained in Chapter-I and Chapter-II. The models for Analog & Digital Loopback were

developed. This report’s concern is that of the building up on model and how to execute your

models successfully; hence, it doesn’t contain detailed information on the model development.

The author may be contacted for further details on the modeling development issues.

Page 7: Opal-RT_Working_Report_abhishek_syal

7

ACKNOWLEDGEMENTS

The author gratefully acknowledges Satya Kumar, GM (MM &PCI), BHEL Corp. R&D, for his

interest in modeling and in assigning the work which has helped the author to produce this

valuable report for other new Opal-RT users.

The author is indebted to R. Janardhan, Opal-RT, Bangalore for day-to-day guidance and

clarification and to SVR Sarma Sir, AGM (Control & Instrumentation), for his valuable

suggestions and supervision.

The author also thanks A.R. Prabhu, AGM & LM (Control & Instrumentation), for his continued

support and belief and his mentoring.

Abhishek Syal

April, 2011

BHEL Corp. R&D, Hyderabad

Page 8: Opal-RT_Working_Report_abhishek_syal

8

Page 9: Opal-RT_Working_Report_abhishek_syal

9

TABLE OF CONTENTS

Preface

Acknowledgements

Introduction ………………………….. 11

Chapter – I … Getting Started … 13

Chapter – II … Simple Modeling of PID Control … 19

Chapter – III … Configuring Analog Outputs … 24

Chapter – IV … Configuring Analog Inputs … 27

Discussion … Configuring Loopbacks … 29

References

Author’s Profile

Glossary

Page 10: Opal-RT_Working_Report_abhishek_syal

10

Page 11: Opal-RT_Working_Report_abhishek_syal

11

INTRODUCTION

Real-time simulation is carried out to gain time in the testing process. It helps

engineers to forecast possible scenarios and find problems at an earlier stage in

the design process.

It also enables proceeding to a device design while the actual system is not

physically available, and trying to understand the system’s transients. Moreover,

the environment remains safe and secure, while giving high flexibility. In such

scenarios, Opal-RT’s Wanda RTOS Simulator having the architecture as elucidated

in figure below, can be deployed.

Fig. I Opal-RT RTOS System Architecture

Page 12: Opal-RT_Working_Report_abhishek_syal

12

Page 13: Opal-RT_Working_Report_abhishek_syal

13

CHAPTER – I

Getting Started: Get, Set, Go!

1.1 Why Subsystems?

Subsystems help us to create a customized standard blocks with

specific/specialized functionality which aids us to create and re-use such

blocks to suit our modelling requirements, which may be recurrent.

During real-time execution, it offers two distinct advantages:

� Real-time models need to be computed: The Subsystem regrouping helps

us to efficiently achieve this by using top-down approach. We can also

analyse individual subsystem behaviour and analyse at a much

intermediate level – looking at behaviour of each individual functional

block.

� Computing on Cores: It is helpful and easy to use many cores (processors)

for real time simulations. Moreover, different subsystems help to embed

different subsystems on different cores, thus aiding to achieve parallelism

and making computing more efficient.

Page 14: Opal-RT_Working_Report_abhishek_syal

14

1.2 Subsystems & Cores

In Opal-RT system, each each top-level subsystem created by the user will

be computed on one core.

This invariably implies:

1 Subsystem ���� 1 Core

1 Core ���� 1 Subsystem

An important exception to this rule is the console subsystem (SC).

1.3 Subsystem Modeling

In a Simulink model that is to be used with RTLAB, no mathematical

content can be found in the top-level of the model. Therefore, subsystems

are needed.

The user must add a prefix to all the top-level subsystems to allow RT-LAB

to manage them. There are 3 types of subsystems. Each subsystem is

computed on a different computation node in Opal-RT’s hardware.

Page 15: Opal-RT_Working_Report_abhishek_syal

15

Fig. 1. I Case of a Real-Time Subsystem

1.3a SC Console Subsystem

This is the only subsystem that will be available to the user during

execution. It enables the user to interact with the system while it is

running.

The console runs asynchronously from the other subsystems. It is also the

only subsystem that is not linked to a computation node (core). Therefore,

there should be no signal generation or important mathematical

operations included in this subsystem.

Prefix Identifier: SC_

Number of SC subsystems allowed in a model: 0 or 1

Content: All user interface blocks (scopes, displays, switches, controls, etc)

Page 16: Opal-RT_Working_Report_abhishek_syal

16

1.3b SM Master Subsystem

This is the main subsystem and every model must have one SM subsystem.

Prefix Identifier: SM_

Number of SM subsystems allowed in a model: 1 (always)

Content: All the computational elements of the model, the mathematical

operations, the I/O block, the signal generators, etc.

1.3c SS Slave Subsystem

This subsystem is needed only if the computational elements must be

distributed across multiple nodes. Remember that one subsystem = one

computation node for the SM and SS.

Prefix Identifier: SS_

Number of SS subsystems allowed in a model: Any (From 0 to...)

Content: All the computational elements of the model, the mathematical

operations, the I/O block, the signal generators, etc.

Page 17: Opal-RT_Working_Report_abhishek_syal

17

Fig. 1.II Subsystem modelling

Page 18: Opal-RT_Working_Report_abhishek_syal

18

Page 19: Opal-RT_Working_Report_abhishek_syal

19

CHAPTER – II

Simple Modeling of a Plant Controller & its

Behavior: Running Your First Model & Building Up!

2.1 Simple second order plant with PID control

The figures below explain the model. In this model, the “plant response”

and the “control signal” are exchanged between 2 real-time subsystems,

SM and SS.

Fig. 2.I Modeling of PID control

Page 20: Opal-RT_Working_Report_abhishek_syal

20

2.2 Parameters Selection for Model Execution

A real-time model can only run in Fixed-Step mode as real time is fixed-step

de facto.

The Fixed-Step size (fundamental sample time) must be chosen carefully

regarding the needs of the simulation, the dynamics of the model and must

take in account the software/hardware capability.

Fig. 2.II Setting the Parameters for Model Execution

Page 21: Opal-RT_Working_Report_abhishek_syal

21

2.3 Assigning Nodes

In the MainControl window, the Assign Nodes button allows the user to link

the model’s subsystems to the targets. The list of available nodes is in a

drop-down menu. Select the one which is ready and unused. Select

automatically assign nodes to automate the process, in which RT-Lab

assigns each node to a particular subsystem (of course, except the SC

subsystem, which isn’t assigned any node).

Use the arrows to associate a subsystem to a node. You can verify that the

target is up and running by using the “Ping” button.

2.4 Build and Execute

Click on Load Option after building your model and to transfer your model

to the Wanda simulator to execute it in real time.

After the model has been loaded, it can be executed by clicking on

“execute” option. During execution, you can change the controls found in

the console and witness changes displayed in scopes, displays, etc. You can

also pause or reset the model at any time.

Page 22: Opal-RT_Working_Report_abhishek_syal

22

2.5 Reset

When you want to stop definitely the model from running, you must use

the reset button found in the MainControl window. This will stop the

acquisition (software & hardware) and the console will now close.

Fig. 2.III Opal RT’s RT-Lab User Interface

Page 23: Opal-RT_Working_Report_abhishek_syal

23

Page 24: Opal-RT_Working_Report_abhishek_syal

24

CHAPTER – III

Configuring Analog Outputs: Speaking it Out!

3.1 Analog Output module

OP 5330 is the Analog Output Module, which is used to give analog outputs

to external peripheral devices.

It has the following features:

• Up to 16 analog output channels

• Simultaneous output on all

• 1 MS/s max. update rate

• Independent programmable ranges from +/- mV to +/- V

• Outputs short-circuit protected

3.2 Modeling

You can use the AnalogOut function block which can be found in the

Simulink library.

If you want to give a sine wave output, then you can select the sine signal

source, and connect it to the input terminal of this block. You can find the

status of this bock, while running the program.

Page 25: Opal-RT_Working_Report_abhishek_syal

25

3.3 Parameters Setting

You need to set the simulation parameters to “hardware synchronized”,

“fixed step” and “50us” in time step interval in the dialog box referred to in

Fig 2.II. You also need to set XHP mode to “on” to enable the running of the

controller in the Assignation Dialog Box.

3.4 Measurement, Testing & Validation

One can use an oscilloscope to measure the signal on the output terminals.

One can check with the Matlab scope of the signal being fed to the output

block.

Page 26: Opal-RT_Working_Report_abhishek_syal

26

Page 27: Opal-RT_Working_Report_abhishek_syal

27

CHAPTER – IV

Configuring Analog Inputs: Listening to External

Signals!

4.1 Analog Input module

OP 5340 is the Analog Input Module, which is used to input analog signals

from external peripheral devices.

It has the following features:

• Up to 16 different analog Input channels

• One 16 bit ADC per channel

• Simultaneous sampling on all channels.

• Up to 500 kS/s update rate per channel. Total throughput of 8

MS/s

• Independent programmable ranges from +/- 100 mV to +/- 20V

4.2 Modeling

You can use the AnalogIn function block which can be found in the Simulink

library.

Page 28: Opal-RT_Working_Report_abhishek_syal

28

4.3 Parameters Setting

After setting “hardware synchronized”, one needs to tick the check box of

“Handle s/w console automatically.” This ensures online running of the

Simulink program.

4.4 Measurement, Testing & Validation

Connect the Matlab scope to the “Volt” output of the block. One can see

the signal that is fed to the input pins by the function generator in this

scope.

Page 29: Opal-RT_Working_Report_abhishek_syal

29

DISCUSSION

Configuring Loopbacks: Input==Output!

Using the above guidelines, one can give output to the output channels, which

can be hard-wired to the input pins. This is called a loopback. Loopback tests are

generally carried out for HIL (Hardware in Loop) Simulators to verify their

functioning.

Digital Loopback can be performed in a similar fashion for the digital output and

input terminals.

The parameter settings remain same as explained for the output and input

terminals. One should take care to check and clearly define all the parameters.

Opal RT gives standard hardware interface for running the loopback tests. These

are shown in the figures 5.I and 5.II below.

Page 30: Opal-RT_Working_Report_abhishek_syal

30

Fig. 5.I Analog Loopback

Page 31: Opal-RT_Working_Report_abhishek_syal

31

Fig. 5.II Digital Loopback

Page 32: Opal-RT_Working_Report_abhishek_syal

32

Page 33: Opal-RT_Working_Report_abhishek_syal

33

REFERENCES

• RT-LAB User Manual – Quick Start Guide, Opal-RT Technologies,

Canada, 2010

• RT-LAB Engineering Simulator – User Guide, Opal-RT Technologies,

Canada, 2004

Page 34: Opal-RT_Working_Report_abhishek_syal

34

AUTHOR’S PROFILE

Abhishek Syal has worked on Opal-RT’s RTOS – Wanda Simulator to successfully

create, test and execute Matlab SIMULINK models from January, 2011 at Control

& Intrumentation Lab, BHEL Corp. R&D, Hyderabad. He has hands-on experience,

and has worked through various crash reports to understand the successful start-

up and deployment of Opal-RT hardware being interfaced with Matlab for running

Real-Time simulations. His learning has been guided by Opal-RT Training

Personnel, R. Janardhan, and with helpful suggestions from SVR Sarma, BHEL

Corp. R&D.

Page 35: Opal-RT_Working_Report_abhishek_syal

35

GLOSSARY

• RTOS : Real Time Operating System; basically, a system which

computes simulations within deterministic time limit for various

cases/initial conditions.

• DSO : Digital Oscilloscope; used to measure electronic signals .

• Subsystem : A Matlab block customized for particular complex

functions; depends on user to create and deploy one.

• Core : A processor in Simulator; An RTOS having 8 cores implies 8

processors, which can simultaneously execute 8 different program

modules.

• Target : A RTOS hardware, typically comprised of more than one

core.

• Node : Another name of cores; basically, it implies the no. of

active cores on which you deploy your subsystems; a software

reference

• Hardware Synchronized : The model is synchronized on an

external hardware timer, and runs in real-time.

Page 36: Opal-RT_Working_Report_abhishek_syal

36

• HIL : Hardware-in-Loop; it implies that while running simulations,

external hardware (typically RTOS) are deployed while models and

GUI reside on PC.

• Loopback : It implies that output from the output terminals are

fed back directly to the input pins.

Page 37: Opal-RT_Working_Report_abhishek_syal

37