Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 11 additions & 16 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,28 +27,25 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .
pip install pytest pytest-cov pytest-xdist
run: uv sync --locked

- name: Generate OCHRE golden results
if: matrix.os == 'macos-latest'
run: python test/resstock_golden/generate_ochre_result.py
run: uv run python test/resstock_golden/generate_ochre_result.py

- name: Run tests
run: |
pytest test/ -v --tb=short -n auto --cov=ochre --cov-report=xml --cov-report=term-missing ${{ matrix.os != 'macos-latest' && '-m "not golden"' || '' }}
uv run pytest test/ -v --tb=short -n auto --cov=ochre --cov-report=xml --cov-report=term-missing ${{ matrix.os != 'macos-latest' && '-m "not golden"' || '' }}

- name: Compare OCHRE vs EnergyPlus
if: matrix.os == 'macos-latest'
run: python test/resstock_golden/compare_ochre_and_eplus.py
run: uv run python test/resstock_golden/compare_ochre_and_eplus.py

- name: Commit comparison CSVs
if: matrix.os == 'macos-latest' && github.event_name == 'pull_request'
Expand Down Expand Up @@ -77,19 +74,17 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
python-version: "3.11"

- name: Install linting tools
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
run: uv sync --locked

- name: Run ruff linter
run: ruff check . --output-format=github
run: uv run ruff check . --output-format=github
continue-on-error: true

