# RobustAndOptimalControl.jl Named State Space With Time Delay

**URL:** <https://discourse.julialang.org/t/robustandoptimalcontrol-jl-named-state-space-with-time-delay/104515>\
**Category:** Modelling & Simulations\
**Tags:** controlsystems\
**Created:** [October 2, 2023, 10:40pm UTC](https://discourse.julialang.org/t/robustandoptimalcontrol-jl-named-state-space-with-time-delay/104515 "2023-10-02T22:40:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![matthew3245](https://avatars.discourse-cdn.com/v4/letter/m/ba8739/32.png) [@matthew3245](https://discourse.julialang.org/u/matthew3245)\
**Post date:** [October 2, 2023, 10:40pm UTC](https://discourse.julialang.org/t/robustandoptimalcontrol-jl-named-state-space-with-time-delay/104515/1 "2023-10-02T22:40:04Z")

</div>

Is there a way to make a named state space model with a time delay? The following code produces an error:

```julia
julia> named_ss(ss(-1, 1, I, 0)) * delay(0.1)
ERROR: promotion of types NamedStateSpace{Continuous, StateSpace{Continuous, Int64}} and DelayLtiSystem{Float64, Float64} failed to change any arguments
Stacktrace:
 [1] error(::String, ::String, ::String)
   @ Base ./error.jl:44
 [2] sametype_error(input::Tuple{NamedStateSpace{Continuous, StateSpace{Continuous, Int64}}, DelayLtiSystem{Float64, Float64}})
   @ Base ./promotion.jl:405
 [3] not_sametype(x::Tuple{NamedStateSpace{Continuous, StateSpace{Continuous, Int64}}, DelayLtiSystem{Float64, Float64}}, y::Tuple{NamedStateSpace{Continuous, StateSpace{Continuous, Int64}}, DelayLtiSystem{Float64, Float64}})
   @ Base ./promotion.jl:399
 [4] promote
   @ ./promotion.jl:382 [inlined]
 [5] *(sys1::NamedStateSpace{Continuous, StateSpace{Continuous, Int64}}, sys2::DelayLtiSystem{Float64, Float64})
   @ ControlSystemsBase ~/.julia/packages/ControlSystemsBase/CUXI9/src/types/Lti.jl:4
 [6] top-level scope
   @ REPL[16]:1

```

This same code will work if its not a named state space system. Any help is appreciated.

Cheers.

---

<div class="post-metadata">

**Author:** ![baggepinnen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/baggepinnen/32/693_2.png) [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)\
**Post date:** [October 3, 2023, 9:03am UTC](https://discourse.julialang.org/t/robustandoptimalcontrol-jl-named-state-space-with-time-delay/104515/2 "2023-10-03T09:03:54Z")

</div>

`NamedStateSpace` does not support delays at the moment. It’s on my long-term wishlist to implement a type that supports all the different features currently scattered around multiple different subtypes of `AbstractStateSpace`, but for now this is unfortunately not supported ☹

---

<div class="post-metadata">

**Author:** ![matthew3245](https://avatars.discourse-cdn.com/v4/letter/m/ba8739/32.png) [@matthew3245](https://discourse.julialang.org/u/matthew3245)\
**Post date:** [October 3, 2023, 11:50am UTC](https://discourse.julialang.org/t/robustandoptimalcontrol-jl-named-state-space-with-time-delay/104515/3 "2023-10-03T11:50:42Z")

</div>

Cheers, no problem at all.
