diff --git a/src/named_systems2.jl b/src/named_systems2.jl index 516e3a0..41c7617 100644 --- a/src/named_systems2.jl +++ b/src/named_systems2.jl @@ -105,7 +105,7 @@ function Base.convert(::Type{NamedStateSpace{T, S}}, s::U) where {T, S <: Abstra end function Base.convert(::Type{NamedStateSpace{T, S}}, M::AbstractMatrix) where {T, S <: AbstractStateSpace} - te = T <: Discrete ? Discrete(ControlSystemsBase.UNDEF_SAMPLEPETIME) : Continuous() + te = T <: Discrete ? T(Discrete(ControlSystemsBase.UNDEF_SAMPLEPETIME)) : Continuous() NT = numeric_type(S) named_ss(ss(NT.(M), te), x = gensym("x"), u = gensym("u"), y = gensym("y")) end @@ -121,7 +121,7 @@ function Base.convert(::Type{NamedStateSpace{T, S}}, s::U) where {T, S <: Abstra end function Base.convert(::Type{NamedStateSpace{T, S}}, N::Number) where {T, S <: AbstractStateSpace} - te = T <: Discrete ? Discrete(ControlSystemsBase.UNDEF_SAMPLEPETIME) : Continuous() + te = T <: Discrete ? T(Discrete(ControlSystemsBase.UNDEF_SAMPLEPETIME)) : Continuous() NT = numeric_type(S) named_ss(tf(NT(N), te), x = gensym("x"), u = gensym("u"), y = gensym("y")) end diff --git a/test/test_named_systems2.jl b/test/test_named_systems2.jl index 869b2fd..5b2ef8d 100644 --- a/test/test_named_systems2.jl +++ b/test/test_named_systems2.jl @@ -499,4 +499,9 @@ isys = inv(s1) isys = 2/s1 @test isys.sys == 2/s1.sys -@test isys.x != s1.x \ No newline at end of file +@test isys.x != s1.x + +# Test https://github.com/JuliaControl/RobustAndOptimalControl.jl/issues/130 +P = named_ss(ssrand(1,1,2, Ts=1.0)) +C = named_ss(ssrand(1,1,2, Ts=1.0)) +@test gangoffour(P, C) isa NTuple{4, NamedStateSpace{Discrete{Float64}, StateSpace{Discrete{Float64}, Float64}}} \ No newline at end of file