# Infrared thermometer and thermal camera simulation using OpticStudio

Infrared detectors measure the temperature of objects based on their emitted thermal radiation. The technology has been widely adapted in various domains, such as in the medical practice, food safety and quality assessment, pest detection, and surveillance. This article discusses how to model infrared thermal detectors in Zemax OpticStudio and shows how to simulate the calibration and measurement processes using ZOS-API.

Authored By Csilla Timar-Fulep

Article Attachments

Introduction

Objects with temperature above absolute zero emit thermal radiation, and the intensity and spectrum of the emitted radiation depend on the objects’ temperature. Infrared thermal detectors can collect this radiation and deduce the temperature from the measurement results based on Planck’s radiation law. Thermometers measure the average temperature in the field of view, which can be used for safe remote body temperature measurement. In contrast, thermal cameras have the further advantage of providing a 2D heatmap, which can be applied in non-destructive mechanical and electrical testing applications to identify malfunctioning parts, detect subsurface defects, or monitor materials during heating and cooling processes, based on hotspots and temperature gradients. This article demonstrates how to simulate infrared detectors in OpticStudio, model blackbody sources to describe thermal radiation, and how to mimic the temperature calibration process and readouts via ZOS-API.

## Basic Design

Thermal detectors collect and analyze infrared radiation. Most commonly these devices operate in the long-wave infrared range, and therefore special considerations have to be taken into account during the design process. Considering these distinctive features, we modelled a thermometer and a thermal camera based on designs published in the literature.

### Considerations for IR optics

First, the selection of optical materials is critical in the design of infrared devices. Traditional materials used in the visible spectrum are not suitable due to their high absorption in the infrared range. Therefore, special materials with lower absorption for infrared light are required. OpticStudio provides a collection of such materials in the built-in INFRARED.AGF material catalog. Furthermore, some of these infrared materials have a high refractive index, which leads to an increased Fresnel reflection at the air/material interfaces. This reflected light may result in glare, ghost images, and background noise in infrared optical devices. Therefore, to minimize these effects, high quality anti-reflection coating is required.

### Initial design

In order to demonstrate how infrared thermal detectors measure the temperature of objects, we implemented two different models in OpticStudio based on the literature. First, a simple thermometer design consisting of plano-convex AR coated ZnSe stock lenses, and second, an improved thermal imaging camera design with custom-made Germanium lenses. To eliminate double bounce ghost images from the detector, which would distort the pixel-wise temperature measurement, we applied ideal I.95 coating on the Germanium lenses. Although, according to the literature, both designs were optimized in the Sequential mode of OpticStudio, afterwards they were converted to the Non-Sequential mode by using the Convert To NSC Group tool to take advantage of the additional thermal source modelling capabilities there:

Further details about how to convert Sequential designs to Non-Sequential models are discussed in this knowledgebase article: Converting sequential surfaces to non-sequential objects.

The applied Non-Sequential functionalities are discussed in detail in the next sections, together with the simulation of the complete thermal calibration and temperature measurement workflow via the ZOS-API.

## Infrared thermal detector model

In the Non-Sequential mode of OpticStudio, thermal radiation of objects can be easily and accurately modelled using the Black Body Spectrum Source Color. In this case, OpticStudio automatically generates a true blackbody spectrum over the specified wavelength range based upon the defined source temperature. To cover most of the thermal radiation emitted by objects in the target temperature range between -45°C and +75°C, we set the wavelength range from 3 to 40 μm based on Planck’s blackbody radiation law:

$$B(\lambda, T) = \dfrac{2 \, h \, c^2}{\lambda^5}\dfrac{1}{\exp\left(\dfrac{h \, c}{\lambda\, k_B T}\right)-1}$$

In order to provide a good sampling of this spectrum, we used 100 evenly distributed wavelengths for the simulations. The resulting spectral distribution can be visualized by using the Source Spectrum Plot, as shown in the image below:

The angular distribution of blackbody emission is Lambertian. However, as thermal detectors typically cover only a small portion of the angular space, this means that just a few percentages of rays will trace to the device because of the wide-angle distribution. Therefore, to efficiently trace rays and simulate thermal imaging detectors, we applied Importance Sampling in our model to force rays to trace towards the device. The mechanism and application of Importance Sampling are discussed in detail in this knowledgebase article: How to use importance sampling to model scattering efficiently.

As Importance Sampling cannot be directly applied on source objects, we set up the sources to launch parallel rays, and added extra surfaces right after the sources with Lambertian scattering and Importance Sampling applied on them. This was realized in OpticStudio by using Source Rectangle/Ellipse and additional Rectangle/Ellipse objects. To ensure that the scattering surface covers the source, its Reference Object was set to the source with a 0.1 mm shift applied in the Z Position and its X/Y Half Width was set to a Pickup from the X/Y Half Width of the source.

