Skip to content

Commit

Permalink
Merge pull request #60 from JuliaControl/no_plots
Browse files Browse the repository at this point in the history
Remove dependency on Plots
  • Loading branch information
baggepinnen authored Sep 12, 2022
2 parents 20628d9 + 8f288ed commit 9924e4e
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ MatrixEquations = "99c1a7ee-ab34-5fd5-8076-27c950a045f4"
MatrixPencils = "48965c70-4690-11ea-1f13-43a2532b2fa8"
MonteCarloMeasurements = "0987c9cc-fe09-11e8-30f0-b96dd679fdca"
Optim = "429524aa-4258-5aef-a3af-852621145aeb"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
UnPack = "3a884ed6-31ef-47d7-9d2a-63182c4928ed"

[compat]
Expand Down
2 changes: 1 addition & 1 deletion docs/Project.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[deps]
ControlSystemsBase = "a6e380b2-a6ca-5380-bf3e-84a91bcd477e"
ControlSystemsBase = "aaaaaaaa-a6ca-5380-bf3e-84a91bcd477e"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
MonteCarloMeasurements = "0987c9cc-fe09-11e8-30f0-b96dd679fdca"
Expand Down
2 changes: 1 addition & 1 deletion src/RobustAndOptimalControl.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ module RobustAndOptimalControl

using ControlSystemsBase: issiso
using LinearAlgebra, Statistics
using Plots
using RecipesBase
using UUIDs # To check if Plots is loaded in gofplot
using ControlSystemsBase
import ControlSystemsBase: ss, ssdata, ninputs, noutputs, nstates, isdiscrete, iscontinuous, to_matrix, timeevol, _string_mat_with_headers, common_timeevol, gangoffour, sensitivity,
input_sensitivity,
Expand Down
6 changes: 6 additions & 0 deletions src/lqg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,9 @@ function gangoffour(l::LQGProblem)
end

function ControlSystemsBase.gangoffourplot(l::LQGProblem, args...; sigma = true, kwargs...)
plots_id = Base.PkgId(UUID("91a5bcdd-55d7-5caf-9e0b-520d859cae80"), "Plots")
haskey(Base.loaded_modules, plots_id) || error("Call using Plots before calling this function")
Plots = Base.loaded_modules[plots_id]
S,D,N,T = gangoffour(l)
bp = (args...; kwargs...) -> sigma ? sigmaplot(args...; kwargs...) : bodeplot(args...; plotphase=false, kwargs...)
f1 = bp(S, args...; show=false, title="S", kwargs...)
Expand All @@ -515,6 +518,9 @@ function ControlSystemsBase.gangoffourplot(l::LQGProblem, args...; sigma = true,
end

function gangofsevenplot(P, C, F, args...; sigma = true, ylabel="", layout=4, kwargs...)
plots_id = Base.PkgId(UUID("91a5bcdd-55d7-5caf-9e0b-520d859cae80"), "Plots")
haskey(Base.loaded_modules, plots_id) || error("Call using Plots before calling this function")
Plots = Base.loaded_modules[plots_id]
S,D,CS,T = gangoffour(P,C)
RY = T*F
RU = CS*F
Expand Down
1 change: 0 additions & 1 deletion test/test_uncertainty.jl
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,5 @@ w = exp10.(-1:0.01:4)

bodeplot(P, exp10.(-1:0.001:3))
nyquistplot(P*C, w[1:10:end], points=true, xlims=(-3.5, 2.5), ylims=(-5, 1.5), Ms_circles=[1.5, 2], alpha=1) # Note, the nyquistplot with uncertain coefficients requires manual selection of plot limits
# c2d(feedback(P, C), 0.001)
# plot(step(feedback(P, C), 0:0.0001:0.05), lab="L = " .* string.(P.Tau[].particles'), title="Disturbance response") # This is not being run to avoid having to load ControlSystems

0 comments on commit 9924e4e

Please sign in to comment.