State Estimation with Observers

Similar documents
Control and Simulation in. LabVIEW

Solutions. Discretization HANS-PETTER HALVORSEN,

Data Acquisition HANS-PETTER HALVORSEN,

Datalogging in LabVIEW

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

Virtual Instruments with LabVIEW

DAQ in MATLAB HANS-PETTER HALVORSEN,

Wireless DAQ using ZigBee

NI Vision System HANS- PETTER HALVORSEN,

Exercise 11: Discretization

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

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

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

Faculty of Technology, Department of Electrical Engineering, Information Technology and Cybernetics. SCADA System

Wireless DAQ System. In this project you are going to create a Wireless DAQ System, see Figure 1-1. Figure 1-1: Wireless DAQ system

LabVIEW MathScript Quick Reference

Laboratory System. 1 Introduction

Weather System. In this project you are going to create a Weather System, see Figure 1-1. Figure 1-1: Weather system

NI USB-TC01 Thermocouple Measurement Device

Telemark University College Department of Electrical Engineering, Information Technology and Cybernetics. MathScript

Level control with DeltaV using MPC

Exercise 5: Basic LabVIEW Programming

Exercise: State-space models

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

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

LABVIEW MATHSCRIPT HANS-PETTER HALVORSEN,

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

Introduction to ERwin

Process Control and Instrumentation Technology Model: PCT-200

Visual Studio Team Services

Create a Virtual Test Environment

Modbus Hans-Petter Halvorsen

Using SQL Server in C#

Data Acquisition in LabVIEW

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

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

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

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

International Journal of Advance Engineering and Research Development. Flow Control Loop Analysis for System Modeling & Identification

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

Ch En 475: Introduction to Instrumentation and Signal Processing with Labview

Intelligent Systems Research Laboratory

Design of Liquid Level Control System Based on Simulink and PLC

Industrial IT Laboratory Work Hans-Petter Halvorsen

Ch En 475: Introduction to Instrumentation and Signal Processing with Labview

Welcome to Microsoft Excel 2013 p. 1 Customizing the QAT p. 5 Customizing the Ribbon Control p. 6 The Worksheet p. 6 Excel 2013 Specifications and

Introduction to Simulink

Software Implementation

Software Architecture

A liquid level control system based on LabVIEW and MATLAB hybrid programming

Digital Signal Processing System Design: LabVIEW-Based Hybrid Programming Nasser Kehtarnavaz

Integrated Math I. IM1.1.3 Understand and use the distributive, associative, and commutative properties.

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

Software Architecture

Linear Algebra in LabVIEW

[1] CURVE FITTING WITH EXCEL

Chapter 2. MathScript

SC2000 MOTOR PROTECTION ELECTRONICS, INC. INSTRUCTION MANUAL. Phone: (407) Fax: (407) Vulcan Road Apopka, Florida 32703

Software Documentation

Test Plans & Test Results

Isotemp. Bath Circulators. Improve the productivity. of your lab with solutions. from Fisher Scientific

Section 1.5. Finding Linear Equations

COOLING SOLUTIONS BY LABTECH INNOVATION INSPIRED

ME 224: EXPERIMENTAL ENGINEERING. Lecture 2

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

Using MATLAB, SIMULINK and Control System Toolbox

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

VCE Further Mathematics Units 3&4

INSTRUCTION MANUAL STATION CONTROLLER SC1000 MOTOR PROTECTION ELECTRONICS, INC.

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

Team Assignment. Final Software Delivery. IA4412 Software Engineering

Coordinate Geometry. Coordinate geometry is the study of the relationships between points on the Cartesian plane

Relationship between Fourier Space and Image Space. Academic Resource Center

Wireless Data Acquisition in. LabVIEW

Virtualizing Industrial Control Systems Testbeds for Cybersecurity Research

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

Integrated electronic controller Type EP-tronic T1 with bayonet connector

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

CHAPTER 3 MODELING OF DEAERATOR AND SIMULATION OF FAULTS

Introduction to MATLAB

Swapnil Nimse Project 1 Challenge #2

Plasma Quest RPCVD: Operating Procedure (6/24/02)

LabWindows/CVI Development Tools for ANSI C

3.5 ASPEN DYNAMICS SIMULATION OF CSTRs

A New Method for Multisensor Data Fusion Based on Wavelet Transform in a Chemical Plant

ALGEBRA 2 W/ TRIGONOMETRY MIDTERM REVIEW

Artificial Intelligence for Robotics: A Brief Summary

Digital Control Design for the Boiler Drum

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

SQL Server and SQL Structured Query Language

QUICK SETUP GUIDE SECULIFE IFPRO

DYNAMIC POSITIONING CONFERENCE September 16-17, Sensors

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

