Pid Controller

User Manual: Pdf pid-controller

Open the PDF directly: View PDF PDF.
Page Count: 21

DownloadPid-controller
Open PDF In BrowserView PDF
Memo

To

To whom it may concern
Reference

Number of pages

2018-04-18

SVN: 53753

21

From

Direct line

E-mail

Jan Mooiman

+31 (0)88 335 8568
+31 06 4691 4571

jan.mooiman@deltares nl

Subject

PID controller mass-spring-damper system
—

DR
AF

Copy to

T

Date

Version control information
Location :

https://repos.deltares.nl/repos/ds/trunk/doc/user_manuals/
white_papers/sobek/pid-controller/pid.tex

Revision :

53753

Contents
1
2
3
4
5

6

7
8
9

PID controller in SOBEK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Aim of this document . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Mass-Spring-Damper system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.1
Energy of Mass-Spring-Damper system . . . . . . . . . . . . . . . . . . . .
Feedback loop, PID-controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.1
Unit impulse function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.2
Unit step function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
PID controller (positional) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.1
Proportional term . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.2
Derivative term . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.3
Integral term . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
PID controller (velocity) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Determine coefficients from experiments . . . . . . . . . . . . . . . . . . . . . . . .
Numerical discretisation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.1
Mass-Spring-Damper system as system of first order PDE’s . . . . . . . . .
9.2
PID controller (positional) . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.2.1
Implicit Mass-Spring-Damper system with explicit PID-controller .
9.2.2
Implicit Mass-Spring-Damper system with implicit PID-controller .
9.2.3
Corrected Mass-Spring-Damper system while using an explicit PID
controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.3
PID controller (velocity) . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.3.1
Implicit Mass-Spring-Damper system with explicit velocity PID controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

2
3
3
3
4
5
5
6
7
8
8
8
10
11
12
12
12
12
12
13
14
14

Date

Reference

Page

2018-04-18

SVN: 53753

2/21

Implicit Mass-Spring-Damper system with implicit velocity PID controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.3.3
Corrected Mass-Spring-Damper system while using an explicit velocity PID controller . . . . . . . . . . . . . . . . . . . . . . . . .
10
Experiments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10.1
Solutions determined by Maplesoft . . . . . . . . . . . . . . . . . . . . . .
10.2
Numerical experiments . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10.2.1
Time integration method . . . . . . . . . . . . . . . . . . . . . .
10.2.2
Convergence behaviour . . . . . . . . . . . . . . . . . . . . . . .
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

T

9.3.2

Used references

14
15
16
17
17
19
21

Berdahl and III (2007),
Callafon (2014),
Rowell (2004),
Yon-Ping (Mass-Damper-Spring systems/PID control of the simplest second-order systems,
eq. 23): PD-Controller, desired set-point will not be reached.
• Rao (2009, pg. 13, eq. 2-39): Integral of Dirac delta functions (unit impulse and unit step
response)
• Åström and Murray (2016, pg. 47 eq. 2.19): Unit step response solution.
• Seborg et al. (2011, §8.6.1)

To Do

DR
AF

•
•
•
•

14

1 Transfer functions.

1

PID controller in SOBEK

The discretised PID-controller in SOBEK2 read:

f n = f n−1 + Kp en + Ki

n
X


ej + Kd en − en−1 ,

(1)

j=0

No literaure references are found for this PID-controller (i.e. Equation (1)).
The proposed discretised PID-controller read:


en − 2en−1 + en−2
f n = f n−1 + Kp en − en−1 + Ki ∆tn en + Kd
∆t
This PID-controller (Equation (2)) is based on the linearisation of the standard PID-controller.

(2)

Date

Reference

Page

2018-04-18

SVN: 53753

3/21

2

Aim of this document

The aim of this document is to find out what each term of the PID-controller does do to a general
system. To reach that goal we look to the Mass-Spring-Damper system without loss of generality.

