[TRNSYS-users] Calling a component within a TRNSYS Iteration
David BRADLEY
d.bradley at tess-inc.com
Wed Oct 5 09:58:36 PDT 2011
Aaron,
There are two TRNSYS components that do something similar to what you
are proposing. Type45 (a thermosiphon solar collector) calls Type38 (a
liquid storage tank) internally. There aren't any iterations between the
two components in this case, the TRNSYS kernel passes input information
to Type45, Type45 calls Type38 to solve the thermal storage part, Type38
returns its results to Type45 and then Type45 returns both its results
and Type38's results to the TRNSYS kernel. You may be able to use the
Type45 and type38 code to work out the mechanics of how your two Types
are going to pass information back and forth.
The next thing you will need to do is to write your own iterative solver
within one of your two Types. Your solver will pass Type A's results to
Type B, get Type B's results and resolve Type A, continuing until it
decides that the results match. There are a number of TRNSYS components
that have internal iterative solvers. Type508 in the TESS Libraries is a
good example. Type60 in the standard library has an internal solver as
well but its code is, shall we say, not the easiest to follow.
My concern about your proposed method is that the TRNSYS kernel calls
all Types, passes them their input information, recuperates their output
information, and uses that output information to determine convergence
of the system. In your case, the kernel is going to call both Type A and
Type B and not be aware that they are communicating directly between
themselves. The kernel will call Type A, which comes to a converged
solution internally with Type B, then call Type B and ... I'm not sure
whether you want B to call A and do something. Is there some reason why
"B" is a Type? Can it be a subroutine of Type A? If it has inputs of its
own that interact with other components in the system, those inputs can
all be passed to it through Type A's input list. I think that your
problem will be much easier to solve if you are able to redefine Type B
as a subroutine of Type A.
regards,
David
On 10/4/2011 19:06, Aaron J. Danenberg wrote:
> TRNSYS Users:
>
> I have a simulation consisting of 5 or more components. Two
> of which require an "iteration within an iteration". This
> means that two of the components in the system must feed
> each other outputs and inputs within a single iteration
> before the TRNSYS solver takes over. Both components are
> user written, without going into further explanation they
> cannot be combined into a single component. I am trying to
> figure out how within a loop in my code I can call the other
> single component strictly within that specific loop. In
> this loop I want only these two components in this system
> passing inputs an outputs back and forth until the criteria
> is is satisfied. In my problem we can call the variable X,
> both components have different methods in which they compute
> X, and each of the components require the output from the
> other component to calculate their respective X. The TRNSYS
> solver is not appropriate for the iterative scheme that must
> be used between these two components, so I need to figure
> out a way to run an iteration between two components within
> each TRNSYS iteration. It may be possible for me to modify
> the control of the TRNSYS solver, but I am not where to even
> begin. Thanks for reading my question!
>
> -Aaron
> _______________________________________________
> TRNSYS-users mailing list
> TRNSYS-users at cae.wisc.edu
> https://mailman.cae.wisc.edu/listinfo/trnsys-users
>
>
>
--
***************************
David BRADLEY
Principal
Thermal Energy Systems Specialists, LLC
22 North Carroll Street - suite 370
Madison, WI 53703 USA
P:+1.608.274.2577
F:+1.608.278.1475
d.bradley at tess-inc.com
http://www.tess-inc.com
http://www.trnsys.com
More information about the TRNSYS-users
mailing list