## Computing Features from the Refrigeration Sensor Readings

Features in machine learning are signals containing information about a measurable property of the system being observed.

It is difficult to use raw sensor data in machine-learning. The data may be too much: the refrigerator, for example, uses an AC compressor and is connected to a 60 Hz power supply. The Nyquist-Shannon sampling theorem says that to recover the 60 Hz, one has to sample at at-least 120 Hz. In reality, most engineers over-sample in an attempt to capture higher frequencies that would preserve transients in the signal. In the refrigeration case-study, the sampling rate is 500 Hz which means that at every 2 ms there is a new data point. Even at this modest sampling frequency it may be computationally hard to apply the classification or regression formula. We are only interested in algorithms that can compute diagnosis at real-time. Summarizing the signals over time-windows solves the computational difficulty problem.

Another reason for using features is that classification and regression machine-learning formulas are typically not good enough to capture the complex physics of the devices we are trying to diagnose. Manually constructing features is bridging physics and model-based reasoning and machine learning. We can actually "hide" a fully-fledged model-based diagnosis engine as a feature. This feature will directly compute if the device is failing and then there is no work for the classifier to determine the state of the system.

Table 1: Features formulas for diagnosing the refrigerator
Description Formula
Minimum value $\min{\{x_i, x_{i - 1}, \ldots, x_{i - k}\}}$
Maximum value $\max{\{x_i, x_{i - 1}, \ldots, x_{i - k}\}}$
Mean value $\displaystyle\frac{1}{k}\sum_{j = i - k}^{i}{x_j}$
Standard deviation $\sqrt{\sum{x - \mu}}$
Derivative $x_i - x_{i - 1}, \ldots, x_{i - k + 1} - x_{i - k}$
Product $x \times y$

Table 1 shows the types of features that are used for diagnosing the refrigerator. They are all computed for a sliding window of $k$ samples. The first four features are simply common sliding-window descriptive statistics. The fifth one is the first derivative of temperature (of course, first a low-pass filter with a cut-off frequency of 1 mHz is used to smooth the original signal). The last feature is the product of two signals. Notice that after computing derivatives or products, it is necessary to again compute descriptive statistics (minimum, maximum, mean, and standard deviation) over a sliding window.

In the case of the thermostat only the present value of the thermostat at the time of diagnosis is used. This approach does not use all thermostat information. To use all information it is possible to compute a feature that shows when was the last thermostat transition. Somewhat surprisingly, this feature not only does not help with any of the classifiers we have tried, its inclusion significantly decreases the isolation accuracy.

How is the length $k$ of the sliding window determined? A more advanced approach would be to use intelligent segmentation instead of a sliding window, however segmentation implies making a step toward computing a diagnosis which imposes a bootstrapping problem. In our study we just take a range of sliding window lengths and we compute a large number of features. We also compute the product of all possible temperature pairs. This results in a large number of features: 10 681, to be precise.

Figure 1 shows the features computed from one temperature sensor for a fixed sliding window size of 30 min.

Machine learning often normalizes the feature ranges by multiplying them with suitable constants. Experiments showed that this does not help the accuracy of classification in the case of the refrigerator and we use the features without scaling.

## Common Refrigerator Diagnostic Test-Bed Design, Part III

The main purpose of a refrigerator is to keep stable low temperature in the general compartment and even lower temperature in the freezer. The temperature inside and outside of the refrigerator is one of the most important sources of sensor data for the diagnostic process. Ideally, we would like to know the temperature at each time instance and at each point in the refrigerator and in the environment. This setup is, of course, ideal and unfeasible in practice, so we have to sample the space at several discrete points.

To measure the temperature we use the absolute champion of low-cost temperature measurement: the DS18B20 semiconductor sensor. The DS18B20 costs less than USD 3, has integrated Analog to Digital Converter (ADC), and even provides a unique laser-engraved identification code for easy location. The operating range is from $-55^\circ{C}$ to $125^\circ{C}$ which is well-above our requirements. The resolution is 12-bit with an accuracy of $0.5^\circ{C}$. We believe that the accuracy is often better than the one advertised in the data-sheet.

