Changeset 5211c46 in OpenModelica


Ignore:
Timestamp:
2022-05-18T10:30:34+02:00 (2 years ago)
Author:
AnHeuermann <andreas.heuermann@…>
Children:
2bbbca3
Parents:
c9e6dd3
Message:

Check step size is smaller then experiment duration

Location:
OMCompiler/SimulationRuntime/c/simulation/solver
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • OMCompiler/SimulationRuntime/c/simulation/solver/perform_simulation.c.inc

    rc9e6dd3 r5211c46  
    506506        }
    507507
     508        // Calculate integrator step size
    508509        if(simInfo->numSteps == 0) {
    509510          if(fabs(simInfo->stopTime-simInfo->startTime) < 1e-16) {
  • OMCompiler/SimulationRuntime/c/simulation/solver/solver_main.c

    r8529da7 r5211c46  
    743743    simInfo->numSteps = round((simInfo->stopTime - simInfo->startTime)/simInfo->stepSize);
    744744  }
     745  /* Check step size is not larger then stopTime-startTime, up to 6 decimals */
     746  if (simInfo->stepSize > (simInfo->stopTime - simInfo->startTime + 1e-7)) {
     747    warningStreamPrint(LOG_STDOUT, 1, "Integrator step size greater then length of experiment");
     748    infoStreamPrint(LOG_STDOUT, 0, "start time: %f, stop time: %f, integrator step size: %f",simInfo->startTime, simInfo->stopTime, simInfo->stepSize);
     749    messageClose(LOG_STDOUT);
     750  }
    745751#if !defined(OMC_EMCC)
    746752    MMC_TRY_INTERNAL(simulationJumpBuffer)
Note: See TracChangeset for help on using the changeset viewer.