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

Re: [EnergyPlus_Support] A question about CTFs



Here is a code which I wrote in VBA to bring in CTFs from Excel along with inside and outside surface temperatures, and can then calculate the new heat flux.  I have an expanded version which performs surface heat balances so that you do not have to bring in surface temperatures, but I figured this is focused more on what you were wanting.  Hope it helps in some way.


Sub CTFtoFlux()
'Calculates hourly flux values for a given day using CTFs up to order n=5

'Dimension Variables
'X(n),Y(n),Z(n),PHI(n),Text(day, hour),Tint(day, hour),
'days, hours
Dim qflux_in(8761) As Single, Text(8761) As Single, Tint(8761) As Single
Dim X(7) As Single, Y(7) As Single, Z(7) As Single, PHI(7) As Single

'*******Read in CTFs
Xflag = 0: Yflag = 0: Zflag = 0: PHIflag = 0


For i = 0 To 7
    
    If Xflag = 0 Then
        If IsEmpty(Cells(i + 6, 3)) = False Then
            X(i) = Cells(i + 6, 3).Value
        Else
            n_X = i - 1
            Xflag = 1
        End If
    End If
    
    If Yflag = 0 Then
       If IsEmpty(Cells(i + 6, 4)) = False Then
           Y(i) = Cells(i + 6, 4).Value
       Else
           n_Y = i - 1
           Yflag = 1
       End If
    End If
    
    If Zflag = 0 Then
       If IsEmpty(Cells(i + 6, 5)) = False Then
           Z(i) = Cells(i + 6, 5).Value
       Else
           n_Z = i - 1
           Zflag = 1
       End If
    End If
    
    If PHIflag = 0 Then
       If IsEmpty(Cells(i + 6, 6)) = False Then
           PHI(i) = Cells(i + 6, 6).Value
       Else
           n_PHI = i - 1
           PHIflag = 1
       End If
    End If
       
Next i
    
'*******Input Daily Temp Range
For days = 1 To 364
    For hours = 1 To 24
        HRofYR = 24 * days + hours
        Text(HRofYR) = Cells(hours + 18, 3)
        Tint(HRofYR) = Cells(hours + 18, 4)
    Next hours
Next days

'*******Initial (day zero) Heat Flux set to zero
For hours = 1 To 24
    qflux_in(hours) = 0
Next hours

'******Calculate fluxes for three days, check for convergence
For days = 1 To 3
    For hours = 1 To 24
    
    HRofYR = 24 * days + hours

'**************interior:  qcond=Z0term-Zsum+Y0term+Ysum+PhiSum
        zTerm = Z(0) * Tint(HRofYR)

        'Sum up Z terms (inside temperature terms)
        zSum = 0
        For k = 1 To n_Z
            zSum = zSum + Z(k) * Tint(HRofYR - k)
        Next k
    
        yTerm = Y(0) * Tint(HRofYR)
        
        'Sum up Y terms (outside temperature terms)
        ySum = 0
        For k = 1 To n_Y
            ySum = ySum + Y(k) * Text(HRofYR - k)
        Next k
        
        'Sum up flux history terms
        phiSum = 0
        For k = 1 To n_PHI
            phiSum = phiSum + PHI(k) * qflux_in(HRofYR - k)
        Next k
        
        qflux_in(HRofYR) = -zTerm - zSum + yTerm + ySum + phiSum

    Next hours
Next days

'*****************exterior:  qcond=-Y0term-Ysum+X0term+Xsum+PhiSum

'*****************Output flux data
For days = 1 To 3
    For hours = 1 To 24
        HRofYR = 24 * days + hours
        Cells(9 + hours, days + 8) = qflux_in(HRofYR)
    Next hours
Next days

End Sub



----- Original Message ----
From: wanglei <wangleihello@xxxxxxx>
To: EnergyPlus_Support@xxxxxxxxxxxxxxx
Sent: Monday, October 22, 2007 9:11:16 PM
Subject: [EnergyPlus_Support] A question about CTFs










  


    
            

