Skip to content

Commit

Permalink
corrections in fluid library to make call_lib pass again
Browse files Browse the repository at this point in the history
- adapted wrong files for new biomethane properties
- added lhv and hhv with exception in case file was not found, as these properties are not absolutely necessary
  • Loading branch information
dlohmeier committed Nov 3, 2023
1 parent c0ac8a5 commit bab5c14
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 22 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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
-0.0024789428559189412 0.9962776221466679
2 changes: 1 addition & 1 deletion pandapipes/properties/biomethane_treated/heat_capacity.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down

This file was deleted.

34 changes: 16 additions & 18 deletions pandapipes/properties/fluids.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit bab5c14

Please sign in to comment.