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?
Re: [TRNSYS-users] "Average value
over time step" in TRNSYS Types
<My component models a thermal storage and uses
an explicit finite
difference method to solve the model equation for the temperature T. I
do
indeed need T from the end of the last timestep to solve the eqation for
T
at the end of the current time step, and I use "getStorageVars()"
and
"setStorageVars()" to save and retrieve T between time steps.
My question
was really about which value of T I should use as output from this
component, to be received as inputs by the other components. Would it be
correct to use an average of T at the end of the previous time step n-1
and T at the end of the current time step n, simply computed by (T_n-1
+
T_n)/2? >
No - it's not technically correct to use the average value of the initial
and final temperatures as the average over the timestep as your thermal
storage model considers the mass. You'll need to solve the resulting
differential equations for not only the final temperature at the end of
timestep (which is based on the initial temperature) but also for the
average value over the timestep. Your proposed solution assumes the
model
behaves linearly from Ti to Tf where the real solution most likely follows
an exponential profile. The TRNSYS manual does provide the solution
for
the average temperature of a differential equation of the form:
dT/dt = aT+b
If this is not the form of your solution then you'll have to take your
solution for Tf and integrate it from t(i-1) to t(i) in order to solve
for
the average temperature over the timestep. Failure to solve for the
average temperature correctly will lead to an energy balance problem in
your simulation.
Jeff
Jeff Thornton
President - TESS, LLC
22 North Carroll Street - Suite 370
Madison WI 53703 USA
------------------------------------------------------------------------------------------------------------
Meld deg på vårt nyhetsbrev på www.niva.no