0% found this document useful (0 votes)
74 views15 pages

U I (UIU) : Expt. No. 2 M S

The document describes modeling systems using transfer functions and state-space representations. It provides two examples: 1) A cruise control system is modeled using transfer functions, obtaining G(s)=1/(ms+b). Simulations are run for varying mass m and damping b values. 2) A DC motor is modeled using transfer functions, obtaining G(s)=K/(JLs^2+(JR+bL)s+(Rb+K^2)). Simulations are run for varying motor parameters. State-space representations relate the input, output, and state variables through matrices (A, B, C, D). Modeling physical systems using transfer functions and state-space allows understanding

Uploaded by

Maksud Sarker
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
74 views15 pages

U I (UIU) : Expt. No. 2 M S

The document describes modeling systems using transfer functions and state-space representations. It provides two examples: 1) A cruise control system is modeled using transfer functions, obtaining G(s)=1/(ms+b). Simulations are run for varying mass m and damping b values. 2) A DC motor is modeled using transfer functions, obtaining G(s)=K/(JLs^2+(JR+bL)s+(Rb+K^2)). Simulations are run for varying motor parameters. State-space representations relate the input, output, and state variables through matrices (A, B, C, D). Modeling physical systems using transfer functions and state-space allows understanding

Uploaded by

Maksud Sarker
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 15

UNITED INTERNATIONAL UNIVERSITY (UIU)

COURSE NO. EEE 402 (CONTROL SYSTEM LABORATORY)

EXPT. NO. 2

MODELING SYSTEM BY TRANSFER FUNCTION AND STATE SPACE

A. Introduction
To understand and control physical systems, one of the initial requirements is to obtain the mathematical
models of these systems. A model is one that quantitatively describes the relationship between the input and
output of a dynamic system. To model systems, we use physical laws, such as Kirchhoff’s laws for electrical
networks and Newton’s law for mechanical systems, along with simplifying assumptions.

Input u(t) Output y(t)


System: G(s)
or (A,B,C,D)

Figure 2.1
(A system showing input and output)
The classical approach of modeling linear systems is the transfer function technique which is derived from the
differential equation using Laplace transform. Other than transfer function G(s), a system can be modeled by
state-space model such that input and output can be related in the following manner.
1. By transfer function: Y ( s )  G ( s ).U ( s )

x  A x  Bu
2. By state-space: ,
y  C x  Du
Where x represent a set of system variable called state variable that will be discussed in the later section.
Following section will present example of modeling physical system using both transfer function and state
space.

B. Modeling of a cruise control system by transfer function


Physical setup and system equations
In the cruise control system, we consider a car and assume that it travels only in one direction. We
want to apply control to the car so that it has a smooth start-up, along with a constant-speed ride. If
the inertia of the wheels is neglected, and it is assumed that friction (which is proportional to the car's
speed) is what is opposing the motion of the car, then the problem is reduced to the simple mass and
damper system shown below.

1
m f

Frictional force, bv

dv
dt
Figure 2.5
(A cruise control system)

Using Newton's law, modeling equations for this system becomes:


dv
m  bv  f ……………………………………(i)
dt
where f is the force from the engine. For this case, let's assume that
m = 1000kg
b = 50Nsec/m
f = 500N
Transfer Function :Taking the Laplace transform of the modeling equations (1), we find
msV ( s )  bV ( s )  F ( s )

Since our output is the velocity, V(s), the transfer function of the system becomes,
V ( s) 1
G (s)  
F ( s ) ms  b

Matlab code :
m=1000;
b=50;
num=[1];
den=[m,b];
G=tf(num,den)
step(G)

Output :

2
Step Response
0.02

0.018

0.016

0.014

0.012
Amplitude

0.01

0.008

0.006

0.004

0.002

0
0 20 40 60 80 100 120
Time (sec)

Figure 2.6
(Step response of a cruise control system)
Task:
i) Use “for” loop to simulate the above system for different value of b =[5, 15, 50]. You
may use “hold on” and “pause” command inside the loop.
ii) Simulate the above system for different mass value of m =[50, 200, 1000]
iii) Comment on the changes in output in terms of steady state value and settling time.

C. Modeling of a DC motor by transfer function


A common actuator in control systems is the DC motor. It directly provides rotary motion and, coupled
with wheels or drums and cables, can provide transitional motion. The electric circuit of the armature
and the free body diagram of the rotor are shown in the following figure:
R L
T
i

e=K 
V

Figure 2.7
(DC motor)
For this example, we will assume the following values for the physical parameters.
moment of inertia of the rotor (J) = 0.01 kg.m^2/s^2
damping ratio of the mechanical system (b) = 0.1 Nms/rad
electromotive force constant (K) = 0.01 Nm/Amp
electric resistance (R) = 1 ohm J

