Part VIII: Industrial, Energy, and Infrastructure Sensor AI
Chapter 39: Energy, Buildings, and Environmental Sensors

Sustainability applications

"They asked me to prove we saved a thousand tonnes of carbon. I asked them to hand over the parallel universe where we did nothing. Negotiations are ongoing."

A Counterfactual AI Agent

Why this section matters

Every previous section in this chapter taught you to measure a building: disaggregate its meter, read its HVAC telemetry, watch its air and soil, span it with a sensor network, forecast it, and repair its missing points. Sustainability is where that measurement is asked to earn its keep. A retrofit is only funded if someone can prove the kilowatt-hours it avoided; a carbon-aware control policy is only credible if it shifts load to genuinely cleaner hours; a methane program is only useful if it finds the leak before a year of gas escapes. Each of these is a sensing-and-inference problem with a hard, adversarial evaluation attached, because money and regulatory claims ride on the answer. This section is about turning environmental and energy telemetry into defensible statements about avoided energy, avoided carbon, and demand flexibility. It is the section where the six verbs of this book, measure through deploy, are pointed at a planetary constraint.

This section builds directly on the forecasting and control of Section 39.5 and the load disaggregation of Section 39.1, and it leans hard on the leakage-safe evaluation discipline of Chapter 5. The single idea that unifies everything below is the counterfactual: sustainability claims are almost never about what happened, but about the gap between what happened and what would have happened otherwise. That gap is never observed, only estimated, which is why it is a modeling problem before it is an accounting one.

Measurement and verification: proving a negative

The foundational sustainability task is measurement and verification (M&V): quantifying the energy a project saved. The trouble is that savings are unmeasurable in principle. You can meter what a building used after an efficiency upgrade, but the thing you want, the energy it would have used without the upgrade, was erased the moment you acted. The standard response, codified in the International Performance Measurement and Verification Protocol (IPMVP) and operationalized by the open CalTRACK methods, is to build a baseline model: fit whole-building energy as a function of weather (and calendar) over a pre-intervention year, then run that fitted model forward on the post-intervention weather to predict the counterfactual. Avoided energy is the predicted counterfactual minus the metered actual.

$$\widehat{\text{Savings}} \;=\; \sum_{t \in \text{post}} \Big( \hat{f}_{\text{pre}}(w_t) - y_t \Big), \qquad \hat{f}_{\text{pre}} = \arg\min_{f}\sum_{t \in \text{pre}} \big(y_t - f(w_t)\big)^2$$

Here \(y_t\) is metered energy in an interval, \(w_t\) is the weather covariate (usually outdoor temperature, entered through heating- and cooling-degree-day features), and \(\hat{f}_{\text{pre}}\) is trained only on the pre period. The leakage rule is absolute and is the entire reason for the pre/post split: a single post-period sample touching the baseline fit inflates the very savings the fit is meant to certify.

A savings number without an interval is a guess with good posture

Because the counterfactual is a model prediction, the savings estimate inherits the model's uncertainty, and that uncertainty is often the same order of magnitude as the savings itself. A 6% efficiency project sits comfortably inside the year-to-year prediction error of a naive baseline, which means the honest deliverable is not a point estimate but an interval: "we avoided 42,000 ± 9,000 kWh at 90% confidence." The fractional savings uncertainty scales roughly with the baseline's normalized prediction error divided by the fractional saving, so a noisy building needs a bigger intervention (or more data) to prove anything. This is exactly where the conformal-prediction machinery of Chapter 18 earns its place: it wraps the baseline model in a distribution-free interval, so the savings claim carries a coverage guarantee instead of an optimistic single number.

The code below implements the whole M&V loop on synthetic daily data: a temperature-response baseline fit on the pre year, projected onto post-year weather, differenced against actuals, and finally converted to avoided carbon using an emissions factor.

import numpy as np

# Daily energy (kWh) vs outdoor temperature. Pre = baseline year, post = after retrofit.
rng = np.random.default_rng(0)
def hdd_cdd(T, base=15.5):                     # heating/cooling degree days from daily mean T
    return np.maximum(base - T, 0), np.maximum(T - base, 0)

T_pre  = 15 + 10*np.sin(np.arange(365)*2*np.pi/365) + rng.normal(0, 2, 365)
T_post = 15 + 10*np.sin(np.arange(365)*2*np.pi/365) + rng.normal(0, 2, 365)
# True response: baseload + heating + cooling; retrofit cuts heating slope by 30%.
def energy(T, heat_slope):
    h, c = hdd_cdd(T)
    return 40 + heat_slope*h + 3.0*c + rng.normal(0, 4, len(T))
y_pre, y_post = energy(T_pre, 5.0), energy(T_post, 3.5)

