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

Loop statement unsupported in TRNSYS 18?

6 Posts
2 Users
0 Reactions
468 Views
0
Topic starter
Hi all

Is the LOOP statement supposed to be supported in TRNSYS 18? It is still in the documentation of TRNEDIT (I'm using the iterative substitution solver).

When I add a loop statement TRNSYS crashes because it calls LoopEx with a unit < 0 in the "Very first call manipulations", among other places.

Before I could even proceed to a "proper crash" I had to changes lines like
 
If (unit > 0 .and. Call(unit) .and. Call6(unit)) Then

to something like
If (unit > 0) Then
  If (Info(3,unit) <= 0) Then

because, I've learned, Fortran doesn't have short-curcuiting semantics (and maybe my version of
ifort is a bit stricter than previous iterations?).

Cheers,
Damian
This topic was modified 12 months ago by baumstrunk
baumstrunk Topic starter 13/11/2023 1:23 pm

Sorry, I have no idea why my post became all black...and why my previous post of the same title turned out empty.

baumstrunk Topic starter 13/11/2023 1:23 pm

See attached a screenshot of the stack when the crash occurred.

baumstrunk Topic starter 13/11/2023 1:31 pm

The reason why I was looking at the LOOP statement was that I'd like my iterative feedback controller (Type 22) to try out a control value and then wait for the system to converge for that value, before adjusting the control value - instead of adjusting the control value in response to the error changing due to the rest of the system trying to converge. I hope I'm making any sense. 🙂

1 Answer
0

@baumstrunk 

Damian, if the LOOP command is not functioning in v18 it is a bug and not something intentional. 

That said, Type22 has the concept of setting the number of allowed controller state changes to 0 for the case that you describe. In this mode, the controller will stick to its decision before the maximum number of allowable iterations so that the other components in the system can come to convergence without the controller causing problems. 

You might also look at using Type23 (the PID controller). It has a mode in which it can make its control decision only after the other components in the system have converged. That control decision is then the starting point for the controller's state at the next timestep.

kind regards,

 David

baumstrunk Topic starter 22/11/2023 8:28 pm

@davidbradley Thanks, David!

Share: