slight tweak -- end a timestep just before scheduled events to better capture their effect
This commit is contained in:
parent
c7f496eb7b
commit
504062a853
@ -80,8 +80,15 @@ public abstract class AbstractEulerStepper extends AbstractSimulationStepper {
|
|||||||
timeStep = Math.min(timeStep, 1.0/absAccel);
|
timeStep = Math.min(timeStep, 1.0/absAccel);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Honor max step size passed in
|
// Honor max step size passed in. If the time to next time step is greater than our minimum
|
||||||
timeStep = Math.min(timeStep, maxTimeStep);
|
// we'll set our next step to just before it in order to better capture discontinuities in things like chute opening
|
||||||
|
if (maxTimeStep < timeStep) {
|
||||||
|
if (maxTimeStep > MIN_TIME_STEP) {
|
||||||
|
timeStep = maxTimeStep - MIN_TIME_STEP;
|
||||||
|
} else {
|
||||||
|
timeStep = maxTimeStep;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// but don't let it get *too* small
|
// but don't let it get *too* small
|
||||||
timeStep = Math.max(timeStep, MIN_TIME_STEP);
|
timeStep = Math.max(timeStep, MIN_TIME_STEP);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user