[TRNSYS-users] Possibility of running simulation in Fortran Environment

David Bradley bradley at tess-inc.com
Fri Jul 14 08:32:50 PDT 2006


Dear Areemit Narongwit,
   I am not entirely sure how to answer your question. From a technical 
point of view, I imagine that you could rewrite enough of the TRNSYS 
subroutines so that they would work within the framework of your existing 
Fortran program. However, TRNSYS has a lot of routines that deal with the 
overhead of a simulation (making time progress, reading the input file to 
determine the structure of the system that you are trying to simulate, 
determining convergence, plotting, printing, reading weather data, etc.) It 
seems as though the process of rewriting all of those capabilities would be 
quite time consuming.

   The stored variable concept in TRNSYS is not too terribly complex. 
Basically there are three operations.

1. reserving the required amount of space in the storage structure, which 
is done during simulation initialization by calling the subroutine 
setStorageSize().

2. placing variables into storage at an appropriate time by calling the 
setStorageVars() subroutine.

3. retrieving variables from storage at an appropriate time by calling the 
getStorageVars() subroutine.

the most common sequence of operations is as follows. Say that you want to 
store 2 variables. Reserve 4 spots in the storage structure. The first two 
spots will hold the values of the two variables at the end of the previous 
time step (which are the same as the values of the two variables at the 
beginning of the current time step). The second two spots will hold the 
most recently calculated values of the two variables. At each time step, 
directly after reading the current input values, call getStorageVars in 
order to retrieve the values of the two variables at the end of the 
previous time step. Just before you set the outputs at each time step, call 
setStorageVars to set the most recently calculated values of the two 
variables. At the very last call in each time step (when INFO(13) = 1) 
replace the first two storage spots with the variables in the second two 
storage spots.

There is an example component that shows how to use storage available for 
download at http://www.trnsys.com by following the "freebies" link on the left.

Kind regards,
  David


At 02:31 7/14/2006, Narongwit Areemit wrote:
>Dear Sir,
>
>As i am very new to TRNSYS as well as  this mailing list. Please forgive 
>me if what i ask have already been asked before. According to my research 
>mean, we would like to calculate the results involving buildings with 
>hygroscopic material considering the moisture capacity of the building 
>components together with solar desiccant system. As long as i am 
>concerned, TRNSYS and TESS libraries provide me components enough to 
>perform the calculation of solar desiccant system, but , i am not so sure 
>about the hygroscopic material simulation. Fortunately, i used to make a 
>hygroscopic simulation program on Fortran environment. So it would be 
>great if i can combine my program together with TRNSYS. But the thing is, 
>in order to transform my program into TRNSYS components, it seems to be a 
>number of difficulties involving the stored variable concept in TRNSYS. 
>So, would it be possible to, reversely, use the Fortran source code of 
>TRNSYS, components as a subroutine to run together with my program on 
>Fortran environment without dealing with DLL or other interfaces thing?
>
>Looking forward to hearing from you. and i would like to express my 
>gratitude in advance
>
>Best regards
>Areemit Narongwit
>
>The University of Tokyo
>_______________________________________________
>TRNSYS-users mailing list
>TRNSYS-users at 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 at tess-inc.com
Web Pages:  http://www.tess-inc.com     and      http://www.trnsys.com

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





More information about the TRNSYS-users mailing list