      SUBROUTINE STRCTL(IDBG,NZONG) 
C 
C-----READS STRUCTURE INFORMATION FOR RESIDENTIAL SIMULATION PROGRAM
C  NOTES:  1. IN BASMT ZONE, INPUT VALUES FOR THE CEILING AS IF IT
C             WERE AN INTERIOR PARTITION BETWEEN ZONES.  ENTER BASE-
C             MENT ENCLOSURE DATA AFTER OTHER ZONE DATA 
C-----CONSTANTS 
CMDK NKONST
CMDK NRF
CMDK NWL
CMDK NWN
CMDK NWZN
CMDK NZN
CMDK NZW
C 
C-----COMMON BLOCKS 
CMDK CNSTRK
CMDK BLKFMI
CMDK ENCBK1
CMDK ENCBK2
CMDK ENCBLK
CMDK DUCTS4
CMDK IRDFQ
CMDK IWLS
CMDK IZPART
CMDK IZZQ
CMDK MZON1
CMDK NCR
CMDK QUAYCH
CMDK ROOF
CMDK STRUCA
CMDK SURFAR
CMDK WNDBLK
C 
      CHARACTER*1 IDEXPI
      CHARACTER*1 IDXP (10), IFXDI (4)
      CHARACTER*4 NHEADE(10)
C 
C-----INITIALIZATIONS 
      DATA IDXP   /'N', 'E', 'S', 'W', 'C', 'F', 'I','B','G','H'/ 
      NLEAKS=0
C         SET SHADING ALWAYS FOR CONSTRUCT 11 (SEE BLKDAT)      
      IFXL(1,11)=4
C ZERO NWALLA,NRMA,AND IZSET ARRAYS 
      CALL ZERVI(NZN,NWALLA)
      CALL ZERVI(NZN,NRMA)
      CALL ZERVI(NZW,IZSET) 
C  NOTE:MULTIPLE INTERIOR WALLS THAT ARENT SEPARATING ZONES AND 
C       HAVE SAME CONSTRUCT NO. SHOULD BE ENTERED CONSECUTIVELY 
      WRITE(60,524)
      CALL FLUSH(6)
C 
C  ---READ DATA THAT IS TO BE LOADED INTO STRUCTURE FILE
C   NIZ IS DIMENSION OF IZWSS AND IZWSV SET IN CMDECKS(6*NZN)
      CALL ZERVI(NIZ,IZWSS) 
      NIZWS=0 
      IZW=0 
      NW=0
      IBAS=0
      ICRW=0
C      
      OPEN(10,FILE='TAPE10',STATUS='OLD',IOSTAT=IO10)
      IF(IO10.NE.0)THEN
        WRITE(60,*)' STRCTL: CANT OPEN TAPE10 WITH STRUCTURE DATA'
        STOP ' STRCTL: CANT OPEN TAPE10 WITH STRUCTURE DATA'
        ENDIF
C 
C     IFXDI   ARRAY OF UP TO FOUR COMPASS DIRECTIONS THAT ARE ALWAYS
C             SHADED
C     WROTA   ANGLE THAT STRUCTURE IS ROTATED FROM THE CARDINAL COMPASS 
C             DIRECTIONS (+ CLOCKWISE, - COUNTER-CLOCKWISE) 
      READ(10, 500) IFXDI, WROTA 
C 
C     CONVERT IFXDI TO NUMERIC VALUE IN IFXDS ARRAY 
      NSQ=0 
      DO 81 I=1, 4
         IFXDS (I)=0
         DO 80 J=1, 4 
            IF (IFXDI (I).EQ.IDXP (J)) THEN 
               IFXDS (I)=J
               NSQ=NSQ+1
            END IF
80          CONTINUE
81       CONTINUE 
C 
      IF (NSQ.NE.0) WRITE(60, 503) (IFXDS (I), I=1, NSQ) 
      WRITE(60, 504) WROTA 
      CALL FLUSH(6)
      IAREA=0 
C 
C     NROOMS  NUMBER OF ZONES 
C     NSECTA  NUMBER OF ROOF SECTIONS 
C    NZNBAS  ZONE NUMBER OF BASEMENT (IE. NRM OF BASEMENT ZONE) 
C    NATC  NUMBER OF ATTIC ZONES
C 
      READ(10, *) NROOMS, NSECTA, NZNBAS, NATC 
      WRITE(60, 505) NROOMS, NSECTA, NZNBAS, NATC
      CALL FLUSH(6)
      IF (NROOMS.GT.NZN) STOP 'STRCTL: NROOMS TOO LARGE, INCREMENT NZN' 
      IF (NSECTA.GT.NRF) STOP 'STRCTL: NSECT TOO LARGE, INCREMENT NRF'
C-----READ ZONE DATA
      IZT=0 
      DO 130 J=1, NROOMS
