[TRNSYS-users] variable storage problems

Jeff Thornton thornton at tess-inc.com
Thu Jun 1 09:06:11 PDT 2006


Jeroen,

There are actually a few problems with your Type that are causing the issues that you are seeing with storage. I'm going to assume that the variables you calculate each timestep are based on variables from the previous timestep - not the previous iteration.  If I'm mistaken here then completely ignore the rest of this e-mail and let me know what you are trying to do.

 I've also included a template file that shows the proper way of using the storage routine: 2 storage spots for each variable that you want to store, 1 for the value at the end of the last timestep, and 1 that is used for each iteration during the current timestep.  At the end of each timestep (info(13)>0) the value at the last iteration gets moved to the value at the last timestep to get ready for the new time step.

You can adopt this strategy (preferred) or you can make a few simple changes to your model to accomplish the same end result (since you are already keeping the variables in the OUT array).  I've shown pieces of your code before and after the required changes:

Before:

IF (INFO(13).GT.0) THEN
   NITEMS=4
   STORED(1)=TVLV
   STORED(2)=DTEMP
   STORED(3)=XMFRW
   STORED(4)=TSET
   CALL setStorageVars(STORED,NITEMS,INFO)
   RETURN 1
ENDIF

After: (The values of your variables may be from a different unit so we need to set them again)

IF (INFO(13).GT.0) THEN
   XMFRW=OUT(1)
   TVLV=OUT(2)
   TSET=OUT(3)
   DTEMP=OUT(4)

   NITEMS=4
   STORED(1)=TVLV
   STORED(2)=DTEMP
   STORED(3)=XMFRW
   STORED(4)=TSET
   CALL setStorageVars(STORED,NITEMS,INFO)
   RETURN 1
ENDIF


Old section:

100 NITEMS=4
STORED(1)=TVLV
STORED(2)=DTEMP
STORED(3)=XMFRW
STORED(4)=TSET
CALL setStorageVars(STORED,NITEMS,INFO)
IF (DMFR.GE.EPS ) GOTO 33 MSR02290


New section (don't overwrite the values from the last timestep as you are already storing the variables in the out array for the current iteration):

100 IF (DMFR.GE.EPS ) GOTO 33 MSR02290



Those changes should allow your type to operate correctly, but its important that you understand the method by which the storage algorithm is used.  If you have questions please feel free to e-mail.  And don't worry, many of the TRNSYS "experts" struggle with the storage arrays.  Concentrate on the methodology and you'll be fine!

Jeff

****************************************************************
Jeff W. Thornton
President - Thermal Energy System Specialists
2916 Marketplace Drive - Suite 104
Madison WI 53719
(608) 274-2577 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Sample_DiffEq.f90
Type: application/octet-stream
Size: 10128 bytes
Desc: not available
URL: <http://lists.onebuilding.org/pipermail/trnsys-users-onebuilding.org/attachments/20060601/11eb01dc/attachment-0001.obj>


More information about the TRNSYS-users mailing list