Skip to content

Demand pattern library#492

Merged
kaklise merged 17 commits into
USEPA:mainfrom
kaklise:demand_library
Apr 4, 2025
Merged

Demand pattern library#492
kaklise merged 17 commits into
USEPA:mainfrom
kaklise:demand_library

Conversation

@kaklise

@kaklise kaklise commented Mar 25, 2025

Copy link
Copy Markdown
Collaborator

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

@kbonney kbonney left a comment

Copy link
Copy Markdown
Collaborator

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
Copy Markdown

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
@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