      SUBROUTINE IWALLS(NRM,IZW,KON,NZONC,TWIA,AWIA,IDBG) 
C 
C  TEMPERATURES OF INTERIOR WALLS AND LVG SPC-TO-GARAGE WALLS 
C  TWIA AND AWIA ARE USED TO GET THE AREA WEIGHTED PARTITION WALL SURF
C                TEMP FOR USE BY THE THERMOSTAT MODEL 
C 
C - - - PARAMETER CONSTANTS 
C 
CMDK FTR
CMDK NKONST
CMDK NWL
CMDK NWN
CMDK NZN
CMDK NZW
CMDK SIGMA
C 
C - - - COMMON BLOCKS 
CMDK BLKQS
CMDK CNSTRK
CMDK ENCBK1
CMDK ENCBK2
CMDK ENCBLK
CMDK IZPART
CMDK MRTBLK
CMDK OWETHR
CMDK SURFAR
CMDK TCNBLK
CMDK TCONCB
CMDK TEMPB
CMDK TIMEB
      LOGICAL NZY 
C 
      IDBGSV=IDBG 
      K=KON 
      NLM=NLMP(K) 
      NZON=NZONC-8
      NZY=.FALSE. 
      IF(IDBG.NE.0)WRITE(60,506)TIME,NZON,NRM,K,KNSTAT(NRM)
      IF(NZON.EQ.NRM.AND.K.EQ.KNSTAT(NRM))NZY=.TRUE.
      AWL=AWALLA(IZW) 
      IF(NZY)AWIA=AWIA+AWL
      T1=TMP(1,IZW) 
      T2=TMP(2,IZW) 
      T3=TMP(3,IZW) 
      IF(NZON.NE.NRM.AND.NZONC.NE.6)THEN
C  PARTITION WALL BETWEEN ZONES 
          IZWO=IZSET(IZW) 
          NRMO=NZON 