3

Conclusion

T

Mathematical physics

DR
AF

• Proportional gain factor: influence on equilibrium state. But it does not reach the required
set-point.
• Integral gain factor: influence on the equilibrium state. You need this term to reach the equilibrium state.
• Derivative gain factor: Influence transition time to the equilibrium state, but it does not influence the equilibrium state.

Numerical experiments

Some numerical experiments are performed. Varying time step and varying the time integration
method of the PID-controller. The time integration of the Mass-Spring-Damper-system is implicit.
• Explicit implementation (black box approach of the PID-controller) does have a severe draw
back on the computation time because the ∆t should be decreased w.r.t. the other methods.

4

Mass-Spring-Damper system
k

f (t)

m

c

Figure 1: Drawing of Mass-Spring-Damper system.

Equation of Mass-Spring-Damper system (m > 0, c > 0 and k > 0):

mẍ + cẋ + kx = f (t)

⇔

ẍ +

c
k
1
ẋ + x = f (t)
m
m
m

(3)

Date

Reference

Page

2018-04-18

SVN: 53753

4/21

The natural (free) angular velocity ωn is (c = 0 and f (t) = 0):

r
ωn =

k
,
m

(4)

The decay time constant τ is:

τ=

2m
c

(5)

c
ζ= √
2 mk
The damping ratio is related to ωn .

T

and the damping ratio ζ is:
(6)

4.1

DR
AF

√
−c± c2 −4mk
mr2 + cr + k = 0 ⇒ r1,2 =
2m

−c
Decay of solution is: exp 2m
, so the decay
is: τ = 2m
c
 time constant
−ct
c
Damping rate is: exp (−ζωn t) = exp 2m ⇒ ζωn = 2m ⇒ ζ = 2ωcn m ⇒ ζ = 2√ckm .
2
The equation can also be written as: ẍ + 2ζωn ẋ + ωn
=0
p
p
2
2
1
r + 2ζωn r + ωn = 0 ⇒ r1,2 = ζωn ± 2 4ζ 2 ωn2 − 4ωn2 ⇒ r1,2 = ζωn ± ωn ζ 2 − 1.
p
Define ωd = ωn 1 − ζ 2 as the frequency for the under damped oscillations.
ζ = 0 not damped (oscillations)
ζ < 1 under damped (oscillations)
ζ = 1 critical damped
ζ > 1 over damped

Energy of Mass-Spring-Damper system

Write the Mass-Spring-Damper system as a set of first order of PDE’s, without external forces as:

ẋ = v

mv̇ = −cv − kx,

(7)
(8)

The total energy of the system read:

1
1
Etot = Ekin + Epot = mv 2 + kx2
2
2

(9)

Energy conserving:



d
d 1
1
Etot =
mv 2 + kx2
dt
dt 2
2
= mv v̇ + kxẋ

(10)
(11)

Substituting gives:

d
−cv − kx
Etot = mv
+ kxv = −cv 2 − vkx + kxv = −cv 2
dt
m

(12)

d
So if c = 0 the system is energy conserving, other wise the system is dissipative. If dt
Etot = 0 the
d
Mass-Spring-Damper system is called a Hamiltonian system, if dt
Etot ≤ 0 the Mass-Spring-Damper
system is called a Lyapunov function.

Date

Reference

Page

2018-04-18

SVN: 53753

5/21

5

Feedback loop, PID-controller

Implement the feed back loop (external force is dependent on solution, Berdahl and III (2007)) and
an external force as step function (i.e. new setpoint)

f (t) = −Kp x − Kd ẋ + u(t)

(13)

with
gain factor proportional to x.
gain factor proportional to the time derivative of x (i.e. ẋ, velocity) and
the unit step function is defined as Rao (2009, pg. 13, eq. 2-28):

