# Measure heat usage in a radiator and gather consumption data for modern ‘Green’ analysis

**Setting the Stage
**

Tracking energy use is recognized as more and more important in today’s world. It makes perfect sense to see the proliferation of smart energy meters and programmable thermostats that emerged in recent years. But with all the focus on home and business energy use, one kind of dwelling—multifamily units like apartments and condominiums—has frequently escaped the ballooning interest in energy tracking. These structures have been largely ignored because their heat is frequently provided by a hot-water radiator sourced from a common boiler. In short, measuring energy consumption is not as straightforward as monitoring gas or electricity use.

In these radiator systems, monitoring energy use requires measuring both the temperature drop from the point at which water enters the radiator to the point at which it exits, and measuring the mass of water that flows through the radiator. In this article we will examine an economical way of doing this.

**Quantifying the Heat Energy
**

In a typical water-sourced radiator system, hot water from a boiler enters the radiator through a valve that can be operated by the user. After heat is delivered into the living space, the cooler water exits the radiator to return back to the boiler to be reheated before making the cycle again (Figure 1). The user can open the valve to allow more water to flow and provide more heat into the space. Or the user can close the valve to reduce the flow and reduce the heat delivered to the space.

**Figure 1: A water-sourced radiator with a heat meter. The MAX35101 time-to-digital converter measures water flow rate and the temperature of the water flowing into and out of the radiator.**

To deliver a given amount of heat energy into a space, start with a working fluid at a temperature higher than the ambient temperature of the space. As heat from the working fluid is delivered into the space, the temperature of the space rises and the working fluid cools toward the ambient temperature of the space. In our analysis, the working fluid is water.

The enthalpy—the heat—contained in the working fluid can be calculated by:

Where:

t is the absolute temperature of the working fluid

m is the mass of the working fluid

C is the specific heat capacity of the working fluid. Notice that C is a function of temperature.

Water has a heat capacity of about 4.1813 joules per gram per degree Kelvin at room temperature and varies somewhat over its liquid temperature range. Notice that, although the equation relates energy to the mass of water, we will actually be measuring the volume of moving water. Nominally, water has a density of about one gram per cubic centimeter. If the density of water was constant over temperature, the job of converting water volume to mass would be trivial. But the density of water varies strongly with temperature. Water is most dense at 4°C (0.99997g/cc) and is least dense just below the boiling point (0.9584g/cc). Since we will be measuring flow volume and not mass, we must apply conversion tables to use the proper heat capacity and volume-to-mass conversion values. To compute the energy delivered into the space, we compute the enthalpy as the working fluid enters the radiator and subtract the enthalpy as it leaves. The difference is the heat delivered into the space.

To measure the heat energy delivered to the space we must periodically measure the inlet temperature, the outlet temperature, and the volume of the water moving through the system. If we are measuring flow through a spool body of known diameter, then the volume of water will be directly proportional to the velocity of water through the spool body. We then convert the volume of water to mass of water using lookup tables, and multiply first by the heat capacity (also from a lookup table) and then by the difference in the inlet and outlet temperatures.

Measuring the Water Flow Velocity

How can you measure the velocity of water flowing through the radiator? There are several ways to do this, including traditional mechanical methods that use water flow to rotate a wheel that drives a counter. There are more accurate ways to measure water velocity today.

Sound waves in a fluid propagate more quickly when traveling in the downstream direction (that is, with the direction of flow) than when traveling in the upstream direction (that is, against the flow) (Figure 2). We can use this fact to our advantage.

Figure 2: Measuring the velocity of a fluid by differential time-of-flight.

In Figure 2 the system is configured to measure time of flight. Time of flight is defined as the time that elapses from the instant a burst of ultrasonic sound is launched from one transducer (transducer A in the diagram) to the instant that the burst is received in another transducer (transducer B). The time of flight will be dependent on the physical properties of the medium and the velocity of flow. The faster the fluid flows in the burst direction, the less the time of flight will be.

When a burst of ultrasonic sound is launched from transducer B and received in transducer A, the situation is reversed. Now, the velocity of the fluid is working against the sound burst. The faster the fluid flows, the greater the time of flight will be.

