JuliaControl / ControlSystems.jl

A Control Systems Toolbox for Julia
https://juliacontrol.github.io/ControlSystems.jl/stable/
Other
508 stars 85 forks source link

`feedback_control` causes a stackoverflow on DelayLtiSystem #815

Closed pepijndevos closed 1 year ago

pepijndevos commented 1 year ago
julia> sys = feedback_control(tf([1], [0.1, 1]), delay(0.1))
ERROR: StackOverflowError:
Stacktrace:
 [1] feedback(sys1::DelayLtiSystem{Float64, Float64}, sys2::DelayLtiSystem{Float64, Float64}; kwargs::Base.Pairs{Symbol, Any, Tuple{Symbol, Symbol}, NamedTuple{(:Z2, :Zperm), Tuple{Colon, Vector{Int64}}}}) (repeats 39992 times)
   @ ControlSystemsBase ~/.julia/packages/ControlSystemsBase/8Sk6N/src/types/Lti.jl:34
baggepinnen commented 1 year ago

I opened #817 to keep track of making this work. I'd like to solve a more general problem rather than adding a rather complex hack to support this particular instance of the problem, unfortunately, the general problem requires quite a bit of work to implement.

baggepinnen commented 1 year ago

For now, you can obtain the closed loop systems from r->y and r->u separately using

julia> Gry = feedback(tf([1], [0.1, 1]) * delay(0.1));

julia> Gru = feedback(delay(0.1), tf([1], [0.1, 1]));