      SUBROUTINE TAATTC(ATCDTS, QAVENT, QCEIL1, QWALL5, RARATS,
     +                  TATTCN, TODDBR,  WODFAC,IDBG)
C
C  CALC AIR TEMPERATURE IN UP TO TWO ATTICS
C
C - - -CONSTANTS
CMDK CPAIR
CMDK FTR
CMDK NWL
CMDK NWN
CMDK NZN
CMDK NZW
CMDK BLKQGS
CMDK BLKQS
CMDK ENCBK1
CMDK IZZQ
CMDK MZON1
CMDK OWETHR
CMDK QUAYLE
CMDK STRUCA
CMDK SURFAR
CMDK TEMP1
CMDK TEMPB
CMDK TIMEB
C - - -DIMENSIONS
      REAL TATTCN(2)
      CALL ZERV(3,QAVENT,QCEIL1,QWALL5,0.,0.,0.,0.,0.,0.,0.)
C
      DO 100 IA=1,NATC
      IQZ=IZT+IA
      HIQ=HIRDN*HIR
      T4=TMP(4,IQZ)
      IF(TATTC(IA).GT.T4)HIQ=HIRUP*HIR
      HIRX=HIQ*ABS(T4-TATTC(IA))**.33
      QROOFN=RAREA(IA)*HIRX*(T4-TATTC(IA))
      QWALL5=QWALL5+QROOFN
      QROOF(IA)=QROOF(IA)-QROOFN
C
C - - -CEILING HEAT FLOW
      IZ=3+IA
      QCELN=0.
      DO 10 J=1,NROOMS
      NRM=NRMA(J)
      N2=NWALLA(NRM)
      DO 10 K2=1,N2
      IZW=NENC(NRM,K2)
      ID=IDEXP(IZW)
      NZONC=NZNC(IZW)
      IF(ID.EQ.5.AND.NZONC.EQ.IZ)THEN
          HAQ=HACUP*HAC
          T1=TMP(1,IZW)
          IF(TATTC(IA).GT.T1)HAQ=HACDN*HAC
          HACX=HAQ*ABS(T1-TATTC(IA))**.33
          QCEL1N=AWALLA(IZW)*HACX*(TATTC(IA)-T1)
          QCEIL1=QCEIL1+QCEL1N
          QCELN=QCELN+QCEL1N
          ENDIF
   10 CONTINUE
C
      QCEIL(IA)=QCEIL(IA)+QCELN
      RAIRAT=WODFAC/(TATTC(IA)+FTR)
      ATTCFH=VENATC(IA)*ATCVOL(IA)*CPAIR
      QAVNTN=ATTCFH*(TODDBR-TATTC(IA)*RAIRAT)
      QAVENT=QAVENT+QAVNTN
      QVNTA=0.
      IF(NATVNT.EQ.IA)QVNTA=QVENTA
      ATCDT=DTIME/(CPAIR*ATCVOL(IA))
      IF(IA.EQ.NATVNT)THEN
C     GET RAIRAT AND ATCDT NEEDED IN LOOP
          RARATS=RAIRAT
          ATCDTS=ATCDT
          ENDIF
      TATTCN(IA)=(QROOFN+QAVNTN-QCELN+QVNTA)*ATCDT/RAIRAT
     +           +TATTC(IA)
      IF(IDBG.NE.0)THEN
         WRITE(60,500)IA,HIRX,QROOFN,HACX,QCELN,QAVNTN,QVNTA,
     +               TATTC(IA),TATTCN(IA)
         ENDIF
  100 CONTINUE
      RETURN
  500 FORMAT(11X,'TATTC:IA,HIRX,QROOFN= ',I4,2G13.5/
     +18X,'HACX,QCELN= ',2G13.5/
     +18X,'QAVNTN,QVNTA= ',2G13.5/
     +18X,'TATTC(IA),TATTCN(IA)= ',2G13.5)
      END


