Computer Control Systems

Embed Size (px)

Citation preview

  • 8/2/2019 Computer Control Systems

    1/30

    A very important category of real time systems are automatic control

    systems. In fact all control systems are real-time systems because

    they must react to external events within a specified amount of time.

    The operation of computer control systems is usually synchronized by

    a clock signal that determines the sampling period. This sampling

    period specifies the maximum total amount of time that is available for

    A/D and D/A conversions and control computations.

    Computer control systemsComputer control systems

  • 8/2/2019 Computer Control Systems

    2/30

    Control loop variables

    y(t) ory(k) - controlled variable (temperature, pressure, water

    level, flow, speed etc.)r(k) - reference or setpoint i.e. the desired value of the controlled

    variable

    e(k) - control error the difference between the desired value of the

    controlled variable and its actual value e(k)=r(k) - y(k)u(t) oru(k) manipulated variable represents the action that is

    used by the controller to change the controlled variable (control

    valve position, power input of a heating element, speed of a

    cooling fan, fuel flow to an engine or to a boiler)

    Besides, there is usually also one or more disturbance variable(s)d(t) that are external influences affecting the controlled variable

    (changing temperature of the environment, changing load of a

    electric drive or of an engine etc.)

  • 8/2/2019 Computer Control Systems

    3/30

    Examples:

    Digital control

    of an Air Heater:

    Digital speed control

    of a DC motor:

  • 8/2/2019 Computer Control Systems

    4/30

    Two types of real-time control

    systems:1. Embedded Systems

    dedicated control systems the computer is an embedded part of

    some piece equipment

    microprocessors, real-time kernels, RTOS

    aerospace, industrial robots, vehicular

    systems

    2. Industrial Control Systems

    distributed control systems (DCS),

    programmable controllers (PLC),Soft-PLCs

    hierarchically organized, distributed

    control systems

    process industry, manufacturing industry,

  • 8/2/2019 Computer Control Systems

    5/30

    Universal process controllerModular control system:

  • 8/2/2019 Computer Control Systems

    6/30

    Actuators: Control valves

  • 8/2/2019 Computer Control Systems

    7/30

  • 8/2/2019 Computer Control Systems

    8/30

    Control valves with electrical drive typically two phase

    induction motor

  • 8/2/2019 Computer Control Systems

    9/30

    Operation of the analog-to-digital converter (ADC), the digital-

    to-analog converter (DAC) and the zero order hold (ZOH)

    ADC performs two functions:

    1. Analog signal sampling

    Continuous signal is replacedwith a sequence of values

    equally spaced in the time

    domain

    2. Quantization amplitude of

    the signal is represented with a

    discrete set of different values

  • 8/2/2019 Computer Control Systems

    10/30

    Zero order hold is described by the formula

    vvvTktkTkTyty )1()()( e!

    The behavior of the output of standard DAC is that of zero order hold.

    Discontinuous step changes at ZOH output can excite poorly damped

    mechanical modes of the physical process and also cause wear in the

    actuators of the system. A theoretically possible solution is higher order

    hold circuits.

    First order hold:

    vvvv

    v

    v

    vTktkTkTyTky

    T

    kTtkTyty )1()())1(()()( e

    !

    This form of FOH is not causal. Causal FOH can be obtained by

    introducing a delay of one sampling period or using output prediction

    based on extrapolation from previous sampling period.

    vvvv

    v

    v

    vTktkTTkykTy

    T

    kTtkTyty )1())1(()()()( e

    !

    First and higher order hold circuits are normally not used in control

    systems because of the high phase shift they introduce.

  • 8/2/2019 Computer Control Systems

    11/30

  • 8/2/2019 Computer Control Systems

    12/30

    The simplest approach to control: on-off and three

    position control

    Static characteristics of on-off and three position controllers

  • 8/2/2019 Computer Control Systems

    13/30

    1. The higher is the control error the higher the control action

    (manipulated variable) must be

    )()( tertu o!Proportional orP controller r0proportional gain

    Digital P/PI/PID controller

    )s(EsTsT

    r)s(Udt

    )t(deTd)(e

    T)t(er)t(u

    d

    i

    od

    t

    i

    o]

    11[]

    1[

    0

    !! XX

    If the control error equals zero, the manipulated variable is also zero.

    As a result of it, if the controlled plant is non-integrating (i.e. non-

    zero plant input is necessary to have non-zero output), there will

    always be some non-zero steady state error. The value of error will

    be the smaller the higher the proportional gain will be.This is a significant drawback as the majority of the controlled plants

    are non-integrating (some non-zero value of the plant input is

    necessary to compensate for thermal losses, mechanical friction, load

    torque etc. depending on the particular plant being controlled).

  • 8/2/2019 Computer Control Systems

    14/30

    2. Proportional Integral or PI controller

    )(1

    )(]1

    1[)(

    ])(1

    )([)(0

    sEsT

    sTrsE

    sTrsU

    deT

    tertu

    i

    io

    i

    o

    t

    i

    o

    !!

    ! XX Tiintegral time constant

    Due to the presence of the integral term, the manipulated variable(=plant input) can be non-zero even if control error is zero.

    Achieving zero steady state error is therefore possible)

  • 8/2/2019 Computer Control Systems

    15/30

    3. Proportional Integral Derivate PID controller

    Td derivative time constant)(]1

    1[)(

    ])(

    )(1

    )([)(0

    sEsTsT

    rsU

    dt

    tdeTde

    T

    tertu

    d

    i

    o

    d

    t

    io

    !

    !

    XX

    The derivative term does not affect the steady state behavior of the

    control loop (derivative of constant is zero), however it can be used

    to speed up and improve the dynamics response of the control loop

  • 8/2/2019 Computer Control Systems

    16/30

    Digital PID controller

    )s(EsT

    sT

    r)s(U

    dt

    )t(deTd)(e

    T)t(er)t(u

    d

    i

    od

    t

    i

    o]

    11[]

    1[

    0

    !! XX

    Individual terms are often discretized using different methods. The

    proportional term requires no approximation because it is a purely

    static part.

    Integral term: rectangular rule, trapezoid rule

    )k(I)i(eT

    Tr)(e

    T

    rO

    k

    ii

    vo

    t

    i

    o !} !10

    X

    )k(I))i(e)i(e(T

    Tr)(e

    T

    rL

    k

    ii

    vot

    i

    o !} !10

    12

    X

    Backward rectangular rule:

    (it is better than forward rule as it

    immediately reacts to setpoint changes)

    Trapezoid rule:

  • 8/2/2019 Computer Control Systems

    17/30

    ))1()((2

    )1()(finallyand

    ))1()((

    2

    )1()(

    ))1()((2

    )1(

    ))1()((

    2

    )(

    1

    1

    1

    !

    !

    !

    !

    !

    !

    kekeT

    TrkIkI

    keke

    T

    TrkIkI

    ieieT

    TrkI

    ieieT

    TrkI

    i

    voLL

    i

    voLL

    k

    ii

    voL

    k

    ii

    voL

    The formula for calculating the integral term includes summation

    from the beginning (1 or0 depending on the particular rule that is

    used). For implementation it is converted to the form of differenceequation that is updated recursively at each sampling instant. For

    the trapezoid method this can be written in the following way

  • 8/2/2019 Computer Control Systems

    18/30

    This simple approximation is very sensitive to noise and combined

    effects of quantization and sampling may result in erratic behavior, in

    particular if sampling time is small (the response to a slowly and

    linearly growing signal e(t) is then not a small constant but a

    sequence of short peaks with high magnitude)

    Derivative term:

    The simplest approach: backward difference

    )())1()(( kDTkekeTrdt

    deTr vdodo !}

  • 8/2/2019 Computer Control Systems

    19/30

    Better Alternative:

    Multipoint difference:

    Derivative at time kTv is approximated with an average speed of controlerror change at several sampling intervals

    Average error4

    321 ! kkkkkeeee

    e

    v

    kkkk

    v

    kk

    v

    kk

    v

    kk

    v

    kk

    v

    k

    T

    eeee

    T

    ee

    T

    ee

    T

    ee

    T

    ee

    T

    ekD

    6

    33

    5,15,05,05,14

    1)(

    321

    321

    !

    !

    !(!

  • 8/2/2019 Computer Control Systems

    20/30

    IntegralIntegral WindWind--upup

    Internal computation of the integral term

    is practically unlimited, while the physicalmanipulated variable is always limited

    and the limits are hard. As a result of it

    the value of the integral term can

    significantly exceed the value of the

    physically realizable manipulatedvariable. In such a situation, if the setpoint

    is reached and the control error changes

    sign, it takes the a long time before this

    change can also be observed at

    manipulated variable output. Long lasting

    overshoots as can be seen from the figure

    and other problems then result.

  • 8/2/2019 Computer Control Systems

    21/30

    Wind-up can be prevented by using the dynamic limitation of the

    integral term.

    The procedure is as follows:

    1. At each time step k compute the individual terms P(k),I(k) andD(k)

    2. Sum these terms up to calculate the manipulated variable

    u(k)=P(k)+I(k)+D(k)

    3. If the value of the manipulated variable is within limits, it is

    sent to the D/A converter. If not, manipulated variable remains at

    one of its limits, the current value of the integral termI(k) is

    discarded and replaced withI(k-1)

    In the next sampling instant this procedure is repeated. Thus the

    integral term is frozen for the whole time during which themanipulated variable is at its limits and if its value becomes

    smaller after the change of control error sign the effect on

    manipulate variable is immediate.

    As the integral term is frozen at some static value that is not

    specified a priori, this limitation is called dynamic.

  • 8/2/2019 Computer Control Systems

    22/30

    AliasingAliasing)ftsin(A)t(u T2!Harmonic signal with frequency f

    Sampling with period Tv

    )fkTsin(A)k(uv

    T2!

    By sampling harmonic signal with frequencyv

    nffs

    )fkTsin(A)nsin()fkTcos(A)ncos()fkTsin(A

    kT)nff(sinA)k(u

    vv

    vv

    TTTTT

    T

    22222

    2

    !s!

    !s!

    In other words, it is not possible to distinguish betweensampled signal with frequency fand vs nfff O!

    Signal 50 Hz sampled with sampling frequency a) 49 Hz b) 51 Hz

  • 8/2/2019 Computer Control Systems

    23/30

    2v

    ff

    Shannon-Kotlnikov theorem

    This theorem cannot be satisfied for noise signals anti-aliasingfilter is necessary

    Usually analogue low-pass filter is combined with digital filter that

    works with smaller sampling time that is the sampling time of thecontrol algorithm.

    fnfffvs"!Then and aliasing does not occur

  • 8/2/2019 Computer Control Systems

    24/30

    PID Controller Output with PWM modulation

    Tc cycle time

  • 8/2/2019 Computer Control Systems

    25/30

    Tuning ofPID Controllers

    The behavior of the PID controllers depends on 3 parameters:

    r0 - proportional gain

    Ti -integral time constant or reset time

    Td - derivative time constant or rate time

    Their values must be chosen appropriately in order to make the

    control loop:1) stable

    2) well tuned with respect to dynamic responses to setpoint and/or

    external disturbance changes. Typically, these responses should be

    fast and without big over- or undershoots

  • 8/2/2019 Computer Control Systems

    26/30

    If the dynamics ofw(t) and d(t) changes is significantly different (and

    typically it will be different: setpoint is often changed in steps resulting in stepchanges of control error while the disturbances usually cause gradual changes

    of the controlled variable and control error), the controller tuning must be

    optimized either with respect to setpoint tracking or with respect to

    disturbance rejection but it is not possible to achieve both objectives with the

    same controller tuning.

    )()()()()(1

    1)()()(

    )(

    )()(1

    )()(

    )()(1

    )()()(

    sDsGsWsGsG

    sYsWsE

    sD

    sGsG

    sGsW

    sGsG

    sGsGsY

    d

    RS

    RS

    d

    RS

    RS

    !!

    !

    Two different objectives ofPID controllers tuning:

    a) Set-point tracking

    b) Disturbance rejection

  • 8/2/2019 Computer Control Systems

    27/30

    Ziegler Nicholsmethod. This method is suitable for

    disturbance rejection. It exists in two variants.

    1. Variant Ultimate gain method: only P controller is used, I and Dterms are switched off. Proportional gain is gradually increased until

    the stability limit is reached (undamped oscillations with constant

    magnitude). This value of the gain is called the ultimate gain rkand the

    period of oscillations is denoted as the ultimate period Tk. Using these

    two pieces of information the recommended controller tuning can becalculated using the table below.

    Controller ro Ti TdP 0,5rk

    PI 0,45rk 0,85Tk

    PID 0,6rk 0,5Tk 0,125Tk

    Ziegler-Nichols tuning rules ultimate gain method

  • 8/2/2019 Computer Control Systems

    28/30

    2. Variant - Step response method Tangent in the inflection point of

    the response (the point where the

    slope of the response is

    maximum)

    Tu dead time

    Tn rise time

    K steady state gain

    )(

    )(

    g(

    g(

    ! u

    y

    K

    n

    u

    T

    T!5

    Normalized dead

    timeController ro Ti Td

    P 1/(K5

    PI 0,9/(K5 3Tu

    PID 1,2/(K5 2 Tu 0,5 Tu

    Ziegler Nichols tuning rules step response method

  • 8/2/2019 Computer Control Systems

    29/30

    Chien Hrones Reswick method

    Based on the first order plus time delay approximation of the controlled

    plant dynamics. Two possible choices: aperiodic closed loop response and

    closed loop response with ca 20% overshoot. This method gives tuningformulae both for the setpoint tracking and for the disturbance rejection.

  • 8/2/2019 Computer Control Systems

    30/30

    )1()(

    !

    s

    KesG

    DsT

    sX

    Controller No overshoot Max 20% overshoot

    Set-point tracking Disturbancerejection

    Set-point tracking Disturbancerejection

    P ro=0,3X/(KTD) ro=0,3X/(KTD) ro=0,7X/(KTD) ro=0,7X/(KTD)

    PI ro=0,35X/(KTD)Ti=1,2X

    ro=0,6X/(KTD)Ti=4TD

    ro=0,6X/(KTD)Ti=X

    ro=0,7X/(KTD)Ti=2,3TD

    PID ro=0,6X/(KTD)Ti=X

    Td=0,5TD

    ro=0,95X/(KTD)Ti=2,4TDTd=0,42TD

    ro=0,95X/(KTD)Ti=1,35XTd=0,47TD

    ro=1,2X/(KTD)Ti=2TD

    Td=0,42TD

    Chien Hrones Reswick tuning rules