Modeling and Control of a Spring-Mass

Download Report

Transcript Modeling and Control of a Spring-Mass

This Week’s Objectives
• Establish Dynamic Models of System to be
Controlled
– Second Order Systems
• Obtain Solutions using LaPlace Transforms
• Create Simulink Model and Generate
Simulated Results
Modeling of a Spring-MassDamper System
(Modeling of a Second Order System)
• let’s start with a one car system
– suppose we know:
• m1
• k1, L01
•c
mass of the car
spring constant and free length
damping coefficient
f(t)
c
m1
k1,L01
x1
• one car system
– suppose at start (initial condition):
•
•
•
x1 = L01
x 1 = 0
spring is applying zero force
car is at rest
there is no applied force
f(0) = 0
f(t)
c
m1
k1,L01
x1
• one car system
– now we want (final condition):
•
•
•
•
x1 = L01 + 3 cm
we want to move there ‘as fast as possible’
we don’t want to overshoot ‘much’
we want the system to settle down ‘quick’
f(t)
We’re going to need to
properly define these
terms.
c
m1
k1,L01
x1
• one car system
– we have a desired final position
– we can measure the position of the car
– we can set the value of f, the applied force, to
any value we want and constantly adjust it
We’ll pick a value for f that is
related to the difference between
the current measured position and
the desired final position.
f(t)
c
m1
k1,L01
x1
Current
error in
position
Current
position
X1(t)
In Controls Terminology:
X1desired
+
Our controller
Force
value
Dynamics of
system
-
BLOCK DIAGRAM
Any feedback
dynamics
f(t)
c
m1
k1,L01
x1
f(t)
c
• problem statement
– given:
•
•
•
•
•
•
m1
k1, L01
c
x1(0)
 1(0)
x
xd
m1
k1,L01
x1
mass of the car
spring constant and free length
damping coefficient
initial position at t=0
initial velocity at t=0
desired position
– generate values for the input force such that
• the car reaches the desired position within 3 sec
• the car will not overshoot by more than 0.25 cm
• the car will settle within 0.1 cm within 5 sec
f(t)
c
• how to start?
m
• let’s first write the equation
k ,L
of motion
x1
• assume the current position x1>L01 and
that x 1 is positive
1
1
f(t)
cx 1
k1 (x1- L01)
01
m1
f(t) cx 1  k1(x1  L01 )  m1 x1
f(t)
c
m1
k1,L01
x1
m1 x1  cx 1  k1(x1  L01 )  f(t)
• how do you solve for x1(t) if you know f(t)
as well as x1(0) and x1(0)?
f(t)
• we must solve a second
order differential equation
c
m1
k1,L01
x1
m1 x1  cx 1  k1(x1  L01 )  f(t)
• we will write the equation in the Laplace
domain
• Laplace transformations substitute easily
solved algebraic equations for differential
equations
Review of Laplace transforms
• if f(t) is some function of time, then the
Laplace transformation of f(t) can be
written as

F(s)  L f(t)    f(t)e
0
st
dt
• change from the time domain to the 's'
domain
• Example:
Let f(t) = 1 for t > 0. Find F(s).

F(s)    e
0
 st
dt
1 st
 e
s
t 
t 0
 1 s   1 s0 
  e   e 
 s
  s

1

s
• Example:
Let f(t) = eat for t > 0 where ‘a’ is a
constant. Find F(s).

F(s)    e e
0
at
 st

dt    e
1  t(s-a)

e
s-a
0
- t(s-a)
dt
t 
t 0
1
 1     1 0 
 
e  
e 
 s-a
  s-a
 sa
• The LaPlace transform is a linear
operation.
• For any functions f(t) and g(t) and for any
constants, a and b,
L{a f(t) + b g(t)} = a L {f(t)} + b L {g(t)}
• Example:
Let f(t) = cosh(at) = (eat + e-at)/2
for t > 0. Find F(s).
1
1
at
-at
F(s)  L (coshat)  L (e )  L (e )
2
2
1 1  1 1 
 
 

2  sa 2  sa
s
 2