3
electric inductance (L) = 0.5 H
input (V): Source Voltage
output (theta): position of shaft
The rotor and shaft are assumed to be rigid

The motor torque, T, is related to the armature current, i, by a constant factor K.


T=Ki

The back emf, e, is related to the rotational velocity by the following equation :
d
ek
dt
d  2
d
From Newton’s law, J 2
b  Ki …………………………………………….(i)
dt dt
di d
From Kirchhoff’s law, L  Ri  V  K ……………………………………………(ii)
dt dt
Eliminating i from these two equations we get,
d 2 d
JL 2   bL  JR    Rb  K 2   VK [Here, ω = dθ/dt]
dt dt
Since, the rotational speed is the output and the voltage is the input., the transfer function is
W K
G(s)   [Here, W = sθ]
V JLs   JR  bL  s  ( Rb  K 2 )
2

MATLAB code
J=0.01;
b=0.1;
K=0.01;
R=1;
L=0.5;
num=K;
den=[(J*L) ((J*R)+(L*b)) ((b*R)+K^2)];
G= tf(num,den);
t=0:0.1:10;
step(G,t)

Output:

4
Step Response
0.1

0.09

0.08

0.07

0.06
Amplitude

0.05

0.04

0.03

0.02

0.01

0
0 0.5 1 1.5 2 2.5 3
Time (sec)

Figure 2.8
(Step response of a dc motor)
Task:
i) Simulate the above system for different value of J, b, R. Specially try K=[.01 .05 .5
1 1.5]. Try to explain how system response changes from overdamped to
underdamped condition.
ii) Comment on changes in output responses.

D. State-space representation of dynamic systems:


The state of a system is a set of variables such that the knowledge of these variables and the input
functions will, with the equations describing the dynamics, provide the future state and output of the
system. The state of the system is described by the set of the first-order differential equations written
in terms of state variables (x1, x2, x3, ..., xn). These first-order differential equations can be written
in a general form that can be represented in matrix notation:

x  A x  Bu
y  C x  Du


x  ( n  1) state vector
u  (m  1) input or control signal vector
y  ( p  1) output or signal vector

A  ( n  n) 
B  (n  m) 
 matrices of constant elements
C  ( p  n) 
D  ( p  m)
MATLAB representation of state-space analysis :
Use of ss( ) function

5
Example: Obtain MATLAB representation of a control system described in it’s state-space
representation given by :

 1 1 1
x    x   u and y  [1 1]x  [0]u

0 1 0
The MATLAB codes are given below :
>> A=[1 1;0 -1];
>> B=[1;0];
>> C=[1 1];
>> D=[0];
>> system=ss(A,B,C,D)

The output is obtained as :


a=
x1 x2
x1 1 1
x2 0 -1

b=
u1
x1 1
x2 0

c=
x1 x2
y1 1 1

d=
u1
y1 0
Continuous-time model.

E. Modeling a RLC circuit by state-space:

Analysis of a physical system :


An electrical system :
Example: Consider an RLC series circuit as shown in the figure below:

6
Obtain the state-space representation of this system and obtain the unit step response.
Solution :
1) Let the state variables are, x 1  v c and x 2  i
and the output is v c .
Using Kirchhoff's voltage law, we obtain a differential equation that can be reduced to a set of first-
order system:
dVc di
2) From C  i and L  iR  Vc  Vi we get State Equations:
dt dt
 1
Vc  i
C
 R 1 1
i   Vc  i  vin
L L L
3) Output Equation: y  Vc
Now we can rewrite the above equations in matrix form:

 1  0 
   0  x 

x 1 C 1   x1 
      1 u
y  [1 0]   0.u
 x   1  R   x 2    x 2 
 2  L
 L L
Thus we get four matrices from above two equations:
 1 
 0  0
A=  C B  1 C  [1 0] and, D=[0]
1 R  L 
  
 L L

7
The MATLAB codes are given below (create an M-file):

R= 10;
L= 20;
Cap= 0.05;
A = [0 1/Cap; -1/L -R/L];
B=[0 ;1/L];
C=[1 0];
D=[0];
step(A,B,C,D)

The out put of the step response is shown below:

Step Response
1.5

1
Amplitude

0.5

0
0 5 10 15 20 25
Time (sec)

Task:
Simulate the above system for different value of R,L,C. You can chose to vary R=[5 20 40 100]
to find that the response is changing from underdamped to overdamped. Comment on the
findings.

F. Conversion between transfer function and state-space

Converting a transfer function to state-space representation :


Use of tf2ss( ) command
Example: Obtain the state-space representation of the following transfer function ,
s2
G (s )  3
s  10s 2  15s  150
The MATLAB codes are given below :

>> n=[1 2];


>> d=[1 10 15 150];
>> [A,B,C,D]=tf2ss(n,d)

The output is obtained as


