<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Chun-Kwong,<br>
  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. <br>
<br>
 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...<br>
<br>
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.<br>
Kind regards,<br>
 david<br>
<br>
<br>
<a class="moz-txt-link-abbreviated" href="mailto:a8304506@graduate.hku.hk">a8304506@graduate.hku.hk</a> wrote:
<blockquote cite="mid:1229565956.4949b0047bce9@imp3.webmail.hku.hk"
 type="cite">
  <pre wrap="">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




  </pre>
  <pre wrap="">
<hr size="4" width="90%">
_______________________________________________
TRNSYS-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:TRNSYS-users@cae.wisc.edu">TRNSYS-users@cae.wisc.edu</a>
<a class="moz-txt-link-freetext" href="https://www-old.cae.wisc.edu/mailman/listinfo/trnsys-users">https://www-old.cae.wisc.edu/mailman/listinfo/trnsys-users</a>
  </pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">-- 
***********************************************************************
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: <a class="moz-txt-link-abbreviated" href="mailto:bradley@tess-inc.com">bradley@tess-inc.com</a> 
Web Pages:  <a class="moz-txt-link-freetext" href="http://www.tess-inc.com">http://www.tess-inc.com</a>    and      <a class="moz-txt-link-freetext" href="http://www.trnsys.com">http://www.trnsys.com</a>

***********************************************************************</pre>
</body>
</html>