# Measure Temperature During Quenching of Steel Using Thermocouple Block

This example shows how you can use the Thermocouple block to measure the temperature in steel quenching. During quenching, you heat the steel to a temperature above its recrystallization temperature and then rapidly cool the steel by submerging it in liquid. Because of the high temperature, you cannot use the traditional temperature measurement techniques such as thermistor-based or semiconductor-based temperature sensors or liquid thermometers. To measure temperatures in such harsh environments, industries and laboratories employ thermocouples, which convert thermal potential difference into electrical potential difference.

### Model Overview

Open the model ee_fault_current_limiter.slx.

mdl = "ee_thermocouple_quenching";
open_system(mdl)

A Thermal Mass block models a steel cylinder with an initial temperature of 850°C. A Constant Volume Chamber (TL) block models a quenching bath and cools the cylinder to 20°C through forced convection.

### Simulate the Model and Plot the Results

Simulate the model.

sim(mdl);

The 1-D Lookup Table block converts the output voltage from the Thermocouple block into temperature. Plot the temperature estimated from the thermocouple output voltage and the actual simulated temperature of the cylinder against time.

TemperatureOut = squeeze(logsout{1}.Values.Data);
time = simlog_ee_thermocouple_quenching.Cylinder.T.series.time;
temperature = simlog_ee_thermocouple_quenching.Cylinder.T.series.values;

ee_thermocouple_quenching_plot(tout,TemperatureOut,time,temperature,'Temperature (°C)','Estimate','Actual')

As expected, the estimated and actual values are consistent.

Plot the temperature of the Constant Volume Chamber (TL) block.

time =  simlog_ee_thermocouple_quenching.Constant_Volume_Chamber_TL.T_I.series.time;
temperature =  simlog_ee_thermocouple_quenching.Constant_Volume_Chamber_TL.T_I.series.values;

ee_thermocouple_quenching_plot(time,temperature,'Temperature (°C)')

To ensure that the temperature is lower than the maximum valid temperature of the thermal liquid, the Chamber volume and Cross-sectional area at port A parameters of the Constant Volume Chamber (TL) block must be sufficiently high. In this example, the maximum temperature is equal to 52.1°C, which is within acceptable range.

### Change to Thermocouple Type S

The Thermocuple block parameters are specified for a Type K thermocouple by default. These values are obtained from the NIST ITS-90 Thermocouple Database [1].

Save the results for the Type K thermocouple.

TypeK_tout = tout;
TypeK_TemperatureOut = squeeze(logsout{1}.Values.Data);
TypeK_vout = simlog_ee_thermocouple_quenching.Thermocouple.v.series.values;

In the thermocouple block, set the Thermocouple type parameter to Type B, E, J, K (t<=0 degC), N, R, S or T.

set_param(mdl + "/Thermocouple", "thermocouple_type", '1');

In the thermocouple block, set the values of the Coefficients [c0 c1 ... cn] parameter for a Type S thermocouple.

set_param(mdl + "/Thermocouple", "Cvec", 'TypeS_Cvec');

In the 1-D Lookup Table block, set the Table data and Breakpoints 1 parameters, which convert from the Volts to degC, to the correct vectors for a Type S thermocouple.

For more information on how to obtain these vectors, see the Approximating Nonlinear Relationships: Type S Thermocouple example.

set_param(mdl + "/1-D Lookup Table", "Table", 'TypeS_degC');
set_param(mdl + "/1-D Lookup Table", "BreakpointsForDimension1", 'TypeS_Volts');

Simulate the model again and save the results.

sim(mdl);

TypeS_tout = tout;
TypeS_TemperatureOut = squeeze(logsout{1}.Values.Data);
TypeS_vout = simlog_ee_thermocouple_quenching.Thermocouple.v.series.values;

Plot the output voltage and temperature for the Type K and Type S Thermocouples.

ee_thermocouple_quenching_plot(TypeK_tout,TypeK_vout,TypeS_tout,TypeS_vout,'Voltage (V)','Type K','Type S')

ee_thermocouple_quenching_plot(TypeK_tout,TypeK_TemperatureOut,TypeS_tout,TypeS_TemperatureOut,'Temperature (°C)','Type K','Type S')

As expected, the output voltage differs for the two thermocouple types but the temperatures are consistent.

### Change Heat Transfer Properties

In this example, the value of the Specific heat coefficient parameter of the Thermal Mass block and the value of the Heat transfer coefficient of the Convective Heat Transfer block are estimates obtained from a scale-model laboratory study of industrial quenching of a steel cylinder in water [2]. For simplicity, these parameters are constant. For more accurate simulation results, specify these coefficients as a function of the temperature if the data are available. Alternatively, run simulations with different values of these parameters to obtain a range of estimates.

In the Convective Heat Transfer block, set the value of the Heat transfer coefficient parameter to 2000.

set_param(mdl + "/Convective Heat Transfer", "heat_tr_coeff", '2000');

Simulate the model and plot the results.

sim(mdl);
TemperatureOut = squeeze(logsout{1}.Values.Data);

ee_thermocouple_quenching_plot(tout,TemperatureOut,TypeS_tout,TypeS_TemperatureOut,'Temperature (°C)','2000 W/(K*m^2)','4000 W/(K*m^2)')

With a Heat transfer coefficient parameter value of 2000, the steel cylinder cools much slower.

### References

[1] Garrity, Karen. “NIST ITS-90 Thermocouple Database - SRD 60.” National Institute of Standards and Technology, July 1, 2000. https://doi.org/10.18434/T4S888.

[2] Hasan, H. S., M. J. Peet, J. M. Jalil, and H. K. D. H. Bhadeshia. “Heat Transfer Coefficients during Quenching of Steels.” Heat and Mass Transfer 47, no. 3 (March 2011): 315–21. https://doi.org/10.1007/s00231-010-0721-4.