How to create Matlab Script and Simulink Model for Designing a Pole Placement Controller

Similar documents
How to Create Matlab Script and Simulink Model for Designing a Pole Placement Controller

Control Theory association of mathematics and engineering

23.1 Tuning controllers, in the large view Quoting from Section 16.7:

McCreight s Suffix Tree Construction Algorithm. Milko Izamski B.Sc. Informatics Instructor: Barbara König

ECE-320 Linear Control Systems. Winter 2013, Exam 1. No calculators or computers allowed, you may leave your answers as fractions.

Sampler-B. Secondary Mathematics Assessment. Sampler 521-B

UTC. Engineering 329. Proportional Controller Design. Speed System. John Beverly. Green Team. John Beverly Keith Skiles John Barker.

Maximum Entropy and Exponential Families

EE 370L Controls Laboratory. Laboratory Exercise #7 Root Locus. Department of Electrical and Computer Engineering University of Nevada, at Las Vegas

EE451/551: Digital Control. Relationship Between s and z Planes. The Relationship Between s and z Planes 11/10/2011

The simulation analysis of the bridge rectifier continuous operation in AC circuit

Some facts you should know that would be convenient when evaluating a limit:

Controller Design Based on Transient Response Criteria. Chapter 12 1

Chapter 15 Equilibrium. Reversible Reactions & Equilibrium. Reversible Reactions & Equilibrium. Reversible Reactions & Equilibrium 2/3/2014

1. Description of Finite Heat Release Function

EE451/551: Digital Control. Chapter 7: State Space Representations

arxiv: v1 [physics.gen-ph] 5 Jan 2018

The Hanging Chain. John McCuan. January 19, 2006

Force Reconstruction for Nonlinear Structures in Time Domain

Speed-feedback Direct-drive Control of a Low-speed Transverse Flux-type Motor with Large Number of Poles for Ship Propulsion

1. A dependent variable is also known as a(n). a. explanatory variable b. control variable c. predictor variable d. response variable ANSWER:

Chapter 15 Equilibrium. Reversible Reactions & Equilibrium. Reversible Reactions & Equilibrium. Reversible Reactions & Equilibrium 5/27/2014

Problem set 6 for the course Theoretical Optics Sample Solutions

6.4 Dividing Polynomials: Long Division and Synthetic Division

Methods Higher Tier Practice Paper Unit 1 Markscheme

Algebra I. Slide 1 / 216. Slide 2 / 216. Slide 3 / 216. Polynomials

mn 3 17x 2 81y 4 z Algebra I Definitions of Monomials, Polynomials and Degrees 32,457 Slide 1 / 216 Slide 2 / 216 Slide 3 / 216 Slide 4 / 216

MCH T 111 Handout Triangle Review Page 1 of 3

Geometry of Transformations of Random Variables

