Skip to content

Commit

Permalink
Fixed bug in calculation of alg. vars.
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@1538 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Peter Aronsson committed Feb 25, 2005
1 parent ac6e746 commit 9f11944
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
11 changes: 9 additions & 2 deletions c_runtime/simulation_runtime.cpp
Expand Up @@ -110,19 +110,26 @@ int main(int argc, char **argv)
tout = t+step;

DDASRT(functionDAE_res, &nx, &t, x, xd, &tout, info,&rtol, &atol, &idid,rwork,&lrw, iwork, &liw, y /* rpar */, &ipar, dummyJacobianDASSL, zeroCrossing, &ng, &jroot);
functionDAE_res(&t,x,xd,dummy_delta,0,0,0); // Since residual function calculates
// alg vars too.
functionDAE_output(&t,x,xd,y);
add_result(data,t,x,xd,y,nx,ny,&actual_points);
info[0] = 1;
//dumpresult(t,y,idid,rwork,iwork);
tout += step;
while(t<stop) {
while(t<stop && idid>0) {
DDASRT(functionDAE_res, &nx, &t, x, xd, &tout, info,&rtol, &atol, &idid,rwork,&lrw, iwork, &liw, y /*rpar */, &ipar, dummyJacobianDASSL, zeroCrossing, &ng, &jroot);
functionDAE_res(&t,x,xd,dummy_delta,0,0,0); // Since residual function calculates
// alg vars too.
functionDAE_output(&t,x,xd,y);
add_result(data,t,x,xd,y,nx,ny,&actual_points);
//dumpresult(t,y,idid,rwork,iwork);
tout += step;
}

if (idid < 0 ) {
cerr << "Error, simulation stopped at time: " << t << endl;
cerr << "Result written to file." << endl;
}
string * result_file =(string*)getFlagValue("-r",argc,argv);
const char * result_file_cstr;
if (!result_file) {
Expand Down
1 change: 1 addition & 0 deletions c_runtime/simulation_runtime.h
Expand Up @@ -63,6 +63,7 @@ void read_input(int argc, char **argv,
double *step);
extern double x[];
extern double xd[];
extern double dummy_delta[];
extern double y[];
extern double p[];
extern long liw;
Expand Down

0 comments on commit 9f11944

Please sign in to comment.