ComStock is an NREL model of the U.S. commercial building stock. The model takes some building characteristics from the U.S. Department of Energy's (DOE's) Commercial Prototype Building Models and Commercial Reference Building. However, unlike many other building stock models, ComStock also combines these with a variety of additional public- and private-sector data sets. Collectively, this information provides high-fidelity building stock representation with a realistic diversity of building characteristics.
This repository contains the source code used to build and execute ComStock models, including upgrade scenarios. In addition, the sampling of buildings characteristics used for the initial ComStock (V1.0) release is provided. The ComStock model is under active calibration and development, which is publicly visible on this repository.
Execution of the ComStock workflow is managed through the buildstockbatch repository, a shared asset of ResStock and ComStock, specifically developed to scale to execution of tens of millions of simulations through multiple infrastructure providers.
The dataset output from the initial ComStock (V1.0) release can be found at the accompanying ComStock data viewer website and additional information about ComStock found on the NREL Buildings Website. For more details about ongoing model development please consult the End Use Load Profiles website.
ComStock is a direct result of the NREL residential stock modeling tool ResStock (recipient of a R&D100 award) and was inspired by the high-fidelity solar & storage adoption model dGen. Additionally, this tool would not be possible without the decades of work undertaken by the OpenStudio and EnergyPlus visionaries and contributors, significant funding, feedback and support from the Los Angeles Department of Water and Power, and the Department of Energy's Building Technology Office ongoing support of and investment in building energy modeling software.
/buildcontains instructions for building Apptainer images for running ComStock on HPC systems./documentationcontains LaTeX documentation and instructions for building the documentation./measurescontains the high-level "meta" measures used to call other measures, and the reporting measures used to summarize outputs./nationalcontains seed directories necessary for a ComStock run using buildstockbatch./postprocessingcontains postprocessing scripts to create graphics for viewing results and comparing to other data sources./resourcescontains workflow and upgrade measures/samplescontains sample buildstock.csv files, which describe the set of models included in a run./samplingcontains instructions and code to generate buildstock.csv files./ymlscontains sample .yml files, which are the configuration files used to execture a ComStock run with buildstockbatch.
ComStock is under an open source license. See LICENSE.txt in this directory. You are welcome to use this repository for your own use. However, we do not provide technical support. Please refer to our technical assistance documentation instead. We strongly suggest and support using the public datasets instead of attempting to run millions of building energy models yourself.
This is needed if you are a developer making changes to openstudio-standards or openstudio-geb gems or are running simulations locally using BuildStock Batch.
-
Install the latest version of OpenStudio. ComStock requires OpenStudio 3.8.0 or newer.
-
Install the Ruby version that corresponds to your OpenStudio install. See the OpenStudio SDK Version Compatibility Matrix.
- On Mac:
- Install Ruby 3.2.2 using rbenv (
ruby -vfrom command prompt to check installed version). - On Windows:
- Install Ruby+Devkit 3.2.2 (
ruby -vfrom command prompt to check installed version).
-
Connect Ruby to OpenStudio:
- On Mac:
- Create a file called
openstudio.rb - Contents:
require "/Applications/openstudio-3.8.0/Ruby/openstudio.rb"Modify3.8.0to the version you installed. - Save it here:
/usr/lib/ruby/site_ruby/openstudio.rb - On Windows:
- Create a file called
openstudio.rb - Contents:
require "C:/openstudio-3.8.0/Ruby/openstudio.rb"Modify3.8.0to the version you installed. - Save it here:
C:/Ruby32-x64/lib/ruby/site_ruby/openstudio.rb
-
gem install bundlerThis installs thebundlerruby gem. -
Install Git.
-
Install GitHub desktop or another GUI that makes Git easier to use.
-
Clone the ComStock source code using GitHub desktop (easier) or Git (harder).
-
Run all commands below from the top level
/ComStockdirectory -
mkdir .custom_gemsThis makes a temp directory to install required gems inside. -
copy /Y .\resources\Gemfile .\.custom_gems\GemfileThis copies the Gemfile to the temp directory. -
gem install bundler:2.4.10This installs the version of bundler needed by OpenStudio. -
bundle _2.4.10_ install --path "C:/GitRepos/ComStock/.custom_gems" --gemfile "C:/GitRepos/ComStock/.custom_gems/Gemfile" --without testThis will install all ruby gems necessary to develop this code. -
If running simulations locally, install BuildStock Batch
-
Add the following additional Python packages into your
buildstockbatchenvironment:
conda activate buildstockbatch
pip install GHEDesigner==1.0
pip install NREL-PySAM==4.2.0- Follow the developer installation instructions above. In particular,
GHEDesigner==1.0must be installed withpip install GHEDesigner==1.0. - Run the measure tests with the rake command:
bundle exec rake unit_tests:all_teststo run all measure tests.bundle exec rake unit_tests:reporting_measure_teststo run all reporting measure tests.bundle exec rake unit_tests:workflow_measure_teststo run all workflow measure tests.bundle exec rake unit_tests:upgrade_measure_teststo run allupgrade_measure tests.
- Follow the developer installation instructions above
- navigate to the
.custom_gemsdirectory - run
bundle exec rake rubocop:showin terminal - review results by opening the
rubocop-results.htmlin the.rubocop/directory - rubcop can automatically fix errors by running
rubocop --autocorrect. This will fix some, but not all errors, so you still need to check and make manual fixes.