From 52cd6addf58d656bfac5733d44d6331eb633927f Mon Sep 17 00:00:00 2001 From: qichenghua Date: Tue, 21 Mar 2017 13:41:43 +0100 Subject: [PATCH] extended error message in Cvode in case of too many events in small time interval. --- SimulationRuntime/cpp/Solver/CVode/CVode.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/SimulationRuntime/cpp/Solver/CVode/CVode.cpp b/SimulationRuntime/cpp/Solver/CVode/CVode.cpp index 7a4e7f9c949..110adc3c8e8 100644 --- a/SimulationRuntime/cpp/Solver/CVode/CVode.cpp +++ b/SimulationRuntime/cpp/Solver/CVode/CVode.cpp @@ -547,8 +547,15 @@ void Cvode::CVodeCore() _tLastEvent = _tCurrent; _event_n = 0; } - else - throw ModelicaSimulationError(EVENT_HANDLING,"Number of events exceeded in time interval " + to_string(_abs) + " at time " + to_string(_tCurrent)); + else{ + std::stringstream zeros; + _idid = CVodeGetRootInfo(_cvodeMem, _zeroSign); + for (int i = 0; i < _dimZeroFunc; i++){ + if(_zeroSign[i]!=0) + zeros << i << " "; + } + throw ModelicaSimulationError(EVENT_HANDLING,"Number of events of zero function(s) " + zeros.str() + "exceeded in time interval " + to_string(_abs) + " at time " + to_string(_tCurrent)); + } // CVode has interpolated the states at time 'tCurrent' _time_system->setTime(_tCurrent);