WIP: feat(yaml): introduce multiple streams and pressures functionality in process_systems and process_simulations#1453
WIP: feat(yaml): introduce multiple streams and pressures functionality in process_systems and process_simulations#1453
Conversation
2f01beb to
507f040
Compare
| class YamlInterstageProcessSystem(YamlBase): | ||
| type: Literal["INTERSTAGE"] | ||
| name: ProcessSystemReference | ||
| items: list[YamlInterstageItem] = Field( | ||
| default_factory=list, | ||
| title="ITEMS", | ||
| description="Ordered list of choke, mixer, and splitter units at this interstage location.", | ||
| ) |
There was a problem hiding this comment.
Do we actually need this? Can we instead just have a list of units in addition to CompressorStages when setting up the train?
| type: Literal["SERIAL"] | ||
| name: ProcessSystemReference | ||
| items: list[YamlItem[YamlCompressorStageProcessSystem]] | ||
| items: list[YamlItem[YamlCompressorStageProcessSystem | YamlInterstageProcessSystem]] |
There was a problem hiding this comment.
| items: list[YamlItem[YamlCompressorStageProcessSystem | YamlInterstageProcessSystem]] | |
| items: list[YamlItem[YamlCompressorStageProcessSystem | YamlInterstageChoke | YamlInterstageSplitter | YamlInterstageMixer]] |
|
|
||
| class YamlProcessConstraints(YamlBase): | ||
| outlet_pressure: YamlExpressionType | None = Field( | ||
| discharge_pressure: YamlExpressionType | None = Field( |
There was a problem hiding this comment.
Should we use discharge instead of inlet? inlet/outlet seems to work for streams, is it different for pressure?
| title="DISCHARGE_PRESSURE", | ||
| description="Target discharge pressure [bara].", | ||
| ) | ||
| pressure_control: YamlPressureControl | None = Field( |
There was a problem hiding this comment.
Will constraint, anti-surge and pressure control always go hand-in-hand?
I think we also should consider introducing a type for constraint, maybe switch to a list. That gives us more flexibility in case we need to introduce different constraints.
If combining constraint and 'how to solve' like this we should also consider a different name than constraint
08d553e to
88e14e6
Compare
8e95998 to
fbae582
Compare
| @@ -231,12 +231,12 @@ def _get_compressor(self, yaml_compressor_stage: YamlCompressorStageProcessSyste | |||
| ) | |||
|
|
|||
| def _get_compressors(self, target: YamlSerialProcessSystem, shaft: Shaft) -> list[Compressor]: | |||
There was a problem hiding this comment.
Suggestion - replace _get_compressors() and _get_compressor() with:
_map_stage_to_process_units()->list[ProcessUnit](CompressorandTemperatureSetter)_map_pressure_drop_to_process_units()->list[ProcessUnit](Choke)_get_process_units()->list[ProcessUnit](Choke,TemperatureSetter,Compressor)
There was a problem hiding this comment.
Will be added in a follow up PR involving yaml-to-domain mapping
Consolidate all process system types in yaml_process_system.py. - Add interstage topology types: PRESSURE_DROP, MIXER, SPLITTER - Add SERIAL anti-surge config (INDIVIDUAL_ASV / COMMON_ASV) - Restructure simulation targets with per-item constraints carrying OUTLET_PRESSURE and PRESSURE_CONTROL - Add MIXER_STREAMS and SPLITTER_RATES to simulation targets - Add parse-time validators in YamlAsset (topological ordering, choke placement, reference consistency)
fbae582 to
4289e42
Compare
Summary
Refactors the process system and simulation YAML types to support interstage topology — enabling expression of legacy multi-stream and multi-pressure compressor trains in the new YAML format.
All types live in
yaml_process_system.py.Process system topology (
PROCESS_SYSTEMS)COMPRESSOR_STAGEPRESSURE_DROPMIXERSPLITTERSERIALANTI_SURGE(default:INDIVIDUAL_ASV)PRESSURE_DROP,MIXER, andSPLITTERare new interstage topology types.Process simulation (
PROCESS_SIMULATIONS)Each simulation has a list of
TARGETS(one = serial, many = parallel — implicit from count) and a requiredSTREAM_DISTRIBUTION(COMMON_STREAMorINDIVIDUAL_STREAMS, both accept stream refs or inline stream definitions).Each target carries:
TARGET: reference to aSERIALprocess systemCONSTRAINTS: map of item name / train name →OUTLET_PRESSURE+PRESSURE_CONTROLMIXER_STREAMS: map of mixer name → inlet streamSPLITTER_RATES: map of splitter name → extraction rateParse-time validation
SERIALprocess systemMIXERin a train must have aMIXER_STREAMSentry per targetSPLITTERin a train must have aSPLITTER_RATESentry per targetSERIAL.items)UPSTREAM_CHOKEonly valid on the first constraint in topological orderDOWNSTREAM_CHOKEonly valid on the last constraint in topological orderINDIVIDUAL_STREAMS: inlet stream count must match target countCOMMON_STREAM: eachRATE_FRACTIONSlist must have one entry per targetSERIAL.itemsmust not reference anotherSERIAL(no nested serial trains)MIXER_STREAMSkeys must referenceMIXERitems in the trainSPLITTER_RATESkeys must referenceSPLITTERitems in the trainCOMMON_STREAMoverflowFROM/TOreferences must be valid target namesMapper
process_simulation_mapper.pyupdated to resolve string item references viareference_service, read pressure control from per-target outlet constraints, and read anti-surge fromtrain.anti_surge. Multi-segment trains (more than one constraint) raiseNotImplementedErrorpendingMultiPressureSolversupport.Example YAML