1818 maximize_x_given_boolean_condition_function ,
1919)
2020from libecalc .domain .process .core .results .compressor import TargetPressureStatus
21- from libecalc .domain .process .entities .shaft import Shaft , VariableSpeedShaft
21+ from libecalc .domain .process .entities .shaft import Shaft
2222from libecalc .domain .process .value_objects .fluid_stream import FluidService , FluidStream
2323from libecalc .domain .process .value_objects .fluid_stream .fluid_model import FluidModel
2424
@@ -436,8 +436,6 @@ def _calculate_train_result(std_rate_for_stream: float) -> CompressorTrainResult
436436 def calculate_compressor_train (
437437 self ,
438438 constraints : CompressorTrainEvaluationInput ,
439- asv_rate_fraction : float = 0.0 ,
440- asv_additional_mass_rate : float = 0.0 ,
441439 ) -> CompressorTrainResultSingleTimeStep :
442440 """
443441 Simulate the compressor train for the given inlet conditions, stream rates, and shaft speed.
@@ -454,8 +452,6 @@ def calculate_compressor_train(
454452
455453 Args:
456454 constraints (CompressorTrainEvaluationInput): Pressures, stream rates, and speed for the simulation.
457- asv_rate_fraction (float, optional): Fraction of anti-surge valve recirculation. Defaults to 0.0.
458- asv_additional_mass_rate (float, optional): Additional mass rate for recirculation. Defaults to 0.0.
459455
460456 Returns:
461457 CompressorTrainResultSingleTimeStep: Object containing inlet/outlet streams, per-stage results, speed,
@@ -509,8 +505,6 @@ def calculate_compressor_train(
509505 rates_out_of_splitter = rates_out_of_splitter ,
510506 streams_in_to_mixer = streams_in_to_mixer ,
511507 speed = self .shaft .get_speed (),
512- asv_rate_fraction = asv_rate_fraction ,
513- asv_additional_mass_rate = asv_additional_mass_rate ,
514508 )
515509 )
516510
@@ -595,7 +589,8 @@ def find_and_calculate_for_compressor_train_with_two_pressure_requirements(
595589 lower_bound_for_speed = self .minimum_speed , # Only search for a solution within the bounds of the
596590 upper_bound_for_speed = self .maximum_speed , # original, complete compressor train
597591 )
598- if math .isclose (compressor_train_first_part .shaft .get_speed (), self .minimum_speed , rel_tol = EPSILON ):
592+ first_speed = compressor_train_first_part .shaft .get_speed ()
593+ if math .isclose (first_speed , self .minimum_speed , rel_tol = EPSILON ):
599594 compressor_train_results_first_part_with_optimal_speed_result = (
600595 compressor_train_first_part .evaluate_with_pressure_control_given_constraints (
601596 constraints = constraints_first_part ,
@@ -628,8 +623,8 @@ def find_and_calculate_for_compressor_train_with_two_pressure_requirements(
628623 lower_bound_for_speed = self .minimum_speed ,
629624 upper_bound_for_speed = self .maximum_speed ,
630625 )
631-
632- if math .isclose (compressor_train_last_part . shaft . get_speed () , self .minimum_speed , rel_tol = EPSILON ):
626+ last_speed = compressor_train_last_part . shaft . get_speed ()
627+ if math .isclose (last_speed , self .minimum_speed , rel_tol = EPSILON ):
633628 compressor_train_results_last_part_with_optimal_speed_result = (
634629 compressor_train_last_part .evaluate_with_pressure_control_given_constraints (
635630 constraints = constraints_last_part ,
@@ -647,8 +642,8 @@ def find_and_calculate_for_compressor_train_with_two_pressure_requirements(
647642 Then run the last part as a single speed train with the speed chosen
648643 Fixme: Need to deliver the result in a proper format below.
649644 """
650- if compressor_train_first_part . shaft . get_speed () > compressor_train_last_part . shaft . get_speed () :
651- compressor_train_last_part .shaft .set_speed (compressor_train_first_part . shaft . get_speed () )
645+ if first_speed > last_speed :
646+ compressor_train_last_part .shaft .set_speed (first_speed )
652647 compressor_train_results_last_part_with_pressure_control = (
653648 compressor_train_last_part .evaluate_with_pressure_control_given_constraints (
654649 constraints = constraints_last_part ,
@@ -660,7 +655,6 @@ def find_and_calculate_for_compressor_train_with_two_pressure_requirements(
660655 compressor_train_results_to_return_last_part = compressor_train_results_last_part_with_pressure_control
661656
662657 else :
663- compressor_train_first_part .shaft .set_speed (compressor_train_last_part .shaft .get_speed ())
664658 compressor_train_results_first_part_with_pressure_control = (
665659 compressor_train_first_part .evaluate_with_pressure_control_given_constraints (
666660 constraints = constraints_first_part ,
@@ -775,7 +769,7 @@ def split_train_on_stage_number(
775769
776770 compressor_train_first_part = CompressorTrainCommonShaftMultipleStreamsAndPressures (
777771 streams = streams_first_part ,
778- shaft = VariableSpeedShaft () ,
772+ shaft = compressor_train . shaft ,
779773 energy_usage_adjustment_constant = compressor_train .energy_usage_adjustment_constant ,
780774 energy_usage_adjustment_factor = compressor_train .energy_usage_adjustment_factor ,
781775 stages = compressor_train .stages [:stage_number ],
@@ -823,7 +817,7 @@ def split_train_on_stage_number(
823817 energy_usage_adjustment_factor = compressor_train .energy_usage_adjustment_factor ,
824818 stages = compressor_train .stages [stage_number :],
825819 fluid_service = compressor_train ._fluid_service ,
826- shaft = VariableSpeedShaft () ,
820+ shaft = compressor_train . shaft ,
827821 calculate_max_rate = compressor_train .calculate_max_rate
828822 if compressor_train .calculate_max_rate is not None
829823 else False ,
0 commit comments