Skip to content

feat: add yaml classes for PORTS and CONNECTIONS-based STREAM_DISTRIBUTION - #1562

Closed
frodehk wants to merge 4 commits into
mainfrom
feat/ports-and-stream-connections
Closed

feat: add yaml classes for PORTS and CONNECTIONS-based STREAM_DISTRIBUTION#1562
frodehk wants to merge 4 commits into
mainfrom
feat/ports-and-stream-connections

Conversation

@frodehk

@frodehk frodehk commented May 18, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds yaml classes for the upcoming CONNECTIONS-based STREAM_DISTRIBUTION structure, along with PORTS for declaring physical interstage connection points on compressor stages.

Why

The domain already supports multiple streams and pressures, but the YAML schema only allows a single inlet stream and a single outlet pressure per train. PORTS and CONNECTIONS make it possible to express setups with multiple inlets along the train and intermediate pressure targets.

Scope

Schema additions only. The new classes are defined but not used in any field on YamlProcessSimulation. The existing stream_distribution schema remains in place so the mapper keeps working. Switching the field, removing the legacy classes, renaming YamlPortOverflow to YamlOverflow, and migrating the mapper will follow in subsequent PRs.

What's added

On YamlCompressorStageProcessSystem:

  • PORTS — optional mapping of port name → port specification

New schema classes (defined, not yet wired up):

  • YamlPort, YamlPortType — declares an INLET port on a stage
  • YamlRateDistributionEntry — port + rate fraction
  • YamlPortOverflow — port-to-port overflow (temporary name to avoid collision with the legacy YamlOverflow)
  • YamlIndividualStreamConnection — one stream routed to one port
  • YamlCommonStreamConnection — one stream distributed across multiple ports
  • YamlConnection — discriminated union of the two connection types
  • YamlStreamDistributionPriority — set of connections forming one complete configuration
YAML example (illustrates the target structure)
# A setup with two compressor trains running in parallel, a side inlet on the second stage  
# of train A, and a common gas stream split between the two trains with overflow handling.
PROCESS_SIMULATIONS:
  - NAME: my_simulation
    TARGETS:
      - TARGET:
          NAME: train_a
          TYPE: SERIAL
          ITEMS:
            - TARGET:
                NAME: stage_1
                TYPE: COMPRESSOR_STAGE
                INLET_TEMPERATURE: 30
                COMPRESSOR: compressor_a1
            - TARGET:
                NAME: stage_2
                TYPE: COMPRESSOR_STAGE
                INLET_TEMPERATURE: 30
                COMPRESSOR: compressor_a2
                PORTS:
                  side_inlet:
                    TYPE: INLET
      - TARGET:
          NAME: train_b
          TYPE: SERIAL
          ITEMS:
            - TARGET:
                NAME: stage_1
                TYPE: COMPRESSOR_STAGE
                INLET_TEMPERATURE: 30
                COMPRESSOR: compressor_b1

    STREAM_DISTRIBUTION:
      # Priority 1 - preferred configuration:
      # - injection_stream goes to the side inlet on train A, stage 2
      # - main_gas is split 70/30 between train A and train B, with excess from
      #   train A overflowing to train B if A cannot handle its share.
      - CONNECTIONS:
          - TYPE: INDIVIDUAL_STREAM
            STREAM: injection_stream
            PORT: train_a.stage_2.side_inlet
          - TYPE: COMMON_STREAM
            STREAM: main_gas
            RATE_DISTRIBUTION:
              - PORT: train_a.stage_1.inlet
                RATE_FRACTION: 0.7
              - PORT: train_b.stage_1.inlet
                RATE_FRACTION: 0.3
            OVERFLOW:
              - FROM_REFERENCE: train_a.stage_1.inlet
                TO_REFERENCE: train_b.stage_1.inlet

      # Priority 2 - fallback configuration used if priority 1 is infeasible:
      # - injection_stream goes to the side inlet on train A, stage 2
      # - main_gas is routed entirely through train B.
      - CONNECTIONS:
          - TYPE: INDIVIDUAL_STREAM
            STREAM: injection_stream
            PORT: train_a.stage_2.side_inlet
          - TYPE: INDIVIDUAL_STREAM
            STREAM: main_gas
            PORT: train_b.stage_1.inlet

Refs: equinor/ecalc-internal#1809


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?

@frodehk frodehk self-assigned this May 18, 2026
@frodehk
frodehk requested a review from a team as a code owner May 18, 2026 14:06
@frodehk frodehk changed the title feat: add PORTS and STREAM_CONNECTIONS to process system schema feat: add schema classes for PORTS and CONNECTIONS-based STREAM_DISTRIBUTION May 20, 2026
@frodehk frodehk changed the title feat: add schema classes for PORTS and CONNECTIONS-based STREAM_DISTRIBUTION feat: add yaml classes for PORTS and CONNECTIONS-based STREAM_DISTRIBUTION May 20, 2026
@frodehk
frodehk marked this pull request as draft May 20, 2026 11:49
@frodehk

frodehk commented Jun 22, 2026

Copy link
Copy Markdown
Contributor Author

Will be handled in other pull requests, e.g. #1636

@frodehk frodehk closed this Jun 22, 2026
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.

1 participant