Skip to content

Commit 6670be2

Browse files
committed
-bug fix in RTEuler
1 parent 4a7ed5c commit 6670be2

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

Compiler/Template/CodegenCpp.tpl

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1794,9 +1794,18 @@ extern "C" void debugSimulation(void)
17941794
getMotionCycle(cycletime);
17951795

17961796
initSimulation(simController, simData, cycletime);
1797-
for(int i = 0; i < 1000; i++)
1797+
while(true)
17981798
{
1799-
simController->calcOneStep();
1799+
try
1800+
{
1801+
wvEvent(1,NULL,0);
1802+
simController->calcOneStep();
1803+
wvEvent(2,NULL,0);
1804+
}
1805+
catch(ModelicaSimulationError& ex)
1806+
{
1807+
break;
1808+
}
18001809
}
18011810
delete simController;
18021811

SimulationRuntime/cpp/Solver/RTEuler/RTEuler.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,16 @@ void RTEuler::initialize()
3636
_mixed_system = dynamic_cast<IMixedSystem*>(_system);
3737
_time_system = dynamic_cast<ITime*>(_system);
3838

39+
_dimSys = _continuous_system->getDimContinuousStates();
40+
3941
if (_dimSys == 0)
4042
return;
4143

4244
//(Re-) Initialization of solver -> call default implementation service
4345
SolverDefaultImplementation::initialize();
4446

4547
// Dimension of the system (number of variables)
46-
_dimSys = _continuous_system->getDimContinuousStates();
48+
4749

4850
// Check system dimension
4951
if (_dimSys == 0)

0 commit comments

Comments
 (0)