Skip to content

Commit

Permalink
- fixed noEquidistant mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Willi Braun committed Oct 27, 2015
1 parent e15a57a commit 4ca8547
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
12 changes: 6 additions & 6 deletions SimulationRuntime/c/simulation/solver/dassl.c
Expand Up @@ -524,7 +524,7 @@ int dassl_step(DATA* data, threadData_t *threadData, SOLVER_INFO* solverInfo)
unsigned int ui = 0;
int retVal = 0;
int saveJumpState;
unsigned int dasslStepsOutputCounter = 1;
static unsigned int dasslStepsOutputCounter = 1;

DASSL_DATA *dasslData = (DASSL_DATA*) solverInfo->solverData;

Expand Down Expand Up @@ -568,6 +568,9 @@ int dassl_step(DATA* data, threadData_t *threadData, SOLVER_INFO* solverInfo)
/* If dasslsteps is selected, the dassl run to stopTime */
if (dasslData->dasslSteps)
{
/* rhs final flag is FALSE during dassl evaulation */
RHSFinalFlag = 0;

if (data->simulationInfo.nextSampleEvent < data->simulationInfo.stopTime)
{
tout = data->simulationInfo.nextSampleEvent;
Expand Down Expand Up @@ -665,16 +668,13 @@ int dassl_step(DATA* data, threadData_t *threadData, SOLVER_INFO* solverInfo)
/* emit step, if dasslsteps is selected */
if (dasslData->dasslSteps)
{
/*
* to emit consistent value we need to update the whole
* continuous system with algebraic variables.
*/
/* rhs final flag is TRUE during output evaulation */
RHSFinalFlag = 1;

if (omc_flag[FLAG_NOEQUIDISTANT_OUT_FREQ]){
/* output every n-th time step */
if (dasslStepsOutputCounter >= dasslData->dasslStepsFreq){
dasslStepsOutputCounter = 0; /* next line set it to one */
dasslStepsOutputCounter = 1; /* next line set it to one */
break;
}
dasslStepsOutputCounter++;
Expand Down
7 changes: 6 additions & 1 deletion SimulationRuntime/c/simulation/solver/perform_simulation.c
Expand Up @@ -348,7 +348,12 @@ int prefixedName_performSimulation(DATA* data, threadData_t *threadData, SOLVER_
{
if (solverInfo->currentTime >= solverInfo->lastdesiredStep)
{
__currStepNo++;
double tmpTime = solverInfo->currentTime;
do
{
__currStepNo++;
solverInfo->currentStepSize = (double)(__currStepNo*(simInfo->stopTime-simInfo->startTime))/(simInfo->numSteps) + simInfo->startTime - solverInfo->currentTime;
}while(solverInfo->currentStepSize <= 0);
}
}
else
Expand Down

0 comments on commit 4ca8547

Please sign in to comment.