1616from libecalc .domain .process .compressor .core .train .single_speed_compressor_train_common_shaft import (
1717 SingleSpeedCompressorTrainCommonShaft ,
1818)
19+ from libecalc .domain .process .compressor .core .utils import map_compressor_train_stage_to_domain
1920from libecalc .domain .process .value_objects .chart .generic import GenericChartFromDesignPoint , GenericChartFromInput
2021from libecalc .domain .process .value_objects .fluid_stream .fluid_model import EoSModel , FluidComposition , FluidModel
2122from libecalc .infrastructure .neqsim_fluid_provider .neqsim_fluid_factory import NeqSimFluidFactory
@@ -240,22 +241,24 @@ def test_valid_train_known_stages(self):
240241 fluid_factory = NeqSimFluidFactory (
241242 fluid_model = FluidModel (eos_model = EoSModel .PR , composition = FluidComposition (methane = 1 ))
242243 )
244+ stages = [
245+ dto .CompressorStage (
246+ compressor_chart = SingleSpeedChartDTO (
247+ speed_rpm = 1 ,
248+ rate_actual_m3_hour = [1 , 2 ],
249+ polytropic_head_joule_per_kg = [3 , 4 ],
250+ efficiency_fraction = [0.5 , 0.5 ],
251+ ),
252+ inlet_temperature_kelvin = 300 ,
253+ pressure_drop_before_stage = 0 ,
254+ remove_liquid_after_cooling = True ,
255+ control_margin = 0.0 ,
256+ )
257+ ]
258+ stages_mapped = [map_compressor_train_stage_to_domain (stage_dto ) for stage_dto in stages ]
243259 SingleSpeedCompressorTrainCommonShaft (
244260 fluid_factory = fluid_factory ,
245- stages = [
246- dto .CompressorStage (
247- compressor_chart = SingleSpeedChartDTO (
248- speed_rpm = 1 ,
249- rate_actual_m3_hour = [1 , 2 ],
250- polytropic_head_joule_per_kg = [3 , 4 ],
251- efficiency_fraction = [0.5 , 0.5 ],
252- ),
253- inlet_temperature_kelvin = 300 ,
254- pressure_drop_before_stage = 0 ,
255- remove_liquid_after_cooling = True ,
256- control_margin = 0.0 ,
257- )
258- ],
261+ stages = stages_mapped ,
259262 energy_usage_adjustment_factor = 1 ,
260263 energy_usage_adjustment_constant = 0 ,
261264 pressure_control = libecalc .common .fixed_speed_pressure_control .FixedSpeedPressureControl .DOWNSTREAM_CHOKE ,
@@ -266,18 +269,20 @@ def test_invalid_chart(self):
266269 fluid_factory = NeqSimFluidFactory (
267270 fluid_model = FluidModel (eos_model = EoSModel .PR , composition = FluidComposition (methane = 1 ))
268271 )
272+ stages = [
273+ dto .CompressorStage (
274+ compressor_chart = VariableSpeedChartDTO (curves = []),
275+ inlet_temperature_kelvin = 300 ,
276+ pressure_drop_before_stage = 0 ,
277+ remove_liquid_after_cooling = True ,
278+ control_margin = 0.0 ,
279+ )
280+ ]
281+ stages_mapped = [map_compressor_train_stage_to_domain (stage_dto ) for stage_dto in stages ]
269282 with pytest .raises (ProcessChartTypeValidationException ):
270283 SingleSpeedCompressorTrainCommonShaft (
271284 fluid_factory = fluid_factory ,
272- stages = [
273- dto .CompressorStage (
274- compressor_chart = VariableSpeedChartDTO (curves = []),
275- inlet_temperature_kelvin = 300 ,
276- pressure_drop_before_stage = 0 ,
277- remove_liquid_after_cooling = True ,
278- control_margin = 0.0 ,
279- )
280- ],
285+ stages = stages_mapped ,
281286 energy_usage_adjustment_factor = 1 ,
282287 energy_usage_adjustment_constant = 0 ,
283288 pressure_control = libecalc .common .fixed_speed_pressure_control .FixedSpeedPressureControl .DOWNSTREAM_CHOKE ,
0 commit comments