Welcome to the TRNSYS Users Forum.

The forum is a place where people can interact and have discussions about different topics involving the use of the TRNSYS software package. Here you can post topics for discussion or questions on using TRNSYS and get advice from other users or TRNSYS experts. This forum is not intended for detailed technical support. Users should contact their distributor’s hotline for such assistance.

Some tips for success on using the forum:

  • Follow the Forum Rules posted in Forum Administration.
  • There are categories for different types of topics and questions. Post your topic or question into the proper category.
  • Before posting a topic or question search the existing topics  (and the TRNSYS Users listserv archive or Post archive) to see if a similar topic or question has already been answered.
  • Use a descriptive topic name. Don’t use attention getting subjects, they don’t get attention and only annoy people.
  • State the version of TRNSYS and which add-ons your are using.
  • Include enough specific details for your topic of question to be answered. Just posting “Why am I getting an error?” without describing the specific error and what you are trying to do when you get the error will not receive a response that fixes your issue.
  • Remember when people help you, they are doing you a favor. Be patient, help people out by posting good descriptions of what you need help with, and be polite even if a response does not solve your issue.
  • Moderators may edit your post for clarity or move your topic to a more appropriate category.

Notifications
Clear all

[Solved] Is it possible to call and use a TRNSYS type in a new TRNSYS component (user created component)?

4 Posts
2 Users
0 Reactions
627 Views
0
Topic starter

I am trying to develop a new TRNSYS component that requires iterations: inside the component, I need to use Type1b during internal iterations of the component. Is it possible to include a type (here), Type1b inside a new component?

Context: I use the output temperature and Useful energy from Type1b to calculate a flowrate using a correlation. I obtain also a new output temperature based on the general energy balance. I give back the calculated flowrate to Type1b to obtain a new outlet temperature and this is to be repeated until the difference between the Type1b outlet temperature and the outlet temperature from the balance are within a defined tolerance. I am trying to reproduce the thermosiphon water-in-glass collector model presented by Budihardjo and Morrison ( https://www.researchgate.net/publication/313638497_PERFORMANCE_MODEL_FOR_WATER-IN-GLASS_EVACUATED_TUBE_SOLAR_WATER_HEATERS ).

Thank you

1 Answer
0

I wouldn't recommend trying to call a Type from within another Type. It sounds like you can make all the connections you described externally - just make outlet temperature and useful energy gain inputs to your custom Type that you link from Type 1, and make the calculated mass flow rate an output that you connect back to Type 1. TRNSYS will iterate on the mass flow rate until the solution converges. Make sure you have at least one component on your flow loop with some thermal capacitance, such as a pipe or a storage tank, in order to promote convergence. 

I'm not sure why you describe re-calculating the outlet temperature as well as the mass flow rate - from the equations in Fig 2 of the linked paper, it looks like all you need is the useful energy gain and collector temperature to solve for the thermosiphon mass flow rate. 

Ken Topic starter 23/05/2023 1:33 pm

@a_weiss
Dear A_Weiss, thank you very much for your explanations. I was doing the links as you suggested but nothing was happening (flow rate remains null) that is why I thought about calling type 1b within a component (since I was able to model the whole system with success, when I use simplified equations for the collector).
Now, I found that the problem comes from the fact that when the flow rate becomes zero (at night), the subsequent steps always give zero (since Useful energy is always zero all over the following days). One of the solutions that I have found is to include an if loop (conditional) in which if "Useful energy" is less than or equal to zero, then Flowrate = 0.0001 kg/h; otherwise, the calculated value is used. Then, it works. The only problem is that the flow is now at least 0.0001 kg/h, when it should be 0. But this is quite fine and has not much effect on the final result. Thank you.

A_Weiss A_Weiss 23/05/2023 2:14 pm

Ah, I see the problem. What I would try next is changing the conditional to check if the outlet temperature > inlet temperature by some nominal amount. You should see the outlet temperature rise above the inlet temperature anytime there's sufficient solar to overcome the losses, even if there's no flow through the collector. With that change, you should be able to set flow = 0 anytime outlet temperature <= (inlet temperature + 0.1 C or whatever you like), else use the calculated value. 

There is potential for convergence problems with this logic, especially if there's no thermal capacitance in the loop; in other words, if the system gives T_out > (T_in + tol) with flow = 0 but T_out <= (T_in + tol) with the calculated flow rate, TRNSYS will get stuck cycling between the two until its iteration limit is reached. But as long as there's a pipe or storage tank with at least a timestep's worth of thermal capacitance in the loop, I think the chances of that becoming a significant problem are small.      

Of course, if you have a solution that's acceptable to you and doesn't have much impact on the final result, that's all you really need! 

Ken Topic starter 25/05/2023 4:16 pm

@a_weiss
Thank you very much. I have tried it and it works as well. But at the end, the flow rate at the convergence is anyway 0.0001. Even when I use 0.001 as tolerance between T_out et T_in. Thanks

Share: