|
12 | 12 | from libecalc.domain.infrastructure.energy_components.legacy_consumer.tabulated import TabularEnergyFunction |
13 | 13 | from libecalc.domain.process.compressor.dto import CompressorSampled as CompressorTrainSampledDTO |
14 | 14 | from libecalc.domain.process.dto import EnergyModel |
15 | | -from libecalc.domain.process.pump.pump import PumpModelDTO |
| 15 | +from libecalc.domain.process.pump.pump import PumpSingleSpeed, PumpVariableSpeed |
| 16 | +from libecalc.domain.process.value_objects.chart import SingleSpeedChart, VariableSpeedChart |
16 | 17 | from libecalc.domain.resource import Resource, Resources |
17 | 18 | from libecalc.presentation.yaml.file_context import FileContext, FileMark |
18 | 19 | from libecalc.presentation.yaml.mappers.energy_model_factory import EnergyModelFactory |
@@ -116,64 +117,62 @@ def _create_compressor_train_sampled_dto_model_data( |
116 | 117 |
|
117 | 118 | def _create_pump_model_single_speed_dto_model_data( |
118 | 119 | resource: Resource, facility_data: YamlPumpChartSingleSpeed, **kwargs |
119 | | -) -> PumpModelDTO: |
| 120 | +) -> PumpSingleSpeed: |
120 | 121 | chart_data = get_single_speed_chart_data(resource=resource) |
121 | | - |
122 | | - chart = SingleSpeedChartDTO( |
123 | | - speed_rpm=chart_data.speed, |
124 | | - efficiency_fraction=convert_efficiency_to_fraction( |
125 | | - efficiency_values=chart_data.efficiency, |
126 | | - input_unit=YAML_UNIT_MAPPING[facility_data.units.efficiency], |
127 | | - ), |
128 | | - rate_actual_m3_hour=convert_rate_to_am3_per_hour( |
129 | | - rate_values=chart_data.rate, input_unit=YAML_UNIT_MAPPING[facility_data.units.rate] |
130 | | - ), |
131 | | - polytropic_head_joule_per_kg=convert_head_to_joule_per_kg( |
132 | | - head_values=chart_data.head, input_unit=YAML_UNIT_MAPPING[facility_data.units.head] |
133 | | - ), |
134 | | - ) |
135 | | - |
136 | | - head_margin = facility_data.head_margin |
137 | | - |
138 | | - return PumpModelDTO( |
139 | | - chart=chart, |
140 | | - energy_usage_adjustment_constant=_get_adjustment_constant(facility_data), |
141 | | - energy_usage_adjustment_factor=_get_adjustment_factor(facility_data), |
142 | | - head_margin=head_margin, |
143 | | - ) |
144 | | - |
145 | | - |
146 | | -def _create_pump_chart_variable_speed_dto_model_data( |
147 | | - resource: Resource, facility_data: YamlPumpChartVariableSpeed, **kwargs |
148 | | -) -> PumpModelDTO: |
149 | | - curves_data = chart_curves_as_resource_to_dto_format(resource=resource) |
150 | | - |
151 | | - curves: list[ChartCurveDTO] = [ |
152 | | - ChartCurveDTO( |
153 | | - speed_rpm=curve.speed, |
| 122 | + pump_chart = SingleSpeedChart( |
| 123 | + SingleSpeedChartDTO( |
| 124 | + speed_rpm=chart_data.speed, |
154 | 125 | rate_actual_m3_hour=convert_rate_to_am3_per_hour( |
155 | | - rate_values=curve.rate, |
156 | | - input_unit=YAML_UNIT_MAPPING[facility_data.units.rate], |
| 126 | + rate_values=chart_data.rate, input_unit=YAML_UNIT_MAPPING[facility_data.units.rate] |
157 | 127 | ), |
158 | 128 | polytropic_head_joule_per_kg=convert_head_to_joule_per_kg( |
159 | | - head_values=curve.head, |
160 | | - input_unit=YAML_UNIT_MAPPING[facility_data.units.head], |
| 129 | + head_values=chart_data.head, input_unit=YAML_UNIT_MAPPING[facility_data.units.head] |
161 | 130 | ), |
162 | 131 | efficiency_fraction=convert_efficiency_to_fraction( |
163 | | - efficiency_values=curve.efficiency, |
| 132 | + efficiency_values=chart_data.efficiency, |
164 | 133 | input_unit=YAML_UNIT_MAPPING[facility_data.units.efficiency], |
165 | 134 | ), |
166 | 135 | ) |
167 | | - for curve in curves_data |
168 | | - ] |
| 136 | + ) |
| 137 | + return PumpSingleSpeed( |
| 138 | + pump_chart=pump_chart, |
| 139 | + energy_usage_adjustment_constant=_get_adjustment_constant(facility_data), |
| 140 | + energy_usage_adjustment_factor=_get_adjustment_factor(facility_data), |
| 141 | + head_margin=facility_data.head_margin, |
| 142 | + ) |
169 | 143 |
|
170 | | - head_margin = facility_data.head_margin |
171 | 144 |
|
172 | | - return PumpModelDTO( |
173 | | - chart=VariableSpeedChartDTO(curves=curves), |
| 145 | +def _create_pump_chart_variable_speed_dto_model_data( |
| 146 | + resource: Resource, facility_data: YamlPumpChartVariableSpeed, **kwargs |
| 147 | +) -> PumpVariableSpeed: |
| 148 | + curves_data = chart_curves_as_resource_to_dto_format(resource=resource) |
| 149 | + pump_chart = VariableSpeedChart( |
| 150 | + VariableSpeedChartDTO( |
| 151 | + curves=[ |
| 152 | + ChartCurveDTO( |
| 153 | + speed_rpm=curve.speed, |
| 154 | + rate_actual_m3_hour=convert_rate_to_am3_per_hour( |
| 155 | + rate_values=curve.rate, |
| 156 | + input_unit=YAML_UNIT_MAPPING[facility_data.units.rate], |
| 157 | + ), |
| 158 | + polytropic_head_joule_per_kg=convert_head_to_joule_per_kg( |
| 159 | + head_values=curve.head, |
| 160 | + input_unit=YAML_UNIT_MAPPING[facility_data.units.head], |
| 161 | + ), |
| 162 | + efficiency_fraction=convert_efficiency_to_fraction( |
| 163 | + efficiency_values=curve.efficiency, |
| 164 | + input_unit=YAML_UNIT_MAPPING[facility_data.units.efficiency], |
| 165 | + ), |
| 166 | + ) |
| 167 | + for curve in curves_data |
| 168 | + ] |
| 169 | + ) |
| 170 | + ) |
| 171 | + return PumpVariableSpeed( |
| 172 | + pump_chart=pump_chart, |
174 | 173 | energy_usage_adjustment_constant=_get_adjustment_constant(facility_data), |
175 | 174 | energy_usage_adjustment_factor=_get_adjustment_factor(facility_data), |
176 | | - head_margin=head_margin, |
| 175 | + head_margin=facility_data.head_margin, |
177 | 176 | ) |
178 | 177 |
|
179 | 178 |
|
|
0 commit comments