AC : MATHEMATICAL MODELING AND SIMULATION US- ING LABVIEW AND LABVIEW MATHSCRIPT

Mastery. PRECALCULUS Student Learning Targets

Competency goals 3 and 5; non-routine problem solving Represent problem situations with geometric models.

Create Installation Packages in Visual Studio

System Identification

U4L4B Box Problem - TI Nspire CAS Teacher Notes

Workshop - Model Calibration and Uncertainty Analysis Using PEST

Transcription:

Telemark University College Department of Electrical Engineering, Information Technology and Cybernetics State Estimation with Observers HANS-PETTER HALVORSEN, 2012.08.20 Faculty of Technology, Postboks 203, Kjølnes ring 56, N-3901 Porsgrunn, Norway. Tel: +47 35 57 50 00 Fax: +47 35 57 54 01

Preface In this Lab we will implement an Observer in LabVIEW and MathScript. An Observer is an alternative to Kalman Filter. LabVIEW and LabVIEW Control Design and Simulation Module have advanced features for State Estimation. LabVIEW has a built-in Observer algorithm we will use, but we will also implement our own Observer algorithm from scratch. We will use the USB-6008 DAQ device and the Level Tank in this assignment. Go to the following website for more background information about the Lab Work: http://home.hit.no/~hansha/?lab=state_estimator_observer ii

Table of Contents Preface...ii Table of Contents... iii 1 Introduction... 4 1.1 Lab Equipment... 4 2 Modelling... 5 2.1 Introduction... 5 2.2 Tasks... 7 Task 1: Model parameter adjustment Trial and Error... 7 Task 2: State-space Model... 8 Task 3: Discretization... 8 3 Observers... 10 3.1 Introduction... 10 3.2 Tasks... 15 Task 4: Observer Gain... 15 Task 5: Built-in Observer Algorithm... 15 Task 6: Implement an Observer from scratch... 16 4 Control System... 17 Task 7: PI(D) Control... 17 iii

1 Introduction 1.1 Lab Equipment The LM-900 Level Tank equipment will be used in this Lab Work: You will also need the USB-6008 DAQ device. 4

2 Modelling 2.1 Introduction The LM-900 Level Tank equipment will be used in this Lab Work: A very simple (linear) model of the water tank is as follows: or [ ] Where: is the level in the water tank is the pump control signal to the pump is the cross-sectional area is the pump gain 5

6 Modelling [cm3/s] is the outflow through the valve (this outflow can be modeled more accurately taking into account the valve characteristic expressing the relation between pressure drop across the valve and the flow through the valve). In your application the sampling time can be set to 0.1 s. A more complicated/accurate and nonlinear model can be found here: http://home.hit.no/~finnh/dok_tankmodell/ Control Signal: A pump fills the tank with water from the reservoir. The pump speed can be controlled by a voltage signal in the range 0-5V. The pump can be controlled by an external voltage signal at the FROM PC connector. Measurement Signal: The measurement is a voltage signal in the range 0-5V available at the TO PC connector. This voltage range corresponds to a level range of 0-20 cm, approximately (unless you need a more accurate relation, you can assume this range in your applications). Scaling: You need to scale the signal to. The following linear relationship applies: You have to find (slope) and (intercept). The following formulas may be used:

7 Modelling This gives: where 2.2 Tasks Task 1: Model parameter adjustment Trial and Error Adjust the model parameters, from experiments on the real process. You need to use the LM-900 Level Tank equipment and the USB-6008 DAQ for this task. Show by simulations where you run the real process in parallel with the simulated model that you have found proper values. Note! can be found directly if you measure the radius in the tank ( ). Note! [End of Task]

8 Modelling Task 2: State-space Model For the real system, only the level ( ) is measured, so we want to use Kalman Filter and Observers for estimating the outflow ( ) of the tank. Set up the system on the following form ( pen and paper ): Set and Assume that is constant, i.e., Find the matrices. MathScript: Implement the state-space model in MathScript LabVIEW: Implement the state-space model in LabVIEW. [End of Task] Task 3: Discretization Find the discrete linear state-space model on the following form: Use the Euler Forward discretization method. Where is the sampling time. Find the matrices. LabVIEW: Use LabVIEW to convert the continuous model to a discrete state-space model from the previous task. Compare the results with your calculations.

9 Modelling MathScript: Find the discrete state-space model in MathScript. Compare the results. [End of Task]

