<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Marcello and Hermann,<br>
If you use the method below, you can sometimes run into trouble
because TRNSYS already opens all of the files that are ASSIGNed to
logical unit numbers. You may be able to just skip the line:<br>
<br>
Open(unit=Fid,file=Filename)
<br>
<br>
or, you can use the access function:<br>
<br>
closeFileIVF(Fid)<br>
<br>
then reopen it with <br>
<br>
Open(unit=Fid,file=Filename)
<br>
<br>
Best,<br>
David<br>
<br>
<br>
<br>
On 10/5/2011 08:10, Hermann Schranzhofer wrote:
<blockquote cite="mid:20111005151055064.00000004416@fwtpc100"
type="cite">
<pre wrap="">
Dear Marcello,
It should work something like this:
Fid = getParameterValue(1)
Filename = getLUFilename(Fid)
Open(unit=Fid,file=Filename)
Read(Fid,*) value
Close(Fid)
Best regards,
Hermann.
_______________________________________________________________
DI Dr. mont. Hermann Schranzhofer
Institut fuer Waermetechnik / Institute of Thermal Engineering
TU Graz / Graz University of Technology
Inffeldgasse 25 / B, A-8010 Graz
Tel.: +43 316 873 7314
mobil: +43 664 60 873 7314
Fax : +43 316 873 7305
<a class="moz-txt-link-freetext" href="http://www.iwt.tugraz.at/">http://www.iwt.tugraz.at/</a>
_______________________________________________________________
-----Ursprüngliche Nachricht-----
Von: <a class="moz-txt-link-abbreviated" href="mailto:trnsys-users-bounces@cae.wisc.edu">trnsys-users-bounces@cae.wisc.edu</a> [<a class="moz-txt-link-freetext" href="mailto:trnsys-users-bounces@cae.wisc.edu">mailto:trnsys-users-bounces@cae.wisc.edu</a>] Im Auftrag von <a class="moz-txt-link-abbreviated" href="mailto:marcello.caciolo@aximaseitha-gdfsuez.com">marcello.caciolo@aximaseitha-gdfsuez.com</a>
Gesendet: Mittwoch, 05. Oktober 2011 13:46
An: <a class="moz-txt-link-abbreviated" href="mailto:trnsys-users@cae.wisc.edu">trnsys-users@cae.wisc.edu</a>
Betreff: [TRNSYS-users] TR: File handling
Dear Hermann,
Thank you for your answer. However, the getLUfileName function gives me the name of the file as a string (which is, by the way, the correct one). But how can I use it to access this file?
Is there a form of the "read" instruction taking as parameter the file name instead of the unit number? If yes, could you give me an example of its use?
Thank you,
Marcello
-----Message d'origine-----
De : <a class="moz-txt-link-abbreviated" href="mailto:trnsys-users-bounces@cae.wisc.edu">trnsys-users-bounces@cae.wisc.edu</a> [<a class="moz-txt-link-freetext" href="mailto:trnsys-users-bounces@cae.wisc.edu">mailto:trnsys-users-bounces@cae.wisc.edu</a>] De la part de Hermann Schranzhofer Envoyé : mercredi 5 octobre 2011 13:38 À : <a class="moz-txt-link-abbreviated" href="mailto:trnsys-users@cae.wisc.edu">trnsys-users@cae.wisc.edu</a> Objet : Re: [TRNSYS-users] File handling
Dear Marcello,
I think you have to use the getLUfileName function. See Programmers Guide page 7-46.
Best regards,
Hermann Schranzhofer.
_______________________________________________________________
DI Dr. mont. Hermann Schranzhofer
Institut fuer Waermetechnik / Institute of Thermal Engineering TU Graz / Graz University of Technology Inffeldgasse 25 / B, A-8010 Graz
Tel.: +43 316 873 7314
mobil: +43 664 60 873 7314
Fax : +43 316 873 7305
<a class="moz-txt-link-freetext" href="http://www.iwt.tugraz.at/">http://www.iwt.tugraz.at/</a>
_______________________________________________________________
________________________________
Von: <a class="moz-txt-link-abbreviated" href="mailto:trnsys-users-bounces@cae.wisc.edu">trnsys-users-bounces@cae.wisc.edu</a> [<a class="moz-txt-link-freetext" href="mailto:trnsys-users-bounces@cae.wisc.edu">mailto:trnsys-users-bounces@cae.wisc.edu</a>] Im Auftrag von <a class="moz-txt-link-abbreviated" href="mailto:marcello.caciolo@aximaseitha-gdfsuez.com">marcello.caciolo@aximaseitha-gdfsuez.com</a>
Gesendet: Mittwoch, 05. Oktober 2011 11:19
An: <a class="moz-txt-link-abbreviated" href="mailto:trnsys-users@cae.wisc.edu">trnsys-users@cae.wisc.edu</a>
Betreff: [TRNSYS-users] File handling
Dear TRNSYS users,
I would like to write a component for TRNSYS 17 which reads its parameters from an external file. In the proforma of my type, I specified a parameter "Logical unit", linked to the name of the file in the "File" tab.
In the FORTRAN code, at the iteration zero, my type simply use the read instruction as it follows:
unit_fichier_sortie = jfix(getParameterValue(4) + 0.1)
! Lecture de la version du fichier
read(unit_fichier_descriptif,*, iostat = erreur_lecture) par_1
However, instead of reading in the correct file, this instruction reads in a file called "fort.30" (where 30 is the logical unit number assigned by TRNSYS).
If I write my parameters in "fort.30", the type reads its parameters correctly. However, I would really like that it reads in the file I specify in the proforma ("exemple.in")!
If I debug the code, the function getLUfileName(unit_fichier_descriptif) returns the correct name of the file (example.in).
Has someone experienced the same kind of problem? For information, I use Compaq Visual Fortran.
Thank you for your help!
Marcello CACIOLO
Responsable Outils et Méthodes d'Analyse Energétique ___________________________________________________
logo AximaSeitha
Cellule Efficacité Energétique
Direction Commerciale
46 Boulevard de la Prairie au Duc BP 40119 44000 Nantes Cédex 2 Tel. 02 40 41 06 57
mail: <a class="moz-txt-link-abbreviated" href="mailto:marcello.caciolo@aximaseitha-gdfsuez.com">marcello.caciolo@aximaseitha-gdfsuez.com</a>
<a class="moz-txt-link-abbreviated" href="http://www.aximaseitha-gdfsuez.com">www.aximaseitha-gdfsuez.com</a>
P Pensez à l'environnement avant d'imprimer ce message
GDF SUEZ Mail Disclaimer: <a class="moz-txt-link-freetext" href="http://www.gdfsuez.com/disclaimer/disclaimer-fr.html">http://www.gdfsuez.com/disclaimer/disclaimer-fr.html</a>
GDF SUEZ Mail Disclaimer: <a class="moz-txt-link-freetext" href="http://www.gdfsuez.com/disclaimer/disclaimer-fr.html">http://www.gdfsuez.com/disclaimer/disclaimer-fr.html</a>
_______________________________________________
TRNSYS-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:TRNSYS-users@cae.wisc.edu">TRNSYS-users@cae.wisc.edu</a>
<a class="moz-txt-link-freetext" href="https://mailman.cae.wisc.edu/listinfo/trnsys-users">https://mailman.cae.wisc.edu/listinfo/trnsys-users</a>
</pre>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
TRNSYS-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:TRNSYS-users@cae.wisc.edu">TRNSYS-users@cae.wisc.edu</a>
<a class="moz-txt-link-freetext" href="https://mailman.cae.wisc.edu/listinfo/trnsys-users">https://mailman.cae.wisc.edu/listinfo/trnsys-users</a>
</pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
***************************
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
<a class="moz-txt-link-abbreviated" href="mailto:d.bradley@tess-inc.com">d.bradley@tess-inc.com</a>
<a class="moz-txt-link-freetext" href="http://www.tess-inc.com">http://www.tess-inc.com</a>
<a class="moz-txt-link-freetext" href="http://www.trnsys.com">http://www.trnsys.com</a></pre>
</body>
</html>