digital controllers_anjan raksit

Upload: sourav

Post on 07-Apr-2018

218 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/3/2019 Digital Controllers_anjan raksit

    1/49

    Digital Controller in a Process Control Loop

  • 8/3/2019 Digital Controllers_anjan raksit

    2/49

    Digital Controller in a Process Control Loop

    In a processor based digital controller, rapid switching from onealgorithm to another (e.g. a P controller to a PID controller) andautomatic tuning of controller parameters are possible.

    No drift problem is encountered in a digital system.

    All the desirable features of a process controller (e.g. anti-integralwind-up, auto/manual modes of operation with bump-less transfer

    etc.) may be easily incorporated while maintaining the highaccuracy and precision of digital systems.

  • 8/3/2019 Digital Controllers_anjan raksit

    3/49

    Digital Controller in a Process Control Loop

    + ADCDigital

    ControllerDACr

    +

    _

    e en mn

    Set pointError

    Errorsequence controlleroutputsequence

    m FinalControlElement

    VProcess

    Controlleroutput

    C

    ADC equivalent

    e en

    Sampler

    m

    n

    m

    C

    Sample & hold

    (holdcapacitor)

    DAC equivalent

    e

    time0

    Error

    en 2

    n

    Errorsequence

    0 1 2 3

    Controlleroutput

    sequence

    DACoutput

    m

    mn

    0 1 2 3n

    time0 2

    m

    Sampling interval (ADC conversion time + computation time)

  • 8/3/2019 Digital Controllers_anjan raksit

    4/49

    Digital Controller in a Process Control Loop

    The error computation may be performed digitally if the set-point is available indigital form (say, from digital keyboard) and the measured variable is digitized withthe ADC.

    +rn+

    DigitalController

    DACen

    Errorsequence

    _Set pointsequence

    (digital)

    mn m Final

    ControlElement

    Process

    ADCCn

    outputsequence

    CV

    Digital System

    Proper selection of the sampling interval is necessary for satisfactory operation ofthe process control loop.

    A large may lead to unstable operation of the loop (because of the extra lagintroduced in the loop), whereas a very small requires a high speed digital hardware(hence high cost) to implement the controller.

  • 8/3/2019 Digital Controllers_anjan raksit

    5/49

    Realization of Digital Controllers(through discrete approximation of analog controllers)

    Proportional (P) Controller

    The controller output at the nth instant is given by

    n p n n n n

    m K e b m b= + = +

    The analog controller output is

    m = Kp

    e + b

    where, Kp = proportional gain,bn = fixed bias.

    Realization of the P controller:

    Kp

    +

    bn

    mn

    en

    m'n

  • 8/3/2019 Digital Controllers_anjan raksit

    6/49

    Realization of Digital Controllers(through discrete approximation of analog controllers)

    Proportional-Integral (PI) Controller

    The analog controller output is

    1.

    t

    p o

    i

    m K e e dt bT

    = + +

    = m+ b, where Ti is the integral time and1 .

    t

    p o

    i

    m K e e dt T

    = +

    Let the integration term be .t

    o I e dt =

    The integration term at the nth instant is .n

    n o I e dt

    = where is the sampling interval

    . .n n

    o ne dt e dt

    = + for n = 1,2,3,..

    Now,( )1

    1. .n n

    no oe dt e dt I

    = =

    Then,

  • 8/3/2019 Digital Controllers_anjan raksit

    7/49

    t

    e

    ( )1

    t n

    t n

    e

    e

    =

    =

    ( )1n n

    This area may be approximated by the shaded rectangle (called the method of

    rectangular integration) as

    Pl Controller

    The second term of the above relation represents the area

    under the curve e for (n 1) t n.

  • 8/3/2019 Digital Controllers_anjan raksit

    8/49

    Using the notation en for t ne = 1n n n I I e= +,

    t

    e

    ( )1

    t n

    t n

    e

    e

    =

    =

    ( )1n n

    Thus,

    ( )1.

    n

    n t nedt e

    =

    Pl Controller

  • 8/3/2019 Digital Controllers_anjan raksit

    9/49

    Similarly the output at the (n 1)th instant may be expressed as

    1n n n I I e= +

    Now, output m at the nth instant may be expressed as

    where

    Pl Controller

    The difference between these two outputs is

    ( )1 1 11

    n n p n n n n

    i

    m m K e e I I T

    = +

  • 8/3/2019 Digital Controllers_anjan raksit

    10/49

    1 1 1, say

    o n n na e a e m = + +

    where, 1o pi

    a K T

    = + and

    1 pa K=

    Pl Controller

    or,1 11n n p p n n

    i

    m e K K e m

    T

    = + +

    1 1

    n

    n n p n n

    i

    e

    m m K e e T

    = +

    ( )1 1 11

    n n p n n n n

    i

    m m K e e I I

    T

    = +

    Substituting the value of (I

    n I

    n-1) for rectangular integration, [(I

    n I

    n-1) = e

    n]

  • 8/3/2019 Digital Controllers_anjan raksit

    11/49

    Realization of the PI Controller

    a1

    ao

    +

    +

    m'n

    delay

    m'n-1

    bn

    (bias)

    mn

    en-1

    delay

    en

    errorsequence

    Controlleroutput

    sequence

    Controller output at the nth instant:

    mn= mn+ bn

    mn= a0en+ a1en-1 + mn-1

    Problem: Develop a digital PI Controller using Trapezoidal rule for integration.

  • 8/3/2019 Digital Controllers_anjan raksit

    12/49

    Velocity or incremental form of PI controller

    The controller output is proportional to the derivative of a standard PIcontroller and it may be expressed as (without bias):

    1 1 1 1n n n n n o n nm m m m m a e a e = = = +

    Velocity form of controller is useful when the actuator is some kind ofadder (integral action), like a stepping motor.

  • 8/3/2019 Digital Controllers_anjan raksit

    13/49

    Software Realization of the PI Controller

    a1

    a0 + +mp

    b

    m

    e1

    e

    # include < studio.h>void main (void)

    {float e = 0, e1, m, mp = 0;float a0, a1, b;float adc (void) ; // digitized error

    void dac (float m ) ; // analog outputa0 = - - - - - - - - ; // Kp [1 + /Ti ]a1 = - - - - -- - - ; // -Kpb = - - - - - - - - - ; // bias

  • 8/3/2019 Digital Controllers_anjan raksit

    14/49

    Software Realization of the PI Controller

    a1

    a0 + +mp

    b

    m

    e1

    e

    for (;;) // continuous loop{ // loop time is the sampling interval e1 = e;e = adc ();mp = mp + a0*e + a1*e1;m = mp + b;

    // provision for saturationif (m < 0) m = 0;if (m > 100) m = 100;dac (m);}

    }

  • 8/3/2019 Digital Controllers_anjan raksit

    15/49

    Software Realization of the PI Controller

    a1

    a0 + +mp

    b

    m

    e1

    e

    float adc (void) // Analog-to-digital conversion{float v;

    scanf (%f, &v); // for (keyboard) simulationreturn v; // (to be replaced for actual} // realization)

    void dac (float m) // Digital-to-analog conversion{

    printf (%f\n, m); // for (VDU) simulation} // (to be replaced for actual realization)

  • 8/3/2019 Digital Controllers_anjan raksit

    16/49

  • 8/3/2019 Digital Controllers_anjan raksit

    17/49

    PD Controller

    Thus the controller output at the nth instant is

    1

    1

    1 1

    or 1

    n n

    n p n d n

    p dd

    n p n n n

    o n n n

    e em K e T b

    K TT

    m K e e b

    a e a e b

    = + +

    = + +

    = + +

    where 1 do p

    Ta K

    = +

    and

    1

    p dK T

    a

    =

  • 8/3/2019 Digital Controllers_anjan raksit

    18/49

    Realization of the PD Controller

    a1

    ao

    + +

    bn

    (bias)

    mn

    en-1

    delay

    en

    (error) Controlleroutput

    Problem: Develop a c program for software realization of the PD Controller.

  • 8/3/2019 Digital Controllers_anjan raksit

    19/49

    PD Controller

    Provision for anti-derivative kick

    To avoid derivative action from a sudden change in set-point, the derivative actionis generally derived from the measured output.

    Now, e = r c

    then, ,de dr dc

    dt dt dt

    =

    ,dc

    dt= assuming set-point r is constant.

    Thus, the controller output may be expressed as,

    p d

    dcm K e T b

    dt

    = +

  • 8/3/2019 Digital Controllers_anjan raksit

    20/49

  • 8/3/2019 Digital Controllers_anjan raksit

    21/49

    Realization of PD Controller with anti-derivative kick

    Problem: Develop a c program for software realization of the PD Controllerwith anti-derivative kick

    ao

    po

    p1

    + +

    en

    error

    cn

    (processoutput)

    cn-1

    delay

    bn

    (bias)

    mn

    (Controller output)

  • 8/3/2019 Digital Controllers_anjan raksit

    22/49

    Realization of Digital Controllers

    (through discrete approximation of analog controllers)

    Proportional-Integral-Derivative (PID) Controller

    The analog controller output is

    1

    ' (say)

    t

    p do

    i

    dem K e edt T b

    T dt

    m b

    = + + +

    = +

    where1

    't

    p do

    i

    dem K e edt T

    T dt

    = + +

    The controller output (without bias) at the nth instant, using backward differencealgorithm, is

    1n n nn p n d

    i

    I e em K e T

    T

    = + +

  • 8/3/2019 Digital Controllers_anjan raksit

    23/49

  • 8/3/2019 Digital Controllers_anjan raksit

    24/49

    ( )11 1 2 12n n d

    n n p n n n n n

    i

    I I T m m K e e e e e

    T

    = + + +

    Using rectangular integration algorithm, 1n n n I I e =

    then, ( )1 1 1 22d

    n n p n n n n n n

    i

    Tm m K e e e e e e

    T

    = + + +

    or,1 2 1

    21 1

    p dd dn n p n p n n

    i

    K TT Tm e K e K e m

    T

    = + + + + +

    or, 1 1 2 2 1n o n n n nm a e a e a e m = + + +

    PID Controller

  • 8/3/2019 Digital Controllers_anjan raksit

    25/49

    1 1 2 2 1n o n n n nm a e a e a e m = + + +

    1

    1

    2 1

    do p

    i

    dp

    Ta KT

    Ta K

    = + +

    = +

    where,

    and2

    p dK Ta

    =

    PID Controller

  • 8/3/2019 Digital Controllers_anjan raksit

    26/49

    Realization of the PID Controller

    1 1 2 2 1n o n n n nm a e a e a e m = + + +

    a

    2

    a1

    ao

    + +

    bn

    (bias)

    mn

    m'n-1

    m'n

    en-2

    en-1

    en

    mn = mn + bnand

  • 8/3/2019 Digital Controllers_anjan raksit

    27/49

  • 8/3/2019 Digital Controllers_anjan raksit

    28/49

    Techniques used for anti-integral windup

    By saturating or limiting the integral value

    By resetting the integral value to zero

    By omitting the integral term

    By adaptive adjustment of controller parameters

  • 8/3/2019 Digital Controllers_anjan raksit

    29/49

    Some anti-integral windup schemes

    Stop integration when PI/PID controller internal output (prior to thesaturation block) exceeds the saturation limits

    + Kp +100

    1000Process

    +_

    +

    n

    Saturation

    r e

    +_

    X

    Multiplier

    0

    11/0

    Stop integration ifsaturated

    C

    Scheme for PI Controller

    hardswitching Scheme

    i

    p

    sT

    K

  • 8/3/2019 Digital Controllers_anjan raksit

    30/49

    + Kp +100

    1000Process

    +

    _+

    n

    Saturation

    r e

    +_

    X

    Multiplier

    0

    11/0

    Stop integration ifsaturated

    C

    Scheme for PI Controller

    hardswitching Scheme

    i

    p

    sT

    K

    Performance of anti-integral windup scheme

    PI control without anti-integral windup PI control with anti-integral windup

  • 8/3/2019 Digital Controllers_anjan raksit

    31/49

    Some anti-integral windup schemes

    Reduce integration gradually as PI/PID controller internal outputexceeds the saturation limits

    + Kp +100

    1000Process

    +_

    +

    Saturation

    r e

    +_

    p

    i

    K

    T

    C

    softswitching Scheme

    +

    G

    G : a constant

    s

    1

  • 8/3/2019 Digital Controllers_anjan raksit

    32/49

    Some anti-integral windup schemes

    Clegg integrator the integrator is set to zero (reset) when the errorcrosses zero

    _

    +

    C

    reset control

    resetSW

    error integrator outputR

  • 8/3/2019 Digital Controllers_anjan raksit

    33/49

  • 8/3/2019 Digital Controllers_anjan raksit

    34/49

    Automatic/Manual modes of Operations

    ControllerFinal

    Control element

    Manual input or commnd

    Auto

    Man

    me

    error

    vProcess

    If there is any difference between the controller output and the manual command, abumpoccurs in the process output when the switch position is altered.

    To provide bump-less transferfrom auto-to-manual change over, specialarrangements may be made for set-point initialization.

    The manual command is driven to equal the controller output when the loop is inAUTO mode.

  • 8/3/2019 Digital Controllers_anjan raksit

    35/49

    Automatic/Manual modes of Operations

    ControllerFinal

    Control element

    Manual input or commnd

    Auto

    Man

    me

    error

    vProcess

    When the loop is in MANual mode, if there is a steady error existing due to anydifference between the set-point of the controller and the process output (under

    manual control), integral term, in case of PI and PID controllers, may wind-up to alarge value, and consequently anti-integral wind-up is necessary for suchsituations.

    To provide bump-less transferfor all the operating modes, incremental or velocityfrom of controller is used with an additional integrator.

  • 8/3/2019 Digital Controllers_anjan raksit

    36/49

  • 8/3/2019 Digital Controllers_anjan raksit

    37/49

  • 8/3/2019 Digital Controllers_anjan raksit

    38/49

    Automatic/Manual modes of Operations

    Digital

    incremental

    controller

    Integrator

    Incremental manual command

    Auto

    Man

    m'ne

    n +

    bn

    (bias)

    m'n m

    n

    Scheme for bump-less transfer

    The presence of integrator at the output ensures a smooth output variation even

    when the actual manual command is different from the actual controller outputunder closed-loop control.

  • 8/3/2019 Digital Controllers_anjan raksit

    39/49

    Realization of the incremental type PID Controller

    a

    2

    a1

    ao

    + +

    bn

    mn

    m'n-1

    m'n

    en-2

    en-1

    en +

    m'n

    Incremental manualCommand

    MAN

    AUTO

    Incremental orVelocity

    Controller

    Integrator

  • 8/3/2019 Digital Controllers_anjan raksit

    40/49

    Automatic tuning of PID Controllers the Relay autotuner

    This is based on a special technique for determining the critical gain Kc and critical

    time period Tc of the process loop.

    Kc is the gain margin of the process loop.

    Controller parameters Kp, Ti and Td are calculated according to Ziegler Nichols(Z-N) rulefor a stable time response.

    Suitable for processes with non-zero dead-time.

    Z-N settings

    gain margin: 2

    Controller Kp Ti Td

    P Controller 0.5 Kc

    PI Controller 0.45 K c Tc/1.2

    PID Controller 0.6 Kc Tc/2 Tc/8

  • 8/3/2019 Digital Controllers_anjan raksit

    41/49

    Automatic tuning of PID Controllers the Relay autotuner

    The critical gain Kc and critical time period Tc are determined from an experimentwith relay (switching element) feedback.

    +

    -D

    0

    D

    Processe v

    Relay

    r = 0

    set pointc+

    _

    The relay control provides ON / OFF control of the process.

    The input r is set to zero.

    The output c oscillates around a mean value of zero (limit-cycle oscillations).

    The process is driven by a square wave of amplitude D.

  • 8/3/2019 Digital Controllers_anjan raksit

    42/49

    Automatic tuning of PID Controllers the Relay autotuner

    +

    -D0

    D

    Processe v

    Relay

    r = 0

    set pointc+

    _

    Assuming the process to be a low-pass system, the process output c containsmainly the fundamental component.

    Thus the error signal e becomes sinusoidal,

    e = A sint

  • 8/3/2019 Digital Controllers_anjan raksit

    43/49

    Automatic tuning of PID Controllers the Relay autotuner

    The relay output v may be found out as follows:

    +

    -D0

    D

    Processe v

    Relay

    r = 0set point

    c+

    _

    v

    D

    0e

    - D

    time

    e0 A

    - A

    v

    D

    0time

    - D

    2

    2

    e = A sint

  • 8/3/2019 Digital Controllers_anjan raksit

    44/49

    Automatic tuning of PID Controllers the Relay autotuner

    +

    -D0

    D

    Processe v

    Relay

    r = 0set point

    c+

    _

    D

    - D

    2

    v

    time

    The Fourier series of the relay output (v) may be expressed as:

    4 1 1sin sin 3 sin 5 .......3 5

    Dv t t t

    = + + +

    The process practically attenuates all higher harmonics other than the fundamental.

    Then the process gain at frequency becomes

    ( )

    4 4

    output amplitude A AG

    Dinput amplitude D

    = = =

  • 8/3/2019 Digital Controllers_anjan raksit

    45/49

    Automatic tuning of PID Controllers the Relay autotuner

    +

    -D0

    D

    Processe v

    Relay

    r = 0set point

    c+

    _

    ( )

    44

    output amplitude A AG

    Dinput amplitude D

    = = =

    Process gain at frequency :

    Now, to maintain steady oscillations at = c, the loop gain is 1 (consideringnegative feedback).

    Thus the gain of the relay controller (i.e. the critical gain) at = c is

    ( )( )c c

    1 4as K . G 1

    c

    c

    DK

    AG

    = = =

    Also G (c) = , as relay phase shift is zero.

    .

  • 8/3/2019 Digital Controllers_anjan raksit

    46/49

    Automatic tuning of PID Controllers the Relay autotuner

    +

    -D0

    D

    Processe v

    Relay

    r = 0set point

    c+

    _

    Thus by knowing the relay amplitude D and by measuring the amplitude A of the

    process output c, critical gain Kc may be determined .

    4

    c

    D

    K A

    =

    Tc may be estimated by measuring the frequency of the output oscillation .2

    c

    c

    T

    =

  • 8/3/2019 Digital Controllers_anjan raksit

    47/49

    Block diagram of the Relay autotuner

    D

    0

    D

    Relay

    +PID

    ControllerProcess

    Manualcommand

    r +

    _

    eM

    A v

    T

    c

    Modeswitch

    M Manual positionA Auto positionT Tune position

    (The Satt Control Autotuner by Satt Control, Sweden)

    At first, the process is brought to equilibrium state ( zero error), bysetting a constant control signal in manual mode.

    The tuning is then activated by pushing the mode switch to tune position.

  • 8/3/2019 Digital Controllers_anjan raksit

    48/49

    Modified relay characteristic for a non-zero set-point

    Manualsetting

    v

    0e

    v

    0t

    Controlleroutput forzero error

    D = 0.1vmax

    The relay amplitude D is initially set to 10% of the controller output-range.

    This amplitude is adjusted after one and a half period to give oscillation of 2% of the mean output.

    This ensures minimum disturbance at the process output due to tuning.

    This adjustment is done by measuring the change in output during the first one and a half period.

    The modified relay amplitude is stored for the next tuning operation.

  • 8/3/2019 Digital Controllers_anjan raksit

    49/49

    D0

    D

    Relay

    +PID

    ControllerProcess

    Manualcommand

    r +

    _

    eM

    A v

    T

    c

    Modeswitch

    M Manual positionA Auto positionT Tune position

    The system is automatically switched to Auto mode after estimating the

    critical gain Kc and critical time period Tc during first 5 period of oscillation.

    The parameters of PID controller (viz. Kp, Ti and Td ) are determined from Kcand Tc according to Z-N rule.

    Satt Control Autotuner