# Fit baseline f(T) = b0 + b1*HDD + b2*CDD on the PRE year ONLY (no post leakage).
Hp, Cp = hdd_cdd(T_pre)
X_pre  = np.column_stack([np.ones(365), Hp, Cp])
beta, *_ = np.linalg.lstsq(X_pre, y_pre, rcond=None)

# Counterfactual on POST weather, then avoided energy and avoided carbon.
Ho, Co = hdd_cdd(T_post)
counterfactual = np.column_stack([np.ones(365), Ho, Co]) @ beta
avoided_kwh = float((counterfactual - y_post).sum())
resid_sd    = float((y_pre - X_pre @ beta).std(ddof=3))
ci95        = 1.64 * resid_sd * np.sqrt(365)   # rough aggregate savings uncertainty
grid_kgco2_per_kwh = 0.35                       # average grid emissions factor
print(f"avoided: {avoided_kwh:,.0f} +/- {ci95:,.0f} kWh/yr  "
      f"({avoided_kwh*grid_kgco2_per_kwh/1000:,.1f} tCO2/yr)")
A CalTRACK-style whole-building M&V calculation: a degree-day baseline is fit on the pre-retrofit year, projected onto post-retrofit weather to form the counterfactual, and differenced against metered energy to yield avoided kWh with an uncertainty band and an avoided-carbon conversion.

Let OpenEEmeter own the CalTRACK edge cases

The toy fit above ignores the parts of M&V that actually consume engineering time: automatic changepoint selection for the temperature balance point, sufficiency checks on data coverage, daily-versus-billing-cadence handling, and the CalTRACK compliance rules regulators require. The open-source eemeter library (the OpenEEmeter project) encodes all of it: fitting a compliant hourly or daily model, projecting the counterfactual, and returning savings with metadata is a few dozen lines instead of the several thousand a from-scratch CalTRACK implementation would take, and the result is the same specification utilities settle on. You supply meter and temperature series; it supplies a defensible, audited savings number.

Carbon-aware operation: not all kilowatt-hours are equal

Saving energy is one lever; the second is when you use it. The carbon intensity of the grid swings by a factor of two or more across a day as coal, gas, wind, and solar cycle in and out, so a kilowatt-hour drawn at noon under heavy solar can carry a fraction of the emissions of the same kilowatt-hour at a still winter evening peak. Two intensity signals matter and are routinely confused. The average emissions factor attributes the whole grid's emissions across all its load; the marginal emissions factor asks which generator moves when you change your demand by one more unit. For any decision about shifting or curtailing load, the marginal factor is the correct one, because it describes the plant your action actually turns up or down. Providers such as WattTime and Electricity Maps publish these signals, including short-horizon forecasts, so a controller can pre-cool a building, charge a battery, or defer a pump into the cleanest hours ahead.

This turns the forecasting-and-control problem of Section 39.5 into a carbon-optimization problem: minimize \(\sum_t \text{MEF}_t \cdot P_t\) subject to comfort and equipment constraints, where the marginal emissions factor \(\text{MEF}_t\) is itself a forecast with its own uncertainty. Modern time-series foundation models like TimesFM (see Chapter 19) are increasingly used to produce the multi-horizon load and emissions forecasts these controllers consume, precisely because they generalize across sites without per-building retraining.

A refrigerated warehouse that chills on solar

A cold-storage operator ran a fleet of refrigerated warehouses, each a giant thermal battery holding pallets at −20 °C. The insight was that the product did not care when the compressors ran, only that the setpoint held within a band. The team fed a marginal-emissions forecast and a day-ahead price into a model-predictive controller that deep-cooled the rooms during midday solar surplus and coasted through the dirty evening peak on stored cold. Nothing about the sensing stack changed: the same zone thermometers, door-position sensors, and power meters from earlier in this chapter fed the optimizer. Metered against a CalTRACK baseline, the sites cut operating carbon by roughly a fifth with no new refrigeration hardware and no measurable effect on product temperature compliance. The freezer had quietly become a grid asset.

Grid-interactive buildings and demand flexibility

The warehouse example generalizes into the concept of the grid-interactive efficient building (GEB): a building that is not a passive load but a controllable, communicating resource that can shed, shift, or modulate demand on request. The sensing prerequisites are exactly the capabilities this chapter built. You cannot offer flexibility you cannot measure, so demand-response settlement reuses the same counterfactual baseline as M&V, only now over event hours: the payment for shedding load is the gap between a predicted "business as usual" demand and the metered reduced demand. Disaggregation (Section 39.1) tells you which loads are sheddable; occupancy inference tells you which zones can coast without complaint; forecasting tells you how much headroom the next hour holds. Aggregated across thousands of buildings, this flexibility becomes a virtual power plant that firms the renewables it is timed against, closing the loop between building sensing and grid decarbonization.

