Salta al contenuto
Note per Studenti Case Study - Temperature Control of a Heated-Air Tube Report

Case Study - Temperature Control of a Heated-Air Tube

In questa pagina 5

Worked example of the non-idealities of Non-Idealities in a Control Loopmodels and control consequences of the main non-idealities of a feedback loop, namely sensor bias, noise, quantization and limited bandwidth, actuator saturation and limited bandwidth, time delays with Pade approximations, disturbances and parameter or model uncertainties.Non-Idealities in a Control Loop →: the plant has a time delay, the actuator saturates, the sensor quantizes and adds measurement error, and the controller is digital. Modeling follows the energy-balance approach (compare System ModelingA mathematical model (parameters, variables, relations) describes a system quantitatively; models are classified as static or dynamic, causal, linear, time-invariant, SISO or MIMO, and the course focuses on SISO continuous-time causal dynamic LTI systems described by a constant-coefficient input-output ODE.System Modeling → and Continuous-Time Modeling of Dynamic SystemsWhy control engineers need a model, white-box versus black-box modeling, the assumptions behind linear time-invariant lumped models, linear ODEs with constant coefficients, and the classification of lumped elements as passive or active.Continuous-Time Modeling of Dynamic Systems →).

1. The system

An airflow is forced inside a cylindrical tube by a fan; the inflow air is heated by an electrical resistor (heater); the outflow air temperature is measured with a thermocouple at the outlet. Goal: regulate the air temperature at the outlet port.

 fan --> [ inlet ---R(heater)------------- L ------------ thermocouple ] --> outlet
 inflow   ambient T_a      "control" volume (temperature T)           outflow

Hardware blocks:

block component
heated-air tube transparent cylinder with inlet and outlet
fan forces the airflow
electrical heater resistor RR at the inlet
voltage driver BTS7960 half-bridge
temperature sensor K-type thermocouple
voltage amplifier + ADC MAX6675
microcontroller Arduino Mega 2560

Roles in the control loop:

  • Process: the physical system to control, i.e. the heated airflow inside the cylinder, including heat transfer from the resistor to the air, airflow transport along the tube and heat losses to the environment.
  • Actuator: the subsystem that converts the control command into thermal power: the heating resistor plus the BTS7960 half-bridge driver.
  • Sensor: the subsystem that converts the outlet temperature into a digital measurement: the K-type thermocouple plus the MAX6675 voltage amplifier and ADC.
  • Controller: the digital control algorithm that reads the measured temperature, compares it with the reference and generates the PWM command that drives the heater. It is implemented on the Arduino Mega 2560.

2. Process model

Write the heat balance for a heated region near the resistor (the "control" volume), where the temperature TT can be assumed approximately uniform. The tube has length LL (distance from the resistor to the thermocouple), air speed vv, ambient temperature TaT_a.

Energy balance:

Ev=Er+Ein−Eout−Eloss,E_v = E_r + E_{in} - E_{out} - E_{loss},

with

term expression meaning
EvE_v mvcpTm_v c_p T stored thermal energy
ErE_r vr2R dt\dfrac{v_r^2}{R}\,dt heater thermal energy
EinE_{in} min cp Tam_{in}\,c_p\,T_a incoming thermal energy
EoutE_{out} mout cp Tm_{out}\,c_p\,T outgoing thermal energy
ElossE_{loss} 1Rth(T−Ta) dt\dfrac{1}{R_{th}}(T - T_a)\,dt thermal losses

Notation: TT average temperature of the control volume, TaT_a ambient temperature, mvm_v effective mass of air in the control volume, minm_{in}, moutm_{out} incoming and outgoing mass of air, cpc_p specific heat of air, RthR_{th} thermal resistance of the tube surface, vrv_r voltage applied to the heater resistor RR.

Simplifying assumption: the air is incompressible, so min=mout=mm_{in} = m_{out} = m with m=ρAv dtm = \rho A v\,dt, where ρ\rho is the air density, AA the cylinder base area and vv the air speed (assumed constant).

Heat (thermal power) balance, dividing by dtdt:

dEvdt=dErdt+dEindt−dEoutdt−dElossdt,\frac{dE_v}{dt} = \frac{dE_r}{dt} + \frac{dE_{in}}{dt} - \frac{dE_{out}}{dt} - \frac{dE_{loss}}{dt},

with heater power dErdt=vr2R\frac{dE_r}{dt} = \frac{v_r^2}{R}, incoming heat flow dEindt=dmdtcpTa\frac{dE_{in}}{dt} = \frac{dm}{dt}c_p T_a, outgoing heat flow dEoutdt=dmdtcpT\frac{dE_{out}}{dt} = \frac{dm}{dt}c_p T, heat losses dElossdt=1Rth(T−Ta)\frac{dE_{loss}}{dt} = \frac{1}{R_{th}}(T - T_a), and dmdt=ρAv\frac{dm}{dt} = \rho A v. Hence