C - - -NOW CHECK TO SEE IF WALL TEMPS HAVE ALREADY BEEN CALCULATED IN 
C        OTHER ZONE (IF CALC ORDER IS KEPT THE SAME AS INPUT ORDER, 
C        THEN IZW FOR BACKSIDE SURFACE WILL BE GREATER THAN IZW FOR 
C        SURFACE IN THIS ZONE 
          IF(IZWO.LT.IZW)THEN 
C - - -TEMPS FOR ENCLOSURE HAVE ALREADY BEEN CALC IN ZONE NZON
C          SO RESET TEMPS AND RETURN
              IF(NLM.EQ.1)THEN
                  TMPN(1,IZW)=TMPN(3,IZWO)
                  TMPN(2,IZW)=TMPN(2,IZWO)
                  TMPN(3,IZW)=TMPN(1,IZWO)
                  QRMRT(IZW)=QRMRT(IZWO)
                  IF(NZY)TWIA=TMPN(3,IZW)*AWL+TWIA
                  IF(IDBG.NE.0)WRITE(60,504)NRM,IZW,TMPN(1,IZW), 
     +              TMPN(2,IZW),TMPN(3,IZW) 
                  GO TO 200 
                  ENDIF 
              IF(NLM.EQ.3)THEN
                  TMPN(1,IZW)=TMPN(4,IZWO)
                  TMPN(2,IZW)=TMPN(3,IZWO)
                  TMPN(3,IZW)=TMPN(2,IZWO)
                  TMPN(4,IZW)=TMPN(1,IZWO)
                  QRMRT(IZW)=QRMRT(IZWO)
                  IF(NZY)TWIA=TMPN(4,IZW)*AWL+TWIA
                  IF(IDBG.NE.0)WRITE(60,505)NRM,IZW,TMPN(1,IZW), 
     +              TMPN(2,IZW),TMPN(3,IZW),TMPN(4,IZW) 
                  GO TO 200 
                  ENDIF 
              ENDIF 
      ELSE
C              IMMERSED PARTITION WALLS AND GARAG WALL!      
          IZWO=IZW
          NRMO=NRM
          ENDIF 
      TC1=TCON(1,K) 
      TC2=TCON(2,K) 
      TC3=TCON(3,K) 
      IF(NZONC.NE.6)THEN
         QPRADO=HRI(IZWO)*(TMR(NRMO)-T1)+QSI(IZWO)
      ELSE
C  RADIATION AND CONVECTION FROM GARAGE-SIDE OF LVG SPC-TO-GARAGE WALL
         TMN=0.5*(TGARAG+T1)
         QPRADO=4.*WALLFO(IZW)*SIGMA*(TMN+FTR)**3 *(TGARAG-T1)
         HIO=HC(NRM,IZW,5,.FALSE.,T1,TGARAG)
         QCGAR=HIO*AWALLA(IZW)*(TGARAG-T1)
         QLOSWL(NRM)=QLOSWL(NRM)-QCGAR-AWALLA(IZW)*QPRADO
      ENDIF
      QCOVAI=QCSURF(IZW)/AWALLA(IZW)
      IF(NZONC.NE.6)THEN
         QCOVAO=QCSURF(IZWO)/AWALLA(IZW)
      ELSE
         QCOVAO=QCGAR/AWALLA(IZW) 
         ENDIF
      IF(NLM.EQ.1)THEN
C  CHECK FOR LIGHT WALL ELEMENT 
          IF(NKSTAB.NE.0)THEN 
              DO 10 IK=1,NKSTAB 
   10         IF(K.EQ.KONSTB(IK))GO TO 20 
              GO TO 40
   20         NRAT=NRATTM(IK) 
              XRAT=1./NRAT
              TS1=T1
              TS2=T2
              TS3=T3
              TCS1=XRAT*TC1 
              TCS2=XRAT*TC2 
              TCS3=XRAT*TC3 
              QPRDO=0.
              QPRDI=0.
              DO 30 NT=1,NRAT 
              IF(NT.NE.1)THEN
                QPRADO=HRI(IZWO)*(TMR(NRMO)-TS1)+QSI(IZWO) 
              ENDIF
              TS1N=TCS3*(TS2-TS1)+TCS2*(QCOVAO+QPRADO)+TS1
              TS2N=0.5*TCS1*(TS1-2.*TS2+TS3)+TS2
              QPRADI=HRI(IZW)*(TMR(NRM)-TS3)+QSI(IZW) 
              TS3N=TCS3*(TS2-TS3)+TCS2*(QCOVAI+QPRADI)+TS3
              TS1=TS1N
              TS2=TS2N
              TS3=TS3N
              QPRDO=QPRDO+QPRADO
              QPRDI=QPRDI+QPRADI
   30         CONTINUE
              QPRADO=QPRDO/NRAT 
              QPRADI=QPRDI/NRAT 
              TMPN(1,IZW)=TS1 
              TMPN(2,IZW)=TS2 
              TMPN(3,IZW)=TS3 
              IF(NZY)TWIA=TMPN(3,IZW)*AWL+TWIA
              GO TO 50
              ENDIF 
   40     TMPN(1,IZW)=TC1*(T2-T1)+TC2*(QCOVAO+QPRADO)+T1
          TMPN(2,IZW)=0.5*TC1*(T1-2.*T2+T3)+T2
          QPRADI=HRI(IZW)*(TMR(NRM)-T3)+QSI(IZW)
          TMPN(3,IZW)=TC3*(T2-T3)+TC2*(QCOVAI+QPRADI)+T3
          IF(NZY)TWIA=TMPN(3,IZW)*AWL+TWIA
          ENDIF 
      IF(NLM.EQ.3)THEN
          TC4=TCON(4,K) 
          TC5=TCON(5,K) 
          TC6=TCON(6,K) 
          TC7=TCON(7,K) 
          TC8=TCON(8,K) 
          T4=TMP(4,IZW) 
          TMPN(1,IZW)=TC1*(T2-T1)+TC2*(QCOVAO+QPRADO)+T1
          TMPN(2,IZW)=TC3*(T1-T2)+TC4*(T3-T2)+T2
          TMPN(3,IZW)=TC5*(T2-T3)+TC6*(T4-T3)+T3
          QPRADI=HRI(IZW)*(TMR(NRM)-T4)+QSI(IZW)
          TMPN(4,IZW)=TC7*(T3-T4)+TC8*(QCOVAI+QPRADI)+T4
          IF(NZY)TWIA=TMPN(4,IZW)*AWL+TWIA
          ENDIF 
   50 CONTINUE
      QRMRT(IZW)=QPRADI*AWALLA(IZW) 
      IF(NZONC.NE.6)THEN
         QRMRT(IZWO)=QPRADO*AWALLA(IZW) 
      ELSE
         QRGAR=QPRADO*AWALLA(IZW) 
         ENDIF
      IF(IDBG.NE.0)THEN 
          WRITE(60,500)NRM,IZW,KON,NZON
          IF(NLM.EQ.1)THEN
              WRITE(60,501)T1,TMPN(1,IZW),T2,TMPN(2,IZW),T3,TMPN(3,IZW), 
     +        TC1,TC2,TC3 
              ENDIF 
          IF(NLM.EQ.3)THEN
              WRITE(60,502)T1,TMPN(1,IZW),T2,TMPN(2,IZW),T3,TMPN(3,IZW), 
     +        T4,TMPN(4,IZW),TC1,TC2,TC3,TC4,TC5,TC6,TC7,TC8
              ENDIF 
          IF(NZONC.NE.6)THEN
             WRITE(60,503)QCSURF(IZW),QCSURF(IZWO),QRMRT(IZW), 
     +                   QRMRT(IZWO),TMR(NRM),TMR(NRMO),QSI(IZW), 
     +                   QSI(IZWO)
          ELSE
             WRITE(60,503)QCSURF(IZW),QCGAR,QRMRT(IZWO),QRGAR, 
     +                   TMR(NRM),TGARAG,QSI(IZW),0.
             ENDIF
          ENDIF
  200 CONTINUE
      IDBG=IDBGSV 
      RETURN
  500 FORMAT(10X,'IWALLS:NRM,IZW,KON,NZONC= ',4I5)
  501 FORMAT(10X,'T1,T1N= ',2G13.5/ 
     +10X,'T2,T2N= ',2G13.5/
     +10X,'T3,T3N= ',2G13.5/
     +10X,'TC1= ',G13.5,'  TC2= ',G13.5,'  TC3= ',G13.5)
  502 FORMAT(10X,'T1,T1N= ',2G13.5/ 
     +10X,'T2,T2N= ',2G13.5/
     +10X,'T3,T3N= ',2G13.5/
     +10X,'T4,T4N= ',2G13.5/
     +10X,'TC1= ',G13.5,'  TC2= ',G13.5,'  TC3= ',G13.5,' TC4= ',G13.5/ 
     +10X,'TC5= ',G13.5,'  TC6= ',G13.5,'  TC7= ',G13.5,' TC8= ',G13.5) 
  503 FORMAT(10X,'QCSURF(AT INNER AND OUTER SURF)= ',2G13.5/
     +10X,'QRMRT(AT INNER AND OUTER SURF)= ',2G13.5/
     +10X,'TMR(IN ZONE AND CONNECTING ZONE)= ',2G13.5/
     +10X,'QSI(AT INNER AND OUTER SURF)= ',2G13.5)
  504 FORMAT(10X,'NRM,IZW= ',2I5,' TMPN(1-3)= ',3G13.5) 
  505 FORMAT(10X,'NRM,IZW= ',2I5,' TMPN(1-4)= ',4G13.5) 
  506 FORMAT(10X,'IWALLS:TIME= ',F12.5/13X,'LOOK FOR TSTAT;NZON', 
     +',NRM,K,KNSTAT(NRM)=', 4I5) 
      END 
