@@ -1138,10 +1138,7 @@ bool CFSTY::cf_Thermal( // layer temps / heat fluxes
11381138 }
11391139 } // iTry Iteration loop
11401140
1141-
1142-
1143- // calculate radiosities of each layer
1144- // set up matrix
1141+ // calculate radiosities of each layer
11451142 ADIM = 2 *NL + 2 ;
11461143 A = ACopy; // right hand column will be all zeros
11471144
@@ -1172,8 +1169,8 @@ bool CFSTY::cf_Thermal( // layer temps / heat fluxes
11721169 JF (NL+1 ) = XSOL (2 *NL+2 );
11731170 JB (NL+1 ) = 0 .;
11741171
1175- // calculate indices of merit
1176- // set up matrix
1172+ // calculate indices of merit
1173+ // set up matrix
11771174 ADIM = NL;
11781175 A.Resize ( ADIM, ADIM+2 , 1 , 1 );
11791176 A = 0 .;
@@ -1216,7 +1213,7 @@ bool CFSTY::cf_Thermal( // layer temps / heat fluxes
12161213
12171214 // find SHGCcg
12181215 SHGCcg = 0 .;
1219- if ( ISOL > 0.01 ) // for now only calculate if insolation is non-zero
1216+ if (ISOL > 0.01 ) // for now only calculate if insolation is non-zero
12201217 { A = ACopy;
12211218
12221219 TOUTdv = 0 .;
@@ -1294,7 +1291,7 @@ bool CFSTY::cf_Thermal( // layer temps / heat fluxes
12941291 // can only be done if ISOL > 0
12951292 NRad = 0 .;
12961293 NConv = 0 .;
1297- if (ISOL > 0.01 )
1294+ if (ISOL >= 0.001 )
12981295 { TOUTdv = 0 .;
12991296 TRMOUTdv = 0 .;
13001297 TINdv = 0 .;
@@ -1321,25 +1318,24 @@ bool CFSTY::cf_Thermal( // layer temps / heat fluxes
13211318 }
13221319 }
13231320
1324- // Message( msgXXX, "M( I) = " 6F8.5)'), M(1:NL)
1325- // Message( msgXXX, "P( I) = " 6F8.5)'), P(1:NL)
1326-
13271321 // find A for each layer, use to get NRad & NConv fraction for that layer
1328- for (I=1 ; I<=NL; I++)
1322+ for (I=1 ; I<=NL; I++)
13291323 { SOURCEdv ( I) = SOURCE[ I]/ISOL;
13301324 NRad += M[ I]*SOURCEdv ( I);
13311325 NConv += P[ I]*SOURCEdv ( I);
13321326 }
13331327
13341328#if defined( _DEBUG)
13351329 // check values, should be equal to SHGC
1336- Q_INdv = SOURCE[ NL+1 ];
1337- for (I=1 ; I<=NL; I++)
1338- Q_INdv += SOURCE[ I]*(M[ I] + P[ I]);
1339- Q_INdv /= ISOL;
1340- double SUMERR = Q_INdv - SHGCcg;
1341- if (abs ( SUMERR) > .0001 )
1342- Message ( msgERR, " Check for M & P, should be 0: %0.6f" , SUMERR);
1330+ if (ISOL > .01 ) // else no SHGCcg, see above
1331+ { Q_INdv = SOURCE[ NL+1 ];
1332+ for (I=1 ; I<=NL; I++)
1333+ Q_INdv += SOURCE[ I]*(M[ I] + P[ I]);
1334+ Q_INdv /= ISOL;
1335+ double SUMERR = Q_INdv - SHGCcg;
1336+ if (abs ( SUMERR) > .0001 )
1337+ Message ( msgERR, " Check for M & P, should be 0: %0.6f" , SUMERR);
1338+ }
13431339#endif
13441340 }
13451341
@@ -4227,6 +4223,8 @@ static double VB_SLAT_RADIUS_RATIO( // curved slat radius ratio (W / R)
42274223 }
42284224 return rat;
42294225} // VB_SLAT_RADIUS_RATIO
4226+
4227+
42304228// -----------------------------------------------------------------------------
42314229static void VB_SOL4 ( // four surface flat-slat model with slat transmittance
42324230 double S, // slat spacing (any length units; same units as W)
@@ -4254,9 +4252,55 @@ static void VB_SOL4( // four surface flat-slat model with slat transmittance
42544252// if you want the back-side reflectance call with the same
42554253// input data - except negate the slat angle, PHI_DEG
42564254{
4257- #if 1
4258- RHO_BD = TAU_BD = 0 .;
4259- #endif
4255+ // lengths of diagonal strings used in the four-surface model
4256+ double AF = SqrtSumSq ( W*cos (PHI), S - W*sin ( PHI));
4257+ double CD = SqrtSumSq ( W*cos (PHI), S + W*sin ( PHI));
4258+
4259+ double Z3, Z4; // diffuse source terms from surfaces 3 and 4 due to incident beam radiation
4260+ if ((PHI + OMEGA) >= 0.0 )
4261+ { // sun shines on top of slat
4262+ Z3 = TAU_SLAT*S / DE;
4263+ Z4 = RHOUFS_SLAT*S / DE;
4264+ }
4265+ else
4266+ { // sun shines on bottom of slat
4267+ Z3 = RHODFS_SLAT*S / DE;
4268+ Z4 = TAU_SLAT*S / DE;
4269+ }
4270+
4271+ if (abs (PHI - PIOVER2) < SMALL_ERROR)
4272+ { // venetian blind is closed
4273+ if (W < S)
4274+ { // gaps between slats when closed
4275+ RHO_BD = (W / S)*RHOUFS_SLAT;
4276+ TAU_BD = (W / S)*TAU_SLAT;
4277+ }
4278+ else
4279+ { // no gaps between slats when closed
4280+ RHO_BD = RHOUFS_SLAT;
4281+ TAU_BD = TAU_SLAT;
4282+ }
4283+ }
4284+ else
4285+ { // blind is open
4286+ double F13, F14, F23, F24, F34, F43; // Shape factors
4287+ F13 = (S+W-CD)/(2.0 *S);
4288+ F14 = (S+W-AF)/(2.0 *S);
4289+ F23 = (S+W-AF)/(2.0 *S);
4290+ F24 = (S+W-CD)/(2.0 *S);
4291+ F34 = (CD+AF-2.0 *S)/(2.0 *W);
4292+ F43 = (CD+AF-2.0 *S)/(2.0 *W);
4293+
4294+ double C3 = 1.0 / (1.0 - TAU_SLAT*F43);
4295+ double B3 = (RHODFS_SLAT*F34) / (1.0 - TAU_SLAT*F43);
4296+ double C4 = 1.0 / (1.0 - TAU_SLAT*F34);
4297+ double B4 = (RHOUFS_SLAT*F43) / (1.0 - TAU_SLAT*F34);
4298+ double J3 = (C3*Z3 + B3*C4*Z4) / (1.0 - B3*B4);
4299+ double J4 = (C4*Z4 + B4*C3*Z3) / (1.0 - B3*B4);
4300+
4301+ RHO_BD = F13*J3 + F14*J4;
4302+ TAU_BD = F23*J3 + F24*J4;
4303+ }
42604304} // VB_SOL4
42614305// -----------------------------------------------------------------------------
42624306void VB_SOL6 ( // 6 surface flat-slat model with slat transmittance
@@ -4286,9 +4330,98 @@ void VB_SOL6( // 6 surface flat-slat model with slat transmittance
42864330// except negate the slat angle, PHI_DEG
42874331//
42884332{
4289- #if 1
4290- RHO_BD = TAU_BD = 0 .;
4291- #endif
4333+ double Z3, Z4; // diffuse source terms from surfaces 3 and 4 due to incident beam radiation
4334+ if ((PHI + OMEGA) >= 0 .)
4335+ { // sun shines on top of slat
4336+ Z3 = TAU_SLAT*S / DE;
4337+ Z4 = RHOUFS_SLAT*S / DE;
4338+ }
4339+ else
4340+ { // sun shines on bottom of slat
4341+ Z3 = RHODFS_SLAT*S / DE;
4342+ Z4 = TAU_SLAT*S / DE;
4343+ }
4344+
4345+ // CHECK TO SEE if VENETIAN BLIND IS CLOSED
4346+ if (abs (PHI - PIOVER2) < SMALL_ERROR)
4347+ { // blind is closed
4348+ if (W < S)
4349+ { // gaps between slats when blind is closed
4350+ RHO_BD = (W / S)*RHOUFS_SLAT;
4351+ TAU_BD = (W / S)*TAU_SLAT;
4352+ }
4353+ else
4354+ { // no gaps when closed
4355+ RHO_BD = RHOUFS_SLAT;
4356+ TAU_BD = TAU_SLAT;
4357+ }
4358+ }
4359+ else
4360+ { // blind is open
4361+ // lengths of slat segments and diagonal strings used in the six-surface model
4362+ double AB = DE;
4363+ double AF = SqrtSumSq (W*cos (PHI), S - W*sin (PHI));
4364+ double BC = W - AB;
4365+ double EF = BC;
4366+ double BD = SqrtSumSq (DE*cos (PHI), S + DE*sin (PHI));
4367+ double BF = SqrtSumSq (EF*cos (PHI), S - EF*sin (PHI));
4368+ double CD = SqrtSumSq (W*cos (PHI), S + W*sin (PHI));
4369+ double CE = SqrtSumSq (EF*cos (PHI), S + EF*sin (PHI));
4370+ double AE = SqrtSumSq (DE*cos (PHI), S - DE*sin (PHI));
4371+
4372+ double F13, F14, F23, F24, F34, F36, F15, F16; // shape factors
4373+ double F43, F45, F54, F56, F63, F65, F25, F26;
4374+ F13 = (S + AB - BD) / (2.0 *S);
4375+ F14 = (S + DE - AE) / (2.0 *S);
4376+ F15 = (W + BD - (AB + CD)) / (2.0 *S);
4377+ F16 = (W + AE - (AF + DE)) / (2.0 *S);
4378+ F23 = (W + BF - (BC + AF)) / (2.0 *S);
4379+ F24 = (W + CE - (CD + EF)) / (2.0 *S);
4380+ F25 = (S + BC - BF) / (2.0 *S);
4381+ F26 = (S + EF - CE) / (2.0 *S);
4382+ F34 = (AE + BD - 2.0 *S) / (2.0 *AB);
4383+ F36 = (AF + S - (AE + BF)) / (2.0 *AB);
4384+ F43 = (AE + BD - 2.0 *S) / (2.0 *DE);
4385+ F45 = (CD + S - (BD + CE)) / (2.0 *DE);
4386+ F54 = (CD + S - (BD + CE)) / (2.0 *BC);
4387+ F56 = (CE + BF - 2.0 *S) / (2.0 *BC);
4388+ F63 = (AF + S - (AE + BF)) / (2.0 *EF);
4389+ F65 = (BF + CE - 2.0 *S) / (2.0 *EF);
4390+
4391+ // POPULATE THE COEFFICIENTS OF THE RADIOSITY MATRIX
4392+ A2D< 4 , 6 > A (4 , 6 , 1 , 1 );
4393+ A (1 , 1 ) = 1.0 - TAU_SLAT*F43;
4394+ A (1 , 2 ) = -RHODFS_SLAT*F34;
4395+ A (1 , 3 ) = -TAU_SLAT*F45;
4396+ A (1 , 4 ) = -RHODFS_SLAT*F36;
4397+ A (1 , 5 ) = Z3;
4398+ A (2 , 1 ) = -RHOUFS_SLAT*F43;
4399+ A (2 , 2 ) = 1.0 - TAU_SLAT*F34;
4400+ A (2 , 3 ) = -RHOUFS_SLAT*F45;
4401+ A (2 , 4 ) = -TAU_SLAT*F36;
4402+ A (2 , 5 ) = Z4;
4403+ A (3 , 1 ) = -TAU_SLAT*F63;
4404+ A (3 , 2 ) = -RHODFS_SLAT*F54;
4405+ A (3 , 3 ) = 1.0 - TAU_SLAT*F65;
4406+ A (3 , 4 ) = -RHODFS_SLAT*F56;
4407+ A (3 , 5 ) = 0.0 ;
4408+ A (4 , 1 ) = -RHOUFS_SLAT*F63;
4409+ A (4 , 2 ) = -TAU_SLAT*F54;
4410+ A (4 , 3 ) = -RHOUFS_SLAT*F65;
4411+ A (4 , 4 ) = 1.0 - TAU_SLAT*F56;
4412+ A (4 , 5 ) = 0.0 ;
4413+
4414+ A1D< 1 > XSOL (4 );
4415+ A.Solve (XSOL);
4416+ double J3, J4, J5, J6; // radiosity, surface i
4417+ J3 = XSOL (1 );
4418+ J4 = XSOL (2 );
4419+ J5 = XSOL (3 );
4420+ J6 = XSOL (4 );
4421+
4422+ RHO_BD = F13*J3 + F14*J4 + F15*J5 + F16*J6;
4423+ TAU_BD = F23*J3 + F24*J4 + F25*J5 + F26*J6;
4424+ }
42924425} // VB_SOL6
42934426// -----------------------------------------------------------------------------
42944427static void VB_SOL46_CURVE ( // four and six surface curve-slat model with slat transmittance
@@ -4704,8 +4837,37 @@ bool CFSLAYER::cl_Reverse( // reverse a layer
47044837 CFSLAYER& LR) const // returned: reversed layer
47054838// returns true iff success
47064839{
4707- bool bRet = false ;
4708- // TODO
4840+ #if 1
4841+ bool bRet = false ;
4842+ #else
4843+ bool bRet = true;
4844+
4845+ // TODO: incomplete 9-25-2016
4846+
4847+ // LR.ID = SX(ID) // ' REV'
4848+
4849+ // copy invariant mbrs
4850+ LR.LTYPE = LTYPE;
4851+ LR.S = S;
4852+ LR.W = W;
4853+ LR.C = C;
4854+ LR.PHI_DEG = -PHI_DEG; // flip slat angle
4855+ if (cl_IsVB())
4856+ { // blinds: slat properties don't change (up still up)
4857+ LR.SWP_MAT = SWP_MAT;
4858+ LR.LWP_MAT = LWP_MAT;
4859+ bRet = LR.cl_Finalize(); // ??? put at end?
4860+ }
4861+ // else drapes?
4862+ else
4863+ { // other types: F <-> B
4864+ (LR.SWP_MAT = SWP_MAT).csw_Reverse();
4865+ (LR.LWP_MAT = LWP_MAT).clw_Reverse();
4866+ (LR.SWP_EL = SWP_EL).csw_Reverse();
4867+ (LR.LWP_EL = LWP_EL).clw_Reverse();
4868+ }
4869+ #endif
4870+
47094871 return bRet;
47104872} // CFSLAYER::cl_Reverse
47114873// ------------------------------------------------------------------------------
0 commit comments