Skip to content

fix(libecalc): improve validation of pressures set to zero - #1705

Merged
olelod merged 1 commit into
mainfrom
fix/zero-pressure-validation
Aug 6, 2026
Merged

fix(libecalc): improve validation of pressures set to zero#1705
olelod merged 1 commit into
mainfrom
fix/zero-pressure-validation

Conversation

@olelod

@olelod olelod commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Today it is common among ecalc operators to set the rate (and often also pressures) to zero when a consumer should be switched off. At some point in the (not too distant) future, this will change - such that a consumer can be started and stopped in some other way.

The situation today is that it does not really matter what the pressure is when the rate is 0. No calculation will be performed. The code, however, currently treats a zero pressure as missing (None) - and an assert statement fails, due to pressure being required to be defined.

This PR changes the validation of pressures slightly such that the pressure is also required to be positive, but only if the rate is positive. If rate is non-positive, the pressure can be any number.

Type of Work

  • Patch: X.Y.Z+1. NEGLIGIBLE visible changes, does not change input or output - OR changes behaviour. Use chore:, refactor: etc
  • Minor: X.Y+1.Z. Minor changes, might ADD new input (YAML), or other backwards-compatible changes. Use feat:, fix:
  • Major: X+1.Y.Z. Major and most likely BREAKING changes, wo. backwards compatibility, or removing temporary backwards compatibility functionality. Use ! or BREAKING:.

See here (internal): https://github.com/equinor/ecalc-internal/discussions/1044

Have you remembered and considered?

  • IF FEAT: I have remembered to update documentation
  • IF FIX OR FEAT: I have remembered to update manual changelog (docs/drafts/next.draft.md)
  • IF BREAKING: I have remembered to update migration guide (docs/docs/migration_guides/)
  • IF BREAKING: I have committed with BREAKING: in footer or ! in header
  • I have added tests (if not, comment why)
  • I have used conventional commits syntax (if you squash, make sure that conventional commit is used)
  • I have included the Github issue nr in the footer!

What is this PR all about?

What else did you consider?

Between the lines?

@olelod
olelod force-pushed the fix/zero-pressure-validation branch from 32974bf to 87b8f7d Compare August 6, 2026 09:31
@olelod
olelod marked this pull request as ready for review August 6, 2026 11:38
@olelod
olelod requested a review from a team as a code owner August 6, 2026 11:38
- Expression values of 0 were treated as missing causing assertion failures
- Add ProcessNonPositivePressureValidationException for clear feedback
  when suction, discharge, or intermediate pressure is zero or negative (but
  currently only validate when the rate is positive - this should change when
  we get other means than rate =0 for switching a consumer off)
- Rename validate_increasing_pressure to validate_pressures
@olelod
olelod force-pushed the fix/zero-pressure-validation branch from 87b8f7d to 71fb639 Compare August 6, 2026 11:39
@olelod
olelod merged commit 5df4878 into main Aug 6, 2026
25 checks passed
@olelod
olelod deleted the fix/zero-pressure-validation branch August 6, 2026 11: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.

2 participants