Simulation in LabVIEW. Hans-Petter Halvorsen, M.Sc.

Similar documents
University College of Southeast Norway. LM-900 Level Tank. Hans-Petter Halvorsen,

Data Acquisition HANS-PETTER HALVORSEN,

Control and Simulation in. LabVIEW

Datalogging in LabVIEW

Solutions. Discretization HANS-PETTER HALVORSEN,

State Estimation with Observers

Virtual Instruments with LabVIEW

NI mydaq HANS-PETTER HALVORSEN, Telemark University College Department of Electrical Engineering, Information Technology and Cybernetics

MATLAB Examples. Simulink. Hans-Petter Halvorsen, M.Sc.

DAQ in MATLAB HANS-PETTER HALVORSEN,

University College of Southeast Norway. Control and Simulation. in LabVIEW. Hans-Petter Halvorsen,

Introduction to Simulink

Wireless DAQ using ZigBee

University College of Southeast Norway. Web Services. with Examples. Hans-Petter Halvorsen,

Høgskolen i Telemark Telemark University College Department of Electrical Engineering, Information Technology and Cybernetics.

Industrial IT Laboratory Work Hans-Petter Halvorsen

NI Vision System HANS- PETTER HALVORSEN,

Create a Virtual Test Environment

MATLAB Examples. Flow Control and Loops. Hans-Petter Halvorsen, M.Sc.

Modbus Hans-Petter Halvorsen

Data Acquisition in LabVIEW

Visual Studio Team Services

Introduction to ERwin

Exercise 11: Discretization

Exercise 5: Basic LabVIEW Programming

NI USB-TC01 Thermocouple Measurement Device

MATLAB Examples. Interpolation and Curve Fitting. Hans-Petter Halvorsen

Introduction to LabVIEW

Software Architecture

Sensors and Actuators with Arduino. Hans-Petter Halvorsen, M.Sc.

Unit Testing. Quiz with Explainations. Hans-Petter Halvorsen, M.Sc.

B series Controller Communications VI Library

Virtual Instrumentation With LabVIEW

Using SQL Server in C#

Step-by-Step Data Acquisition Part II Exercise 2: Generating an Analog Output Waveform

Software Architecture

Team Assignment. Final Software Delivery. IA4412 Software Engineering

Chapter 2. MathScript

Measurement & Automation Explorer (MAX) View and control your devices and software

Hands-On Introduction to. LabVIEW. for Scientists and Engineers. Second Edition. John Essick. Reed College OXFORD UNIVERSITY PRESS

Linear Algebra in LabVIEW

Analytical Instrumentation

Database Views & Stored Procedures. Hans-Petter Halvorsen, M.Sc.

Analytical Instrumentation

LabVIEW Tutorials. T.1 Temperature Measurement and Cold Junction Compensation (CJC) LUMS School of Science and Engineering

Team Foundation Server Visual Studio Team Services. Hans-Petter Halvorsen, M.Sc.

Read Temperature Data

Today. 4/5/11 Physics 262 Lecture 10 Questions about Exams Homework. Lab: Continue project. Lecture. Review your exams and review practice exam again.

BE/EE189 Design and Construction of Biodevices Lecture 5. BE/EE189 Design and Construction of Biodevices - Caltech

OpenStax-CNX module: m Thermometer VI * National Instruments

Wireless Data Acquisition in. LabVIEW

LabVIEW MathScript Quick Reference

Introduction to MATLAB

EECS Berkeley EE249 LabVIEW Framework. Hugo A. Andrade Principal Architect LabVIEW Platform & Real Time Group

Database Systems. S. Adams. Dilbert. Available: Hans-Petter Halvorsen

Virtual Instrumentation With LabVIEW

Database Lab. Hans-Petter Halvorsen

INTRODUCTION TO LABVIEW

Database. Quiz with Explainations. Hans-Petter Halvorsen, M.Sc.

Raspberry Pi. Hans-Petter Halvorsen, M.Sc.

Software Implementation

ENGR 1000, Introduction to Engineering Design

SQL Server and SQL Structured Query Language