C 
C        NRM     ZONE NUMBER (CAN BE ANY ORDER (BEST TO USE 1,2,..5,
C                HOWEVER), BUT KEEP MAXIMUM VALUE AS LOW AS POSSIBLE 
C        NWALLI  NUMBER OF ENCLOSURE ELEMENTS (OUTSIDE WALLS, INTERIOR
C                WALLS, FLOOR, CEILING, ETC.) IN THIS ZONE
C NOTE: NWALLA MAY GET MODIFIED WITH VALUES FROM AN INTERIOR PARTITION
C       BETWEEN ZONES SET IN ANOTHER ZONE .
C        CLHT    CEILING HEIGHT IN THIS ZONE, FT
C        KNSTAT   CONSTRUCT THAT HAS TSTAT MOUNTED ON IN THIS ZONE
         READ(10, *) NRM, NWALLI, CLHT (NRM), KNSTAT(NRM)
         N2I=1
C   NWALLA(NRM) CAN BE > 0 IF MIRROR IMAGE WAS SET IN THIS ZONE 
         IF(NWALLA(NRM).GT.0)N2I=NWALLA(NRM)+1
         NWALLA(NRM)=NWALLA(NRM)+NWALLI 
         WRITE(60,529) 
         WRITE(60, 506) NRM, NWALLI, CLHT (NRM), KNSTAT(NRM) 
         WRITE(60,530) 
         CALL FLUSH(6)
         NRMA (NRM)=NRM 
         N2=NWALLA (NRM)
C 
C NOTE!!!!!!! 
C  INTERIOR PARTITION WALLS BETWEEN ZONES SHOULD ONLY BE ENTERED
C  IN 1ST ZONE ( A MIRROR IMAGE IS SET UP IN 2ND ZONE)
C 
         DO 128 K2=N2I, N2
            IZW=IZW+1 
            IF (IZW.GT.NZW) STOP 'STRCTL: NZW MUST BE INCREMENTED'
            NENC (NRM, K2)=IZW
C 
C    IDEXPI:                   IDEXP
C       N  NORTH OUTSIDE WALL  - 1 
C       E  EAST OUTSIDE WALL   - 2 
C       S  SOUTH OUTSIDE WALL  - 3 
C       W  WEST OUTSIDE WALL   - 4 
C       C  CEILING INSIDE      - 5 
C       F  FLOOR INSIDE        - 6 
C       I  INTERIOR INSIDE WALL- 7 
C       B  BSMT FLOOR          - 8 (SET NZNC=0)
C       G  BELOW GRND BSMT WALL- 9 (SET NZNC=0)
C       H  ABOVE GRND BSMT WALL- 10(SET NZNC=0)
C    NHEADE - UP TO 40 CHAR DESCRIPTION OF THIS WALL
            READ(10, 501) IDEXPI, NHEADE 
C           CONVERT IDEXPI TO NUMERIC VALUE 
            DO 90 I=1, 10 
               IF (IDEXPI.EQ.IDXP (I)) GO TO 92 
90             CONTINUE 
            WRITE(60, *)' STRCTL: IDEXPI BAD; NRM,K2,IDEXPI= ',
     +            NRM,K2,IDEXPI
            CALL FLUSH(6)
            STOP 'STRCTL: IDEXPI BAD' 
C 
92          IDX=I 
            WRITE(60, 518) NHEADE
            WRITE(60, 507) IDX, IZW
            CALL FLUSH(6)
            IDEXP (IZW)=IDX 
C 
C           NZNC  CONNECTING SPACE NUMBER:  
C              0 FOR BSMT FLR,BLW GRND BSMT WALL, AND ABV GRND BSMT WALL
C              1 OUTDOORS     4 ATTIC NUMBER 1       7 BASEMENT W/DUCTS 
C              2 BASEMENT     5 ATTIC NUMBER 2       8 CRAWLSPC W/DUCTS 
C              3 CRAWLSPACE   6 ATTACHED GARAGE 
C              9-13  FIVE ZONES IN LIVING SPACE 
C           KONSTA  CONSTRUCT NUMBER (SEE BLOCK DATA SUBPROGRAM)
C                   IF KONSTA < 0, CONSTRUCT IN BLOCK DATA WILL BE 
C                   REPLACED.
C           HGTA    HEIGHT OF ENCLOSURE ELEMENT, FT 
C           XLENA   LENGTH OF ENCLOSURE ELEMENT, FT 
C  NOTE 1. ENTER TWO ELEMENTS FOR BASEMENT FLOOR(ID=8).  THE SMALLER
C          ELEMENT WILL REPRESENT THE FLOOR NEAR THE OUTSIDE WALL AND 
C          SHOULD BE ENTERED SECOND.
C  NOTE 2. ENTER FOUR ELEMENTS FOR THE BASEMENT WALL BELOW GROUND(ID=9) 
C          IN ORDER OF DEPTH.  HEIGHT DZN OF GROUND NODES USED IN SETNOD
C          OF SOIL OR GROUND TEMPERATURE ROUTINES WILL BE THE SAME AS 
C          THE HEIGHT OF THESE ELEMENTS.
C  NOTE 3. FOR FLOOR ABOVE BSMT, ENTER ONLY ONE ELEMENT W/O DUCTS BELOW 
C          AND ONLY ONE ELEMENT W/ DUCTS BELOW.  IF MORE THAN ONE ELEMENT 
C          IS ENTERED FOR THESE, FLOOR LOSSES WONT GET CALC PROPERLY).
C          ENTER THESE ELEMENTS IN ZONE ABOVE BSMT AND DONT REPEAT
C          IN BASEMENT ZONE FOR BASEMENT CEILING.  BSMT CEILING WILL
C          GET GENERATED FROM LVG SPC FLOOR INFO. 
C 
            READ(10, *) NZNC (IZW), KONSTA (IZW), HGTA (IZW),
     1         XLENA (IZW)
            WRITE(60, 508) NZNC (IZW), KONSTA (IZW), HGTA (IZW), 
     1         XLENA (IZW)
            CALL FLUSH(6)
C  OVERRIDE IDEXPI IF <= 4 AND NZONC=6 (GARAGE) SO THAT IWALLS IS USED TO 
C  CALC WALL TEMPS OF WALL BETWEEN LVG SPC AND GARAGE 
         IF(IDX.LE.4.AND.NZNC(IZW).EQ.6)THEN
            IDXGAR=IDX 
            IDX=7 
            IDEXP(IZW)=IDX
            WRITE(60,532)IZW,IDXGAR,IDX
            ENDIF 
         IF(NZNC(IZW).EQ.2.OR.NZNC(IZW).EQ.7)IBAS=1 
         IF(NZNC(IZW).EQ.3.OR.NZNC(IZW).EQ.8)ICRW=1 
