Performing Residential Building Controls Research with Open Source Tools

Performing Residential Building Controls Research with Open Source Tools and aggregating data to ensure the net energy spend of a community stayed below a certain threshold.

This is A Guest Post

OpenHVAC periodically asks professionals across the community to generate content which we feel is relevant to our community members. OpenHVAC is not associated with or receives any compensation for any of the the products and services listed in this article.

Cory is currently at PassiveLogic. Previously at NREL & WSP. Interested in HVAC, controls & mpc, software, building science, GEBs, and decarbonization in general. At this point, I’m a glorified generalist. Mostly driven by fear of climate change, losing beautiful places, and ecological degradation.
– Cory Mosiman, Passive Logic

My name is Cory Mosiman and I come from the smart buildings space in the commercial world. I went to grad school to study MPC (model predictive control) for buildings at CU Boulder under Gregor Henze. I learned a lot about smart building technologies and started consulting for commercial building owners on technology strategy for portfolios, including fault detection & diagnostics tools. I had dabbled in software and then went to NREL, where I was involved in the Project Haystack community, Brick Schema community, and other open source standards, mostly working on data formats for representing building information (BuildingSync, gbXML, IFC, hpXML, etc.).

For the past ~3 years, I’ve been at PassiveLogic, where we’re developing an autonomous building controls system. We have a building scanning app called QuantumLens, a web-based building drawing app similar to SketchUp called BuildingStudio, and other tools coming. In this article, I’ll walk you through a fun project I implemented that is very relevant for buildings and the grid of the future – distributed energy resource (DER) aggregation.

My Distributed Energy Resource Project

In Spring 2019 I enrolled in the Grid Connected Systems course at CU Boulder with Professor Kyri Baker. At the time, I was working as a Software Developer at NREL (although still very early in my skills development journey) and wanted to dive into building-to-grid operations and optimization. In my graduate degree, I had studied building systems and was fascinated by model predictive control (MPC) of buildings, but spent my masters project on general building technologies (gotta pay the bills).

Dr. Baker’s class focused on the interplay between buildings and the electrical grid. We learned about electricity markets, how power delivery works in general (still don’t think I’ll ever fully grasp it), and optimization. The final course project was very open ended and I wanted to challenge myself, so I worked to recreate an interesting paper I had read during the course, A Distributed Energy Management Approach for Residential Demand Response. Unfortunately that paper is behind a paywall, but I made my final project paper available for download here (the project was called the Distributed Resource AGGregator – dragg). I think the introduction does a decent job of setting up and explaining the problem.

The general notion of the project was to simulate how a distributed energy resource (DER) aggregator could incentivize individual homes to maintain a relatively flat electric demand profile using price incentives. To make it appear more like an actual community, the homes had different sets of controllable assets. Home 1 might have a battery, PV panel, electric hot water heater, and a heat pump, while Home 2 might only have a heat pump. Each of the homes was individually optimizing for cost while maintaining comfort constraints (i.e. maintain temps between 66°F – 72°F); the aggregator’s job was to ensure net demand of the community stayed below a certain threshold. Each time step of the algorithm looked something like this:

  1. The aggregator sets the additional cost = 0.
  2. This cost is communicated to the homes
  3. The aggregator then tells the homes to optimize for cost and comfort over the next n hours (say 8 hours)
  4. The homes then communicate their predicted power consumption for the next hour back to the aggregator
  5. The aggregator checks if the total power consumption of all homes is below the threshold. If it is, then nothing additional is needed. If not, it bumps the cost up, and repeats steps 2-5.

Open Source Tools

In grad school, although I had worked on similar types of problems, it had mostly been in MATLAB. It’s a great product, but it’s wicked pricey and I wanted to see what I could do with open source tools. I decided on the following:

  • Redis: In the setup, I needed a communication mechanism. The aggregator needed to communicate price signals to the homes, and the homes needed to communicate their optimized demand profiles. Redis is an open source, in-memory data store that supports a publish/subscribe (pub/sub) architecture. In essence, things can listen and receive notifications to message topics they’re interested in. I had worked with it briefly on a project at NREL, but had never set anything like that up myself so I wanted to try it.
  • Python: At that point, I was most proficient in Python as a programming language (not that I was great with it). I knew it had a lot of open source packages and tooling to facilitate optimization and plotting of results.
  • CVXPY: “An open source Python-embedded modeling language for convex optimization problems”. This is what I used to actually program the models and optimization problem.

There was a bit of a learning curve getting everything to work together as desired, but the project went well overall. The best part of that project though is what came next.

Dr. Baker liked my work and recommended her student Aisling Pigott to expand it for use in some reinforcement learning work. It turned into a publishable paper called Deep Q-Learning for Aggregator Price Design, Aisling also created an Open AI gym for it (dragg-gym), and they even used it to create an energy competition at CU Boulder called GNOMES4Homes. Aisling improved dragg, made it friendlier for others to use, and added features. 

Takeaways on Open Source for Building Industry Professionals

As with most open source tools, the goal is to keep iterating, improving, and expanding the feature set to make it usable for others. The work that you’ve done becomes a platform for other people to build upon and create even more interesting work. While there is value in redoing or recreating something that’s already been completed (mostly from a learning perspective), there is only so much time and so many resources. When it comes to decarbonizing at scale, both time and resources are in short supply.

In a lot of ways, the concept of open source is a way for like minded individuals, regardless of location, to build useful infrastructure and abstractions that allow others to move faster and execute more interesting projects. It provides a great avenue for continued learning as well. So I’m excited to be involved with OpenHVAC and can’t wait to see what this community can do together.

Leave a Comment

Your email address will not be published. Required fields are marked *