Skip to content

Commit

Permalink
-fixed bug with zero states
Browse files Browse the repository at this point in the history
  • Loading branch information
RuedKamp committed Sep 15, 2015
1 parent 19b35e1 commit cd20244
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions SimulationRuntime/cpp/Solver/RTEuler/RTEuler.cpp
Expand Up @@ -14,6 +14,8 @@ RTEuler::RTEuler(IMixedSystem* system, ISolverSettings* settings)
, _z (NULL)
, _dimSys (0)
, _f (NULL)
, _zInit (NULL)

{
}

Expand All @@ -38,12 +40,16 @@ void RTEuler::initialize()

_dimSys = _continuous_system->getDimContinuousStates();

if (_dimSys == 0)
return;


//(Re-) Initialization of solver -> call default implementation service
SolverDefaultImplementation::initialize();
IGlobalSettings* globalsettings = _eulerSettings->getGlobalSettings();
_h = globalsettings->gethOutput();

if (_dimSys == 0)
return;

SolverDefaultImplementation::initialize();
// Dimension of the system (number of variables)


Expand Down Expand Up @@ -86,8 +92,8 @@ void RTEuler::initialize()

memcpy(_z,_zInit,_dimSys*sizeof(double));

IGlobalSettings* globalsettings = _eulerSettings->getGlobalSettings();
_h = globalsettings->gethOutput();


}

/// Set start t for numerical solution
Expand Down Expand Up @@ -137,7 +143,11 @@ void RTEuler::solve(const SOLVERCALL command)
_continuous_system->setContinuousStates(_z);
}


_tCurrent += _h;
_time_system->setTime(_tCurrent);
_continuous_system->evaluateAll();

_continuous_system->stepCompleted(_tCurrent);
}

Expand Down

0 comments on commit cd20244

Please sign in to comment.