C 
C           CHECK TO SEE IF CONSTRUCT IS AVAILABLE; IF NOT, READ
C           CONSTRUCT DATA
         IF (KONSTA (IZW).GT.NCONS.OR.KONSTA(IZW).LT.0) THEN
            IF(KONSTA(IZW).GT.0)THEN
               NCONS=NCONS+1
               KONSTA (IZW)=NCONS 
               N=NCONS
            ELSE
               KONSTA(IZW)=IABS(KONSTA(IZW))
               N=KONSTA(IZW)
               WRITE(60,3060)N 
               ENDIF
               CALL FLUSH(6)
C 
C              NLMP   NUMBER OF LUMPS IN THIS CONSTRUCT (1 OR 3)
C              IFXL   = (1, 2, 3, 4) FOR ALWAYS SHADING (N, E, S, W) DIR
C                     = 0 FOR DEACTIVATE
            WRITE(60,*)' TRYING TO READ NEW CONSTRUCT DATA!!!!'
            CALL FLUSH(6)
            READ(10, *) NLMP (N), (IFXL (I, N), I=1, 4)
            WRITE(60, 509) NLMP (N), (IFXL (I, N), I=1, 4) 
            CALL FLUSH(6)
C 
C              WK   THERMAL CONDUCTIVITY OF LUMP MATERIAL, BTU/HR-FT-F
C              WX   THICKNESS OF LUMP LAYER, FT 
C              WRHO DENSITY OF LUMP MATERIAL, LBM/FT3 
C              WCP  SPECIFIC HEAT OF LUMP MATERIAL, BTU/LBM-F 
            READ(10, *) WK (1, N), WX (1, N), WRHO (1, N), 
     1            WCP (1, N)
            WRITE(60, 510) 1, WK (1, N), WX (1, N),
     1            WRHO (1, N), WCP (1, N) 
            CALL FLUSH(6)
            IF (NLMP (N).EQ.3) THEN 
               READ(10, *) WK (2, N), WX (2, N), WRHO (2, N),
     1               WCP (2, N) 
               WRITE(60, 510) 2, WK (2, N), WX (2, N), 
     1               WRHO (2, N), WCP (2, N)
               CALL FLUSH(6)
               READ(10, *) WK (3, N), WX (3, N), WRHO (3, N),
     1               WCP (3, N) 
               WRITE(60, 510) 3, WK (3, N), WX (3, N), 
     1               WRHO (3, N), WCP (3, N)
               CALL FLUSH(6)
               END IF 
            END IF
C 
C           LEAKAGE PARAMETERS
C           DON'T READ LEAKAGE IF ENCLOSURE ELEMENT IS INTERIOR WALL
C           WITHIN THE SAME ZONE (IR=0) OR CEILING OR FLOOR
            IR=0
C 
C           IF THE ENCLOSURE ELEMENT IS AN INTERIOR WALL BETWEEN ZONES
C           , AN ABOVE-GRND BSMT WALL, OR AN OUTSIDE WALL (IR=1)
C   INTERIOR WALL BETWEEN ZONES 
C                   NZON IS CONNECTING ZONE
              NZON=NZNC(IZW)-8
              IF(IDX.EQ.7.AND.NRM.NE.NZON)IR=1
C   BASEMENT WALL ABOVE GROUND
              IF(IDX.EQ.10)IR=1 
C   OUTSIDE WALL
              IF(IDX.LE.4)IR=1
C              
C              WDLEAK - WIDTH OF LEAKAGE OPENING, IN.
C              HGTLEAK - HEIGHT OF LEAKAGE OPENING, IN.
C              HNPL - HEIGHT FROM CENTER OF OPENING UP TO NEUTRAL
C                     PRESSURE LEVEL IN BUILDING (USED ON OUTSIDE
C                     WALLS WHEN WIND VELOCITY IS ZERO.--SEE P.23.4
C                     OF 1989 ASHRAE HANDBOOK OF FUNDAMENTALS)
C                    
             IF(IR.EQ.1)THEN
               READ(10, *) WDLEAK (IZW), HGTLEAK (IZW), HNPL (IZW)
               WRITE(60, 512) WDLEAK (IZW), HGTLEAK (IZW), HNPL (IZW)
               CALL FLUSH(6)
             END IF 
C 
C           WALLFI   LONGWAVE EMISSIVITY INSIDE SURFACE OF
C                    ENCLOSURE ELEMENT
C           WALLFO   LONGWAVE EMISSIVITY AT OUTER SURFACE OF
C                    ENCLOSURE ELEMENT
C           EPSLR    SHORTWAVE (SOLAR) ABSORPTIVITY AT OUTER
C                    SURFACE OF ENCLOSURE ELEMENT 
            IF(IDX.LE.4)THEN
              READ(10, *) WALLFI (IZW), WALLFO (IZW), EPSLR(IZW) 
              WRITE(60, 531) WALLFI (IZW), WALLFO (IZW),EPSLR(IZW) 
              CALL FLUSH(6)
            ELSE
              READ(10, *) WALLFI(IZW), WALLFO(IZW) 
              WRITE(60, 513) WALLFI (IZW), WALLFO (IZW)
              CALL FLUSH(6)
              ENDIF 
            WRITE(60, 520) IDX 
            CALL FLUSH(6)
