tespy icon indicating copy to clipboard operation
tespy copied to clipboard

Add tutorial with deleting and adding connections

Open OskarRaftegard opened this issue 4 years ago • 3 comments

I'm following the heat pump tutorial. When solving the second part of the model, "Valve and evaporator system", I get an error message:

"ERROR:root:All Components must have unique labels, duplicate labels are: "valve".

These are the "dummy-sink" and the real valve component.

  1. Somehow I do not think this is expected? Setting up the dummy-sink valve as va = Sink('valve') when modeling the consumer system was supposed to make it easy to replace it when modelling the valve and evaporator.

  2. How du you drop / remove / change a component? The obvious solution above is of course to remove the dummy valve from the code, as soon as the consumer system is verified. But is there a way to delete a component? I could only find a way to delete connectors ( del_conns).

(Btw, I discovered a Pandas DataFrame, nw.comps. But dropping the row with the dummy did not help. What is this DataFrame?

OskarRaftegard avatar Oct 25 '21 07:10 OskarRaftegard

Hi Oskar,

thank you for reaching out! The network is generated from the connection information, therefore you do not add or delete components but connections instead:

  1. Delete the connection with the Sink nw.del_conns(cd_va).
  2. Create the Valve component va = Valve('valve')
  3. Create a new connection with the actual valve cd_va = Connection(cd, 'out1', va, 'in1')
  4. Add the newly created connection to the network nw.add_conns(cd_va)

I will clarify this in the tutorial section once I find the time. When we created the tutorial, I was going with the solution you suggested in 2., but using this solution might be favorable in many cases, especially with larger networks.

To your second question: The DataFrames (nw.comps and nw.conns) are only used internally to handle equation and derivative calculation as well as some pre- and postprocessing steps. If you want to export the results of a simulation, you can use the nw.results dictionary, which contains pandas DataFrames for each class of component (e.g. nw.results['HeatExchanger']) as well as the connections nw.results['Connection'] and busses nw.results['Bus']. The key is the respective class name.

If there are any other questions or improvements you'd like to suggest, I'd be glad if you let me know.

Best regards and have a nice day Francesco

fwitte avatar Oct 25 '21 07:10 fwitte

Thanks! Problem solved. Do not know if you want to close issue or keep it open it until tutorial updated?

Best regards, Oskar


Other minor heat pump tutorial improvements:

  • I'd prefer the term "refrigerant" instead of "coolant", since a coolant can be many things like the refrigerant, or the cooling water at heat pump "cold side" so to speak. Same goes for "expansion_valve" instead of "valve". But that's my humble opinion.
  • Figure with all component and connector labels included

The tutorial is however very well written as it is!

I'm looking onto making better char_maps for refrigeration compressors. Something that is closer to commercially available compressors. As example have a look at Figure 3 and 4 in below paper: https://www.researchgate.net/publication/281476915_Reciprocating_and_Screw_Compressor_semi-empirical_models_for_establishing_minimum_energy_performance_standards

OskarRaftegard avatar Oct 26 '21 10:10 OskarRaftegard

Thanks! Problem solved. Do not know if you want to close issue or keep it open it until tutorial updated?

Will keep this open as reminder, thank you for your feedback!

I'm looking onto making better char_maps for refrigeration compressors. Something that is closer to commercially available compressors. As example have a look at Figure 3 and 4 in below paper: https://www.researchgate.net/publication/281476915_Reciprocating_and_Screw_Compressor_semi-empirical_models_for_establishing_minimum_energy_performance_standards

That sounds nice, let me know if you need any assistance or guidance in integrating the data in the models or the codebase. We can also easily create a new parameter/equation in the Compressor class, if required. Also, as far as I know @maltefritz and @jfreissmann are working in a project where characteristic curves for different types of compressors are required as well. At least regarding the implementation of new methods there might be common tasks.

fwitte avatar Oct 28 '21 07:10 fwitte

All issues have been fixed here, closing this.

In case you still have questions/ideas please reach out at any time :)

fwitte avatar Oct 02 '22 09:10 fwitte