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

[TRNSYS-users] trnsys 16 dynamic data



Hello All,

 

I am not sure if this has been posted before or solved in trnsys 17.

 

I use routines that call the trnsys dynamic data routine to read in data from a file and interpolate data. Depending on the mode of the calling type (e.g. heat pump in heating or cooling mode) the data may be read several times during the simulation as the calling type may wish to reread the correct data if the mode has changed.

 

Now, when this happens I get an error:

 

Severe(151):allocatable array is already allocated

 

 

I could solve this by deallocating the temporary arrays in the dynamic data routine:

 

      SUBROUTINE DYNAMICDATA(LUdd,NINDdd,NXdd,NYdd,Xdd,Ydd,INFO,*)

     

C**********************************************************************************************

C THIS SUBROUTINE IS USED TO READ AND INTERPOLATE DATA FROM FREE FORMAT DATA FILES IN UP TO 4

C  DIMENSIONS.

C

C WRITTEN BY: D. Bradley at CSTB in Spring 2001    

C

C REVISION HISTORY

C  2005.10.10 - DEB: changed calls to MESSAGES so that UNIT and TYPE number are now reported.

C**********************************************************************************************

! Copyright © 2005 Solar Energy Laboratory, University of Wisconsin-Madison. All rights reserved.

 

!export this subroutine for its use in external DLLs.

!DEC$ATTRIBUTES DLLEXPORT :: DYNAMICDATA

 

…..

…..

…..

C     save the previous array sizes - these will be used on the next call to make

C      that the array always grows, never tries to shrink

      OLDNX1dd=SIZE(X1dd,1)

      OLDNX2dd=SIZE(X2dd,1)

      OLDNX3dd=SIZE(X3dd,1)

      OLDNX4dd=SIZE(X4dd,1)

      OLDNLUdd=NLUdd

      OLDNYMAXdd=NYMAXdd     

C HW  TO PREVENT ERRORS CLEAN UP THE TEMPORARY ARRAYS:

      DEALLOCATE(X1TEMPdd)

      DEALLOCATE(X2TEMPdd)

      DEALLOCATE(X3TEMPdd)

      DEALLOCATE(X4TEMPdd)

      DEALLOCATE(LUSTORTEMPdd)

      DEALLOCATE(YDATATEMPdd)

      DEALLOCATE(DATAINTEMPdd)

      DEALLOCATE(IPTTEMPdd)

      END

 

Should this not have been done anyway, or am I missing something and will this actually cause problems?

 

Thanks!

 

Henk Witte

Groenholland Geo-energysystems

Valschermkade 26

1059CD Amsterdam

 

T: +31 (0)20 6159050

M: +31 (0)628176535

E: henk.witte@groenholland.nl