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

feat: allow cross overs both in and out of the same compressor train … #709

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

olelod
Copy link
Contributor

@olelod olelod commented Nov 22, 2024

…in a compressor system

This can be done if it is made sure that the compressor trains in the compressor system are processed in the right order. You can only pass rates to a compressor train that has not been processed yet. Hence, the indexes in the list specifying the cross overs must be increasing (or zero, meaning no cross over).

Why is this pull request needed?

A case with a compressor system with three compressor trains (A, B, C). Send everything to A first, if it is too much pass the exceeding rate on to train B, if it is too much for train B also, pass the remaining rate on to train C.

Have you remembered and considered?

  • I have remembered to update documentation
  • I have remembered to update manual changelog (docs/drafts/next.draft.md)
  • I have remembered to update migration guide (docs/docs/migration_guides/)
  • I have committed with BREAKING: in footer or ! in header, if breaking
  • 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 Jira issue ID somewhere in the commit body (ECALC-XXXX)

@olelod olelod requested a review from a team as a code owner November 22, 2024 10:49
if self.crossover is None:
return self
for index, crossover in enumerate(self.crossover):
if crossover >= max(self.crossover[: index + 1]) or crossover == 0:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
if crossover >= max(self.crossover[: index + 1]) or crossover == 0:
if self.crossovers_exhausted(index, crossover) or self.has_no_crossovers():

or similar? more fluent and easier to read? too use more of those types of fluent typing/syntactic sugar?

@olelod olelod force-pushed the feat/allow-cross-overs-both-in-and-out-of-a-compressor-train branch from cf7be3f to c75f830 Compare November 22, 2024 12:20
…in a compressor system

This can be done if it is made sure that the compressor trains in the compressor system
are processed in the right order. You can only pass rates to a compressor train that
has not been processed yet. Hence, the indexes in the list specifying the cross overs
must be larger than the index of the compressor train where the cross over comes from
(or zero, meaning no cross over).
@olelod olelod force-pushed the feat/allow-cross-overs-both-in-and-out-of-a-compressor-train branch from c75f830 to 5ce2f63 Compare November 22, 2024 12:21
f"Crossover: {self.crossover}\n"
"The compressor trains in the compressor system are not defined in the correct order, according to "
"the way the crossovers are set up. eCalc can now try to pass excess rates to compressor trains in "
"the system that has already been evaluated. \n\n"
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this correct? Or should it be not evaluated?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The way it works now if you have crossover: [0, 1, 0], you first evaluate the first consumer (here it has no crossover). The next consumers can pass excess rate to the first one, potentially exceeding the maximum rate there, and the operational setting will be chosen even if it is invalid.

Copy link
Contributor

Choose a reason for hiding this comment

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

The sentence eCalc can now try to pass excess rates to compressor trains the system that has already been evaluated confused me. Is the intention to inform the user why the current crossover setting isn't allowed? So If we were to allow this crossover setup, eCalc™ could try to pass excess rates to compressor trains in the system that has already been evaluated?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Poorly phrased, I guess... Yes, that was happening in one model. The first train is within capacity, the second one outside capacity, so rate was passed to the first one (which then with the additional rate was outside capacity).

"To avoid loops and to avoid passing rates to compressor trains that have already been "
"processed, the index of the crossovers should be either 0 (no crossover) or larger than the index "
"of the current compressor train (passing excess rate to a compressor train not yet evaluated). \n\n"
"CROSSOVER: [2, 3, 0] is valid, but CROSSOVER: [2, 1, 0] is not. \n"
Copy link
Contributor

Choose a reason for hiding this comment

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

v2 does the sorting for the user, just sayin'

f"Crossover: {self.crossover}\n"
"The compressor trains in the compressor system are not defined in the correct order, according to "
"the way the crossovers are set up. eCalc can now try to pass excess rates to compressor trains in "
"the system that has already been evaluated. \n\n"
Copy link
Contributor

Choose a reason for hiding this comment

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

The sentence eCalc can now try to pass excess rates to compressor trains the system that has already been evaluated confused me. Is the intention to inform the user why the current crossover setting isn't allowed? So If we were to allow this crossover setup, eCalc™ could try to pass excess rates to compressor trains in the system that has already been evaluated?

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