RobustAndOptimalControl.jl Uncertain Time Delays For State Space Models

I can’t get uncertain time delays for state space models to work. For example, the following code:

julia> using LinearAlgebra, ControlSystems, RobustAndOptimalControl, MonteCarloMeasurements
julia> P = ss(-1, 1, I, 0)
julia> P * delay(0.1 .. 0.3)


ERROR: TypeError: in new, expected ControlSystemsBase.PartitionedStateSpace{Continuous, StateSpace{Continuous, Particles{Float64, 2000}}}, got a value of type ControlSystemsBase.PartitionedStateSpace{Continuous, StateSpace{Continuous, Int64}}
Stacktrace:
 [1] DelayLtiSystem{Particles{Float64, 2000}, Particles{Float64, 2000}}(P::StateSpace{Continuous, Int64}, Tau::Vector{Float64})
   @ ControlSystemsBase ~/.julia/packages/ControlSystemsBase/CUXI9/src/types/DelayLtiSystem.jl:8
 [2] DelayLtiSystem{Particles{Float64, 2000}, Particles{Float64, 2000}}(sys::StateSpace{Continuous, Int64})
   @ ControlSystemsBase ~/.julia/packages/ControlSystemsBase/CUXI9/src/types/DelayLtiSystem.jl:21
 [3] convert(#unused#::Type{DelayLtiSystem{Particles{Float64, 2000}, Particles{Float64, 2000}}}, sys::StateSpace{Continuous, Int64})
   @ ControlSystemsBase ~/.julia/packages/ControlSystemsBase/CUXI9/src/types/DelayLtiSystem.jl:52
 [4] _promote
   @ ./promotion.jl:358 [inlined]
 [5] promote
   @ ./promotion.jl:381 [inlined]
 [6] *(sys1::StateSpace{Continuous, Int64}, sys2::DelayLtiSystem{Particles{Float64, 2000}, Particles{Float64, 2000}})
   @ ControlSystemsBase ~/.julia/packages/ControlSystemsBase/CUXI9/src/types/Lti.jl:4
 [7] top-level scope
   @ REPL[5]:1

The above code for the exact same system works for transfer functions however:

julia> using LinearAlgebra, ControlSystems, RobustAndOptimalControl, MonteCarloMeasurements
julia> P = tf(1, [1, 1])
julia> P * delay(0.1 .. 0.3)

DelayLtiSystem{Particles{Float64, 2000}, Particles{Float64, 2000}}

P: StateSpace{Continuous, Particles{Float64, 2000}}
A = 
 -1.0
B = 
 0.0  1.0
C = 
 1.0
 0.0
D = 
 0.0  0.0
 1.0  0.0

Continuous-time state-space model

Delays: Particles{Float64, 2000}[0.2 ± 0.058]

Does anyone know why one method works and not the other? Ideally I want to use state space models for my project.

Cheers.

Fixed by fix DelaySS conversion with special number type by baggepinnen · Pull Request #878 · JuliaControl/ControlSystems.jl · GitHub

1 Like

Thanks mate! Appreciate the help!