Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/OMSimulatorLib/SystemSC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +881,15 @@ oms_status_enu_t oms::SystemSC::doStepCVODE()
{
const fmi3Float64 tout = std::min(tnext, end_time);

// CVode rejects an interval it cannot tell apart from zero (CV_TOO_CLOSE)
// There is nothing left to integrate in it; assume end_time is reached.
if (tout - time < 2.0 * SUN_UNIT_ROUNDOFF * std::max(std::fabs(time), std::fabs(tout)))
{
logDebug("CVode: skipping degenerate interval " + std::to_string(time) + " -> " + std::to_string(tout));
time = end_time;
break;
}

logDebug("CVode: " + std::to_string(time) + " -> " + std::to_string(tout));
for (size_t j=0, k=0; j < fmus.size(); ++j)
for (size_t i=0; i < nStates[j]; ++i, ++k)
Expand Down
1 change: 1 addition & 0 deletions testsuite/tests/resources/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ set(OM_OMS_TESTSUITE_RESOURCES_FMUS
${CMAKE_CURRENT_SOURCE_DIR}/B
${CMAKE_CURRENT_SOURCE_DIR}/BouncingBall
${CMAKE_CURRENT_SOURCE_DIR}/BouncingBall3
${CMAKE_CURRENT_SOURCE_DIR}/ClockedStepBoundary
${CMAKE_CURRENT_SOURCE_DIR}/Dahlquist
${CMAKE_CURRENT_SOURCE_DIR}/Dahlquist3
${CMAKE_CURRENT_SOURCE_DIR}/DualMassOscillator.System1
Expand Down
13 changes: 13 additions & 0 deletions testsuite/tests/resources/ClockedStepBoundary.mos
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Regenerates testsuite/resources/ClockedStepBoundary.
//
// A clocked model: Modelica.Clocked drives it from periodic clocks whose tick
// times are computed exactly (k * period), while a master stepping the FMU
// accumulates its own communication points. The two disagree by an ULP once the
// accumulated end of a communication step lands just past a tick, which is what
// the clockedStepBoundary test exercises.

loadModel(Modelica, {"4.0.0"}); getErrorString();

buildModelFMU(Modelica.Clocked.Examples.CascadeControlledDrive.AbsoluteClocks, version="2.0", fmuType="me", fileNamePrefix="ClockedStepBoundary", platforms={"x86_64-linux-gnu docker run multiarch/crossbuild","x86_64-w64-mingw32 docker run multiarch/crossbuild"}); getErrorString();

system("zip -qd ClockedStepBoundary.fmu sources/* && unzip -o ClockedStepBoundary.fmu -d ClockedStepBoundary/");
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

<h1>Modelica.Clocked.Examples.CascadeControlledDrive.AbsoluteClocks</h1>
<p> <i>Drive with clocked cascade controller where all partitions are defined with exact (integer) clock that need to be compatible to each other</i> </p>
<h4> <u> Information </u> </h4><html>
<p>
Cascade control drive with discrete-time controller where two
periodic clock with absolute periods are defined and
are associated to
the corresponding controller partitions.
The super-sampling factor of block "super" is derived by
clock inference.
</p>
</html>
<h4> <u> Revisions </u> </h4>
Loading