Skip to content

Commit a180a10

Browse files
committed
Updated to julia1.0 and new ControlSystems reference
1 parent 1bb6789 commit a180a10

14 files changed

+19
-18
lines changed

REQUIRE

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
julia 0.4
1+
julia 0.7
22
VisualRegressionTests
33
ControlSystems
44
Plots
55
GR
6+
Gtk
7+
ImageMagick

src/ControlExamplePlots.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module ControlExamplePlots
22

3-
using ControlSystems, Plots, VisualRegressionTests
3+
using ControlSystems, Plots, VisualRegressionTests, Gtk
44

55
include("genplots.jl")
66

src/figures/bode.png

74 Bytes
Loading

src/figures/gangoffour.png

-6.86 KB
Loading

src/figures/impulse.png

-4.61 KB
Loading

src/figures/lsim.png

-1.47 KB
Loading

src/figures/margin.png

-4.44 KB
Loading

src/figures/nichols.png

-1.66 KB
Loading

src/figures/nyquist.png

-307 Bytes
Loading

src/figures/pzmap.png

-23 Bytes
Loading

src/figures/rlocus.png

-3.75 KB
Loading

src/figures/sigma.png

-1.04 KB
Loading

src/figures/step.png

-4.79 KB
Loading

src/genplots.jl

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,37 @@
11
export genplots, getexamples, runplotgen
22

3-
@doc """ results = runplotgen()
3+
""" results = runplotgen()
44
Run full generation of the plots needed for the tests in ControlSystems.jl
5-
""" ->
5+
"""
66
function runplotgen()
77
funcs, refs, eps = getexamples()
88
genplots(funcs, refs, eps=eps)
99
end
1010

11-
@doc """ results = genplots(funcs, refs; eps, kwargs...)
11+
""" results = genplots(funcs, refs; eps, kwargs...)
1212
Generate the plots needed for the tests in ControlSystems.jl
13-
""" ->
13+
"""
1414
function genplots(funcs, refs; eps=0.01*ones(length(refs)), kwargs...)
1515
ENV["MPLBACKEND"] = "Agg"
16-
results = Array{VisualRegressionTests.VisualTestResult,1}(length(refs))
16+
results = Array{VisualRegressionTests.VisualTestResult,1}(undef, length(refs))
1717
#Run/generate tests
1818
for (i,ref) in enumerate(refs)
1919
testf(fn) = png(funcs[i](), fn)
20-
results[i] = test_images(VisualTest(testf, ref); eps=eps[i], kwargs...)
20+
results[i] = test_images(VisualTest(testf, ref); tol=eps[i], kwargs...)
2121
end
2222
results
2323
end
2424

25-
@doc """funcs, refs, eps = getexamples()
25+
"""funcs, refs, eps = getexamples()
2626
Get the example functions and locations of reference plots needed for the tests in ControlSystems.jl
27-
""" ->
27+
"""
2828
function getexamples()
29-
tf1 = tf([1],[1,1], inputnames=["Inp1"], outputnames=["Out1"])
30-
tf2 = tf([1/5,2],[1,1,1], inputnames=["Inp2"], outputnames=["Out1"])
29+
tf1 = tf([1],[1,1])
30+
tf2 = tf([1/5,2],[1,1,1])
3131
sys = [tf1 tf2]
32-
sysss = ss([-1 2; 0 1], [1 0; 1 1], [1 0; 0 1], [0.1 0; 0 -0.2],
33-
inputnames=["MyIn1", "MyIn2"], statenames=["State1", "State2"])
32+
sysss = ss([-1 2; 0 1], [1 0; 1 1], [1 0; 0 1], [0.1 0; 0 -0.2])
3433

35-
ws = logspace(-2,2,200)
34+
ws = 10.0 .^range(-2,stop=2,length=200)
3635
ts = 0:0.01:5
3736
bodegen() = begin
3837
setPlotScale("dB")
@@ -45,7 +44,7 @@ function getexamples()
4544

4645
stepgen() = stepplot(sys, ts[end], ts[2]-ts[1], l=(:dash, 4))
4746
impulsegen() = impulseplot(sys, ts[end], ts[2]-ts[1], l=:blue)
48-
L = lqr(sysss.A, sysss.B, eye(2), eye(2))
47+
L = lqr(sysss.A, sysss.B, [1 0; 0 1], [1 0; 0 1])
4948
lsimgen() = lsimplot(sysss, (x,i)->-L*x, ts, [1;2])
5049

5150
margingen() = marginplot([tf1, tf2], ws)
@@ -56,11 +55,11 @@ function getexamples()
5655
pzmapgen() = pzmap(tf2, xlims=(-15,5))
5756
rlocusgen() = rlocusplot(tf2)
5857

59-
plotsdir = Pkg.dir("ControlExamplePlots")*"/src/figures/"
58+
plotsdir = joinpath(dirname(pathof(ControlExamplePlots)), "..", "src", "figures")
6059
refs = ["bode.png", "nyquist.png", "sigma.png", "nichols.png", "step.png",
6160
"impulse.png", "lsim.png", "margin.png", "gangoffour.png", "pzmap.png", "rlocus.png"]
6261
funcs = [bodegen, nyquistgen, sigmagen, nicholsgen, stepgen,
6362
impulsegen, lsimgen, margingen, gangoffourgen, pzmapgen, rlocusgen]
6463
eps = 0.001*ones(length(refs));
65-
funcs, map(s -> plotsdir*s, refs), eps
64+
funcs, map(s -> joinpath(plotsdir,s), refs), eps
6665
end

0 commit comments

Comments
 (0)