Skip to content

Commit a8eda85

Browse files
committed
Small update to build, readme and docs
1 parent b207324 commit a8eda85

File tree

8 files changed

+80
-61
lines changed

8 files changed

+80
-61
lines changed

.travis.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
language: julia
22
julia:
3-
- 0.7
43
- 1.0
4+
- 1.1
5+
- nightly
6+
matrix:
7+
allow_failures:
8+
- julia: nightly
59
notifications:
610
email: false
711
after_success:

README.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
# ControlSystems.jl
22

3-
[![ControlSystems](http://pkg.julialang.org/badges/ControlSystems_0.6.svg)](http://pkg.julialang.org/?pkg=ControlSystems)
43
[![Build Status](https://travis-ci.org/JuliaControl/ControlSystems.jl.svg?branch=master)](https://travis-ci.org/JuliaControl/ControlSystems.jl)
5-
[![Coverage Status](https://coveralls.io/repos/github/JuliaControl/ControlSystems.jl/badge.svg?branch=master)](https://coveralls.io/github/JuliaControl/ControlSystems.jl?branch=master)
6-
[![Latest](https://img.shields.io/badge/docs-latest-blue.svg)](http://juliacontrol.github.io/ControlSystems.jl/latest/)
4+
[![Gitter](https://badges.gitter.im/JuliaControl/ControlSystems.jl.svg)](https://gitter.im/JuliaControl/ControlSystems.jl?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
5+
6+
[![](https://img.shields.io/badge/docs-stable-blue.svg)](https://juliacontrol.github.io/ControlSystems.jl/stable)
7+
[![](https://img.shields.io/badge/docs-latest-blue.svg)](https://juliacontrol.github.io/ControlSystems.jl/latest)
78

89
A control systems design toolbox for Julia.
910

docs/make.jl

+21-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,27 @@ import GR # Bug with world age in Plots.jl, see https://github.com/JuliaPlots/Pl
33

44
include("src/makeplots.jl")
55

6-
makedocs(modules=[ControlSystems], format=:html, sitename="ControlSystems")
7-
6+
makedocs(modules=[ControlSystems],
7+
format=Documenter.HTML(),
8+
sitename="ControlSystems.jl",
9+
pages=[
10+
"Home" => "index.md",
11+
"Examples" => Any[
12+
"Design" => "examples/example.md",
13+
],
14+
"Guide" => Any[
15+
"Introduction" => "man/introduction.md",
16+
"Creating Transfer Functions" => "man/creatingtfs.md",
17+
],
18+
"Functions" => Any[
19+
"Constructors" => "lib/constructors.md",
20+
"Analysis" => "lib/analysis.md",
21+
"Synthesis" => "lib/synthesis.md",
22+
"Time and Frequency response" => "lib/timefreqresponse.md",
23+
"Plotting" => "lib/plotting.md",
24+
],
25+
]
26+
)
827
# If not running travis, generate the plots here, even if we are not deploying
928
if get(ENV, "TRAVIS", "") == ""
1029
makePlots()

docs/src/assets/logo.png

5.94 KB
Loading

docs/src/examples/example.md

+24-24
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ Q = I
1717
R = I
1818
L = dlqr(A,B,Q,R) # lqr(sys,Q,R) can also be used
1919

20-
u(t,x) = -L*x + 1.5(t>=2.5)# Form control law (u is a function of t and x), a constant input disturbance is affecting the system from t≧2.5
20+
u(x,t) = -L*x .+ 1.5(t>=2.5)# Form control law (u is a function of t and x), a constant input disturbance is affecting the system from t≧2.5
2121
t =0:h:5
2222
x0 = [1,0]
23-
y, t, x, uout = lsim(sys,u,t,x0)
23+
y, t, x, uout = lsim(sys,u,t,x0=x0)
2424
plot(t,x, lab=["Position", "Velocity"]', xlabel="Time [s]")
2525
```
2626

27-
![](../plots/lqrplot.svg)
27+
![](../../plots/lqrplot.svg)
2828

2929

3030
# LQR design
@@ -39,22 +39,22 @@ Q = I
3939
R = I
4040
L = dlqr(A,B,Q,R) # lqr(sys,Q,R) can also be used
4141

42-
u(t,x) = -L*x + 1.5(t>=2.5)# Form control law (u is a function of t and x), a constant input disturbance is affecting the system from t≧2.5
42+
u(x,t) = -L*x .+ 1.5(t>=2.5)# Form control law (u is a function of t and x), a constant input disturbance is affecting the system from t≧2.5
4343
t =0:h:5
4444
x0 = [1,0]
45-
y, t, x, uout = lsim(sys,u,t,x0)
45+
y, t, x, uout = lsim(sys,u,t,x0=x0)
4646
plot(t,x, lab=["Position", "Velocity"]', xlabel="Time [s]")
4747
```
4848

49-
![](../plots/lqrplot.svg)
49+
![](../../plots/lqrplot.svg)
5050

5151
# PID design functions
5252
By plotting the gang of four under unit feedback for the process
5353
```julia
5454
P = tf(1,[1,1])^4
5555
gangoffourplot(P,tf(1))
5656
```
57-
![](../plots/pidgofplot.svg)
57+
![](../../plots/pidgofplot.svg)
5858

5959
we notice that the sensitivity function is a bit too high at around frequencies ω = 0.8 rad/s. Since we want to control the process using a simple PI-controller, we utilize the
6060
function `loopshapingPI` and tell it that we want 60 degrees phase margin at this frequency. The resulting gang of four is plotted for both the constructed controller and for unit feedback.
@@ -63,8 +63,8 @@ function `loopshapingPI` and tell it that we want 60 degrees phase margin at thi
6363
ωp = 0.8
6464
kp,ki,C = loopshapingPI(P,ωp,phasemargin=60, doplot=true)
6565
```
66-
![](../plots/pidgofplot2.svg)
67-
![](../plots/pidnyquistplot.svg)
66+
![](../../plots/pidgofplot2.svg)
67+
![](../../plots/pidnyquistplot.svg)
6868

6969

7070
We could also cosider a situation where we want to create a closed-loop system with the bandwidth ω = 2 rad/s, in which case we would write something like
@@ -74,8 +74,8 @@ kp,ki,C60 = loopshapingPI(P,ωp,rl=1,phasemargin=60, doplot=true)
7474
```
7575
Here we specify that we want the Nyquist curve `L(iω) = P(iω)C(iω)` to pass the point `|L(iω)| = rl = 1, arg(L(iω)) = -180 + phasemargin = -180 + 60`
7676
The gang of four tells us that we can indeed get a very robust and fast controller with this design method, but it will cost us significant control action to double the bandwidth of all four poles.
77-
![](../plots/pidgofplot3.svg)
78-
![](../plots/pidnyquistplot2.svg)
77+
![](../../plots/pidgofplot3.svg)
78+
![](../../plots/pidnyquistplot2.svg)
7979

8080
# Advanced pole-zero placement
8181
This example illustrates how we can perform advanced pole-zero placement. The task is to make the process a bit faster and damp the poorly damped poles.
@@ -121,24 +121,24 @@ stepplot([P,Gcl]) # Visualize the open and closed loop responses.
121121
gangoffourplot(P, tf(-S,R)) # Plot the gang of four to check that all tranfer functions are OK
122122
```
123123

124-
![](../plots/ppstepplot.svg)
125-
![](../plots/ppgofplot.svg)
124+
![](../../plots/ppstepplot.svg)
125+
![](../../plots/ppgofplot.svg)
126126

127127

128128
# Stability boundary for PID controllers
129129
The stability boundary, where the transfer function `P(s)C(s) = -1`, can be plotted with the command `stabregionPID`. The process can be given in string form or as a regular LTIsystem.
130130

131131
```julia
132-
P1 = "exp(-sqrt(s))"
132+
P1 = s -> exp(-sqrt(s))
133133
f1 = stabregionPID(P1,exp10.(range(-5, stop=1, length=1000)))
134-
P2 = "100*(s+6).^2./(s.*(s+1).^2.*(s+50).^2)"
134+
P2 = s -> 100*(s+6).^2. /(s.*(s+1).^2. *(s+50).^2)
135135
f2 = stabregionPID(P2,exp10.(range(-5, stop=2, length=1000)))
136136
P3 = tf(1,[1,1])^4
137137
f3 = stabregionPID(P3,exp10.(range(-5, stop=0, length=1000)))
138138
```
139-
![](../plots/stab1.svg)
140-
![](../plots/stab2.svg)
141-
![](../plots/stab3.svg)
139+
![](../../plots/stab1.svg)
140+
![](../../plots/stab2.svg)
141+
![](../../plots/stab3.svg)
142142

143143

144144
# PID plots
@@ -149,18 +149,18 @@ P = tf([1.],[1., 1])
149149
ζ = 0.5 # Desired damping
150150

151151
ws = exp10.(range(-1, stop=2, length=8)) # A vector of closed-loop bandwidths
152-
kp = 2*ζ*ws-1 # Simple pole placement with PI given the closed-loop bandwidth, the poles are placed in a butterworth pattern
152+
kp = 2*ζ*ws .- 1 # Simple pole placement with PI given the closed-loop bandwidth, the poles are placed in a butterworth pattern
153153
ki = ws.^2
154154
pidplots(P,:nyquist,:gof;kps=kp,kis=ki, ω= exp10.(range(-2, stop=2, length=500))) # Request Nyquist and Gang-of-four plots (more plots are available, see ?pidplots )
155155
```
156-
![](../plots/pidplotsnyquist1.svg)
157-
![](../plots/pidplotsgof1svg)
156+
![](../../plots/pidplotsnyquist1.svg)
157+
![](../../plots/pidplotsgof1svg)
158158

159159
Now try a different strategy, where we have specified a gain crossover frequency of 0.1 rad/s
160160
```julia
161161
kp = range(-1, stop=1, length=8) #
162-
ki = sqrt(1-kp.^2)/10
162+
ki = sqrt.(1 .- kp.^2)/10
163163
pidplots(P,:nyquist,:gof;kps=kp,kis=ki)
164164
```
165-
![](../plots/pidplotsnyquist2.svg)
166-
![](../plots/pidplotsgof2.svg)
165+
![](../../plots/pidplotsnyquist2.svg)
166+
![](../../plots/pidplotsgof2.svg)

docs/src/index.md

+2-8
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ CurrentModule = ControlSystems
77
## Examples
88
```@contents
99
Pages = ["examples/example.md"]
10-
Depth = 1
10+
Depth = 2
1111
```
1212

1313
## Guide
@@ -20,12 +20,6 @@ Depth = 1
2020
## Functions
2121

2222
```@contents
23-
Pages = ["lib/constructors.md", "lib/plotting.md"]
24-
```
25-
26-
## Documentation Index
27-
28-
```@index
29-
Pages = ["lib/constructors.md", "lib/plotting.md", "lib/syntheis.md", "lib/timefreqresponse.md", "lib/analysis.md"]
23+
Pages = ["lib/constructors.md", "lib/analysis.md", "lib/syntheis.md", "lib/timefreqresponse.md", "lib/plotting.md"]
3024
Depth = 1
3125
```

docs/src/man/creatingtfs.md

+15-14
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,15 @@ tf(num, den, Ts=0)
1313
where `num` and `den` are the polinomial coefficients of the numerator and denominator of the polynomial and `Ts` is the sample time.
1414
### Example:
1515
```julia
16-
tf([1],[1,2,1])
16+
tf([1.0],[1,2,1])
1717

1818
# output
1919

20-
TransferFunction:
21-
1.0
22-
----------------
23-
s^2 + 2.0s + 1.0
20+
TransferFunction{ControlSystems.SisoRational{Float64}}
21+
1.0
22+
---------------------
23+
1.0*s^2 + 2.0*s + 1.0
24+
2425

2526
Continuous-time transfer function model
2627
```
@@ -35,14 +36,14 @@ zpk(zeros, poles, gain, Ts=0)
3536
where `zeros` and `poles` are `Vectors` of the zeros and poles for the system and `gain` is a gain coefficient.
3637
### Example
3738
```julia
38-
zpk([-1,1], [-5, -10], 2)
39+
zpk([-1.0,1], [-5, -10], 2)
3940

4041
# output
4142

42-
TransferFunction:
43-
(s - 1.0)(s + 1.0)
44-
2.0-------------------
45-
(s + 10.0)(s + 5.0)
43+
TransferFunction{ControlSystems.SisoZpk{Float64,Float64}}
44+
(1.0*s + 1.0)(1.0*s - 1.0)
45+
2.0---------------------------
46+
(1.0*s + 5.0)(1.0*s + 10.0)
4647

4748
Continuous-time transfer function model
4849
```
@@ -56,10 +57,10 @@ tf(zpk([-1], [1], 2, 0.1))
5657

5758
# output
5859

59-
TransferFunction:
60-
2.0z + 2.0
61-
----------
62-
z - 1.0
60+
TransferFunction{ControlSystems.SisoRational{Int64}}
61+
2*z + 2
62+
-------
63+
1z - 1
6364

6465
Sample Time: 0.1 (seconds)
6566
Discrete-time transfer function model

docs/src/man/introduction.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ Transfer functions can easily be created using the function `tf(num, den, Ts=0)`
1818

1919
Example:
2020
```julia
21-
P = tf([1],[1,1])
21+
P = tf([1.0],[1,1])
2222
T = P/(1+P)
2323

2424
# output
2525

26-
TransferFunction:
27-
s + 1.0
28-
----------------
29-
s^2 + 3.0s + 2.0
26+
TransferFunction{ControlSystems.SisoRational{Float64}}
27+
1.0*s + 1.0
28+
---------------------
29+
1.0*s^2 + 3.0*s + 2.0
3030

3131
Continuous-time transfer function model
3232
```
@@ -37,10 +37,10 @@ minreal(T)
3737

3838
# output
3939

40-
TransferFunction:
41-
1.0
42-
-------
43-
s + 2.0
40+
TransferFunction{ControlSystems.SisoRational{Float64}}
41+
1.0
42+
-----------
43+
1.0*s + 2.0
4444

4545
Continuous-time transfer function model
4646
```

0 commit comments

Comments
 (0)