Dear all:

 I want to use the CTF to calculate the heat transfer through the wall.

 The form of the conduction transfer function solution is below equation:  

 Current Inside Conductive Flux = (Inside Term 0) * (Current Inside Face Temperature)

                                  +(Inside Term 1) * (Previous Inside Face Temperature)

                                  +(Inside Term 2) * (Inside Face Temperature 2 Time Steps Ago)

                                  +(Inside Term 3) * (Inside Face Temperature 3 Time Steps Ago)

                                  + ...

                                  +(Cross Term 0) * (Current Outside Face Temperature)

                                  +(Cross Term 1) * (Previous Outside Face Temperature)

                                  +(Cross Term 2) * (Outside Face Temperature 2 Time Steps Ago)

                                  +(Cross Term 3) * (Outside Face Temperature 3 Time Steps Ago)

                                  + ...

                                  +(Flux Term 1) * (Previous Inside Face Flux)

                                  +(Flux Term 2) * (Inside Face Flux 2 Time Steps Ago)

                                  +(Flux Term 3) * (Inside Face Flux 3 Time Steps Ago)

                                  + ...

and I get the CTFs in *.eio file, the value of CTFs is shown below:

Construction, EXTERWALL1_ CONCRETE_ 2100,   4,  18,   0.167,     0.6033    ,   0.900,   0.900,   0.700,   0.700,Rough

 Material,SLUSH MORTAR,  0.0200,         0.930,   1800.000,     1062.000,  0.2151E-01

 Material,EPS1,  0.0500,         0.040,     15.000,     1400.000,   1.250   

 Material,CONCRETE1_ 2100,  0.2000,         1.280,   2100.000,      920.000,  0.1562   

 Material,LIME MORTAR,  0.2000,         0.870,   1700.000,     1050.000,  0.2299   

 CTF,18,0.15049167E- 07,-0.21682487E- 18,0.67069711E- 13, -0.15626633E- 14

 CTF,17,-0.26448243E -05,-0.15318301E -18,-0.66319653E -07,  0.15918648E- 08

 CTF,16, 0.15333157E- 03,0.16905925E- 18, 0.94242000E- 05,  -0.22710729E- 06

 CTF,15, -0.44145301E- 02,-0.84324973E- 17, -0.39650340E- 03, 0.96432515E- 05

 CTF, 14,0.76655816E- 01, 0.12202644E- 14, 0.87375554E- 02,   -0.21485780E- 03

 CTF,  13, -0.88895541, 0.91721351E- 13,  -0.12139338    ,   0.30224184E- 02

 CTF,  12, 7.3048382 ,  0.37306641E- 11,   1.1614489    ,    -0.29318711E- 01

 CTF,  11, -44.119610,  0.64830792E- 10,   -8.0375559   ,    0.20599150   

 CTF,  10, 200.43401 ,  0.56642175E- 09,    41.419788    ,    -1.0792574   

 CTF,   9,  -694.62120 ,0.25311226E- 08,   -161.69510    ,       4.2897295   

 CTF,   8,  1849.9195  ,0.60119969E- 08,    482.45677    ,      -13.050737   

 CTF,   7,   -3792.0595 , 0.74054537E- 08,   -1102.8340    ,    30.461354   

 CTF,   6,  5958.2866    , 0.47728248E- 08,1923.9766, -54.337180   

 CTF,   5,  -7099.4379 , 0.13441164E- 08, -2534.5777    ,       73.285778   

 CTF,   4,  6290.1754  , 0.27272593E- 09,    2472.3625    ,      -73.274261  

 CTF,   3,  -4008.4518 , -0.53020291E- 10,  -1727.2414  , 52.524960   

 CTF,   2,  1733.9872 , 0.29931675E- 10,   815.66186    ,      -25.472846   

 CTF,   1,   -455.33483 , -0.87445859E- 11,-232.84147    ,       7.4729689   

 CTF,   0,  54.733855 ,   0.11687668E- 11, 30.301279     

The C languange source code of my program is shown below:

for(t=0;t<TotalNum; t++)

{

 

 ZTi=0;

 YTo=0;

        Qqi=0;

 for(j=1;j<=N; j++)

 {

     if(t-j>=0)

     {

   ZTi=ZTi+Z[j] *TI[t-j];

         YTo=YTo+Y[j] *TO[t-j];

      Qqi=Qqi+Q[j] *QI[t-j];

        

   

  }

 }

 

  QI[t]=0-Z[0] *TI[t]-ZTi+ Y[0]*TO[t] +YTo+Qqi;

 

 //  printf("%f\t% f\t%f\n", -Z[0]*TI[ t],-ZTi,YTo, ,Qqi);

}

After run this program, the result confuses me, because the heat flue is increasing with time increasing.

Anyone can told me why?

Wang Lei



[Non-text portions of this message have been removed]





    
  

    
    




<!--