This is how you measure flow velocity. First, launch a burst in the downstream direction and count the time that it takes to be received. Now launch a burst in the upstream direction and count the time that takes to be received. If the two times are equal, then the medium (the water) is stationary. But if the upstream count is greater than the downstream count, the difference gives you a very precise indication of the velocity of the medium. Now factor in the pipe diameter and apply a conversion constant, and you can report the flow rate in your units of choice: gallons per minute, liters per second, or cubic meters per hour.

**Doing the Math**

The velocity of propagation of sound in any medium under stated conditions of temperature and pressure is generally considered to be a constant, C_{0}. For a particular path length, L, the time of flight is given by:

In water, the velocity of propagation of sound is about 1,497m/s at room temperature. If the spool body has a path length of about 10cm, the time of flight will be about 67µs.

This formula applies only if the medium is stationary. If the medium is moving in a direction parallel to, and in the same direction as, the pulse path (downstream propagation), the propagation velocity is increased and the propagation time is reduced:

Similarly, if the medium is moving in a direction parallel to, and in the opposite direction from, the pulse path (upstream propagation), the propagation velocity is decreased and the propagation time is increased:

Now, if we take a measurement in the upstream direction and a second measurement in the downstream direction, and then calculate the difference, we obtain:

We can find a common denominator on the right side of the equation:

But the velocity of sound in the medium is much greater than the velocity of the medium, so we can eliminate the v^{2} term. We can also cancel the C_{0} term in the numerator:

Solving this equation for v we obtain:

If C_{0} is assumed to be about 1,497m/s at room temperature, and if we assume a path length of 10cm, then the fluid velocity would be the time difference multiplied by about 11.2 × 106m/s. Conversely, a velocity of 1m/s would provide a time difference of 89.2ns.

We must now resolve a new difficulty: how to accurately and with sufficient resolution measure a time difference of less than 100ns?

There are a number of techniques to accurately measure time intervals that do not involve running an oscillator at microwave frequencies. For example, the MAX35101 Time-to-Digital Converter measures time differences with an accuracy of better than 20ps and a resolution of about 4ps.

Since the fluid velocity equation strongly depends on the velocity of sound in water, and since the velocity of sound in water is strongly dependent on temperature, it is necessary to measure the temperature and adjust C_{0} accordingly. That leads us to the second difficulty to be resolved: how to accurately and inexpensively measure the temperature of the flowing water?

Actually, measuring temperature is not that difficult. Many suppliers provide solid-state devices that deliver a temperature reading with reasonably good accuracy. But if the meter is already measuring time differences with a high accuracy, can that same facility be used to measure temperature too?

**Measure Temperature by Measuring Time**

When considering how to measure temperature in an industrial setting, two technologies stand out: thermocouples and resistive temperature detectors (RTDs). There is a place for each in temperature detection, but a decision on an implementation usually comes down to one criterion. If the application needs to measure very hot (greater than 600°C) temperatures, a thermocouple is a better choice. In virtually every other situation, however, the RTD is a better choice…and it is our choice here.

An RTD is typically a fine coil of platinum wire or a thin film of platinum metal on a ceramic or other inert base. As the temperature increases, the resistance of the conductor increases. If the temperature range is relatively narrow, the change in resistance is a simple quadratic function with temperature.

Above 0°C, the resistance of a platinum RTD is given by:

For typical RTD sensors, A has a value of about 3.9083 × 10^{3}/°C and B has a value of about -0.5775 × 10^{6}/°C^{2}. At 90°C (typical inlet temperature for a water-sourced radiative heat system), a 1,000Ω RTD will exhibit a resistance of 1,347.07Ω. If the outlet temperature is room temperature, the 1kΩ RTD will exhibit a resistance of 1,097.35Ω, for a difference of 249.72Ω. This resistance range is easily measured.

One method of determining temperature given the resistance of the RTD is to solve the quadratic equation given above for T and plug in R_{T}. The problem with this supposedly “simple” solution is accurately measuring the resistance of the RTD. Remember that the device in the heat meter measures time with a high degree of accuracy; it does not measure resistance.