The settings for the thermometer design model are shown in the image below:

Even though we used standard infrared materials for the lenses, Germanium and ZnSe, the wavelength range of these materials in the default INFRARED.AGF catalog of OpticStudio did not cover the applied thermal radiation spectrum up to 40 μm. Therefore, to overcome this issue, we added a new INFRARED_BLACKBODY.AGF , and extended the wavelength range of the applied materials:

Step by step instructions about how to define new materials and catalogs are presented in this knowledgebase article: How to add new materials and glasses in OpticStudio.

The new INFRARED_BLACKBODY.AGF catalog, with the extended wavelength range, enables ray tracing for the whole required spectrum. Therefore, we could accurately model the full spectral distribution of blackbody emission and could easily calculate the emitted total power, P, based on the object’s temperature and area using the Stefan-Boltzmann law:

$$P=\int_0^{\infty}d\lambda \int_A d\Omega \, B(\lambda, T)=\sigma \cdot A \cdot T^4$$

where σ is the Stefan-Boltzmann constant:

$$\sigma=\dfrac{2 \, k_B^4 \, \pi^5}{15 \, c^2 \, h^3}=5.670374 \cdot 10^{-8} \dfrac{J}{s \cdot m^2 \cdot K^4}$$

As the spectral responsivity of common infrared thermal devices is limited to the long-wave infrared range, between 8 and 14 μm, we filtered our simulation results to this specific bandwidth, so the extrapolation in the dispersion formulae didn’t cause any adverse effects besides enabling accurate thermal radiation modelling. We applied the X_WAVERANGE(n, a, b) filter string to identify rays that hit object #n within the target wavelength range (a, b):

Further details and application examples about how to apply filter strings to select specific rays can be found in this article: Identifying specific rays using filter strings.

## Thermal calibration

To use the detectors not only for qualitative analyses, but also for accurate temperature measurements, a thermal calibration has to be performed on the devices. This calibration process relies on the Sakuma–Hattori equation, which provides a mathematical model for predicting the amount of thermal radiation received by a detector from a perfect blackbody source based on the temperature of the object. In our model, we used the Planckian form of the Sakuma-Hattori equation, which is recommended for infrared thermometry applications:

$$S(T)=\dfrac{C}{\exp\left(\dfrac{c_2}{A \cdot T+B}\right)-1}$$

In the above equeation A, B and C are scalar coefficients, c2=0.014387752 m∙K is the second radiation constant, and T is the absolute temperature in K. To calibrate the free A, B, C parameters of the model, the workflow involves measuring objects with different known temperatures. Once the device is calibrated, the inverse Sakuma–Hattori equation can be used to deduce the temperature of new objects based on the thermal radiation measured by the detector:

$$T=\dfrac{c_2}{A \cdot \ln \left( \dfrac{C}{S} +1 \right)}-\dfrac{B}{A}$$

We used the ZOS-API to simulate this thermal calibration procedure. In this example, we used the Interactive Connection from Python API - connected to OpticStudio via .NET - to modify the source parameters, run Non-Sequential ray traces, and pull the results from the detector. We also took advantage of the curve fitting and data processing tools in Python and plotted the results for visualization purposes.

### Modifying the source settings from the API

To mimic the thermal calibration process, we intended to record the signal on the detector in case of different source temperatures. To do so, we looped over the different scenarios, and in each step, a new source temperature was set, and the emitted power was adjusted based on the temperature and size of the object according to Stefan-Boltzmann law. The corresponding Python code reads as the following:

source = TheNCE.GetObjectAt(sourceNum)source.SourcesData.SourceColor = ZOSAPI.Editors.NCE.SourceColorMode.BlackBodySpectrumsource.SourcesData.SourceColorSettings._S_BlackBodySpectrum.Spectrum = 100source.SourcesData.SourceColorSettings._S_BlackBodySpectrum.WavelengthFrom = 3source.SourcesData.SourceColorSettings._S_BlackBodySpectrum.WavelengthTo = 40source.SourcesData.SourceColorSettings._S_BlackBodySpectrum.TemperatureK = tempsource.ObjectData.Power = blackBodyPower(source, shape, temp)

Then, we ran ray traces for the different temperatures, and extracted the results from the detector. In order to analyze only the sensitive spectral range of the detectors, i.e. between 8 and 14 μm, we saved the ray trace results to ZRD files and applied filter strings on them. The Python commands for NSC Ray Tracing are the followings:

