Thank you David, I'm using a logical unit as a parameter in my type, utilizing the assign feature. The fortran code is written in f90 free format. I'm using labels and goto command. This seems to give the kernel trouble in opening and reading the file automatically. If i explicitly define the file name in the fortran code, it works perfect (making the assign feature redundant). After the struggle, I converted the code to a fixed fortran format , file extension became *.for. The generated dll now works for multiple text files when used with multiple types, using the assign feature, finally achieving my objective. I don't know why it works with fixed fortran format but not with the free format. There must be something I missed or an f90 library not installed in my machine. Thanks again, Saleh Sent from Yahoo! Mail for iPhone Sent from Yahoo! Mail for iPhone |
Saleh, What you are trying to do was very difficult in TRNSYS 16. There are improved methods in Trnsys17, however. The only real way to get a file name to a Type is to do as other Types do and make use of the ASSIGN keyword that associates a file name with an integer logical unit number. The logical unit number is then given as a parameter to the Type. The problem then is that with this method, the TRNSYS kernel automatically opens the file that has been ASSIGNED. You need to close the file from your component in order to reopen and read it. To complicate matters, your Type only knows the logical unit number, not the file name so you will need to write some new TRNSYS kernel access functions that allow you to close the file from your Type. In TRNSYS 17, there is a keyword called DESIGNATE. It is the same as ASSIGN except that the file will not be opened by the kernel. We also added a number of access functions that allow your Type to retrieve the name and location of the file based on knowing only its DESIGNATED logical unit number. Best, David On 6/3/2013 15:34, saleh saadi wrote:
-- *************************** 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 d.bradley@tess-inc.com http://www.tess-inc.com http://www.trnsys.com |