Skip to content

Commit 182d180

Browse files
committed
added: adding a try block in verify_delays
This is necessary for `ForwardDiff` AD.
1 parent 754ff5c commit 182d180

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎src/controller/construct.jl‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,11 +581,16 @@ end
581581

582582
"Warn if `Hp ≤ nk`, where `nk` is the estimated delays `model`."
583583
function verify_delays(model::LinModel, Hp)
584-
nk = estimate_delays(model)
584+
nk = try
585+
estimate_delays(model)
586+
catch
587+
NaN
588+
end
585589
if Hp ≤ nk
586590
@warn("prediction horizon Hp ($Hp) ≤ estimated number of delays in model "*
587591
"($nk), the closed-loop system may be unstable or zero-gain (unresponsive)")
588592
end
593+
isnan(nk) && @warn("could not estimate the model delay, Hp ($Hp) might be too small.")
589594
return nothing
590595
end
591596
"Do nothing when `model` is not a [`LinModel`](@ref)."

0 commit comments

Comments
 (0)