[TRNSYS-users] Building a TRNSYS DLL to couple run Simulink and TRNSYS

4 posts / 0 new
Last post

Hello,

I'm using TRNSYS 17, MATLAB R2012b (32-bit), and Microsoft Visual C++ 2008 to build a TRNSYS DLL which will compile a Simulink project.

I'm using a dissertation written by Saleh Nasser Al-Saadi, titled "Modeling and Simulation of PCM-Enhanced Fa?ade Systems" as a guide to help me (I've linked the paper to this question and the guide starts on p. 475 of the pdf).

https://www.researchgate.net/publication/261633240_MODELING_AND_SIMULATION_OF_PCM-ENHANCED_FACADE_SYSTEMS

A brief summary of guide is:

1) Compile the Simulink project and generate the C++ files

2) Open the .makefile in Microsoft Visual Studio 2008

3) Build the solution

4) DLL files will automatically be generated in TRNSYS' Release DLLs folder

In our case, we were unable to build the solution in Microsoft Visual Studio. The output window in Microsoft Visual Studio had a bunch of errors and warnings which I can't make any sense of.

The only reason why the solution won't build - that I can think of - is that the person who wrote the dissertation was using TRNSYS 16 (confirmed by the author) instead of TRNSYS 17.

If anyone has had a similar problem and were able to rectify the issue, please let me know. Your help will be greatly appreciated!

Mustafa Ahmed Syed's picture
Joined: 2016-04-05
Reputation: 0

Dear Users,

I would like to edit an existing source file for Types 1257 and 1259 of TESS library. I want to do this change because I need to simulate a solar thermal field with a different transfer mean (that would be a specific thermal oil). I have the formula describing the equations of its density, thermal conductivity and enthalpy.
I managed to add the extra parameters into the source text file. Is it necessary to do anything else? For example add any parameter into the ?variable tab? of each component inside TRNSYS?

Regards
Alexandros

P3XT3L's picture
Offline
Joined: 2016-04-05
Reputation: 0

Alexandros,
You do not need to modify the Type1257 or 1259 source code in order to
specify a different working fluid. The properties of the working fluid
are taken among the model's parameters (fluid density, fluid enthalpy,
and fluid internal energy coefficients). Modifying the source code is a
somewhat complex procedure because once you have modified the source
code you need to recompile it and relink it into a DLL using a Fortran
compiler. If you added parameters, inputs, or outputs you would also
need to modify the component's proforma.
kind regards,
David

--
***************************
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 at tess-inc.com

http://www.tess-inc.com
http://www.trnsys.com

David BRADLEY2's picture
Offline
Joined: 2011-10-02
Reputation: 200

Mustafa,
The TRNSYS kernel and TRNSYS types communicate with each other in a
fundamentally different way between Trnsys16 and Trnsys17. In Trnsys16
the kernel passed certain pieces of relevant information (like the list
of parameters, inputs, outputs, and certain flags for where the
simulation is in its overall process) to the Types whereas in Trnsys17
the Types query the kernel for the information that they need. That
said, the Trnsys17 kernel is able to communicate with Trnsys16 Types
using the "passed information" method so long as the Types identify
themselves as being written using the Trnsys16 coding standard. I don't
think that the problem you are facing lies here. More likely the issue
is in either the compiler project settings not matching up with those of
the Visual Studio Fortran project that is used to compile the DLL or
that your project cannot access the compiled libraries that contain the
definitions of all the functions and data structures that your Type
needs but that are contained and declared in the TRNDLL. I have not
written any C++ components for TRNSYS so I am afraid that I can't offer
any hints on how to resolve the problems. If any other users have
experience with this, I would greatly appreciate hearing about it.
kind regards,
David

--
***************************
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 at tess-inc.com

http://www.tess-inc.com
http://www.trnsys.com

David BRADLEY2's picture
Offline
Joined: 2011-10-02
Reputation: 200