Watching what escapes: emissions and resource monitoring

The last sustainability frontier is not energy at all but the direct measurement of what leaks. Methane is the sharpest case: a potent greenhouse gas whose emissions are dominated by a small number of large, intermittent "super-emitter" leaks that are invisible to periodic manual inspection. The sensing answer is a hierarchy: continuous ground-based point sensors and optical-gas cameras at facilities, aircraft and drone surveys, and satellites (TROPOMI for wide screening, targeted instruments like GHGSat and MethaneSAT for facility-scale attribution). Turning a plume image or a concentration trace into an emission rate is an inverse problem coupling the sensor reading to a dispersion model and wind field, and it draws directly on the multispectral and thermal-infrared imaging of Chapter 45. The same pattern (cheap continuous sensors plus AI attribution) reappears for water: leak detection on distribution networks and irrigation-efficiency inference from soil-moisture nodes are resource-sustainability twins of the energy work above. Because all of these feed regulatory and financial claims, they inherit the accountability and disclosure obligations discussed in Chapter 70.

Exercise: stress the savings claim

Using the M&V code above: (1) reduce the true retrofit effect until the avoided energy falls inside the ±95% band, and state the smallest heating-slope reduction the baseline can certify as non-zero. (2) Replace the average emissions factor with a synthetic hourly marginal profile that is high on winter evenings, then recompute avoided carbon assuming the retrofit primarily cut evening heating; explain why the carbon saving can exceed the naive energy-times-average-factor estimate. (3) Introduce a deliberate leak: fit the baseline on a window that overlaps three post-period days and report how much the savings estimate inflates. Write two sentences connecting that inflation to the leakage-safe splitting rule of Chapter 5.

Self-check

  1. Why is energy savings fundamentally unmeasurable, and what does a baseline model actually estimate in its place?
  2. What is the difference between average and marginal grid emissions factors, and which one should drive a load-shifting decision?
  3. How does demand-response settlement reuse the M&V counterfactual, and why does the same leakage rule apply to both?

Lab 39

build a building-energy anomaly + forecasting pipeline with weather covariates.

Bibliography

Measurement and verification

Efficiency Valuation Organization (2012). International Performance Measurement and Verification Protocol (IPMVP), Core Concepts. EVO.

The reference framework that defines baseline-and-counterfactual M&V; every whole-building savings method in this section is an operationalization of its options.

CalTRACK Working Group (2020). CalTRACK Methods for Whole-Building Energy Savings.

The open, testable specification for weather-normalized whole-building savings that regulators and utilities settle on; the degree-day baseline in the code follows its logic.

OpenEEmeter Project (2024). eemeter: An open source toolkit for standardized energy efficiency metering.

The production library that implements CalTRACK end to end, including changepoint selection and data-sufficiency checks; the library-shortcut callout is built around it.

Carbon-aware operation and grid interaction

Callaway, D., Fowlie, M., McCormick, G. (2018). Location, Location, Location: The Variable Value of Renewable Energy and Demand-Side Efficiency Resources. Journal of the Association of Environmental and Resource Economists.

The rigorous case for using marginal, spatially and temporally resolved emissions factors rather than average grid intensity when valuing efficiency and load shifting.

WattTime (2021). Marginal Emissions Methodology.

Documents how a real-time and forecast marginal operating emissions rate is estimated from grid data, the signal a carbon-aware controller consumes.

Neukomm, M., Nubbe, V., Fares, R. (2019). Grid-interactive Efficient Buildings Technical Report Series. U.S. Department of Energy.

Defines the GEB concept and the sense-communicate-control capabilities that turn a building into a demand-flexibility resource.

Forecasting and emissions sensing

Das, A., Kong, W., Sen, R., Zhou, Y. (2024). A decoder-only foundation model for time-series forecasting (TimesFM). ICML.

The zero-shot forecasting backbone increasingly used for multi-site load and emissions prediction without per-building retraining.

Jacob, D. J., et al. (2022). Quantifying methane emissions from the global scale down to point sources using satellite observations of atmospheric methane. Atmospheric Chemistry and Physics.

A comprehensive account of the satellite sensing hierarchy (TROPOMI, GHGSat, MethaneSAT) and the inverse modeling that converts plume observations into emission rates.

Deceglie, M. G., et al. (NREL, 2023). RdTools: An open source Python library for PV degradation and performance analysis.

The renewable analog of M&V: weather-normalized performance and degradation estimation for solar assets, using the same counterfactual-baseline discipline.

What's Next

In Chapter 40, the book pivots from scalar energy and environmental streams to the geometry of the physical world itself. We open Part IX with the fundamentals of depth and 3D sensing, stereo, structured light, and time-of-flight, the active modalities that let a machine measure not just how much a space is using, but exactly what shape it is.