Skip to content

Commit 876a3c4

Browse files
committed
guard against not reaching threshold
1 parent afcb06e commit 876a3c4

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

lib/ControlSystemsBase/src/timeresp.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,7 @@ function stepinfo(res::SimResult; y0 = nothing, yf = nothing, settling_th = 0.02
524524
undershoot = direction * 100 * (y0 - lowerpeak) / stepsize
525525
undershoot > 0 ? undershoot : zero(undershoot)
526526
settlingtimeind = findlast(abs(y-yf) > settling_th * stepsize for y in y)
527+
settlingtimeind === nothing && (settlingtimeind = length(res.t))
527528
settlingtimeind == length(res.t) && @warn "System might not have settled within the simulation time"
528529
settlingtime = res.t[settlingtimeind] + Ts
529530
op = direction == 1 ? (>) : (<)

0 commit comments

Comments
 (0)