[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: multiple user-defined type

Yes, you can put more than one instance of a user written type into a project provided that you make use of something called the "S-Array." What happens when you have two instances of the same Type in your project is that TRNSYS in fact executes the same piece of code twice, once with one set of information, then again with another set of information. The TRNSYS kernal takes care of sending the correct XIN( ), PAR( ), and OUT( ) values to each UNIT (instance) of the Type. It sounds as though your Type is getting confused between the two sets of information. A couple of common causes are that your Type does not always read in its inputs and recalculate all of its outputs at each iteration or that your Type does not reread its parameters if the UNIT number (INFO(2) ) has changed. There are a number of other possible causes, especially ones if your Type is counting the number of iterations in a given time step. If this is the case then you should make use of the s-array, which is a global array accessible through the /STORE/ common block and which allows you to store values calculated by a Type between iterations and between time steps as appropriate. More information on how to use the s-array is presented in Chapter 3 of the main TRNSYS manual. For more information on how to correctly write a Type (and specifically how to notice whether the UNIT number has changed), I would suggest that you have a look at the code for Type6 as it is relatively simple and easy to follow.
Kind regards,

At 11:59 AM 3/18/2004 +0100, you wrote:

We need to use more than once a user-defined type into the same project.
We placed two of them, supposedly to give different outputs, but those gave both the same
output of the first type we placed.
Is it possible to place several units of the same user-defined type into the same project
and have them working properly?
What shall we do?


Best regards,

**************************************************************************************** Thermal Energy System Specialists (TESS) David BRADLEY 2916 Marketplace Drive - Suite 104 Partner Madison, WI 53719 Phone: (608) 274-2577 USA Fax: (608) 278-1475 E-mail: bradley@xxxxxxxxxxxx Web Pages: http://www.tess-inc.com and http://www.trnsys.com

"Providing software solutions for today's energy engineering projects"