Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add filter yaml capability to upgrades_analyzer #38

Merged
merged 5 commits into from
Dec 23, 2023
Merged

Add filter yaml capability to upgrades_analyzer #38

merged 5 commits into from
Dec 23, 2023

Conversation

rajeee
Copy link
Collaborator

@rajeee rajeee commented Dec 23, 2023

Resolves #[issue number here].

Pull Request Description

This PR introduces "filter_yaml" capability to upgrades_analyzer. filter_yamls are add-ons to the project definition files used for running ResStock or ComStock. The filter_yaml has the following schema which is similar to the schema of the regular project definition file except there are only two top level keys (besides the schema version): all_upgrades_remove_logic and upgrades.

all_upgrades_remove_logic can be used to define a removal logic (following the same syntax as any apply_logic) that will be used to remove buildings from all upgrades. The logic can greedy and include more buildings than what's in the upgrade - only the buildings that are actually available in the upgrade will be impacted, and the buildings not in the upgrade will be ignored.

upgrades block can be used to define (additional) removal logic for individual upgrades. The upgrades are referred to by the corresponding name in the project yaml, and the removal logic is specified under remove_logic key.

# xx_upgrades_filter.yaml_schema
schema_version: enum('0.1')
all_upgrades_remove_logic:  include('apply-logic-spec', required=False)
upgrades: list(include('upgrade-spec'), required=False)
---
upgrade-spec:
  upgrade_name: str(required=True)
  remove_logic: include('apply-logic-spec', required=True)
apply-logic-spec: >
  any(
    list(
      include('and-spec'),
      include('or-spec'),
      include('not-spec'),
      include('param_option-spec'),
    ),
    include('and-spec'),
    include('or-spec'),
    include('not-spec'),
    include('param_option-spec')
  )
or-spec:
  or: list(include('apply-logic-spec'))
and-spec:
  and: list(include('apply-logic-spec'))
not-spec:
  not: any(include('apply-logic-spec'), list(include('apply-logic-spec')))

@rajeee rajeee merged commit 55de28b into main Dec 23, 2023
@rajeee rajeee deleted the filter_yaml branch December 23, 2023 00:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant