-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathliquid_remover.py
More file actions
30 lines (23 loc) · 1.19 KB
/
liquid_remover.py
File metadata and controls
30 lines (23 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from typing import Final
from libecalc.domain.process.process_pipeline.process_unit import GasProcessUnit, ProcessUnitId
from libecalc.domain.process.value_objects.fluid_stream import FluidService, FluidStream
from libecalc.domain.process.value_objects.fluid_stream.constants import ThermodynamicConstants
class LiquidRemover(GasProcessUnit):
def __init__(self, fluid_service: FluidService, process_unit_id: ProcessUnitId | None = None):
self._id: Final[ProcessUnitId] = process_unit_id or GasProcessUnit._create_id()
self._fluid_service = fluid_service
def get_id(self) -> ProcessUnitId:
return self._id
def propagate_stream(self, inlet_stream: FluidStream) -> FluidStream:
"""
Removes liquid from the fluid stream.
Args:
inlet_stream: The fluid stream to be scrubbed.
Returns:
FluidStream: A new FluidStream with liquid removed.
"""
if inlet_stream.vapor_fraction_molar < ThermodynamicConstants.PURE_VAPOR_THRESHOLD:
new_fluid = self._fluid_service.remove_liquid(inlet_stream.fluid)
return inlet_stream.with_new_fluid(new_fluid)
else:
return inlet_stream