[TRNSYS-users] DYNAMICDATA function in C++
Daniel.Kiehlmann at csiro.au
Daniel.Kiehlmann at csiro.au
Tue Apr 20 18:06:12 PDT 2010
Hi Werner,
Thank you for your answer.
I checked it and I know that the dynamicdata function is causing the error in TRNSYS.
I send you the function of the TRNSYS header file and the part of the code where it calls the that function (it's the example which is explained in the TRNSYS manual).
extern "C" __declspec(dllimport) void _cdecl DYNAMICDATA(int* lu,int* nind,int nx[],int* ny,double x[],double y[],int info[],int* n);
...
int nind = 2;
int nx[2];
int ny = 2;
double x[2];
double y[2];
int n=0;
...
nx[0] = 3; //3 values of second variable in file
nx[1] = 2; //2 values of first variable in file
X[0] = T_evap; //input1
x[1] = T_cond; //input2
DYNAMICDATA(&logical_unit,&nind,nx,&ny,x,y,info,&n);
xout[0]=y[0];
xout[1]=y[1];
...
Kind Regards
Daniel
From: keilholz, werner [mailto:werner.keilholz at cstb.fr]
Sent: Tuesday, 20 April 2010 6:27 PM
To: Kiehlmann, Daniel (DET, Newcastle); TRNSYS-users at engr.wisc.edu
Subject: RE: [TRNSYS-users] DYNAMICDATA function in C++
Hi Daniel,
It it hard to tell without looking @ some code, but I would bet on some argument type mismatch, or array size mismatch (your arrays must match the constants in TrnsysConstants.f90).
The TRNSYS kernel functions mainly want arguments passed by reference, like in
int a; doit(&a);
Set a breakpoint on the line that calls the function , F5 in DevStudio, navigate to Trnsys.exe, point to the deck to run, inspect the variables when the breakpoint is hit. F11 will basically debug into the TRNDll by using the debug version (you need to recompile TRNDll with a Fortran compiler).
Hope that helps (a little),
Werner
De : Daniel.Kiehlmann at csiro.au [mailto:Daniel.Kiehlmann at csiro.au]
Envoyé : mardi 20 avril 2010 05:20
À : TRNSYS-users at engr.wisc.edu
Objet : [TRNSYS-users] DYNAMICDATA function in C++
Dear all,
I'm trying to create a new component in C++ with a dynamicdata function.
It works when I build the solution in C++, but pulls out following error when I run this component in TRNSYS:
"Access violation at address 100048CC in module 'TRNDLL.DLL'. Read of address 00000002"
Does anyone has some experience in using the dynamicdata function in C+ and can help me out?
Thanks very much in advance
Daniel Kiehlmann
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.onebuilding.org/pipermail/trnsys-users-onebuilding.org/attachments/20100421/be515424/attachment-0005.htm>
More information about the TRNSYS-users
mailing list