Download Modeling using state space

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Equations of motion wikipedia , lookup

Analytical mechanics wikipedia , lookup

Symmetry in quantum mechanics wikipedia , lookup

Oscillator representation wikipedia , lookup

Dynamical system wikipedia , lookup

Transcript
Control Systems Lab
LAB # 3
Modeling using state space
State space
There are several different ways to describe a system of linear differential equations.
The state-space representation is given by the equations:
where x is an n by 1 vector representing the state (commonly position and velocity
variables in mechanical systems), u is a scalar representing the input (commonly a
force or torque in mechanical systems), and y is a scalar representing the output. The
matrices A (n by n), B (n by 1), and C (1 by n) determine the relationships between
the state and input and output variables. Note that there are n first-order differential
equations. State space representation can also be used for systems with multiple
inputs and outputs (MIMO), but we will only use single-input, single-output (SISO)
systems in these tutorials.
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 i 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
Control Systems Lab
 R

i   L
   K m
w 
t    J
   0


LAB # 3
Kb
L
Kf
J
1

0
1
i


L




0  w   0 Vapp(t )
 

0    0 
 


i
y (t )  0 0 1 w  0Vapp(t )
 
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 x is called the state variable , u 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 1.6 & 1.7 represent a system (DC Motor) and the state variables are
i & w and the input is Vapp . Matrix A is the coefficient of the state variables (i, w) ,
Matrix B is the coefficient of the input Vapp. The output y is the output of the system
and here we can choose between i or w to be the output or both and we chose the
speed of the motor w to be our output and represent it as y=w by matrix C and D.


conv : This command is used to convolve two polynomials. It is
particularly useful for determining the expanded coefficients for factored
polynomials. For example, this command can be used to enter the transfer
s2
function H ( s) 
by typing “H=tf([1 2],conv([1 1],[1 -3]))”.
( s  1)( s  3)
series or * : This command is used to combine two transfer functions that
are in series. For example, if H(s) and G(s) are in series, they could be
combined with the command “T=G*H” or “T=series(G,H)”.
2
Control Systems Lab
LAB # 3

parallel : This command is used to combine two transfer functions that are
in parallel. For example, if G(s) is in the forward path and H(s) is in the
feedback path, they could be combined with the command
“T=parallel(G,H)”.

feedback : This command is used to combine two transfer functions that
are in feedback. For example, if G(s) is in the forward path and H(s) is in
the feedback path, they could be combined with the command
“T=feedback(G,H)”.
3
Control Systems Lab
LAB # 3

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 :
sys = ss(A,B,C,D); So it convert the matrices and define them as a
system.

tf2ss : converts the parameters of a transfer function representation of a
given system to those of an equivalent state-space representation.
[A,B,C,D] = tf2ss (num,den) returns the A, B, C, and D matrices of a state
space representation for the single-input transfer function

ss2tf : converts a state-space representation of a given system to an
equivalent transfer function representation.
[num,den] = ss2tf(A,B,C,D) returns the transfer function.
First And Second Order System
The T.F for First order system is
k *a
sa
For example to find the response of the first order system write the following
Matlab code :
% Response First Order system
K=1;
a=1;
num1=a;
den1=[1 a];
x=tf(num1,den1)
impulse(x)
figure
step(x)
4
Control Systems Lab
LAB # 3
Second order systems
k * b2
G( s)  2
S  aS  b 2
% Second Order System
K=1;
a=4;
b=25;
num2=[b^2];
den2=[1 4 25];
x2=tf(num2,den2);
figure
impulse(x2)
figure
step(x2)
5
Control Systems Lab
LAB # 3
Impulse response
Step response
6
Control Systems Lab
LAB # 3
Introduction to Simulink
Exercise
Find the step response for the two parallel transfer functions G1&G2
G1 
2S  3
4
& G2 
2S  5
S  3S  2
2
7