3 Observers 3.1 Introduction An alternative to Kalman Filters are Observers. Observers have the same structure as the Kalman Filter, but they are calculated from specified estimator error dynamics, or in other words: how fast and stable you want the estimates to converge to the real values. A necessary condition when using Observers is that the system needs be observable. Given the following linear system: The Observability matrix is defined as: [ ] Where is the system order, i.e., number of states. A system is observable if the Observability matrix has full rank: The rank is given by the determinant. If the determinant is not equal zero, then the Observability matrix has full rank and the system is observable. The Observer Gain is given by the eigenvalues for : Example: Given the following system: ( ) [ ] [ ] [ ] [ ] 10

11 Observers [ ] Observability matrix: The Observability matrix is given by: [ ] This gives: [ ] Finally: [ ] [ ] [ ] Determinant: We find the determinant: For a 2x2 system we have: [ ] Then we get: ([ ]) MathScript: In MathScript we can write the following code: clear, clc % Define system A = [0, 1; 0, 0]; B = [0; 1]; C = [1, 0]; D = [0]; ssmodel = ss(a, B, C, D); O = obsvmx(ssmodel)

12 Observers rank(o) det(o) Observer Gain: Next we want to find the Observer Gain: A 2.ordens Butterworth polynomial is defined as: Where. This gives: The Observer Gain is: [ ] The Observer system matrix ( ) becomes: [ ] [ ] [ ] [ ] [ ] The characteristic equation becomes: ( ) ([ ] [ ]) ([ ]) A 2.order Butterworth filter has the following polynomial: This gives: ( ) We compare and get:

13 Observers This gives: [ ] [ ] Then we have: For simplicity we set This gives: Finally: MathScript: We use the roots() and acker() functions: A = [0, 1; 0, 0]; B = [0; 1]; C = [1, 0]; D = [0]; n=2; Tr=2; T=Tr/n; B2=[T*T, 1.4142*T, 1]; eigenvalues=roots(b2); K=acker(A,C,eigenvalues,'o') %o for observer This gives: K = 1.4142 1 LabVIEW:

14 Observers In LabVIEW we define the polynomial like this: We use the CD Ackermann.vi in order to find the Observer Gain K. Block Diagram: Front Panel: As you see, we get the same results either we use pen and paper, MathScript or LabVIEW.

15 Observers [End of Example] LabVIEW have several built-in algorithms. Below we see the Estimation palette in LabVIEW (Control Design & Simulation Simulation Estimation): LabVIEW have built-in algorithms, both for continuous systems and discrete systems. 3.2 Tasks Do the following tasks: Task 4: Observer Gain Check for Observability and find the Observer Gain using Pen and Paper. Check your answer by using MathScript. Use the Ackermann (acker() function). You may set, e.g.,. [End of Task] Task 5: Built-in Observer Algorithm Estimate the process variables using Observer on the simulated tank. Use one of the built-in functions in LabVIEW. LabVIEW have several built-in algorithms, but in this task you can use the CD Continuous Observer.vi function.

16 Observers Add noise in the simulated model to make it more realistic. You can use, e.g., the Gaussian White Noise PtByPt.vi. Extend your application and use the Observer on Real Process. With the real tank, use your state estimators (simultaneuously, i.e. in parallel) to estimate. Change the outflow by adjusting manually the outlet valve. Discuss the results. [End of Task] Task 6: Implement an Observer from scratch I this task you shall implement your own Observer algorithm from scratch in LabVIEW. The general Observer algorithm is as follows: Step 1: Find Measurement Estimate For linear systems: Step 2: Find estimator error: Step 3: Find corrected and predicted state estimate: For linear systems: K is the Observer Gain. Use Ackermann to find the Observer Gain ( CD Ackermann.vi ). [End of Task]

4 Control System Here you will control the system using a standard PI(D) controller. Task 7: PI(D) Control Implement a PI(D) Control System for your system. You shall control the level in the water tank. Use the built-in PID controller in LabVIEW. The Observer Estimator shall be running in parallel (use either the built-in or your own algorithm). Find proper PI(D) parameters using the Skogestad's method. You cannot use the Good Gain method or the Ziegler-Nichols' method because the process has almost no time-delay. A reasonable process model is a time-constant (with zero time-delay, ): You need to apply a step on the input and then observe the response and the output, as shown below: Here are the Skogestad s formulas for finding the PID parameters: 17

18 Control System In this task we can set sec and. For more details about the Skogestads method, please read this article: Model-based PID tuning with Skogestad s method. Discuss the results. Create the application so that you can use the estimated level instead of the measured level if the measurement for some reason is not available. Try it out by removing the cables from the DAQ device. Discuss the results. [End of Task]

Telemark University College Faculty of Technology Kjølnes Ring 56 N-3918 Porsgrunn, Norway www.hit.no Hans-Petter Halvorsen, M.Sc. Telemark University College Department of Electrical Engineering, Information Technology and Cybernetics E-mail: hans.p.halvorsen@hit.no Blog: http://home.hit.no/~hansha/