Skip to content

Commit

Permalink
close #869
Browse files Browse the repository at this point in the history
  • Loading branch information
baggepinnen committed Sep 8, 2023
1 parent 4f6bdba commit ce4f79f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/ControlSystemsBase/src/types/SisoTfTypes/conversion.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
function Base.convert(::Type{SisoZpk{T,TR}}, f::SisoRational{T2}) where {T<:Number, TR<:Number, T2<:Number}
if length(f.num) == 0
return SisoZpk(T[],TR[],0)
return SisoZpk(T[],TR[],zero(T))
elseif all(f.den == zero(f.den))
error("Zero denominator, this should not be possible") # NOTE: Should we keep this?
end
Expand Down
8 changes: 8 additions & 0 deletions lib/ControlSystemsBase/test/test_conversion.jl
Original file line number Diff line number Diff line change
Expand Up @@ -188,4 +188,12 @@ myss = ss(mytf)
test = ss([-1 2 3; 0 -2 3; 0 0 -3],[1;2;3],[1 2 3], [0])
@test tf(test) isa TransferFunction


# Issue https://github.com/JuliaControl/ControlSystems.jl/issues/869

sys = tf(ssrand(2,2,2))
sys.matrix[1,1] = 0
syszpk = zpk(sys)
@test syszpk isa TransferFunction{Continuous, ControlSystemsBase.SisoZpk{Float64, ComplexF64}}

end

0 comments on commit ce4f79f

Please sign in to comment.