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

Re: [TRNSYS-users] Strange results when using more than one component with storage



Chun-Kwong,
  Having messed up the use of storage in many many components myself, I can very confidently tell you that the problem lies either in the implementation of the getStorageValues(), and setStorageValues() subroutines in your Type or in the reading of parameters when the Type's UNIT number has changed.

 If you want a quick and dirty solution, you can make two types, both of which are identical but which have different numbers. That way, technically, you only have one unit of each of two components instead of two units of the same component...

If you want to solve the problem, however, the first thing to make sure of is that your Type is rereading its parameters either every single iteration (which is a bit inefficient but simple) or that the Type is checking to see if INFO(1) has changed since the last time that the Type was called. All of the standard Types make this check. You'll find something that says "IF (IUNIT.NE.INFO(1)) THEN ... reread parameters). If that doesn't solve the problem, then the issue lies in the use of getStorageVars() and setStorageVars(). What may be happening is that some local variable in your component is not getting recalculated properly when the simulation time and iteration count have not changed but the unit number has. There are lots of other things that could be wrong of course... I would recommend putting breakpoints into your code and walking though the simulation one iteration at a time to try and figure out where the problem is coming from.
Kind regards,
 david


a8304506@graduate.hku.hk wrote:
Hello, Trnsys users.

I have written a new component which uses storage.  When I test it in a project
containing only one unit of the new component, it looks alright.  However, when
I implement it into a project with two units of the same new component, strange
results are found.  Should I need to add specific statements in the source
code?  Please advise how I can rectify the problem.  Thank you!

Best Regards
LEE, Chun Kwong
Research assistant
Division of Building Science and Technology
City University of Hong Kong




  

_______________________________________________ TRNSYS-users mailing list TRNSYS-users@cae.wisc.edu https://www-old.cae.wisc.edu/mailman/listinfo/trnsys-users

-- 
***********************************************************************
Thermal Energy System Specialists (TESS), LLC 
David BRADLEY                      22 N. Carroll Street - Suite 370 
Partner                            Madison, WI 53703 
                                   USA
P: +1.608.274.2577 
F: +1.608.278.1475
E-mail: bradley@tess-inc.com 
Web Pages:  http://www.tess-inc.com    and      http://www.trnsys.com

***********************************************************************