C 
C           NWNDA   NUMBER OF WINDOWS FOR THIS ENCLOSURE ELEMENT
C           OHANGA  ROOF OVERHANG ABOVE THESE WINDOWS, FT 
C           HHANGA  HEIGHT TO OVERHANG FROM TOP OF OUTSIDE WALL, IN.
            IF (IDX.LE.4) THEN
               READ(10, *) NWNDA (IZW), OHANGA (IZW), HHANGA (IZW) 
               WRITE(60, 514) NWNDA (IZW), OHANGA (IZW), 
     1            HHANGA (IZW)
               CALL FLUSH(6)
               N4=NWNDA (IZW) 
               IF (N4.NE.0) THEN
C                 READ WINDOW DATA
                  DO 94 K4=1, N4
                     NW=NW+1
                     NIWND (IZW, K4)=NW 
C 
C                    WHGTA   HEIGHT OF TRANSPARENT WINDOW, FT 
C                    WWDTHA  WIDTH OF TRANSPARENT WINDOW REDUCED TO 
C                            ACCOUNT FOR ANY BLOCKAGE, FT 
C                    REVELA  DEPTH OF REVEAL OR SETBACK OF WINDOW FROM
C                            OUTER SURFACE, IN. 
C                    OHNGHA  DISTANCE FROM TOP OF WINDOW AND ROOF 
C                            OVERHANG, IN.
C                    SFSDA   WINDOW SHADING COEFFICIENT (ASHRAE 
C                            HANDBOOK OF FUNDAMENTALS)
                     READ(10, *) WHGTA (NW), WWDTHA (NW),
     1                  REVELA (NW), OHNGHA (NW), SFSDA (NW)
                     WRITE(60, 515) NW, WHGTA (NW), WWDTHA (NW), 
     1                  REVELA (NW), OHNGHA (NW), SFSDA (NW)
                     CALL FLUSH(6)
94                   CONTINUE 
               END IF 
            END IF
      KONI=KONSTA(IZW)
      NZONC=NZNC(IZW) 
      NZON=NZONC-8
      IBZ=0 
C   IBZ = 1, IF THIS ENCLOSURE ELE IS AN INTERIOR WALL BETWN ZONES      
      IF(IDX.EQ.7.AND.NRM.NE.NZON.AND.NZONC.NE.6)IBZ=1
      IF(IDX.EQ.6)THEN
          IF(NZONC.EQ.2.OR.NZONC.EQ.7)THEN
C   IBZ = 2, IF THIS ENCLOSURE ELE IS FLOOR BETWN LVG ZONE AND BSMT          
              IBZ=2 
              NZON=NZNBAS 
              ENDIF 
          ENDIF 
      IF(IBZ.NE.0)THEN
C - - INTERIOR PARTITION WALL OR FLOOR BETWEEN ZONES
C  SET VALUES FOR OTHER SIDE OF WALL OR FLOOR 
          N2=NWALLA(NZON)+1 
          NWALLA(NZON)=N2 
          IF(NRMA(NZON).EQ.0)NRMA(NZON)=NZON
          IZWX=IZW
          IZW=IZW+1 
          IF(IZW.GT.NZW)STOP 'STRCTL:NZW MUST BE INCREASED' 
          NENC(NZON,N2)=IZW 
          IF(IBZ.EQ.1)THEN
              WRITE(60,3040)IZWX,NRM,IZW,NZON
              CALL FLUSH(6)
C  IDQ IS THE IDEXP OF THE CONNECTING ZONE IN WHICH A MIRROR IMAGE
C  IS SET              
              IDQ=7 
              ENDIF 
          IF(IBZ.EQ.2)THEN
              WRITE(60,3050)IZWX,NRM,IZW,NZON
              CALL FLUSH(6)
              IDQ=5 
              ENDIF 
          IDEXP(IZW)=IDQ
          NZNC(IZW)=NRM+8 
C - - LOOK FOR MIRROR IMAGE OF THIS CONSTRUCT; IF NOT AVAILABLE, THEN 
C         SET UP A NEW CONSTRUCT WHICH IS A MIRROR IMAGE
          CALL KONSET(KONI,KONO)
          KONSTA(IZW)=KONO
          HGTA(IZW)=HGTA(IZWX)
          XLENA(IZW)=XLENA(IZWX)
C          WDLEAK(IZW)=WDLEAK(IZWX)
C          HGTLEAK(IZW)=HGTLEAK(IZWX)
C          HNPL(IZW)=HNPL(IZWX)
          WALLFI(IZW)=WALLFO(IZWX)
          WALLFO(IZW)=WALLFI(IZWX)
          AWALLA(IZW)=AWALLA(IZWX)
C  SET IZW ON BACKSIDE OF PARTITION WALL BETWEEN ZONES
          NIZWS=NIZWS+1 
          IF(NIZWS.GT.NIZ)THEN
            WRITE(60,528)2*NIZ 
           STOP 'INCR DIM OF IZWSS AND IZWSV IN CMDECKS & NIZ IN STRCTL' 
            ENDIF 
C  IZSET IS IZW ON THIS SIDE OF INTERIOR PART WALL BETWN ZONES
C  IZWSS IS IZW ON BACK SIDE OF INTERIOR PART WALL BETWEEN ZONES            
          IZSET(NIZWS)=IZWX 
          IZWSS(NIZWS)=IZW
          NIZWS = NIZWS + 1
          IF(NIZWS.GT.NIZ)THEN
            WRITE(60,528)2*NIZ 
           STOP 'INCR DIM OF IZWSS AND IZWSV IN CMDECKS & NIZ IN STRCTL' 
          ENDIF 
          IZSET(NIZWS)=IZW
          IZWSS(NIZWS)=IZWX 
          ENDIF 
128         CONTINUE
         WRITE(60, 521)
C 
C        CHECK FOR CONSOLIDATION OF ENCLOSURE ELEMENTS IN ZONE NRM
C        IZT IS IZW AT END OF ENCLOSURE ELEMENTS FOR PREVIOUS ZONE
         CALL CONSLD (NRM, IAREA, 0,IDBG) 