Subject: Introduction to Component Matching and Off-Design Operation % % ( (1) R T % (

Fundamental Theorem of Calculus

Wavetech, LLC. Ultrafast Pulses and GVD. John O Hara Created: Dec. 6, 2013

Common Mistakes & How to avoid them Class X - Math. Unit: Algebra. Types of Question Common Mistakes Points to be emphasised. points.

A Queueing Model for Call Blending in Call Centers

MODELS FOR VARIABLE RECRUITMENT (continued)

Millennium Relativity Acceleration Composition. The Relativistic Relationship between Acceleration and Uniform Motion

EE 321 Project Spring 2018

Sampler-A. Secondary Mathematics Assessment. Sampler 521-A

YTÜ Mechanical Engineering Department

6665/01 Edexcel GCE Core Mathematics C3 Silver Level S4

Canimals. borrowed, with thanks, from Malaspina University College/Kwantlen University College

FREQUENCY DOMAIN FEEDFORWARD COMPENSATION. F.J. Pérez Castelo and R. Ferreiro Garcia

6 Dynamic Optimization in Continuous Time

SELF-ERECTING, ROTARY MOTION INVERTED PENDULUM Quanser Consulting Inc.

Control Systems. Control Systems Design Lead-Lag Compensator.

Modelling and Simulation. Study Support. Zora Jančíková

The Laws of Acceleration

Announcements. Office Hours Swap: OH schedule has been updated to reflect this.

Final Exam: know your section, bring your ID!

CHBE320 LECTURE X STABILITY OF CLOSED-LOOP CONTOL SYSTEMS. Professor Dae Ryook Yang

Improved Extended Kalman Filter for Parameters Identification

CSE 5311 Notes 18: NP-Completeness

Chapter 2: One-dimensional Steady State Conduction

Instytut Fizyki Doświadczalnej Wydział Matematyki, Fizyki i Informatyki UNIWERSYTET GDAŃSKI

PN Code Tracking Loops

Simplify each expression. 1. 6t + 13t 19t 2. 5g + 34g 39g 3. 7k - 15k 8k 4. 2b b 11b n 2-7n 2 3n x 2 - x 2 7x 2

18 Numerical Integration of Functions

Process engineers are often faced with the task of

MATLAB/Simulink Based Study of Different Approaches Using Mathematical Model of Differential Equations

Computer Engineering 4TL4: Digital Signal Processing (Fall 2003) Solutions to Final Exam

State variable feedback

Chapter 13, Chemical Equilibrium

An Adaptive Optimization Approach to Active Cancellation of Repeated Transient Vibration Disturbances

2 How far? Equilibrium Answers

Exercise 3: Quadratic sequences

Communicating Special Relativity Theory s Mathematical Inconsistencies

KAMILLA OLIVER AND HELMUT PRODINGER

18.06 Problem Set 4 Due Wednesday, Oct. 11, 2006 at 4:00 p.m. in 2-106

Chapter 15: Chemical Equilibrium

Experiment I Electric Force

Falling Mass and Improved Euler

Final Review. A Puzzle... Special Relativity. Direction of the Force. Moving at the Speed of Light

Masonry Beams. Ultimate Limit States: Flexure and Shear

Experiment 03: Work and Energy

TAYLOR S POLYNOMIAL APPROXIMATION FOR FUNCTIONS

In this assignment you will build a simulation of the presynaptic terminal.

Factorising FACTORISING.

PhysicsAndMathsTutor.com 1

The Effectiveness of the Linear Hull Effect

Variable Impedance Control with an Artificial Muscle Manipulator Using Instantaneous Force and MR Brake

Extended Spectral Nonlinear Conjugate Gradient methods for solving unconstrained problems

UPPER-TRUNCATED POWER LAW DISTRIBUTIONS

Optimal torque control of permanent magnet synchronous machines using magnetic equivalent circuits

To work algebraically with exponential functions, we need to use the laws of exponents. You should

The Lorenz Transform

Planar sheath and presheath

To derive the other Pythagorean Identities, divide the entire equation by + = θ = sin. sinθ cosθ tanθ = 1

Today we re going to talk about time delays, affectionately referred to as e -st in the Laplace domain. Why e -st? Recall: time.

Final Exam Study Guide and Practice Problems Solutions

Zero-Knowledge Protocols

Physics 6C. Special Relativity. Prepared by Vince Zaccone For Campus Learning Assistance Services at UCSB

REVIEW QUESTIONS Chapter 15

Department of Electrical and Computer Engineering ECED4601 Digital Control System Lab3 Digital State Space Model

Lecture 14 - Using the MATLAB Control System Toolbox and Simulink Friday, February 8, 2013

UNCERTAINTY RELATIONS AS A CONSEQUENCE OF THE LORENTZ TRANSFORMATIONS. V. N. Matveev and O. V. Matvejev

FINITE WORD LENGTH EFFECTS IN DSP

A population of 50 flies is expected to double every week, leading to a function of the x

1. Which two values of temperature are equivalent to the nearest degree when measured on the Kelvin and on the

Inverse Functions. Review from Last Time: The Derivative of y = ln x. [ln. Last time we saw that

A MATLAB Method of Lines Template for Evolution Equations

Transcription:

How to reate Matlab Sript an Simulink Moel for Designing a Pole Plaement Controller

Pole Plaement Controller Design H tot Y( Kr B ( R ( AC ( ( BD ( ( P ( AC ( ( BD ( (

Polplaement Equation ( ( ( ( [egree] ( ( ( ( ( B P K D C n n n n n n n P D B C A r n n n n a b b a p Choose egree: Set:

Pole Plaement Example Bertil Thomas, Moern reglerteknik y( k Y,8Y H ( B(,8y U Y,5 k A(,8,5u,5U,5 k,5,5,8,5u,5u k { Z :} (x Desire: ubble pole in,5

Pole Plaement Example,5,5 ( ( n p P,8 (,5,5 ( A B Desire: ubble pole in,5 ( ( D n n C n n a b,5 (,5 (,5 (,8 ( : P BD AC

Pole Plaement Example,5,8 (,5,85,8 (,5,5,8,8 (,5 (,5 (,8 (,5,5,8,5,8,5,8,5,5,8 ACBD P

Pole Plaement Example,8,5,5,8,5,5,8,8,5,5,8,8,5,5,36,3,5» X[,.5; -.8,.5]\[-.8,.5] X -.363.5»

Pole Plaement Example P B,5,5,5 K r P( B(,5,5,5,5 E U R K E C r Y D

Pole Plaement Example E U R K E C r Y D E,5 R,5Y U E,363 U E,363U Differens equations: U (,363 E e,5r, 5y k k k u k ek k,363u

Integrating Blok To avoi resiual error if we have a isturbane V we nee an integrating ontroller. A ( A( ( * During alulations the integrator is plae in A(, here alle A * (. ( easiest

With Integrating Blok Searhe P( has ubble pole,5 an extra pole in origo.,5 (,5 ( ( n p P (,8 ( (,8 (,5,5 ( * A A B ( ( D n n C n n a b *,5 (,5 (,5 ( (,8 ( : P BD A C

With Integrating Blok 3,5,5 (,8,5,5,8 (,8,5,8 ( (,5 (,5 ( (,8 (,5,8,5 (,8,57,5,5,8,5,5,5,8 (,8,8,5,5,8 (» X[,.5,;-.8,.5,.5;.8,,.5]\[.8,-.57,] X.38.876 -.66»

With Integrating Blok P B,5,5,5 K r P( B(,5,5,5,5 C * D( C( (,876,66 ( K r,5,6,38,88,63 (,38,68,5,5,8 Integrator now in C-blok! * C B A,38 D

Controller Differene Equations E U R K E * C r Y D E,5 R,88Y,63Y U,6 E,38 U,6U,38U E U E,6U,38U Differene Equations: ek,5rk,88 yk,63 yk u,6 k ek uk, 38uk

Matlab Sript for Lab 3 Pole plaement requires extensive alulations every time you want to try new poles. This is something you o not have time to o uring the lab you have to automate alulations using a Matlab sript. When solving the preparation tasks, evelop a MATLAB sript to be able to quikly reo the alulations uring the lab with the values of the real proess.

Matlab Sript for Lab 3 % poleplae.m % % Preparation for IE34 Lab 3: Pole plaement ontroller. % % E U GP % R -->Kr-->O--->/C(--->B(/A(----> Y % Htot(: -^ % % --------D(<------------ % % Proess transfer funtion GP has two time onstants Start the sript with a omment (%. That omment is printe when writing help poleplae in the Matlab omman winow goo pratie to show what the sript oes.

Matlab Sript for Lab 3 Prior to the lab, we assume that proess gain an time onstants have the following values: % Proess transfer funtion GP [m] % has two time onstants Kp 3 % Change proess gain if neee T6 % Change first time onstant if neee T % Change seon time onstant if neee s tf('s'; GP Kp / ( T*s / ( T*s [GpNum,GpDen]tfata(GP,'v' These values must be hange to atual proess values at the lab [V]

Assume values prior to lab. KP GP { KP 3 T 6 T } ( Ts( Ts s s s s ( 6 ( 6 7 3 3 3 Perform the system ientifiation at lab. Note! Use sript: [a,p]ap(q,n

Matlab Sript for Lab 3 It is ommon pratie to insert results from the omman winow as ommans in the sript! Kp 3 % Change proess gain if neee T 6 % Change first time onstant if neee T % Change seon time onstant if neee s tf('s'; GP Kp / ( T*s / ( T*s [GpNum,GpDen]tfata(GP,'v' % Default transfer funtion: % 3 % ------------------ % 6 s^ 7 s % GpNum 3 % GpDen 6 7

Matlab Sript for Lab 3 For pole plaement alulations, we nee the proess isretetime moel. Matlab an print the moel in positive ( n or negative ( -n form. % Disretie the proess isp('now isretiing' h.6; % sampling interval HP(GP,h; fprintf('\nhp Negative notation' HP.variable '^-' fprintf('\nhp Positive notation' HP.variable '' % Disrete transfer funtion: % HP Negative notation % Transfer funtion: %.47 ^-.3935 ^- % ----------------------------- % -.877 ^-.8794 ^- % Sampling time (seons:.6 % % HP Positive notation % Transfer funtion: %.47.3935 % ---------------------- % ^ -.877.8794 % Sampling time (seons:.6

Matlab Sript for Lab 3 We nee proess transfer funtion in negative form, split into enominator (A an numerator (B. % HPB/A [B,A]tfata(HP,'v' % HP Negative notation % Transfer funtion: %.47 ^-.3935 ^- % ----------------------------- % -.877 ^-.8794 ^- % B [.4.39] % A [. -.8767.8794]

Matlab Sript for Lab 3 A an B are both of seon egee an for now we use the following preliminary poles to reate the pole plaement polynomial:,7 ±,i an. % 3 poles suggestion: p.7.i; % Change if neee p.7-.i; % Change if neee p3; P ( AC ( ( BD ( ( % Prompt user for pole values % p input('first pole (abi: '; % p input('seon pole (a-bi: '; % isplay('thir pole at origo i'; % Poleplaement polynomial P poly([p,p,p3] % P [. -.4.53 ] When trying many ifferent pole values it might be onvenient to have the sript prompt the user!

Matlab Sript for Lab 3 Controller polynomials C an D: % Controller polynomials C an D % C _*^- % D *^- AC ( ( BD ( ( P ( Parameters oh _ are alulate by ientifiation of the ontroller polynomial s equivalent terms. This algebra an not be performe with Matlab (when the Maple moule is missing but may be one with paper an penil or with Mathematia. When the algebra is mae, Matlab an solve the equation system numerially. You must present the algebrai alulations at the lab!

Parameter names in Matlab % P [. -.4.53 ] [P(4 P(3 P( P(] P(4*^-3 P(4*^- P(4*^- P(4*^- % HPB/A [B,A]tfata(HP,'v' % B [.4.39] [B(3 B( B(] B(3*^- B(*^- B(*^- % A [. -.8767.8794] [A(3 A( A(] A(3*^- A(*^- A(*^- % Controller polynomials C an D % C [ _] _*^- % D [ ] *^- Ientify: AC ( ( BD ( ( P (

Matlab Sript for Lab 3 Desribe your algebrai alulations at the lab! This Matlab an solve left [ B( A( B(3 B( A(3 B(3 ]; right [P(-A(, P(3-A(3, P(4]' ; left \ right; _ ans(, _ ans(, _ ans(3 % _.48 % _ 63.7665 % _ -48.5 Now we have the parameters _ alulate!

Matlab Sript for Lab 3 K r P( B( % KrP(/B( Kr polyval(p, / polyval(b, % Kr 6.664 Now we have all the parameters!

Matlab Sript for Lab 3 % Controller bloks D [ ] D_blok tf( D,[ ],h; fprintf('\nblok D positive notation' D_blok.variable '' % D 63.7665-48.5 % % Blok D positive notation % Transfer funtion: % 63.77-48. % --------------- % % Sampling time (seons:.6

Matlab Sript for Lab 3 % Controller bloks C [ _] C_blok tf([ ],C,h ; fprintf('\nblok C positive notation' C_blok.variable '' % C..48 % % Blok C positive notation % Transfer funtion: % % ---------- %.48 % Sampling time (seons:.6

Matlab Sript for Lab 3 % Total transfer funtion % Kr*B Htot % Htot --------- % A*C B*D % Transfer funtion of ontrolle system: fprintf('\ntotal system, positive notation' Htot tf( Kr*B, onv(a,c onv(b,d,h ; Htot.variable '' Kr B ( AC ( ( BD ( ( % Transfer funtion: %.6639.636 % ----------------------------------- % ^3 -.4 ^.53.776e-7

Matlab Sript for Lab 3 Commans to plot system info. % Print system info. figure('name','step Response of Proess','numbertitle','off' step(gp % step response of proess opt stepdataoptions('stepamplitue',.5, 'InputOffset',.5; figure('name','step Response of Feebak Loop','numbertitle','off' step(htot, opt % step response of feebak loop figure('name','margins of Feebak Loop','numbertitle','off' margin(htot % Gain an phase margins of feebak loop [Y,T]step(Htot, opt; stepinfo(y,t,'settlingtimethreshol',.5

Matlab Sript for Lab 3 How o you hek that the sript is orret an that the poles are orretly plae? [P,Z]pmap(Htot % P %.7.i %.7-.i % Z -.958 Poles are as esire, the sript is orret!

Simulink Moel

Export transfer funtions to Simulink Simulink an simulate ontinuous-time an isrete-time systems together. For the proess it is onvenient to use the ontinuous-time moel. [GpNum,GpDen]tfata(GP,'v' GpNum an GpDen polynomials are importe in Simulink moel. William Sanqvist william@kth.se

Export transfer funtions to Simulink % Controller bloks D [ ] D_blok tf( D,[ ],h; fprintf('\nblok D positive notation' D_blok.variable '' % D 63.7665-48.5 % % Blok D positive notation % Transfer funtion: % 63.77-48. % --------------- % % Sampling time (seons:.6 D polynomial is importe in Simulink moel.

Export transfer funtions to Simulink C [ _] C_blok tf([ ],C,h ; fprintf('\nblok C positive notation' C_blok.variable '' % C..48 % % Blok C positive notation % Transfer funtion: % % ---------- %.48 % Sampling time (seons:.6 C polynomial is importe in Simulink moel.

Export transfer funtions to Simulink % KrP(/B( P( B( Kr polyval(p, / polyval(b, % Kr6.664 K r Kr value is importe in Simulink moel.

Plot Simulation Result in Matlab The following Matlab sript reates one figure for ontrol input an another for proess output. The plots are upate when a new simulation is mae. % stepplot.m % Plots output (y an ontrol input (u. figure('name','output, y','numbertitle','off' plot(t,y linkata on figure('name','control Input,u','numbertitle','off' stairs(t,u linkata on

Simulation Plots Simulation result when referene value is hange from.5v to 3V after 5s. Proess output y(k is ontinous, while ontrol input u(k is isrete.

Matlab sript for C-oe (Not part of the ourse. Matlab an write to a file! For example, the pole plaement ontroller an be printe as a C funtion, whih an be inlue when ompiling a C program. fifopen('pp.','w'; fprintf(fi,'float PolePlaeController(float r, float y\n'; fprintf(fi,'{\n'; fprintf(fi,' stati float pre_u ;\n'; fprintf(fi,' stati float pre_y ;\n'; fprintf(fi,' float e;\n'; fprintf(fi,' float u;\n\n'; fprintf(fi,' e %6.3f*r - %6.3f*y - %6.3f*pre_y;\n',Kr,_,_; fprintf(fi,' u e - %6.3f*pre_u;\n\n',_; fprintf(fi,' pre_u u;\n'; fprintf(fi, pre_y y;\n\n'; fprintf(fi,' return u;\n}\n'; flose(fi;

C-funtion (not part of the Course