[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fwd: Re: FW: Re: [TRNSYS-users] Bug in TYPE74]



Dear Fernando,
  It is inefficient to recalculate the characteristic parameters at every iteration (as is done in the component) because if you only have one instance in the input file, then there is no need to recalculate those values at each time step. You need only read the parameters once and then calculate those lines between the ENDIF and line 60 once. If those lines were brought inside the ENDIF then you would also want to copy the lines up to the section between

      !initialize storage variables
        RHOD=-1.
      EFFD=0.
        TALN=TAU_ALPHA(NG,EFFD,XKL,RI,ALF,RHOD)
      stored(1) = RHOD
      stored(2) = TALN
      CALL setStorageVars(NStorage,stored,INFO)

and

      !set the outputs to 0
        OUT(1) = XIN(1) 
      OUT(2:NO) = 0.d0 !zero remaining outputs
        RETURN 1         !the first timestep is for initialization - exit.

as well because if there is only one instance of Type74, and if the ENDIF had been moved down to line 60 then those lines would never be executed because INFO(1) would always equal IUNIT. If you have an input file that is giving you results that you don't understand and you have tracked it to Type74, please feel free to send it to me. You may be right that there is a problem although I do not see one from looking at the structure of the code in there.
Kind regards,
  David

Fernando Domínguez Muñoz wrote:
Dear David,

the (INFO(1).NE.IUNIT) check is right. The problem comes from the end
point of the IF statement:

c      IF(INFO(1).NE.IUNIT) THEN
        !recall the UNIT and TYPE number
        IUNIT = INFO(1)
	ITYPE = INFO(2)
        !read parameter values
	NS     = JFIX(PAR(1)+0.1)
        XNS    = DBLE(NS)

         ..........
         ..........

        RI     = PAR(12)
        XKL    = PAR(13)

c	ENDIF  <---------- THIS

C    RETRIEVE STORED VARIABLES
      CALL getStorageVars(NStorage,stored,INFO)

I think that the end point of this loop must be the line number 60,
where the program starts reading the inputs. But, the characteristic
parameters of the unit are re-calculated on every interation, and
consequently its values turn incorrect.

Best regards

Fernando.

  
Dear Fernando,
 The line

IF(INFO(1).NE.IUNIT) THEN

is correct. The point of the line is to handle the case in which there 
is more than one instance of Type74 in the simulation. The variable 
INFO(1) is always the current instance's UNIT number (specified in the 
input file). At each time that the Type is called, the value of INFO(1) 
is stored as a local variable. In this way, if ever INFO(1) and IUNIT do 
not have the same value, then it can only be because a different 
instance of the component has been simulated. If a different instance 
has been simulated, then the component's parameters should be reread and 
reset to local variables.

In December 2004, a bug fix was made in that component. If your version 
does not have the comment:

C  12/02/2004 - JWT - Fixed an error with storing variables and added 
the first call to Tau_Alpha

in the "Revision History" near the top of the file Type74.for then you 
should contact your distributor to get the latest version.
Kind regards,
 David

Fernando Domínguez Muñoz wrote:

    
Dear all,

I think I have found a bug in TYPE74 (parabolic concentrator solar
collector).

Where says (Line 207):

     IF(INFO(1).NE.IUNIT) THEN

Should said:

     IF(INFO(1).NE.IUNIT) GO TO 60

Best regards.

Fernando Domínguez Muñoz
University of Málaga (Spain)
_______________________________________________
TRNSYS-users mailing list
TRNSYS-users@engr.wisc.edu
https://www.cae.wisc.edu/mailman/listinfo/trnsys-users
 

      
_______________________________________________
TRNSYS-users mailing list
TRNSYS-users@engr.wisc.edu
https://www.cae.wisc.edu/mailman/listinfo/trnsys-users