[TRNSYS-users] Writing to a file at the end of a simulation

2 posts / 0 new
Last post

Dear all,

I am currently writing a user type which needs to create a xxx.txt file at the end of the simulation containing some information that was created during the simulation. I assume that, when creating the according component, I can use the FILES tab to define the write path (or have the user define it). However, I do not know how to get access to this information in my C++ code. There is some "getlistingfilelogicalunit" function in the Trnsys header, but I have no clue how to use it. Is there any documentation or simple example available?

I appreciate your help!
All the best
J?rn

Dr.-Ing. J?rn von Grabe, M.Sc.
Wissenschaftlicher Mitarbeiter und Postdoktorand

Universit?t Liechtenstein
Institut f?r Architektur und Raumentwicklung
F?rst-Franz-Josef-Strasse, 9490 Vaduz, Liechtenstein
Telefon +423 265 11 11, Direkt +423 265 11 39
joern.vgrabe at uni.li, www.uni.li

Bleiben wir in Verbindung:
Facebook | YouTube | Twitter | LinkedIn

=?iso-8859-1?Q?von_Grabe_J=F6rn?='s picture
Joined: 2016-04-05
Reputation: 0

J?rn -

If you use the FILES keyword for assigning the name of the file, then
you can use the getExtFilePath to get the file name, open the file and
then write to the file.

! getExtFilePath: Returns information about external file "fileNum" that
has been referenced by
! UNIT "unitNum" using the FILES keyword in the input file. The argument
"extFilePath" is set to
! the full path and name of the external file. The function return value
is the length of the
! variable needed to contain the file name. This function is intended
primarily for components
! written in C and C++.
Function getExtFilePath(unitNum,fileNum,extFilePath)

Regards,

Tim

---
Timothy P. McDowell
Executive Vice President
Thermal Energy System Specialists, LLC
22 N Carroll St, Suite 370
Madison, WI 53703
608-274-2577

On 2016-02-02 09:20, von Grabe J?rn wrote:

Links:
------
[1]
http://lists.onebuilding.org/listinfo.cgi/trnsys-users-onebuilding.org
[2] http://www.uni.li
[3] https://www.facebook.com/uni.li
[4] http://www.youtube.com/user/UniLiechtenstein
[5] https://twitter.com/uni_li
[6] http://www.linkedin.com/company/universit-t-liechtenstein/

Timothy McDowell's picture
Joined: 2011-10-02
Reputation: 0