|
| 1 | +import enum |
| 2 | +from typing import List, Literal |
| 3 | + |
| 4 | +from pydantic import Field |
| 5 | + |
| 6 | +from libecalc.presentation.yaml.yaml_types import YamlBase |
| 7 | +from libecalc.presentation.yaml.yaml_types.models.yaml_compressor_chart import ( |
| 8 | + YamlCompressorChart, |
| 9 | +) |
| 10 | +from libecalc.presentation.yaml.yaml_types.models.yaml_enums import ( |
| 11 | + YamlModelType, |
| 12 | +) |
| 13 | + |
| 14 | + |
| 15 | +class YamlPressureControl(enum.Enum): |
| 16 | + DOWNSTREAM_CHOKE = "DOWNSTREAM_CHOKE" |
| 17 | + UPSTREAM_CHOKE = "UPSTREAM_CHOKE" |
| 18 | + INDIVIDUAL_ASV_PRESSURE = "INDIVIDUAL_ASV_PRESSURE" |
| 19 | + INDIVIDUAL_ASV_RATE = "INDIVIDUAL_ASV_RATE" |
| 20 | + COMMON_ASV = "COMMON_ASV" |
| 21 | + |
| 22 | + |
| 23 | +class YamlCompressorStage(YamlBase): |
| 24 | + inlet_temperature: str = Field( |
| 25 | + ..., |
| 26 | + description="Inlet temperature in Celsius for stage", |
| 27 | + title="INLET_TEMPERATURE", |
| 28 | + ) |
| 29 | + compressor_chart: YamlCompressorChart = Field( |
| 30 | + ..., |
| 31 | + description="Reference to compressor chart model for stage, must be defined in MODELS or FACILITY_INPUTS", |
| 32 | + title="COMPRESSOR_CHART", |
| 33 | + ) |
| 34 | + pressure_drop_ahead_of_stage: str = Field( |
| 35 | + ..., |
| 36 | + description="Pressure drop before compression stage [in bar]", |
| 37 | + title="PRESSURE_DROP_AHEAD_OF_STAGE", |
| 38 | + ) |
| 39 | + |
| 40 | + |
| 41 | +class YamlSingleSpeedCompressorTrain(YamlBase): |
| 42 | + name: str = Field( |
| 43 | + ..., |
| 44 | + description="Name of the model. See documentation for more information.", |
| 45 | + title="NAME", |
| 46 | + ) |
| 47 | + type: Literal[YamlModelType.SINGLE_SPEED_COMPRESSOR_TRAIN] = Field( |
| 48 | + YamlModelType.SINGLE_SPEED_COMPRESSOR_TRAIN, |
| 49 | + description="Defines the type of model. See documentation for more information.", |
| 50 | + title="TYPE", |
| 51 | + ) |
| 52 | + fluid_model: str = Field(..., description="Reference to a fluid model", title="FLUID_MODEL") |
| 53 | + pressure_control: YamlPressureControl = Field( |
| 54 | + ..., |
| 55 | + description="Method for pressure control", |
| 56 | + title="PRESSURE_CONTROL", |
| 57 | + ) |
| 58 | + maximum_discharge_pressure: str = Field( |
| 59 | + ..., |
| 60 | + description="Maximum discharge pressure in bar (can only use if pressure control is DOWNSTREAM_CHOKE)", |
| 61 | + title="MAXIMUM_DISCHARGE_PRESSURE", |
| 62 | + ) |
| 63 | + power_adjustment_constant: float = Field( |
| 64 | + 0.0, |
| 65 | + description="Constant to adjust power usage in MW", |
| 66 | + title="POWER_ADJUSTMENT_CONSTANT", |
| 67 | + ) |
| 68 | + maximum_power: str = Field( |
| 69 | + ..., description="Optional constant MW maximum power the compressor train can require", title="MAXIMUM_POWER" |
| 70 | + ) |
| 71 | + calculate_max_rate: str = Field( |
| 72 | + ..., |
| 73 | + description="Optional compressor train max standard rate [Sm3/day] in result if set to true. " |
| 74 | + "Default false. Use with caution. This will increase runtime significantly.", |
| 75 | + title="CALCULATE_MAX_RATE", |
| 76 | + ) |
| 77 | + stages: List[YamlCompressorStage] |
0 commit comments