2
s a
• LaPlace transform of the derivative of f(t).
L(f '(t)) = sL (f) - f(0)
L (f "(t)) = s2L (f) - sf(0) - f'(0)
L (f (n)) = snL (f) - sn-1f(0) - sn-2f '(0) - ...
- f(n-1)(0)
• LaPlace transform of the integral of f(t).

L   f (τ ) dτ
0
t
 1
  f(t)
 s

• Laplace transforms have been calculated
for a large variety of functions. Sampling
of these are listed in Table 2.3 of the text
– Modern Control Systems, 9th ed., R.C. Dorf
and R.H. Bishop, Prentice Hall, 2001.
• Inverse transformations are often of the form
G(s)
F(s) 
H(s)
where G(s) and H(s) are polynomials in s
• This ratio must be re-written in terms of its partial
fraction expansion.
• Review the techniques for partial fraction
expansion when the polynomial H(s) has
repeated roots or complex roots.
• Example:
Let
1
F(s) 
(s  a)(s  b)
a≠b . Find f(t)
first perform partial fraction reduction
1
A1
A2
F(s) 


(s  a)(s  b) (s  a) (s  b)
Multiplying the left and right side of the above
equation by (s-a)(s-b) gives
1= A1 (s-b) + A2 (s-a)
Can pick two values for s and then solve
for A1 and A2 from the two equations in two
unknowns.
When s=a, 1= A1(a-b).
When s=b, 1=A2(b-a). Thus
1
-1
A1 
, A2 
(a  b)
(a  b)
• substituting A1 and A2 into F(s) gives
1
-1 
 1  1

F(s) 



(s  a)(s b)  a  b  (s  a) (s  b) 
• Using the linearity of the Laplace
transform,
- 1 
 1   1  1 
1 
  L 

f(t)  
  L 
 a  b    (s  a) 
 (s  b) 
• from previous example
- 1 
 1   1  1 
1 
  L 

f(t)  
  L 
 a  b    (s  a) 
 (s  b) 

 1  at
bt

 e e
 a b 

END OF REVIEW
Back to our problem.
car 1
car 2
car 3
f(t)
c
m1
k1,L01
• equation of motion
x1
m1 x1  cx 1  k1(x1  L01 )  f(t)
• take Laplace transform of left and right side
of equation
m1 L x1   c L x 1   k1L x1   k1 L01 L (1)  F(s)
f(t)
c
m1
k1,L01
x1
m1 L x1   c L x 1   k1L x1 
 k1 L01 L (1)  F(s)
L x 1   sX1(s) x1(0)
2


L x1   s X1(s) s x1(0)  x 1(0)
m1 L x1   c L x 1   k1L x1 
 k1 L01 L (1)  F(s)
m1  s2 X1(s)  s x1(0)  x1(0) 
f(t)
c
m1
k1,L01
x1
1
 c  sX1(s)  x1(0)   k1X1(s)  k1 L 01  F(s)
s


X1(s) m1 s  c s  k1  m1s x1(0)  x 1(0)
2
1
 c x1(0)  k1 L 01  F(s)
s
f(t)
c
• suppose
sec2/m
m1 = 2 kg = 2 N
k1 = 3 N/cm = 300 N/m
L01 = 6 cm = 0.06 m
c = 2.5 N sec/cm = 250 N sec/m
x1(0) = 4 cm = 0.04 m
x 1 (0) = -2 cm/sec = -0.02 m/sec
m1
k1,L01
x1
f(t) is a step input of 8 N starting at t=0
8
F(s) 
s
f(t)
seems like s has units of 1/sec
and X(s) has units of m sec
c
m1
k1,L01
x1
 N sec2  2 
N sec  
N 
 s   250
X1(s)  2
 s   300 
m 
m  
m 


 N sec2  
m 
  s (0.04m)  (-0.02
  2
)
m 
sec 

N sec 
N
1 8N


  250
 (0.04m)   300 0.06 m 
m 
m
s
s


are units consistent?


8
X1(s) 2 s  250 s  300   2 0.04 s  0.02
s
1
 250(0.04)  3000.06
s

2

26
X1(s) 2 s  250 s  300 
 0.08 s  9.96
s
2
26
 0.08 s  9.96
2
0.08
s
 9.96 s  26
s
X1(s)
 3
2
2 s  250 s  300 2 s  250 s2  300 s
• x1(t) = 0.08667
+ 0.00667 e-62.5 t
[-7cosh(61.29 t) – 7.187sinh(61.29 t)]
how do we check the results ?
check boundary conditions
check steady state final position
- final value theorem:
lim sX1 ( s)  0.08667
s 0
How to model the system in Simulink?
f(t)
c
m1
k1,L01
x1
f(t)
c
• suppose
sec2/m
m1 = 2 kg = 2 N
k1 = 3 N/cm = 300 N/m
L01 = 6 cm = 0.06 m
c = 2.5 N sec/cm = 250 N sec/m
x1(0) = 4 cm = 0.04 m
x 1 (0) = -2 cm/sec = -0.02 m/sec
m1
k1,L01
x1
f(t) is a step input of 8 N starting at t=0
f(t)
• let’s model this system
using Simulink
c
m1
k1,L01
x1
• governing differential equation
m1 x1  cx 1  k1(x1  L01 )  f(t)
• for our case, f(t) = 0,
x 1 (0) = -0.02 m/sec, x1(0) = 0.04 m
• thus
f (t) cx 1  k1(x1  L01 )
x1 
m1
f (t) cx 1  k1(x1  L01 )
x1 
m1
• blocks can be grouped into subsystems
x
Current
error in
position
X1desired
+
Our controller
Force
value
-
Any feedback
dynamics
f(t)
c
m1
k1,L01
x1
Dynamics of
system
Current
position
X1(t)
f1
f2
c2
c1
m1
k1, L01
x1
m2
k2, L02
d1
k3, L03
d2
x2
d3
d1 = d2 = 15 cm
d3 = 80 cm
m1 = 2.5 kg
m2 = 5.5 kg
c1 = 8 N sec/m
c2 = 10 N sec/m
k1 = 3 N/cm ; L01 = 6 cm
k2 = 5 N/cm ; L02 = 8 cm
k3 = 4 N/cm ; L03 = 10 cm
Cars 1 and 2 start at rest at their static
equilibrium position.
A constant force f1 = 20N and f2 = -5 N .
Obtain the motion response of the two cars, i.e.
obtain x1(t) and x2(t).
Determine the position of the two cars at static equilibrium when no
forces are applied.
m1
k1, L01
x1
k2, L02
d1
x2
k1 (x1 – L01) = k2 [x2 – (x1 + d1 + L02)]
Car 1 will be in equilibrium when
m2
k2, L02
x1
d1
k3, L03
d2
x2
d3
Car 2 will be in equilibrium when
k2 [x2 – (x1 + d1 + L02)] = k3 [d3 – (x2 + d2 + L03)]
Substituting the given parameters and solving for x1 and x2 gives
x1_equil = 17.06 cm
x2_equil = 46.70 cm
Now write equations of motion of the system.
f1
c1 x 1
k2 [x2 – (x1 + d1 + L02)]
m1
k1 (x1 – L01)
x1
m1 x1  f1  k 2 [x 2  (x1  d1  L02 )]  c1 x 1  k1 (x1  L01 )
f2
c 2 x 2
k2 [x2 – (x1 + d1 + L02)]
x1
m2
d1
k3 [d3 – (x2 + d2 + L03)]
d2
x2
d3
m2 x 2  f 2  k 2 [x 2  (x1  d1  L02 )]  c2 x 2  k3 [d3  (x 2  d 2  L03 )]
m1 x1  f1  k 2 [x 2  (x1  d1  L02 )]  c1 x 1  k1 (x1  L01 )
m2 x 2  f 2  k 2 [x 2  (x1  d1  L02 )]  c2 x 2  k3 [d3  (x 2  d 2  L03 )]
x1 (0)  0.1706m, x 1 (0)  0
x 2 (0)  0.4670m, x 2 (0)  0
position, meters
car 2
car 1
time, sec
This Week’s Objectives
• Establish Dynamic Models of System to be
Controlled
– Second Order Systems
• Obtain Solutions using LaPlace Transforms
• Create Simulink Model and Generate
Simulated Results