linear control systems laboratorysite.iugaza.edu.ps/hswedan/files/2019/02/experiment-6...linear...

15
Islamic University Of Gaza Faculty of Engineering Electrical Engineering Department Linear Control Systems LABORATORY Prepared By: Eng. Adham Maher Abu Shamla Under Supervision: Dr. Basil Hamed

Upload: others

Post on 20-Feb-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Linear Control Systems LABORATORYsite.iugaza.edu.ps/hswedan/files/2019/02/Experiment-6...Linear Control Systems Lab EELE (3160-3161) Page 3 of 14 In this model, the dynamics of the

Islamic University Of Gaza

Faculty of Engineering

Electrical Engineering Department

Linear Control Systems

LABORATORY

Prepared By:

Eng. Adham Maher Abu Shamla

Under Supervision:

Dr. Basil Hamed

Page 2: Linear Control Systems LABORATORYsite.iugaza.edu.ps/hswedan/files/2019/02/Experiment-6...Linear Control Systems Lab EELE (3160-3161) Page 3 of 14 In this model, the dynamics of the

Linear Control Systems Lab EELE (3160-3161)

Page 1 of 14

Experiment #4

System Modeling by MatLab& LabView

1) Introduction:

What is a system?

In general, the system is a collection of some elements and components that can be organized to take an input and give an output according to it. An example of a system is the DC motor that consists of coils and magnets and takes voltage as input and gives a specific motion as output, so it is a system that transforms the electric energy to a mechanical energy.

What is a plant?

Typically, control engineers begin by developing a mathematical description of the dynamic system that they want to control. The system to be controlled is called a plant. As an example of a plant, this section uses the DC motor and develops the differential equations that describe the electromechanical properties of a DC motor with an inertial load and I want to design a controller to its speed so the motor is called a plant.

What is modeling?

When we go to the real practical work we only see physical devices and our job here is to deal with these physical devices and we know that all our dealing in the university was with mathematical equations, so here we want a translator of the physical devices to a mathematical presentation.

Modeling: is the translator that represents a physical device by its equivalent equations.

In modeling we need some standard physical laws that relate our variables. For example we know that relation between the voltage and current across

a resistor is directly proportional and related by Ohm's law ๐‘‰ = ๐‘… ๐ผ . R: is constant (resistor).

Page 3: Linear Control Systems LABORATORYsite.iugaza.edu.ps/hswedan/files/2019/02/Experiment-6...Linear Control Systems Lab EELE (3160-3161) Page 3 of 14 In this model, the dynamics of the

Linear Control Systems Lab EELE (3160-3161)

Page 2 of 14

2) Model Representation:

The plant of a system can be represented by:

1. Transfer Function H(s) ,for example:

2. State Space Model (SS): is a mathematical model that consist of

simultaneous, first order differential equations and an output equation

for example:

Where A, B, C, and D are matrices of appropriate dimensions, x is the

state vector, and u and y are the input and output vectors.

3. Zero-Pole-Gain Model (ZPK) ,for example:

4. Frequency Response Model.

5. Block Diagram Model.

6. Differential Equations.

3) System Modeling: DC Motor

A simple model of a DC motor driving an inertial load shows the angular rate of the load, ๐Ž(๐’•), as the output and applied voltage, ๐‘ฃ๐‘Ž๐‘๐‘(๐‘ก), as the input.

The ultimate goal of this example is to control the angular rate (speed) by varying the applied voltage.

Figure 4.1: a simple model of the DC motor

Page 4: Linear Control Systems LABORATORYsite.iugaza.edu.ps/hswedan/files/2019/02/Experiment-6...Linear Control Systems Lab EELE (3160-3161) Page 3 of 14 In this model, the dynamics of the

Linear Control Systems Lab EELE (3160-3161)

Page 3 of 14

In this model, the dynamics of the motor itself are idealized; for instance, the magnetic field is assumed to be constant.

The resistance of the circuit is denoted by R and the self-inductance of the armature by L.

The important thing here is that with this simple model and basic laws of physics, it is possible to develop differential equations that describe the behavior of this electromechanical system.

In this example, the relationships between electric potential and mechanical force are Faraday's law of induction and Ampere's law for the force on a conductor moving through a magnetic field.

Mathematical Derivation:

The torque (๐‰) seen at the shaft of the motor is proportional to the current ๐‘–(๐‘ก) induced by the applied voltage,

Where ๐พ๐‘š, the armature constant, is related to physical properties of the motor, such as magnetic field strength, the number of turns of wire around the conductor coil, and so on. The back (induced) electromotive force,๐‘ฃ๐‘’๐‘š๐‘“

is a voltage proportional to the angular rate ๐œ”(๐‘ก) seen at the shaft,