The DS18B20 is relatively slow and it may take up to 750 ms to convert a temperature measurement. On the positive side, the DS18B20 needs only two wires as it can be powered via the data-line. In our application we use external 5V power supply from the Arduino MEGA 2560 voltage regulator. Multiple DS18B20 can be chained in series. The only think that we need to connect a chain of DS18B20s to the Arduino digital I/O is a pull-up resistor of $4.7 k\Omega$.

A instrumented refrigerator is shown in the photo below.

We managed to wire very thin wire outside of the refrigerator without drilling it (we used the whole for the refrigerant pipe).

The photo below shows the freezer sensor. The sensor is in a waterproof casing.

Finally, we mount two external sensors on top of the refrigerator:

## Common Refrigerator Diagnostic Test-Bed Design, Part II

The various feedback control mechanisms in many devices contribute to failures. Engineered devices that use bad choice of control algorithm (for example hysteresis control instead of Proportional Integral Derivative control) may not satisfy the design constraints. A proportional coefficient in a PID controller may need recalibration and the device it controls may start, for example, oscillating in an undesired way.

The refrigerator in the test-bed we are designing uses very basic hysteresis control (also known as on-off or bang-bang control). The thermostat, when warmed-up to the set-point temperature mechanically closes the circuit which starts the compressor. When the temperature drops below the desired set-point the thermostat opens and the compressor stops.

We will modify this basic electro-mechanical subsystem to provide computerized control. The new schematic is shown in figure 1.

Modifying the electrical circuit of the refrigerator is very simple and requires cutting the wire from the thermostat to the power connector and rewiring the compressor terminals. The process and the end-result are shown in the following photos:

The relay-board which is off-the shelf and is put in an aluminum box for electrical protection as shown below:

In the relay-board as well as everywhere else it is extremely important to do proper earthing. The reason for this is beyond safety: lack of good earthing can cause Electromagnetic Interference (EMI) problems. Finally, this is the Arduino shield which has all Arduino connectors for the refrigerator test-bed:

In the photo of the Arduino shield we can also see the current limiting resistors (for the thermostat and temperature sensors) and Light Emitting Diodes (LEDs) that provide basic indication for the health and operation of the test-bed. In our more modern Arduino shields we use Liquid Crystal Displays (LCDs) as they are also very cheap and easy to program.

By applying the modification described above, we can (1) change the type of control for this refrigerator and (2) inject failures. One of the possible changes in the control is to use different sensor instead of the existing thermostat control (for example a digital temperature sensor). More relevant to our goal is the ability to inject and retract thermostat open-circuits and short-circuits. Another failure is modifying the hysteresis time. We will have detailed discussion on the type of failure injections once we discuss the design of the benchmark scenarios.

## Common Refrigerator Diagnostic Test-Bed

According to the US Census Bureau, there are more than 129 millions of refrigerators and 86 million houses with central air-conditioning units in the US alone. Even a slight improvement in the efficiency of those would result in huge energy savings. One typically neglected aspect of energy optimization is the energy consumption of malfunctioning or partially-functioning devices. We all know that many refrigerators and Heating Ventilation and Air-Conditioning (HVAC) units have degraded performance over time due to worn gaskets (in the case of refrigerators), clogged filters (HVACs), pipe deposits (HVACs), refrigerant leaks and various sensor failures. In some anecdotes building managers fully ignore the warnings of their Building Management Systems (BMSes) due to the large number of false positives they generate.

But refrigeration systems are not only important because our daily comfort and meal depends on them. Refrigerators keep vaccines potent and a refrigerator with an intermittently faulty short-circuited thermostat may freeze a vaccine and make it not working. Refrigeration technologies are used in space cryogenics to cool down sensors and in quantum-computing to achieve superconductivity. So, studying and analyzing malfunctioning refrigeration systems is very beneficiary to society.

