Skip to content

Demand pattern library #492

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

Merged
merged 17 commits into from
Apr 4, 2025
Merged

Demand pattern library #492

merged 17 commits into from
Apr 4, 2025

Conversation

kaklise
Copy link
Collaborator

@kaklise kaklise commented Mar 25, 2025

Summary

The following PR includes a demand pattern library with the following capabilities:

  • Load a library of demand patterns from a JSON file (this contains patterns from existing INP files)
  • Add a pattern to the library
  • Create a pulse pattern (on/off sequence)
  • Create a pattern that follows a gaussian or triangular distribution
  • Combine patterns
  • Create a copy of a pattern
  • Modify the pattern timestep or start clocktime
  • Add gaussian random noise to a pattern
  • Normalize the pattern to have a mean of 1
  • Filter patterns by category
  • Convert the pattern to a WNTR Pattern object to it add to a WaterNetworkModel
  • Convert the pattern to a Pandas Series (indexed by time in seconds) to easily analyze or further modify the pattern
  • Plot patterns
  • Save and load custom demand pattern libraries

The WNTR Pattern object now includes a flag (in time options) for pattern interpolation, this is used to extend and combine patterns.

Tests and documentation

Tests are located in test_library_demand.py
Documentation is in libraries.rst (the multispecies model library is now also included in this section of the documentation)

Acknowledgement

By contributing to this software project, I acknowledge that I have reviewed the software quality assurance guidelines and that my contributions are submitted under the Revised BSD License.

@kbonney kbonney self-requested a review March 26, 2025 19:32
Copy link
Collaborator

@kbonney kbonney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The demand library feature is well-designed, documented, and tested. I have suggested some minor changes to the documentation (kaklise#81), but otherwise this PR is solid and ready to merge.

@coveralls
Copy link

Coverage Status

coverage: 82.083% (+0.3%) from 81.788%
when pulling 14ab83d on kaklise:demand_library
into 102e2ad on USEPA:main.

@kaklise kaklise merged commit c41b5e4 into USEPA:main Apr 4, 2025
43 checks passed
@kaklise kaklise deleted the demand_library branch June 3, 2025 17:43
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.

3 participants