Where ๐พ๐‘, the emf constant, also depends on a certain physical properties of the motor.

So ๐‘น , ๐‘ณ, ๐‘ฒ๐’Ž ๐’‚๐’๐’… ๐‘ฒ๐’ƒ are parameters which be given by the datasheet of the motor.

The mechanical part of the motor equations is derived using Newton's law, which states that the inertial load J times the derivative of angular rate equals the sum of all the torques about the motor shaft.

The result is this equation,

๐›•(๐ญ) = ๐Š๐ฆ โˆ— ๐ข(๐ญ) โ‹ฏ ๐„๐ช๐ฎ๐š๐ญ๐ข๐จ๐ง ๐Ÿ

๐’—๐’†๐’Ž๐’‡(๐ญ) = ๐Š๐› โˆ— ๐›š(๐ญ) โ‹ฏ ๐„๐ช๐ฎ๐š๐ญ๐ข๐จ๐ง ๐Ÿ

๐‘ฑ๐๐›š(๐ญ)

๐๐ญ= โˆ‘ ๐‰๐’Š = โˆ’๐‘ฒ๐’‡ โˆ— ๐Ž(๐’•) + ๐Š๐ฆ โˆ— ๐ข(๐ญ) โ‹ฏ ๐„๐ช๐ฎ๐š๐ญ๐ข๐จ๐ง ๐Ÿ‘

Page 5: Linear Control Systems LABORATORYsite.iugaza.edu.ps/hswedan/files/2019/02/Experiment-6...Linear Control Systems Lab EELE (3160-3161) Page 3 of 14 In this model, the dynamics of the

Linear Control Systems Lab EELE (3160-3161)

Page 4 of 14

Where ๐พ๐‘“ is a linear approximation for viscous friction (๐พ๐‘“ from datasheet).

Finally, the electrical part of the motor equations can be described by

Or, solving for the applied voltage and substituting for the back emf,

This sequence of equations leads to a set of two differential equations that describe the behavior of the motor, the first for the induced current,

and the second for the resulting angular rate,

Now equations 6&7 are differential equations and together describe my DC Motor system.

๐’—๐’‚๐’‘๐’‘(๐ญ) โˆ’ ๐’—๐’†๐’Ž๐’‡(๐ญ) = ๐‹๐๐ข(๐ญ)

๐๐ญ+ ๐‘ โˆ— ๐ข(๐ญ) โ‹ฏ ๐„๐ช๐ฎ๐š๐ญ๐ข๐จ๐ง ๐Ÿ’

๐’—๐’‚๐’‘๐’‘(๐’•) = ๐‹๐๐ข(๐ญ)

๐๐ญ+ ๐‘ โˆ— ๐ข(๐ญ) + ๐‘ฒ๐’ƒ โˆ— ๐›š(๐ญ) โ‹ฏ ๐„๐ช๐ฎ๐š๐ญ๐ข๐จ๐ง ๐Ÿ“

๐๐ข(๐ญ)

๐๐ญ=

๐Ÿ

๐‘ณ๐’—๐’‚๐’‘๐’‘(๐’•) โˆ’

๐‘

๐‘ณโˆ— ๐ข(๐ญ) โˆ’

๐‘ฒ๐’ƒ

๐‘ณโˆ— ๐›š(๐ญ) โ‹ฏ ๐„๐ช๐ฎ๐š๐ญ๐ข๐จ๐ง ๐Ÿ”

๐๐›š(๐ญ)

๐๐ญ= โˆ’

๐‘ฒ๐’‡

๐‘ฑโˆ— ๐Ž(๐’•) +

๐Š๐ฆ

๐‘ฑโˆ— ๐ข(๐ญ) โ‹ฏ ๐„๐ช๐ฎ๐š๐ญ๐ข๐จ๐ง ๐Ÿ•

Page 6: Linear Control Systems LABORATORYsite.iugaza.edu.ps/hswedan/files/2019/02/Experiment-6...Linear Control Systems Lab EELE (3160-3161) Page 3 of 14 In this model, the dynamics of the

Linear Control Systems Lab EELE (3160-3161)

Page 5 of 14

Transfer Function Modeling for DC motor:

By Laplace transform and substituting the value of ๐ผ(๐‘ ) of Eq.7 in Eq.6, we will get one differential equation with input ๐‘‰๐‘Ž๐‘๐‘(๐‘ ) and the output is the

speed of the motor ๐‘Š(๐‘ ),

This T.F. describes the relation between the input voltage and the speed and by plotting the step response of it we will see how the speed will be changed and show the behavior of the motor.

Some experts said that for many motors the armature time constant ๐‘…

๐ฟ is

negligible and therefore:

In time domain:

Where kM = bmf

m

KKRK

K

is the DC Gain.

๐‰m = bmf KKRK

RJ

is the motor time constant.

Also others make Kb = Km = K.

But if you don't want the speed as output, instead of it you want the angle of rotation to be the output then we think about what is the relation between

the angular displacement(angle ฮธ) and the state variable (๐‘– ๐‘œ๐‘Ÿ ๐‘ค) and we found that

)()(

twt

t

๐‘† ๐œƒ (๐‘ ) = ๐‘Š(๐‘ )

bmf

m

KKKJSRLS

K

sV

sW

))(()(

)(

m

M

fmb

fmb

m

fmb

m

S

k

RKKKRKKK

JRS

K

RKKKJRS

K

sV

sW

1

))]((1[)()(

)(

).()( tVktdt

daMm

Page 7: Linear Control Systems LABORATORYsite.iugaza.edu.ps/hswedan/files/2019/02/Experiment-6...Linear Control Systems Lab EELE (3160-3161) Page 3 of 14 In this model, the dynamics of the

Linear Control Systems Lab EELE (3160-3161)

Page 6 of 14

Then the transfer function that relates the voltage (input) with angle (position) is:

State-Space Equations for the DC Motor:

Given the two differential equations derived in the last section, you can now develop a state-space representation of the DC motor as a dynamic system.

The current ๐‘–(๐‘ก) and the angular rate ๐œ”(๐‘ก) are the two states of the system.

The applied voltage ๐‘ฃ๐‘Ž๐‘๐‘(๐‘ก), is the input to the system, and the angular

velocity ๐œ”(๐‘ก) is the output.

The previous state space model represent the output as angular speed and if you want the angle (position) as output we make some understood changes.

)1()))((()(

)(

m

M

bmf

m

SS

k

KKKJSRLSS

K

sV

s

)(0100)(

)(

0

0

1

010

0

0

tVappw

i

ty

tVappL

w

i

J

K

J

KL

K

L

R

w

i

t

fm

b

Page 8: Linear Control Systems LABORATORYsite.iugaza.edu.ps/hswedan/files/2019/02/Experiment-6...Linear Control Systems Lab EELE (3160-3161) Page 3 of 14 In this model, the dynamics of the

Linear Control Systems Lab EELE (3160-3161)

Page 7 of 14

More Details about state space:

The state space model is one of the representation ways that define a system and as well as the transfer function defines a system by its numerator and denominator the state space defines the system by its four matrices A,B,C,D and take the form:

At first, the variable ๐‘ฅ is called the state variable, ๐‘ข is called the input of the system.

The state space can be derived from the differential equations directly, if we note that the two equations 6 & 7 represent a system (DC Motor) and the state variables are ๐‘– & ๐‘ค and the input is ๐‘‰๐‘Ž๐‘๐‘ .

Matrix A is the coefficient of the state variables (๐‘–, ๐‘ค), Matrix B is the coefficient of the input ๐‘‰๐‘Ž๐‘๐‘.

The output ๐‘ฆ is the output of the system and here we can choose between

๐‘– or ๐‘ค to be the output or both and we chose the speed of the motor ๐‘ค to be our output and represent it as ๐‘ฆ = ๐‘ค by matrix ๐ถ ๐‘Ž๐‘›๐‘‘ ๐ท.

4) MatLab Commands & LabView Structure:

By MatLab:

๐’•๐’‡: This command is used to enter transfer functions or represent the system by T.F.

For example, to enter the transfer function,5

2)(

2

s

ssH , you would type

โ‰ช ๐ป = ๐‘ก๐‘“([1 2], [1 0 5]) โ‰ซ.

The first parameter is a row vector of the numerator coefficients. Similarly, the second parameter is a row vector of the denominator coefficients.

Page 9: Linear Control Systems LABORATORYsite.iugaza.edu.ps/hswedan/files/2019/02/Experiment-6...Linear Control Systems Lab EELE (3160-3161) Page 3 of 14 In this model, the dynamics of the

Linear Control Systems Lab EELE (3160-3161)

Page 8 of 14

By LabView:

by using construct transfer function model from control design and simulation library as shown in the figure.

By MatLab:

Series or (*): This command is used to combine two transfer functions that are in series.

For example, if ๐ป(๐‘ ) and ๐บ(๐‘ ) are in series, they could be combined with the command โ‰ช ๐‘‡ = ๐บ โˆ— ๐ป โ‰ซ ๐‘œ๐‘Ÿ โ‰ช ๐‘‡ = ๐‘ ๐‘’๐‘Ÿ๐‘–๐‘’๐‘ (๐บ, ๐ป) โ‰ซ.

Page 10: Linear Control Systems LABORATORYsite.iugaza.edu.ps/hswedan/files/2019/02/Experiment-6...Linear Control Systems Lab EELE (3160-3161) Page 3 of 14 In this model, the dynamics of the

Linear Control Systems Lab EELE (3160-3161)

Page 9 of 14

By LabView:

By using series function from interconnected model in control design and simulation library.

By MatLab:

Parallel or (+): This command is used to combine two transfer functions that are in parallel.

For example, if ๐บ(๐‘ ) is in the forward path and ๐ป(๐‘ ) is in the feedback path, they could be combined with the commandโ‰ช ๐‘‡ = ๐‘๐‘Ž๐‘Ÿ๐‘Ž๐‘™๐‘™๐‘’๐‘™(๐บ, ๐ป) โ‰ซ

Page 11: Linear Control Systems LABORATORYsite.iugaza.edu.ps/hswedan/files/2019/02/Experiment-6...Linear Control Systems Lab EELE (3160-3161) Page 3 of 14 In this model, the dynamics of the

Linear Control Systems Lab EELE (3160-3161)

Page 10 of 14

By LabView:

By using parallel function from interconnected model in control design and simulation library.

Page 12: Linear Control Systems LABORATORYsite.iugaza.edu.ps/hswedan/files/2019/02/Experiment-6...Linear Control Systems Lab EELE (3160-3161) Page 3 of 14 In this model, the dynamics of the

Linear Control Systems Lab EELE (3160-3161)

Page 11 of 14

By MatLab:

Feedback: This command is used to combine two transfer functions that are in feedback.

For example, if ๐บ(๐‘ ) is in the forward path and ๐ป(๐‘ ) is in the feedback path, they could be combined with the command

โ‰ช ๐‘‡ = ๐‘“๐‘’๐‘’๐‘‘๐‘๐‘Ž๐‘๐‘˜(๐บ, ๐ป) โ‰ซ

By LabView:

By using feedback function from interconnected model in control design and simulation library.

Page 13: Linear Control Systems LABORATORYsite.iugaza.edu.ps/hswedan/files/2019/02/Experiment-6...Linear Control Systems Lab EELE (3160-3161) Page 3 of 14 In this model, the dynamics of the

Linear Control Systems Lab EELE (3160-3161)

Page 12 of 14

By MatLab:

ss: This command used to represent a system by state space model and it takes the four parameter matrices A,B,C,D.

For example: ๐‘ ๐‘ฆ๐‘  = ๐‘ ๐‘ (๐ด, ๐ต, ๐ถ, ๐ท);

So it convert the matrices and define them as a system.

By Labview:

By using construct state space model from control design and simulation library as shown in the figure.

Page 14: Linear Control Systems LABORATORYsite.iugaza.edu.ps/hswedan/files/2019/02/Experiment-6...Linear Control Systems Lab EELE (3160-3161) Page 3 of 14 In this model, the dynamics of the

Linear Control Systems Lab EELE (3160-3161)

Page 13 of 14

By MatLab:

tf2ss: converts the parameters of a transfer function representation of a given system to those of an equivalent state-space representation.

[๐ด, ๐ต, ๐ถ, ๐ท] = ๐‘ก๐‘“2๐‘ ๐‘  (๐‘›๐‘ข๐‘š, ๐‘‘๐‘’๐‘›)

Returns the A, B, C, and D matrices of a state space representation for the single-input transfer function.

By LabView:

By using convert to state space model from model conversion in control design and simulation library as shown in the figure

By MatLab:

ss2tf: converts a state-space representation of a given system to an equivalent transfer function representation.

[๐‘›๐‘ข๐‘š, ๐‘‘๐‘’๐‘›] = ๐‘ ๐‘ 2๐‘ก๐‘“(๐ด, ๐ต, ๐ถ, ๐ท);

Returns the transfer function.

By LabView:

By using convert to transfer function model from model conversion in control design and simulation library as shown in the figure.

Page 15: Linear Control Systems LABORATORYsite.iugaza.edu.ps/hswedan/files/2019/02/Experiment-6...Linear Control Systems Lab EELE (3160-3161) Page 3 of 14 In this model, the dynamics of the

Linear Control Systems Lab EELE (3160-3161)

Page 14 of 14

Lab work:

1. What is the transfer function of the DC Motor if the output is: a. Speed. b. Angle.

2. Let: R= 2.0 % Ohms

L= 0.5 % Henrys

Km = 0.015 % torque constant

Kb = 0.015 % emf constant

Kf = 0.2 % N-m/s

J= 0.02 % kg.m2/s2

a. By MatLab & LabView, get the transfer function of the motor

speed.

b. By MatLab & LabView, get the state space of the motor angle.

3. Given the system :

15.0

1

)(

)(2

sssX

sY

a. By MatLab & LabView, get the state space model for it.

b. Manually, get the differential equations of the system.