NSCRayTrace = TheSystem.Tools.OpenNSCRayTrace()NSCRayTrace.ClearDetectors(0)NSCRayTrace.SplitNSCRays = TrueNSCRayTrace.ScatterNSCRays = TrueNSCRayTrace.UsePolarization = TrueNSCRayTrace.IgnoreErrors = TrueNSCRayTrace.SaveRays = TrueNSCRayTrace.Filter = f"X_WAVERANGE({objectNum}, {lambda_min}, {lambda_max})"NSCRayTrace.SaveRaysFile = "IR_thermalDetector.ZRD"NSCRayTrace.Run()NSCRayTrace.WaitForCompletion()NSCRayTrace.Close()

Finally, a Detector Viewer was used to analyze filtered datasets from the ZRD files:

DetectorView = TheSystem.Analyses.New_DetectorViewer()DetectorView_Settings = DetectorView.GetSettings()DetectorView_Settings.RayDatabaseFilename = "IR_thermalDetector.ZRD"DetectorView_Settings.ShowAs = ZOSAPI.Analysis.DetectorViewerShowAsTypes.FalseColorDetectorView_Settings.Filter = f"X_WAVERANGE({objectNum}, {lambda_min}, {lambda_max})"DetectorView.ApplyAndWaitForCompletion()DetectorView.Close()

### Temperature measurements

After running all the simulations and collecting the results from the target temperature range, we exploited the additional optimization and interpolation capabilities of the SciPy package via the ZOS‑API and fit the Sakuma–Hattori function to the measured data. To ensure a good fit with reasonable parameters, according to the literature, we set the initial values for the curve fitting algorithm based on the center, λ0, and width, Δλ, of the spectral range of the detector, i.e. 8...14 μm:

$$A=\lambda_0 \cdot \left(1-\dfrac{\Delta\lambda^2}{2\lambda_0^2} \right)= 9.3636 \, \mathrm{\mu m}$$

$$B=\dfrac{c_2 \, \Delta\lambda^2}{24\lambda_0^2}=1.7836 \cdot 10^{-4} \, \mathrm{m \cdot K}$$

The result of the above-described calibration process is visualized in the image :

Once the calibration is complete, thermal radiation detectors can be used for accurate temperature measurements too. In this stage, the temperature of an unknown object is calculated from the detected signal by using the inverse Sakuma-Hattori equation. In case of thermometers the calibration process can be accomplished all at once for the total signal, as these devices only measure an average temperature for the full field of view. As measured objects should fill the full field of view as well, the same source can be used in OpticStudio both for the calibration and later measurements. In contrast, for thermal imaging cameras, the calibration should be performed with a large source covering the full field of view, and then the data processing and curve fitting must be accomplished on a pixel-by-pixel basis to achieve accurate temperate maps. In this way, the calibration also considers the differences between the individual pixels of the detector. To simulate the application of thermal imaging cameras, in our model we included one large calibration source that covered the full field of view of the device, and three smaller test sources with different shapes, sizes, positions and temperatures:

The incoherent irradiance simulated in OpticStudio together with the temperature map generated via the ZOS-API are shown below:

With a thorough calibration process thermal detectors can reach sub-kelvin accuracy. In commercial thermal cameras typically an additional image post-processing algorithm is applied to identify objects of interest, hotspots, or outstanding temperature gradients.

## Conclusion

In this article, we have demonstrated how to model infrared thermal detectors in the Non-Sequential mode of OpticStudio. We covered how to model thermal radiation of blackbody sources and how to collect the results by infrared detectors. Furthermore, we discussed how to calibrate thermal detectors and how to use these devices for accurate temperature measurements using the API.

## References

1. Hajnoor, Elshafia, Ahmed. IR optical system design of uncooled thermal imaging camera in long band (8-12μm). IOSR Journal of Applied Physics, 6(5):32-40 (2014).
2. Yoon, Khromchenko, Eppeldauer. Improvements in the design of thermal infrared radiation thermometers and sensors. Optics Express, 27(10):14246-14259 (2019).
3. Lane, Whitenton. Calibration and Measurement Procedures for a High Magnification Thermal Camera. National Institute of Standards and Technology, US Department of Commerce, NISTIR 8098 (2015).
4. Size-of-Source Effect in Infrared Thermometers. Measurements Standards Laboratory of New Zeland, MSL Technical Guide 26, (2017).
5. Saunders. General interpolation equations for the calibration of radiation thermometers. Metrologia, 34:201-210 (1997).
6. Usamentiaga, Venegas, Guerediaga, Vega, Molleda, Bulnes. Infrared thermography for temperature measurement and non-destructive testing. Sensors 14(7):12305–12348 (2014).