A=
-10 -15 -150
1 0 0
0 1 0
8
B=
1
0
0
C=
0 1 2

D=
0
Converting state-space representation to a transfer function :
Use of ss2tf( ) command
Useful commands :
[n , d ]  ss2 tf ( A, B, C, D, k )
where the argument k is required only if the system has more than one input and specifies kth input.
If the system has only one input, it can be omitted. So, if k=1, the syntax may be,
[ n , d ]  ss 2 tf (A, B, C, D,1)
or,
[n , d ]  ss 2tf ( A, B, C, D)
Example 5.3: Obtain the transfer function of the system described by the following state-space
equations :



x 1  0 1x1 0 
    u x 1 
y  1 0  
  5 10x2 15
and

x 2 
x 2
The MATLAB codes are given below :
>> A=[0 1;-5 -10];
>> B=[0;15];
>> C=[1 0];
>> D=[0];
>> [n,d]=ss2tf(A,B,C,D);
>> G=tf(n,d)
9
And the output is obtained as,
Transfer function:
15
--------------
s^2 + 10 s + 5
G. Response of a MIMO system by State-space approach
State-space approach to plot unit step response :
Use of step(A,B,C,D)
Example:
(a) Obtaining step response for all inputs of a MIMO system: Obtain step response of the
system whose state-space representation is given as,

  1  0.5x1 1. 15 u1


x        
5 .0 0x2 0.5 0u2

10
y1 1 0x1 0 u1
     
y2 0 1x2 0 u2
(b) Obtaining step response for specific input of a MIMO system: Obtain step response of the
same system when only the first input is applied and the second input is zero.
(a)The MATLAB codes are given below :

>> A=[-1 -0.5;5.0 0];


>> B=[1.5 1;0.5 0];
>> C=[1 0;0 1];
>> D=[0 0;0 0];
>> step(A,B,C,D);
The output is given below :

11
Step Response
From: In(1) From: In(2)
0.6

0.4
To: Out(1)
0.2

-0.2
Amplitude

-0.4
5

4
To: Out(2)

0
0 5 10 0 5 10
Time (sec)

(b) The MATLAB codes are given below :

>> A=[-1 -0.5;5.0 0];


>> B=[1.5 1;0.5 0];
>> C=[1 0;0 1];
>> D=[0 0;0 0];
>> step(A,B,C,D,1);
>> grid;
>> gtext('y1');
>> gtext('y2');
>> title('Step response for first input only.');
The output is given as:

Step response for first input only.


0.6

0.4
To: Out(1)

0.2

0 y1

-0.2
Amplitude

-0.4
5

4
y2
To: Out(2)

0
0 2 4 6 8 10 12 14
Time (sec)

12
H. Simulating system response by SIMULINK
Example: Obtain the unit step response of a control system described by the following state-space
representation :

 0 1 0   x 1  0 

x  0 0 1 x  0u x1 

and, y  [1 0 0] x

  2     2
x 3 
4 3 2x2 4
Solution:
Step-1 : Construct the following model using SIMULINK . (State-Space box can be found in
Continuous block library.) Connect the blocks, and set input and output points (e.g., right click on
arrow>linearization points>input).

x' = Ax+Bu
y = Cx+Du
Step State-Space Scope
Step-2 : Double Click the State-Space block and set the values of A,B,C and D .
Step-3 : From the LTI viewer, see the step response . [Click on Tools>Control
Design>LinearAnalysis, then click on Linearize model]

The response should be like the following figure :

13
Task: Simulate the above system in SIMULINK by transfer function.
(Hint: first convert the state-space into transfer function, then bring a transfer function block instead
of state-space block.)

I. Home Work :
2.1 Define rise time, settling time, percentage overshoot and steady state error of a system for step input.

2.2 How steady state speed, rise time and overshoot of the output response vary with the variation of
m and b in the cruise control system? (Figure 2.6)

2.3 What are the differences between SISO and MIMO system. What are the advantages of using State-
Space model to handle a MIMO system ?

2.4 The dynamics of a system is represented by the state-space representation as ,

14
 0 1 0   x 1  0 

x  0 0 1 x  0u x1 

and, y  [1 0 0] x

  2     2
x 3 
2 4 3x2 1
(a) Using state-space equation, find the impulse response.
(b) Using state-space equation, find the step response.
(c) Using SIMULINK model , find the step response.
(d) Obtain the response for an input of u = 1+t for a 6 sec interval using MATLAB dialogue .
[ Hints : Use lsim(A,B,C,D, u, t ) ]

2.5 Find the transfer function G(s) of the above system (A,B,C,D) in problem 2.4. Now convert back the
G(s) into state-space (A1,B1,C1,D1). Are the any differences between (A,B,C,D) and (A1,B1,C1,D1)
? explain why.

15

You might also like