Ticket #2539: stepSize.diff
File stepSize.diff, 4.4 KB (added by , 11 years ago) |
---|
-
SimulationRuntime/c/simulation/solver/perform_simulation.c
96 96 SIMULATION_INFO *simInfo = &(data->simulationInfo); 97 97 98 98 solverInfo->currentTime = simInfo->startTime; 99 100 unsigned int __currStepNo = 0; 99 101 100 102 if(measure_time_flag) 101 103 { … … 151 153 rotateRingBuffer(data->simulationData, 1, (void**) data->localData); 152 154 153 155 /***** Calculation next step size *****/ 154 /* Calculate new step size after an event */155 156 if(solverInfo->didEventStep == 1) 156 157 { 157 if((solverInfo->currentTime - solverInfo->laststep) + DBL_EPSILON > simInfo->stepSize)158 solverInfo->currentStepSize = simInfo->stepSize;159 else160 solverInfo->currentStepSize = simInfo->stepSize - (solverInfo->currentTime - solverInfo->laststep);161 162 158 infoStreamPrint(LOG_SOLVER, 0, "offset value for the next step: %.10f", (solverInfo->currentTime - solverInfo->laststep)); 163 159 } 164 160 else 165 161 { 166 solverInfo->currentStepSize = simInfo->stepSize;162 __currStepNo++; 167 163 } 168 169 /* adjust final step? */ 170 if(solverInfo->currentTime + solverInfo->currentStepSize > simInfo->stopTime) { 171 solverInfo->currentStepSize = simInfo->stopTime - solverInfo->currentTime; 172 } 164 solverInfo->currentStepSize = (double)(__currStepNo*(simInfo->stopTime-simInfo->startTime))/(simInfo->numSteps) + simInfo->startTime - solverInfo->currentTime; 173 165 /***** End calculation next step size *****/ 174 166 175 167 /* check for next time event */ -
testsuite/openmodelica/cruntime/simoptions/testOutputIntervalDASSL.mos
56 56 // simulationOptions = "startTime = 0.0, stopTime = 2.0, numberOfIntervals = 6, tolerance = 0.000001, method = 'dassl', fileNamePrefix = 'testModel', options = '', outputFormat = 'mat', variableFilter = '.*', measureTime = false, cflags = '', simflags = '-noEventEmit'", 57 57 // messages = "" 58 58 // end SimulationResult; 59 // 859 // 7 60 60 // record SimulationResult 61 61 // resultFile = "testModel_res.mat", 62 62 // simulationOptions = "startTime = 0.0, stopTime = 3.0, numberOfIntervals = 500, tolerance = 0.000001, method = 'dassl', fileNamePrefix = 'testModel', options = '', outputFormat = 'mat', variableFilter = '.*', measureTime = false, cflags = '', simflags = '-noEventEmit'", -
testsuite/openmodelica/cruntime/simoptions/testOutputIntervalEuler.mos
56 56 // simulationOptions = "startTime = 0.0, stopTime = 2.0, numberOfIntervals = 6, tolerance = 0.000001, method = 'euler', fileNamePrefix = 'testModel', options = '', outputFormat = 'mat', variableFilter = '.*', measureTime = false, cflags = '', simflags = '-noEventEmit'", 57 57 // messages = "" 58 58 // end SimulationResult; 59 // 859 // 7 60 60 // record SimulationResult 61 61 // resultFile = "testModel_res.mat", 62 62 // simulationOptions = "startTime = 0.0, stopTime = 3.0, numberOfIntervals = 500, tolerance = 0.000001, method = 'euler', fileNamePrefix = 'testModel', options = '', outputFormat = 'mat', variableFilter = '.*', measureTime = false, cflags = '', simflags = '-noEventEmit'", -
testsuite/openmodelica/cruntime/simoptions/testOutputIntervalRK.mos
62 62 // simulationOptions = "startTime = 0.0, stopTime = 2.0, numberOfIntervals = 6, tolerance = 0.000001, method = 'rungekutta', fileNamePrefix = 'testModel', options = '', outputFormat = 'mat', variableFilter = '.*', measureTime = false, cflags = '', simflags = '-noEventEmit'", 63 63 // messages = "" 64 64 // end SimulationResult; 65 // 865 // 7 66 66 // endResult