<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7654.12">
<TITLE>Calling external program from a new C++ Component</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">Hi everybody,</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">I’m stuck with TRNSYS</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri"> v 16.1</FONT></SPAN><SPAN LANG="en-us"> <FONT FACE="Calibri">, the part of the API that normally allow to call an external program (</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri">an exe written in c++</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri">)</FONT></SPAN><SPAN LANG="en-us"> <FONT FACE="Calibri">seems to</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri"> not</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri"> be</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri"> supported by the C++ plugin (</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri">I</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri"> can just create</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri"> my</FONT></SPAN><SPAN LANG="en-us"> <FONT FACE="Calibri"> own component that will basically calculate the output from the input)</FONT></SPAN><SPAN LANG="en-us"></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">I mean the linker can</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri">’</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri">t find the</FONT></SPAN><SPAN LANG="en-us"> <FONT FACE="Calibri">“</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri">call</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri">”</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri"></FONT></SPAN><SPAN LANG="en-us"> <FONT FACE="Calibri"> subroutine just like described in the programmer</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri">’</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri">s guide of the manual (part 8):</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><B><I></I></B></SPAN><SPAN LANG="en-us"><B><I></I></B></SPAN><SPAN LANG="en-us"><B><I><FONT SIZE=4 FACE="Arial">8.4.4.1. Calling External Programs</FONT></I></B></SPAN><SPAN LANG="en-us"><B><I></I></B></SPAN><SPAN LANG="en-us"><B><I></I></B></SPAN><SPAN LANG="en-us"><B><I></I></B></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">I know</FONT></SPAN><SPAN LANG="en-us"> <FONT FACE="Calibri">the example shown is</FONT></SPAN><SPAN LANG="en-us"> <FONT FACE="Calibri">for fortran but,</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri"> in the file ..</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri">\Trnsys16_1\SourceCode\Templates</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri">\CppType.cpp</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri"> we have this at the line 133:</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri"> //*** Call N ('normal' call)</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">That seems to be the function that allow me to call an external program</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri">,</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri"> however</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri"> there is no reference of that function in the</FONT></SPAN><SPAN LANG="en-us"> <FONT FACE="Calibri">“</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri">TRNSYS</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri">.h</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri">”</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri">, So I</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri">’</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri">m being stuck with a linker problem.</FONT></SPAN><SPAN LANG="en-us"></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">What I want to do</FONT></SPAN><SPAN LANG="en-us"> <FONT FACE="Calibri">is to</FONT></SPAN><SPAN LANG="en-us"> <FONT FACE="Calibri">start a simulation in TRNSYS, then when it reach a certain component, TRNSYS will call a external program</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri"> with data (</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri">in</FONT></SPAN><SPAN LANG="en-us"> <FONT FACE="Calibri">argument if possible)</FONT></SPAN><SPAN LANG="en-us"> <FONT FACE="Calibri"> and wait for it to finish,</FONT></SPAN><SPAN LANG="en-us"> <FONT FACE="Calibri">and then get back value from my program</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri">?</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">Unfortunately, TRNSYS doesn</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri">’</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri">t seem to support Socket connection</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri"> to</FONT></SPAN><SPAN LANG="en-us"> <FONT FACE="Calibri">exchange</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri"> data. I see that type66 do</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri"> it (</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri">This routine calls a program called Engineering Equation Solver (EES)</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri">)</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri"> with the data exchange</FONT></SPAN><SPAN LANG="en-us"> <FONT FACE="Calibri">protocol</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri"> via the windows</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri">’</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri"> clipboard</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri">. </FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">To resume:</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">So</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri"> do</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri"> I have to start over with the fortran plugin</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri"> to be</FONT></SPAN><SPAN LANG="en-us"> <FONT FACE="Calibri">able</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri"> to call external progr</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri">am</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri">?</FONT></SPAN><SPAN LANG="en-us"></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">Or do you</FONT></SPAN><SPAN LANG="en-us"> <FONT FACE="Calibri">k</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri">now a other way to do</FONT></SPAN><SPAN LANG="en-us"> <FONT FACE="Calibri">what I want ?</FONT></SPAN><SPAN LANG="en-us"></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">And</FONT></SPAN><SPAN LANG="en-us"> <FONT FACE="Calibri">do you think I need to communicate through a file ?</FONT></SPAN><SPAN LANG="en-us"></SPAN></P>
<BR>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">Thanks a lot for your help.</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">Amine</FONT></SPAN><SPAN LANG="en-us"></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"></SPAN></P>
</BODY>
</HTML>