Henk,There are two levels of input / output unit checking in TRNSYS. One level is in the Studio interface where the user can change the units of parameters and the units of UNCONNECTED inputs in a proforma. As soon as the output of a component is connected to the input of another, the value of that output is passed to the input without any conversion. The Studio tries to help you by preventing you from connecting outputs and inputs that have different units. With the Studio level of checking, The second level of input / output unit checking is in the Fortran code. If two connected components have their YCHECK and OCHECK arrays set correctly with the three letter codes that indicate the units of the inputs and outputs respectively and if the RCHECK() subroutine has been called during initialization then the TRNSYS engine
At 04:31 11/15/2007, Henk Stijnen wrote:
Thanks, Jeff,Further question: is special care required in selecting the units while creating the proforma?
The short answer is that yes, you should take care to select input units that match the output units of connected components or else you will have to put an equation in between the two to convert.
Does TRNsys "see" the unit difference between e.g. output of one component and input of a connected component? Or is it needed to carefully set input units equal to output units while creating the schema?
There are two levels of input / output unit checking in TRNSYS. One level is in the Studio interface where the user can change the units of parameters and the units of UNCONNECTED inputs in a proforma. As soon as the output of a component is connected to the input of another, the value of that output is passed to the input without any conversion. The Studio tries to help you by preventing you from connecting outputs and inputs that have different units.
The second level of input / output unit checking is in the Fortran code. If two connected components have their YCHECK and OCHECK arrays set correctly in the Fortran code with the three letter codes that indicate the units of the inputs and outputs respectively and if the RCHECK() subroutine has been called during initialization then the TRNSYS engine will print warnings to the list file whenever there is a mismatch between the output units of one component and the connected input units of another. However, again, no automatic conversion is performed.
Kind regards, David
>>> "Jeff Thornton" <thornton@tess-inc.com> 14-11-2007 18:07 >>> <I've created a new component with connected C++ function. The variables in my component have their dimensions and units. In standard TRNsys components one can freely change the units and computation goes on. In my compo it's also possible to change units. However, in my C++ function only numbers are input for the variables. How can I detect which units the user has selected? Or is it needed to lock the units in the component and how can that be done?> Henk, The studio lets you change the units for your parameters and non-connected inputs as you have pointed out. However, the parameters and inputs are still written to the TRNSYS input file in the units that were originally selected by the author - and therefore passed to the model in the desired units. So, in short, it's not necessary to "detect" the units that are being provided to your model - they will be provided in the units that you dictate when you create the studio proforma. Jeff Jeff Thornton President - TESS, LLC 2916 Marketplace Drive - Suite 104 Madison WI 53719 USA Phone: 608-274-2577 Fax: 608-278-1475 E-mail: thornton@tess-inc.com Web: www.tess-inc.com _______________________________________________ TRNSYS-users mailing list TRNSYS-users@engr.wisc.edu https://www.cae.wisc.edu/mailman/listinfo/trnsys-users
**************************************************************************************** Thermal Energy System Specialists (TESS), LLC David BRADLEY 2916 Marketplace Drive - Suite 104 Partner Madison, WI 53719 Phone: (608) 274-2577 USA Fax: (608) 278-1475 E-mail: bradley@tess-inc.com Web Pages: http://www.tess-inc.com and http://www.trnsys.com "Providing software solutions for today's energy engineering projects" ****************************************************************************************