<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=iso-8859-1"><meta name=Generator content="Microsoft Word 12 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";
        color:black;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"Préformaté HTML Car";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:black;}
span.PrformatHTMLCar
        {mso-style-name:"Préformaté HTML Car";
        mso-style-priority:99;
        mso-style-link:"Préformaté HTML";
        font-family:Consolas;
        color:black;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body bgcolor=white lang=FR link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Dear David and Hermann,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>As David says, I run into trouble when opening the file. I send you enclosed two tests in order to better explain my problem.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>I created a test component (the proforma is in the corresponding directory) whit two dlls, one with the command “open” and the other without it (directories dll 1 and dll2, the corresponding codes are in the code 1 and code 2 directories).<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>If you copy the first dll and run the project “test temp” (in the TRNSYS project directory), the result file contains two lines at the end: one indicates the error code which FORTRAN generates when I try to open the file (code 30, which indicates, according to the Compaq visual FORTRAN manual, that is impossible to open the file), the second line gives the values of the three parameters read. This values correspond to the one specified in the file “fort.30”, in the project directory, and not the ones contained in the “temp.in” file, which is specified for the component. However, the “filename” string returned by getLUfileName is correct, as you can see if you debug the code!!!<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>In the case of the second dll, I do not use the open command but the result is exactly the same: my component reads its parameters in the file “fort.30”.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>I really do not understand what I miss…could you help me please?<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Best,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Marcello<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext'>De :</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext'> trnsys-users-bounces@cae.wisc.edu [mailto:trnsys-users-bounces@cae.wisc.edu] <b>De la part de</b> David BRADLEY<br><b>Envoyé :</b> mercredi 5 octobre 2011 19:20<br><b>À :</b> Hermann Schranzhofer<br><b>Cc :</b> trnsys-users@cae.wisc.edu<br><b>Objet :</b> Re: [TRNSYS-users] TR: File handling<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>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: <o:p></o:p></p><pre> <o:p></o:p></pre><pre>Dear Marcello,<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>It should work something like this:<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>Fid = getParameterValue(1)<o:p></o:p></pre><pre>Filename = getLUFilename(Fid)<o:p></o:p></pre><pre>Open(unit=Fid,file=Filename)<o:p></o:p></pre><pre>Read(Fid,*) value<o:p></o:p></pre><pre>Close(Fid)<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>Best regards,<o:p></o:p></pre><pre>Hermann.<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>_______________________________________________________________<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>DI Dr. mont. Hermann Schranzhofer<o:p></o:p></pre><pre>Institut fuer Waermetechnik / Institute of Thermal Engineering<o:p></o:p></pre><pre>TU Graz / Graz University of Technology <o:p></o:p></pre><pre>Inffeldgasse 25 / B, A-8010 Graz <o:p></o:p></pre><pre><o:p> </o:p></pre><pre>Tel.: +43 316 873 7314<o:p></o:p></pre><pre>mobil: +43 664 60 873 7314<o:p></o:p></pre><pre>Fax : +43 316 873 7305<o:p></o:p></pre><pre><a href="http://www.iwt.tugraz.at/">http://www.iwt.tugraz.at/</a><o:p></o:p></pre><pre>_______________________________________________________________<o:p></o:p></pre><pre><o:p> </o:p></pre><pre><o:p> </o:p></pre><pre>-----Ursprüngliche Nachricht-----<o:p></o:p></pre><pre>Von: <a href="mailto:trnsys-users-bounces@cae.wisc.edu">trnsys-users-bounces@cae.wisc.edu</a> [<a href="mailto:trnsys-users-bounces@cae.wisc.edu">mailto:trnsys-users-bounces@cae.wisc.edu</a>] Im Auftrag von <a href="mailto:marcello.caciolo@aximaseitha-gdfsuez.com">marcello.caciolo@aximaseitha-gdfsuez.com</a><o:p></o:p></pre><pre>Gesendet: Mittwoch, 05. Oktober 2011 13:46<o:p></o:p></pre><pre>An: <a href="mailto:trnsys-users@cae.wisc.edu">trnsys-users@cae.wisc.edu</a><o:p></o:p></pre><pre>Betreff: [TRNSYS-users] TR: File handling<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>Dear Hermann,<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>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?<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>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?<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>Thank you,<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>Marcello<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>-----Message d'origine-----<o:p></o:p></pre><pre>De : <a href="mailto:trnsys-users-bounces@cae.wisc.edu">trnsys-users-bounces@cae.wisc.edu</a> [<a 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 href="mailto:trnsys-users@cae.wisc.edu">trnsys-users@cae.wisc.edu</a> Objet : Re: [TRNSYS-users] File handling<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>Dear Marcello,<o:p></o:p></pre><pre> <o:p></o:p></pre><pre>I think you have to use the getLUfileName function. See Programmers Guide page 7-46.<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>Best regards,<o:p></o:p></pre><pre>Hermann Schranzhofer.<o:p></o:p></pre><pre> <o:p></o:p></pre><pre><o:p> </o:p></pre><pre>_______________________________________________________________<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>DI Dr. mont. Hermann Schranzhofer<o:p></o:p></pre><pre>Institut fuer Waermetechnik / Institute of Thermal Engineering TU Graz / Graz University of Technology Inffeldgasse 25 / B, A-8010 Graz<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>Tel.: +43 316 873 7314<o:p></o:p></pre><pre>mobil: +43 664 60 873 7314<o:p></o:p></pre><pre>Fax : +43 316 873 7305<o:p></o:p></pre><pre><a href="http://www.iwt.tugraz.at/">http://www.iwt.tugraz.at/</a><o:p></o:p></pre><pre>_______________________________________________________________<o:p></o:p></pre><pre><o:p> </o:p></pre><pre><o:p> </o:p></pre><pre><o:p> </o:p></pre><pre> <o:p></o:p></pre><pre><o:p> </o:p></pre><pre>________________________________<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>Von: <a href="mailto:trnsys-users-bounces@cae.wisc.edu">trnsys-users-bounces@cae.wisc.edu</a> [<a href="mailto:trnsys-users-bounces@cae.wisc.edu">mailto:trnsys-users-bounces@cae.wisc.edu</a>] Im Auftrag von <a href="mailto:marcello.caciolo@aximaseitha-gdfsuez.com">marcello.caciolo@aximaseitha-gdfsuez.com</a><o:p></o:p></pre><pre>Gesendet: Mittwoch, 05. Oktober 2011 11:19<o:p></o:p></pre><pre>An: <a href="mailto:trnsys-users@cae.wisc.edu">trnsys-users@cae.wisc.edu</a><o:p></o:p></pre><pre>Betreff: [TRNSYS-users] File handling<o:p></o:p></pre><pre><o:p> </o:p></pre><pre><o:p> </o:p></pre><pre><o:p> </o:p></pre><pre>Dear TRNSYS users,<o:p></o:p></pre><pre><o:p> </o:p></pre><pre> <o:p></o:p></pre><pre><o:p> </o:p></pre><pre>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.<o:p></o:p></pre><pre><o:p> </o:p></pre><pre> <o:p></o:p></pre><pre><o:p> </o:p></pre><pre>In the FORTRAN code, at the iteration zero, my type simply use the read instruction as it follows:<o:p></o:p></pre><pre><o:p> </o:p></pre><pre> <o:p></o:p></pre><pre><o:p> </o:p></pre><pre>unit_fichier_sortie = jfix(getParameterValue(4) + 0.1)<o:p></o:p></pre><pre><o:p> </o:p></pre><pre> <o:p></o:p></pre><pre><o:p> </o:p></pre><pre>! Lecture de la version du fichier<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>read(unit_fichier_descriptif,*, iostat = erreur_lecture) par_1<o:p></o:p></pre><pre><o:p> </o:p></pre><pre> <o:p></o:p></pre><pre><o:p> </o:p></pre><pre>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).<o:p></o:p></pre><pre><o:p> </o:p></pre><pre> <o:p></o:p></pre><pre><o:p> </o:p></pre><pre>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")!<o:p></o:p></pre><pre><o:p> </o:p></pre><pre> <o:p></o:p></pre><pre><o:p> </o:p></pre><pre>If I debug the code, the function getLUfileName(unit_fichier_descriptif) returns the correct name of the file (example.in). <o:p></o:p></pre><pre><o:p> </o:p></pre><pre> <o:p></o:p></pre><pre><o:p> </o:p></pre><pre>Has someone experienced the same kind of problem? For information, I use Compaq Visual Fortran.<o:p></o:p></pre><pre><o:p> </o:p></pre><pre> <o:p></o:p></pre><pre><o:p> </o:p></pre><pre>Thank you for your help!<o:p></o:p></pre><pre><o:p> </o:p></pre><pre> <o:p></o:p></pre><pre><o:p> </o:p></pre><pre>Marcello CACIOLO<o:p></o:p></pre><pre>Responsable Outils et Méthodes d'Analyse Energétique ___________________________________________________ <o:p></o:p></pre><pre><o:p> </o:p></pre><pre>logo AximaSeitha<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>Cellule Efficacité Energétique<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>Direction Commerciale<o:p></o:p></pre><pre>46 Boulevard de la Prairie au Duc BP 40119 44000 Nantes Cédex 2 Tel. 02 40 41 06 57<o:p></o:p></pre><pre><o:p> </o:p></pre><pre><o:p> </o:p></pre><pre>mail: <a href="mailto:marcello.caciolo@aximaseitha-gdfsuez.com">marcello.caciolo@aximaseitha-gdfsuez.com</a><o:p></o:p></pre><pre><o:p> </o:p></pre><pre><o:p> </o:p></pre><pre><a href="http://www.aximaseitha-gdfsuez.com">www.aximaseitha-gdfsuez.com</a><o:p></o:p></pre><pre><o:p> </o:p></pre><pre> <o:p></o:p></pre><pre><o:p> </o:p></pre><pre>P Pensez à l'environnement avant d'imprimer ce message<o:p></o:p></pre><pre><o:p> </o:p></pre><pre> <o:p></o:p></pre><pre><o:p> </o:p></pre><pre><o:p> </o:p></pre><pre><o:p> </o:p></pre><pre><o:p> </o:p></pre><pre>GDF SUEZ Mail Disclaimer: <a href="http://www.gdfsuez.com/disclaimer/disclaimer-fr.html">http://www.gdfsuez.com/disclaimer/disclaimer-fr.html</a><o:p></o:p></pre><pre><o:p> </o:p></pre><pre><o:p> </o:p></pre><pre><o:p> </o:p></pre><pre><o:p> </o:p></pre><pre>GDF SUEZ Mail Disclaimer: <a href="http://www.gdfsuez.com/disclaimer/disclaimer-fr.html">http://www.gdfsuez.com/disclaimer/disclaimer-fr.html</a><o:p></o:p></pre><pre><o:p> </o:p></pre><pre><o:p> </o:p></pre><pre><o:p> </o:p></pre><pre>_______________________________________________<o:p></o:p></pre><pre>TRNSYS-users mailing list<o:p></o:p></pre><pre><a href="mailto:TRNSYS-users@cae.wisc.edu">TRNSYS-users@cae.wisc.edu</a><o:p></o:p></pre><pre><a href="https://mailman.cae.wisc.edu/listinfo/trnsys-users">https://mailman.cae.wisc.edu/listinfo/trnsys-users</a><o:p></o:p></pre><p class=MsoNormal><br><br><br><o:p></o:p></p><pre>_______________________________________________<o:p></o:p></pre><pre>TRNSYS-users mailing list<o:p></o:p></pre><pre><a href="mailto:TRNSYS-users@cae.wisc.edu">TRNSYS-users@cae.wisc.edu</a><o:p></o:p></pre><pre><a href="https://mailman.cae.wisc.edu/listinfo/trnsys-users">https://mailman.cae.wisc.edu/listinfo/trnsys-users</a><o:p></o:p></pre><p class=MsoNormal><br><br><o:p></o:p></p><pre>-- <o:p></o:p></pre><pre>***************************<o:p></o:p></pre><pre>David BRADLEY<o:p></o:p></pre><pre>Principal<o:p></o:p></pre><pre>Thermal Energy Systems Specialists, LLC<o:p></o:p></pre><pre>22 North Carroll Street - suite 370<o:p></o:p></pre><pre>Madison, WI  53703 USA<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>P:+1.608.274.2577<o:p></o:p></pre><pre>F:+1.608.278.1475<o:p></o:p></pre><pre><a href="mailto:d.bradley@tess-inc.com">d.bradley@tess-inc.com</a><o:p></o:p></pre><pre><o:p> </o:p></pre><pre><a href="http://www.tess-inc.com">http://www.tess-inc.com</a><o:p></o:p></pre><pre><a href="http://www.trnsys.com">http://www.trnsys.com</a><o:p></o:p></pre></div><font face="monospace"><br>
<br>
<br>
GDF SUEZ Mail Disclaimer: http://www.gdfsuez.com/disclaimer/disclaimer-fr.html<br>
<br>
</font></body></html>