Skip to content

Commit

Permalink
fix: make sure that suction pressure is less than or equal to dischar…
Browse files Browse the repository at this point in the history
…ge pressure for compressor train
  • Loading branch information
olelod committed Jun 29, 2023
1 parent 329c8e9 commit 156cf19
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,19 @@ def _validate_operational_conditions(
discharge_pressure = np.where(
np.logical_and(np.min(rate, axis=0) <= 0, discharge_pressure <= 0), 1, discharge_pressure
)

if not np.all(discharge_pressure >= suction_pressure):
logger.warning(
f"Inlet pressure needs to be a less than or equal to outlet pressure. Given values for inlet"
f" pressure: {suction_pressure.tolist()}. Given values for outlet pressure:"
f" {discharge_pressure.tolist()}. The affected time steps will not be calculated,"
f" and rate is set to zero."
)
rate = np.where(discharge_pressure < suction_pressure, 0, rate)
suction_pressure = np.where(
np.logical_and(np.min(rate, axis=0) <= 0, suction_pressure > discharge_pressure),
discharge_pressure,
suction_pressure,
)
# for multiple stream train, rate is 2D
if np.ndim(rate) == 2:
# check if any of the streams have changed value during validation, streams along axis 0, time along axis 1
Expand Down

0 comments on commit 156cf19

Please sign in to comment.