33from libecalc .common .fixed_speed_pressure_control import FixedSpeedPressureControl , InterstagePressureControl
44from libecalc .domain .process .compressor .core .train .compressor_train_common_shaft import CompressorTrainCommonShaft
55from libecalc .domain .process .compressor .core .train .train_evaluation_input import CompressorTrainEvaluationInput
6+ from libecalc .process .process_pipeline .process_pipeline import ProcessPipeline
67from libecalc .process .process_solver .float_constraint import FloatConstraint
78from libecalc .process .process_solver .multi_pressure_solver import MultiPressureSolver
89from libecalc .process .process_solver .pipeline_section import Pipeline
@@ -380,15 +381,15 @@ def test_target_not_achievable_event_identifies_failing_segment(
380381 lp_units , lp_loops = with_individual_asv (lp_units_raw )
381382 lp_loop_ids = [loop .get_id () for loop in lp_loops ]
382383 lp_runner = process_runner_factory (units = lp_units , configuration_handlers = [shaft , * lp_loops ])
383- lp_process_pipeline = process_pipeline_factory (units = lp_units )
384384
385385 hp_compressor = compressor_factory (chart_data = chart_data )
386386 hp_units_raw = stage_units_factory (compressor = hp_compressor , shaft = shaft , temperature_kelvin = temperature )
387387 hp_compressors = [hp_compressor ]
388388 hp_units , hp_loops = with_individual_asv (hp_units_raw )
389389 hp_loop_ids = [loop .get_id () for loop in hp_loops ]
390390 hp_runner = process_runner_factory (units = hp_units , configuration_handlers = [shaft , * hp_loops ])
391- hp_process_pipeline = process_pipeline_factory (units = hp_units )
391+
392+ process_pipeline_id = ProcessPipeline ._create_id ()
392393
393394 lp_segment = pipeline_section_factory (
394395 runner = lp_runner ,
@@ -399,7 +400,7 @@ def test_target_not_achievable_event_identifies_failing_segment(
399400 runner = lp_runner , recirculation_loop_ids = lp_loop_ids , compressors = lp_compressors
400401 ),
401402 shaft = shaft ,
402- process_pipeline_id = lp_process_pipeline . get_id () ,
403+ process_pipeline_id = process_pipeline_id ,
403404 )
404405 hp_segment = pipeline_section_factory (
405406 runner = hp_runner ,
@@ -410,10 +411,13 @@ def test_target_not_achievable_event_identifies_failing_segment(
410411 runner = hp_runner , recirculation_loop_ids = hp_loop_ids , compressors = hp_compressors
411412 ),
412413 shaft = shaft ,
413- process_pipeline_id = hp_process_pipeline . get_id () ,
414+ process_pipeline_id = process_pipeline_id ,
414415 )
415416
416- solver = MultiPressureSolver (Pipeline (process_pipeline_sections = [lp_segment , hp_segment ]))
417+ process_pipeline = Pipeline (
418+ process_pipeline_sections = [lp_segment , hp_segment ], process_pipeline_id = process_pipeline_id
419+ )
420+ solver = MultiPressureSolver (pipeline = process_pipeline )
417421
418422 inlet_stream = stream_factory (standard_rate_m3_per_day = 10_000 , pressure_bara = 30.0 , temperature_kelvin = temperature )
419423
@@ -425,7 +429,9 @@ def test_target_not_achievable_event_identifies_failing_segment(
425429
426430 assert not solution .success
427431 assert isinstance (solution .failure , TargetPressureUnreachableFailure )
428- assert solution .failure .source_id == hp_process_pipeline .get_id ()
432+ assert (
433+ solution .failure .source_id == process_pipeline .get_process_pipeline_sections ()[1 ].get_id ()
434+ ) # HP section fails
429435
430436
431437def test_target_not_achievable_event_when_first_segment_fails (
@@ -465,15 +471,14 @@ def test_target_not_achievable_event_when_first_segment_fails(
465471 lp_units , lp_loops = with_individual_asv (lp_units_raw )
466472 lp_loop_ids = [loop .get_id () for loop in lp_loops ]
467473 lp_runner = process_runner_factory (units = lp_units , configuration_handlers = [shaft , * lp_loops ])
468- lp_process_pipeline = process_pipeline_factory (units = lp_units )
469474
470475 hp_compressor = compressor_factory (chart_data = chart_data )
471476 hp_units_raw = stage_units_factory (compressor = hp_compressor , shaft = shaft , temperature_kelvin = temperature )
472477 hp_compressors = [hp_compressor ]
473478 hp_units , hp_loops = with_individual_asv (hp_units_raw )
474479 hp_loop_ids = [loop .get_id () for loop in hp_loops ]
475480 hp_runner = process_runner_factory (units = hp_units , configuration_handlers = [shaft , * hp_loops ])
476- hp_process_pipeline = process_pipeline_factory ( units = hp_units )
481+ process_pipeline_id = ProcessPipeline . _create_id ( )
477482
478483 lp_segment = pipeline_section_factory (
479484 runner = lp_runner ,
@@ -484,7 +489,7 @@ def test_target_not_achievable_event_when_first_segment_fails(
484489 runner = lp_runner , recirculation_loop_ids = lp_loop_ids , compressors = lp_compressors
485490 ),
486491 shaft = shaft ,
487- process_pipeline_id = lp_process_pipeline . get_id () ,
492+ process_pipeline_id = process_pipeline_id ,
488493 )
489494 hp_segment = pipeline_section_factory (
490495 runner = hp_runner ,
@@ -495,10 +500,14 @@ def test_target_not_achievable_event_when_first_segment_fails(
495500 runner = hp_runner , recirculation_loop_ids = hp_loop_ids , compressors = hp_compressors
496501 ),
497502 shaft = shaft ,
498- process_pipeline_id = hp_process_pipeline .get_id (),
503+ process_pipeline_id = process_pipeline_id ,
504+ )
505+
506+ process_pipeline = Pipeline (
507+ process_pipeline_sections = [lp_segment , hp_segment ], process_pipeline_id = process_pipeline_id
499508 )
500509
501- solver = MultiPressureSolver (pipeline = Pipeline ( process_pipeline_sections = [ lp_segment , hp_segment ]) )
510+ solver = MultiPressureSolver (pipeline = process_pipeline )
502511
503512 inlet_stream = stream_factory (standard_rate_m3_per_day = 10_000 , pressure_bara = 30.0 , temperature_kelvin = temperature )
504513
@@ -510,4 +519,6 @@ def test_target_not_achievable_event_when_first_segment_fails(
510519
511520 assert not solution .success
512521 assert isinstance (solution .failure , TargetPressureUnreachableFailure )
513- assert solution .failure .source_id == lp_process_pipeline .get_id ()
522+ assert (
523+ solution .failure .source_id == process_pipeline .get_process_pipeline_sections ()[0 ].get_id ()
524+ ) # LP section fails
0 commit comments