C         
C   SET LEAKAGE CONNECTION DATA
         N2=NWALLA(NRM)
         DO 129 K2=1,N2
         IZW=NENC(NRM,K2)
         NZONC=NZNC(IZW)
C              SET THE ZONE THAT CONNECTS TO AN ATTACHED GARAG         
         IF(NZONC.EQ.6)THEN
           NZONG=NRM
         ENDIF
         IF(WDLEAK(IZW).GT.0.)THEN
           NLEAKS=NLEAKS+1
           IZWLEAK(NLEAKS)=IZW
         ENDIF
  129    CONTINUE         
C        IZT IS IZW AT END OF ENCLOSURE ELEMENTS FOR THIS ZONE
          IZW=IZT 
  130    CONTINUE 
C   NOW RESET IZSET ARRAY WITH ORDER OF IZWSS VALUES
      DO 131 IQ=1,NIZWS 
  131 IZWSV(IQ)=IZSET(IQ) 
      CALL ZERVI(NZW,IZSET) 
      DO 132 IQ=1,NIZWS 
      IZW=IZWSS(IQ) 
  132 IZSET(IZW)=IZWSV(IQ)
      WRITE(60,*)'  ***  NOW PRINT IZW INDICES OF MIRROR-IMAGE ELEMENTS'
      DO 133 IZW=1,NZW
      IF(IZSET(IZW).NE.0)THEN
        WRITE(60,*)' IZW,IZSET(IZW)= ',IZW,IZSET(IZW)
      ENDIF
  133 CONTINUE
C 
C     READ ROOF DATA
      DO 140 K5=1, NSECTA 
C        READ COMPASS DIRECTION THAT ROOF FACES 
C 
C        IDEXPI:  
C           N  NORTH FACING SECTION- 1
C           E  EAST FACING SECTION - 2
C           S  SOUTH FACING SECTION- 3
C           W  WEST FACING SECTION - 4
C  NHEADE - UP TO 40 CHAR DESCRIPTION OF ROOF ELEMENT
         READ(10,501) IDEXPI,NHEADE
         WRITE(60, 519) IDEXPI,NHEADE
         DO 138 I=1, 4
            IF (IDEXPI.EQ.IDXP (I)) GO TO 139 
138         CONTINUE
         STOP 'STRCTL: IDEXP OF ROOF SECTION IS BAD'
  139      IDEXPR (K5)=I
         WRITE(60, 516) K5, IDEXPR (K5)
C 
C        NATTC   ATTIC NUMBER BELOW ROOF (1 OR 2) 
C        KONSTR  CONSTRUCT NUMBER (SEE BLOCK DATA SUBPROGRAM) 
C        SECTAA  SURFACE AREA OF THIS ROOF SECTION, SQ FT 
C        PAA     PITCH ANGLE BETWEEN ROOF LINE AND HORIZONTAL, DEG
C        ROOFI   LONGWAVE EMISSIVITY/ABSORPTIVITY FOR UNDERSIDE OF ROOF 
C        ROOFO   LONGWAVE EMISSIVITY/ABSORPTIVITY FOR OUTER SURF OF ROOF
C       EPRSLR   ABSORPTIVITY FOR SOLAR RADIATION AT OUTER SURFACE OF 
C                ROOF 
         READ(10, *) NATTC (K5), KONSTR (K5), SECTAA (K5), PAAI, 
     1      ROOFI (K5), ROOFO (K5), EPRSLR(K5)
         WRITE(60, 517) NATTC (K5), KONSTR (K5), SECTAA (K5), PAAI,
     1      ROOFI (K5), ROOFO (K5),EPRSLR(K5) 
         IF(NATTC(K5).EQ.1)THEN 
            KONRF(1)=KONSTR(K5) 
            ROFOM(1)=ROOFO(K5)
            ROFIM(1)=ROOFI(K5)
            ENDIF 
         IF(NATTC(K5).EQ.2)THEN 
            KONRF(2)=KONSTR(K5) 
            ROFOM(2)=ROOFO(K5)
            ROFIM(2)=ROOFI(K5)
            ENDIF 
         PAA (K5)=90.0-PAAI 
140      CONTINUE 
C 
C     CALCULATE WINDOW AND ROOF AREAS 
      IAREA=1 
      CALL CONSLD (1, IAREA, 0,IDBG)
C  NRMVNT IS NUMBER OF LVG SPACE ZONES(OTHER THAN BASEMENT) 
C    THAT VENT GOES THROUGH.
C 
C  HIR - CONVECTIVE HEAT TR COEF AT INSIDE SURF OF ROOF,BTU/HR-FT2-F
C  HAC - CONVECTIVE HEAT TR COEF AT ATTIC SIDE OF CEILING, BTU/HR-FT2-F
      READ(10, *)HIR,HAC 