To help the analysis of failing refrigeration systems, we have decided to break (in multiple ways) and diagnose a common household refrigerator. We will experiment with several of the extremely popular Haier refrigerators not only because they are cheap (retail price of less than 100 USD) and good but because they are representative for how most refrigerators and HVACs work (since the invention of the auto-defrost in 1927, the core refrigeration technology has not changed much).

Our goal in diagnosing refrigerators is not necessarily to design and build a self-diagnosing household appliance. Our goal is the collection of data and the design of frameworks and algorithms that can help diagnosis of thermo-electric systems in general. We want to compare the performance of various diagnostic and diagnostic entropy-reduction methods on real-world data and to use this data as a common diagnostic benchmark.

In a series of blog postings, some of which will be part of scientific and engineering publications we will experiment with household refrigerators, create a diagnostic benchmark and compare several data-driven and model-based diagnostic algorithms.

These are some parameters of the refrigerators we have chosen for our experiments:

 Model HC27SF10RB Total volume 2.7 ft$^3$ (0.0764555 m$^3$) Voltage 115 V AC (RMS) Voltage Frequency 60 Hz Current 1.5 A Start-up current 6.3 A Pressure high-side 270 Psi ($1861.58\times 10^3$ Pa) Pressure low-side 103 Psi ($710.16\times 10^3$ Pa) Refrigerant R600a (isobutane) Refrigerant amount 0.71 oz (0.021 l)

And this is how the refrigerator looks from the front:

The next photograph shows it from behind.

The electrical diagram of the refrigerator is shown in figure 1. The main electrical components are the thermostat, the bimetallic overload protector, the Positive Temperature Coefficient (PTC) thermistor and the electric motor in the compressor.

The compressors that this type of refrigerators use are Huayi, type L35C5L:

The compressor uses a Resistance Start, Induction Run (RSIR) motor. Motors that use capacitors for running and starting are more efficient but also more expensive. Electrolytic capacitors also age and tend to fail often. To start the compressor, the refrigerator runs current through a secondary start winding.

The function of the PTC thermistor is to limit the amount of time during which current flows through the start winding. As current flows the temperature of the thermistor and its resistance increase (hence the word positive in PTC). After increasing the temperature for a while, the PTC thermistor enters equilibrium and there is little current flowing through the start winding of the motor.

The type of the thermistor is a generic brand QP2-4.7 and the product type only specifies its $R_0$ resistance of 4.7$\Omega$. Although we could not find the original manufacturer's datasheet, a similar component by Sensata Technologies specifies that $R_0$ is measured at $25^\circ{C}$ and $2 V$. We will analyze the PTC thermistor in greater detail in our subsequent writings.

The QP2-4.7 are switching thermistors. Switching thermistors are made mostly of polycrystalline ceramic materials. These materials are normally highly resistive. To achieve the desired resistance, the ceramics is doped with compositions of barium, lead and strontium titanates with additives such as yttrium, manganese, tantalum and silica.

The type of the overload protector is BT48-125A61D2. The open-circuit temperature is specified as $125 \pm 5^\circ C$ and the closed-circuit temperature is $61 \pm 9^\circ C$.

Figure 2 shows the refrigerant flow and the actual refrigeration cycle.

There are five major components through which the refrigerant flows. The compressor converts electrical energy to potential energy stored as compressed isobutane. The compression of the refrigerant happens in the condenser and during this process heat is rejected in the environment. The filter drier is a mesh that captures contaminants from the refrigerant so they do not clog the capillary tube. The capillary tube is a long narrow pipe that results in a pressure drop of the refrigerant. The result of the pressure drop is that the refrigerant expands in the evaporator. The latter process is endothermic and absorbs heat from the refrigerator and from the freezer. Finally, the refrigerant is fed to the compressor again for repeating the cycle.