[TRNSYS-users] Reserving Storage Space in a user written component

David BRADLEY d.bradley at tess-inc.com
Mon Apr 22 09:30:01 PDT 2013

   I would recommend that you add your Type to the IVF TRNBuild solution 
and run your simulation from IVF so that you can step through your 
component one line at a time. Certainly from the code except that you 
included, the setStorageSize() routine should be getting called. The 
question is whether that section of code is being correctly executed at 
the appropriate time.

   I might also mention that you are using a very out of date coding 
standard. This will still work but more recent versions of TRNSYS export 
an updated Type template that contains a lot more access functions 
(which are intended to be a lot more intuitive to use than all the codes 
associated with the INFO() array.

   Lastly, if you need to know the solution at the previous timestep to 
solve the current time step, remember that you need to reserve twice as 
many spots in the storage structure. In one spot, you will have the 
solution from the last timestep. In the other, you will keep your best 
guess of the current solution. At the end of the timestep when all the 
iterations are complete (and when INFO(13) > 0 in the coding standard 
that you are using) ten you need to swap the "current solution" into the 
"last timestep" solution spot in the storage structure. In the newer 
coding standard, you can instead reserve what are called "dynamic" 
storage spots that will automatically update at the end of the timestep. 
Look in the 07-Programmer's Guide from 17.1 or later for details on the 
newer coding standard.

On 4/19/2013 17:06, Currie, Sam R wrote:
> Hello,
> I am currently building a component for TRNSYS 17 that requires the 
> solution at the previous time step to solve for the current time step. 
> The .dll's compile fine but I am getting the following error when 
> attempting to run it in Simulation Studio:
> (From the lst file)
> TRNSYS Message    408 : The setStorageSize subroutine was not called 
> to set the number of storage locations required before the 
> setStorageVars routine was called.
> My FORTRAN code for my first call manipulations is as follows:
> ! Perform Initialization Manipulations
> IF (INFO(7) .EQ. -1) THEN
>         ! Retrieve unit and type #:
>         IUNIT = INFO(1)
>         ITYPE = INFO(2)
>         ! Reserve space in the global OUT array:
>         INFO(6) = NO
>         ! This type should be called at each iteration
>         ! whether or not its inputs change:
>         INFO(9) = 1
>         ! Call Type Check subroutine:
>         CALL TYPECK(1, INFO, NI, NP, ND)
>         ! Call input/output check subroutine:
>         ! Reserve storage space:
>         CALL setStorageSize(NS, INFO)
>         ! Return to calling program:
>         RETURN 1
> Any thoughts on this error?
> I am using Visual Studio 2010 with Intel Visual FORTRAN if that helps.
> Thanks!
> Sam
> _______________________________________________
> TRNSYS-users mailing list
> TRNSYS-users at cae.wisc.edu
> https://mailman.cae.wisc.edu/listinfo/trnsys-users

Thermal Energy Systems Specialists, LLC
22 North Carroll Street - suite 370
Madison, WI  53703 USA

d.bradley at tess-inc.com


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.onebuilding.org/pipermail/trnsys-users-onebuilding.org/attachments/20130422/ccff0874/attachment-0001.htm>

More information about the TRNSYS-users mailing list