[TRNSYS-users] Storage Vars problem

David BRADLEY d.bradley at tess-inc.com
Tue Apr 10 12:39:29 PDT 2012


Vincenzo,
I think the problem is in the section that is called at the very end of 
the timestep (when INFO(13) > 0). I think you need to read the values 
out of storage spots 2 and 4, then plug those into storage spots 1 and 
3. Also you need to call the function setStorageVars, not getStorageVars 
before returning. Here is more or less what you have:

	CALL getStorageVars(Stored,StorageSize,INFO)
	Stored(1)=t_letto
	Stored(3)=wst
         call getStorageVars(Stored,StorageSize,INFO)

I think it should be more like:

         CALL getStorageVars(Stored,StorageSize,INFO)
	Stored(1)= Stored(2)
	Stored(3)= Stored(4)
         call setStorageVars(Stored,StorageSize,INFO)


Best,
  David




On 4/4/2012 17:27, vincenzo gentile wrote:
> Hello TRNSYS-Users,
> i want to create a Type to describe an adsorbent packed bed, but i
> think have a problem with the storage vars. I used it to update two
> values of the output (obtained by solving the system of equation for a
> time step)  to two initial values of the equation's system, to solve
> it for the next time step. But really this operation to save a value
> of the output and update to an initial value, functions only for one
> of these values (t_letto), and only for three time step. After this
> time TRNSYS gives me a flat characteristics. Instead for the other
> value (wst) TRNSYS calculates it only for the first time step, and
> keeps it costant for the rest of simualtion.
> I attached the source code for the case anybody would like to look through.
> I appreciate every advice to solve this problem.
> Thanks in advance.
> Vincenzo
>
> PS: t0_letto and w0_letto are the initial values of these two otuput
> (t_letto, wst) for the initial timestep, they are inserted like
> parameters in the proforma.
>
> 			SUBROUTINE TYPE161 (TIME,XIN,OUT,T,DTDT,PAR,INFO,ICNTRL,*)
> C************************************************************************
> C Object: letto_adsorbente
> C Simulation Studio Model: 161
> C
> C Author:
> C Editor:
> C Date:	 marzo 26, 2012 last modified: marzo 26, 2012
> C
> C
> C ***
> C *** Model Parameters
> C ***
> C			l	- [-Inf;+Inf]
> C			grad_vuoto	- [-Inf;+Inf]
> C			Sezione	- [-Inf;+Inf]
> C			d_silicagel	- [-Inf;+Inf]
> C			rho_silicagel	- [-Inf;+Inf]
> C			t0_letto	- [-Inf;+Inf]
> C			w0_letto	- [-Inf;+Inf]
>
> C ***
> C *** Model Inputs
> C ***
> C			t_amb	- [-Inf;+Inf]
> C			equi	- [-Inf;+Inf]
> C			ads	- [-Inf;+Inf]
> C			portata	- [-Inf;+Inf]
> C			x_amb	- [-Inf;+Inf]
>
> C ***
> C *** Model Outputs
> C ***
> C			intervallo	- [-Inf;+Inf]
> C			velocit	- [-Inf;+Inf]
> C			area_sup	- [-Inf;+Inf]
> C			massa	- [-Inf;+Inf]
> C			t_aria_in	- [-Inf;+Inf]
> C			num_part	- [-Inf;+Inf]
> C			miu	- [-Inf;+Inf]
> C			k1	- [-Inf;+Inf]
> C			k2	- [-Inf;+Inf]
> C			w_eq	- [-Inf;+Inf]
> C			x_aria_out	- [-Inf;+Inf]
> C			wst_prec	- [-Inf;+Inf]
> C			wst	- [-Inf;+Inf]
> C			H_ads	- [-Inf;+Inf]
> C			i	- [-Inf;+Inf]
> C			g	- [-Inf;+Inf]
> C			t0_letto_K	- [-Inf;+Inf]
> C			t_letto_prec_k	- [-Inf;+Inf]
> C			t_letto	- [-Inf;+Inf]
> C			t_aria	- [-Inf;+Inf]
> C			dx	- [-Inf;+Inf]
> C			t_equilibrata	- [-Inf;+Inf]
> C			c	- [-Inf;+Inf]
> C			d	- [-Inf;+Inf]
> C			e	- [-Inf;+Inf]
> C			perdita_carico	- [-Inf;+Inf]
>
> C ***
> C *** Model Derivatives
> C ***
>
> C (Comments and routine interface generated by TRNSYS Studio)
> C************************************************************************
>
> C    TRNSYS acess functions (allow to acess TIME etc.)
>        USE TrnsysConstants
>        USE TrnsysFunctions
>
> C-----------------------------------------------------------------------------------------------------------------------
> C    REQUIRED BY THE MULTI-DLL VERSION OF TRNSYS
>        !DEC$ATTRIBUTES DLLEXPORT :: TYPE161				!SET THE CORRECT TYPE NUMBER HERE
> C-----------------------------------------------------------------------------------------------------------------------
> C-----------------------------------------------------------------------------------------------------------------------
> C    TRNSYS DECLARATIONS
>        IMPLICIT NONE			!REQUIRES THE USER TO DEFINE ALL VARIABLES
> BEFORE USING THEM
>
> 	DOUBLE PRECISION XIN	!THE ARRAY FROM WHICH THE INPUTS TO THIS TYPE
> WILL BE RETRIEVED
> 	DOUBLE PRECISION OUT	!THE ARRAY WHICH WILL BE USED TO STORE THE
> OUTPUTS FROM THIS TYPE
> 	DOUBLE PRECISION TIME	!THE CURRENT SIMULATION TIME - YOU MAY USE THIS
> VARIABLE BUT DO NOT SET IT!
> 	DOUBLE PRECISION PSYDAT(1)
> 	DOUBLE PRECISION PAR	!THE ARRAY FROM WHICH THE PARAMETERS FOR THIS
> TYPE WILL BE RETRIEVED
> 	DOUBLE PRECISION STORED !THE STORAGE ARRAY FOR HOLDING VARIABLES FROM
> TIMESTEP TO TIMESTEP
> 	DOUBLE PRECISION T		!AN ARRAY CONTAINING THE RESULTS FROM THE
> DIFFERENTIAL EQUATION SOLVER
> 	DOUBLE PRECISION DTDT	!AN ARRAY CONTAINING THE DERIVATIVES TO BE
> PASSED TO THE DIFF.EQ. SOLVER
> 	DOUBLE PRECISION StorageArray(1)
> 	INTEGER StorageSize
> 	INTEGER*4 INFO(15),IUNITS,MODE,WBMODE,EMODE,STATUS	!THE IFO ARRAY
> STORES AND PASSES VALUABLE INFORMATION TO AND FROM THIS TYPE
> 	INTEGER*4 NP,NI,NOUT,ND	!VARIABLES FOR THE MAXIMUM NUMBER OF
> PARAMETERS,INPUTS,OUTPUTS AND DERIVATIVES
> 	INTEGER*4 NPAR,NIN,NDER	!VARIABLES FOR THE CORRECT NUMBER OF
> PARAMETERS,INPUTS,OUTPUTS AND DERIVATIVES
> 	INTEGER*4 IUNIT,ITYPE	!THE UNIT NUMBER AND TYPE NUMBER FOR THIS COMPONENT
> 	INTEGER*4 ICNTRL		!AN ARRAY FOR HOLDING VALUES OF CONTROL FUNCTIONS
> WITH THE NEW SOLVER
> 	INTEGER*4 NSTORED		!THE NUMBER OF VARIABLES THAT WILL BE PASSED INTO
> AND OUT OF STORAGE
> 	CHARACTER*3 OCHECK		!AN ARRAY TO BE FILLED WITH THE CORRECT VARIABLE
> TYPES FOR THE OUTPUTS
> 	CHARACTER*3 YCHECK		!AN ARRAY TO BE FILLED WITH THE CORRECT VARIABLE
> TYPES FOR THE INPUTS
> 	CHARACTER*50	valore non valido
> C-----------------------------------------------------------------------------------------------------------------------
>
> C-----------------------------------------------------------------------------------------------------------------------
> C    USER DECLARATIONS - SET THE MAXIMUM NUMBER OF PARAMETERS (NP), INPUTS (NI),
> C    OUTPUTS (NOUT), AND DERIVATIVES (ND) THAT MAY BE SUPPLIED FOR THIS TYPE
>        PARAMETER (NP=7,NI=5,NOUT=26,ND=0,NSTORED=4)
> C-----------------------------------------------------------------------------------------------------------------------
>
> C-----------------------------------------------------------------------------------------------------------------------
> C    REQUIRED TRNSYS DIMENSIONS
>        DIMENSION XIN(NI),OUT(NOUT),PAR(NP),YCHECK(NI),OCHECK(NOUT),
> 	1   STORED(NSTORED),T(ND),DTDT(ND)
>        INTEGER NITEMS
> C-----------------------------------------------------------------------------------------------------------------------
> C-----------------------------------------------------------------------------------------------------------------------
> C    ADD DECLARATIONS AND DEFINITIONS FOR THE USER-VARIABLES HERE
>
>
> C    PARAMETERS
>        DOUBLE PRECISION l
>        DOUBLE PRECISION grad_vuoto
>        DOUBLE PRECISION Sezione
>        DOUBLE PRECISION d_silicagel
>        DOUBLE PRECISION rho_silicagel
>        DOUBLE PRECISION t0_letto
>        DOUBLE PRECISION w0_letto
> 	DOUBLE PRECISION PATM
>
> C    INPUTS
>        DOUBLE PRECISION t_amb
>        DOUBLE PRECISION equi
>        DOUBLE PRECISION ads
>        DOUBLE PRECISION portata
>        DOUBLE PRECISION x_amb
>
> c	OUTPUTS
> 	DOUBLE PRECISION intervallo,
>       &velocit,
>       &area_sup,
>       &massa,
>       &t_aria_in,
>       &num_particelle,
>       &miu,
>       &k1,
>       &k2,
>       &w_eq,
>       &x_out,
>       &wst_prec,
>       &w0_letto_ads,
>       &wst,
>       &H_ads,
>       &i,
>       &g,
>       &t0_letto_K,
>       &t_letto_prec_k,
>       &t_letto,
>       &t_aria,
>       &dx,
>       &t_equilibrata,
>       &c,
>       &d,
>       &e,
>       &perdita_carico,
>       &TWET,
>       &RELHUM,
>       &TDEW,
>       &ENTHAL,
>       &DELT
>
> 	DATA PATM/1.0/
> C	GET GLOBAL TRNSYS SIMULATION VARIABLES
> 	DELT = getSimulationTimeStep()
> C-----------------------------------------------------------------------------------------------------------------------
> C       READ IN THE VALUES OF THE PARAMETERS IN SEQUENTIAL ORDER
>        l=PAR(1)
>        grad_vuoto=PAR(2)
>        Sezione=PAR(3)
>        d_silicagel=PAR(4)
>        rho_silicagel=PAR(5)
>        t0_letto=PAR(6)
>        w0_letto=PAR(7)
> 	
>
> C-----------------------------------------------------------------------------------------------------------------------
> C    RETRIEVE THE CURRENT VALUES OF THE INPUTS TO THIS MODEL FROM THE
> XIN ARRAY IN SEQUENTIAL ORDER
>
>        t_amb=XIN(1)
>        equi=XIN(2)
>        ads=XIN(3)
>        portata=XIN(4)
>        x_amb=XIN(5)
> 	   IUNIT=INFO(1)
> 	   ITYPE=INFO(2)
>
> C-----------------------------------------------------------------------------------------------------------------------
> C    SET THE VERSION INFORMATION FOR TRNSYS
>        IF(INFO(7).EQ.-2) THEN
> 	   INFO(12)=16
> 	   RETURN 1
> 	ENDIF
> C-----------------------------------------------------------------------------------------------------------------------
>
> C-----------------------------------------------------------------------------------------------------------------------
> C    DO ALL THE VERY LAST CALL OF THE SIMULATION MANIPULATIONS HERE
>        IF (INFO(8).EQ.-1) THEN
> 	   RETURN 1
> 	ENDIF
> C-----------------------------------------------------------------------------------------------------------------------
>
> C-----------------------------------------------------------------------------------------------------------------------
> C    PERFORM ANY 'AFTER-ITERATION' MANIPULATIONS THAT ARE REQUIRED HERE
> C    e.g. save variables to storage array for the next timestep
>        IF (INFO(13).GT.0) THEN
> 	CALL getStorageVars(Stored,StorageSize,INFO)
> 	Stored(1)=t_letto
> 	Stored(3)=wst
> 	call getStorageVars(Stored,StorageSize,INFO)
> C	   STORED(1)=... (if NITEMS>  0)
> C        CALL setStorageVars(STORED,NITEMS,INFO)
> 	ENDIF
> C
> C-----------------------------------------------------------------------------------------------------------------------
>
> C-----------------------------------------------------------------------------------------------------------------------
> C    DO ALL THE VERY FIRST CALL OF THE SIMULATION MANIPULATIONS HERE
>        IF (INFO(7).EQ.-1) THEN
>
> C       SET SOME INFO ARRAY VARIABLES TO TELL THE TRNSYS ENGINE HOW
> THIS TYPE IS TO WORK
>           INFO(6)=NOUT				
>           INFO(9)=1				
> 	   INFO(10)=0	!STORAGE FOR VERSION 16 HAS BEEN CHANGED				
>
> C       SET THE REQUIRED NUMBER OF INPUTS, PARAMETERS AND DERIVATIVES
> THAT THE USER SHOULD SUPPLY IN THE INPUT FILE
> C       IN SOME CASES, THE NUMBER OF VARIABLES MAY DEPEND ON THE VALUE
> OF PARAMETERS TO THIS MODEL....
>           NIN=NI
> 	   NPAR=NP
> 	   NDER=ND
> 	
> C       CALL THE TYPE CHECK SUBROUTINE TO COMPARE WHAT THIS COMPONENT
> REQUIRES TO WHAT IS SUPPLIED IN
> C       THE TRNSYS INPUT FILE
> 	   CALL TYPECK(1,INFO,NIN,NPAR,NDER)
>
> C       SET THE NUMBER OF STORAGE SPOTS NEEDED FOR THIS COMPONENT
>           StorageSize=4
> 	CALL setStorageSize(StorageSize,INFO)
> C	   CALL setStorageSize(NITEMS,INFO)
>
> C       RETURN TO THE CALLING PROGRAM
>           RETURN 1
>
>        ENDIF
> C-----------------------------------------------------------------------------------------------------------------------
>
> C-----------------------------------------------------------------------------------------------------------------------
> C    DO ALL OF THE INITIAL TIMESTEP MANIPULATIONS HERE - THERE ARE NO
> ITERATIONS AT THE INTIAL TIME
>        IF (TIME .LT. (getSimulationStartTime() +
>       . getSimulationTimeStep()/2.D0)) THEN
>
> C       SET THE UNIT NUMBER FOR FUTURE CALLS
>           IUNIT=INFO(1)
>           ITYPE=INFO(2)
>
> C       CHECK THE PARAMETERS FOR PROBLEMS AND RETURN FROM THE
> SUBROUTINE IF AN ERROR IS FOUND
> C         IF(...) CALL TYPECK(-4,INFO,0,"BAD PARAMETER #",0)
>
> C       PERFORM ANY REQUIRED CALCULATIONS TO SET THE INITIAL VALUES OF
> THE OUTPUTS HERE
> C		 intervallo
> 			OUT(1)= delt*3600
> C		 velocit
> 			OUT(2)=portata/(sezione*3600)
> C		 area_sup
> 	        OUT(3)=6*(((3.14*(D_silicagel)**2)/4)*(L*sezione*
>       &(1-grad_vuoto))/(3.14*d_silicagel**3))/(L*Sezione)
> C		 massa
> 			OUT(4)=sezione*l*(1-grad_vuoto)*rho_silicagel
> C		 t_aria_in
> 			OUT(5)=t_amb
> C		 num_part
> 			OUT(6)=(L*sezione*(1-grad_vuoto))/(3.14*d_silicagel**3)
> C		 miu
> 			OUT(7)=((((0.622/(0.622+x_amb))*(7.801*(
>       &(t_amb+273)/100)-0.626*((
>       &(t_amb+273)/100)**2)+0.02942*(((t_amb+273)/100)**3)+0.0076
>       &9*(1.293*(273/(t_amb+273))))+(x_amb/(0.622+x_amb))*(40.407/(
>       &((t_amb+273)/100)**2)-18.473/((t_amb+273)/100)+3.853*((
>       &t_amb+273)/100)+(0.006*exp(0.05*t_amb))*(RELHUM/100)*
>       &(0.0407-(1.988/((t_amb+273)/100))))))*((((x_amb/(0.622+x_amb))
>       &-((x_amb/(0.622+x_amb))**2))/2.75)+1))/1000000
> C		 k1
> 	OUT(8)=0.000000011*(t_amb)**4-0.000001901*(t_amb)**3
>       &+0.000119197*(t_amb)**2-0.003107449*(t_amb)+
>       &0.027364286
> C		 k2
> 	OUT(9)=-0.00000017*(t_amb)**4+0.000033428*(t_amb)**3-
>       &0.002105473*(t_amb)**2+0.05610934*(t_amb)-
>       &0.496785714
> C		 w_eq
> 	OUT(10)=(x_amb-(0.000000011*(t_amb)**4-0.000001901*
>       &(t_amb)**3+0.000119197*(t_amb)**2-0.003107449
>       &*t_amb+0.027364286))/(-0.00000017*(t_amb)**4+0.000033428
>       &*(t_amb)**3-0.002105473*(t_amb)**2+0.05610934*t_amb-
>       &0.496785714)
> C		 x_aria_out
> 	OUT(11)=x_amb
> C		 wst_prec
> 			OUT(12)=w0_letto
> C		 wst
> 			OUT(13)=w0_letto
> C		 H_ads
> 	OUT(14)=0
> C		 i
> 	OUT(15)=0.1263
> C		 g
> 	OUT(16)=7.833
>
> C		 t0_letto_K
> 			OUT(17)=t0_letto_K
> C		 t_letto_prec_k
> 			OUT(18)=t0_letto
> C		 t_letto
> 			OUT(19)=t0_letto
> C		 t_aria
> 			OUT(20)=t0_letto+(t_amb-t0_letto)*exp(-0.1263)
> C		 dx
> 			OUT(21)=0
> C		 t_equilibrata
> 	OUT(22)=(t0_letto)+(t_amb-t0_letto)*exp(-0.1263)
> C		 c
> 			OUT(23)=c
> C		 d
> 			OUT(24)=d
> C		 e
> 			OUT(25)=e
> C		 perdita_carico
> 			OUT(26)=perdita_carico
>
> C       PERFORM ANY REQUIRED CALCULATIONS TO SET THE INITIAL STORAGE
> VARIABLES HERE
>
> 	STORED(1)=t0_letto
> 	STORED(2)=t_letto
> 	STORED(3)=w0_letto
> 	STORED(4)=wst
> C	   STORED(1)=...
>
> C       PUT THE STORED ARRAY IN THE GLOBAL STORED ARRAY
>           CALL setStorageVars(STORED,StorageSize,INFO)
> c	  CALL PSYCHROMETRICS SUBROUTINE
> 	PSYDAT(1) = PATM
> 	PSYDAT(2) = t_amb
> 	PSYDAT(3) = TWET
> 	PSYDAT(4) = RELHUM
> 	PSYDAT(5) = TDEW
> 	PSYDAT(6) = x_amb
> 	PSYDAT(7) = ENTHAL
> C     DO NOT PRINT ERROR WARNINGS ON THE FIRST CALL
>
> 	CALL PSYCHROMETRICS(TIME,INFO,1,MODE,WBMODE,PSYDAT,0,STATUS,
>       1	*10)
> 	CALL LINKCK('TYPE 33','PSYCHROMETRICS',1,99)
> 10      CONTINUE
>
> C       GET INFO FROM PSYCH
> 	   MODE=4
>           PATM = PSYDAT(1)
>           t_amb = PSYDAT(2)
>           TWET = PSYDAT(3)
>           RELHUM = PSYDAT(4)
>           TDEW = PSYDAT(5)
>           x_amb = PSYDAT(6)
>           ENTHAL = PSYDAT(7)
>
>
> C       RETURN TO THE CALLING PROGRAM
>           RETURN 1
>
>        ENDIF
> C-----------------------------------------------------------------------------------------------------------------------
>
> C-----------------------------------------------------------------------------------------------------------------------
> C    *** ITS AN ITERATIVE CALL TO THIS COMPONENT ***
> C-----------------------------------------------------------------------------------------------------------------------
>
> 	
> C-----------------------------------------------------------------------------------------------------------------------
>
> C-----------------------------------------------------------------------------------------------------------------------
> C-----------------------------------------------------------------------------------------------------------------------
> C    C    CHECK DEI PARAMETRI
> 	if(l.gt.1) then
> 	write (valore non valido,'("Par(1)=",G",which is ok")')PAR(1)
> 	call Messages(-1,trim(valore non valido),'Fatal',info(1),info(2))
> 	return 1
> 	endif
> 		
> C    CHECK THE INPUTS FOR VALIDITY AND RETURN IF PROBLEMS ARE FOUND
>        IF(portata.lt.0) CALL TYPECK(-3,INFO,4,0,0)
> 	if(equi.lt.0) call typeck(-3,info,2,0,0)
> 	if(equi.gt.1) call typeck(-3,info,2,0,0)
> 	if(ads.lt.0) call typeck(-3,info,3,0,0)
> 	if(ads.gt.1) call typeck(-3,info,3,0,0)
>        IF(ErrorFound() ) RETURN 1
> C-----------------------------------------------------------------------------------------------------------------------
> C-----------------------------------------------------------------------------------------------------------------------
> C    *** PERFORM ALL THE CALCULATION HERE FOR THIS MODEL. ***
> C-----------------------------------------------------------------------------------------------------------------------
>
> C		ADD YOUR COMPONENT EQUATIONS HERE; BASICALLY THE EQUATIONS THAT WILL
> C		CALCULATE THE OUTPUTS BASED ON THE PARAMETERS AND THE INPUTS.	REFER TO
> C		CHAPTER 3 OF THE TRNSYS VOLUME 1 MANUAL FOR DETAILED INFORMATION ON
> C		WRITING TRNSYS COMPONENTS.
>
> C	ACTIVE CONDITION
> C    RETRIEVE THE VALUES IN THE STORAGE ARRAY FOR THIS ITERATION
> C
> 	CALL getStorageVars(STORED,StorageSize,INFO)
> 	StorageSize=4
>        STORED(1)=t0_letto
> 	STORED(3)=w0_letto
> 	
>
> 	intervallo = DELT*3600
>
>        velocit=portata/(sezione*3600)
>
>        num_particelle=(L*sezione*(1-grad_vuoto))/(3.14*d_silicagel**3)
>
> 	area_sup=6*(((3.14*(D_silicagel)**2)/4)*num_particelle)/(l*Sezione)
>
>        massa=sezione*l*(1-grad_vuoto)*rho_silicagel
>
> 	t_aria_in=t_amb
>
>        w0_letto_ads=w0_letto
>
> 	miu=((((0.622/(0.622+x_amb))*(7.801*((t_aria_in+273)/100)-0.626*((
>       &(t_aria_in+273)/100)**2)+0.02942*(((t_aria_in+273)/100)**3)+0.0076
>       &9*(1.293*(273/(t_aria_in+273))))+(x_amb/(0.622+x_amb))*(40.407/(
>       &((t_aria_in+273)/100)**2)-18.473/((t_aria+273)/100)+3.853*((
>       &t_aria_in+273)/100)+(0.006*exp(0.05*t_aria_in))*(RELHUM/100)*
>       &(0.0407-(1.988/((t_aria_in+273)/100))))))*((((x_amb/(0.622+x_amb))
>       &-((x_amb/(0.622+x_amb))**2))/2.75)+1))/1000000
>
> 	k1=0.000000011*(t_amb)**4-0.000001901*(t_amb)**3
>       &+0.000119197*(t_amb)**2-0.003107449*(t_amb)+
>       &0.027364286
>
>        k2=-0.00000017*(t_amb)**4+0.000033428*(t_amb)**3
>       &-0.002105473*(t_amb)**2+0.05610934*(t_amb)-
>       &0.496785714
>
>        w_eq=(x_amb-k1)/k2
>
>        x_out=x_amb-(k2*(w_eq-w0_letto)*exp(-(portata*(1.293*(273/(t_aria
>       &+273)))/(3600*massa))*k2*(intervallo)))
>
>        wst = w_eq -(w_eq-w0_letto)*exp(-(portata*(1.293*(273/(t_aria_in+
>       &273)))/(3600*massa))*k2*intervallo)
>
>        wst_prec=wst
>
> 	H_ads=(2950-1400*wst)*(0.704*(velocit*(1.293*(273/(t_aria_in+
>       &273))))*(d_silicagel*portata*(1.293*(273/(t_aria_in+273)))/(miu*
>       &sezione*3600))**(-0.51))*area_sup*dx/1000
>
>        i=0.1263
>
> 	
>
>        g=(0.683*(velocit*(1.293*(273/(t_aria_in+273))))*(1.884*(x_amb/(1
>       &+x_amb))+1.005*(1-(x_amb/(1+x_amb))))*(d_silicagel*portata*(1.293*
>       &(273/(t_aria_in+273)))/(miu*sezione*3600))**(-0.51))*area_sup*(1+
>       &exp(-i))
>
>        t0_letto_k=t0_letto+273
>
>        t_letto=(((t_amb)*g+2*H_ads+(g*(t0_letto-
>       &(t_amb))-2*H_ads)*exp(-g*(intervallo)/(2*(4.178*wst+
>       &0.921)*(1-grad_vuoto)*rho_silicagel)))/g)
>
> 	t_aria=t_letto+(t_amb-t_letto)*exp(-i)
>
> 	t_letto_prec_K=t_letto+273
>
>        dx=(x_amb-x_out)*1000
>
>        t_equilibrata=t_amb
>
> 	c=150/((d_silicagel*portata*(1.293*(273/(t_aria_in+273)))/(miu*
>       &sezione*3600))/(1-grad_vuoto))+1.75
>
> 	d=((1.293*(273/(t_aria_in+273)))*velocit)**2
>
> 	e=l*(1-grad_vuoto)/((1.293*(273/(t_aria_in+273)))*d_silicagel*
>       &grad_vuoto**3)
>
> 	perdita_carico=c*d*e
> C-----------------------------------------------------------------------------------------------------------------------
> C    SET THE STORAGE ARRAY AT THE END OF THIS ITERATION IF NECESSARY
>        STORED(2)=t_letto
> 	STORED(4)=wst
> 	CALL setStorageVars(STORED,StorageSize,INFO)
> C-----------------------------------------------------------------------------------------------------------------------
> C-----------------------------------------------------------------------------------------------------------------------
> C    REPORT ANY PROBLEMS THAT HAVE BEEN FOUND USING CALLS LIKE THIS:
> C      CALL MESSAGES(-1,'put your message here','MESSAGE',IUNIT,ITYPE)
> C      CALL MESSAGES(-1,'put your message here','WARNING',IUNIT,ITYPE)
> C      CALL MESSAGES(-1,'put your message here','SEVERE',IUNIT,ITYPE)
> C      CALL MESSAGES(-1,'put your message here','FATAL',IUNIT,ITYPE)
> C-----------------------------------------------------------------------------------------------------------------------
> C-----------------------------------------------------------------------------------------------------------------------
> C    SET THE OUTPUTS FROM THIS MODEL IN SEQUENTIAL ORDER AND GET OUT
>
> C		 intervallo
> 			OUT(1)=intervallo
> C		 velocit
> 			OUT(2)=velocit
> C		 area_sup
> 			OUT(3)=area_sup
> C		 massa
> 			OUT(4)=massa
> C		 t_aria_in
> 			OUT(5)=t_aria_in
> C		 num_part
> 			OUT(6)=num_particelle
> C		 miu
> 			OUT(7)=miu
> C		 k1
> 			OUT(8)=k1
> C		 k2
> 			OUT(9)=k2
> C		 w_eq
> 			OUT(10)=w_eq
> C		 x_aria_out
> 			OUT(11)=x_out
> C		 wst_prec
> 			OUT(12)=wst_prec
> C		 wst
> 			OUT(13)=wst
> C		 H_ads
> 			OUT(14)=H_ads
> C		 i
> 			OUT(15)=i
> C		 g
> 			OUT(16)=g
> C		 t0_letto_K
> 			OUT(17)=t0_letto_K
> C		 t_letto_prec_k
> 			OUT(18)=t_letto_prec_K
> C		 t_letto
> 			OUT(19)=t_letto
> C		 t_aria
> 			OUT(20)=t_aria
> C		 dx
> 			OUT(21)=dx
> C		 t_equilibrata
> 			OUT(22)=t_equilibrata
> C		 c
> 			OUT(23)=c
> C		 d
> 			OUT(24)=d
> C		 e
> 			OUT(25)=e
> C		 perdita_carico
> 			OUT(26)=perdita_carico
>
> C-----------------------------------------------------------------------------------------------------------------------
> C    EVERYTHING IS DONE - RETURN FROM THIS SUBROUTINE AND MOVE ON
>        RETURN 1
>        END
> C-----------------------------------------------------------------------------------------------------------------------
> _______________________________________________
> TRNSYS-users mailing list
> TRNSYS-users at cae.wisc.edu
> https://mailman.cae.wisc.edu/listinfo/trnsys-users
>

-- 
***************************
David BRADLEY
Principal
Thermal Energy Systems Specialists, LLC
22 North Carroll Street - suite 370
Madison, WI  53703 USA

P:+1.608.274.2577
F:+1.608.278.1475
d.bradley at tess-inc.com

http://www.tess-inc.com
http://www.trnsys.com




More information about the TRNSYS-users mailing list