SUBROUTINE TYPE73 (TIME,XIN,OUT,T,DTDT,PAR,INFO,ICNTRL,*) C************************************************************************ C* Copyright ASHRAE A Toolkit for Primary HVAC System Energy C* Calculation C*********************************************************************** C* SUBROUTINE: TYPE73 (ABSFLSIM) C* C* LANGAGE: FORTRAN 77 C* C* PURPOSE: Simulation of an absorption chiller in C* steady-state regime. The routine mainly C* calculates the cooling capacity and C* the steam consumption for specified C* conditions. The resolution technique is C* based on the Generalized Newton-Raphson C* method C*********************************************************************** C* INPUT VARIABLES C* Mfrwev Water mass flow rate in the evaporator (kg/s) C* xin(1) (kg/hr) C* Choice If Choice (-) C* =1: the absorber and the condenser are set in series C* =2: the absorber and the condenser are not set in C* series C* xin(2) (-) C* Mfrwabs Water mass flow rate in the absorber (kg/s) C* xin(3) (kg/hr) C* Mfrwcd Water mass flow rate in the condenser (kg/s) C* ( = 0 if Choice = 1 ) C* xin(4) (kg/hr) C* Twsuev Evaporator supply water temperature (K) C* xin(5) (øC) C* Twsuabs Absorber supply water temperature (K) C* xin(6) (øC) C* Twsucd Condenser supply water temperature (K) C* ( = 0 if Choice = 1 ) C* xin(7) (øC) C* psteam Steam pressure (Pa) C* xin(8) (atm) C* PevG Guess of the cooling capacity (W) C* xin(9) (kJ/hr) C* PabsG Guess of the heat rejected out of the absorber (W) C* xin(10) (kJ/hr) C* PcdG Guess of the heat rejected in the condenser (W) C* xin(11) (kJ/hr) C* C* OUTPUT VARIABLES C* Pev Cooling capacity (W) C* out(1) (kJ/hr) C* Pabs Heat rejected out of the absorber (W) C* out(2) (kJ/hr) C* Pcd Heat rejected in the condenser (W) C* out(3) (kJ/hr) C* Pgen Heat consumed by the generator (W) C* out(4) (kJ/hr) C* COP Coefficient of performance (-) C* out(5) (-) C* Twexev Evaporator exhaust water temperature (K) C* out(6) (øC) C* Twexabs Absorber exhaust water temperature (K) C* out(7) (øC) C* Twexcd Condenser exhaust water temperature (K) C* out(8) (øC) C* MfrSteam Steam mass flow rate (kg/s) C* out(9) (kg/hr) C* XUp Upper mass concentration (in percent) of LiBr (-) C* out(10) (-) C* h4 Enthalpy of the high-concentrated solution (J/kg) C* leaving the heat-exchanger C* out(11) (J/kg) C* XLow Lower mass concentration (in percent) of LiBr (-) C* out(12) (-) C* ErrDetec This variable is equal to 1 if the routine (-) C* does not converge, is equal to 2 if cristallization C* of the high-concentrated solution occurs at C* the heat-exchanger exhaust and is equal to 3 if the C* determinant of the matrix to be inversed is C* equal to 0 C* out(13) (-) C* C* PARAMETERS C* AUev Evaporator heat transfer coefficient (W/K) C* par(1) (kJ/hr/øC) C* AUcd Condenser heat transfer coefficient (W/K) C* par(2) (kJ/hr/øC) C* AUabs Absorber heat transfer coefficient (W/K) C* par(3) (kJ/hr/øC) C* AUgen Generator heat transfer coefficient (W/K) C* par(4) (kJ/hr/øC) C* AUexch Heat-exchanger heat transfer coefficient (W/K) C* par(5) (kJ/hr/øC) C* VLow Volume flow rate of weak solution (m**3/s) C* par(6) (m**3/hr) C* C* WATER PROPERTIES C* CpWat Specific heat of liquid water (J/kg/K) C* CpWatVap Specific heat of water vapor (J/kg/K) C* Hfg0 Latent heat of vaporization of water (J/kg) C* referenced at 273.15K C*********************************************************************** C MAJOR RESTRICTONS: The surrounding heat exchanges are C neglected. The refrigerant leaves the C evaporator and the condenser as saturated C vapor and saturated liquid respectively. C The steam is assumed to be C saturated . Perfect fluid properties C are used.The absorbent properties are C valid in the following range of mass C concentration of LiBr: 45 % to 70 % . C The compression of the solution is assumed C to be isenthalpic. C C DEVELOPERS: Jean Lebrun C Bruno Boulanger C Marc Grodent C Jean-Pascal Bourdouxhe C University of LiŠge,Belgium C C DATE: March 1, 1995 C C SUBROUTINES CALLED: ABSORP C LINKCK C C Modified for TRNSYS: January 26, 1995 C Jean-Pascal Bourdouxhe C*********************************************************************** C INTERNAL VARIABLES: C X Array containing: (W) C - the value of the 3 independent C variables ( X(J,1) ,J=1,3 ) C - the values of the independent variables used C to calculate the matrix of the numerical C derivatives ( X(I,J) ,I=1,3 and J=1,7 ) C F Array containing: (W) C - the value of the 3 functions to be C nullified ( F(J,1) ,J=1,3 ) C - the values of the functions to be nullified C used to calculate the matrix of the numerical C derivatives ( F(I,J) ,I=1,3 and J=2,7 ) C A Matrix of the numerical derivatives of the (-) C vectorial function F(J,1) C Amin Matrix of the cofactors of the matrix of the (-) C derivatives C Ainv Inverse matrix of the matrix of the derivatives (-) C DQ Increment (W) C DetA Determinant of the matrix of the derivatives (-) C TolRel Relative error tolerance (-) C ErrRel1 Relative error on the first function to be (-) C nullified C ErrRel2 Relative error on the second function to be (-) C nullified C ErrRel3 Relative error on the third function to be (-) C nullified C ErrRel Maximum of ErrRel1, ErrRel2 and ErrRel3 (-) C IterMax Maximum number of iterations (-) C Iter Counter (-) C NPAbschil Number of parameters (-) C C Pevp, Pcdp and Pabsp are variables used in the iterative scheme C*********************************************************************** IMPLICIT REAL*8 (A-H,O-Z) INTEGER*4 INFO DOUBLE PRECISION XIN,OUT REAL*8 Mfrwev,Mfrwabs,Mfrwcd,MfrSteam REAL*4 TIME,PAR DIMENSION PAR(6),XIN(11),OUT(13),INFO(15),X(3,7),F(3,7),A(3,3), & Amin(3,3),Ainv(3,3) COMMON /LUNITS/ LUR,LUW,IFORM,LUK COMMON /SIM/ TIME0,TFINAL,DELT,IWARN COMMON /STORE/ NSTORE,IAV,S(5000) COMMON /CONFIG/ TRNEDT,PERCOM,HEADER,PRTLAB,LNKCHK,PRUNIT,IOCHEK, & PRWARN INFO(6)=13 DATA DQ/1D-05/ DATA TolRel,IterMax/1D-05,50/ DATA CpWat,CpWatVap,Hfg0/4187.,1820.,2501000./ C*** INPUTS 11 (converted in SI units) C************* Mfrwev=xin(1)/3600. Choice=xin(2) Mfrwabs=xin(3)/3600. Mfrwcd=xin(4)/3600. Twsuev=xin(5)+273.15 Twsuabs=xin(6)+273.15 Twsucd=xin(7)+273.15 psteam=xin(8)*101325. PevG=xin(9)/3.6 PabsG=xin(10)/3.6 PcdG=xin(11)/3.6 C*** PARAMETERS 6 (converted in SI units) C**************** AUev=DBLE(par(1)/3.6) AUcd=DBLE(par(2)/3.6) AUabs=DBLE(par(3)/3.6) AUgen=DBLE(par(4)/3.6) AUexch=DBLE(par(5)/3.6) VLow=DBLE(par(6)/3600.) C2*** Initialization Pev=PevG Pcd=PcdG Pabs=PabsG ErrDetec=0 C1*** Beginning of the loop Iter=0 5 Iter=Iter+1 C2*** Construction of the matrix used to calculate the numerical C2*** derivatives of the vectorial function F(J,1) DO 10 J=1,7 X(1,J)=Pev X(2,J)=Pcd X(3,J)=Pabs 10 CONTINUE X(1,2)=X(1,2)+DQ X(1,3)=X(1,3)-DQ X(2,4)=X(2,4)+DQ X(2,5)=X(2,5)-DQ X(3,6)=X(3,6)+DQ X(3,7)=X(3,7)-DQ C1*** Calculate the matrix of the numerical derivatives C1*** of the vectorial function F(J,1) DO 20 J=1,7 CALL ABSORP(CpWat,CpWatVap,Hfg0,AUev,AUcd,AUabs,AUgen,AUexch, & VLow,Mfrwev,Twsuev,Mfrwabs,Twsuabs,Choice,Mfrwcd, & Twsucd,psteam,X(1,J),X(2,J),X(3,J),F(1,J),F(2,J),F(3,J), & Pgen,COP,Twexev,Twexabs,Twexcd,MfrSteam,XUp,h4,XLow, & ErrDetec) 20 CONTINUE DO 30 I=1,3 A(I,1)=(F(I,2)-F(I,3))/(2.*DQ) A(I,2)=(F(I,4)-F(I,5))/(2.*DQ) A(I,3)=(F(I,6)-F(I,7))/(2.*DQ) 30 CONTINUE C2*** Calculate the determinant of the matrix of the derivatives DetA=A(1,1)*(A(2,2)*A(3,3)-A(3,2)*A(2,3))-A(1,2)*(A(2,1)*A(3,3) & -A(3,1)*A(2,3))+A(1,3)*(A(2,1)*A(3,2)-A(3,1)*A(2,2)) IF (DetA.EQ.0.) THEN ErrDetec=3 GOTO 60 ENDIF C2*** Calculate the cofactors of the matrix of the derivatives Amin(1,1)=A(2,2)*A(3,3)-A(3,2)*A(2,3) Amin(1,2)=A(3,1)*A(2,3)-A(2,1)*A(3,3) Amin(1,3)=A(2,1)*A(3,2)-A(3,1)*A(2,2) Amin(2,1)=A(3,2)*A(1,3)-A(1,2)*A(3,3) Amin(2,2)=A(1,1)*A(3,3)-A(3,1)*A(1,3) Amin(2,3)=A(3,1)*A(1,2)-A(1,1)*A(3,2) Amin(3,1)=A(1,2)*A(2,3)-A(2,2)*A(1,3) Amin(3,2)=A(2,1)*A(1,3)-A(1,1)*A(2,3) Amin(3,3)=A(1,1)*A(2,2)-A(2,1)*A(1,2) C1*** Calculate the inverse matrix of the matrix of the derivatives DO 40 I=1,3 DO 50 J=1,3 Ainv(I,J)=Amin(J,I)/DetA 50 CONTINUE 40 CONTINUE C1*** Calculate a new value of the cooling capacity, the C1*** heat rejected in the condenser and the heat rejected C1*** out of the absorber by means of the GENERALIZED Newton-Raphson C1*** method Pevp=Pev Pcdp=Pcd Pabsp=Pabs Pev=Pev-Ainv(1,1)*F(1,1)-Ainv(1,2)*F(2,1)-Ainv(1,3)*F(3,1) Pcd=Pcd-Ainv(2,1)*F(1,1)-Ainv(2,2)*F(2,1)-Ainv(2,3)*F(3,1) Pabs=Pabs-Ainv(3,1)*F(1,1)-Ainv(3,2)*F(2,1)-Ainv(3,3)*F(3,1) ErrRel1=DABS((Pev-Pevp)/Pevp) ErrRel2=DABS((Pcd-Pcdp)/Pcdp) ErrRel3=DABS((Pabs-Pabsp)/Pabsp) ErrRel=DMAX1(ErrRel1,ErrRel2,ErrRel3) C2*** If converged, then leave the loop IF ((ErrRel.GT.TolRel).AND.(Iter.LE.IterMax)) GOTO 5 IF (Iter.GT.IterMax) THEN ErrDetec=1 GOTO 60 ENDIF C1*** Calculate the outputs of the absorption chiller simulation Pev=SNGL(Pevp) Pcd=SNGL(Pcdp) Pabs=SNGL(Pabsp) CALL ABSORP(CpWat,CpWatVap,Hfg0,AUev,AUcd,AUabs,AUgen,AUexch, & VLow,Mfrwev,Twsuev,Mfrwabs,Twsuabs,Choice,Mfrwcd, & Twsucd,psteam,Pevp,Pcdp,Pabsp,F1,F2,F3,Pgen,COP,Twexev, & Twexabs,Twexcd,MfrSteam,XUp,h4,XLow,ErrDetec) C*** OUTPUTS 13 (converted in TRNSYS units) C************** out(1)=Pev*3.6 out(2)=Pabs*3.6 out(3)=Pcd*3.6 out(4)=Pgen*3.6 out(5)=COP out(6)=Twexev-273.15 out(7)=Twexabs-273.15 out(8)=Twexcd-273.15 out(9)=MfrSteam*3600. out(10)=XUp out(11)=h4 out(12)=XLow 60 out(13)=ErrDetec RETURN 1 END SUBROUTINE ABSORP(CpWat,CpWatVap,Hfg0,AUev,AUcd,AUabs,AUgen, & AUexch,VLow,Mfrwev,Twsuev,Mfrwabs,Twsuabs,Choice, & Mfrwcd,Twsucd,psteam,Pev,Pcd,Pabs,F1,F2,F3,Pgen,COP, & Twexev,Twexabs,Twexcd,MfrSteam,XUp,h4,XLow,ErrDetec) C************************************************************************ C* Copyright ASHRAE A Toolkit for Primary HVAC System Energy C* Calculation C*********************************************************************** C* SUBROUTINE: ABSORP C* C* LANGAGE: FORTRAN 77 C* C* PURPOSE: Simulation of an absorption chiller in C* steady-state regime. C* The cooling capacity, the heat C* rejected in the condenser and the heat C* rejected out of the absorber are known C* a priori. C*********************************************************************** C* INPUT VARIABLES C* Mfrwev Water mass flow rate in the evaporator (kg/s) C* Choice If Choice (-) C* =1: the absorber and the condenser are set in series C* =2: the absorber and the condenser are not set in C* series C* Mfrwabs Water mass flow rate in the absorber (kg/s) C* Mfrwcd Water mass flow rate in the condenser (kg/s) C* ( = 0 if Choice = 1 ) C* Twsuev Evaporator supply water temperature (K) C* Twsuabs Absorber supply water temperature (K) C* Twsucd Condenser supply water temperature (K) C* ( = 0 if Choice = 1 ) C* psteam Steam pressure (Pa) C* Pev Cooling capacity (W) C* Pabs Heat rejected out of the absorber (W) C* Pcd Heat rejected in the condenser (W) C* C* OUTPUT VARIABLES C* Pgen Heat consumed by the generator (W) C* COP Coefficient of performance (-) C* Twexev Evaporator exhaust water temperature (K) C* Twexabs Absorber exhaust water temperature (K) C* Twexcd Condenser exhaust water temperature (K) C* MfrSteam Steam mass flow rate (kg/s) C* XUp Upper mass concentration (in percent) of LiBr (-) C* h4 Enthalpy of the high-concentrated solution (J/kg) C* leaving the heat-exchanger C* XLow Lower mass concentration (in percent) of LiBr (-) C* ErrDetec This variable is equal to 2 if cristallization (-) C* of the high-concentrated solution occurs at C* the heat-exchanger exhaust C* F1 Value of the first function to be nullified (W) C* F2 Value of the second function to be nullified (W) C* F3 Value of the third function to be nullified (W) C* C* PARAMETERS C* AUev Evaporator heat transfer coefficient (W/K) C* AUcd Condenser heat transfer coefficient (W/K) C* AUabs Absorber heat transfer coefficient (W/K) C* AUgen Generator heat transfer coefficient (W/K) C* AUexch Heat-exchanger heat transfer coefficient (W/K) C* VLow Volume flow rate of weak solution (m**3/s) C* C* WATER PROPERTIES C* CpWat Specific heat of liquid water (J/kg/K) C* CpWatVap Specific heat of water vapor (J/kg/K) C* Hfg0 Latent heat of vaporization of water (J/kg) C* referenced at 273.15K C* The following coefficients are introduced as data in the routine: C* Aw1,Bw1 Coefficients used in the Clausius-Clapeyron equation C* in a range from 273.15K to 373.15K C* Aw2,Bw2 Coefficients used in the Clausius-Clapeyron equation C* in a range from 373.15K to 493.15K C* C* PROPERTIES OF THE LITHIUM BROMIDE SOLUTION C* (these properties are introduced as data in the routine) C* A1x,A2x,Bx Coefficients used in the Clausius-Clapeyron equation C* Dho Enthalpy increase dut to 1% of concentration C* variation at the reference temperature (J/kg) C* Xo Reference concentration (-) C* c1x,c2x Coefficients used to calculate the specific (J/kg/K) C* heat of the solution C* v1x,v2x Coefficients used to calculate the specific (m**3/kg) C* volume of the solution C* hmin1,hmin2 Coefficients used to calculate the enthalpy (J/kg) C* at the cristallization limit C*********************************************************************** C MAJOR RESTRICTONS: The surrounding heat exchanges are C neglected. The refrigerant leaves the C evaporator and the condenser as saturated C vapor and saturated liquid respectively. C The steam is assumed to be C saturated . Perfect fluid properties C are used.The absorbent properties are C valid in the following range of mass C concentration of LiBr: 45 % to 70 % . C The compression of the solution is assumed C to be isenthalpic. C C DEVELOPERS: Jean Lebrun C Bruno Boulanger C Marc Grodent C Jean-Pascal Bourdouxhe C University of LiŠge,Belgium C C DATE: March 1, 1995 C*********************************************************************** C INTERNAL VARIABLES: C Effev Evaporator effectiveness (-) C Effabs Absorber effectiveness (-) C Effcd Condenser effectiveness (-) C Tev Evaporating temperature (K) C pevap Evaporating pressure (Pa) C h7 Enthalpy of the refrigerant at the evaporator (J/kg) C exhaust C Tabs Temperature of the solution at the absorber (K) C exhaust C h1 Enthalpy of the solution at the absorber (J/kg) C exhaust C MfrLow Mass flow rate of the low-concentrated (kg/s) C solution C Tcd Condensing temperature (K) C pcond Condensing pressure (Pa) C h6 Enthalpy of the refrigerant at the condenser (J/kg) C exhaust C Tsteam Steam temperature (K) C Tgen Temperature of the solution at the generator (K) C exhaust C h5 Enthalpy of the refrigerant leaving the (J/kg) C generator C h3 Enthalpy of the solution at the generator (J/kg) C exhaust C MfrUp Mass flow rate of the high-concentrated (kg/s) C solution C MfrRef Refrigerant mass flow rate (kg/s) C NTU Number of transfer units of the heat-exchanger (-) C C Ratio of the capacity flow rates associated (-) C with the heat-exchanger C Effexch Heat-exchanger effectiveness (-) C Pexch Heat transfer in the heat-exchanger (W) C hMin Minimum enthalpy of the high-concentrated (J/kg) C solution allowed at the heat-exchanger exhaust C cSolUp Specific heat of the high-concentrated (J/kg/K) C solution C cSolLow Specific heat of the low-concentrated (J/kg/K) C solution C hg Enthalpy of water vapor ( steam side ) (J/kg) C hf Enthalpy of liquid water ( steam side ) (J/kg) C To Reference temperature (K) C NPAbschil Number of parameters (-) C*********************************************************************** IMPLICIT REAL*8 (A-H,O-Z) REAL*8 Mfrwev,Mfrwabs,Mfrwcd,MfrSteam,MfrLow,MfrUp,MfrRef,NTU DATA c1x,c2x/3500.,26.53/ DATA v1x,v2x/1.0111D-03,7.1622D-06/ DATA A1x,A2x,Bx/29.37,0.091,-5371./ DATA Aw1,Bw1,Aw2,Bw2/25.5069,-5204.62,24.3902,-4793.124/ DATA Dho,Xo,To/5105.87,50.,273.15/ DATA hmin1,hmin2/-1396670.,24000./ C2*** If the absorber and the condenser are set in series: IF (Choice.EQ.1) THEN Mfrwcd=Mfrwabs ENDIF C1*** Calculate the evaporator, absorber and condenser effectiveness Effev=1.-DEXP(-AUev/(Mfrwev*CpWat)) Effabs=1.-DEXP(-AUabs/(Mfrwabs*CpWat)) Effcd=1.-DEXP(-AUcd/(Mfrwcd*CpWat)) C1*** Calculate the water steam temperature IF (psteam.LT.101320.) THEN Tsteam=Bw1/(DLOG(psteam)-Aw1) ELSE Tsteam=Bw2/(DLOG(psteam)-Aw2) ENDIF C1*** Calculate the evaporating temperature Tev=Twsuev-Pev/(Effev*Mfrwev*CpWat) C1*** Calculate the evaporating pressure pevap=DEXP(Aw1+Bw1/Tev) C1*** Calculate the enthalpy of the refrigerant at the evaporator C1*** exhaust h7=Hfg0+CpWatVap*(Tev-To) C1*** Calculate the absorber exhaust water temperature Twexabs=Twsuabs+Pabs/(Mfrwabs*CpWat) C1*** Calculate the solution temperature at the absorber exhaust Tabs=Twsuabs+Pabs/(Effabs*Mfrwabs*CpWat) C1*** Calculate the mass concentration of LiBr ( in percent ) in the C1*** low-concentrated solution XLow=(Bx+A1x*Tabs-Tabs*DLOG(pevap))/(A2x*Tabs) C1*** Calculate the mass flow rate of the low concentrated solution MfrLow=VLow/(v1x-v2x*XLow) C1*** Calculate the enthalpy of the solution at the absorber exhaust cSolLow=c1x-c2x*XLow h1=Dho*(XLow-Xo)+cSolLow*(Tabs-To) C2*** If the absorber and the condenser are set in series: IF (Choice.EQ.1) THEN Twsucd=Twexabs ENDIF C1*** Calculate the condensing temperature Tcd=Twsucd+Pcd/(Effcd*Mfrwcd*CpWat) C1*** Calculate the condensing pressure pcond=DEXP(Aw1+Bw1/Tcd) C1*** Calculate the enthalpy of the refrigerant at the condenser C1*** exhaust h6=CpWat*(Tcd-To) C1*** Calculate the heat consumed by the generator Pgen=Pcd+Pabs-Pev C1*** Calculate the solution temperature at the generator exhaust Tgen=Tsteam-Pgen/AUgen C1*** Calculate the mass concentration of LiBr ( in percent ) in the C1*** high-concentrated solution XUp=(Bx+A1x*Tgen-Tgen*DLOG(pcond))/(A2x*Tgen) C1*** Calculate the mass flow rate of the high concentrated solution MfrUp=XLow*MfrLow/XUp C1*** Calculate the refrigerant mass flow rate MfrRef=MfrLow-MfrUp C1*** Calculate the enthalpy of the refrigerant leaving the generator h5=Hfg0+CpWatVap*(Tgen-To) C1*** Calculate the enthalpy of the solution at the generator exhaust cSolUp=c1x-c2x*XUp h3=Dho*(XUp-Xo)+cSolUp*(Tgen-To) C1*** Calculate the heat transfer in the heat-exchanger NTU=AUexch/(MfrUp*cSolUp) C=MfrUp*cSolUp/(MfrLow*cSolLow) IF (C.LE.995D-03) THEN Effexch=(1.-DEXP(-NTU*(1.-C)))/(1.-C*DEXP(-NTU*(1.-C))) ELSE Effexch=NTU/(1+NTU) ENDIF Pexch=Effexch*MfrUp*cSolUp*(Tgen-Tabs) C1*** Calculate the enthalpy of the high-concentrated solution C1*** at the heat-exchanger exhaust h4=h3-Pexch/MfrUp C1*** Calculate the value of the functions to be nullified F1=Pev-MfrRef*(h7-h6) F2=Pcd-MfrRef*(h5-h6) F3=Pabs-MfrRef*h7-MfrUp*h4+MfrLow*h1 C1*** Verify if no cristallisation occurs at the heat-exchanger exhaust hMin=hmin1+hmin2*XUp IF (h4.LT.hMin) THEN ErrDetec=2 ELSE ErrDetec=0 ENDIF C1*** Calculate the coefficient of performance COP=Pev/Pgen C1*** Calculate the evaporator exhaust water temperature Twexev=Twsuev-Pev/(Mfrwev*CpWat) C1*** Calculate the condenser exhaust water temperature Twexcd=Twsucd+Pcd/(Mfrwcd*CpWat) C1*** Calculate the water steam mass flow rate hg=Hfg0+CpWatVap*(Tsteam-To) hf=CpWat*(Tsteam-To) MfrSteam=Pgen/(hg-hf) RETURN END SUBROUTINE LINKCK(ENAME1,ENAME2,ILINK,LNKTYP) C*************************************************************************** C THIS SUBROUTINE WAS WRITTEN FOR TRNSYS 14.0 LINK CHECKING - THIS ROUTINE C IS CALLED BY OTHER SUBROUTINES WHEN AN UNLINKED SUBROUTINE HAS BEEN C FOUND. LINKCK IS NEEDED IN ORDER TO AVOID PUTTING COMMON BLOCKS LUNITS C AND CONFIG IN THE TRNSYS TYPES - JWT -- 3/93 C*************************************************************************** COMMON /LUNITS/ LUR,LUW,IFORM,LUK COMMON /CONFIG/ TRNEDT,PERCOM,HEADER,PRTLAB,LNKCHK,PRUNIT,IOCHEK, 1 PRWARN COMMON /SIM/TIME0,TFINAL,DELT,IWARN CHARACTER*1 TRNEDT,PERCOM,HEADER,PRTLAB,LNKCHK,PRUNIT,IOCHEK, 1 PRWARN CHARACTER*6 ENAME1,ENAME2 INTEGER ILINK,LNKTYP C ILINK = 1 --> GENERATE AN ERROR MESSAGE AND STOP TRNSYS C ILINK = 2 --> GENERATE A WARNING BUT DON'T STOP TRNSYS C ILINK = 3 --> TRNSYS HAS FOUND AN UNLINKED TYPE - GENERATE AN ERROR AND C STOP THE PROGRAM C ILINK = 4 --> WARN THE USER THAT A ROUTINE REQUIRES AN EXTERNAL FUNCTION C ENAME1 --> CALLING PROGRAM THAT NEEDED THE UNLINKED FILE C ENAME2 --> FILE THAT WAS NOT FOUND BY ENAME1 SUBROUTINE C LNKTYP --> TYPE NUMBER THAT IS UNLINKED IF((LNKCHK.EQ.'Y').OR.(LNKCHK.EQ.'y')) THEN IF(ILINK.EQ.1) THEN WRITE(LUW,20) 104,ENAME1,ENAME2 WRITE(LUW,15) CALL MYSTOP(104) ELSE IF(ILINK.EQ.2) THEN WRITE(LUW,20) 104,ENAME1,ENAME2 IWARN=IWARN+1 ELSE IF(ILINK.EQ.3) THEN WRITE(LUW,25) 105,LNKTYP,LNKTYP WRITE(LUW,15) CALL MYSTOP(105) ELSE IF(ILINK.EQ.4) THEN WRITE(LUW,35) LNKTYP,ENAME1,ENAME2 IWARN=IWARN+1 ELSE IF(ILINK.EQ.5) THEN WRITE(LUW,40) 105,LNKTYP,LNKTYP WRITE(LUW,15) CALL MYSTOP(105) ELSE WRITE(LUW,30) ENAME1 IWARN=IWARN+1 ENDIF ENDIF 15 FORMAT(//2X,47H*** SIMULATION TERMINATED WITH ERROR STATUS ***/) 20 FORMAT(//,1X,'***** ERROR *****',8X,'TRNSYS ERROR # ',I3,/1X,A6, 1' REQUIRES THE FILE "',A6,'" WHICH WAS CALLED BUT NOT LINKED.',/1X 1,'PLEASE LINK IN THE REQUIRED FILE AND RERUN THE SIMULATION.') 25 FORMAT(//,1X,'***** ERROR *****',8X,'TRNSYS ERROR # ',I3,/1X, 1'TYPE ',I3,' WAS CALLED IN THE TRNSYS INPUT FILE BUT NOT LINKED.', 1/1X,'LINK TYPE ',I3,' BEFORE RUNNING THIS SIMULATION.') 30 FORMAT(/1X,'*****WARNING*****',/1X,'THE LINKCK SUBROUTINE WAS CALL 1ED WITH AN INVALID OPERAND.',/1X,'THE PROGRAM WHICH CALLED LINKCK 1WITH THE IMPROPER OPERAND WAS ',A6,'.',/1X,'PLEASE MAKE SURE THAT 1THE CALLING PROGRAM IS FIXED OR UNLINKED SUBROUTINES MAY ',/1X,'GO 1 UNNOTICED.') 35 FORMAT(/1X,'*****WARNING*****',/1X,'UNIT ',I2,' ',A6,' REQUIRES TH 1E SUBROUTINE ',A6,/1X,'MAKE SURE THAT THIS SUBROUTINE IS LINKED IN 1 TO AVOID PROBLEMS. IT MAY ALREADY BE LINKED IN.',/) 40 FORMAT(//,1X,'***** ERROR *****',8X,'TRNSYS ERROR # ',I3,/1X, 1'TYPE',I3,' WAS CALLED IN THE TRNSYS INPUT FILE BUT NOT LINKED.', 1/1X,'A DUMMY TYPE SUBROUTINE WAS CALLED IN ITS PLACE. PLEASE LINK' 1,/1X,'TYPE',I3,' BEFORE RUNNING THIS SIMULATION OR TURN OFF THE CH 1ECK'/1X,'FOR UNLINKED SUBROUTINES OPTION IN THE CONFIGURATION FILE 1.') RETURN END