[TRNSYS-users] Reading data from an external file in a new TY PE
keilholz, werner
werner.keilholz at cstb.fr
Mon Jun 25 05:14:07 PDT 2007
Hi Jordi,
If you use TRNSYS' external file mechanism, the file will actually be opened
by the TRNSYS main program (i.e. you don't need to open it, and thus your
program even doesn't need to know the file name).
You just use the logical file number (LUN) to read from or write to that
file.
You can see how it works in
.\Trnsys16\SourceCode\Types\Type9.for
It just says
READ(LU_DATA,*,ERR=2000,END=2000)
without ever opening that file - it has been opened by TRNSYS by the time
this code is executed.
The magical variable LU_DATA is just one of the parameters - the one that
has been linked to the assign statement in the PROFORMA (that's the reason
for the "Parameter" popup in the "Files" section of the Proforma).
In type 9 it is a complicated formula depending on the number of parameters,
but basically it is just
LU_DATA = PAR(N)
(N is the parameter holding the LUN).
Happy data shuffling!
Werner
> -----Message d'origine-----
> De : jordi cipriano [mailto:cipriano at cimne.upc.edu]
> Envoyé : lundi 25 juin 2007 08:02
> À : trnsys-users at engr.wisc.edu
> Objet : [TRNSYS-users] Reading data from an external file in a new TYPE
>
> Dear all,
>
> I'm programming a new TYPE and I would like to read some inputs from an
> external file. If I define a Logical Unit for this file and I put in the
> proforma of the Type the path of this file, how do I use the OPEN
> instruction
> within my TYPE ?. I have some doubts, because, as I understand, the fact
> of
> putting an external file in the proforma conducts to an ASSIGN instruction
> in
> the deck file. Thus, do I need to re-write again the path of the file in
> my
> fortran code, or is there any way to avoid that?.
>
> Many thanks,
>
> Jordi Cipriano
> BEE-Group
> CIMNE, Spain
>
> --
> Open WebMail Project (http://openwebmail.org)
> Debian Project (http://www.debian.org)
>
> _______________________________________________
> TRNSYS-users mailing list
> TRNSYS-users at engr.wisc.edu
> https://www.cae.wisc.edu/mailman/listinfo/trnsys-users
>
>
>
>
>
> **************************************************************************
> **********
> This footnote confirms that this email message has been scanned by
> PineApp Mail-SeCure for the presence of malicious code, vandals & computer
> viruses.
> **************************************************************************
> **********
>
************************************************************************************
This footnote confirms that this email message has been scanned by
PineApp Mail-SeCure for the presence of malicious code, vandals & computer viruses.
************************************************************************************
More information about the TRNSYS-users
mailing list