(
0
u(t) =
1

T

Kp
Kd
u(t)

DR
AF

t<0
t≥0

(14)

After substitution of Equation (13) in Equation (3) (consider only t ≥ 0; assume everything is in rest
for t < 0) we get:

mẍ + cẋ + kx = −Kp x − Kd ẋ + u(t)

(15)

mẍ + (c + Kd )ẋ + (k + Kp )x = u(t)

(16)

To evaluate the stepfunction u(t) of Equation (14), we first discuss the solution for the Dirac delta
function (or unit impulse function) and than the unit step function.

5.1

Unit impulse function

To evaluate the Dirac delta function (or unit impulse function):

(
∞
δ(t − a) =
0

t=a
t 6= a

(17)

δ(t − a)dt = 1

(18)

f (t)δ(t − a)dt = f (a)

(19)

which satisfies

Z

∞

−∞

Z

∞

−∞

Suppose g(t) is the solution of the system:

mg̈ + cġ + kg = δ(t)

(20)

Integrate this equation from 0 to T (T > 0), just the length of the pulse. Resulting in a valid value at
the right hand side

Z T
(mg̈ + cġ + kg) dt =
δ(t) dt
0
0
Z T
Z T
Z T
mg̈ dt +
cġ dt +
kg dt =
δ(t) dt
Z

Z
0

T

T

0

0

0

(21)
(22)

Date

Reference

Page

2018-04-18

SVN: 53753

6/21

Taking the limit as T ↓ 0, we obtain (term by term):

Z

T

lim
T ↓0

mg̈(t) dt = lim mġ(t)|T0 = lim m [ġ(T ) − ġ(0)] = mġ(0+ )
T ↓0

0

T ↓0

ġ(t) is discontinue
(23)

T

lim
T ↓0

T ↓0

0

Z

T

lim
T ↓0

T ↓0

g(t) is continue

kg(t) dt = lim ktg(0)|T0 = lim k [T g(0) − 0g(0)] = 0
T ↓0

T ↓0

0

Z

cġ(t) dt = lim cg(t)|T0 = lim c [g(T ) − g(0)] = 0

T

δ(t) dt = 1
0

and thus

1
m

DR
AF

mġ(0+ ) = 1

⇒

ġ(0+ ) =

because g(0) = 0

T

Z

(24)
(25)
(26)

(27)

Now that we know that the response of a second-order resting system is to change the velocity
(while leaving position unchanged), we can use this fact to obtain the impulse response g(t). In
particular, assuming an underdamped system, we know that the general form of the free response
is given as

g(t) = e−ζωn t (A cos ωd t + B sin ωd t)

(28)

Therefore, with g(0) = 0 and ġ(0+ ) = 1/m the response of the system to a unit impulse at t = 0 is
given as

g(t) =

5.2

(
0

1
−ζωn t sin ω t
d
mωd e

t≤0
t>0

(29)

Unit step function

The unit step function is defined as

(
0
u(t − a) =
1

t 0 we have (integrating Equation (29))

Z t

s(t) =

0

1 −ζωn τ
e
sin ωd τ
mωd



dτ

(39)

After some calculation, using sin x = (eix − e−ix )/2i and (eix + e−ix )/2 = cos x (Rao, 2009), we
get

s(t) =

(
0

t≤0

1
2
mωn



1−

e−ζωn t



cos ωd t +

ζωn
ωd

sin ωd t



t>0

(40)

This solution brings the system to a new equilibrium state:

lim s(t) =

t→∞

6

1
mωn2

(41)

PID controller (positional)

Assume that the equilibrium value x(∞) or setpoint (new equilibrium) is a desired value, the error
(deviation) to that value is defined as: e(t) = x(∞)−x(t). This error (deviation) will be investigated.
The PID-controller can been seen as a external force on the Mass-Spring-Damper-system and read:

Z
f (t) = Kp e(t) + Ki

t

e(τ ) dτ + Kd
0

de(t)
,
dt

where

Kp
Ki
Kd

gain factor proportional to e(t),
gain factor proportional to the time integral of e(t) and
gain factor proportional to the time derivative of e(t).

(42)

Date

Reference

Page

2018-04-18

SVN: 53753

8/21

6.1

Proportional term

Consider just the proportional term, so Ki = Kd = 0.
The proportial term Kp e(t) does influence the equilibrium state of the Mass-Spring-Damper system,
but will not reached the desired equilibrium state x(∞).

mẍ + cẋ + kx = Kp (x(∞) − x)

(43)

mẍ + cẋ + (k + Kp )x = Kp x(∞)

(44)

lim x(t) =

t→∞

Kp
x(∞) and k + Kp > 0
(k + Kp )

T

So the particular solution will not reach the equilibrium state (limt→∞ , and ẍ = ẋ = 0):
(45)

DR
AF

also the free angular frequency is influenced by the proportional gain Kp

r

ωn =

6.2

k + Kp
m

k + Kp > 0

and

(46)

Derivative term

Consider just the derivative term, so Kp = Ki = 0.

The derivative term Kd ė(t) does not influence the equilibrium state of the Mass-Spring-Damper
system:

d
(x(∞) − x)
dt
mẍ + cẋ + kx = Kd (ẋ(∞) − ẋ)

mẍ + cẋ + kx = Kd

(47)
(48)

With ẋ(∞) = 0 for the equilibrium state, so

mẍ + cẋ + kx = −Kd ẋ

(49)

mẍ + (c + Kd )ẋ + kx = 0

(50)

So, just the damping factor (resistance, friction) is adjusted by the derivative gain Kd and the equilibrium state is the same as for the homogeneous solution (ẍ = ẋ = 0):

lim kx(t) = 0

t→∞

⇒

lim x(t) = 0.

t→∞

(51)

Remark: c + Kd > 0 other wise the system is unstable, see section 4.1

6.3

Integral term

Consider just the integral term, so Kp = Kd = 0.

Rt

The integral term Ki 0 e(τ ) dτ does influence the equilibrium state of the Mass-Spring-Damper
system. Switching a Mass-Spring-Damper system to another equilibrium state is done by prescribing

Date

Reference

Page

2018-04-18

SVN: 53753

9/21

a value other than zero as external force. For example a constant value, the integral of a Dirac delta
function or another bounded integral. Prescribing a constant value of 1 will give as equilibrium state
(ẍ = ẋ = 0):

lim (mẍ + cẋ + kx) = 1

(52)

t→∞

kx = 1

⇒

x=

1
k

(53)

Z

∞

δ(t − a)dt = 1
−∞

T

The integral of the Dirac delta function is equal to 1,
(54)

and will give therefore the same solution as above (Equation (53)).

DR
AF

Prescribing the external force as

Z

t

(x(∞) − x(τ )) dτ

f (t) =

(55)

0

will force the solution x(t) to x(∞), because

lim (x(∞) − x(t)) = 0

t→∞

and the integral is bounded (< ∞).

(56)

Date

Reference

Page

2018-04-18

SVN: 53753

10/21

7

PID controller (velocity)

Assume that a equilibrium value x(∞) or setpoint (a new equlibrium), is a desired value, the error (deviation) to that value is defined as:
e(t) = x(∞) − x(t), and need to be investigated.
The PID-controller can been seen as a external force on the Mass-Spring-Damper-system and read:
t

Z
fPID (t) = Kp e(t) + Ki

e(τ ) dτ + Kd
0

de(t)
,
dt

equal to Equation (42)

(57)

de(t)
d2 e(t)
∂fPID
= Kp
+ Ki e(t) + Kd
∂t
dt
dt2
Which comes from the linearisation (i.e. δy = K δx) of the PID-controller:

DR
AF

fPID (t + δt) − fPID (t) = K δt

T

The time derivative (velocity) of the PID-controller (Equation (57)) read:

(58)

(59)

Divide Equation (59) by δt and take limδt→0 , we get:

lim

δt→0

fPID (t + δt) − fPID (t)
=K
δt
∂fPID
= K = RHS Equation (58)
∂t

(60)
(61)

In discrete form of Equation (58) read, with ∆tn = ∆t is constant, en = x(∞) − xn :

en − en−1
en − 2en−1 + en−2
f n − f n−1
= Kp
+ Ki en + Kd
∆tn
∆tn
∆t2


n − en−1
e
en − 2en−1 + en−2
f n = f n−1 + ∆tn Kp
+ Ki en + Kd
2
∆tn
∆t
n − 2en−1 + en−2

e
f n = f n−1 + Kp en − en−1 + Ki ∆tn en + Kd
∆t

(62)
(63)
(64)

Date

Reference

Page

2018-04-18

SVN: 53753

11/21

8

Determine coefficients from experiments

Taken from Callafon (2014)

Estimation of model parameters

DR
AF

T

With the times t0 , tn and the values y0 , yn and y∞ from step response:

Figure 2: Collect data from measurement.

Allows us to estimate:

n
damped resonance frequency
tn − t0


1
y0 − y∞
c =
βω
ln
exponential decay term
n
tn − t0
y0 − y∞
ω
bd = 2π

(65)
(66)

c we can now compute
where n = number of oscillations between tn and t0 . With the estimations of ω
bd and βω
n
ω
bn =
β=

q
c2
ω
bd2 + βω
n
c
βω
n
ω
bn

undamped resonance frequency

damping ratio

(67)
(68)

Date

Reference

Page

2018-04-18

SVN: 53753

12/21

9

Numerical discretisation

9.1

Mass-Spring-Damper system as system of first order PDE’s

The equation of a Mass-Spring-Damper system

mẍ + cẋ + kx = f (t)

(69)

can be written as a system of first order partial differential equations, which read:

ẋ = v

T

(70)

mv̇ = −cv − kx + f (t)

(71)

with initial conditions: ẋ = v = 0 and x = 1. In matrix notation this equation read:

1
0

  
0
ẋ
0
=
m
v̇
−k

1
−c

  

x
0
+
v
f (t)

DR
AF



(72)

This system of equations in discrete form, with ∆tn+1 = tn+1 − tn , read:

m

xn+1 − xn
= vn
∆tn+1

(73)

v n+1 − v n
= −cv n+1 − kxn+1 + f (xn+1 , xn , . . .)
∆tn+1

(74)

Rearranging gives:

xn+1 = xn + ∆tn+1 v n



9.2
9.2.1

(75)



∆tn+1
∆tn+1 n+1
∆tn+1
1+
c v n+1 = v n −
kx
+
f (xn+1 , xn , . . .)
m
m
m

(76)

PID controller (positional)

Implicit Mass-Spring-Damper system with explicit PID-controller

An explicit discrete form of the PID-controller (Equation (42)) read:

f n = Kp en + Ki

n
X

ej ∆tj + Kd

j=0

en − en−1
∆tn

(77)

The system of equations will than read:

xn+1 = xn + ∆tn+1 v n



9.2.2

(78)



∆tn+1 n+1
∆tn+1
1+
c v n+1 = v n −
kx
+
m
m


n
X
∆tn+1 
en − en−1 
n
j
Kp e + Ki
e ∆tj + Kd
m
∆tn
j=0

(79)

Implicit Mass-Spring-Damper system with implicit PID-controller

An implicit discrete form of the PID-controller (Equation (42)) read:

f n+1 = Kp en+1 + Ki

n+1
X
j=0

ej ∆tj + Kd

en+1 − en
∆tn+1

(80)

Date

Reference

Page

2018-04-18

SVN: 53753

13/21

The system of equations will than read:

xn+1 = xn + ∆tn+1 v n


∆tn+1
∆tn+1 n+1
1+
c v n+1 = v n −
kx
+
m
m


n+1
X
∆tn+1 
en+1 − en 
n+1
j
Kp e
+ Ki
e ∆tj + Kd
m
∆tn+1
j=0

(82)

Corrected Mass-Spring-Damper system while using an explicit PID controller

T

9.2.3

(81)



Therefore we will adjust the Mass-Spring-Damper system for the explicit values used by the PID-controller by adding those terms who
will make the PID-controller implicit.
We will separate Equation (77) from Equation (80). The individual terms belonging to Equation (77) will be placed between square
brackets.
n+1
X

ej ∆tj + Kd

en+1 − en
∆tn+1

DR
AF

f n+1 = Kp en+1 + Ki

j=0

(83)

= Kp en+1 − Kp en + [Kp en ] +


n
X
n+1
j
Ki e
∆tn+1 + Ki
e ∆tj 
j=0

+ Kd

en+1

−

en

∆tn+1

− Kd



en − en−1
en − en−1
+ Kd
∆tn
∆tn

(84)

The part between square brackets, is equal to Equation (77), which is the PID-controller based on explicit time levels:

f n = Kp en + Ki

n
X

j=0

ej ∆tj + Kd

en − en−1
∆tn

(85)

So we get:

f n+1 = Kp en+1 − Kp en + Ki en+1 ∆tn+1 + Kd

en+1 − en
en − en−1
− Kd
+ fn
∆tn+1
∆tn

(86)

Substitution of Equation (100) in Equation (76) leads to the following system of equations:

xn+1 = xn + ∆tn+1 v n

(87)





1+

∆tn+1
∆tn+1 n+1
c v n+1 = v n −
kx
+
m
m
1 
∆tn+1
−Kp (xn+1 − xn ) + Ki en+1 ∆tn+1
m

en+1 − en
en − en−1
+Kd
− Kd
+ fn
∆tn+1
∆tn

(88)

Some rearranging:

xn+1 = xn + ∆tn+1 v n


(89)



1+

∆tn+1
∆tn+1
∆tn+1
c v n+1 = v n −
(k + Kp ) xn+1 +
K p xn +
m
m
m
∆tn+1
Ki en+1 ∆tn+1 +
+
m
∆tn+1
en+1 − en
∆tn+1
en − en−1
∆tn+1 n
+
Kd
−
Kd
+
f
m
∆tn+1
m
∆tn
m

f n is given by Equation (77).

(90)

Date

Reference

Page

2018-04-18

SVN: 53753

14/21

9.3
9.3.1

PID controller (velocity)
Implicit Mass-Spring-Damper system with explicit velocity PID controller

An explicit discrete form of the PID-controller based on the linearisation (Equation (58)) read:


en − 2en−1 + en−2
f n = f n−1 + Kp en − en−1 + Ki ∆t en + Kd
,
∆t

equal to Equation (64)

(91)

The system of equations will than read:

xn+1 = xn + ∆tn+1 v n


9.3.2

∆tn+1
∆tn+1 n+1
c v n+1 = v n −
kx
+
m
m



∆tn+1
en − 2en−1 + en−2
f n−1 + Kp en − en−1 + Ki ∆t en + Kd
m
∆t

DR
AF

1+

(92)

T



(93)

Implicit Mass-Spring-Damper system with implicit velocity PID controller

An implicit discrete form of the PID-controller based on the linearisation (Equation (58)) read:


en+1 − 2en + en−1
,
f n+1 = f n + Kp en+1 − en + Ki ∆t en+1 + Kd
∆t

equal to Equation (64)

(94)

The system of equations will than read:

xn+1 = xn + ∆tn+1 v n

1+

9.3.3

(95)





∆tn+1 n+1
∆tn+1
c v n+1 = v n −
kx
+
m
m



∆tn+1
en+1 − 2en + en−1
f n + Kp en+1 − en + Ki ∆t en+1 + Kd
m
∆t

(96)

Corrected Mass-Spring-Damper system while using an explicit velocity PID controller

Therefore we will adjust the Mass-Spring-Damper system for the explicit values used by the velocity PID-controller by adding those terms
who will make the velocity PID-controller implicit.
We will separate Equation (91) from Equation (94). The individual terms belonging to Equation (91) will be placed between square
brackets. ∆t is constant.


en+1 − 2en + en−1
f n+1 = f n + Kp en+1 − en + Ki ∆t en+1 + Kd
∆t


= f n − f n−1 + f n−1 +
 

+ Kp en+1 − 2en + en−1 + Kp en − en−1
+ Ki en+1 ∆tn+1 − Ki en ∆tn + [Ki en ∆tn ]


en − 2en−1 + en−2
+ . . . + Kd
∆t

(97)

(98)

The part between square brackets, is equal to Equation (91), which is the PID-controller based on explicit time levels:


en − 2en−1 + en−2
f n = f n−1 + Kp en − en−1 + Ki ∆t en + Kd
∆t

(99)

So we get:

f n+1 = . . . + f n

(100)

Date

Reference

Page

2018-04-18

SVN: 53753

15/21

Substitution of Equation (100) in Equation (76) leads to the following system of equations:

xn+1 = xn + ∆tn+1 v n


(101)



1+

∆tn+1
∆tn+1 n+1
c v n+1 = v n −
kx
+
m
m
∆tn+1
(. . . + f n )
m

(102)

Some rearranging:

xn+1 = xn + ∆tn+1 v n


(103)

1+

∆tn+1
∆tn+1 n
c v n+1 = v n + . . . +
f
m
m

f n is given by Equation (77).

Experiments

DR
AF

10

T



(104)

Mass-Spring-Damper-system:

mẍ + cẋ + kx = f (t),
Z t
de(t)
f (t) = Kp e(t) + Ki
e(τ ) dτ + Kd
dt
0

with

Initial values: x(0) = 1 and ẋ(0) = 0.
Coefficients: m = 100, c = 2, k = 1.
PID gain factors: Kp = 10.0; Ki = 0.05; Kd = 10.0.
Setpoint: 0.5.

e(t) = x(∞) − x(t).
x(∞) = setpoint.

Table 1: Equilibrium solution.

Kp

Ki

Kd

Equili

10.0

0.0

0.0

0.45

0.0

0.05

0.0

0.5

0.0

0.0

10.0

0.0

(105)
(106)

Date

Reference

Page

2018-04-18

SVN: 53753

16/21

10.1

Solutions determined by Maplesoft

(m=100.0, c=0.0, k=1.0)
(0.5; 0.0, 0.0, 0.0) PID
t_eq: 0.0

Mass Spring Damper
1.00
c=0.0; not damped
0.50; setpoint
0.00; pd-setpoint

0.75
0.50

T

Amplitude [m]

0.25
0.00
0.25

DR
AF

0.50
0.75
1.00

0.00

60.00

120.00

Time [s]

180.00

240.00

300.00

Figure 3: The natural frequency; c = Kp = Ki = Kd = 0.

(m=100.0, c=2.0, k=1.0)
(0.5; 10.0, 0.05, 10.0) PID
t_eq: 300.0
tau : 16.666667
zeta: 0.180907

MassSpringDamper: MapleSoft determined solution

1.0

Analytic
0.50; setpoint
0.45; pd-setpoint

Amplitude [m]

0.8

0.6

0.4

0.2

0.00

60.00

120.00

Time [s]

180.00

240.00

300.00

Figure 4: PID controller on Mass-Spring-Damper using MapleSoft solution. The integral term is
quite small and therefor the influence is noticed after a while.

Date

Reference

Page

2018-04-18

SVN: 53753

17/21

10.2

Numerical experiments
Table 2: Performed numerical experiments.
∆t
0.5 s

∆t
0.25 s

explicit (§9.2.1)

X

X

X

implicit (§9.3.2)

X

X

X

corrected (§9.2.3)

X

X

X

Time integration method

T

∆t
1.0 s

DR
AF

10.2.1

time integration

Figure 5: Numerical experiment (∆t = 1 s); explicit (blue, §9.2.1), implicit (red, §9.3.2), corrected
(black, §9.2.3).

Reference

Page

2018-04-18

SVN: 53753

18/21

DR
AF

T

Date

Figure 6: Numerical experiment (∆t = 0.5 s); explicit (blue, §9.2.1), implicit (red, §9.3.2), corrected (black, §9.2.3).

Figure 7: Numerical experiment (∆t = 0.25 s); explicit (blue, §9.2.1), implicit (red, §9.3.2),
corrected (black, §9.2.3).

Date

Reference

Page

2018-04-18

SVN: 53753

19/21

Convergence behaviour

DR
AF

T

10.2.2

Figure 8: Numerical experiment (explicit §9.2.1); black, ∆t = 1.0 s; red, ∆t = 0.5 s; blue,
∆t = 0.25 s.

Figure 9: Numerical experiment (corrected §9.2.3); black, ∆t = 1.0 s; red, ∆t = 0.5 s; blue,
∆t = 0.25 s.

Reference

Page

2018-04-18

SVN: 53753

20/21

DR
AF

T

Date

Figure 10: Numerical experiment, different ∆t and time integration; explicit (red, ∆t = 0.25 s,
§9.2.1), corrected (black, ∆t = 1.0 s, §9.2.3).

Figure 11: Maple solution (blue) vs corrected (red, ∆t = 1.0 s, §9.2.3).

Date

Reference

Page

2018-04-18

SVN: 53753

21/21

References
Åström, K. J. and R. M. Murray (2016). Feedback Systems. Tech. rep. 3.0h/. Caltech (California
Institute of Technology). URL: http : / / www . cds . caltech . edu / ~murray / amwiki /
index.php/Main_Page.
Berdahl, Edgar J. and Julius O. Smith III (2007). PID Control of a Plucked String. Tech. rep. Center for Computer Research in Music and Acoustics (CCRMA), and the Department of Electrical
Engineering (REALSIMPLE Project∗ ). Stanford, CA: Stanford University.

T

Callafon, R. A. de (2014). Position Control Experiment (MAE171A). URL: http://maecourses.
ucsd.edu/callafon/labcourse/index.html.
Rao, A.V. (2009). Mechanical vibrations: Lecture notes for course EML 4220. URL: http://vdol.
mae.ufl.edu/CourseNotes/EML4220/vibrations.pdf.

DR
AF

Rowell, D. (2004). Review of First- and Second-Order System Response. EducationMIT. URL: http:
//web.mit.edu/2.151/www/Handouts/FirstSecondOrder.pdf.
Seborg, D.E., T.F. Edgar, D.A. Mellichamp, and F.J. Doyle III (2011). Process Dynamics and Control.
John Wiley & Sons, Inc.
Yon-Ping, Chen. Mass-Damper-Spring systems/PID control of the simplest second-order systems.
URL : http://jsjk.cn.nctu.edu.tw/JSJK/DSAS/DSAS_11_12.pdf.



Source Exif Data:
File Type                       : PDF
File Type Extension             : pdf
MIME Type                       : application/pdf
PDF Version                     : 1.5
Linearized                      : No
Page Count                      : 21
Page Mode                       : UseOutlines
Author                          : 
Title                           : 
Subject                         : 
Creator                         : LaTeX with hyperref package
Producer                        : pdfTeX-1.40.18
Create Date                     : 2018:04:18 07:31:28+02:00
Modify Date                     : 2018:04:18 07:31:28+02:00
Trapped                         : False
PTEX Fullbanner                 : This is MiKTeX-pdfTeX 2.9.6588 (1.40.18)
EXIF Metadata provided by
EXIF.tools

Navigation menu