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

[TRNSYS-users] Read an external text file in a new TRNSYS TYPE



Hello TRNSYS users,

Background:
I’m developing a type to be used in TRNSYS 16.1 where I use external text file to read some parameters. More specifically, it is a multilayer wall system where layers descriptions are provided through an external text file. This requires an open file command with an explicit file name in my Fortran code. I compiled the code using CVF 6.6 using virtual machine with XP.  That works perfect when I have one wall type (one text file provided). It also works for multiple wall units (two copies of the type in the simulation studio) where if I change inputs of one wall unit I could see the changes. This means that the code works ok when multiple walls are used. However, I have to use only one text file.

Up to this point, the DLL works well!


For this TYPE to work for multiple wall systems (different walls with different designs) , I need the code (or the generated DLL) to read multiple text files (one for each wall). Therefore, I tried to comment the open command in the fortran code and use the inquire command without the explicit file name. I compiled again and run the TRNSYS project. I got a message showing that the file is not found. I know that the inquire command in fortran will not open the file but I wanted the code to open the text file using the logical unit rather than the explicit file name. I tried this with different PCs but I got the same error. I then downloaded IVF with MS2010 and compiled the code with exactly the same error.

I took this fortran code and I use one of my old PC vista win32bits with CVF 6.6 compiler and the DLL works fine for multiple units and multiple text files. I was wondering what makes the DLL generated by this old PC works and others generated by virtual machine not. Unfortunately, my OLD PC has crashed after windows update(!!) and can’t have access to the compiler anymore. 

In all cases above, I can compile the code and DLL is generated without any error. The error is generated once I run the project in TRNSYS.

My questions:
Is there a way or a command to open a text file using logical unit rather than an explicit file name?. or that is not possible in fortran?
 
I hope that somebody can offer a help on this.

thanks,
Saleh Al-Saadi