Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/ControlSystemsBase/src/ControlSystemsBase.jl
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ function __init__()
print(io, " for automatic discretization (applicable to systems without delays or nonlinearities only).")
end
plots_id = Base.PkgId(UUID("91a5bcdd-55d7-5caf-9e0b-520d859cae80"), "Plots")
if exc.f !== nothing && nameof(exc.f) === :plot && parentmodule(argtypes[1]) == @__MODULE__() && !haskey(Base.loaded_modules, plots_id)
if exc.f isa Function && nameof(exc.f) === :plot && parentmodule(argtypes[1]) == @__MODULE__() && !haskey(Base.loaded_modules, plots_id)
printstyled(io, "\nPlotting is not available unless Plots.jl is loaded manually. Call `using Plots` before plotting.", color=:green, bold=true)
elseif (exc.f == /) && argtypes[2] <: DelayLtiSystem
print(io, "A delayed system can not be inverted. Consider use of the function `feedback`.")
Expand Down
2 changes: 1 addition & 1 deletion lib/ControlSystemsBase/src/analysis.jl
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ function sisomargin(sys::LTISystem, w::AbstractVector{<:Real}; full=false, allMa
if !allMargins #Only output the smallest margins
gm, idx = findmin([gm;Inf])
wgm = [wgm;NaN][idx]
pm, idx = findmin([abs.(pm);Inf])
pm, idx = findmin([pm;Inf])
fi = [fi;NaN][idx]
wpm = [wpm;NaN][idx]
if full
Expand Down
8 changes: 4 additions & 4 deletions lib/ControlSystemsBase/src/connections.jl
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,12 @@ Base.typed_hcat(::Type{S}, X::Union{AbstractArray{<:Number,1}, AbstractArray{<:N

## Mixed-type array creation
# When creating an array of systems, an error may be thrown if the default Base.vect is called that tries to promote all systems to a common type. E.g., when using non-proper transfer functions and statespace systems. We thus opt out of the conversion with the method below
function Base.vect(X::LTISystem...)
LTISystem[X...]
function Base.vect(X0::LTISystem, X::LTISystem...)
LTISystem[X0, X...]
end

function Base.vect(X::T...) where T <: LTISystem
T[X...]
function Base.vect(X0::T, X::T...) where T <: LTISystem
T[X0, X...]
end

"""
Expand Down
14 changes: 7 additions & 7 deletions lib/ControlSystemsBase/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import Base.isapprox # In framework and test_synthesis
import SparseArrays: sparse # In test_matrix_comps
import Polynomials: conv # In test_conversion and test_synthesis
using Aqua
# @testset "Aqua" begin
# Aqua.test_all(ControlSystemsBase;
# ambiguities = false, # causes 100s of hits in all dependencies
# stale_deps = true, # Aqua complains about itself https://github.com/JuliaTesting/Aqua.jl/issues/78
# project_toml_formatting = false, # https://github.com/JuliaTesting/Aqua.jl/issues/105
# )
# end
@testset "Aqua" begin
Aqua.test_all(ControlSystemsBase;
ambiguities = false, # causes 100s of hits in all dependencies
stale_deps = true, # Aqua complains about itself https://github.com/JuliaTesting/Aqua.jl/issues/78
project_toml_formatting = false, # https://github.com/JuliaTesting/Aqua.jl/issues/105
)
end


include("framework.jl")
Expand Down
4 changes: 4 additions & 0 deletions lib/ControlSystemsBase/test/test_analysis.jl
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,10 @@ Lw = freqresp(L, m[1][])[]
@test imag(Lw) 0 atol = 1e-6 # Test definition of gain margin
@test inv(-real(Lw)) m[2][] atol = 1e-6 # Test definition of gain margin

# https://github.com/JuliaControl/ControlSystems.jl/issues/961
P = tf(1,[5, 10.25, 6.25, 1])
w_180, gm, w_c, pm = margin(50P)
@test pm[] -35.1 rtol=1e-2

# RGA
a = 10
Expand Down
Loading