Fortunately, there is a simple way to convert resistance to time: allow a capacitor to discharge through the resistance and count the amount of time it takes to discharge to a known voltage level. Figure 3 shows how it works:

**Figure 3: Temperature-to-time conversion circuit.**

In Figure 3, Q1 turns on to precharge the capacitor prior to the measurement interval. When the capacitor is completely charged, then Q1 turns off and Q2 turns on to begin discharging the capacitor. The time measurement logic simultaneously begins counting time. When the voltage on the capacitor falls below the comparator’s threshold level, the time measurement logic stops counting and reports the count. Then Q2 is turned off and Q1 is turned on to precharge the capacitor again (Figure 4). Since resistance is proportional to temperature and a higher resistance corresponds to a longer period to discharge the capacitor, a greater count will correspond to a higher temperature.

In Figure 3, a second input, T4, is connected to a 1kΩ metal-film resistor. Metal film is a very stable material to use as a resistance element, changes little with temperature, and has good aging properties. Measuring the time required to discharge the capacitor through a very stable, fixed resistor eliminates all other possible influences in the circuit. For example, the capacitance of a C0G-type capacitor, while having good stability, does vary slightly with temperature. By measuring first the voltage on the RTD at T1 and then the voltage on the fixed resistor at T4 and then computing the ratio of the two counts, all spurious effects are cancelled. Only the effects of temperature on the RTD remain.

Figure 4: Timing during temperature measurement.

The job now is to take the time counts from measuring the resistance of the RTD and the reference resistor, find the ratio, and then look up the ratio in a table. The host microcontroller will take the average count from several measurements of the RTD resistance and the reference resistor. RTD manufacturers typically provide a table of resistance versus temperature for each of their sensor types, and we can use this as the starting point for a count-to-temperature table.

Sponsor video, mouseover for sound

Now we need to think about how to perform the calculations and build an appropriate lookup table. Assume default values of 1,000Ω for the reference resistor and 100nF for the capacitor. When the capacitor is fully charged and Q3 (Figure 3) connects the reference resistor to ground, the time for the capacitor to discharge from 3.3V to 1.2V is given by:

Evaluating this for the values above, the discharge curve will hit the threshold after 101.16µs. Assume that our time measurement apparatus has the resolution of the MAX35101, then the count registers will provide time in units of about 3.81ps. That gives a count of about 26.5 million (specifically, 0x0194 A3EF).

One might think at this point that it would make sense to solve the equation above for R and convert the time measurement to a resistance value. But since the time and resistance are directly proportional, and since we are really not interested in the absolute resistance but rather the ratio of the resistance of the RTD and the fixed reference resistor, we can leave the numbers as raw counts.

Most inexpensive host microcontrollers will not contain a floating-point unit. Here is how to compute the resistance ratio:

- Measure the reference resistor and store the count value.
- Shift the reference resistor count value right by (for example) 12 bits.
- Measure the RTD and store the count value.
- Divide the count value of the RTD by the shifted count value of the reference resistor (that is, compute count(RTD)/(count(reference)/4096)). Discard the remainder.

If the value of the reference resistor equals the value of the RTD, then the result will be exactly 4,096 (implying a temperature at the RTD of 0°C). If the result is greater than 4,096, then the RTD had a resistance value higher than the reference resistor (and the temperature is greater than 0°C). Finally, if the value is less than 4,096, then the RTD had a resistance value less than the reference resistor (and the temperature is less than 0°C).

But how much greater (or less)? RTD manufacturers publish tables for each of their sensors that give the resistance of the sensor over their entire recommended operating range. For example, Table 1 shows an excerpt of a table from a typical sensor, centered on room temperature:

**Table 1. Excerpt of a Typical RTD Resistance Table**

Now, we can extend this table to show the ratio and the expected result from the divide operation (Table 2).

**Table 2. Creating a Ratio Table**

In your microcontroller code, you need only the shaded columns: the temperature and the results of the division found in Table 2.If you have a table with a fixed temperature increment (as in Table 2), you can eliminate the temperature column. For example, if you have a static array called temp_table that only contains the rightmost column of the table and starts at 0°C, your conversion subroutine might look like:

