      SUBROUTINE STRRUN
C - - - FORMAL PARAMETERS FOR THIS SUBPROGRAM ARE IN COMMON BLKSV
C
C-----PERFORMS CALCULATIONS FOR THE START OF THE RUN
C
C
C-----CONSTANTS
CMDK NHBK
CMDK NHRO
CMDK NHRP
CMDK NOUTDY
CMDK NRF
CMDK NWN
CMDK NWL
CMDK NZN
CMDK NZN7
CMDK NZW
CMDK RHOAIR
CMDK SIGMA
C
C-----COMMON BLOCKS
CMDK ACHBQ
CMDK ACHLQ
CMDK ACND
CMDK BAR
CMDK BIDRUN
CMDK BLKBSF
CMDK BLKCM2
CMDK BLKGS1
CMDK BLKGS2
CMDK BLKOIL
CMDK BLKQS
CMDK BLKQGS
CMDK BLKRAD
CMDK BLKSV
CMDK BLKTM2
CMDK CITINF
CMDK COLLEC
CMDK DUCTSC
CMDK DUCTS2
CMDK DUCTS4
CMDK EBALA
CMDK ENCBK1
CMDK ENCBK2
CMDK ENCBLK
CMDK FANBLK
CMDK FLWSIZ
CMDK GASFC
CMDK HANDBK
CMDK HUMIDC
CMDK IBEV
CMDK INDIC1
CMDK IWETHR
CMDK IWLS
CMDK IZZQ
CMDK MRTBLK
CMDK MZON1
CMDK NCR
CMDK OUTPUT
CMDK PRT1
CMDK QACCMQ
CMDK QUAYCH
CMDK QUAYLE
CMDK ROOF
CMDK SHDF
CMDK SIMA
CMDK SOILB
CMDK STRUCA
CMDK SURFAR
CMDK TEMP1
CMDK TEMPB
CMDK TIMEB
CMDK TSTATC
CMDK TSTB4
CMDK UABAS
C
      CHARACTER*3 NSTT
      REAL  SHDRE (24), SHDRS (24), SHDRW (24), SHDVE (24), SHDVS (24)
      REAL  SHDVW (24), SHDWE (24), SHDWS (24), SHDWW (24)
C
      EQUIVALENCE (SHDVE,SHDFCT(1,1,1,1)),(SHDVS,SHDFCT(2,1,1,1)),
     +            (SHDVW,SHDFCT(3,1,1,1)),(SHDWE,SHDFCT(1,2,1,1)),
     +            (SHDWS,SHDFCT(2,2,1,1)),(SHDWW,SHDFCT(3,2,1,1)),
     +            (SHDRE,SHDFCT(1,3,1,1)),(SHDRS,SHDFCT(2,3,1,1)),
     +            (SHDRW,SHDFCT(3,3,1,1))
