From 49765f03ca419029301a888c61bb1038182470b4 Mon Sep 17 00:00:00 2001 From: Francesco Witte Date: Tue, 16 Jan 2024 16:28:02 +0100 Subject: [PATCH 1/2] Apply condensation check only for water component --- src/tespy/tools/fluid_properties/mixtures.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tespy/tools/fluid_properties/mixtures.py b/src/tespy/tools/fluid_properties/mixtures.py index b156a133f..645537783 100644 --- a/src/tespy/tools/fluid_properties/mixtures.py +++ b/src/tespy/tools/fluid_properties/mixtures.py @@ -253,7 +253,7 @@ def exergy_chemical_ideal_cond(pamb, Tamb, fluid_data, Chem_Ex): fluid_aliases = fluid_data[fluid]["wrapper"]._aliases - if molar_liquid > 0: + if molar_liquid > 0 and "water" in fluid_aliases: y = [ Chem_Ex[k][2] for k in fluid_aliases if k in Chem_Ex ] From 0c6ed01b9204d1acf75cf0bbea54c7e0c21a893a Mon Sep 17 00:00:00 2001 From: Francesco Witte Date: Tue, 16 Jan 2024 16:28:44 +0100 Subject: [PATCH 2/2] Adhere to latest fluprodia API --- tutorial/heat_pump_exergy/NH3_calculations.py | 13 ++++++++----- tutorial/heat_pump_exergy/R410A_calculations.py | 13 ++++++++----- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/tutorial/heat_pump_exergy/NH3_calculations.py b/tutorial/heat_pump_exergy/NH3_calculations.py index a602ae0dc..af56e171f 100644 --- a/tutorial/heat_pump_exergy/NH3_calculations.py +++ b/tutorial/heat_pump_exergy/NH3_calculations.py @@ -19,6 +19,7 @@ import plotly.graph_objects as go from fluprodia import FluidPropertyDiagram import pandas as pd +import matplotlib.pyplot as plt # %% network pamb = 1.013 # ambient pressure @@ -166,16 +167,18 @@ for key, data in result_dict.items(): result_dict[key]['datapoints'] = diagram.calc_individual_isoline(**data) -diagram.set_limits(x_min=0, x_max=2100, y_min=1e0, y_max=2e2) diagram.calc_isolines() -diagram.draw_isolines('logph') + +fig, ax = plt.subplots(1, figsize=(16, 10)) +diagram.draw_isolines(fig, ax, 'logph', x_min=0, x_max=2100, y_min=1e0, y_max=2e2) for key in result_dict.keys(): datapoints = result_dict[key]['datapoints'] - diagram.ax.plot(datapoints['h'], datapoints['p'], color='#ff0000') - diagram.ax.scatter(datapoints['h'][0], datapoints['p'][0], color='#ff0000') + ax.plot(datapoints['h'], datapoints['p'], color='#ff0000') + ax.scatter(datapoints['h'][0], datapoints['p'][0], color='#ff0000') -diagram.save('NH3_logph.svg') +plt.tight_layout() +fig.savefig('NH3_logph.svg') # %% exergy analysis diff --git a/tutorial/heat_pump_exergy/R410A_calculations.py b/tutorial/heat_pump_exergy/R410A_calculations.py index 457a10472..5cb3e6a01 100644 --- a/tutorial/heat_pump_exergy/R410A_calculations.py +++ b/tutorial/heat_pump_exergy/R410A_calculations.py @@ -19,6 +19,7 @@ import plotly.graph_objects as go from fluprodia import FluidPropertyDiagram import pandas as pd +import matplotlib.pyplot as plt # %% network pamb = 1.013 # ambient pressure @@ -165,16 +166,18 @@ for key, data in result_dict.items(): result_dict[key]['datapoints'] = diagram.calc_individual_isoline(**data) -diagram.set_limits(x_min=200, x_max=500, y_min=0.8e1, y_max=0.8e2) diagram.calc_isolines() -diagram.draw_isolines('logph') + +fig, ax = plt.subplots(1, figsize=(16, 10)) +diagram.draw_isolines(fig, ax, 'logph', x_min=200, x_max=500, y_min=0.8e1, y_max=0.8e2) for key in result_dict.keys(): datapoints = result_dict[key]['datapoints'] - diagram.ax.plot(datapoints['h'], datapoints['p'], color='#ff0000') - diagram.ax.scatter(datapoints['h'][0], datapoints['p'][0], color='#ff0000') + ax.plot(datapoints['h'], datapoints['p'], color='#ff0000') + ax.scatter(datapoints['h'][0], datapoints['p'][0], color='#ff0000') -diagram.save('R410A_logph.svg') +plt.tight_layout() +fig.savefig('R410A_logph.svg') # %% exergy analysis