C  IF IHCOLD = 0, H'S WILL BE CALC IN SUB: HC FROM STILL AIR VALUES 
C                 AS A FUNCT OF HT FLOW DIR. AND SURF. ORIENTATION
C                 IF HIBLWR>0., IT WILL BE USED AT WALLS WHEN BLOWER
C                 IS ON(TARP USED A VALUE OF 1.09--SEEMS HIGH RDF)
C                 ,BUT INDEP. OF BLWR STATE AND SURF-TO-AIR DT
C  IF IHCOLD = 1, H'S WILL BE CALC IN SUB: HC AS FUNCT OF BLOWER
C                 STATE AND SURF-TO-AIR DELTA T.  HIC,HIG,ETC ARE 
C                 MULTIPLIERS ON BUILT IN FUNCTIONS 
C  IF IHCOLD = 2 , THEN ALL H'S (HIG,HIW,HIC,ETC.) WILL BE
C                  USED AS IS.
C  NOTE:::: UNITS FOR THE H VALUES BELOW ARE BTU/HR-FT2-F
C          NOTE: SET HIC,H1F,HIW,H3B,HIG,H3F,H3FB = 1. OR OTHER
C                VALUE OF MULTIPLIER IF IHCOLD < 2 .  IF IHCOLD
C                =2, THE VALUES HIC,H1F,...WILL BE USED AS IS.
C  HIG   - 
C  HIW   - CONVECTIVE HEAT TR COEF AT INSIDE SURF OF EXTERIOR WALLS
C  HIC   - CONVECTIVE HEAT TR COEF AT INSIDE SURF OF CEILING
C  H1F   - CONVECTIVE HEAT TR COEF AT BASEMENT CEILING
C  H3F   - CONVECTIVE HEAT TR COEF AT LIVING-SPACE SIDE OF LVG SPC FLOOR
C  H3B   - CONVECTIVE HEAT TR COEF AT INSIDE SURF OF BASEMENT WALLS
C  H3FB  - CONVECTIVE HEAT TR COEF AT INSIDE SURF OF BASEMENT FLOOR
C  VOLCRW - VOLUME OF CRAWL SPACE, FT3
C  UWGR  - OVERALL HEAT TR COEF FOR AN UNDERGROUND WALL EXPOSED TO 
C          LIVING SPACE(DO NOT INCL FILM COEF ON SOIL-SIDE OF WALL),
C          BTU/HR-FT2-F
C  USLFL - OVERALL HEAT TR COEF FOR SLAB FLOOR EXPOSED TO LIVING SPACE,
C          BTU/HR-FT2-F
C  UWIND - OVERALL HEAT TR COEF FOR WINDOW GLASS SURFACE, BTU/HR-FT2-F
C  HAD   - CONVECTIVE HEAT TR COEF INSIDE DUCTS,BTU/HR-FT2-F
C  HOD   - CONVECTIVE HEAT TR COEF OUTSIDE DUCTS, BTU/HR-FT2-F
C  ASUP  - TOTAL SURFACE AREA OF SUPPLY DUCT, FT2
C  WSUP  - MASS OF SUPPLY DUCT, LBM
C  ARET  - TOTAL SURFACE AREA OF RETURN DUCT, FT2
C  WRET  - MASS OF RETURN DUCT, LBM
C  FSDIB - FRACTION OF SUPPLY DUCT IN BASEMENT OR OUTSIDE
C  FRDIB - FRACTION OF RETURN DUCT IN BASEMENT OR OUTSIDE
C  NRMVNT- NO. OF LIVING SPACE ZONES ABOVE THE BASEMENT THAT VENT
C          GOES THROUGH AND RECEIVE VENT HEAT LOSS
C  NATVNT- ATTIC NO. THAT VENT GOES THROUGH AND RECEIVES VENT HEAT LOSS
      READ(10, *) IHCOLD, HIG, HIW,
     +    HIC, H1F, H3F,        H3B,  H3FB, 
     +   VOLCRW,               UWGR, USLFL, UWIND,
     +   HAD, HOD, ASUP, WSUP, ARET, WRET, FSDIB, FRDIB,
     +   NRMVNT, NATVNT 
C  ATCVOL - NATC VALUES OF ATTIC VOLUMES, FT3
      READ(10,*)(ATCVOL(IA),IA=1,NATC)
C  ROMVOL - NROOM VALUES OF VOLUME OF AIR IN EACH ZONE, FT3     
      READ(10,*)(ROMVOL(NRM),NRM=1,NROOMS)
      IF(NRMVNT.LE.0.OR.NRMVNT.GT.2)THEN
         STOP 'STRCTL:NRMVNT MUST BE 1 OR 2'
         ENDIF
C  IRMVNT(I) IS LIVING SPACE ZONE NO. THAT VENT GOES THROUGH
C  FRCVNT(I) IS FRACTION OF LVG SPC VENT HEAT LOSS TO ZONE IRMVNT(I)
C 
      READ(10,*)(IRMVNT(IJ),FRCVNT(IJ),IJ=1,NRMVNT) 
      DO 142 J=1,NROOMS 
      NRM=NRMA(J) 
C  NRMBGW - NO. OF BELOW-GROUND WALLS IN THIS ZONE
      READ(10,*) NRMBGW(NRM)
C  AWGR - AREA OF BELOW-GROUND WALLS IN THIS ZONE      
      IF(NRMBGW(NRM).GT.0)READ(10,*)AWGR(NRM) 
      IF(NRMBGW(NRM).EQ.0)THEN
          WRITE(60,522)NRM
      ELSE
          WRITE(60,3020)NRMBGW(I),AWGR(I)
          ENDIF 
  142 CONTINUE
      DO 144 J=1,NROOMS 
      NRM=NRMA(J) 
C  NRMSLB - NO. OF SLAB FLOORS IN THIS ZONE      
      READ(10,*) NRMSLB(NRM)
C  ASLFL - AREA OF SLAB FLOOR IN THIS ZONE, FT2      
      IF(NRMSLB(NRM).GT.0)READ(10,*)ASLFL(NRM)
      IF(NRMSLB(NRM).EQ.0)THEN
          WRITE(60,523)NRM
      ELSE
          WRITE(60,3030)NRMSLB(I),ASLFL(I) 
      ENDIF 
  144 CONTINUE
      WRITE(60,525)
      WRITE(60, 3000) IHCOLD,HIG,
     +   HIW, HIR, HAC, HIC, H1F, H3F,        H3B,
     +           VOLCRW,               UWGR, USLFL, UWIND,
     +         HAD, HOD, ASUP, WSUP, ARET, WRET, FSDIB, FRDIB, NRMVNT,
     +   NATVNT 
      WRITE(60,3010)(IA,ATCVOL(IA),IA=1,NATC) 
      WRITE(60,3012)(NRM,ROMVOL(NRM),NRM=1,NROOMS)