C     
C INPUTS IN NAMELIST CONTROL:  SEE DEFAULT VALUES SET IN BLKDAT.FOR
C  TWO METHODS FOR SOIL/SURFACE TEMPERATURE SPECIFICATION
C  1)  AFTG1, BFTG1....TEMP-FLOOR-SOIL= AFTG1*TODAVG+BFTG1
C      AWTG2, BWTG2....TEMP-WALL--SOIL= AWTG2*TODAVG+BWTG2
C  2)  TSOILF (1-12)...12 (MONTHLY/DAILY) FLOOR SOIL TEMPS
C      TSOILW (1-12)...12 (MONTHLY/DAILY) WALL  SOIL TEMPS
C  BARPSI - MEAN BAROMETER FOR RUN, PSI
C  DCTFLR - FRACTION OF DUCT HEAT LOSS THAT IS CONDUCTED UP THRU FLR
C  DEGRAD - DEGRADATION FACTOR FOR ENVELOPE INSULATION. APPLIED TO
C           INTERIOR NODE OF 3-NODE ENCLOSURE ELEMENTS, AND TO BOTH
C           NODES OF 2-NODE SYSTEMS (THERMAL CONDUCTIVITY IS DIVIDED
C           BY THIS NO.)
C  DST    - DAYLIGHT SAVINGS TIME INDICATOR 0 = NO, 1 = YES
C  EATTIC1, EATTIC2  ROOF UNDERSURFACE AND ATTIC FLOOR EMISSIVITIES
C  FAROOF & FAWLOD - RAD VIEW FACTORS FOR ROOF AND WALL (OUTSIDE)
C  HACUP, HACDN - MULTIPLIER ON HAC, THE CONVECTIVE HEAT TR COEF
C                 AT THE ATTIC-SIDE OF THE CEILING, FOR HEAT FLOW 
C                 UP OR DOWN FROM THE UPPER SURFACE OF THE CEILING.
C  HBKRNL - 'HANDBOOK REFERENCE NET LOAD'. USED AS FOLLOWS:
C            IF < 0 DON'T CALC HANDBOOK FACTORS (DEFAULT)
C                   QSUMS WILL BE PRINTED ON FILE TAPE9 WHEN HBKRNL<0.
C            IF = 0 THIS IS A BASELINE RUN (NET LOAD=HEAT DELIVERY)
C            IF > 0 THIS IS A RUN TO COMPARE TO BASELINE.
C  HIBLWR - CONVECTIVE COEF AT INTERNAL WALLS WHEN BLWR IS ON
C           AND THE ZONE DAMPERS ARE OPEN, BTU/HR-FT2-F (USED WHEN
C           IHCOLD=0 IF HIBLWR>0. (A VALUE OF 1.09 WAS USED IN THE
C           TARP CODE--SEEMS HIGH THOUGH(RDF)); OTHERWISE IT IS NOT
C           USED--SEE HC.FOR)
C  HIRUP, HIRDN - MULTIPLIER ON HIR, THE CONVECTIVE HEAT TR COEF
C                 AT UNDERSIDE SURFACE OF THE ROOF WITH UP AND DOWN
C                 HEAT FLOW
C  HRDY   - NO. OF HRS IN EACH DAY (USED TO SHORTEN RUN TO A FEW HRS
C           --ADD .001 TO THIS VALUE)
C  IAPRT - PRINT FLAG FOR ATTIC DATA - DEFAULT 0=NO
C  ICC   - = 1 CLOUD COVER USED TO COMPUTE SOLAR
C          = 0 TOTAL SOLAR RADIATION DATA AVAILABLE
C  ICOLL -  =0 DON'T COLLECT OR WRITE OUT DETAILED DATA 
C           =1 COLLECT AND WRITE OUT DETAILED DATA ON TAPE7 DURING
C              THE TIME PERIOD DEFINED IN NAMELIST INPCOLL BETWEEN
C              TSTART AND TSTOP (SEE FILE INPCOLL.DAT)
C  ICFIZB - =1 TO READ IN AND USE INTERZONE FLOWS CAUSED, BY THE BLOWER,
C              IN NAMELIST CFHZB BELOW
C  ICTRLZ - TEMPERATURE-CONTROLLED-ZONE INDICATOR(ONE VALUE FOR EACH ZONE)
C           =0 FOR FLOATING ZONE; =1 FOR CONTROLLED ZONE
C  IDRUN -  UP TO 4 CHAR RUN IDENTIFIER, I.E. FOR EX:  '1208'
C  IDUMPZ-  RESIDUAL HEAT IN HEAT EXCH OF FURNACE AND DUCTS WILL BE 
C           DUMPED TO THESE ZONES WHEN THERMOSTATS IN ALL ZONES GO OFF
C           (FOR EACH ZONE)  =0 FOR NO DUMP OF RESIDUAL,=1 FOR DUMP OF
C           HEAT FROM FURNACE WITH BLOWER AFTERRUN.  BLOWER AFTERRUN IS 
C           CONTROLLED BY FANTOF OR TIME3 (SEE NAMELIST INPGSF IN GASF)
C  IEDAY -  = JULIAN DAY OF THE YEAR ON WHICH TO END PROCESSING NSEQW = 2
C           AND THEREBY STOP THE RUN 
C  IFLOC -  = FURNACE LOCATION INDICATOR. ZONE DEFINITIONS
C             ALSO APPLY TO THE DUCT MODEL & TO QDUCTZ LOSSES
C             1) CONDITIONED SPACE          2) BASEMENT
C                OR CLOSET IN ZONE 1
C             3) CRAWL SPACE                4) ATTIC
C             5) FURNACE ENCLOSURE          6) GARAGE
C             7) OUTDOORS                   8 ATTIC NO. 2
C             9-12) CONDITIONED SPACE OR CLOSET IN ZONES 2-5
C  IGARAGT- = 0 NO ATTACHED GARAGE 
C           = 1 ATTACHED GARAGE (USE DEFAULT VALUES FOR GARAGE MODEL
C               FOR A HOUSE-A SINGLE-CAR GARAGE SET IN GARAG.FOR)
C           = 2 ATTACHED GARAGE (USE NEW VALUES READ FROM TAPE17 IN
C               NAMELIST GAR IN GARAG.FOR)
C     NOTE: TGARAG IS READ ALONG WITH WEATHER DATA IN WETHR.FOR 
C           WITH NSEQW=2 FOR A VALIDATION RUN.
C  IGRND  -  = 0 (DEFAULT) USE SOIL TEMPS SET FOR EACH DAY (SEE
C                 TSOILF AND TSOILW)
C            = 1 USE GROUND HEAT TRANSFER MODEL IN FILE GROUND.FOR
C  IPCOOL -  =1 TO READ AND USE ATTACHED SPACE TEMP FROM TAPE45 IN WETHR.
C               DURING COOLING.  =0, OTHERWISE.
C  IPL1(I), IPL2(I) - PRINT OUT LOAD DATA BETWEEN TIMESTEPS IPL1(I)
C                     AND IPL2(I), I=1 TO 10 VALUES
C  ISDAY - = JULIAN DAY ON WHICH TO START PROCESSING NSEQW = 2 DATA.
C             RUN STARTS ON THIS JULIAN DAY.
C  ISHDR- =1 TO READ SHDNML NAMELIST WITH HOURLY SHADING DATA;=0,OTHERWISE
C  ISKY -    SKY RADIATION COUPLING (1=USE IT, 0=IGNORE IT) DEFAULT=0
C  IWALS - =0 SOLAR CALC ON OUTSIDE WALLS FOR EACH COMPAS DIRECTION
C          =1 SOLAR CALC ON EACH CONSOLIDATED OUTSIDE-WALL ELEMENT
C            (=1 IS NOT FEASIBLE WITH A 640K PC..DATOUT IS TOO BIG!
C             WITHOUT SHADING, ANSWER WILL BE THE SAME ANYWAY)
C  IWAT -  INTERNAL MOISTURE LOAD INPUT OPTION SELECTOR
C          =1  ORIGINAL OPTION (WINTL--24 AVE HOURLY VALUES - DEFAULT)
C          =2  ALTERNATE DEFINITION OF INTERNAL MOISTURE LOATING:
C              24 VALUES OF WT WILL BE READ FOLLOWING WINTL VALUES.
C              WT VALUES ARE TIME OF YEAR + 24 AT THE CHANGE TO THE
C              NEXT WINTL VALUE; I.E. WINTL(1) VALUE WILL BE USED
C              UNTIL TINDEX EXCEEDS THE VALUE OF WT(1). THEN WT(2)
C              WILL BE USED UNTIL TINDEX EXCEEDS THE VALUE OF WT(2),ETC.
C              NOTE THAT TINDEX BEGINS AT JULIAN DAY(AT START)+0.
C  IWATER -   DEBUG PARAMETER FOR HUMIDITY CALCULATIONS
C             IWATER=0 NO EXTRA OUTPUT (DEFAULT)
C             IWATER>0 IWATER LINES OF OUTPUT(120 LINES MAX)
C  I33T36  =1 TO WRITE HROUT ON TAPE33, HRPRT ON TAPE34,
C             OUTDY ON TAPE35, AND SEASON ON TAPE36 (DEFAULT=0)
C  NDAYM - NO. OF DAYS TO BE RUN FOR EACH MONTH 
C          **WITH NSEQW=2, SET = 1 TO GET SUMMARY DATA PRINTED FOR
C            EACH DAY (AS USED IN VALIDATION RUNS).
C          **WITH NSEQW = 3 (WITH COMPRESSED WEATHER DATA READ
C            IN WWEATH), NDAYM MUST BE EQUAL TO NO. OF DAYS OF
C            WEATHER IN ONE MONTH OF DATA ON THE COMPRESSED 
C            WEATHER DATA FILE (PITT.DAT, MPLS.DAT,ETC) NOT INCLUDING
C            ANY PRECONDITIONING DAY.  
C  NDPRE - NO. OF PRECONDITIONING DAYS ON WEATHER DATA FILE (PITT.DAT..)
C  NDYRI - DAY OF YEAR USED FOR SOLAR CALC.  = MIDWAY BETWEEN ISDAY
C          AND IEDAY FOR VALIDATION RUN.
C          FOR HANDBOOK RUNS WITH NSEQW=3:   = -1 TO USE DAY OF YEAR
C          AT 21ST DAY OF MONTH IN A RUN WITH COMPRESSED WETHR DATA.
C          = -2 TO USE DAY OF YEAR CALCULATED FROM THE THE MONTH AND
C          DAY ON WEATHER DATA.  NOTE IF YOU ONLY RUN 4 DAYS/MONTH WITH
C          COMPRESSED WEATHER DATA, YOU SHOULD USE NDYRI=-2!
C  NMONTH - NO. OF MONTHS TO RUN. 
C  NMNPRE - NO. OF PRECONDITIONING MONTHS FOR GROUND PRECOND(W/ IGRND=1)
C  NREP   - NO. OF TIMES TO REPEAT ONE DAYS WORTH OF WEATHER DATA
C            (DEFAULT IS 0)
C  NSEQG = 0, THERMOSTAT CONTROL OF GAS VALVE
C        = 1, EVENT FILE OVERRIDE OF GAS VALVE CONTROL (NEVER USED!)
C  NSEQW = WEATHER DATA WITH OPTIONS:
C        = 0, CARRIER-STYLE RANDOM-ACCESS WEATHER DATA ON TAPE20
C        = 1, (NMONTH*NDAYM) DAYS OF SEQUENTIAL WEATHER DATA ON TAPE40
C             INCLUDING NDPRE DAYS OF PRECONDITIONING DATA
C        = 2, MEASURED HOUSE DATA (LESS THAN HOURLY INTERVALS-SEE WETHR)
C        = 3, COMPRESSED WEATHER DATA; HANDBOOK STYLE (SEE WWEATH)
C  NSUBR -  NUMBER OF SUBDIVISIONS FOR ROOF TIME INTEGRATION
C           DTIME (ROOF) = (LARGE TIME STEP)/NSUBR
C  PEDLO -  PERCENT OF EXCESS DUCT LEAKAGE (PSUPL-PRETL) THAT
C           GOES OUTSIDE, THE REST GOES UPSTAIRS
C  PLOADS-  PRINT LOADS AT END OF EVERY HOUR? (TRUE/FALSE)
C  PRETL -  PERCENT OF FURNACE MASS FLOW LEAKED INTO RETURN DUCT
C           FROM BASEMENT. FLOW AT BASEMENT TEMPERATURE
C  PSUPL -  PERCENT OF FURNACE MASS FLOW LEAKED FROM SUPPLY DUCT
C           TO BASEMENT. FLOW AT BONNET TEMPERATURE
C  RETDTYP - RETURN DUCT TYPE, "CARRIER" ONLY
C  RQINT  - FRACTION OF INTERNAL HEATING LOAD(QINTL) THAT GOES TO 
C           EACH ZONE (NROOM VALUES)
C  RWINT  - FRACTION OF INTERNAL MOISTURE LOADING(WINTL) THAT GOES TO 
C           EACH ZONE (NROOM VALUES)
C  SRCEAB -  FRACTION OF BASEMENT AIR THAT COMES FROM LIVING SPACE
C  SUPDTYP - SUPPLY DUCT TYPE, "CARRIER" OR "BATTELLE" (USE "BATTELLE")
C  TBASI  - INITIAL BASEMENT AIR TEMP (USED AS A FIXED BASEMENT AIR
C           TEMP DURING GROUND PRECONDITIONING IF IGRND=1), F
C  TENCLO - 12 MEAN-DAILY FURNACE ENCLOSURE TEMPERATURES FOR EA MONTH,F.
C           TODDB IS ASSUMED IF TENCLO IS NOT INPUT.
C  TMEBLS - TIME AT WHICH ZONE-BY-ZONE ENERGY BALANCE STARTS,HR
C           (DEFAULT IS 0. HOURS)
C  TOFFSET-  ODDB TEMPERATURE OFFSET FOR SENSITIVITY STUDIES,F
C  TSOILF,TSOILW - SEE TOP OF THIS LIST AFTER AFTG1!
C  WSHADE - WINDOW SHADE FACTOR (FEJ 4/85)
C
      NAMELIST/CONTROL/ AFTG1, AWTG2 , BARPSI, BFTG1 , BWTG2,
     + DCTFLR, DEGRAD, DST ,EATTC1, EATTC2, FAROOF, FAWLOD,
     + HACDN, HACUP, HBKRNL, HIBLWR, HIRDN , HIRUP , HRDY  ,
     + IAPRT , ICC   , ICOLL, ICFIZB, ICTRLZ, IDRUN, IDUMPZ,
     + IEDAY, IFLOC, IGARAGT, IGRND , IPCOOL, IPL1, IPL2,
     + ISDAY , ISHDR,  ISKY, IWALS , IWAT , IWATER, I33T36, NDAYM,
     + NDPRE , NDYRI , NMONTH, NMNPRE, NREP  ,
     + NSEQG , NSEQW , NSUBR, PEDLO , PLOADS, PRETL, PSUPL ,
     + RADSFL, RETDTYP, RQINT , RWINT, SRCEAB, SUPDTYP,
     + TBASI, TENCLO, TMEBLS, TOFFSET, TSOILF, TSOILW, WSHADE
C     
C INPUTS IN NAMELIST CFHZB:
C  ICFIZB - =1 TO USE CFHZB1,2,3,4 INTERZONE FLOWS
C         THESE INTERZONE FLOWS SUPERCEDE INTERZONE FLOWS(CFHIZ VALUES)
C         SET IN SUBPROGRAM DCTFLW.  THEY ARE USED IN QIZSET.
C         SEE QIZSET FOR BETTER EXPLANATION AND USE OF THESE FLOWS
C            (WORD IZ BELOW MEANS INTERZONE)
C  CFHZB1 & 2 - IZ FLOWS IN FORWARD DIR--(1-2)--W/ BLWR ON AND OFF
C  CFHZB3 & 4 - IZ BACKFLOWS--EX.(2-1)--W/ BLWR ON AND OFF
C
      NAMELIST/CFHZB/CFHZB1,CFHZB2,CFHZB3,CFHZB4
