Skip to content

Commit 47f7150

Browse files
committed
refactor: rename prepare_model_stages_from_data to prepare_compressor_stages_from_data
Update method name for better clarity about compressor-specific functionality.
1 parent 93b934e commit 47f7150

4 files changed

Lines changed: 10 additions & 10 deletions

File tree

src/libecalc/domain/infrastructure/energy_components/legacy_consumer/consumer_function/compressor_consumer_function.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def __init__(
6767

6868
# Prepare simplified model stages BEFORE setting evaluation input
6969
# This fixes data flow: expressions -> builder -> model (not model -> builder)
70-
SimplifiedTrainBuilder.prepare_model_stages_from_data(
70+
SimplifiedTrainBuilder.prepare_compressor_stages_from_data(
7171
compressor_model=compressor_function,
7272
rate=stream_day_rate,
7373
suction_pressure=suction_pressure,

src/libecalc/domain/infrastructure/energy_components/legacy_consumer/system/consumer_function.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ def evaluate_consumers( # type: ignore[override]
325325
consumer_model = consumer.facility_model
326326

327327
# Prepare simplified model stages with correct data flow (BEFORE set_evaluation_input)
328-
SimplifiedTrainBuilder.prepare_model_stages_from_data(
328+
SimplifiedTrainBuilder.prepare_compressor_stages_from_data(
329329
compressor_model=consumer_model,
330330
rate=np.asarray(consumer_rates[i]),
331331
suction_pressure=np.asarray(operational_setting.suction_pressures[i]),

src/libecalc/domain/process/compressor/core/train/simplified_train_builder.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,13 +216,13 @@ def _calculate_number_of_compressors_needed(
216216
return math.ceil(x)
217217

218218
@staticmethod
219-
def prepare_model_stages_from_data(
219+
def prepare_compressor_stages_from_data(
220220
compressor_model: Any,
221221
rate: NDArray[np.float64],
222222
suction_pressure: NDArray[np.float64] | None,
223223
discharge_pressure: NDArray[np.float64] | None,
224224
) -> None:
225-
"""Centralized helper to prepare simplified model stages using builder approach.
225+
"""Centralized helper to prepare simplified compressor model stages using builder approach.
226226
227227
This consolidates the duplicate logic from consumer functions and provides
228228
a single, DRY implementation for stage preparation with correct data flow.

tests/libecalc/core/models/compressor_modelling/test_simplified_compressor_train.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@
1818
calculate_polytropic_head_campbell,
1919
)
2020
from libecalc.domain.process.compressor.dto import CompressorStage
21+
from libecalc.domain.process.value_objects.chart.compressor.compressor_chart_dto import CompressorChart
2122
from libecalc.domain.process.value_objects.chart.generic import GenericChartFromDesignPoint, GenericChartFromInput
2223
from libecalc.domain.process.value_objects.fluid_stream.fluid_model import FluidModel
2324
from libecalc.infrastructure.neqsim_fluid_provider.neqsim_fluid_factory import NeqSimFluidFactory
24-
from libecalc.domain.process.value_objects.chart.compressor.compressor_chart_dto import CompressorChart
2525

2626

2727
@pytest.fixture
@@ -192,7 +192,7 @@ def test_simplified_compressor_train_unknown_stages(
192192
fluid_model=fluid_model_rich, chart=variable_speed_compressor_chart_dto
193193
)
194194
# Prepare stages using centralized builder method (correct data flow)
195-
SimplifiedTrainBuilder.prepare_model_stages_from_data(
195+
SimplifiedTrainBuilder.prepare_compressor_stages_from_data(
196196
compressor_model=compressor_train,
197197
rate=np.linspace(start=1000, stop=10000, num=10),
198198
suction_pressure=np.linspace(start=10, stop=20, num=10),
@@ -213,7 +213,7 @@ def test_simplified_compressor_train_unknown_stages_with_constant_power_adjustme
213213
fluid_model=fluid_model_rich, chart=variable_speed_compressor_chart_dto
214214
)
215215
# Prepare stages using centralized builder method (correct data flow)
216-
SimplifiedTrainBuilder.prepare_model_stages_from_data(
216+
SimplifiedTrainBuilder.prepare_compressor_stages_from_data(
217217
compressor_model=compressor_train_energy_function,
218218
rate=np.linspace(start=1000, stop=10000, num=10),
219219
suction_pressure=np.linspace(start=10, stop=20, num=10),
@@ -400,7 +400,7 @@ def test_compressor_train_simplified_known_stages_generic_chart(
400400

401401
# Make the undefined compressor chart, using rate and pressure input
402402
# Prepare stages using centralized builder method (correct data flow)
403-
SimplifiedTrainBuilder.prepare_model_stages_from_data(
403+
SimplifiedTrainBuilder.prepare_compressor_stages_from_data(
404404
compressor_model=simple_compressor_train_model_extra_generic_stage_from_data,
405405
rate=rates,
406406
suction_pressure=suction_pressures,
@@ -476,7 +476,7 @@ def test_compressor_train_simplified_unknown_stages(
476476
)
477477

478478
# Prepare stages using centralized builder method (correct data flow)
479-
SimplifiedTrainBuilder.prepare_model_stages_from_data(
479+
SimplifiedTrainBuilder.prepare_compressor_stages_from_data(
480480
compressor_model=simple_compressor_train_model,
481481
rate=rates,
482482
suction_pressure=suction_pressures,
@@ -858,7 +858,7 @@ def test_calculate_compressor_work(fluid_factory_medium, simplified_compressor_t
858858
stages=stages, fluid_model=fluid_factory2.fluid_model
859859
)
860860
# Prepare stages using centralized builder method (correct data flow)
861-
SimplifiedTrainBuilder.prepare_model_stages_from_data(
861+
SimplifiedTrainBuilder.prepare_compressor_stages_from_data(
862862
compressor_model=compressor_train,
863863
rate=fluid_factory2.mass_rate_to_standard_rate(mass_rates),
864864
suction_pressure=inlet_pressures,

0 commit comments

Comments
 (0)