int convert_quotient_to_temperature(int quotient)

{

int i=0;

while(temp_table[i] < quotient) i++;

return i;

}

For example, assume that the result of the divide operation was 4,493. Now you can search the table and determine that the nearest value is 4,495. Since this is the 25^{th} entry in the table, the conclusion is that the temperature is 25°C. If more precision is required, one could linearly interpolate between the points on the table. With a nominal value of 4,096 you can obtain about one more digit of precision. And if even more accuracy is desired, one could model the RTD itself and use that knowledge to extract even more meaningful resolution from the raw count.

Putting It All Together

Now we have the tools necessary to build a heat meter that lets us measure the flow through the radiator, the inlet and outlet temperature, and then integrate these values over time.

Practical integration over time involves periodically sampling the flow rate and temperature and making the assumption that these values remain constant until you take another measurement. Fortunately, with reasonable sample rates that turns out to be a good assumption. In fact, bulk temperatures of the working fluid really do not change very frequently, and the flow rate changes only when the valve position is changed.

Assume that the system takes a measurement every minute. Suppose that at one measurement the heat meter senses the inlet temperature at 90°C and the outlet temperature at 50°C, and computes the flow rate at 15cc per second.

At 90°C, water has a density of about 0.965 g/cc. So in one second, we observe about 14.48 grams of water pass through the spool body. Also, at 90°C the specific heat of water is 4.208 joules per gram per degree, and at 50°C the specific heat of water is 4.182 joules per degree per gram per degree.

With this information, we can now compute the energy delivered in one second. Note that we are using Celsius and Kelvin temperatures somewhat interchangeably below. In reality, they are not interchangeable. But since we are concerned about temperature differences rather than the absolute enthalpy of the medium, we can be a little loose with the units:

E = (C(T1) × m × T1) – (C(T2) × m × T2)

E = 4.208 J/g/°K × 14.48g × 90°C – 4.182 J/g/°K × 14.48g × 50°C

E = 5,481.97J – 3,026.72J

E = 2,455.25J

Return now to the radiator heating a room. We see that the energy delivered into the space during one second is 2,455.25 joules. Over the one-minute sample period, the energy delivered into the space is 2,508.89j/s × 60s = 147.3kJ = 40.92Wh. If that rate of usage persists for an hour, the energy used would be about 2.455kWh.

**Building a Practical Meter**

The easiest way to build a practical, high-accuracy flow meter is to start with a working reference design in which the flow measurement and temperature sensing logic is already developed and ready to use. The job of the meter-design engineer is then to decide on the feature set, and on what additional hardware and software are required to implement the chosen features.

For example, the MAX35101 Time to Digital Converter includes four inputs for resistive sensors. In this application, we used only three so far: one for an RTD measuring outlet temperature, one for an RTD measuring inlet temperature, and one for the reference resistor. But it would be a simple matter to attach a sensor to the remaining sensor input to determine the ambient temperature and to provide an actuator to adjust the valve. Then an interface element associated with the control processor could allow the user to directly input the desired temperature and the control processor could regulate the valve to achieve the requested temperature. Such a system is a complete closed-loop temperature-management system. The user selects a temperature, and the control processor drives the valve to deliver more or less heat to the space—all while keeping track of how much heat is actually consumed.

Another enhancement would be remote management and reporting. In this case, the control processor would serve as a data aggregator and switch to permit remote recalibration and reporting of exceptional conditions. Reporting could be performed via wireless protocols (WiFi or cellular modem) or wired protocols (typically powerline networking.)

**Conclusion**

Energy monitoring and energy management—two tasks for utilities and two tasks for socially responsible consumers. With the growing numbers of world citizens and increasing environmental concerns, these topics will become more important as each year passes. If we are really to understand our consumption of energy we need a fool-proof way to measure, monitor, and account for usage patterns and consumption within individual dwellings. Until now it has been difficult and expensive to isolate heating data for individual family units living in condominium complexes. But now with modern heat meters designed around the MAX35101 time-to-digital converter and a companion microcontroller, even those heating their home with a radiator sourced from a common boiler are no longer left out of the environmental revolution!