C      
C INPUTS IN NAMELIST SHDNML:
C  SHDR_X - SHDFCT FOR ROOF WHERE X IS E, S, OR W
C  SHDV_X - SHDFCT FOR WALLS WHERE X IS E, S OR W
C  SHDW_X - SHDFCT FOR WINDOWS WHERE X IS E, S OR W
C NOTE: VALUES IN SHDR_X,SHDV_X, & SHDW_X GET PLACED IN A SINGLE 
C       MULTIDIMENSIONAL ARRAY SHDFCT VIA AN EQUIVALENCE STATEMENT
C       SHDFCT (I, J, K, L) - SHADING FACTORS FOR DIRECT SOLAR
C         I=1 TO 3 FOR E, S OR W(NOTE: NORTH N OMITTED TO SAVE SPACE!)
C         J=1 FOR WALLS, 2 FOR WINDOWS, 3 FOR ROOF
C         K=1 TO 5 ZONE NO. ( NOT USED AS YET TO SAVE EXECUTION MEMORY)
C         L=1 TO 24 FOR EACH HOUR OF THE DAY
C
      NAMELIST/SHDNML/SHDRE,SHDRS,SHDRW,SHDVE,SHDVS,SHDVW,SHDWE,
     +                SHDWS,SHDWW
C
C-----INITIALIZATIONS
      DATA NCTY   /1/
      DO 1 IHR=1,24
      SHDRE(IHR)=1.
      SHDRS(IHR)=1.
      SHDRW(IHR)=1.
      SHDVE(IHR)=1.
      SHDVS(IHR)=1.
      SHDVW(IHR)=1.
      SHDWE(IHR)=1.
      SHDWS(IHR)=1.
      SHDWW(IHR)=1.
    1 CONTINUE
C
C-----READ PHYSICAL DATA ABOUT STRUCTURE
      WRITE(*,*)' --> PROCESSING STRUCTURE DATA(IN STRCTL),PLS WAIT....'
      CALL STRCTL(IDBG,NZONG)
C  - -  CALCULATE LUMP CONSTANTS
C
C----- INPUT DATA
      WRITE(60,*) ' '
C
      OPEN(30,FILE='TAPE30',STATUS='OLD',IOSTAT=IO30)
      IF(IO30.NE.0)THEN
         WRITE(60,*)' STRRUN: CANT OPEN TAPE30 WITH NAMELIST CONTROL'
         STOP ' STRRUN: CANT OPEN TAPE30 WITH NAMELIST CONTROL'
         ENDIF
C
C  SEE ABOVE COMMENTS FOR VARIABLES READ IN CONTROL,CFHZB,&SHDNML
      READ(30,CONTROL,END=999)
C      WRITE(60,CONTROL)
      IF(ICFIZB.GT.0)THEN
        REWIND 30
        READ(30,CFHZB,END=998)
      ENDIF
      IF(ISHDR.EQ.1)THEN
        REWIND 30
        READ(30,SHDNML,END=997)
      ENDIF
      CLOSE(30)
      WRITE(60,*) '  RUN IDENTIFIER= ',IDRUN
C  SET VIEW FACTOR FOR ROOF TO INCLUDE RADIATION TO SKY AT TODDB,
C   IF NO SKY RADIATION IS CALCULATED.
      IF(ISKY.EQ.0)FAROOF=1.
C
      DO 2 JT=1,NROOMS
      ACMAX(JT)=0.
    2 ACMIN(JT)=9.99E10
      VBMAX=0.
      VBMIN=9.99E10
C
C    DO THE EQUIVALENT OF BELOW BY EQUIVALENCING ABOVE
C  LOAD SOLAR SHADING FACTORS FOR WALLS (J=1), WINDOWS (J=2)
C                           AND FOR ROOF (J=3)
C  FOR E (I=1), S (I=2) AND W (I=3) SIDES OF THE HOUSE
C
C***********************************************************************
C********************* DO ONLY FOR ZONE 1 NOW **************************
C***********************************************************************
C      DO 3 IHR=1, 24
C         I=1
C         J=1
C         SHDFCT (I, J, 1, IHR)=SHDVE (IHR)
C         J=2
C         SHDFCT (I, J, 1, IHR)=SHDWE (IHR)
C         J=3
C         SHDFCT (I, J, 1, IHR)=SHDRE (IHR)
C         I=2
C         J=1
C         SHDFCT (I, J, 1, IHR)=SHDVS (IHR)
C         J=2
C         SHDFCT (I, J, 1, IHR)=SHDWS (IHR)
C         J=3
C         SHDFCT (I, J, 1, IHR)=SHDRS (IHR)
C         I=3
C         J=1
C         SHDFCT (I, J, 1, IHR)=SHDVW (IHR)
C         J=2
C         SHDFCT (I, J, 1, IHR)=SHDWW (IHR)
C         J=3
C         SHDFCT (I, J, 1, IHR)=SHDRW (IHR)
C 3        CONTINUE
C
C     CONVERT PERCENT TO DECIMAL
      PSUPL=PSUPL/100.
      PRETL=PRETL/100.
      PEDLO=PEDLO/100.
C
      BARRAT=BARPSI/14.7
      U45=RHOAIR * 60.
      DO 4 I=1,NZN7
    4 FLOC(I)=0
      IF (NSEQW.NE.0) THEN
         NSTT='NEW'
      ELSE
         NSTT='OLD'
      END IF
      QHINPT=0.0
      IF (NSEQW.NE.0) THEN
         NREP=0
         WRITE(60, *) 'RESET NREP.    NREP, NSEQW=', NREP, NSEQW
      END IF
C
C-----READ INPUT DATA
C       ICITY  - CITY CODE NAME(4 CHARACTERS AT COLUMN 1)
C       INAME  - STRUCTURE CODE NAME(8 CHAR AT COL 11)
C       IDES   - PROBLEM DESCRIPTION(40 CHAR AT COL 21)
      READ(5, 500) ICITY, INAME, IDES
      WRITE(60,  501) ICITY, INAME, IDES
C-----GET CITY DATA
      OPEN(4,FILE='TAPE4',STATUS='OLD',IOSTAT=IO4)
      IF(IO4.NE.0)THEN
        WRITE(60,*)' STRRUN: CANT OPEN TAPE4 WITH CITY DATA'
        STOP ' STRRUN: CANT OPEN TAPE4 WITH CITY DATA'
        ENDIF
C        
C  JCITY - CITY NAME (4 CHAR AT COL 1), MUST AGREE W/ ICITY READ ABOVE)
C  STM   - TIME ZONE CODE (EST,CST,MST,PST,YST,ANST--4 CHAR AT COL 11)
C  DNLAT - LATTITUDE OF CITY(NORTHERN HEMISPHERE ONLY), DEG
C  DLONG - LONGITUDE OF CITY(FROM GREENWICH), DEG
C  ALT2  - ALTITUDE OF CITY(ABOVE SEA LEVEL), FT
C  CLEAR - CLEARNESS NO. FOR CITY, (0 - 10)
      READ(4,509)JCITY
10    READ(4,  502, END=170) JCITY, STM, DNLAT, DLONG, ALT2, CLEAR
      IF (ICITY.NE.JCITY) THEN
         NCTY=NCTY+1
         GO TO 10
      END IF
      CLOSE(4)
C
C-----NSUBDV - NUMBER OF TIME INCREMENTS FOR INNER TIME LOOP.
C              TIMESTEP OF INNER TIME LOOP IS DTIME(READ BELOW)/NSUBDV
C-----NINC   - ITERATION PRINT INCREMENT FOR 3RD DAY (0 = NONE)
C-----MODE   - 1 - AUTOMATIC HEATING AND COOLING
C-----         2 - COOLING ONLY
C-----         3 - HEATING ONLY
C-----         4 - NON-AUTOMATIC HEATING AND COOLING
C-----IDEBUG - NUMBER OF 1ST / 2ND DAY ITERATIONS TO BE PRINTED
C-----INPRT  - 1 - PRINT DATA FROM STRUCTURE / WEATHER FILES
C-----IDAYMN - > 0, "MONTHLY" SUMMARIES ARE PROVIDED FOR EACH DAY
C-----IQPRT  - 1 - PRINT HOURLY LOAD SUMMARY
C-----ITER   - NUMBER OF ITERATIONS OF HUMIDIFIER TO BE PRINTED
      READ(5, *) NSUBDV, NINC, MODE, IDEBUG, INPRT,
     +   IDAYMN, IQPRT, ITER
C
      IF (NMONTH.EQ.0 .OR. NDAYM.EQ.0) THEN
         WRITE(60, *) 'NMONTH AND NDAYM MUST BE SET IN ',
     +      'NAMELIST CONTROL'
         STOP ' STRRUN: NMONTH AND NDAYM MUST BE SET IN NMLST CONTROL'
      END IF
      NDAYY=NMONTH*NDAYM
