ВУЗ: Не указан

Категория: Не указан

Дисциплина: Не указана

Добавлен: 14.06.2025

Просмотров: 3152

Скачиваний: 0

ВНИМАНИЕ! Если данный файл нарушает Ваши авторские права, то обязательно сообщите нам.

14.2 Basic Concepts

175

Tm

Kp2>Kp1

Ts

Te

Kp1

t

Fig. 14.5. Waveforms for proportional control

e(t) = Ts − Tm:

Vout = Kp × e(t) .

(14.1)

Kp is called the proportional gain of the control circuit. The response of this system to a step change of the set-point temperature is shown in Fig. 14.5.

For moderate values of Kp, and in the absence of disturbances, the system reaches a steady state temperature Te < Ts, when the energy brought into the system by the heater compensates the energy losses. The steady state error (Ts − Te) can be reduced by increasing Kp, but higher values for Kp cause overshoot, or oscillations of the controlled temperature around the set-point value. In fact, for very large values of Kp, the proportional control acts like the on–off control described above. The reason for that is that the heating can only supply a limited power Vmax, and it cannot sink power when Tm > Ts.

Therefore, when Kp is very large, Vout = Vmax, even for small values of the error e(t), as shown in Fig. 14.6. The interval of values for e(t) where Vout takes values in proportion to e(t) is called the proportional band (PB).

The expression (14.1) reflects only the status of the system at the present time. To solve the problem of the steady state error, it is required to adjust V out by adding a term that reflects the evolution of the error in the past. Mathematically, this is expressed by the integral of the error over a period of time. The output of a proportional-integral (PI) control system is described by:

t

Vout = Kp × e(t) + Ki × e(t)dt

(14.2)

0

The constant Ki is called the integral gain. Often, Ki is represented as Ki = 1 ,

Ti

where Ti is called integral time constant of the control system. The response of this system to a step change of the set-point temperature is shown in Fig. 14.7.

Vout

Vmax

Vout=Vmax

Vout=Kp*e(t)

Vout=0

PB e(t)=Ts-Tm

Fig. 14.6. The output of a proportional control system


176 14 PI Temperature Controller

Tm

Kp2>Kp1

Ts

Kp1

t

Fig. 14.7. Response of a PI control system to a step change in the error

The effect of the integral term is to adjust the output of the control circuit, until the time-averaged error is zero. Note that if the error e(t) is large for a long period, for example after a large change of the set-point, or at start-up, then the value of the integral of the error becomes too large, and causes overshoot that takes a long time to recover. One method to avoid this problem (which is called integral wind-up) is to inhibit integral action while the error is outside the proportional band.

The integral action solves the problem of the steady state error, but not the problem of overshoot. In principle, by keeping Kp at relatively low values it is possible to avoid the overshoot, at the expense of a slow response of the system, as shown in Fig. 14.8, curve 1.

To reduce the response time, it is required to adjust Vout by adding a new term to the expression (14.2). This term should be proportional to the speed of variation of the error, e(t), which is the first derivative of e(t). The expression for Vout becomes:

t

de(t)

Vout = Kp × e(t) + Ki ×

e(t)dt + Kd ×

(14.3)

.

dt

0

This is the general expression of the output of a proportional-integral-derivative control system (PID). Kd is called the derivative gain, or damping factor. The derivative term only affects Vout when the error has a fast variation, for example when the set-point value is changed. In steady state, the value of the derivative term is zero. The effect of the derivative term on the response of the system is presented in Fig. 14.8, curve 2.

While the proportional term in the expression for Vout describes the present status of the system, and the integrative term is related to the past evolution of the system, the derivative contains information about the tendency of evolution of the system in the future. Negative values of the derivative mean that the error is decreasing, i.e. the controlled parameter tends to approach the set-point value, and therefore the control

Tm

Ts

21

t

Fig. 14.8. Two possible responses to a step change in the error


14.3 Hardware Implementation of a Microcontroller-Based Temperature Controller

177

action Vout is reduced. This explains the damping effect of the derivative component on the oscillations of the response of the system around the set-point value.

Temperature control systems are in most cases inherently slow-response systems, and therefore the derivative component is seldom useful for temperature control. Moreover, in noisy environments, some noise spikes can be misinterpreted as step changes of the error, and induce instability in the whole system. For these reasons, the example of the temperature controller described in this chapter is a PI type controller.

14.3 Hardware Implementation of a Microcontroller-Based

Temperature Controller

The hardware implementation of the temperature controller uses the HC11 development board described in Chap. 9, along with an expansion board containing the circuits for interfacing the temperature sensor and the heater. The schematic of the interface with the temperature sensor is presented in Fig. 14.9.

The actual temperature sensor is an RTD (Resistance Temperature Detector), connected to J1. The RTD used in this design example has a nominal resistance of 100 ohms at 0 ◦C, and a rate of variation with the temperature of +0.4 ohms/◦C. To sense the variation of the resistance, a constant current of 2.5 mA is supplied by the voltage-to-current converter made with the operational amplifier IC2B, the transistor

