Skip to content

Commit

Permalink
Fix the electrolyzer example and remove an unused part in fluid vecto…
Browse files Browse the repository at this point in the history
…r presolving (for now)
  • Loading branch information
fwitte committed Feb 12, 2025
1 parent cf1d935 commit 568a107
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/tespy/components/reactors/water_electrolyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,10 @@ class WaterElectrolyzer(Component):
>>> round(el.eta.val, 1)
0.8
>>> el_cmp.set_attr(v=None)
>>> el.set_attr(P=P_design * 0.66)
>>> el.set_attr(P=P_design * 1e6 * 0.2)
>>> nw.solve('offdesign', design_path='tmp')
>>> round(el.eta.val, 2)
0.88
0.84
>>> shutil.rmtree('./tmp', ignore_errors=True)
"""

Expand Down
8 changes: 5 additions & 3 deletions src/tespy/networks/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -1109,9 +1109,11 @@ def presolve_fluid_topology(self):
main_conn.fluid.val.update(fixed_fractions)
main_conn.fluid.is_set = {f for f in fixed_fractions}
main_conn.fluid.is_var = variable
num_var = len(variable)
for f in variable:
main_conn.fluid.val[f] = (1 - mass_fraction_sum) / num_var
# this seems to be a problem in some cases, e.g. the basic
# gas turbine tutorial
# num_var = len(variable)
# for f in variable:
# main_conn.fluid.val[f] = (1 - mass_fraction_sum) / num_var

[c.build_fluid_data() for c in all_connections]
for fluid in main_conn.fluid.is_var:
Expand Down

0 comments on commit 568a107

Please sign in to comment.