      SUBROUTINE TWISET(ICOD,QCSURF,TBAS,TWI)
C
C  SET TEMP OF INSIDE SURF OF BSMT WALL DURING PRECONDITIONING
C   ICOD  7 FOR FLOOR, 4 FOR WALL 
C   QCSURF - HEAT FLOW INTO BASMT WALL SEGMENT PER UNIT AREA, BTU/HR-FT2
C   TBAS - BASEMENT AIR TEMP (SET BY INPUT VALUE OF TI(NZNBAS))
C   TWI  - ON INPUT:  INITIAL GUESS FOR INSIDE SURF TEMP, F
C          ON OUTPUT:  INSIDE SURFACE TEMP, F
CMDK SIGMA
CMDK FTR
      DATA EPSW/.95/,NRM/6/,IZW/80/
C         NRM,IZW HERE ARE NONSENSE VALUES!      
      JAN=0      
      TB=(TBAS+FTR)*.01     
      TB2=TB**2
      TWIG=TWI
  10  HIWBGC=HC(NRM,IZW,ICOD,.FALSE.,TWIG,TBAS)
      TW=(TWIG+FTR)*.01
      TW2=TW**2
      HIR=SIGMA*EPSW*(TB2+TW2)*(TB+TW)
      TWI=TBAS-QCSURF/(HIWBGC+HIR)
      DIF=ABS(TWIG-TWI)
      IF(DIF.GT..01)THEN
        JAN=JAN+1
        IF(JAN.GT.20)STOP 'TWISET: TWI WONT CONVERGE'
        TWIG=TWIG+0.5*(TWI-TWIG)
        GO TO 10
      ENDIF
      TWI=TWIG
      RETURN
      END
