Skip to content

Commit

Permalink
improved extraPolate value insinde [min,max]
Browse files Browse the repository at this point in the history
exception old value was not insinde [min,max]


git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@23515 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Vitalij Ruge committed Nov 22, 2014
1 parent bb7b844 commit 15e5928
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions SimulationRuntime/c/simulation/solver/nonlinearSystem.c
Expand Up @@ -462,11 +462,10 @@ double extraPolate(DATA *data, const double old1, const double old2, const doubl
else
{
retValue = old2 + ((data->localData[0]->timeValue - data->localData[2]->timeValue)/(data->localData[1]->timeValue - data->localData[2]->timeValue)) * (old1-old2);
//if(retValue < minValue) retValue = minValue; //./simulation/libraries/msl31/Modelica.Electrical.Analog.Examples.HeatingRectifier.mos fail
if(retValue < minValue){
if(fabs(retValue-minValue)/(fabs(retValue) + fabs(minValue)) < 0.85) retValue = minValue;
}
if(retValue > maxValue) retValue = maxValue;

if(retValue < minValue && old1 > minValue) retValue = minValue;
else if(retValue > maxValue && old1 < maxValue ) retValue = maxValue;

}

return retValue;
Expand Down

0 comments on commit 15e5928

Please sign in to comment.