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

Re: [TRNSYS-users] Command INQUIRE in TRNSYS16 type



Cédric,

I am trying to update a TRNSYS15 type in TRNSYS16. The type is using the command :
INQUIRE(UNIT=124,OPENED=FLAG,NAME=FNAME)
which returns a flag indicating if a file is connected and the name of the file assigned at the logical unit LUP.
FLAG is defined as LOGICAL
FNAME is defined as CHARACTER*60
In my deck, I have written :
ASSIGN T:/xxxx/xxx/xxxxx.xx 124
But when I run my simulation, the INQUIRE command returns me a False flag and can't find any file.
When I use my type in legacy mode, it founds the file and returns me a true flag.
Is this command already available ? Shall I use another command ?

INQUIRE is a Fortran statement so it is available to all (Fortran) TRNSYS Types. The fact that it tells you that the logical unit is not associated probably comes from a limitations of Fortran DLL's:


SHARING LOGICAL UNITS (FILES) BETWEEN DLL'S

Typical symptoms:
You assign a file in the TRNSYS input file and that file seems to be inaccessible to user-Types compiled in an external DLL.
- An "Inquire" statement tells you that the Logical Unit is not associated to a file
- Attempts to write to / read from the file create "fort.nnn" (where nnn is the logical unit)


Solution:
If a TRNSYS Type uses a file that is opened and closed by the kernel (i.e. a file managed through an "ASSIGN" statement in the deck, or an "External File" in a Studio proforma), the logical unit is associated to the actual file in TRNDll. If a Type that accesses the file is compiled into a separate DLL in UserLib:
- Both DLL's must be linked to the DLL form of the Fortran run-time libraries. Use "/libs:dll" in the command line, or set "Project Settings\Fortran\Libraries" to "Single-threaded DLL" in the Visual Studio ("Debug Single-threaded DLL" for debug configuration).
- Furthermore, all DLL's must be compiled in the same mode (Debug or Release). Note that by default TRNSYS is shipped with a Release TRNDll.dll, but a Debug DLL is available in "\Compilers\Cvf66\TRNDll\Debug".


Please let us know if this fixes your problem.

Michaël Kummert


-- _________________________________________________________

Michaël Kummert

Solar Energy Laboratory - University of Wisconsin-Madison
1303 Engr Res Bldg, 1500 Engineering Drive
Madison, WI 53706

Tel: +1 (608) 263-1589
Fax: +1 (608) 262-8464
E-mail: kummert@xxxxxxxxxxxxx

SEL Web Site: http://sel.me.wisc.edu
TRNSYS Web Site: http://sel.me.wisc.edu/trnsys
_______________________________________________
TRNSYS-users mailing list
TRNSYS-users@xxxxxxxxxxxxx
https://www.cae.wisc.edu/mailman/listinfo/trnsys-users