#ygrp-mkp{
border:1px solid #d8d8d8;font-family:Arial;margin:14px 0px;padding:0px 14px;}
#ygrp-mkp hr{
border:1px solid #d8d8d8;}
#ygrp-mkp #hd{
color:#628c2a;font-size:85%;font-weight:bold;line-height:122%;margin:10px 0px;}
#ygrp-mkp #ads{
margin-bottom:10px;}
#ygrp-mkp .ad{
padding:0 0;}
#ygrp-mkp .ad a{
color:#0000ff;text-decoration:none;}
-->



<!--

#ygrp-sponsor #ygrp-lc{
font-family:Arial;}
#ygrp-sponsor #ygrp-lc #hd{
margin:10px 0px;font-weight:bold;font-size:78%;line-height:122%;}
#ygrp-sponsor #ygrp-lc .ad{
margin-bottom:10px;padding:0 0;}
-->



<!--

#ygrp-mlmsg {font-size:13px;font-family:arial, helvetica, clean, sans-serif;}
#ygrp-mlmsg table {font-size:inherit;font:100%;}
#ygrp-mlmsg select, input, textarea {font:99% arial, helvetica, clean, sans-serif;}
#ygrp-mlmsg pre, code {font:115% monospace;}
#ygrp-mlmsg * {line-height:1.22em;}
#ygrp-text{
font-family:Georgia;
}
#ygrp-text p{
margin:0 0 1em 0;}
#ygrp-tpmsgs{
font-family:Arial;
clear:both;}
#ygrp-vitnav{
padding-top:10px;font-family:Verdana;font-size:77%;margin:0;}
#ygrp-vitnav a{
padding:0 1px;}
#ygrp-actbar{
clear:both;margin:25px 0;white-space:nowrap;color:#666;text-align:right;}
#ygrp-actbar .left{
float:left;white-space:nowrap;}
.bld{font-weight:bold;}
#ygrp-grft{
font-family:Verdana;font-size:77%;padding:15px 0;}
#ygrp-ft{
font-family:verdana;font-size:77%;border-top:1px solid #666;
padding:5px 0;
}
#ygrp-mlmsg #logo{
padding-bottom:10px;}

#ygrp-vital{
background-color:#e0ecee;margin-bottom:20px;padding:2px 0 8px 8px;}
#ygrp-vital #vithd{
font-size:77%;font-family:Verdana;font-weight:bold;color:#333;text-transform:uppercase;}
#ygrp-vital ul{
padding:0;margin:2px 0;}
#ygrp-vital ul li{
list-style-type:none;clear:both;border:1px solid #e0ecee;
}
#ygrp-vital ul li .ct{
font-weight:bold;color:#ff7900;float:right;width:2em;text-align:right;padding-right:.5em;}
#ygrp-vital ul li .cat{
font-weight:bold;}
#ygrp-vital a{
text-decoration:none;}

#ygrp-vital a:hover{
text-decoration:underline;}

#ygrp-sponsor #hd{
color:#999;font-size:77%;}
#ygrp-sponsor #ov{
padding:6px 13px;background-color:#e0ecee;margin-bottom:20px;}
#ygrp-sponsor #ov ul{
padding:0 0 0 8px;margin:0;}
#ygrp-sponsor #ov li{
list-style-type:square;padding:6px 0;font-size:77%;}
#ygrp-sponsor #ov li a{
text-decoration:none;font-size:130%;}
#ygrp-sponsor #nc{
background-color:#eee;margin-bottom:20px;padding:0 8px;}
#ygrp-sponsor .ad{
padding:8px 0;}
#ygrp-sponsor .ad #hd1{
font-family:Arial;font-weight:bold;color:#628c2a;font-size:100%;line-height:122%;}
#ygrp-sponsor .ad a{
text-decoration:none;}
#ygrp-sponsor .ad a:hover{
text-decoration:underline;}
#ygrp-sponsor .ad p{
margin:0;}
o{font-size:0;}
.MsoNormal{
margin:0 0 0 0;}
#ygrp-text tt{
font-size:120%;}
blockquote{margin:0 0 0 4px;}
.replbq{margin:4;}
-->







__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

[Non-text portions of this message have been removed]



The primary EnergyPlus web site is found at:
http://www.energyplus.gov

The group web site is:
http://groups.yahoo.com/group/EnergyPlus_Support/

Attachments are not allowed -- please post any files to the appropriate folder in the Files area of the Support Web Site.

EnergyPlus Documentation is searchable.  Open EPlusMainMenu.pdf under the Documentation link and press the "search" button.
 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/EnergyPlus_Support/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/EnergyPlus_Support/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:EnergyPlus_Support-digest@xxxxxxxxxxxxxxx 
    mailto:EnergyPlus_Support-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    EnergyPlus_Support-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/