C-----IMEAN    < 0 = CALC MEAN DAY WITH READ IN ODDB / RELHUM
C              = 0 = CALC MEAN DAY WITH CALC ODDB / RELHUM
C              > 0 = CALC MEAN, MAX, MIN AND WEIGHTED MONTHLY TOTALS
C            ONLY =0 USED BY BATTELLE!
C-----ITHERM    1 = AVERAGE WALL AND ROOM TEMP FOR THERMOSTAT
C-----NOSUN     1 = NO SOLAR LOADS INCLUDED
C-----ICOMF     1 = NO COMFORT INDEX PRINTED
C-----IEVPRT     1 = PRINT TIME(MIN) AT EVENTS FOR BURNER, BLOWER,
C                   AND DAMPER EVENTS AND TI'S ON TAPE3
C-----IBPRT    1 = PRINT TIME(HOUR) AT BURNER EVENTS ON TAPE51
C
      READ(5, *) IMEAN, ITHERM, NOSUN, ICOMF, IEVPRT, IBPRT
C                OPEN TAPES 3 AND 51 ?      
      IF(IEVPRT.GT.0)THEN
        OPEN(3,FILE='TAPE3',STATUS='UNKNOWN',IOSTAT=IO3)
        IF(IO3.NE.0)THEN
          WRITE(60,*)' STRRUN: PROBLEM WITH OPENING TAPE3,IO3=',IO3
          STOP ' STRRUN: TAPE3 BAD!!!'
        ENDIF
        WRITE(3,534)
      ENDIF
      IF(IBPRT.GT.0)THEN
        OPEN(51,FILE='TAPE51',STATUS='NEW',IOSTAT=IO51)
        IF(IO51.NE.0)THEN
          WRITE(60,*)' STRRUN: PROBLEM WITH OPENING TAPE51,IO51=',IO51
          STOP ' STRRUN: TAPE51 BAD!!!'
        ENDIF
      ENDIF
C        
      IF(ICOMF.NE.1)WRITE(60,*)' NOTE:ICOMF <> 1, NOT AVAILABLE'
      ICOMF = 1
      IF (NSEQW.GT.0 .AND. IMEAN.GE.0) THEN
         WRITE(60, *) 'SP43 INPUT WARNING....NSEQW, IMEAN=',
     1      NSEQW, IMEAN
         WRITE(60, *) 'IMEAN >=0 NOT IMPLEMENTED FOR NSEQW > 0'
      END IF
      IF (ITER.GT.IDEBUG) ITER=IDEBUG
      WRITE(60,  503) NSUBDV, NINC, MODE, IDEBUG, INPRT,
     1   NMONTH, NDAYM, NDAYY, IQPRT, ITER
      WRITE(60,  504) IMEAN, ITHERM, ICITRD, NOSUN, ICOMF
      IF (NOSUN.EQ.1) WRITE(60,  505)
      ILINES=3
      IF (NDPRE.EQ.0) ILINES=2
      IF (IDEBUG.GT.0) ILINES=1
C-----IFW (N) = 1 READ 24 VALUES OF WEATHER DATA AVGES (N, I) FROM
C                 TAPE5.  THESE INPUTS MUST BE LAST ENTRIES ON TAPE5
C                 IN ORDER DISCUSSED BELOW!   
C                
C  IFW(3)=1,READ 24 VALUES OF TOTAL HORIZ SOLAR RADIATION (SEE BELOW)
C  IFW(1)=1,READ 24 VALUES OF OUTDOOR DRY BULB TEMP (SEE STRMON)
C  IFW(2)=1,READ 24 VALUES OF WET BULB TEMP (SEE STRMON)
C  IFW(4)=1,READ 24 VALUES OF WIND SPEED (SEE STRMON)
      READ(5, *) IFW
      IFWL=0
      DO 30 I=1, 5
         IF (IFW (I).GT.0) IFWL=1
30       CONTINUE
      IF (IFWL.GT.0) NSTT='NEW'
      IF (NSEQW.EQ.0) OPEN (20, STATUS=NSTT, FILE='TAPE20',
     1   ACCESS='DIRECT', FORM='UNFORMATTED', RECL=185)
      IF (IFWL.GT.0 .AND. IMEAN.GT.0) IMEAN=0
      IF (IFWL.GT.0) WRITE(60,  506) IFW
C      
C  MONTH - NUMERICAL NUMBER OF EACH MONTH TO BE RUN (NMONTH
C            VALUES -- TO RUN FEB AND MAR, ENTER 2,3 FOR EXAMPLE)
      READ(5, *) (MONTH (I), I=1, NMONTH)
      IF (MODE.EQ.4) THEN
C      
C  MONCS - STARTING MONTH FOR COOLING (5 IS MAY, FOR EXAMPLE)
C  MONCE - ENDING MONTH FOR COOLING
C  MONHS - STARTING MONTH FOR HEATING
C  MONHE - ENDING MONTH FOR HEATING
         READ(5, *) MONCS, MONCE, MONHS, MONHE
         WRITE(60,  507) MONCS, MONCE, MONHS, MONHE
      END IF
      WRITE(60,  508) (MONTH (I), I=1, NMONTH)
      WRITE(60, *) (CMONTH (MONTH (I)), I=1, NMONTH)
      DO 40 IMO=1, 12
         H2ON (IMO)=IMO
         H2ON (IMO+12)=IMO+12
40       CONTINUE
C
      DO 60 I=1, NOUTDY
         SEASUM (I)=0.
60       CONTINUE
      SEASUM (44)=999.
C  COMFTS IN BLKSV WAS DIMENSIONED (11,21) BEFORE DEACTIVATED BY RDF
C      DO 71 J=1, 21
C         DO 70 I=1, 11
C            COMFTS (I, J)=0.
C 70          CONTINUE
C 71       CONTINUE
C-----READ IN FURNACE DATA
      WRITE(60,  512)
C  
C  SET THE NUMBER OF HEAT EXCHANGER NODES ALONG THE GAS FLOW PATH(NSUB)      
      NSUB=3
C  SET THE NUMBER OF VENT SECTIONS(NS)      
      NS=5
