Loading OpenSimRoot/src/engine/SimulaDerivative.hpp +9 −2 Original line number Diff line number Diff line Loading @@ -286,11 +286,18 @@ public: //estimate it using finite difference //note that if the finite difference is too small we may get, because of numerical errors, 0 //todo uses global MINTIMESTEP which might be very small. //todo, probably we should implement rate and state versions of all SimulaDerivative classes, // so they can simply be called? This might also work better with unit expectations and simulaVariable? // this here is for example used to estimate nutrient uptake in nitrate basic Time d1 = MINTIMESTEP / 2.; Time t1 = t - d1; if (t1 < startTime) if (t1 < startTime){ t1 = startTime; Time t2 = t1 + 2 * d1; get(t1, var); var*=0.01;//pure guess return; } Time t2 = t;//t1 + 2 * d1; Time rt = SimulaTimeDriven::getWallTime(t2); if (t2 > rt) { if (rt > t1) { Loading Loading
OpenSimRoot/src/engine/SimulaDerivative.hpp +9 −2 Original line number Diff line number Diff line Loading @@ -286,11 +286,18 @@ public: //estimate it using finite difference //note that if the finite difference is too small we may get, because of numerical errors, 0 //todo uses global MINTIMESTEP which might be very small. //todo, probably we should implement rate and state versions of all SimulaDerivative classes, // so they can simply be called? This might also work better with unit expectations and simulaVariable? // this here is for example used to estimate nutrient uptake in nitrate basic Time d1 = MINTIMESTEP / 2.; Time t1 = t - d1; if (t1 < startTime) if (t1 < startTime){ t1 = startTime; Time t2 = t1 + 2 * d1; get(t1, var); var*=0.01;//pure guess return; } Time t2 = t;//t1 + 2 * d1; Time rt = SimulaTimeDriven::getWallTime(t2); if (t2 > rt) { if (rt > t1) { Loading