C  GET FURNITURE DATA 
C  RHOFM - DENSITY OF FURNITURE MASS, LBM/FT3
C  CPFM  - SPECIFIC HEAT OF FURNITURE MASS, BTU/LBM-F
      READ(10,*)RHOFM,CPFM
      WRITE(60,533)RHOFM,CPFM
      DO 146 JT=1,NROOMS
      NRM=NRMA(JT)
C  THKFM - THICKNESS OF FURNITURE ELEMENTS ( USED TO CALC SURFACE AREA
C          OF FURNITURE), INCHES
C  XMFM  - MASS OF FURNITURE, LBM      
      READ(10,*)THKFM(NRM),XMFM(NRM)
      WRITE(60,534)NRM,THKFM(NRM),XMFM(NRM)
  146 CONTINUE
      CLOSE(10)
C 
C-----NORMAL EXIT 
      WRITE(60, 2010)
      IF(IDBG.NE.0)WRITE(60,526)(I,IZSET(I),I=1,NZW) 
      WRITE(60,527)NROOMS,NZN,NIZWS,2*NIZ
      CALL FLUSH(6)
      RETURN
C 
500   FORMAT (4 (A1, 1X), F10.0)
501   FORMAT (A1, 10A4) 
503   FORMAT (//1X,'INPUT DATA FOR ENCLOSURE ELEMENTS - - - - ', /, 
     +   ' COMPASS DIRECTIONS THAT ARE ALWAYS SHADED ARE = ', 4I5)
504   FORMAT (' ANGLE HOUSE IS ROTATED FROM CARDINAL COMPASS POINTS= ', 
     +   G13.5) 
505   FORMAT (' NUMBER OF ZONES= ', I5, /,
     +   ' NUMBER OF ROOF SECTIONS= ', I5/
     +   ' BASEMENT IS ZONE  ',I5/
     +   ' NUMBER OF ATTIC ZONES= ',I5) 
506   FORMAT (/1X,'ZONE NUMBER = ', I5,
     +   '  NUMBER OF ENCLOSURE ELEMENTS = ', I5, 
     +   ' CEILING HEIGHT = ', G13.5, ' FT'/
     + 10X, 'CONSTRUCT THAT TSTAT IS MOUNTED ON = ',I5) 
507   FORMAT (' ENCLOSURE ID= ', I5, ' ENCLOSURE NUMBER= ', I5) 
508   FORMAT (' THIS ENCLOSURE ELEMENT IS CONNECTED TO SPACE', I5, /, 
     +   ' CONSTRUCT NUMBER  = ', I5, /,
     +   ' HEIGHT AND LENGTH = ', 2G13.5, ' FT')
509   FORMAT ('  NEW CONSTRUCT NUMBER !!!', /,
     +   10X, 'NUMBER OF LUMPS= ', I5,
     +   '  DIRECTIONS ALWAYS SHADED ARE = ', 4I3)
510   FORMAT (10X, 'FOR LUMP NUMBER', I3, 
     +   '  K, DX, RHO, CP= ', 4G13.5)
512   FORMAT (10X, 'WIDTH OF LEAKAGE OPENING = ', G13.5, ' IN', /, 
     +   10X, 'HEIGHT OF LEAKAGE OPENING = ', G13.5,' IN',/,
     +   10X, 'HEIGHT FROM CENTER OF OPENING UP TO NEUTRAL PRESSURE',
     +        ' LEVEL = ',G13.5,' IN')
513   FORMAT (' EMISSIVITY/ABSORPTIVITY OF INNER AND OUTER SURFACE',
     1   ' OF ENCLOSURE= ', 2G13.5) 
514   FORMAT (' NUMBER OF WINDOWS= ', I5, 
     1   ' ROOF OVERHANG= ', G13.5, 'FT', 
     2   3X, 'HGT TO OVERHANG FROM TOP OF ENCLOSURE ELEMENT = ', G13.5, 
     3   'IN.') 
515   FORMAT (' WINDOW INDEX NUMBER = ', I5,
     1   ' HEIGHT AND WIDTH OF WINDOW= ', 2G13.5, ' FT', /, 
     2   10X, 
     3   'REVEAL AND HEIGHT FROM TOP OF WINDOW TO ROOF OVERHANG = ',
     4   2G13.5, ' IN.', /, 
     5   10X, 'WINDOW SHADING COEFFICIENT = ', G13.5) 
516   FORMAT (' ROOF SECTION INDEX NUMBER = ', I5, /, 
     1   10X, 'ORIENTATION ID = ', I5)
517   FORMAT (' ATTIC NUMBER THIS SECTION IS CONNECTED TO= ', I5, /,
     1   10X, 'CONSTRUCT NUMBER=', I5, ' AREA= ', G13.5, ' SQ FT', /, 
     2   ' PITCH ANGLE FROM HORIZONTAL= ', G13.5, /,
     3   10X, 'LONGWAVE EMISSIVITY/ABSORPTIVITY OF INNER AND OUTER'/
     4   10X,'SURFACE= ',2G13.5/10X,'SHORTWAVE (SOLAR) ABSORPTIVITY', 
     5   ' AT OUTER SURFACE= ',G13.5) 
