<br><font size=2 face="sans-serif">Jeff,</font>
<br>
<br><font size=2 face="sans-serif">Thank you for answering my question.</font>
<br>
<br><font size=2 face="sans-serif">If I solve the model equation for the
time  t(i-1/2), would this be a correct approach to find Tavg? I can
then solve for both Tavg and Tf, and use Tf as Ti in the next time step.
Is this how it's done in the standard/TESS TRNSYS components?</font>
<br>
<br><font size=2 face="sans-serif">Best regards,</font>
<br><font size=2 face="sans-serif">Knut Erik  </font>
<br>
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td><font size=1 color=#5f5f5f face="sans-serif">From:</font>
<td><font size=1 face="sans-serif">"Jeff Thornton" <thornton@tess-inc.com></font>
<tr valign=top>
<td><font size=1 color=#5f5f5f face="sans-serif">To:</font>
<td><font size=1 face="sans-serif">knut.erik.enerstvedt@niva.no, bradley@tess-inc.com</font>
<tr>
<td valign=top><font size=1 color=#5f5f5f face="sans-serif">Cc:</font>
<td><font size=1 face="sans-serif">trnsys-users@engr.wisc.edu</font>
<tr valign=top>
<td><font size=1 color=#5f5f5f face="sans-serif">Date:</font>
<td><font size=1 face="sans-serif">08/26/2009 05:30 PM</font>
<tr valign=top>
<td><font size=1 color=#5f5f5f face="sans-serif">Subject:</font>
<td><font size=1 face="sans-serif">Re: [TRNSYS-users] "Average value
over time step" in TRNSYS Types</font></table>
<br>
<hr noshade>
<br>
<br>
<br><tt><font size=2><My component models a thermal storage and uses
an explicit finite<br>
difference method to solve the model equation for the temperature T. I
do<br>
indeed need T from the end of the last timestep to solve the eqation for
T<br>
at the end of the current time step, and I use "getStorageVars()"
and<br>
"setStorageVars()" to save and retrieve T between time steps.
My question<br>
was really about which value of T I should use as output from this<br>
component, to be received as inputs by the other components. Would it be<br>
correct to use an average of T at the end of the previous time step n-1<br>
and T at the end of the current time step n, simply computed by (T_n-1
+<br>
T_n)/2? ><br>
<br>
No - it's not technically correct to use the average value of the initial<br>
and final temperatures as the average over the timestep as your thermal<br>
storage model considers the mass.  You'll need to solve the resulting<br>
differential equations for not only the final temperature at the end of<br>
timestep (which is based on the initial temperature) but also for the<br>
average value over the timestep.  Your proposed solution assumes the
model<br>
behaves linearly from Ti to Tf where the real solution most likely follows<br>
an exponential profile.  The TRNSYS manual does provide the solution
for<br>
the average temperature of a differential equation of the form:<br>
<br>
dT/dt = aT+b<br>
<br>
If this is not the form of your solution then you'll have to take your<br>
solution for Tf and integrate it from t(i-1) to t(i) in order to solve
for<br>
the average temperature over the timestep.  Failure to solve for the<br>
average temperature correctly will lead to an energy balance problem in<br>
your simulation.<br>
<br>
Jeff<br>
<br>
<br>
Jeff Thornton<br>
President - TESS, LLC<br>
<br>
22 North Carroll Street - Suite 370<br>
Madison WI 53703 USA<br>
<br>
Phone: 608-274-2577<br>
Fax: 608-278-1475<br>
E-mail: thornton@tess-inc.com<br>
Web: </font></tt><a href="www.tess-inc.com"><tt><font size=2>www.tess-inc.com</font></tt></a><tt><font size=2><br>
<br>
</font></tt>
<br>
<br><font size=2 face="sans-serif"><br>
------------------------------------------------------------------------------------------------------------<br>
Meld deg på vårt nyhetsbrev på </font><a href=www.niva.no><font size=2 face="sans-serif">www.niva.no</font></a>