#include "stdafx.h" #include "DllFunc.h" #include <stdio.h>
FILE *fGlobal[100]; int iInitialize; int iWrite; int ifclose;
RD_SYSTEM_API void __cdecl request_usub (double time, double upar[], int npar, int iflag, double result[8]) { using namespace rd_syscall; // Parameter Information // time : Simulation time of RD/Solver. (Input) // upar : Parameters defined by user. (Input) // npar : Number of user parameters. (Input) // iflag : When RD/Solver initializes arrays, the flag is true. (Input) // result : Returned values. (Output, Size : 8)
// User Statement // User Declared Variables double VY, Endtime; int ID[2],REPFLAG,ERRFLG; int i,id;
// Assign User parameters into the Variables ID[0] = (int)upar[0]; ID[1] = (int)upar[1]; id = 1; Endtime = 5.0;
// Measure the Velocity between Marker1 and Marker2 sysfnc("VY",ID,2,&VYW,&ERRFLG);
//Initialize if( iInitialize == 0 ){ for(i=0;i<100;i++) fGlobal[i] = NULL; CString str; str.Format("output&d.txt",id); fGlobal[100] = fopen(str,"w+"); iInitialize = 1; iWrite = 1; } re_system(&REPFLG);
if(REPFLG == 1 && iWrite == 1) { fprintf(fGlobal[100], "Time = %8.5f ",time); fprintf(fGlobal[100], "VY = %8.5f \n",VY); }
//close file if( time >= Endtime && iFclose == 0 ){ fclose(fGlobal[100]); iFclose = 1; iWrite = 0; } } |