SIMULINK – Module 2

advertisement
SIMULINK – Module 2
Let’s consider the following.
1. Integrate a sine function.

 
 sin d . The answer is  cos  0 = 2
0
This could be visualized as a circuit
sine
function
integrator
output
To do this:
1. Go to Simulink library.
2. Open a new workspace.
3. Click on Commonly used blocks under Simulink
4. On the right column, find the integrator block, select it
and drag it into the workspace.
5. Go to sources (left column) under Simulink, find a
sinusoidal source, select it and drag it into the
workspace at the left of the integrator block.
6. Go to sink (left column), find a scope and drag it in at
the right of the integrator.
7. Connect them as shown
The output on the scope appears to be
If we want to change the initial starting value of the
integral, we double click the integrator and change it in
the parameter list.
How about changing the input source to a step function?
The view on the scope1 shows the input step function
And its integration is shown at the output scope (marked
scope):
How about using a single pulse function as an input? The
pulse function should appear as
Pulse height: 3
pulse width: 5
To produce this signal, we add two step functions.
Step function 1 would be a normal step function rising at
time = 1 of height 3.
Step function two would be a step function rising at time
= 5 of height 3, but added to the first one with reverse
sign (in effect, step function 2 is subtracted from step
function 1).
The two functions are added via a summing node
(polarities have to be changed). The entire system would
look like
The view on scope1 shows the input pulse:
The output on scope shows the integration of this
function.
Another example.
d2y
dy
Solve 2  a  by  sin t with a  0.01, and
dt
dt
b  0.2 .
This can be written as:
d2y
dt 2
Note that
 ( 0.01
dy
 0.2 y )  sin t
dt
d2y
dt
2
dy
dt
integrator
dy
dt
integrator
y
The analog computer for this equation is:
The posted gain on gain1 a = 0.01, and on gain b = 0.2,
respectively.
The output on scope appears to be:
Lets make a  1.0 , and b  0.2
What if we switch these parameters? Now a  0.2 and
b  1.0 . With these,
PID controller.
The issue is: Control of a dynamic object (Plant)
R

error
_
controller
u
plant
Y
Plant is supposed to generate a signal y  f (R) in response
to signal R . Three types of control are envisaged:
■ Proportional control: k p  error
■ Integral control: k I  (error)dt
d (error)
■ Differential control: kd
dt
The sum total control u at time t is therefore
de
dt
Note that the three control features are not independent.
Changing one affects the other.
u  k pe  k I  edt  kd
Suppose we have a dynamic system with a system equation
as follows:
m
d 2x
dt 2
b
dx
 kx  f (t )
dt
with the following parameters:
m 1
k  16 and f (t )  1
b8
Our objective is to find out its
● rise time response (minimize)
● magnitude of the overshoot (minimize)
● magnitude of the steady state error (minimize)
We don’t know our system solution x(t ), but we assume its
Laplace transformation exists and is obtained as
t
L( x(t ))  X s   e  st x(t )dt
0
Some typical transforms
(http://www.me.cmu.edu/ctms/modeling/tutorial/transferfunction/mainframes.htm)
Linearity
Time Domain
f(t) + g(t)
Function
x(t)
1st Derivative
x'(t)
2nd Derivative
x"(t)
nth Derivative
xn(t)
Frequency Domain
Also note some specific cases below
(http://www.intmath.com/Laplace-transformation/Table-laplace-transforms.php)
Time Function f(t)
f(t) =
-1
{F(s)}
Laplace Transform of f(t)
F(s) =
{ f(t)}
1
t (unit-ramp function)
tn (n, a positive integer)
eat
sin ωt
cos ωt
tng(t), for n = 1, 2, ...
t sin ωt
t cos ωt
g(at)
eatg(t)
eattn, for n = 1, 2, ...
Scale property
G(s − a) Shift property
te-t
1 − e-t/T
eatsin ωt
eatcos ωt
Thus, in our case, Laplace transformation of the equation
leads to (assuming all initial conditions are zero)
LT(model equation):
(ms 2  bs  k ) X ( s)  F ( s) or, in terms of transform
function
X (s) 
1
ms  bs  k
2
F ( s )  tf  F ( s )
The function X (s) is the response solution to the input
F (s) . Thus, the transform function determines the profile
of system response.
We try some approaches.
Case A: Open-loop solution (no feedback).
With output
Suppose we introduce proportional control only. Now the
transfer function changes to
TF 
kp
s 2  8s  (16  k p )
Suppose, we let k p  300 . Then the steady state solution
would be 300/316 = 0.95.
The output would appear as
With a significant overshoot. What if we accept it and
introduce the differential control on it? The transfer
function now changes to
TF 
kd s  k p
s 2  (8  kd ) s  (16  k p )
Suppose we let kd  10 . Our system now changes to
With the scope output as
Note the improvement in response behavior. If we
introduce proportional integration error, our transform
function changes to (no derivative control)
TF 
k p s  kI
s3  8s 2  (16  k p ) s  k I
Let k I  70 . Then our system would appear as
With the scope output (note the scale change)
With all the three controls in effect leads to the following
TF.
TF 
kd s 2  k p s  k I
s 3  (8  kd ) s 2  (16  k p ) s  k I
With (kI , k p , kd )  (70,300,10) , we get
Not much improvement. But we note what we need to do.
Consider the following with a PID controller.
The following diagram shows the activity with
effectively three integrators.
The output on the scope depicts a forced damped
harmonic oscillation.
Download