Named systems with delays
I use delayed systems quite a bit and I love the functionality of named systems when plotting. I was wondering what your thoughts were on creating a named delayed system type (continuous)?
Take the following example of how I currently use named systems with delays:
using ControlSystems, RobustAndOptimalControl
# create named state space plant
P = ss([1 0; 0 -1], [0; 1], [1 0], 0)
P_named = named_ss(P, x=[:pos, :vel], u=[:force], y=[:pos])
# create delayed system (input is delayed)
D = c2d(delay(0.1), 0.05)
D_named = named_ss(D, y=:force, u=:force_cmd)
P_delayed = c2d(P_named, 0.05) * D_named
NamedStateSpace{Discrete{Float64}, Float64}
A =
1.051271096376024 0.0 0.0 0.0
0.0 0.9512294245007141 0.04877057549928599 0.0
0.0 0.0 0.0 1.0
0.0 0.0 0.0 0.0
B =
0.0
0.0
0.0
1.0
C =
1.0 0.0 0.0 0.0
D =
0.0
Sample Time: 0.05 (seconds)
Discrete-time state-space model
With state names: pos vel x1 x2
input names: force_cmd
output names: pos
Ideally, however, because I normally leave systems in continuous form, it would be great if this worked:
P_delayed = P_named * delay(0.1)
I'm not an expert of how delays are internally handle so if I'm missing something obvious please let me know!
Thanks
I have a lot of thoughts around this, but not a lot of time to put those into code :/ A delayed system is internally represented as a feedback interconnection between a linear system and a vector of pure delays. There are other special system types that are represented in a similar way, most notably our UncertainSS type, but also LPV systems and linear systems with static feedback nonlinearities, HammersteinWienerSystem, may be represented in this way. I have a document here
https://github.com/JuliaControl/RobustAndOptimalControl.jl/discussions/102
that tries to gather everything that I'd eventually like to put in this new type that can represent a linear system in feedback with any number of "special elements", where a delay would be one of the special elements. I foresee this type taking a while to implement and get right, based on the experience with how long time it has taken to get the already existing NamedStateSpace reasonably bug free (I still fix new issues regularily), and I'm not sure when I'm going to find this time.
Okay yes I understand why its a non-trivial problem! Thanks for all your effort so far!