jfreissmann / heatpumps

Collection of TESPy heat pump models and additional Streamlit dashboard.
MIT License
17 stars 5 forks source link

Bump TESPy version #2

Closed jfreissmann closed 4 months ago

jfreissmann commented 6 months ago

Description of the task

All heat pump model classes are using TESPy version 0.6.3. Since their creation, there has been a large refactoring of the TESPy back end, which should result in faster and maybe more stable solutions, which is an obvious enhancement for the dashboard. These changes also concern its API, so the model classes should be adapted to it.

Necessary steps

The adaption should use the most recent TESPy version (as of now that is 0.7.2.post2). An overview of the changes since version 0.6.3 can be found in the What's new section of the online documentation. It mostly concerns how the fluids are set within the network. In addition to what is said in the change log, trying out the new version showed that using the .res attribute of the Network class has been renamed to .residual.

Additional information

Since the update, TESPy should be better equipped to handle setting temperature and pressure pairs instead of enthalpy and pressure. This could mean that there would not be a need for initial simulations anymore. This would be a structural enhancement and could save a lot of time, as every design simulation would only need one run. As far as I know, there could remain a need for starting value simulations for setting states with Ref, which is used to set superheating temperature after an internal heat exchanger.

jfreissmann commented 6 months ago

Update: There just was a release of version 0.7.3 of TESPy, but there don't seem to be any changes affecting the existing task.

bilwint commented 4 months ago

Hi,

I recently went through this issue. I changed the nw.res to nw.residual. Then when I run the simulation, except economizer(closed and open) models it worked perfectly. The models with economizer ends up with an error.

    "Saturation function cannot be called on mixtures"

Then I tried to assign fluid in pure form like following without specifying sink and source fluid as 0.

     self.fluid_vec_wf = {self.wf: 1}

Then it worked. Is that any bug in tespy or did I miss something in the version update? But other thing is that, simple, flash and cascade model woks with the previous fluid assign, i.e

    self.fluid_vec_wf = {self.wf: 1, self.si: 0}

And this fluid mixture issue only comes to the main working fluid.

jfreissmann commented 4 months ago

Hey @bilwint,

thank you for looking into that. The main changes in the API of TESPy are listed here in the TESPy Change Log of v0.7.0. I think the issues you described mostly stem from the new way fluid vectors are set up and calculated in the network. Especially components which split or merge fluid streams can lead to errors. Besides just changing the fluid vectors, we probably have to fiddle with the right connections to set the fluids.

I was thinking of focusing more on this issue as well. Maybe there should be another feature branch, that is used for work on this and that we can collaborate on. What do you think about that?

bilwint commented 4 months ago

that's nice

jfreissmann commented 4 months ago

I have created the branch and will start some work on it today. I will push my changes frequently, so we minimize overlap of work done by us.

jfreissmann commented 4 months ago

@bilwint I think, now everything works for me. I replaced the fluid vectors with dicts only containing the fluid itself. Can you verify that on your system?

bilwint commented 4 months ago

@jfreissmann Yes it works perfectly for me as well.

jfreissmann commented 4 months ago

Closed with PR #20.