Skip to content

Commit 5a1487d

Browse files
committed
chore: add yaml class single speed compressor train
1 parent 8d03822 commit 5a1487d

File tree

2 files changed

+78
-0
lines changed

2 files changed

+78
-0
lines changed
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
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]

src/libecalc/presentation/yaml/yaml_types/models/yaml_enums.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ class YamlModelType(str, enum.Enum):
66
COMPRESSOR_CHART = "COMPRESSOR_CHART"
77
TURBINE = "TURBINE"
88
FLUID = "FLUID"
9+
SINGLE_SPEED_COMPRESSOR_TRAIN = "SINGLE_SPEED_COMPRESSOR_TRAIN"
910

1011

1112
class YamlChartType(str, enum.Enum):

0 commit comments

Comments
 (0)