Skip to content

Commit

Permalink
chore: add maximum_rate to CompressorModelResult (#285)
Browse files Browse the repository at this point in the history
test: update tests with maximum rate

chore: update snapshot
  • Loading branch information
olelod authored Dec 20, 2023
1 parent 28885f2 commit 2cb09e2
Show file tree
Hide file tree
Showing 7 changed files with 45,602 additions and 24 deletions.
21 changes: 21 additions & 0 deletions src/libecalc/core/graph_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -757,6 +757,17 @@ def get_asset_result(self) -> libecalc.dto.result.EcalcModelResult:
rate_type=RateType.STREAM_DAY,
regularity=regularity.for_timesteps(model.timesteps).values,
)
maximum_rate = TimeSeriesRate(
timesteps=model.timesteps,
values=model.max_standard_rate[
0
] # WORKAROUND: We only pick max rate for first stream for now
if model.max_standard_rate is not None
else [math.nan] * len(model.timesteps),
unit=Unit.STANDARD_CUBIC_METER_PER_DAY,
rate_type=RateType.STREAM_DAY,
regularity=regularity.for_timesteps(model.timesteps).values,
)
else:
rate = TimeSeriesRate(
timesteps=model.timesteps,
Expand All @@ -765,6 +776,15 @@ def get_asset_result(self) -> libecalc.dto.result.EcalcModelResult:
rate_type=RateType.STREAM_DAY,
regularity=regularity.for_timesteps(model.timesteps).values,
)
maximum_rate = TimeSeriesRate(
timesteps=model.timesteps,
values=model.max_standard_rate
if model.max_standard_rate is not None
else [math.nan] * len(model.timesteps),
unit=Unit.STANDARD_CUBIC_METER_PER_DAY,
rate_type=RateType.STREAM_DAY,
regularity=regularity.for_timesteps(model.timesteps).values,
)

models.extend(
[
Expand All @@ -780,6 +800,7 @@ def get_asset_result(self) -> libecalc.dto.result.EcalcModelResult:
requested_inlet_pressure=requested_inlet_pressure,
requested_outlet_pressure=requested_outlet_pressure,
rate=rate,
maximum_rate=maximum_rate,
stage_results=model_stage_results,
failure_status=model.failure_status,
timesteps=model.timesteps,
Expand Down
1 change: 1 addition & 0 deletions src/libecalc/dto/result/results.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ class CompressorModelResult(ConsumerModelResultBase):
requested_inlet_pressure: TimeSeriesFloat
requested_outlet_pressure: TimeSeriesFloat
rate: TimeSeriesRate
maximum_rate: TimeSeriesRate
stage_results: List[CompressorModelStageResult]
turbine_result: Optional[TurbineModelResult] = None
energy_usage_unit: Unit
Expand Down
1 change: 1 addition & 0 deletions src/libecalc/examples/advanced/model.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ MODELS:
- NAME: simplified_compressor_train_model
TYPE: SIMPLIFIED_VARIABLE_SPEED_COMPRESSOR_TRAIN
FLUID_MODEL: medium_fluid
CALCULATE_MAX_RATE: True
COMPRESSOR_TRAIN:
STAGES:
- INLET_TEMPERATURE: 30
Expand Down
Loading

0 comments on commit 2cb09e2

Please sign in to comment.