Arb 03 Pid Control

Embed Size (px)

Citation preview

  • 8/13/2019 Arb 03 Pid Control

    1/14

    G52ARBAdvanced Robotics

    Lecture 3

    PID Control

    University of Nottingham G52ARB 2

    Overview PID principles

    basic control algorithm

    PID parameter effects Worked example

    DC motor control

    PID tuning manual methods

    formal methods

    PID implementation pseudo code

  • 8/13/2019 Arb 03 Pid Control

    2/14

    University of Nottingham G52ARB

    Navigation

    control

    3

    the robotmust modulate

    its motor outputs toachieve the desired trajectory

    University of Nottingham G52ARB

    The Sense-Think-Act Cycle

    4

    Repeat! sense the current state! reduce difference between current state and goal state

    Until! current state = goal state

  • 8/13/2019 Arb 03 Pid Control

    3/14

    University of Nottingham G52ARB

    The Sense-Think-Act Cycle

    5

    state

    goal

    compareerror compute

    action requiredto reduce error

    controlaction

    University of Nottingham G52ARB

    Compute the Control Action Present

    the current error proportional

    Past the sum of errors up to present time

    integral

    Future the rate of change of the error

    derivative

    6

  • 8/13/2019 Arb 03 Pid Control

    4/14

    CA (t ) = K p e (t ) + K i t

    0

    e ( )d + K dde (t )

    dt

    University of Nottingham G52ARB

    PID Control

    A proportional-integral-derivative controller (PID

    controller) simply combines these three terms ina weighted sum to obtain the control action

    7

    University of Nottingham G52ARB

    Appropriate Parameters Some applications may not require the use of all

    three terms appropriate parameters can be set to zero in order to

    remove unused terms PI, PD, P or I controllers

    PI particularly common since the integral term is required in order to remove steady-state

    error

    the derivative term is very sensitive to measurement noise

    8

  • 8/13/2019 Arb 03 Pid Control

    5/14

    University of Nottingham G52ARB

    PID Block Diagram

    9

    state

    setpoint

    !error

    P

    controlactionI

    D

    !

    +

    -K i

    t

    0

    e ( )d

    K p e (t )

    K dde

    (t)dt

    P out (t ) = K p e (t )

    University of Nottingham G52ARB

    Proportional Term

    A high proportional gain results in a large changein the output for a given error if the proportional gain is too high, the system can

    become unstable if the proportional gain is too low, the system will be

    very slow responding to changes Proportional term is often the dominant one

    but pure proportional control will not settle at setpoint

    10

  • 8/13/2019 Arb 03 Pid Control

    6/14

    I out (

    t) =

    K i

    t

    0

    e(

    )d

    University of Nottingham G52ARB

    Integral Term

    Contribution is proportional to both themagnitude and the duration of the error sum of the instantaneous error over time

    Integral term accelerates the process towardssetpoint and eliminates steady-state error but easily causes overshoot (the actual value

    crosses over the setpoint and creates an error in theopposite direction)

    11

    D out (t ) = K dde (t )

    dt

    University of Nottingham G52ARB

    Derivative Term

    Contribution is proportional to the rate of changeof the error over time first derivative of the instantaneous error

    Used to slow the rate of change of the error effect is most noticeable near to the setpoint

    Helps reduce overshoot caused by integral term

    Differentiation amplifies signal noise and soderivative can cause instability with noise12

  • 8/13/2019 Arb 03 Pid Control

    7/14

    University of Nottingham G52ARB

    PID Summary

    Proportional gain: K p" K p faster response # instability

    Integral gain: K i " K i elimination of steady state error # overshoot

    Derivative gain: K d " K d decreases overshoot, slows transient response# instability

    13

    CA(

    t) =

    K p

    e(

    t) +

    K i

    t

    0

    e(

    )d

    + K

    d

    de (t )dt

    DC Motor

    +

    -

    v emf (t)

    ! (t)

    R

    L

    I

    LLoadInertialLoad J

    vapp (t)

    -

    +

    " (t)

    Kf! ( " )

    Torqu e

    Angu la r ra te

    Vis cou sfriction

    i ( t )

    University of Nottingham G52ARB 14

    DC Motor Input: voltage vapp (t )

    Output: angular velocity ! (t )

  • 8/13/2019 Arb 03 Pid Control

    8/14

    0 5 10 15 20 - 0 . 5

    0 . 0

    0 . 5

    1 . 0

    1 . 5

    T

    w

    University of Nottingham G52ARB 15

    Open-Loop Controlvapp (t ) = 26.681V

    ! (t ) reaches approx. 1 rotation per second

    0 5 10 15 20 - 0 . 5

    0 . 0

    0 . 5

    1 . 0

    1 . 5

    T

    w

    University of Nottingham G52ARB 16

    P ControlP = 20

    P small: note the steady state error

  • 8/13/2019 Arb 03 Pid Control

    9/14

    0 5 10 15 20 - 0 . 5

    0 . 0

    0 . 5

    1 . 0

    1 . 5

    T

    w

    University of Nottingham G52ARB 17

    P ControlP = 100

    P increases: the steady state error persists, and oscillations appear

    0 5 10 15 20 - 0 . 5

    0 . 0

    0 . 5

    1 . 0

    1 . 5

    T

    w

    University of Nottingham G52ARB 18

    P ControlP = 800

    P increases: oscillations becoming dominant

  • 8/13/2019 Arb 03 Pid Control

    10/14

    0 5 10 15 20 - 0 . 5

    0 . 0

    0 . 5

    1 . 0

    1 . 5

    T

    w

    University of Nottingham G52ARB 19

    P ControlP = 900

    P increases further : unstable behaviour

    0 5 10 15 20 - 0 . 5

    0 . 0

    0 . 5

    1 . 0

    1 . 5

    T

    w

    University of Nottingham G52ARB 20

    PI ControlP = 100, I = 100

    I non-zero: the steady state error is reduced

  • 8/13/2019 Arb 03 Pid Control

    11/14

    0 5 10 15 20 - 0 . 5

    0 . 0

    0 . 5

    1 . 0

    1 . 5

    T

    w

    University of Nottingham G52ARB 21

    PI ControlP = 100, I = 1000

    I increases: rise-time improves, but overshoots are significant

    0 5 10 15 20 - 0 . 5

    0 . 0

    0 . 5

    1 . 0

    1 . 5

    T

    w

    University of Nottingham G52ARB 22

    PID ControlP = 100, I = 1000, D=20

    D non-zero: oscillations are damped

  • 8/13/2019 Arb 03 Pid Control

    12/14

    0 5 10 15 20 - 0 . 5

    0 . 0

    0 . 5

    1 . 0

    1 . 5

    T

    w

    University of Nottingham G52ARB 23

    PID ControlP = 300, I = 1000, D=20

    PID tuned: exceedingly close control

    University of Nottingham G52ARB

    Parameter Tuning If PID parameters are chosen incorrectly

    the process may be unstable its output may diverge, with/without oscillation

    The parameters must be adjusted to achieve thedesired behaviour for a given application PID parameter tuning

    The optimum behaviour is application dependent rise-time must be less than a specified time overshoot may not be allowed minimise the energy required to reach setpoint oscillations may not be permitted

    24

  • 8/13/2019 Arb 03 Pid Control

    13/14

    University of Nottingham G52ARB

    Effects of Increasing Parameters

    25

    Parameter Rise-time Overshoot Settling

    time

    Steady-

    state error

    K p

    K i

    K d

    decrease increasesmall

    changedecrease

    decrease increase increase eliminate

    smallchange

    decrease decrease none

    University of Nottingham G52ARB

    Tuning Methods Manual heuristic method

    set I and D to zero increase P until the output oscillates

    set P to about half the critical oscillating value increase I until the steady-state error is eliminated inan appropriate amount of time for the application

    increase D until overshoot is reduced to acceptable Automated (software) tuning

    repeat automatically induce setpoint changes analyse the process characteristics automatically adjust parameters

    until acceptable26

  • 8/13/2019 Arb 03 Pid Control

    14/14

    University of Nottingham G52ARB

    Ziegler-Nichols Method Set I and D to zero

    increase P until it reaches the critical gain, K c ,at which output oscillates note the oscillation period, P c

    27

    ControlType

    K p K i K d

    P

    PI

    PID

    0.5 K c - -

    0.45 K c 1.2 K p / P c -

    0.6 K c 2 K p / P c K p P c / 8

    loop error[t]= setpoint - actual_position integral[t]= integral[t-1] + error[t]

    derivative[t]= error[t] - error[t-1

    action= Kp * error[t] + Ki * integral[t] * dt +

    Kd * derivative[t] / dt

    wait(dt)

    end loop

    University of Nottingham G52ARB

    Pseudo-Code

    28