mvcpdTdt=vr2R+ρAvcpTa−ρAvcpT−1Rth(T−Ta).m_v c_p\frac{dT}{dt} = \frac{v_r^2}{R} + \rho A v c_p T_a - \rho A v c_p T - \frac{1}{R_{th}}(T - T_a).

(The slides write mcp dT/dtm c_p\,dT/dt on the left; here the mass of air in the control volume is denoted mvm_v to distinguish it from the mass flow m=ρAv dtm = \rho A v\,dt.)

Define T~≜T−Ta\tilde T \triangleq T - T_a (ambient temperature taken as constant):

mvcpdT~dt+(ρAvcp+1Rth)T~=vr2R.m_v c_p\frac{d\tilde T}{dt} + \left(\rho A v c_p + \frac{1}{R_{th}}\right)\tilde T = \frac{v_r^2}{R} .

This is a first-order LTI model:

τ dT~dt+T~=K up,τ=mvcpρAvcp+1Rth,K=1ρAvcp+1Rth,up=vr2R.\tau\,\frac{d\tilde T}{dt} + \tilde T = K\,u_p, \qquad \tau = \frac{m_v c_p}{\rho A v c_p + \frac{1}{R_{th}}}, \quad K = \frac{1}{\rho A v c_p + \frac{1}{R_{th}}}, \quad u_p = \frac{v_r^2}{R} .

Here upu_p is the heater power. Laplace transform: (τs+1)T~(s)=KUp(s)(\tau s + 1)\tilde T(s) = K U_p(s), so

T~(s)Up(s)=Kτs+1.\frac{\tilde T(s)}{U_p(s)} = \frac{K}{\tau s + 1} .

Transport delay. The time the control volume needs to reach the outlet (where the thermocouple is) is

Td≈Lv.T_d \approx \frac{L}{v} .

The outlet temperature is therefore delayed: yp(t)=T~(t−Td)y_p(t) = \tilde T(t - T_d), i.e. Yp(s)=e−sTd T~(s)Y_p(s) = e^{-sT_d}\,\tilde T(s).

Process transfer function:

G(s)=Yp(s)Up(s)=Yp(s)T~(s) T~(s)Up(s)=Kτs+1 e−sTd.G(s) = \frac{Y_p(s)}{U_p(s)} = \frac{Y_p(s)}{\tilde T(s)}\,\frac{\tilde T(s)}{U_p(s)} = \frac{K}{\tau s + 1}\,e^{-sT_d} .

 heater power u_p --> [ K/(tau s + 1) e^{-s T_d} ] --> y_p --(+)--> outlet temperature T
                                                              ^
                                                              T_a

The delay is non-rational; see the Pade approximation in Non-Idealities in a Control Loopmodels and control consequences of the main non-idealities of a feedback loop, namely sensor bias, noise, quantization and limited bandwidth, actuator saturation and limited bandwidth, time delays with Pade approximations, disturbances and parameter or model uncertainties.Non-Idealities in a Control Loop →. The first-order part is the model of BIBO Stability and First-Order ModelsA linear system response splits into a natural response from the initial conditions and a forced response from the input; BIBO stability concerns the forced response and stability of the zero equilibrium concerns the natural one, and an n-th order ODE can be rewritten as n first-order equations (a state model) whose transfer function is obtained from the matrices A, B, C and D.BIBO Stability and First-Order Models →.

3. Actuator model

The heating resistor is driven by an Infineon BTS7960 half-bridge circuit: two switches (S1S_1 high side to the supply VSV_S, S2S_2 low side to ground) are driven with complementary PWM signals, so the voltage on the resistor vrv_r is a square wave between VSV_S and 0, with on-time TONT_{\mathrm{ON}} in a PWM period TPWMT_{\mathrm{PWM}}.

Average power delivered by the heating resistor:

up=VS2R δ,δ=TONTPWM,u_p = \frac{V_S^2}{R}\,\delta, \qquad \delta = \frac{T_{\mathrm{ON}}}{T_{\mathrm{PWM}}} ,

so the average power is proportional to the PWM duty cycle δ\delta.

Actuator model: the command uu is saturated into a duty cycle, then multiplied by the gain KaK_a:

