Skip to main content

PNNL ruleset checking tool

Project description

Latest Release
License
Test

Ruleset Checking Tool

Ruleset Checking Tool for ANSI/ASHRAE/IES Standard 90.1-2019 Appendix G

This package provides a reference implementation of a Ruleset Checking Tool (RCT) in support of ASHRAE Standard 229P. The RCT is not intended to be a normative part of the proposed standard, so use with Std 229P is optional. This RCT implementation is specific to ANSI/ASHRAE/IES Standard 90.1-2019 Appendix G and does not support any other rulesets. Final release of this package is dependent upon acceptance and publication of ASHRAE Standard 229P.

Install it from PyPI

pip install ruleset-checking-tool

Usage

from rct229.web_application import run_project_evaluation as run
from rct229.utils.file import deserialize_rpd_file

user_rpd_path = "../examples/chicago_demo/user_model.json"
proposed_rpd_path = "../examples/chicago_demo/proposed_model.json"
baseline_rpd_path = "../examples/chicago_demo/baseline_model.json"

user_rpd = None
proposed_rpd = None
baseline_rpd = None
try:
    user_rpd = deserialize_rpd_file(user_rpd_path)
except:
    print(f"{user_rpd_path} is not a valid JSON file")

try:
    proposed_rpd = deserialize_rpd_file(proposed_rpd_path)
except:
    print(f"{proposed_rpd_path} is not a valid JSON file")
    
try:
    baseline_rpd = deserialize_rpd_file(baseline_rpd_path)
except:
    print(f"{baseline_rpd_path} is not a valid JSON file")


run([user_rpd, proposed_rpd, baseline_rpd], "ashrae9012019", ["ASHRAE9012019DetailReport"], saving_dir="./")

You can also call evaluation functions from its command line tool. Example is given below:

rct229 evaluate -rs ashrae9012019 -f examples\chicago_demo\baseline_model.json -f examples\chicago_demo\proposed_model.json -f examples\chicago_demo\user_model.json -r ASHRAE9012019DetailReport

About ASHRAE 229P

See details in the wiki.

Developing the RCT

Commands

The following provides some useful commands as you get started developing the RCT package.

This package is developed using Poetry to manage packages during the build process. First, follow the instruction from poetry to install the package. Any new dependencies that are added to the package must be included in the pyproject.toml. The package is currently being developed for Python 3.10. This version of Python must be installed on your machine for Poetry to work properly.

Now tests can be run by first installing dependencies and then running pytest.

  1. poetry install
  2. poetry run pytest
    • To see a coverage report, use poetry run pytest --cov
    • To have pytest watch for file changes, use poetry run ptw

You can also package with poetry to test the CLI tool. 2. poetry run rct229 test

Run with example ASHRAE 90.1 2019 RPDs.

  1. poetry run rct229 evaluate -rs ashrae9012019 -f examples\chicago_demo\baseline_model.json -f examples\chicago_demo\proposed_model.json -f examples\chicago_demo\user_model.json -r ASHRAE9012019_DETAIL

Developer Notes

Branch and Pull Request naming convention:

The branch or PR name should have the form:

CODE/INITIALS/DESCRIPTIVE_NAME

CODE is one of the following:

  • RCT: for generic, high-level changes to the ruleset checking tool. Examples include updates to README.md, and the schema files
  • RDS: for changes related to the RDS files
  • RS: for changes to the ruleset code (the actual rules)
  • RT: for changes to the rule test engine

INIITIALS refers to the initials of the owner of the branch or PR.

Commit procedure:

Before committing changes you should run the following commands from the ruleset-checking-tool directory.

  1. poetry run isort . to sort imports according to PEP8 https://www.python.org/dev/peps/pep-0008/
  2. poetry run black . to otherwise format code according to PEP8
  3. poetry run pytest --cov to run all unit tests for functions.
  4. poetry run rct229 test to run rule definition tests.
    1. use -rs ashrae9012019 to run all 90.1 2019 rule definition tests.

Mocking functions for pytests:

Profiling:

  • To profile a file: poetry run pyinstrument --renderer=html path_to_file
  • To profile the RCT command line: poetry run pyinstrument --renderer=html rct229/cli.py evaluate examples/proposed_model.rmd examples/baseline_model.rmd examples/proposed_model.rmd
  • Note: Aborting the run with Ctrl C will cause the profiler to output the profile up to the abort.
  • For detailed info on pyinstrument: https://pyinstrument.readthedocs.io/en/latest/home.html

Disclaimer Notice

This material was prepared as an account of work sponsored by an agency of the United States Government. Neither the United States Government nor the United States Department of Energy, nor Battelle, nor any of their employees, nor any jurisdiction or organization that has cooperated in the development of these materials, makes any warranty, express or implied, or assumes any legal liability or responsibility for the accuracy, completeness, or usefulness or any information, apparatus, product, software, or process disclosed, or represents that its use would not infringe privately owned rights. Reference herein to any specific commercial product, process, or service by trade name, trademark, manufacturer, or otherwise does not necessarily constitute or imply its endorsement, recommendation, or favoring by the United States Government or any agency thereof, or Battelle Memorial Institute. The views and opinions of authors expressed herein do not necessarily state or reflect those of the United States Government or any agency thereof.

PACIFIC NORTHWEST NATIONAL LABORATORY
operated by
BATTELLE
for the
UNITED STATES DEPARTMENT OF ENERGY
under Contract DE-AC05-76RL01830

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ruleset_checking_tool-0.2.8.tar.gz (3.5 MB view details)

Uploaded Source

Built Distribution

ruleset_checking_tool-0.2.8-py3-none-any.whl (4.3 MB view details)

Uploaded Python 3

File details

Details for the file ruleset_checking_tool-0.2.8.tar.gz.

File metadata

  • Download URL: ruleset_checking_tool-0.2.8.tar.gz
  • Upload date:
  • Size: 3.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.10.14 Linux/6.5.0-1021-azure

File hashes

Hashes for ruleset_checking_tool-0.2.8.tar.gz
Algorithm Hash digest
SHA256 dacaf9f5fceb124b5ec8d62dc64471794218ea9899d297d77e9c2644d59edcc5
MD5 74aa356ac023379e43ed9015c9b8e38c
BLAKE2b-256 fde0699dff96a3d483d669e7f389a4ab32be85e8751d1b7d39e47731090cdfdd

See more details on using hashes here.

File details

Details for the file ruleset_checking_tool-0.2.8-py3-none-any.whl.

File metadata

File hashes

Hashes for ruleset_checking_tool-0.2.8-py3-none-any.whl
Algorithm Hash digest
SHA256 0af524a253518c5d51f65d22efade39c7c85a7e64256a1c9f0b3445aac18b34a
MD5 a315bea524afb38a46092b0f8a97206f
BLAKE2b-256 1f01a300525b059c594a9453086d6b39dc168de6562821cb108e226c025a9d9f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page