You are on page 1of 30

Computer control systems

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.

Control loop variables y(t) or y(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) or u(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.)

Examples:

Digital control of an Air Heater:

Digital speed control of a DC motor:

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,

Modular control system:

Universal process controller

Actuators: Control valves

Control valves with electrical drive typically two phase induction motor

Operation of the analog-to-digital converter (ADC), the digitalto-analog converter (DAC) and the zero order hold (ZOH)

ADC performs two functions: 1. Analog signal sampling Continuous signal is replaced with 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

Zero order hold is described by the formula y (t ) ! y (kTv ) kTv e t (k  1)Tv 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: t  kTv y (t ) ! y (kTv )  y ((k  1)Tv )  y (kTv ) kTv e t (k  1)Tv Tv 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. t  kTv y (t ) ! y (kTv )  y (kTv )  y ((k  1)Tv ) kTv e t (k  1)Tv Tv First and higher order hold circuits are normally not used in control systems because of the high phase shift they introduce.

The simplest approach to control: on-off and three position control

Static characteristics of on-off and three position controllers

Digital P/PI/PID controller


1t 1 de( t ) ] U ( s ) ! ro [1   Td s]E( s ) u( t ) ! ro [e( t )  e( X )dX  Td dt Ti s Ti 0

1. The higher is the control error the higher the control action (manipulated variable) must be Proportional or P controller u (t ) ! ro e(t ) r0 proportional gain 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. nonzero 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).

2. Proportional Integral or PI controller 1t u (t ) ! ro [e(t )  e(X )dX ] Ti 0 Ti integral time constant

Ti s  1 1 U ( s ) ! ro [1  ]E ( s ) ! ro E ( s) Ti s Ti s 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)

3. Proportional Integral Derivate PID controller 1t de(t ) u (t ) ! ro [e(t )  e(X )dX  Td ] Ti 0 dt 1  Td s ]E ( s ) U ( s ) ! ro [1  Ti s Td derivative time constant

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

Digital PID controller


1t 1 de( t ) ] U ( s ) ! ro [1   Td s]E( s ) u( t ) ! ro [e( t )  e( X )dX  Td dt Ti s Ti 0

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 Backward rectangular rule:
roTv k ro t e( X ) } T e( i ) ! I O ( k ) Ti 0 i i !1

(it is better than forward rule as it immediately reacts to setpoint changes) Trapezoid rule:
ro t roTv k e( X ) } 2T ( e( i )  e( i  1 )) ! I L ( k ) Ti 0 i i !1

The formula for calculating the integral term includes summation from the beginning (1 or 0 depending on the particular rule that is used). For implementation it is converted to the form of difference equation that is updated recursively at each sampling instant. For the trapezoid method this can be written in the following way roTv k I L (k ) ! (e(i)  e(i  1)) 2Ti i !1 roTv k 1 I L (k  1) ! (e(i)  e(i  1)) 2Ti i !1 roTv (e(k )  e(k  1)) I L (k )  I L (k  1) ! 2Ti and finally I L (k ) ! I L (k  1)  roTv (e(k )  e(k  1)) 2Ti

Derivative term:
The simplest approach: backward difference de roTd } roTd (e(k )  e(k  1)) Tv ! D(k ) dt 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)

Better Alternative:
Multipoint difference: Derivative at time kTv is approximated with an average speed of control error change at several sampling intervals Average error ek  ek 1  ek  2  ek 3 ek ! 4 (ek 1 ek  ek ek 1  ek ek  ek 2 ek  ek 3 D(k ) ! ! 1,5T  0,5T  0,5T  1,5T ! Tv 4 v v v v

ek  3ek 1  3ek 2  ek 3 ! 6Tv

Integral Wind-up WindInternal computation of the integral term is practically unlimited, while the physical manipulated 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 manipulated variable. 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.

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) and D(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 term I(k) is discarded and replaced with I(k-1) In the next sampling instant this procedure is repeated. Thus the integral term is frozen for the whole time during which the manipulated 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.

Aliasing
Harmonic signal with frequency f Sampling with period Tv
u( t ) ! A sin( 2Tft ) u( k ) ! A sin( 2TfkTv )

By sampling harmonic signal with frequency f s nf v


u( k ) ! A sin 2T ( f s nf v )kTv ! ! A sin( 2TfkTv ) cos( 2Tn ) s A cos( 2TfkT ) sin( 2Tn ) ! A sin( 2TfkTv )

In other words, it is not possible to distinguish between nf sampled signal with frequency f and f s ! f O v

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

Shannon-Kot lnikov theorem


f fv 2

Then

f s ! f  nf v " f and aliasing does not occur

This theorem cannot be satisfied for noise signals anti-aliasing filter is necessary Usually analogue low-pass filter is combined with digital filter that works with smaller sampling time that is the sampling time of the control algorithm.

PID Controller Output with PWM modulation Tc cycle time

Tuning of PID 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

Two different objectives of PID controllers tuning: a) Set-point tracking b) Disturbance rejection

GS ( s )GR ( s ) Gd ( s ) Y (s) ! W ( s)  D(s ) 1  GS ( s )GR ( s ) 1  GS ( s )GR ( s ) E ( s) ! W (s )  Y (s ) ! 1 W ( s )  Gd ( s ) D( s ) 1  G S ( s )G R ( s )

If the dynamics of w(t) and d(t) changes is significantly different (and typically it will be different: setpoint is often changed in steps resulting in step changes 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.

Ziegler Nichols method. This method is suitable for disturbance rejection. It exists in two variants. 1. Variant Ultimate gain method: only P controller is used, I and D terms 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 rk and the period of oscillations is denoted as the ultimate period Tk. Using these two pieces of information the recommended controller tuning can be calculated using the table below. Controller ro Ti Td P 0,5rk PI PID 0,45rk 0,6rk 0,85Tk 0,5Tk 0,125Tk

Ziegler-Nichols tuning rules ultimate gain method

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 Normalized dead time (y (g) K! (u (g) Tu 5! Tn

Controller P PI PID

ro 1/(K 5

Ti

Td

0,9/(K 5 3Tu 1,2/(K 5 2 Tu 0,5 Tu

Ziegler Nichols tuning rules step response method

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 tuning formulae both for the setpoint tracking and for the disturbance rejection.

Chien Hrones Reswick tuning rules


Controller No overshoot Set-point tracking Disturbance rejection ro=0,3X/(KTD) ro=0,6X/(KTD) Ti=4TD ro=0,95X/(KTD) Ti=2,4TD Td=0,42TD Max 20% overshoot Set-point tracking Disturbance rejection ro=0,7X/(KTD) ro=0,7X/(KTD) Ti=2,3TD ro=1,2X/(KTD) Ti=2TD Td=0,42TD

P PI

ro=0,3X/(KTD) ro=0,35X/(KTD) Ti=1,2X ro=0,6X/(KTD) Ti=X Td=0,5TD

ro=0,7X/(KTD) ro=0,6X/(KTD) Ti=X ro=0,95X/(KTD) Ti=1,35X Td=0,47TD

PID

Ke sTD Gs ( s ) ! (Xs  1)

You might also like