518   FORMAT (/1X,' ****', 10A4)
519   FORMAT (/1X,' ID FOR ROOF SECTION= ', A4,5X,10A4) 
520   FORMAT (' IDX= ---- ', I4)
521   FORMAT ('  - - - - -  END OF ENCLOSURE INPUT DATA FOR THIS ZONE', 
     1   /, 
     2   '     NOW CONSOLIDATE ENCLOSURE ELEMENTS FOR THIS ZONE, ', 
     3   ' IF POSSIBLE', /) 
  522 FORMAT(/' NO BELOW GROUND WALLS IN LVG SPC ZONE ',I5)
  523 FORMAT(/' NO SLAB FLOOR IN LVG SPC ZONE ',I5)
  524 FORMAT(/1X,'*--*--*NOTE:MULTIPLE INTERIOR WALLS THAT ARENT'/
     +12X,'SEPARATING ZONES AND HAVE THE SAME CONSTRUCT NO. SHOULD'/
     +12X,'BE ENTERED CONSECUTIVELY SO THEY WILL GET CONSOLIDATED', 
     +' PROPERLY')
  525 FORMAT('  NOTE:::HIG,HIW,HIR,HAC,HIC,H1F,H3F, AND H3B'/ 
     +' ARE MULTIPLIERS ON BUILT IN NAT. CONV.CORRELATION'/ 
     +'  AND SO SHOULD BE INPUT = OR CLOSE TO 1.0. IF IRF'/ 
     +'  =0, HIR AND HAC ARE USED AS IS (INCL. RAD.COMPONENT)IN'/ 
     +'   THE ATTIC FOR H') 
  526 FORMAT((1X,'STRCTL:I,IZSET(I)= ',2I4))
  527 FORMAT(/1X,5(1H*),' NO. OF ZONES= ',I3, 
     +' VS MAX ZONES ALLOWED AS COMPILED= ',I3/ 
     +1X,5(1H*),'2 X NO. OF MIRROR-IMAGE ENCLOSURES= ',I3,
     +' VS MAX ALLOWED AS COMPILED(2 X NIZ)= ',I3)
  528 FORMAT(/1X,'STRCTL: INCR DIM OF IZWSS AND IZWSV', 
     +' IN CMDECKS AND XX OF NIZ=XX*NZN IN STRCTL'/ 
     +15X,'2 X NIZ IN STRCTL = ',I4)
  529 FORMAT(/1X, 40(2H- ))
  530 FORMAT(1X,40(2H- )) 
  531 FORMAT (' LONGWAVE EMISS/ABSORPT OF INNER AND OUTER SURFACE', 
     1   ' OF ENCLOSURE= ', 2G13.5/ 
     2' SHORTWAVE (SOLAR) ABSORPTIVITY OF OUTER SURFACE= ',G13.5) 
  532 FORMAT(1X,'ENCLOSURE ',I5,': CHANGED ID FROM ',I4,' TO ', 
     +I4,' SO THAT IWALLS '/
     +'  WILL BE USED TO CALC TEMPS OF LVG SPC/GARAGE WALL')
  533 FORMAT(1X,1H0,'FURNITURE DATA'/ 
     +' DENSITY, LB/FT3= ',G13.5/ 
     +' SPEC HEAT, BTU/LB-F= ',G13.5) 
  534 FORMAT((1X,'ZONE NO.= ',I4,' THICKNESS, INCHES = ',G13.5, 
     +' MASS IN ZONE, LB = ',G13.5/)) 
  
2010  FORMAT (' ********** END OF STRCTL INPUT **********') 
3000  FORMAT ('0', T2, 'IHCOLD= ',I3, T2, 'HIG   =', G13.5, 
     3   T2, 'HIW   =', G13.5, T24, 'HIR   =', G13.5, 
     4   T46, 'HAC   =', G13.5, T68, 'HIC   =', G13.5,
     5   T90, 'H1F   =', G13.5, T112, 'H3F   =', G13.5, /,
     6                         T24, 'H3B   =', G13.5, 
     8                          T112, 'VOLCRW=', G13.5, /,
     A   T46, 'UWGR  =', G13.5, T68, 'USLFL =', G13.5,
     B   T90, 'UWIND =', G13.5, 
     D   T46, 'HAD   =', G13.5, T68, 'HOD   =', G13.5,
     E   T90, 'ASUP  =', G13.5, T112, 'WSUP  =', G13.5, /,
     F   T2, 'ARET  =', G13.5, T24, 'WRET  =', G13.5, 
     G   T46, 'FSDIB =', G13.5, T68, 'FRDIB =', G13.5/
     +   T2, 'NRMVNT=',I7,6X, T24, 'NATVNT=',I7,6X) 
 3010 FORMAT(1X,'IA,ATCVOL= ',2(I4,G13.5))
 3012 FORMAT(1X,'NRM,ROMVOL= ',5(I4,G13.5)) 
 3020 FORMAT((1X,'ZONE NO. W/ BELOW-GRND WALL= ',I4,' WALL AREA= ', 
     +       G13.5/)) 
 3030 FORMAT((1X,'ZONE NO. W/ SLAB FLOOR= ',I4,' SLAB FLOOR ',
     +       'AREA= ',G13.5/))
 3040 FORMAT(/' MIRROR-IMAGE OF INTERIOR ENCLOSURE ELE NO. ',I4,
     +' IN ZONE ',I4/'  SET AS ELE NO. ',I4, ' IN ZONE ',I4)
 3050 FORMAT(/' MIRROR-IMAGE OF FLOOR ELE NO. ',I4,' IN ZONE ', 
     +I4/'  SET AS INTERIOR ENCLOSURE ELE NO. ',I4,' FOR CEILING ', 
     +'ELE IN ZONE ',I4)
 3060 FORMAT(/'YOU HAVE REPLACED CONSTRUCT NO. ',I4, 
     +' IN BLKDAT') 
      END 