Small rectangles (and sometimes squares like this

A Unified Approach for Classroom and Laboratory Control Systems Education

Homework Assignment 9 LabVIEW tutorial

Week Assignment. Source Code Control (SCC) & Bug Tracking Systems. Hans-Petter Halvorsen

2. The LabView Environment Two panes will open, one is the Front panel, and one is the Block Diagram

LabVIEW 2009 Real-Time & FPGA 最新技術剖析. National Instruments 美商國家儀器 行銷部技術經理吳維翰

LabVIEW programming II

Engineering Project-I. Module 1: Familiarization of LabVIEW and the Vernier Toolkit

LabVIEW Core 1. What You Need To Get Started. File Locations. The course installer places the course files in the following location: ni.

PHYS 5061 Lab 1: Introduction to LabVIEW

LabVIEW basics. BME MIT János Hainzmann, Károly Molnár, Balázs Scherer, Csaba Tóth

Software Documentation

Arrays. Collection of data elements that are of same type

Lab Exercise 2: Data Acquisition with NI LabVIEW

With respect to the National Instruments software product(s) being used, the following patents may apply:

LabVIEW control solutions on Mac. Christophe Salzmann. Ecole Polytechnique Fédérale de Lausanne - Switzerland

Concept: Debugging. Goal. Description. Implementation. Use the debugging tools built into LabVIEW.

Creating Classes and Libraries with Arduino

Source Code Control. Quiz with Explainations. Hans-Petter Halvorsen, M.Sc.

Software Platforms. Quiz with Explainations. Hans-Petter Halvorsen, M.Sc.

Multiple control with Learning System Process Automation. MPS PA Compact Workstation & MPS PA Reactor Station

Programming. Languages & Frameworks. Hans-Petter Halvorsen, M.Sc. O. Widder. (2013). geek&poke. Available:

UML. Quiz with Explainations. Hans-Petter Halvorsen, M.Sc.

LabVIEW Basics I: Introduction Course

Introduction to LabVIEW and NI Hardware Platform

OPC and Real-Time Systems. in LabVIEW

Determination of Drag Coefficient

Hands-on Lab 1: LabVIEW NI-DAQ Basics 1

Data Acquisition Laboratory

LABVIEW MATHSCRIPT HANS-PETTER HALVORSEN,

University College of Southeast Norway MATLAB. Part III: Simulink and Advanced Topics. Hans-Petter Halvorsen,

Was ist neu in LabVIEW 2014

1. Learn about LabView software and its different components

ECE 202 LAB 1 INTRODUCTION TO LABVIEW

LabView instrumentoinnissa, 55492, 3op Labview in instrumentation

Labview. Masood Ejaz

Hardware: Acquiring Data and Communicating with Instruments

Transcription:

Simulation in LabVIEW Hans-Petter Halvorsen, M.Sc.

Software LabVIEW LabVIEW Control Design and Simulation Module This module is used for creating Control and Simulation applications with LabVIEW. Here you will find PID controllers, etc. The module is available as a palette on your block diagram. All LabVIEW Software can be downloaded here: www.ni.com/download

Contents Block Diagram Simulation based on differential Equations Using the Simulation Loop PID Control with built-in PID blocks/functions Creating and using Simulation Subsystems Simulations using a While Loop with Subsystems inside

What is LabVIEW? Hans-Petter Halvorsen, M.Sc.

LabVIEW = Fun! Graphical Programming: Very different from traditional programming like VB, C#, Maple, MATLAB, MathScript, etc. It is more like a drawing program than a Programming Language This makes it easy to use for those who are not programmers (or dont like programming J) Excellent tool when using Hardware, when you need to take Measurements (DAQ), etc. It is fun and makes you very creative!

LabVIEW Example LabVIEW has the same things as other programming languages, but in a graphical way! Sequence Structure Comment While Loop Sub VI (Function/Method) Local Variable Arrays Case Structure Stop Button Property Nodes Constants (if-else) Condition Note! To do something with an object Right-click on it (When shall the loop end?)

Front Panel Create your User Interface/HMI here LabVIEW Environment Note! Both the Front Panel and the Block Diagram are stored in one single file. These files are called VIs (because the file extension is.vi ). VI = Virtual Instruments Block Diagram Switch between them: Ctrl + E Create your Code here

Controls and Functions Palette You can pin them! Available only from the Front Panel You create your User Interface with help of these Controls Right-click on the Front Panel You create your Code with help of these Functions Right-click on the Block Diagram Available only from the Block Diagram

Customizing Controls and Functions Palettes Do this for both the Controls Palette and the Functions Palette

LabVIEW This is the core LabVIEW installation that installs the LabVIEW Programming Environment. LabVIEW MathScript RT Module This module is a text-based tool that is very similar to MATLAB. The syntax is similar to MATLAB, you can create and run so-called m files, etc. The module is available from the Tools menu inside LabVIEW. LabVIEW Control Design and Simulation Module This module is used for creating Control and Simulation applications with LabVIEW. Here you will find PID controllers, etc. The module is available as a palette on your block diagram. NI-DAQmx DAQmx is the Hardware Driver needed in order to use hardware devices like NI USB-6008, NI TC-01, etc. inside LabVIEW. The module is available as a palette on your block diagram.

Modelling of Dynamic Systems Hans-Petter Halvorsen, M.Sc.

Water Tank: Dynamic Systems Examples Mathematical Models (differential equations): These are small-scale processes we have at HiT Alt 1 (Integrator): Alt 2 (Time constant/1.order): Air Heater: h Level in the tank Alt 3 (Nonlinear): T Temperature in the tube

Dynamic Systems Dynamic system represented as a differential equation (1.order system): x = ax + bu Note We can easily create a block diagram from the differential equation(s) Dynamic system represented as a block diagram Integrator symbol When we have the block diagram for the system, we can easily implement it in LabVIEW

Simulation in LabVIEW Hans-Petter Halvorsen, M.Sc.

Control and Simulation in LabVIEW Control Design & Simulation Palette in LabVIEW PID Palette in LabVIEW Simulation Loop Control Design Palette in LabVIEW Simulation Palette in LabVIEW Check that you have all these palettes. Open the different subpalettes, etc.

LabVIEW Control and Simulation Example Example of Simulation (and control) of a dynamic system based on the blocks in the Simulation Palette We are going to learn to create such a system (and much more)!

The Simulation palette in LabVIEW Simulation Palette in LabVIEW Simulation Loop: Similar to a While Loop, but customized for used together with the Simulation Blocks available in LabVIEW Different Simulation Blocks by Category Continuous Systems Discrete Systems Nonlinear Systems etc.

LabVIEW Example Hans-Petter Halvorsen, M.Sc.

Dynamic system represented as a differential equation Simulation Example Integrator symbol x = ax + bu

Simulation Example - Configuration In the example the following simulation parameters could be used (right-click on the Simulation Loop border and select Configure Simulation parameters ):

Simulation Example - Solutions Try with different values for u x = ax + bu Correct results? Check static response: Step Response We see the Step Response is as expected!

PID Control in LabVIEW Hans-Petter Halvorsen, M.Sc.

Control System v r e u y - K p T i T d PID Process Sensor PID Algorithm: r Reference Value, SP (Setpoint), SV (Set Value) y Measurement Value (MV), Process Value (PV) e Error between the reference value and the measurement value (e = r y) v Disturbance, makes it more complicated to control the process Kp, Ti, Td PID parameters

Control System implementation with Pen & Paper v K p T i T d r e u y PID Process - Sensor The transition from paper to LabVIEW is easy, because the implementation is very similar to the paper version Control System implementation in LabVIEW Here we have used the Simulation Loop

Control System implementation with Pen & Paper v Controller K p T i T d r e u y PID Process - All this is normally included in the controller Sensor The transition from paper to LabVIEW is easy, because the implementation is very similar to the paper version Control System implementation in LabVIEW Here we have used an ordinary While Loop (which is recommended!)

Alternative 1: PID Palette in LabVIEW (PID Toolkit) PID Control in LabVIEW Alternative 2: This alternative uses seconds! Note! The functions PID.vi and PID Advanced.vi requires that Ti and Td are in minutes, while it s normal to use seconds as the unit for these parameters. You can use the following piece of code in order to transform them: This means we enter values for Ti and Td in secons on the Front Panel and the values are converted to minutes in the code.

LabVIEW Example Hans-Petter Halvorsen, M.Sc.

x = ax + bu LabVIEW PID Example We will replace u in the previous example with the built-in PID Controller (use Alternative 2)

x = ax + bu Front Panel: PID Example - Solutions

x = ax + bu PID Example - Solutions Block Diagram: Right-click (Configuration) on the PID block to select Kp, Ti, Td as Inputs (->Terminals)

Next Step: Continuous Simulation Inf = Infinite Simulation in Real Time Right-click on the Simulation Loop border and select Configure Simulation Parameters Add a Stop Button and a Halt Simulation block

The Simulation now runs until you press the Stop button PID Example Continuous Simulation - Solution

Simulation Subsystems Hans-Petter Halvorsen, M.Sc.

LabVIEW Example Hans-Petter Halvorsen, M.Sc.

Simulation Subsystem File -> New A Way to structure your code, similar to SubVIs This is the recommended way to do it! You can easly reuse your Subsystems in different VIs and your code becomes more structured! Select File -> New..., Then choose Simulation Subsystem. Copy (or move) the blocks containing your process into the New VI (Simulation Subsystem) Create a Subsystem of this part (your process model) We will change your code above where you create a Simulation Sub System for your Process

File -> New Simulation Subsystem - Solutions

Simulation Subsystem 2 (PID Controller) Create a Subsystem of this part (the PID controller) We will change your code above where you create a Simulation Sub System for the PID Controller as well.

Simulation Subsystem Solutions2 Simulation Sub Systems Now your code has become really simple to understand! Note! You may select different icon style

LabVIEW Example With While Loop Hans-Petter Halvorsen, M.Sc.

Simulations using a While Loop Note! The Simulation Loop has some drawbacks/is more complicated to use than an ordinary While Loop. If we use Simulation Subsystems, we can use them inside a While Loop instead! - which becomes very handy! Simulation Subsystems So for real applications that involves more than just simulations (such as DAQ, File Logging, PID control of the real process, etc.), I recommend to use a While Loop instead of a Simulation Loop. We will add the Controller and Process Subsystems inside a While loop as shown above

Hans-Petter Halvorsen, M.Sc. University College of Southeast Norway www.usn.no E-mail: hans.p.halvorsen@hit.no Blog: http://home.hit.no/~hansha/