diff --git a/pandapipes/properties/biomethane_pure/lower_heating_value.txt b/pandapipes/properties/biomethane_pure/lower_heating_value.txt deleted file mode 100644 index e7b41c8d4..000000000 --- a/pandapipes/properties/biomethane_pure/lower_heating_value.txt +++ /dev/null @@ -1 +0,0 @@ -# lower heating value in kWh/kg (at normal conditions) diff --git a/pandapipes/properties/biomethane_treated/compressibility.txt b/pandapipes/properties/biomethane_treated/compressibility.txt index 7ebaa69ce..dbb50a0a5 100644 --- a/pandapipes/properties/biomethane_treated/compressibility.txt +++ b/pandapipes/properties/biomethane_treated/compressibility.txt @@ -1,3 +1,3 @@ # source: linear approximation based on CoolProp (http://www.coolprop.org/) # slope in 1/bar, offset for linear property --0.0024789428559189412, 0.9962776221466679 \ No newline at end of file +-0.0024789428559189412 0.9962776221466679 \ No newline at end of file diff --git a/pandapipes/properties/biomethane_treated/heat_capacity.txt b/pandapipes/properties/biomethane_treated/heat_capacity.txt index f9f78e48d..ec06044fc 100644 --- a/pandapipes/properties/biomethane_treated/heat_capacity.txt +++ b/pandapipes/properties/biomethane_treated/heat_capacity.txt @@ -1,6 +1,6 @@ #source CoolProp (http://www.coolprop.org/) # temperature in Kelvin, isobaric heat capacity in J/(kg K) -263.151976.8823234072695 +263.15 1976.8823234072695 265.15 1980.6134982832095 267.15 1984.416050463013 269.15 1988.2894370033634 diff --git a/pandapipes/properties/biomethane_treated/lower_heating_value.txt b/pandapipes/properties/biomethane_treated/lower_heating_value.txt deleted file mode 100644 index e7b41c8d4..000000000 --- a/pandapipes/properties/biomethane_treated/lower_heating_value.txt +++ /dev/null @@ -1 +0,0 @@ -# lower heating value in kWh/kg (at normal conditions) diff --git a/pandapipes/properties/fluids.py b/pandapipes/properties/fluids.py index fd9a275aa..5d35b0f36 100644 --- a/pandapipes/properties/fluids.py +++ b/pandapipes/properties/fluids.py @@ -680,24 +680,22 @@ def linear_property(prop): phase = "liquid" if fluid_name in _LIQUIDS else "gas" - density = interextra_property("density") - viscosity = interextra_property("viscosity") - heat_capacity = interextra_property("heat_capacity") - molar_mass = constant_property("molar_mass") - der_compr = constant_property("der_compressibility") - compr = linear_property("compressibility") - - if (phase == 'gas') & (fluid_name != 'air'): - lhv = constant_property("lower_heating_value") - hhv = constant_property("higher_heating_value") - - return Fluid(fluid_name, phase, density=density, viscosity=viscosity, - heat_capacity=heat_capacity, molar_mass=molar_mass, - compressibility=compr, der_compressibility=der_compr, lhv=lhv, hhv=hhv) - else: - return Fluid(fluid_name, phase, density=density, viscosity=viscosity, - heat_capacity=heat_capacity, molar_mass=molar_mass, compressibility=compr, - der_compressibility=der_compr) + properties = dict() + properties["density"] = interextra_property("density") + properties["viscosity"] = interextra_property("viscosity") + properties["heat_capacity"] = interextra_property("heat_capacity") + properties["molar_mass"] = constant_property("molar_mass") + properties["der_compressibility"] = constant_property("der_compressibility") + properties["compressibility"] = linear_property("compressibility") + + if phase == 'gas': + for entry, name in [("lhv", "lower_heating_value"), ("hhv", "higher_heating_value")]: + try: + properties[entry] = constant_property(name) + except FileNotFoundError: + pass + + return Fluid(fluid_name, phase, **properties) def get_fluid(net):