Q1 and the resistor R3. The current generated by the converter is I 0 = VREF−VA ,

R3

where VA is a fraction of VREF, adjustable by means of the potentiometer R2. VREF is a 2.5 V reference voltage generated by the special circuit MAX872. IC2A is a voltage follower intended to separate the reference generator from the load. The variations of the voltage on the RTD sensor are sensed and amplified by the differential amplifier IC3, and applied to the analog input AN1 of the MCU. The gain of IC3 is 10, so that the voltage on the analog input AN1 has a variation of 10 mV/◦C. By tuning the value of the reference voltage VREF of the A/D converter at 2.55 V, each 10 mV quantum corresponds to 1 ◦C temperature; thus the value read by the A/D converter directly represents the temperature.

The circuit ICL7660 (IC5) creates the negative voltage (−5 V) required to supply the operational amplifiers.

Vpp

IC4

R1

IC1

C2

IC2A

VREF

R3

VI

VO

AVCC

2

VIN COMP 8

TL082

C4

GND

C5

C1

VOUT 6

3

1

R2 6

AGND

TRIM

5

R10

2

5

7

Q1

AGND

C3

IC2B

GND 4

IC5

U-

1

RTD

6 LV VOUT

5

MAX872

R11

AGND

AGND

2

Sensor

2

CAP+

7

J1

4

CAP- V+

8

C7

R5

R9

IC3A

C6

GND 3

R8

3

1

AN1

ICL7660

AGND

R4

2

R6

TL082

D1

AGND

R7

AGND

Fig. 14.9. The interface with the temperature sensor


178 14 PI Temperature Controller

The set-point temperature, and the control parameters Kp and Ti are read by the MCU as analog inputs, by means of three external potentiometers R12, R13, R14, that divide the reference voltage VREF. The cursors of the potentiometers are connected to the AN0, AN2, and AN3 analog inputs of the MCU. (Refer to Fig. 14.10).

A rotary encoder, S1, connects to ground the four digital inputs PA1–PA4 according to the binary code of the digit selected. This information is used by software to determine which parameter is selected for display. The system uses a four-digit, seven-segment, multiplexed display, connected to the SPI, as described in Appendix A14. Two more digital inputs, PA5, PA6, are connected to external push buttons for the operator START and STOP commands.

Figure 14.11 shows the zero crossing detector circuit that generates a square wave out of the sine wave of the ac power. The output of this circuit is connected to PA0, which is also used as the input for the input capture 3 timer. The edges of this signal generate interrupt requests used by the software to synchronize the pulses that control the output triac. The same transformer that provides the ac voltage used by the zero crossing detector also provides the ac input for the bridge rectifier B1, which generates Vp p.

The heater is driven by the triac T2, controlled to open at precise time moments by the pulses generated by software on PA7, and transmitted to the gate of the triac by means of the transistor T1 and the pulse transformer L1, as shown in Fig. 14.12.

J6

AN3

AN2

AN0

3PA3

2

PA4

VREF

1

VREF

1

VREF

1

1

2

R13

2

R12

2

R14

3

3

GND

3

J3

J5

J4

J2

3

PA1

2

PA2

AGND

AGND PA2

PA3

AGND

1

PA4

PA1

GND

4

A4

R15

R16

AVCC

A3

J12

3

R27

A2

PA5

AVCC

2

3

A

A1

2

PA6

1

R17

R18

1

R28

GND

GND

S1

Fig. 14.10.

J7

VPP

J9

J8

TR1

3

B1

C8

C9

1

2

3

VPP

8

2

2

1

1

GND

1

S2

AGND

7

GND

GND

GND

GND

PRI

6

R19

R20

5 IC3B

4

S1 J10

R21

IC6A

5

3

D2

7

1

2

PA0

2

6

D4

1

D3

TL082

40106N

AGND

AGND

Fig. 14.11. Schematic of the zero crossing detector


14.4 Software Implementation of a PI Temperature Controller

179

VPP R24

R25

HEATER

J11

R26

C11

3

T2

C10

2

BT151

AC POWER

L1

1

GND

R22

PA7 T1

R23

GND

Fig. 14.12. The gate control circuit of the triac

AC

t

PA0

t

PA7

t

Load

t

Fig. 14.13. Waveforms explaining the operation of the gate control circuit

Figure 14.13 explains how the power transferred to the heater is controlled by controlling the delay between the moment when the ac voltage crosses zero and the moment when a pulse is generated by software to open the triac.

The actual output of the control circuit is a time delay: the shorter the delay, the longer time the triac stays in conduction, and the more power is transferred to the load.

14.4 Software Implementation of a PI Temperature Controller

The structure of the software for this application follows the general structure described in Chap. 9. The MAIN.ASM module includes a number of other ASM files, each associated with a particular function, or task. Here is the listing of the MAIN module:

TITLE PI CONTROLLER MAIN

INCLUDE 68HC11F1.DEF

INCLUDE AS11.MAC

INCLUDE MAP.ASM