Hi Amine, ‘Call’ is not the name of a TRNSYS API function, but
just a comment to say that at this point in the example, the C routine is
called for the Nth time. To call an external program in C, you should use the Windows API.
There are many ways to do this, one is to use CreateProcess() function, as
described here: http://msdn.microsoft.com/en-us/library/ms682425(VS.85).aspx One challenge is to make sure the exe has finished before you
try to recover any results it may have put somewhere. If you have the source code of the exe, another option would be
to recompile it as a DLL, adding the TRNSYS TYPE function which should then just
call the main() function of your application (you can then easily pass parameters
and recover results). Hope this helps, Werner De : Bezzarga, Amine
(SCR US EXT) [mailto:amine.bezzarga.ext@siemens.com] Hi everybody, I’m stuck
with TRNSYS v 16.1 , the part of the API that normally
allow to call an external program (an exe written in c++) seems
to not be supported by the C++ plugin (I can just create my
own component that will basically calculate the output from the input) I mean the
linker can’t find the “call”
subroutine just like described in the programmer’s guide of the manual (part
8): 8.4.4.1.
Calling External Programs I know the
example shown is for fortran but, in the file
..\Trnsys16_1\SourceCode\Templates\CppType.cpp we have this at the line 133: //***
Call N ('normal' call) That seems to be
the function that allow me to call an external program, however there is no
reference of that function in the “TRNSYS.h”,
So I’m being stuck with a linker problem. What I want to
do is
to start
a simulation in TRNSYS, then when it reach a certain component, TRNSYS will
call a external program with data (in argument if possible)
and wait for it to finish, and then get back value from my
program? Unfortunately,
TRNSYS doesn’t seem to support Socket connection to exchange
data. I see that type66 do it (This routine calls a program called
Engineering Equation Solver (EES)) with the data exchange protocol
via the windows’ clipboard. To resume: So do I have to
start over with the fortran plugin to be able to call external
program? Or do you know
a other way to do what I want ? And do
you think I need to communicate through a file ? Thanks a lot for
your help. Amine |