- name: Run ruff formatter check
run: ruff format . --check --diff
run: uv run ruff format . --check --diff
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,4 @@ ochre/defaults/Input Files/OCHRE*
test/outputs/
test/resstock_golden/ochre_result/bldg*/
test/resstock_golden/ochre_result/ochre_annual_result_new.csv
test_run/
uv.lock
test_run/
63 changes: 61 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,13 @@ If you use OCHRE for your research or other projects, please fill out our [user

## Installation

OCHRE can be installed using `pip` from the command line:
OCHRE can be installed from PyPI. Using [uv](https://docs.astral.sh/uv/):

```
uv add ochre-nrel
```

Or with `pip`:

```
pip install ochre-nrel
Expand All @@ -29,10 +35,12 @@ pip install ochre-nrel
Alternatively, you can install a specific branch, for example:

```
uv add "ochre-nrel @ git+https://github.com/NREL/OCHRE@dev"
# or
pip install git+https://github.com/NREL/OCHRE@dev
```

Note that OCHRE requires Python version >=3.9 and <3.13.
Note that OCHRE requires Python version >=3.10 and <3.13.

## Usage

Expand Down Expand Up @@ -74,3 +82,54 @@ For more examples, see:
* Run [multiple dwellings](https://github.com/NREL/OCHRE/blob/main/bin/run_multiple.py)
* Run a [OCHRE with an external controller](https://github.com/NREL/OCHRE/blob/main/bin/run_external_control.py)
* Run a [OCHRE in co-simulation using HELICS](https://github.com/NREL/OCHRE/blob/main/bin/run_cosimulation.py)

## Development

OCHRE uses [uv](https://docs.astral.sh/uv/) to manage the development
environment. After [installing uv](https://docs.astral.sh/uv/getting-started/installation/),
clone the repository and sync the environment:

```
git clone https://github.com/NREL/OCHRE.git
cd OCHRE
uv sync
```

`uv sync` creates a virtual environment in `.venv/`, installs OCHRE in editable
mode, and installs the development tools defined in the `dev` dependency group
(ruff, pytest, pytest-cov, pytest-xdist). The resolved versions are pinned in
`uv.lock` for reproducible installs.

Run any command in the project environment by prefixing it with `uv run` (no
need to activate the virtual environment manually):

```
# Run the test suite (in parallel via pytest-xdist)
uv run pytest -n auto

# Run only the ResStock golden test suite
uv run pytest -m golden

# Run everything except the golden tests
uv run pytest -m "not golden"
```

### Linting and formatting

OCHRE uses [ruff](https://docs.astral.sh/ruff/) for both linting and code
formatting. To automatically fix lint issues and reformat the code:

```
# Apply auto-fixable lint issues (e.g. unused/unsorted imports)
uv run ruff check . --fix

# Reformat all code in place
uv run ruff format .
```

To check without modifying any files (this is what CI runs):

```
uv run ruff check .
uv run ruff format . --check
```
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- Added CLI options for `--output_format` and `--export_res`
- Added EV and PV parsing from dedicated HPXML sections (Vehicles, Photovoltaics)
- Narrowed Python version requirement
- Allow flat garage roofs

### OCHRE v0.9.3
- Allow 120V (aka low power) heat pump water heaters
Expand Down
1 change: 0 additions & 1 deletion ochre/Equipment/WaterHeater.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,6 @@ def __init__(self, hp_only_mode=False, water_nodes=12, **kwargs):
self.parasitic_power = kwargs.get("HPWH Parasitics (W)", 1) # Standby power in W
self.fan_power = kwargs.get("HPWH Fan Power (W)", 35) # in W


# Dynamic capacity coefficients
# curve format: [1, t_in_wet, t_in_wet ** 2, t_lower, t_lower ** 2, t_lower * t_in_wet]
if self.low_power_hpwh:
Expand Down
8 changes: 8 additions & 0 deletions ochre/defaults/Envelope/Envelope Boundary Types.csv
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,14 @@ Garage Roof,"slate or tile shingles, Unfinished, Uninsulated, Pitched",slate or
Garage Roof,"slate or tile shingles, Unfinished, Uninsulated, Pitched, Radiant Barrier",slate or tile shingles,"Pitched, Radiant Barrier","Unfinished, Uninsulated",Copied from Attic Roof,1.389695656
Garage Roof,"wood shingles or shakes, Unfinished, Uninsulated, Pitched",wood shingles or shakes,Pitched,"Unfinished, Uninsulated",Copied from Attic Roof,1.38963372
Garage Roof,"wood shingles or shakes, Unfinished, Uninsulated, Pitched, Radiant Barrier",wood shingles or shakes,"Pitched, Radiant Barrier","Unfinished, Uninsulated",Copied from Attic Roof,1.389638876
Garage Roof,"asphalt or fiberglass shingles, Unfinished, Uninsulated, Flat",asphalt or fiberglass shingles,Flat,"Unfinished, Uninsulated",Copied from Attic Roof,1.38963372
Garage Roof,"asphalt or fiberglass shingles, Unfinished, Uninsulated, Flat, Radiant Barrier",asphalt or fiberglass shingles,"Flat, Radiant Barrier","Unfinished, Uninsulated",test files bldg0288066,1.389638876
Garage Roof,"metal surfacing, Unfinished, Uninsulated, Flat",metal surfacing,Flat,"Unfinished, Uninsulated",test files bldg0288066,1.389464516
Garage Roof,"metal surfacing, Unfinished, Uninsulated, Flat, Radiant Barrier",metal surfacing,"Flat, Radiant Barrier","Unfinished, Uninsulated",test files bldg0288066,1.389469671
Garage Roof,"slate or tile shingles, Unfinished, Uninsulated, Flat",slate or tile shingles,Flat,"Unfinished, Uninsulated",test files bldg0288066,1.3896905
Garage Roof,"slate or tile shingles, Unfinished, Uninsulated, Flat, Radiant Barrier",slate or tile shingles,"Flat, Radiant Barrier","Unfinished, Uninsulated",test files bldg0288066,1.389695656
Garage Roof,"wood shingles or shakes, Unfinished, Uninsulated, Flat",wood shingles or shakes,Flat,"Unfinished, Uninsulated",test files bldg0288066,1.38963372
Garage Roof,"wood shingles or shakes, Unfinished, Uninsulated, Flat, Radiant Barrier",wood shingles or shakes,"Flat, Radiant Barrier","Unfinished, Uninsulated",test files bldg0288066,1.389638876
Garage Wall,"ConcreteMasonryUnit, asbestos siding",asbestos siding,ConcreteMasonryUnit,,MF_300 - bldg0000036,3.123212321
Garage Wall,"ConcreteMasonryUnit, brick veneer",brick veneer,ConcreteMasonryUnit,,MF_300 - bldg0000189,3.123212321
Garage Wall,"ConcreteMasonryUnit, none",none,ConcreteMasonryUnit,,res3.1_national_300 - bldg0000094,3.123212321
Expand Down
28 changes: 28 additions & 0 deletions ochre/defaults/Envelope/Envelope Materials.csv
Original file line number Diff line number Diff line change
Expand Up @@ -1035,6 +1035,34 @@ Garage Roof,"wood shingles or shakes, Unfinished, Uninsulated, Pitched, Radiant
Garage Roof,"wood shingles or shakes, Unfinished, Uninsulated, Pitched, Radiant Barrier",wood shingles or shakes,"Pitched, Radiant Barrier","Unfinished, Uninsulated",ROOF RIGID INS,0.0028,0.029,32.04,,0.09571,0.108931002,Copied from Attic Roof,1214.23
Garage Roof,"wood shingles or shakes, Unfinished, Uninsulated, Pitched, Radiant Barrier",wood shingles or shakes,"Pitched, Radiant Barrier","Unfinished, Uninsulated",OSB SHEATHING 0.5 IN.,0.0127,0.115,512.64,,0.11,7.905278413,Copied from Attic Roof,1214.23
Garage Roof,"wood shingles or shakes, Unfinished, Uninsulated, Pitched, Radiant Barrier",wood shingles or shakes,"Pitched, Radiant Barrier","Unfinished, Uninsulated",RADIANT BARRIER,0.0002,235.07,2700.972,,9.08E-07,0.49759467,Copied from Attic Roof,921.14
Garage Roof,"asphalt or fiberglass shingles, Unfinished, Uninsulated, Flat",asphalt or fiberglass shingles,Flat,"Unfinished, Uninsulated",ASPHALT OR FIBERGLASS SHINGLES,0.0063,0.163,1121.4,,0.03903,10.35314047,Copied from Attic Roof,1465.45
Garage Roof,"asphalt or fiberglass shingles, Unfinished, Uninsulated, Flat",asphalt or fiberglass shingles,Flat,"Unfinished, Uninsulated",ROOF RIGID INS,0.0028,0.029,32.04,,0.09571,0.108931002,Copied from Attic Roof,1214.23
Garage Roof,"asphalt or fiberglass shingles, Unfinished, Uninsulated, Flat",asphalt or fiberglass shingles,Flat,"Unfinished, Uninsulated",OSB SHEATHING 0.5 IN.,0.0127,0.115,512.64,,0.11,7.905278413,Copied from Attic Roof,1214.23
Garage Roof,"asphalt or fiberglass shingles, Unfinished, Uninsulated, Flat, Radiant Barrier",asphalt or fiberglass shingles,"Flat, Radiant Barrier","Unfinished, Uninsulated",ASPHALT OR FIBERGLASS SHINGLES,0.0063,0.163,1121.4,,0.03903,10.35314047,Copied from Attic Roof,1465.45
Garage Roof,"asphalt or fiberglass shingles, Unfinished, Uninsulated, Flat, Radiant Barrier",asphalt or fiberglass shingles,"Flat, Radiant Barrier","Unfinished, Uninsulated",ROOF RIGID INS,0.0028,0.029,32.04,,0.09571,0.108931002,Copied from Attic Roof,1214.23
Garage Roof,"asphalt or fiberglass shingles, Unfinished, Uninsulated, Flat, Radiant Barrier",asphalt or fiberglass shingles,"Flat, Radiant Barrier","Unfinished, Uninsulated",OSB SHEATHING 0.5 IN.,0.0127,0.115,512.64,,0.11,7.905278413,Copied from Attic Roof,1214.23
Garage Roof,"asphalt or fiberglass shingles, Unfinished, Uninsulated, Flat, Radiant Barrier",asphalt or fiberglass shingles,"Flat, Radiant Barrier","Unfinished, Uninsulated",RADIANT BARRIER,0.0002,235.07,2700.972,,9.08E-07,0.49759467,Copied from Attic Roof,921.14
Garage Roof,"metal surfacing, Unfinished, Uninsulated, Flat",metal surfacing,Flat,"Unfinished, Uninsulated",METAL SURFACING,0.0005,50.04,7801.74,,1.02E-05,1.796623696,Copied from Attic Roof,460.57
Garage Roof,"metal surfacing, Unfinished, Uninsulated, Flat",metal surfacing,Flat,"Unfinished, Uninsulated",ROOF RIGID INS,0.004,0.029,32.04,,0.1347,0.155615717,Copied from Attic Roof,1214.23
Garage Roof,"metal surfacing, Unfinished, Uninsulated, Flat",metal surfacing,Flat,"Unfinished, Uninsulated",OSB SHEATHING 0.5 IN.,0.0127,0.115,512.64,,0.11,7.905278413,Copied from Attic Roof,1214.23
Garage Roof,"metal surfacing, Unfinished, Uninsulated, Flat, Radiant Barrier",metal surfacing,"Flat, Radiant Barrier","Unfinished, Uninsulated",METAL SURFACING,0.0005,50.04,7801.74,,1.02E-05,1.796623696,Copied from Attic Roof,460.57
Garage Roof,"metal surfacing, Unfinished, Uninsulated, Flat, Radiant Barrier",metal surfacing,"Flat, Radiant Barrier","Unfinished, Uninsulated",ROOF RIGID INS,0.004,0.029,32.04,,0.1347,0.155615717,Copied from Attic Roof,1214.23
Garage Roof,"metal surfacing, Unfinished, Uninsulated, Flat, Radiant Barrier",metal surfacing,"Flat, Radiant Barrier","Unfinished, Uninsulated",OSB SHEATHING 0.5 IN.,0.0127,0.115,512.64,,0.11,7.905278413,Copied from Attic Roof,1214.23
Garage Roof,"metal surfacing, Unfinished, Uninsulated, Flat, Radiant Barrier",metal surfacing,"Flat, Radiant Barrier","Unfinished, Uninsulated",RADIANT BARRIER,0.0002,235.07,2700.972,,9.08E-07,0.49759467,Copied from Attic Roof,921.14
Garage Roof,"slate or tile shingles, Unfinished, Uninsulated, Flat",slate or tile shingles,Flat,"Unfinished, Uninsulated",SLATE OR TILE SHINGLES,0.0191,0.841,1899.972,,0.02265,29.02130224,Copied from Attic Roof,799.717
Garage Roof,"slate or tile shingles, Unfinished, Uninsulated, Flat",slate or tile shingles,Flat,"Unfinished, Uninsulated",ROOF RIGID INS,0.0033,0.029,32.04,,0.1121,0.128382966,Copied from Attic Roof,1214.23
Garage Roof,"slate or tile shingles, Unfinished, Uninsulated, Flat",slate or tile shingles,Flat,"Unfinished, Uninsulated",OSB SHEATHING 0.5 IN.,0.0127,0.115,512.64,,0.11,7.905278413,Copied from Attic Roof,1214.23
Garage Roof,"slate or tile shingles, Unfinished, Uninsulated, Flat, Radiant Barrier",slate or tile shingles,"Flat, Radiant Barrier","Unfinished, Uninsulated",SLATE OR TILE SHINGLES,0.0191,0.841,1899.972,,0.02265,29.02130224,Copied from Attic Roof,799.717
Garage Roof,"slate or tile shingles, Unfinished, Uninsulated, Flat, Radiant Barrier",slate or tile shingles,"Flat, Radiant Barrier","Unfinished, Uninsulated",ROOF RIGID INS,0.0033,0.029,32.04,,0.1121,0.128382966,Copied from Attic Roof,1214.23
Garage Roof,"slate or tile shingles, Unfinished, Uninsulated, Flat, Radiant Barrier",slate or tile shingles,"Flat, Radiant Barrier","Unfinished, Uninsulated",OSB SHEATHING 0.5 IN.,0.0127,0.115,512.64,,0.11,7.905278413,Copied from Attic Roof,1214.23
Garage Roof,"slate or tile shingles, Unfinished, Uninsulated, Flat, Radiant Barrier",slate or tile shingles,"Flat, Radiant Barrier","Unfinished, Uninsulated",RADIANT BARRIER,0.0002,235.07,2700.972,,9.08E-07,0.49759467,Copied from Attic Roof,921.14
Garage Roof,"wood shingles or shakes, Unfinished, Uninsulated, Flat",wood shingles or shakes,Flat,"Unfinished, Uninsulated",WOOD SHINGLES OR SHAKES,0.0063,0.163,1121.4,,0.03903,10.35314047,Copied from Attic Roof,1465.45
Garage Roof,"wood shingles or shakes, Unfinished, Uninsulated, Flat",wood shingles or shakes,Flat,"Unfinished, Uninsulated",ROOF RIGID INS,0.0028,0.029,32.04,,0.09571,0.108931002,Copied from Attic Roof,1214.23
Garage Roof,"wood shingles or shakes, Unfinished, Uninsulated, Flat",wood shingles or shakes,Flat,"Unfinished, Uninsulated",OSB SHEATHING 0.5 IN.,0.0127,0.115,512.64,,0.11,7.905278413,Copied from Attic Roof,1214.23
Garage Roof,"wood shingles or shakes, Unfinished, Uninsulated, Flat, Radiant Barrier",wood shingles or shakes,"Flat, Radiant Barrier","Unfinished, Uninsulated",WOOD SHINGLES OR SHAKES,0.0063,0.163,1121.4,,0.03903,10.35314047,Copied from Attic Roof,1465.45
Garage Roof,"wood shingles or shakes, Unfinished, Uninsulated, Flat, Radiant Barrier",wood shingles or shakes,"Flat, Radiant Barrier","Unfinished, Uninsulated",ROOF RIGID INS,0.0028,0.029,32.04,,0.09571,0.108931002,Copied from Attic Roof,1214.23
Garage Roof,"wood shingles or shakes, Unfinished, Uninsulated, Flat, Radiant Barrier",wood shingles or shakes,"Flat, Radiant Barrier","Unfinished, Uninsulated",OSB SHEATHING 0.5 IN.,0.0127,0.115,512.64,,0.11,7.905278413,Copied from Attic Roof,1214.23
Garage Roof,"wood shingles or shakes, Unfinished, Uninsulated, Flat, Radiant Barrier",wood shingles or shakes,"Flat, Radiant Barrier","Unfinished, Uninsulated",RADIANT BARRIER,0.0002,235.07,2700.972,,9.08E-07,0.49759467,Copied from Attic Roof,921.14
Garage Wall,"ConcreteMasonryUnit, asbestos siding",,,,ASBESTOS SIDING,0.0025,0.606,1899.972,,0.004192,4.773109658,,1004.88
Garage Wall,"ConcreteMasonryUnit, asbestos siding",,,,WALL RIGID INS,0.0101,0.029,32.04,,0.3417,0.392929685,,1214.23
Garage Wall,"ConcreteMasonryUnit, asbestos siding",,,,CONCRETE BLOCK,0.1524,0.747,1892.443,,0.2041,241.8075864,,838.421
Expand Down
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,11 @@ ochre = "ochre:cli"
ochre-gui-basic = "ochre:gui_basic"
ochre-gui-detailed = "ochre:gui_detailed"

[project.optional-dependencies]
[dependency-groups]
dev = [
"ruff==0.14.14",
"pytest>=8.0",
"pytest-cov>=5.0",
"pytest-xdist>=3.8.0",
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ bldg0259582,CA,Single-Family Detached,<1940,500-749,Standard Efficiency,0.2980,0
bldg0274778,OK,Single-Family Detached,1990s,3000-3999,None,NA,0.0000,NA
bldg0275797,NJ,Multi-Family with 5+ Units,<1940,0-499,Standard Efficiency,0.3260,0.2320,+40.5%
bldg0276627,AK,Single-Family Detached,2000s,2000-2499,None,FAILED,0.0000,FAILED
bldg0288066,CA,Single-Family Detached,2000s,2500-2999,Standard Efficiency,FAILED,0.2790,FAILED
bldg0288066,CA,Single-Family Detached,2000s,2500-2999,Standard Efficiency,0.3770,0.2790,+35.1%
bldg0294702,NM,Single-Family Detached,2000s,4000+,None,NA,0.0000,NA
bldg0336334,CA,Single-Family Attached,1990s,2500-2999,None,NA,0.0000,NA
bldg0338190,KY,Single-Family Detached,2000s,1500-1999,None,NA,0.0000,NA
Expand All @@ -54,13 +54,13 @@ bldg0422846,CO,Multi-Family with 5+ Units,<1940,750-999,None,NA,0.0000,NA
bldg0437452,CA,Single-Family Attached,1960s,750-999,None,NA,0.0000,NA
bldg0445042,CA,Single-Family Attached,1980s,1500-1999,Standard Efficiency,0.3270,0.2320,+40.9%
bldg0449322,CA,Single-Family Attached,1970s,1000-1499,Standard Efficiency,0.3550,0.2790,+27.2%
bldg0451855,AL,Multi-Family with 5+ Units,1990s,750-999,None,FAILED,0.0000,FAILED
bldg0464288,WA,Single-Family Detached,1950s,2000-2499,Standard Efficiency,FAILED,0.1390,FAILED
bldg0475650,CA,Single-Family Detached,2000s,1000-1499,Standard Efficiency,FAILED,0.2790,FAILED
bldg0451855,AL,Multi-Family with 5+ Units,1990s,750-999,None,NA,0.0000,NA
bldg0464288,WA,Single-Family Detached,1950s,2000-2499,Standard Efficiency,0.2310,0.1390,+66.2%
bldg0475650,CA,Single-Family Detached,2000s,1000-1499,Standard Efficiency,0.3790,0.2790,+35.8%
bldg0483730,CA,Single-Family Detached,1950s,4000+,Standard Efficiency,0.2710,0.1860,+45.7%
bldg0486267,ME,Single-Family Detached,1990s,1000-1499,Standard Efficiency,0.1650,0.0930,+77.4%
bldg0487739,WY,Mobile Home,1970s,750-999,Standard Efficiency,0.1500,0.0930,+61.3%
bldg0499827,CA,Single-Family Detached,1990s,2000-2499,Standard Efficiency,FAILED,0.1860,FAILED
bldg0501306,CA,Single-Family Detached,1960s,2500-2999,Standard Efficiency,FAILED,0.2320,FAILED
bldg0501306,CA,Single-Family Detached,1960s,2500-2999,Standard Efficiency,0.3270,0.2320,+40.9%
bldg0522592,MA,Multi-Family with 5+ Units,2010s,1000-1499,Standard Efficiency,0.2980,0.1860,+60.2%
bldg9064288,WA,Single-Family Detached,1950s,2000-2499,Standard Efficiency,FAILED,0.1390,FAILED
bldg9064288,WA,Single-Family Detached,1950s,2000-2499,Standard Efficiency,0.2220,0.1390,+59.7%
Loading
Loading