Skip to content

Add detailed pump model#45

Merged
kurbansitterley merged 31 commits into
watertap-org:mainfrom
MuktaHardikar:detailed_pump_model
Mar 12, 2026
Merged

Add detailed pump model#45
kurbansitterley merged 31 commits into
watertap-org:mainfrom
MuktaHardikar:detailed_pump_model

Conversation

@MuktaHardikar

@MuktaHardikar MuktaHardikar commented Feb 12, 2026

Copy link
Copy Markdown
Collaborator

This pump model simultaneously solves a system curve and pump curve to calculate the efficiency at the selected design point using affinity laws.

  • The filepath to a pump Head and Efficiency vs Flow can be provided to create a surrogate
  • Users can provide the surrogate coefficients for the head and efficiency surrogate
  • Test file check if calculate values are within error margin

Comment thread src/models/pump_detailed.py Outdated

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

Made some comments I can immediately address, but many that require some feedback / discussion

Comment thread src/models/tests/test_pump_curves_data.csv
Comment thread src/models/tests/test_pump_detailed.ipynb Outdated
Comment thread src/models/tests/test_pump_detailed.py Outdated
Comment thread src/models/pump_detailed.py Outdated
Comment thread src/models/pump_detailed.py
Comment thread src/models/tests/test_pump_detailed.py
Comment thread src/models/tests/test_pump_detailed.py
Comment thread src/models/tests/test_pump_detailed.py Outdated
Comment thread src/models/tests/test_pump_detailed.py Outdated
Comment thread src/models/tests/test_pump_detailed.py Outdated
@jakechurchi jakechurchi mentioned this pull request Feb 13, 2026
6 tasks
Comment thread src/models/tests/test_pump_detailed.py Outdated
@kurbansitterley kurbansitterley changed the title Detailed pump model Add detailed pump model Feb 18, 2026
@jakechurchi jakechurchi marked this pull request as ready for review February 18, 2026 21:54
Comment thread src/models/pump_detailed.py Outdated
Comment thread src/models/tests/test_pump_detailed.py Outdated

@pytest.mark.unit
def test_low_speed():
# Doubles as low speed (50%) test

@jakechurchi jakechurchi Feb 25, 2026

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.

For lower speed while using head and speed, I have found the first initialization needs to be sufficiently close to the final speed (test_pump_speed here) or there may be initialization issues. Idk if there is a standard to note details like that in documentation.

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.

this is great information and should be reflected with some sort of logic in the initialization routine

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.

I tried to re-create this issue, but doesn't seem to be a problem anymore? May have been a scaling factor issue. The initial flowrate guess can be pretty off and this test still passes.



@pytest.mark.unit
def test_negative_inlet_pressure():

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.

Documentation in PR #48 should be updated to reflect negative inlet pressures.

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.

what is the use case for a negative inlet pressure? Do you think it is common enough that changing the lower bound for pressure should just be part of the build?

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.

Yes, I think it common enough to move in.
Negative pressure is occurs when there is an elevation change the pump must overcome, like with the UF pumps.

Comment thread src/models/pump_detailed.py
Comment thread src/models/pump_detailed.py
)

# Add efficiency variables for more and VFD efficiency. Only defined for variable efficiency
self.vfd_efficiency = Param(

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.

While not needed for WRD, for smaller pumps, vfds, and motors, the efficiency will change with speed more significantly. I image some additional work on this component before merging into WaterTAP.

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

configuration logic should be clean up a bit and we should implement any custom logic needed in the initialization routine for particular use cases.

Comment thread src/models/pump_detailed.py
Comment thread src/models/pump_detailed.py Outdated
Comment thread src/models/pump_detailed.py Outdated
if isinstance(filepath, str):
try:
df = pd.read_csv(filepath)
except Exception as e:

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.

would this fail because the file isn't there? If so FileNotFoundError

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.

and actually, unless you intend to catch some other behavior here or want to have a custom error message, pandas will handle that for you.

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.

Because it fails during the domain validation, pyomo actually throws a ValueError

Comment thread src/models/pump_detailed.py Outdated
Comment thread src/models/pump_detailed.py
Comment thread src/models/tests/test_pump_detailed.py Outdated
from models.pump_detailed import Pump, Efficiency, PumpCurveDataType

solver = get_solver()

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.

because the CONFIG is so critical to what is built, you should have a test that has invalid config and make sure proper errors are raised (search watertap main for with pytest.raises()...)

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.

or check out the test for chemical addition in this repo

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.

I've added a number of these.

Comment thread src/models/pump_detailed.py Outdated


@pytest.mark.unit
def test_negative_inlet_pressure():

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.

what is the use case for a negative inlet pressure? Do you think it is common enough that changing the lower bound for pressure should just be part of the build?

Comment thread src/models/tests/test_pump_detailed.py
Comment thread src/models/pump_detailed.py Outdated
@kurbansitterley kurbansitterley merged commit 27c5eee into watertap-org:main Mar 12, 2026
3 checks passed
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