@@ -512,28 +512,27 @@ namespace Window {
512512 std::array<int , Window::maxGlassLayers> LayerNum = {0 }; // Glass layer number
513513
514514 // Loop over glass layers in the construction
515- for (int IGlass = 1 ; IGlass <= NGlass; ++IGlass ) {
516- int LayNum = 1 + 2 * (IGlass - 1 ) ;
515+ for (int iGlass = 0 ; iGlass < NGlass; ++iGlass ) {
516+ int LayNum = 1 + 2 * iGlass ;
517517 if (ExtShade || ExtBlind || ExtScreen) {
518- LayNum = 2 + 2 * (IGlass - 1 ) ;
518+ LayNum = 2 + 2 * iGlass ;
519519 }
520520 if (BGShade || BGBlind) {
521521 LayNum = 1 ;
522522 if (NGlass == 2 ) {
523- if (IGlass == 2 ) {
523+ if (iGlass == 1 ) {
524524 LayNum = 5 ;
525525 }
526526 } else { // NGlass = 3
527- if (IGlass == 2 ) {
527+ if (iGlass == 1 ) {
528528 LayNum = 3 ;
529- }
530- if (IGlass == 3 ) {
529+ } else if (iGlass == 2 ) {
531530 LayNum = 7 ;
532531 }
533532 }
534533 }
535534
536- LayerNum[IGlass - 1 ] = LayNum;
535+ LayerNum[iGlass ] = LayNum;
537536 LayPtr = thisConstruct.LayerPoint (LayNum);
538537 auto *matGlass = dynamic_cast <Material::MaterialGlass *>(s_mat->materials (LayPtr));
539538 assert (matGlass != nullptr );
@@ -549,15 +548,15 @@ namespace Window {
549548 // In this case, "front" means incident from the outside and "back"
550549 // means incident from the inside.
551550 numptDAT = specData.NumOfWavelengths ;
552- numpt[IGlass - 1 ] = numptDAT;
551+ numpt[iGlass ] = numptDAT;
553552
554553 for (int iLam = 0 ; iLam < numptDAT; ++iLam) {
555- wlt[IGlass - 1 ][iLam] = specData.WaveLength (iLam+1 );
556- t[IGlass - 1 ][iLam] = specData.Trans (iLam+1 );
557- if ((IGlass == 1 || (IGlass == 2 && StormWinConst)) && (!wm->BGFlag ))
558- t[IGlass - 1 ][iLam] *= matGlass->GlassTransDirtFactor ;
559- rff[IGlass - 1 ][iLam] = specData.ReflFront (iLam+1 );
560- rbb[IGlass - 1 ][iLam] = specData.ReflBack (iLam+1 );
554+ wlt[iGlass ][iLam] = specData.WaveLength (iLam+1 );
555+ t[iGlass ][iLam] = specData.Trans (iLam+1 );
556+ if ((iGlass == 0 || (iGlass == 1 && StormWinConst)) && (!wm->BGFlag ))
557+ t[iGlass ][iLam] *= matGlass->GlassTransDirtFactor ;
558+ rff[iGlass ][iLam] = specData.ReflFront (iLam+1 );
559+ rbb[iGlass ][iLam] = specData.ReflBack (iLam+1 );
561560 }
562561
563562 // If there is spectral data for between-glass shades or blinds, calc the average spectral properties for use.
@@ -593,27 +592,27 @@ namespace Window {
593592 // No spectral data for this layer; use spectral average values
594593 if (SpecDataNum == 0 && matGlass->windowOpticalData != Window::OpticalDataModel::SpectralAndAngle) {
595594 lquasi = true ;
596- numpt[IGlass - 1 ] = 2 ;
597- t[IGlass - 1 ][0 ] = matGlass->Trans ;
598- if (IGlass == 1 || (IGlass == 2 && StormWinConst)) {
599- t[IGlass - 1 ][0 ] *= matGlass->GlassTransDirtFactor ;
595+ numpt[iGlass ] = 2 ;
596+ t[iGlass ][0 ] = matGlass->Trans ;
597+ if (iGlass == 0 || (iGlass == 1 && StormWinConst)) {
598+ t[iGlass ][0 ] *= matGlass->GlassTransDirtFactor ;
600599 }
601- t[IGlass - 1 ][1 ] = matGlass->TransVis ;
602- if (IGlass == 1 || (IGlass == 2 && StormWinConst)) {
603- t[IGlass - 1 ][1 ] *= matGlass->GlassTransDirtFactor ;
600+ t[iGlass ][1 ] = matGlass->TransVis ;
601+ if (iGlass == 0 || (iGlass == 1 && StormWinConst)) {
602+ t[iGlass ][1 ] *= matGlass->GlassTransDirtFactor ;
604603 }
605- rff[IGlass - 1 ][0 ] = matGlass->ReflectSolBeamFront ;
606- rbb[IGlass - 1 ][0 ] = matGlass->ReflectSolBeamBack ;
607- rff[IGlass - 1 ][1 ] = matGlass->ReflectVisBeamFront ;
608- rbb[IGlass - 1 ][1 ] = matGlass->ReflectVisBeamBack ;
604+ rff[iGlass ][0 ] = matGlass->ReflectSolBeamFront ;
605+ rbb[iGlass ][0 ] = matGlass->ReflectSolBeamBack ;
606+ rff[iGlass ][1 ] = matGlass->ReflectVisBeamFront ;
607+ rbb[iGlass ][1 ] = matGlass->ReflectVisBeamBack ;
609608 }
610609
611610 if (matGlass->windowOpticalData == Window::OpticalDataModel::SpectralAndAngle) {
612611 if (!wm->BGFlag ) {
613612 AllGlassIsSpectralAverage = false ;
614613 }
615614 numptDAT = wm->wle .size ();
616- numpt[IGlass - 1 ] = numptDAT;
615+ numpt[iGlass ] = numptDAT;
617616 if (wm->BGFlag ) {
618617 // 5/16/2012 CR 8793. Add warning message for the glazing defined with full spectral data.
619618 ShowWarningError (state,
@@ -634,10 +633,10 @@ namespace Window {
634633
635634 for (int iLam = 0 ; iLam < nume; ++iLam) {
636635 Real64 lam = wm->wle [iLam];
637- wlt[IGlass - 1 ][iLam] = lam;
638- t[IGlass - 1 ][iLam] = matGlass->GlassSpecAngTransCurve ->value (state, 0.0 , lam);
639- rff[IGlass - 1 ][iLam] = matGlass->GlassSpecAngFReflCurve ->value (state, 0.0 , lam);
640- rbb[IGlass - 1 ][iLam] = matGlass->GlassSpecAngBReflCurve ->value (state, 0.0 , lam);
636+ wlt[iGlass ][iLam] = lam;
637+ t[iGlass ][iLam] = matGlass->GlassSpecAngTransCurve ->value (state, 0.0 , lam);
638+ rff[iGlass ][iLam] = matGlass->GlassSpecAngFReflCurve ->value (state, 0.0 , lam);
639+ rbb[iGlass ][iLam] = matGlass->GlassSpecAngBReflCurve ->value (state, 0.0 , lam);
641640 }
642641
643642 // set this material to average spectral data
0 commit comments