C      
C  NCELLS- NO. OF CLAMSHELLS OR PARALLEL PATH THROUGH THE GAS-SIDE OF
C          THE FURNACE HEAT EXCHANGER
C  IDAMP - =1 FOR NATURAL-DRAFT(OR ATMOSPHERIC) FURNACE WITH A
C             FLUE DAMPER; =0, OTHERWISE
C  IFAN  - =1 FOR POWER(OR INDUCED DRAFT) FURNACE; =0,OTHERWISE
C  IOIL  - =0 MEANS YOU HAVE AN OIL BURNER COMBUSTION CHAMBER (NOT
C          CHECKED AT BATTELLE!)      
C  IDIRCT- =1 FOR FURNACE WITH DIRECT OUTDOOR VENT FOR COMBUSTION
C          AND RELIEF AIR; =0, OTHERWISE
C  IH2O  - =1 FOR WATER HEATER PRESENT WITH ITS VENT ATTACHED TO THE
C          MAIN VENT DIRECTLY ABOVE THE FLUE DAMPER; =0,OTHERWISE.
C  ICL   - =1 IF THE POWER-DRAFT(OR INDUCED-DRAFT FAN RUNS ONLY WHEN
C          THE BURNER IS ON; =0 IF THE POWER DRAFT(OR INDUCED DRAFT)
C          FAN RUNS CONTINUOUSLY.
      READ(5, *) NCELLS, IDAMP, IFAN, IOIL, IDIRCT, IH2O, ICL
      WRITE(60,  513) NCELLS, IDAMP, IFAN, IOIL, IDIRCT, IH2O, ICL
C
C    THREE SETS OF VALUES OF THE FOLLOWING:
C  D(I)   - INSIDE SPACING BETWEEN GAS-SIDE OF CELL WALLS, FT
C  XL(I)  - HEIGHT OF CELL SECTION, FT
C  AHX(I) - SURFACE AREA OF CELL SECTION, FT2
C  HRAD(I)- HEAT TR COEF FOR RADIATION FROM CO2 & H2O IN GAS,
C           BTU/HR-FT2-F
      READ(5, *) (D (I), XL (I), AHX (I), HRAD (I), I=1, NSUB)
      WRITE(60,  514) (D (I), XL (I), AHX (I), HRAD (I), I=1, NSUB)
C
C   FOLLOWING ARE SPECS FOR CLAM-SHELL HEAT EXCHANGER:
C  CPM  - SPECIFIC HEAT OF THE CELL WALL MATERIAL, BTU/LBM-F
C  RHOMT- DENSITY X THICKNESS OF CELL WALL MATERIAL, LBM/FT2
C  BHX  - DEPTH OF CELL, FT
C  AIN  - GEOMETRIC RATIO FOR COMBUSTION-AIR-FLOW DECAY FOR CLOSED
C         FLUE DAMPER WITH BLOWER OFF (NOT USED AT BATTELLE).
C  AOUT - GEOMETRIC RATIO FOR COMBUSTION-AIR-FLOW DECAY FOR CLOSED
C         FLUE DAMPER WITH BLOWER ON (NOT USED AT BATTELLE).
C  ADIL - RELIEF AIR INLET AREA, FT2
C  DCELL- CENTERLINE DISTANCES BETWEEN CELLS, FT
C  ZKBEND- NO. OF VELOCITY HEADS LOST IN ALL 90 DEG BENDS IN VENT
C  WGMIN - MINIMUM FLOW THROUGH CELLS WITH BURNER OFF, FOR FLUE
C          DAMPER ONLY (SET TO LARGE VALUE TO NULIFY ANY VALUE ENTERED
C          FOR AIN OR AOUT)
C  PRTLD - PART LOAD FIRING FRACTION CONTROLLED BY SECOND STAGE
C          STAGE OF THERMOSTAT. =1 FOR NO PART LOAD (NOT CHECKED OUT
C          BY BATTELLE)
C  DH2O  - INSIDE DIAMETER OF WATER HEATER VENT, FT
C  XLH2O - LENGTH OF WATER HEATER VENT, FT
C  THG   - FLUE GAS TEMPERATURE LEAVING OPERATING WATER HEATER BEFORE
C          MIXING WITH BASEMENT RELIEF AIR, F
C  QHINPT- WATER HEATER FIRING RATE, BTU/HR
      READ(5, *) CPM, RHOMT, BHX, AIN, AOUT,  ADIL, DCELL,
     +   ZKBEND, WGMIN, PRTLD, DH2O, XLH2O, THG, QHINPT
      WRITE(60,  514) CPM, RHOMT, BHX, AIN, AOUT, ADIL,
     +   DCELL, ZKBEND, WGMIN, PRTLD, DH2O, XLH2O, THG, QHINPT
C
C  CPMV(I) - SPECIFIC HEAT OF MATERIAL IN VENT SECTION I , BTU/LBM-F
C  RHOMV(I)- DENSITY X THICKNESS OF MATERIAL IN VENT SECTION I, LBM/FT2
      READ(5, *) (CPMV (I), RHOMV (I), I=1, 6)
      WRITE(60,  514) (CPMV (I), RHOMV (I), I=1, 6)
C
C  DGAPHT- SPACING BETWEEN GAS-SIDE WALLS FOR HEAT TRANSFER IN THE
C          LAST DOWNSTREAM CELL OF CLAMSHELL HEAT EXCHANGER (ACCOUNTS
C          FOR ENHANCEMENT DUE TO V-TYPE BAFFLE, FT
C  TOLDH - TOLERANCE FOR GAS MOLAR ENTHALPY CONVERGENCE (USE 0.1)
C  ZHX   - MULTIPLIER ON CONVECTIVE HEAT TR COEF FOR GAS-SIDE OF CELL
C          FOR PERIODS 1 AND 2 
C  ZA    - MULTIPLIER ON CONVECTIVE HEAT TR COEF FOR AIR-SIDE OF CELL
C          FOR PERIODS 2 AND 3 
C  ZAVB,ZAVH,ZAVA  - MULTIPLIER ON CONVECTIVE HEAT TR COEF FOR OUTSIDE
C          OF VENT IN BASEMENT, LIVING SPACE, AND ATTIC
C  ZVT   - NO. OF VELOCITY HEADS LOST IN FURNACE STACK OUTLET, INCLUDING
C          1.0 VELOCITY HEAD FOR STATIC PRESSURE CONVERSION
      READ(5, *)  DGAPHT, TOLDH, ZHX, ZA, ZAVB, ZAVH, ZAVA, ZVT
      WRITE(60,  514) DGAPHT, TOLDH, ZHX, ZA, ZAVB, ZAVH, ZAVA, ZVT
C
C  ZHX34 - MULTIPLIER ON CONVECTIVE HEAT TR COEF FOR GAS-SIDE OF
C          CELL FOR PERIODS 3 AND 4 ONLY
C  ZA14  - MULTIPLIER ON CONVECTIVE HEAT TR COEF FOR AIR-SIDE OF
C          CELL FOR PERIODS 1 AND 4 ONLY
C  AFCL  - CLEARANCE AREA IN CLOSED FLUE DAMPER, IN2
      READ(5, *) ZHX34, ZA14, AFCL
      WRITE(60,  514) ZHX34, ZA14, AFCL
C  SET FURNACE LOCATION PARAMETER
      FLOC (IFLOC)=1
      WRITE(60, *) 'IFLOC, FLOC...', IFLOC, FLOC
      ICL1=1-ICL
      IDIRCT1=1-IDIRCT
      XM=0.0
      SOOT=1.0
      THETA=0.
      THET1=0.
      PUMPW=0.0
      IF (IOIL.NE.0) THEN
C
C  AC    - SURFACE AREA OF COMBUSTION CHAMBER, FT2
C  DC    - DIAMETER OF COMBUSTION CHAMBER, FT
C  CC    - SPECIFIC HEAT OF COMBUSTION CHAMBER WALL MATERIAL, BTU/LBM-F
C  RHOC  - DENSITY OF COMBUSTION CHAMBER WALL MATERIAL, LBM/FT3
C  AM    - SURFACE AREA OF CELL UP TO TOP OF COMBUSTION CHAMBER, FT2
C  XM    - HEIGHT OF CELL UP TO TOP OF COMBUSTION CHAMBER, FT
C  HI    - CONVECTIVE HEAT TR COEF INSIDE CHAMBER, BTU/HR-FT2-F
C  EMISSG- EMISSIVITY OF GAS AND PARTICULATE INSIDE COMBUSTION CHAMBER
C  ALPHG - ABSORPTIVITY OF GAS INSIDE COMBUSTION CHAMBER
C  EMISC - EMISSIVITY OF COMBUSTION CHAMBER WALL
C  EMISM - EMISSIVITY OF CELL WALL
C  SOOT  - SOOT FACTOR; THIS FACTOR REDUCES ALL GAS-SIDE CELL HEAT TR 
C          COEF
C  PUMPW - FUEL OIL PUMP POWER PER GALLON OF FUEL, KW-HR/GAL
C  THETA - ANGLE FROM THE VERTICAL OF THE BAROMETER DAMPER OPENING
C          AT WHICH RELIEF AIR EQUALS COMBUSTION AIR, DEG
C  THET1 - ANGLE FORMED AT PIVOT BETWEEN CENTER OF MASS AND FLAT 
C          SURFACE OF BAROMETRIC DAMPER, DEG
         READ(5, *) AC, DC, CC, RHOC, AM, XM, HI, EMISSG, ALPHG,
     1      EMISC, EMISM, SOOT, PUMPW, THETA, THET1
         WRITE(60,  514) AC, DC, CC, RHOC, AM, XM, HI, EMISSG,
     1      ALPHG, EMISC, EMISM, SOOT, PUMPW, THETA, THET1
      END IF
      IOIL=1-IOIL
C      
C  DVENT(I) - INSIDE DIAMETER OF VENT SECTION I(5 VALUES), FT
C  XV(I)    - LENGTH OF EACH VENT SECTION I( 5 VALUES)      
      READ(5, *) DVENT, (XV (I), I=1, NS)
      WRITE(60,  514) DVENT, (XV (I), I=1, NS)
C      
C  EMIS(I) - EMISSIVITY OF OUTSIDE SURF OF VENT I
C            (INCLUDING DHW VENT--6 VALUES)      
      READ(5, *) (EMIS (I), I=1, 6)
      WRITE(60,  514) (EMIS (I), I=1, 6)
C      
C  XJ  - THICKNESS OF INSULATION ON INSIDE OF FURNACE JACKET, FT
C  ZKJ - THERMAL CONDUCTIVITY OF JACKET INSULATION, BTU/HR-FT-F
C  CJ  - SPECIFIC HEAT OF JACKET MATERIAL, BTU/LBM-F
C  RHOJ - DENSITY X THICKNESS OF JACKET MATERIAL, LBM/FT2
C  AJ   - SURFACE AREA OF JACKET MATERIAL, FT2
      READ(5, *) XJ, ZKJ, CJ, RHOJ, AJ
      WRITE(60,  514) XJ, ZKJ, CJ, RHOJ, AJ
C      
C  APLEN - SURFACE AREA OF PLENUM, FT2
C  CPMPL - SPECIFIC HEAT OF PLENUM MATERIAL, BTU/LBM-F
C  RHOMPL - DENSITY X THICKNESS OF PLENUM MATERIAL, LBM/FT2
C  HIPL1  - CONVECTIVE HEAT TR COEF AT INSIDE SURFACE OF PLENUM
C           WITH THE BLOWER ON, BTU/HR-FT2-F
C  HOPL1  - CONVECTIVE HEAT TR COEF AT OUTSIDE SURFACE OF PLENUM,
C           BTU/HR-FT2-F
      READ(5, *) APLEN, CPMPL, RHOMPL, HIPL1, HOPL1
      WRITE(60,  514) APLEN, CPMPL, RHOMPL, HIPL1, HOPL1
C      
C  EXCESS- EXCESS AIR FOR COMBUSTION, FRACTION
C  FUELCM- FLOW RATE OF WET NATURAL GAS FIRED, CFM AT METER CONDITIONS
C  CMFANP- COMBUSTION FAN POWER, KW
C  WDPOW - RELIEF AIR FLOW RATE FOR POWER COMBUSTION(OR INDUCED-DRAFT
C          BLOWER), LB/HR
C  QPILOT- STANDING PILOT ENERGY INPUT RATE, BTU/HR
C  REDH  - HEATING CAPACITY REDUCTION FACTOR
C  PHI   - FRACTION OF COMBUSTION AND VENT HOOD AIR FLOW THAT INCREASES
C          INFILTRATION AND INTERZONE AIR MOVEMENT DURING FURNACE
C          OPERATION. SHOULD BE SET >0. TO MODEL INTERZONE AIR
C          MOVEMENT DUE TO FURNACE OPERATION.  INFILTRATION INCREASE
C          CAN BE DEACTIVATED BY USING PHIINF.
C  PHIINF- =0. FOR NO INCREASE IN INFILTRATION DURING FURNACE OPERATION.
C          OTHERWISE SET TO 1., SINCE PHIINF IS A MULTIPLIER ON PHI--
C          SET=0. IF INFILTRATION CORRELATION INCLUDES EFFECT OF
C          FURNACE OPERATION ON INFILTRATION IN BOTH LIVING SPACE
C          AND BASEMENT
      READ(5, *) EXCESS, FUELCM, CMFANP, WDPOW, QPILOT, REDH,PHI,PHIINF
      IF (REDH.EQ.0.) REDH=1.0
      WRITE(60,  514) EXCESS, FUELCM, CMFANP, WDPOW, QPILOT, REDH,
     +                PHI,PHIINF
C
C  XF(I) - MOLE FRACTIONS OF CONSTITUENTS IN THE NATURAL GAS FUEL
C  (1)- METHANE; (2)- ETHANE; (3)- PROPANE; (4)- ISOBUTANE;(5)- N-BUTANE     
C  (6)- ISOPENTANE; (7)- N-PENTANE; (8)- N-HEXANE; (9)- CO2; (10)- N2
C  (11)- O2; (12)- H2
      READ(5, *) (XF (I), I=1, 12)
      WRITE(60,  514) (XF (I), I=1, 12)
      WRITE(60,  515)
C      
C-----IS THE BASEMENT A RETURN AIR PLENUM ?
      IBRP=0
      IF (ARET.EQ.0.0 .AND. IBAS.EQ.1) IBRP=1
C  
C  INFILTRATION DATA ------------------------------
C   
C  STORY  - NO. OF STORIES IN STRUCTURE
C           IF SET = 0., THEN THE INFILTRATION CONSTANTS ACML,ACWSL,
C           ACBL,ACSL,ACCNL WILL BE USED FOR THE AIR CHANGES/HR IN
C           THE LIVING SPACE FOR THE 1ST TO 5TH DAY OF RUN.  AFTER
C           THE 5TH DAY, THE AVERAGE INFILTRATION FOR THE 1ST 5 DAYS
C           WILL BE USED.  THIS FEATURE DOESNT APPLY TO BASEMENT.
C           IF SET < 0., THE AIR CHANGES IN THE LIVING SPACE WILL
C           BE READ FROM TAPE 22 AS A FUNCTION OF TIME (THIS OPTION
C           WAS PROVIDED BY BATTELLE BUT NEVER USED)
C  VENBAS - BASEMENT INFILTRATION, AIR CHANGES/HR (WILL BE USED IF
C           NRMAVB = 0)
C  VENCRW - CRAWL SPACE INFILTRATION, AIR CHANGES/HR
      READ(5,*)STORY, VENBAS, VENCRW
      WRITE(60, 531)STORY, VENBAS, VENCRW
      DO 86 IA=1,NATC
C      
C  VENATC(I) - INFILTRATION RATE IN ATTIC NO. I, AIR CHANGES/HOUR      
C       VENATC   - ATTIC    INFILTRATION MULTIPLIER
   86 READ(5,*)VENATC(IA)
      WRITE(60,532)(IA,VENATC(IA),IA=1,NATC)
C      
C  NRNAVL - VALUES AT NRNAVL TIMESTEPS IN THE CORRELATION FOR
C           INFILTRATION IN THE LIVING SPACE WILL BE AVERAGED.
C  NRNAVB - SAME AS NRNAVL EXCEPT FOR BASEMENT INFILTRATION. IF A 
C           NEGATIVE VALUE IS INPUT, THE VALUES FOR ACMB,ACWSB,ACBB,
C           ACSB,ACCNB WILL BE USED FOR AIR CHANGES ON THE 1ST TO 5TH
C           DAY SIMILAR TO THAT FOR THE LIVING SPACE WITH STORY=0.
      READ(5,*)NRNAVL,NRNAVB
      DO 87 JT=1,NROOMS
      NRM=NRMA(JT)
      IF(NRM.NE.NZNBAS)THEN
C
C    CONSTANTS FOR INFILTRATION IN LIVING SPACE. NOTE THAT INFILTRATION
C    GETS APPORTIONED OUT BY FLOOR AREA TO RESPECTIVE ZONES.      
C THE GENERAL FORM FOR INFILTRATION CORRELATION IN LIVING SPACE AND 
C BASEMENT IS:
C   AIR CHANGES=ACCNX+ACMX*SQRT(STORY*(ACBL*(1/TODR-1/TAR)+ACSL*
C               (1/TODR-1/TSTACKR))+ACWSL*WSPED^2/TODR)
C    WHERE X IS EITHER L OR B FOR LIVING SPACE OR BASEMENT
C          TODR - OUTDOOR DRY BULB TEMP, DEG R
C          TAR  - INDOOR ZONE AIR TEMP, DEG R
C          TSTACKR - TEMP AT INLET TO VENT(AFTER DIVERTER,IF ANY),DEG R
C            NOTE: ACSL WAS DEACTIVATED(SET TO 0.) FOR MOST OF BCL WORK
C          WSPED - WIND SPEED, MPH
C  ACML(NRM)  - MULTIPLIER ON SQUARE-ROOT TERM
C  ACWSL(NRM) - MULTIPLIER ON WIND VELOCITY TERM
C  ACBL(NRM)  - MULTIPLIER ON BOUYANCY TERM WITH INDOOR AIR TEMP
C  ACSL(NRM)  - MULTIPLIER ON BOUYANCY TERM WITH VENT INLET TEMP
C  ACCNL(NRM) - CONSTANT
          READ(5,*)ACML(NRM),ACWSL(NRM),ACBL(NRM),ACSL(NRM),
     +              ACCNL(NRM)
      ELSE
C
C    CONSTANTS FOR INFILTRATION IN BASEMENT. 
C  ACMB,ACWSB,ACBB,ACSB,ACCNB - SIMILAR TO ACML,ACWSL,ACBL,ACSL,ACCNL 
C                               ABOVE EXCEPT FOR BASEMENT INFILTRATION.
          READ(5,*)ACMB,ACWSB,ACBB,ACSB,ACCNB
          ENDIF
   87 CONTINUE
      DO 88 I=1,NROOMS
      IF(I.EQ.NZNBAS)GO TO 88
      WRITE(60,  518)I,ACML(I),ACWSL(I), ACBL(I),
     +                     ACSL(I),ACCNL(I)
   88 CONTINUE
      IF (NRNAVB.GT.0) THEN
         WRITE(60, *) 'BASEMENT INFILTRATION CORRELATION ',
     +      'WILL BE USED'
        WRITE(60, 516)NZNBAS,ACMB,ACWSB,ACBB,ACSB,ACCNB
      ENDIF
      IF (STORY.LT.0.) THEN
         WRITE(60, *) 'LIVING SPACE INFILTRATION WILL BE INPUT ',
     +      'FROM FILE ON TAPE22'
      ELSE IF (STORY.EQ.0.) THEN
         WRITE(60, *) 'LIVING SPACE DAILY INFILTRATION VALUES ',
     +      'WILL BE USED'
         WRITE(60, 529)          (I, I=1, 5),(NRM,ACML(NRM),
     +      ACWSL(NRM),ACBL(NRM),ACSL(NRM),ACCNL(NRM),NRM=1,NROOMS)
      ELSE
         WRITE(60, *) 'LIVING SPACE INFILTRATION CORRELATION ',
     +      'WILL BE USED'
      END IF
C      
C  NOTE!!!!!!  WITH MULTIZONE MODEL, ECFMH1 IS USED TO CALC H'S
C              IN FURNACE MODEL, BUT IT IS LATER SUPERCEDED BY FLOWS
C              READ AND SET IN DCTFLW. INPUT ECFMH1 AT A MEAN VALUE
C              EXPECTED DURING FURNACE OPERATION FOR BEST ACCURACY.
C-----ECFMX1 - INDOOR FAN CFM
C     ECFMC2 - CONVECTION CFM WITH FAN TURNED OFF
C     EFANPX - INDOOR FAN POWER, KW
C     CFANPC - OUTDOOR FAN POWR, KW
      READ(5, *) ECFMC1, ECFMC2, EFANPC, CFANPC
      READ(5, *) ECFMH1, EFANPH
      ECFMH2=ECFMC2
      WRITE(60,  519) ECFMC1, ECFMC2, EFANPC, CFANPC
      WRITE(60,  520) ECFMH1, ECFMH2, EFANPH
      CFSC=CFANPC
      EFSC=EFANPC
      EFSH=EFANPH
      ECFC1S=ECFMC1
      ECFH1S=ECFMH1
      EFANPH=EFANPH*REDH
C-----THERMOSTAT READ-IN
      CALL TSTATD(1, IAC, IAC1, IBURN, IEFAN,IDBG)
C-----HUMIDIFIER READ - IN  (READS 6 ZERO VALUES TO DEACTIVATE)
      CALL HUMDF (DUM)
C-----INITIALIZE INFILTRATION FUNCTIONS
      TDUM=1.0
      WDUM=1.0
      CALL ACHL(1,TDUM, TDUM, WDUM, TDUM, ADUM)
      DUM=ACHB (TDUM, TDUM, WDUM, TDUM)
C
C  RADINT - INTERNAL RADIATION HT COEFFICIENT FRACTION
C  RADSOL - FRACTION OF SOLAR RADIATION FROM WINDOWS THAT
C           GOES TO PARTITIONS OR FLOOR IN EACH ZONE
C  RADSFL - FRACTION OF SOLAR THRU WINDOWS NOT DELIV TO AIR THAT
C           GOES TO FLOOR.  (1-RADSFL) FRACTION GOES TO INTERIOR
C           PARTITIONS

      READ(5, *) RADINT, RADSOL, RADSFL
      WRITE(60,  521) RADINT, RADSOL, RADSFL
C      
C  DTIME  - TIME INCREMENT FOR OUTER LOOP, SEC
C  RELHMI - INITIAL GUESS OF RELATIVE HUMIDITY IN ROOM, PCT
C  TI     - INITIAL GUESS OF ROOM DRY BULB TEMP, F
      READ(5, *) DTIME, RELHMI,(TI(JT),JT=1,NROOMS)
C         MAKE TBASI HAVE HIGHER PRIOITY THAN TI(NZNBAS)      
      IF(TBASI.GT..05)TI(NZNBAS)=TBASI
      WRITE(60,  522) DTIME,(TI(JT),JT=1,NROOMS)
      WRITE(60,530)RELHMI
      WRITE(60,  523) HACUP, HACDN, HIRUP, HIRDN
      DO 89 JT=1,NROOMS
C  SET INITIAL MEAN RADIENT TEMP (TMR)
      TMR(JT)=TI(JT)
C  SAVE INITIAL GUESSES FOR TI
   89 TIS(JT)=TI(JT)
      EXCEST=EXCESS
      FUELCS=FUELCM
      XSSV=XV (1)
      WGMINS=WGMIN
C
C  REFLG  - GROUND REFLECTIVITY
C  QINTL  - AVERAGE INTERNAL SENSIBLE LOAD, BTU/HR
C  WINTL  - AVERAGE INTERNAL MOISTURE LOAD, LBM H2O/HOUR
      READ(5, *) (REFLG (IMO), IMO=1, 12)
      READ(5, *) (QINTL (IHR), IHR=1, 24),
     1   (WINTL (IHR), IHR=1, 24)
      QINTL (25)=QINTL (1)
      WINTL (25)=WINTL (1)
      
C  WT(I) VALUES SHOULD BE COORDINATED W/ DESIRED RANGE OF TINDEX
C    (SEE DESCRIPTION OF IWAT IN NAMELIST ABOVE AND SUBPROGRAM HOUS_II)
C  UNITS OF WT(I) IS LBM H2O/HR
      IF (IWAT.NE.1) READ(5, *) (WT (IHR), IHR=1, 24)
      IF (IH2O.NE.0) THEN
C
C  H2ON - FRACTION OF TIME WATER HEATER IS ON EACH HOUR (24 VALUES)      
         READ(5, *) (H2ON (IHR), IHR=1, 24)
         DO 90 IHR=1, 24
            H2ON (IHR)=H2ON (IHR)+IHR
 90         CONTINUE
      END IF
C-----PRINT INPUT DATA AND STRUCTURE INPUT
      IF (INPRT.NE.0) THEN
         WRITE(60, 524) (REFLG (IMO), IMO=1, 12)
         ATCVLT=TOTV(ATCVOL,NATC)
         ROMVLT=TOTV(ROMVOL,NROOMS)
         NRMSL=0
         NRMBG=0
         DO 91 JT=1,NROOMS
         IF(NRMBGW(JT).GT.0)NRMBG=NRMBGW(JT)
   91    IF(NRMSLB(JT).GT.0)NRMSL=NRMSLB(JT)
         IF(NRMBG.EQ.0)THEN
            AWGRP=0.
         ELSE
            AWGRP=AWGR(NRMBG)
            ENDIF
         IF(NRMSL.EQ.0)THEN
            ASLFLP=0.
         ELSE
            ASLFLP=ASLFL(NRMSL)
            ENDIF
         WRITE(60,  525) 6,AWGRP,7,ASLFLP, 9, HIW, 22, HIR, 35, HAC,
     +   48, HIC, 53, H1F, 54, H3F, 59, H3B, 60, ROMVLT, 62, ATCVLT,
     +   63, VOLCRW, 66, UWGR, 67, USLFL, 68, UWIND, 73, HAD, 74, HOD,
     +   75, ASUP, 76, WSUP, 77, ARET, 78, WRET, 79, FSDIB, 80, FRDIB
      ENDIF
      DTIMSV=DTIME                 
      DTIME=DTIMSV/3600.
      DTIM1=DTIME
      NTGHR=INT(1./DTIM1+.01)
      DTIM2=DTIMSV/(FLOAT(NSUBDV)*3600.)
      KM=MONTH (1)
      DTIM1N=DTIM1*NDAYTOT (KM)
C
      IF(NSEQW.GT.0.AND.IFWL.EQ.0)THEN
        OPEN(40,FILE='TAPE40',STATUS='OLD',IOSTAT=IO40)
        IF(IO40.NE.0)THEN
          WRITE(60,*)' PROBLEM WITH OPENING TAPE40,IO40=',IO40
          STOP ' TAPE40 BAD!!!'
          ENDIF
        OPEN(41,FILE='TAPE41',STATUS='NEW',IOSTAT=IO41)
        IF(IO41.NE.0)THEN
          WRITE(60,*)' DELETE TAPE41 AND RERUN!!'
          STOP ' DELETE TAPE41 AND RERUN!!!'
          ENDIF
        ENDIF
        OPEN(19,FILE='TAPE19',STATUS='NEW',IOSTAT=IO19)
        IF(IO19.GT.0)THEN
          WRITE(60,*) ' STRRUN: DEL TAPE19 AND RERUN'
          STOP ' STRRUN: DEL TAPE19 AND RERUN'
        ENDIF
C-----GET CLOUD COVER OR HORIZONTAL SOLAR FROM WEATHER FILE
C-----MONTHLY SOLAR LOADS ARE CALC IN SOLRLD CALLED FROM STRMON
C
C     WETHR BLOCK 1
      IF (IFW (3).GT.0) THEN
C  NOTE:  WITH THIS OPTION, 24 HRS OF SOLAR DATA ARE USED FOR ALL
C         DAYS IN THE MONTH      
C  SOLARH - TOTAL HORIZONTAL SOLAR RADIATION, BTU/HR-FT2
         READ(5, *) (SOLARH (IHR), IHR=1, 24)
         WRITE(19,533)(SOLARH(IHR),IHR=1,24)
         IQQ2=IDAYM
         IF(IQQ2.LT.2)IQQ2=2
         DO 100 IDY=2, IQQ2
           WRITE(19,533)(SOLARH(IHR),IHR=1,24)
100         CONTINUE
         REWIND(19)
      ELSE IF (NSEQW.EQ.0) THEN
         IWRB=(NCTY-1)*12
         DO 110 KMO=1, 12
            DO 106 IDY=1, NDAYM
               IWR=IWRB+I
C     NOTE: AVGES MUST BE PROPERLY STORED ON TAPE20. SEE CMDKS.FOR
C           FOR DIMENSIONS OF AVGES.  
C      AVGES(1,I)=OUTDOOR DRY-BULB TEMP, F
C      AVGES(2,I)=OUTDOOR WET-BULB TEMP, F
C      AVGES(3,I)=TOTAL HORIZONTAL SOLAR RADIATION, BTU/HR-FT2
C      AVGES(4,I)=WIND SPEED, MPH
               READ(20, REC=IWR) DUM1, DUM2, AVGES, DUM, REST
               WRITE(19,533)(AVGES(3,IHR),IHR=1,24)
106            CONTINUE
110         CONTINUE
         REWIND(19)
      ELSE IF (NSEQW.EQ.1) THEN
C--------PRESENT CODE ASSUMES TAPE 40 HAS NMONTH*NDAYM DAYS OF DATA
C--------INCLUDING NDPRE DAYS OF PRECONDITIONING DATA
         REWIND (UNIT=40)
         DO 120 IMO=1, NMONTH
            KMO=MONTH (IMO)
            DO 116 IDY=1, NDAYM
               DO 114 IHR=1, 24
C  AVGES(3,IHR) - SOLAR RADIATION ON HORIZONTAL SURFACE(NOT CLOUD COVER)
                  READ(40, *, IOSTAT=IO40) DUM, DUM, DUM,
     1               AVGES (3, IHR)
                  IF (IO40.NE.0) THEN
                     WRITE(60, 526)
                     STOP
                  END IF
114            CONTINUE
               WRITE(19,533)(AVGES(3,IHR),IHR=1,24)
116            CONTINUE
120         CONTINUE
         REWIND (UNIT=40)
         REWIND(19)
      ELSE IF (NSEQW.EQ.2) THEN
         WRITE(*,*)' --> PROCESSING WEATHER DATA(IN WETHR), PLS WAIT...'
         CALL WETHR (1, NSEQW)
      ELSE IF (NSEQW.EQ.3) THEN
         REWIND (UNIT=40)
         REWIND (UNIT=41)
         WRITE(*,*)' --> PROCESSING WEATHER DATA(IN WWEATH),PLS WAIT...'
         CALL WWEATH (NMONTH, MONTH, NDPRE, NDAYM+NDPRE)
         IF(IGRND.EQ.0)THEN
            WRITE(60, *) 'WEATHER TYPE 3. GROUND TEMPERATURE ',
     1         'IS INPUT'
            READ(41, *) DUM
C            
C  ODDB - OUTDOOR DRY-BULB TEMP, F            
C  ODWB - OUTDOOR WET-BULB TEMP, F
C  WSPEED - WIND SPEED, MILES/HR
C  KMO - MONTH
C  KDY - DAY
C  KHR - HOUR
160         READ(41, *, IOSTAT=IO41) ODDB (25), ODWB, WSPEED (25),
     1         DUM, DUM, KMO, KDY, KHR
            IF (IO41.NE.0) STOP 'PGM.STRRUN S.160: READING TAPE41'
            IF (KMO.NE.MONTH (1)) GO TO 160
         END IF
         RODB=ODDB (25)
         PWSS=FPWS(RODB)
         WSS=FW22(PWSS)
         WSC=FW35(RODB,ODWB,WSS)
         ODHUM (25)=WSC
      ELSE
         STOP 'BAD NSEQW IN STRRUN'
      END IF
      ISKIP=0
      DO 161 I=1,NZW
  161 QCSURF(I)=0.
      DO 162 I=1,2
      QCEIL(I)=0.
  162 QROOF(I)=0.
      DO 163 I=1,NZN
  163 QDCTBA(I)=0.             
      WMOIST=0.
      SHCR=0.
      TCR=0.
      DO 164 J=1,NROOMS
      TA(J)=TI(J)
  164 CONTINUE
C  SET INITIAL TEMP OF GAS AT VENT INLET(FOR INFILTRATION CALCULATIONS)
      TS=TI(1)+10.
C  CALCULATE CONSTRUCT CONSTANTS
      WRITE(6,*)' --> CALLING TCONC FROM STRRUN HERE!'
      CALL TCONC(DEGRAD,DTIM1)
C- - CALCULATE MEAN RADIENT TEMP FACTORS
      WRITE(6,*)' --> CALLING MRTSWF FROM STRRUN HERE!'
      CALL MRTSWF(DUM1,DUM2,IDBG)
      IF (NSEQW.EQ.3.AND.IGRND.GT.0) THEN
         WRITE(60, *) 'WEATHER TYPE 3. GROUND TEMPERATURE ',
     +      'IS MODELED'
         TBASM=TBASI
         WRITE(*,*)' --> PRECONDITIONING GROUND AROUND BASEMENT,',
     +             ' PLS WAIT...'
         ICODE=1
         CALL GRNDEX (TODDBM, WSPEDM, SOLRHM, KM)
         WRITE(*,*)'      DONE WITH PRECONDITIONING GROUND!'
         ICODE=0
         READ(41, *, IOSTAT=IO41) ODDB (25), ODWB, WSPEED (25),
     1      DUM, DUM, KMO, KDY, KHR
      ENDIF
      CLOSE(5)
C
      RETURN
C
C-----VARIOUS ERROR CONDITIONS
170   WRITE(60, 527) ICITY
      STOP 'STRRUN:ILLEGAL CITY CODE--NOT FOUND ON TAPE4!'
  997 WRITE(60,*)' STRRUN: EOF ON TAPE30 LOOKING FOR NAMELIST SHDNML'
      STOP ' STRRUN: EOF ON TAPE30 LOOKING FOR NAMELIST SHDNML'
  998 WRITE(60,*)' STRRUN: EOF ON TAPE30 LOOKING FOR NAMELIST ICFIZB'
      STOP ' STRRUN: EOF ON TAPE30 LOOKING FOR NAMELIST ICFIZB'
  999 WRITE(60,*)' STRRUN: EOF ON TAPE30 LOOKING FOR NAMELIST CONTROL'
      STOP ' STRRUN: EOF ON TAPE30 LOOKING FOR NAMELIST CONTROL'
C
C-----INPUT FORMATS
 500  FORMAT (A4, 6X, 2A4, 2X, 15A4)
 501  FORMAT (///20X,'-ASHRAE SP43 MULTI-ZONE MODEL-', /,
     +   ' R E S I D E N T I A L  A/C / GAS/OIL  F U R N A C E  ',
     +   'A N A L Y S I S', /,
     +   //'  CITY: ', A3, /,
     +   '  STRUCTURE: ', 2A4, /,
     +   '  DESCRIPTION: ', 15A4)
 502  FORMAT (A4, 6X, A4, 6X, 4F10.0)
 503  FORMAT (1X,' PROGRAM FLAGS:', /,
     +   '  NSUBDV =', I3, /,
     +   '  NINC   =', I3, /,
     +   '  MODE   =', I3, /,
     +   '  IDEBUG =', I3, /,
     +   '  INPRT  =', I3, /,
     +   '  NMONTH =', I3, '  NDAYM  =', I3, '  NDAYY(NMONTH*NDAYM) =',
     +   I3, /, '  IQPRT  =', I3, /,  '  ITER   =', I3)
 504  FORMAT ('  IMEAN  =', I3, /,
     +   '  ITHERM =', I3, /,
     +   ' ICITRD  =', I3, /,
     +   '  NOSUN  =', I3, /,
     +   '  ICOMF  =', I3)
 505  FORMAT (/1X,' *** NO SOLAR LOADS INCLUDED ***', /)
 506  FORMAT (' CHANGES TO WEATHER DATA:', 5I3)
 507  FORMAT (/1X,' NON-AUTOMATIC HEATING/COOLING SELECTED', /,
     +   '  MONCS  =', I3, /,
     +   '  MONCE  =', I3, /,
     +   '  MONHS  =', I3, /,
     +   '  MONHE  =', I3, /)
 508  FORMAT (/1X,' MONTHS SELECTED:', 12I4)
 509  FORMAT(A4)
 512  FORMAT (/20X, ' * * * *  FURNACE INPUT DATA  * * * *', /)
 513  FORMAT (8I10)
 514  FORMAT (9G13.5)
 515  FORMAT (/20X, '* * * * * * * * * * * * * * * * * ', //)
  516 FORMAT(' BASEMENT INFILTRATION CONSTANTS:'/
     +(' NRM,ACM,ACWS,ACB,ACS,ACCNL=',I4,5G13.5/))
 517  FORMAT (/, ' CITY RECORD READ FROM CARDS FOR ', A4, 6X, A4, /,
     +   '  DNLAT =', F10.2, /,
     +   '  DLONG =', F10.3, /,
     +   '  ALT2  =', F10.3, /,
     +   '  CLEAR =', F10.2)
  518 FORMAT(/1X,' ZONE INFILTRATION CONSTANTS:'/
     +(' NRM,ACM,ACWS,ACB,ACS,ACCNL=',I4,5G13.5/))
 519  FORMAT (1X,'UNIT PARAMETERS:', /,
     +   '   MODE       CFM1       CFM2     ',
     +   'EFANP     CFANP     ', /,
     +   ' COOLING   ', F7.2, 4X, F7.2, 3X, 2F10.5)
 520  FORMAT (' HEATING   ', F7.2, 4X, F7.2, 3X, 2F10.5)
 521  FORMAT (/1X,' RADIATION FRACTION PARAMETERS:', /,
     +   '              RADINT    RADSOL    RADSFL', /,
     +   10X,3F10.2, /)
 522  FORMAT (/1X,' TIME INTERVAL =', F10.5, /,
     +   ' DB TEMP IN ZONES=', 5(F6.2,3X))
 523  FORMAT (/1X,' OPTION FOR RAD COUPLING FROM ROOF TO ATTIC FLR', /,
     +   ' H CONVECTIVE= A (DT) **.33  WHERE', /,
     +   ' A VALUES ARE HACUP=', F6.3, /,
     +   '              HACDN=', F6.3, /,
     +   '              HIRUP=', F6.3, /,
     +   '              HIRDN=', F6.3)
 524  FORMAT (/1X,' GROUND REFLECTIVITY:', /,
     +   12G10.4)
 525  FORMAT (/1X,' STRUCTURE FILE DATA:', /,
     +   (1X, 6 (I5, G15.5)))
 526  FORMAT (/6X, '---ERROR: EOF ON WEATHER TAPE 40')
 527  FORMAT (' ***ILLEGAL CITY CODE - ', A3, ' - RUN STOPPED.')
 528  FORMAT (/1X,' !!!WARNING: PRE 12/85 INPUT FILE BEING UPGRADED TO',
     +   ' CURRENT STANDARDS. CARRIER INPUT FOR NMONTH=', I3,
     +   ' . REVISED TO NMONTH=', I3 ,' AND NDAYM=', I3, /)
  529 FORMAT(1X,'DAYS= ',5I4/(1X,'ZONE= ',I4,' ACH EACH DAY= ',5G13.5))
  530 FORMAT(1X,'INITIAL RELATIVE HUMIDITY IN ZONES= ',G13.5)
 531  FORMAT (/1X,' STORY= ', F10.5,/
     +   '  VENBAS =', F10.5, /,
     +   '  VENCRW =', F10.5)
  532 FORMAT((1X,'IA,ATTIC VENTILATION= ',I5,G13.5/))
  533 FORMAT(1X,6G13.5/1X,6G13.5/1X,6G13.5/1X,6G13.5)
  534 FORMAT(///12X,'BURNER'/3X,'TIME',5X,'OR A/C',7X,
     +'ZONE AIR TEMPS,F',11X,'TSTATS',7X,'DAMPERS',4X,'BLWR  ICOL')
C
      END
