|
24 | 24 | from libecalc.domain.process.entities.process_units.temperature_setter import TemperatureSetter |
25 | 25 | from libecalc.domain.process.entities.shaft import Shaft, VariableSpeedShaft |
26 | 26 | from libecalc.domain.process.process_solver.boundary import Boundary |
27 | | -from libecalc.domain.process.process_system.compressor_stage_process_unit import CompressorStageProcessUnit |
28 | 27 | from libecalc.domain.process.process_system.process_error import OutsideCapacityError, RateTooHighError, RateTooLowError |
29 | 28 | from libecalc.domain.process.process_system.process_system import ProcessSystem, create_process_system_id, \ |
30 | 29 | ProcessSystemId |
|
35 | 34 | from libecalc.domain.process.value_objects.fluid_stream import FluidStream, FluidModel, EoSModel |
36 | 35 | from libecalc.presentation.yaml.mappers.charts.user_defined_chart_data import UserDefinedChartData |
37 | 36 |
|
38 | | - |
39 | | -# Temporarily adding dummy/temp stage process unit here until we have one ready |
40 | | -class MyStageProcessUnit(CompressorStageProcessUnit): |
41 | | - def __init__(self, compressor_stage: CompressorTrainStage): |
42 | | - self._id = create_process_unit_id() |
43 | | - self._compressor_stage = compressor_stage |
44 | | - |
45 | | - def get_id(self) -> ProcessUnitId: |
46 | | - return self._id |
47 | | - |
48 | | - def get_compressor_stage(self) -> CompressorTrainStage: |
49 | | - return self._compressor_stage |
50 | | - |
51 | | - def get_speed_boundary(self) -> Boundary: |
52 | | - chart = self._compressor_stage.compressor.compressor_chart |
53 | | - return Boundary(min=chart.minimum_speed, max=chart.maximum_speed) |
54 | | - |
55 | | - def get_maximum_standard_rate(self, inlet_stream: FluidStream) -> float: |
56 | | - compressor_inlet_stream = self._compressor_stage.get_compressor_inlet_stream(inlet_stream_stage=inlet_stream) |
57 | | - density = compressor_inlet_stream.density |
58 | | - max_actual_rate = self._compressor_stage.compressor.compressor_chart.maximum_rate_as_function_of_speed( |
59 | | - self._compressor_stage.compressor.speed |
60 | | - ) |
61 | | - max_mass_rate = max_actual_rate * density |
62 | | - return self._compressor_stage.fluid_service.mass_rate_to_standard_rate( |
63 | | - fluid_model=compressor_inlet_stream.fluid_model, mass_rate_kg_per_h=max_mass_rate |
64 | | - ) |
65 | | - |
66 | | - def get_minimum_standard_rate(self, inlet_stream: FluidStream) -> float: |
67 | | - compressor_inlet_stream = self._compressor_stage.get_compressor_inlet_stream(inlet_stream_stage=inlet_stream) |
68 | | - density = compressor_inlet_stream.density |
69 | | - min_actual_rate = self._compressor_stage.compressor.compressor_chart.minimum_rate_as_function_of_speed( |
70 | | - self._compressor_stage.compressor.speed |
71 | | - ) |
72 | | - min_mass_rate = min_actual_rate * density |
73 | | - return self._compressor_stage.fluid_service.mass_rate_to_standard_rate( |
74 | | - fluid_model=compressor_inlet_stream.fluid_model, mass_rate_kg_per_h=min_mass_rate |
75 | | - ) |
76 | | - |
77 | | - def propagate_stream(self, inlet_stream: FluidStream) -> FluidStream: |
78 | | - result = self._compressor_stage.evaluate(inlet_stream_stage=inlet_stream) |
79 | | - if result.chart_area_flag == ChartAreaFlag.ABOVE_MAXIMUM_FLOW_RATE: |
80 | | - raise RateTooHighError() |
81 | | - if result.chart_area_flag == ChartAreaFlag.BELOW_MINIMUM_FLOW_RATE: |
82 | | - raise RateTooLowError() |
83 | | - |
84 | | - if not result.within_capacity: |
85 | | - raise OutsideCapacityError() |
86 | | - return result.outlet_stream |
87 | | - |
88 | 37 | dummy_process_pipeline_id = uuid.uuid4() |
89 | 38 |
|
90 | 39 | def process_simulation_dummy() -> ProcessSimulation: |
|
0 commit comments