δ=sat⁡(u)={1if u>1uif 0≤u≤10if u<0,up=Ka δ,Ka=VS2R.\delta = \operatorname{sat}(u) = \begin{cases} 1 & \text{if } u > 1 \\ u & \text{if } 0 \le u \le 1 \\ 0 & \text{if } u < 0 \end{cases}, \qquad u_p = K_a\,\delta, \quad K_a = \frac{V_S^2}{R} .

This is the saturation non-ideality of the previous note, with umin⁡=0u_{\min} = 0 and umax⁡=1u_{\max} = 1.

4. Sensor model

The outlet temperature is measured with a type-K thermocouple, whose output voltage is approximately proportional to the temperature difference between the hot junction and the ambient:

VOUT≈(41 μV∘C)×(T−Ta).V_{\mathrm{OUT}} \approx \left(41\ \frac{\mu\mathrm{V}}{^\circ\mathrm{C}}\right)\times(T - T_a) .

The voltage is amplified and converted to a digital signal by the Maxim MAX6675 "K-Thermocouple-to-Digital Converter". Block diagram (as in the datasheet figure of the slides): input low-noise differential amplifier (stages A1 and A2 with input switches S1 to S3), cold-junction compensation diode, reference voltage, ADC with digital controller and serial interface (SCK, SO, CS).

  • Cold-junction compensation: the hot-junction temperature is obtained by "adding" the ambient temperature (sensed by a diode) to the thermocouple voltage.
  • The compensated thermocouple voltage is converted with a 12-bit ADC: a sequence of all zeros means 0 ∘^\circC, a sequence of all ones means +1023.75+1023.75 ∘^\circC.

Quantization step:

q=1023.75 ∘C212−1=0.25 ∘C.q = \frac{1023.75\ ^\circ\mathrm{C}}{2^{12} - 1} = 0.25\ ^\circ\mathrm{C} .

Sensor model: sampling with period TsT_s of the outlet temperature TT, then the quantizer Q(⋅)Q(\cdot) with step qq, then a measurement error nn added to give the measured output ymy_m (see quantization and noise in Non-Idealities in a Control Loopmodels and control consequences of the main non-idealities of a feedback loop, namely sensor bias, noise, quantization and limited bandwidth, actuator saturation and limited bandwidth, time delays with Pade approximations, disturbances and parameter or model uncertainties.Non-Idealities in a Control Loop →).

The datasheet table shown in the slide gives the temperature error in LSB (least significant bit), for TA=+25 ∘T_A = +25\ ^\circC:

thermocouple temperature VCC=3.3V_{CC} = 3.3 V VCC=5V_{CC} = 5 V
+700 ∘+700\ ^\circC ±5\pm 5 ±6\pm 6
00 to +700 ∘+700\ ^\circC ±8\pm 8 ±9\pm 9
+700+700 to +1000 ∘+1000\ ^\circC ±17\pm 17 ±19\pm 19

With q=0.25 ∘q = 0.25\ ^\circC per LSB, an error of ±8\pm 8 LSB corresponds to ±2 ∘\pm 2\ ^\circC (arithmetic from the figures above). The slide image cuts the table off below these rows.

5. The complete digital control loop

Block diagram of the temperature control system:

 r[k] -->(+)--e[k]--> [C(z)] --u[k]--> [ZOH] --u(t)--> | [sat] --delta(t)--> [K_a] --u_p(t)--> [K/(tau s+1) e^{-sT_d}] --y_p(t)--(+)--> y(t)
          ^ -                                          |   <------------------------ Plant ------------------------->     ^
          |                                                                                                              T_a
          +--(+)<-- n[k] <-- [quantizer] <-- [sampler T_s] <-------------------------------------------------------------+
  • The digital controller C(z)C(z) works on samples e[k]=r[k]−(measured y)e[k] = r[k] - (\text{measured } y) and produces u[k]u[k].
  • A zero-order hold (ZOH) converts u[k]u[k] into the continuous-time command u(t)u(t).
  • The plant is the cascade of the saturation, the gain KaK_a and the first-order-plus-delay process; the ambient temperature TaT_a adds to its output.
  • The output y(t)y(t) is sampled with period TsT_s, quantized, and affected by the measurement error n[k]n[k].

Digital implementation, sampling and ZOH are covered in Digital Control SystemsA digital control system replaces the analog controller with a processing unit interfaced to the plant through an A/D converter (sampling plus quantization) and a D/A converter (zero-order hold), and neglecting quantization it becomes a sampled-data system that can be designed by emulation or directly in discrete time.Digital Control Systems →; the saturation and the quantizer are the nonlinearities that call for the precautions listed in Non-Idealities in a Control Loopmodels and control consequences of the main non-idealities of a feedback loop, namely sensor bias, noise, quantization and limited bandwidth, actuator saturation and limited bandwidth, time delays with Pade approximations, disturbances and parameter or model uncertainties.Non-Idealities in a Control Loop → (windup, limit cycles).

Versione ripasso

Rig: fan pushes air through a tube; resistor heater at the inlet; K-type thermocouple at the outlet read by a MAX6675; BTS7960 half-bridge drives the heater by PWM; Arduino Mega 2560 runs the controller. Goal: regulate outlet air temperature.

Process model (energy balance in a uniform-temperature control volume, incompressible air, m=ρAv dtm = \rho A v\,dt): mvcpdTdt=vr2R+ρAvcpTa−ρAvcpT−1Rth(T−Ta).m_v c_p\frac{dT}{dt} = \frac{v_r^2}{R} + \rho A v c_p T_a - \rho A v c_p T - \frac{1}{R_{th}}(T - T_a). With T~=T−Ta\tilde T = T - T_a: τT~˙+T~=Kup,τ=mvcpρAvcp+1/Rth, K=1ρAvcp+1/Rth, up=vr2R.\tau\dot{\tilde T} + \tilde T = K u_p, \quad \tau = \frac{m_v c_p}{\rho A v c_p + 1/R_{th}}, \ K = \frac{1}{\rho A v c_p + 1/R_{th}}, \ u_p = \frac{v_r^2}{R}. Transport delay Td≈L/vT_d \approx L/v, so G(s)=Kτs+1e−sTd,T=yp+Ta.G(s) = \frac{K}{\tau s + 1}e^{-sT_d}, \qquad T = y_p + T_a .

Actuator: half-bridge PWM gives average power up=VS2Rδu_p = \dfrac{V_S^2}{R}\delta, δ=TON/TPWM\delta = T_{\mathrm{ON}}/T_{\mathrm{PWM}}; model: δ=sat⁡(u)\delta = \operatorname{sat}(u) in [0,1][0,1], then Ka=VS2/RK_a = V_S^2/R.

Sensor: type-K thermocouple VOUT≈41 μV/∘C×(T−Ta)V_{\mathrm{OUT}} \approx 41\ \mu\mathrm{V}/^\circ\mathrm{C}\times(T - T_a); MAX6675 does cold-junction compensation and 12-bit conversion (0 to 1023.75 ∘1023.75\ ^\circC), so q=1023.75/(212−1)=0.25 ∘q = 1023.75/(2^{12}-1) = 0.25\ ^\circC; datasheet error a few LSB (for example ±8\pm 8 LSB for 0 to 700 ∘^\circC at 3.3 V). Model: sampler TsT_s, quantizer, plus measurement error nn.

Loop: r[k]→e[k]→C(z)→u[k]→r[k] \to e[k] \to C(z) \to u[k] \to ZOH →u(t)→\to u(t) \to sat →Ka→Kτs+1e−sTd→+Ta→y(t)\to K_a \to \frac{K}{\tau s+1}e^{-sT_d} \to + T_a \to y(t), fed back through sampler TsT_s, quantizer and noise n[k]n[k].

Passi del modello del processo:

  1. Bilancio Ev=Er+Ein−Eout−ElossE_v = E_r + E_{in} - E_{out} - E_{loss}, con m=ρAv dtm = \rho A v\,dt (aria incomprimibile) per i termini EinE_{in} ed EoutE_{out}.
  2. Con T~=T−Ta\tilde T = T - T_a (ambiente costante) la perdita diventa 1RthT~\tfrac{1}{R_{th}}\tilde T; il coefficiente di T~\tilde T è ρAvcp+1/Rth\rho A v c_p + 1/R_{th}.
  3. Divisione per quel coefficiente: τ\tau e KK come sopra, quindi T~(s)/Up(s)=K/(τs+1)\tilde T(s)/U_p(s) = K/(\tau s+1).
  4. Ritardo: Yp(s)=e−sTdT~(s)Y_p(s) = e^{-sT_d}\tilde T(s) con Td≈L/vT_d \approx L/v, cioè G(s)=Kτs+1e−sTdG(s)=\dfrac{K}{\tau s+1}e^{-sT_d}.

Attuatore e sensore:

  • Il duty cycle δ\delta è saturato in [0,1][0,1], poi up=Kaδu_p = K_a\delta con Ka=VS2/RK_a = V_S^2/R.
  • Risoluzione: q=1023.75/(212−1)=0.25 ∘q = 1023.75/(2^{12}-1) = 0.25\ ^\circC per LSB; errore di ±8\pm 8 LSB =±2 ∘=\pm 2\ ^\circC.
  • Codice tutti zeri = 0 ∘^\circC, tutti uno = +1023.75 ∘+1023.75\ ^\circC.

Errori tipici:

  • Scrivere TT invece di T~\tilde T nell'equazione con KK e τ\tau, dimenticando il TaT_a costante.
  • Confondere la massa mvm_v nel volume di controllo con la portata mm.
  • Usare VSV_S al posto di VS2V_S^2 in KaK_a.
  • Dimenticare il ritardo e−sTde^{-sT_d} nella TF del processo.

Teoria collegata