Skip to content

Commit 8e9aa11

Browse files
committed
Added a module DemoSystems.
1 parent 57daebf commit 8e9aa11

File tree

2 files changed

+54
-41
lines changed

2 files changed

+54
-41
lines changed

src/ControlSystems.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export LTISystem,
7878
pade,
7979
# demo systems
8080
ssrand,
81-
systemdepot,
81+
DemoSystems, # A module containing some example systems
8282
# utilities
8383
num, #Deprecated
8484
den, #Deprecated

src/demo_systems.jl

Lines changed: 53 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -26,59 +26,69 @@ ssrand(T::Type, n; kwargs...) = ssrand(T, n, n, 2*n; kwargs...)
2626

2727

2828
"""
29-
systemdepot(sysname::String; Ts=nothing, kwargs...)
29+
DemoSystems
3030
31-
Convenience function for setting up some different systems
32-
that are commonly used as examples in the control literature.
31+
A module containing some different systems that are commonly used as examples in the control literature.
3332
34-
Change the default parameter values by using keyword arguments.
33+
Change the default parameter values using keyword arguments.
3534
3635
SISO systems
3736
============
38-
1) `fo` First-order system `1/(sT+1)`
39-
2) `fotd` First-order system with time-delay `exp(-sτ)/(sT+1)`
40-
3) `sotd` Second-order non-resonant system with time-delay `exp(-sτ)/(sT+1)/(sT2 + 1)`
41-
4) `resonant` Second-order resonant systems `ω0^2/(s^2 + 2ζ*ω0*s + ω0^2)`
37+
* `DemoSystems.fo(;T=1)` First-order system `1/(sT+1)`
38+
* `DemoSystems.fotd(;T=1, τ=1)` First-order system with time delay `exp(-sτ)/(sT+1)`
39+
* `DemoSystems.sotd(;T=1, T2=10, τ=1)` Second-order non-resonant system with time delay `exp(-sτ)/(sT+1)/(sT2 + 1)`
40+
* `DemoSystems.resonant(;ω0=1, ζ=0.25)` Second-order resonant systems `ω0^2/(s^2 + 2ζ*ω0*s + ω0^2)`
4241
4342
MIMO systems
4443
============
45-
5) `woodberry` Wood--Berry distillation column
46-
6) `doylesat` Doyle's spinning body example
47-
"""
48-
function systemdepot(sysname::String; Ts=nothing, kwargs...)
49-
if sysname == "woodberry" # The Wood--Berry distillation column
50-
sys = woodberry(;kwargs...)
51-
elseif sysname == "fotd"
52-
sys = fotd(;kwargs...)
53-
elseif sysname == "sotd"
54-
sys = sotd(;kwargs...)
55-
elseif sysname == "fo"
56-
sys = first_order_system(;kwargs...)
57-
elseif sysname == "resonant"
58-
sys = resonant(;kwargs...)
59-
elseif sysname == "doylesat"
60-
sys = doylesat(;kwargs...)
61-
else
62-
error("Unknown system name: $sysname")
63-
end
44+
* `DemoSystems.woodberry()` Wood--Berry distillation column
45+
* `DemoSystems.doylesat(;a=10)` The spinning body example by Doyle
6446
65-
if isnothing(Ts)
66-
return sys
67-
else
68-
Tsc2d(sys, Ts)
69-
end
70-
end
47+
Fore more information, see the help for the specific systems.
48+
"""
49+
module DemoSystems
50+
51+
using ControlSystems
52+
using LinearAlgebra
53+
54+
55+
"""
56+
fo(;T=1, τ=1)
7157
72-
first_order_system(;T=1) = ss(-1/T, 1, 1/T, 0)
58+
Returns a first-order system `1/(sT+1)` (`StateSpace`).
59+
"""
60+
fo(;T=1) = ss(-1/T, 1, 1/T, 0)
61+
62+
63+
"""
64+
fotd(;T=1, τ=1)
65+
66+
Returns a first-order system + a time delay `exp(-sτ)/(sT+1)` (`DelayLTISystem`).
67+
"""
7368
fotd(;T=1, τ=1) = ss(-1/T, 1, 1/T, 0) * delay(τ)
69+
70+
71+
"""
72+
sotd(;T=1, T2=10, τ=1)
73+
74+
Returns a second-order system + a time delay `exp(-sτ)/(sT+1)/(sT2 + 1)` (`DelayLTISystem`).
75+
"""
7476
sotd(;T=1, T2=10, τ=1) = ss(-1/T, 1, 1/T, 0)*ss(-1/T2, 1, 1/T2, 0)*delay(τ)
77+
78+
79+
"""
80+
resonant(;ω0=1, ζ=0.25)
81+
82+
Returns a second-order system + a time delay `exp(-sτ)/(sT+1)/(sT2 + 1)` (`DelayLTISystem`).
83+
"""
7584
resonant(;ω0=1, ζ=0.25) = ss([-ζ -ω0; ω0 -ζ], [ω0; 0], [0 ω0], 0) # QUESTION: Is this the form that we like? Perhhaps not.
7685

7786

7887
"""
79-
Doyle's spinning body (satellite) example
80-
======================
81-
A classic example that illustrates that robustness analysis of MIMO systems
88+
`doylesat(;a=10) = ss([0 a; -a 0], I(2), [1 a; -a 1], 0)`
89+
90+
Returns a model for the spinning body (satellite) example by Doyle,
91+
which is a classic example that illustrates that robustness analysis of MIMO systems
8292
is more involved than for SISO systems.
8393
8494
*References:*
@@ -93,9 +103,9 @@ doylesat(;a=10) = ss([0 a; -a 0], I(2), [1 a; -a 1], 0)
93103

94104

95105
"""
96-
Wood--Berry distillation column
97-
======================
98-
A classic example from the literature on process control of MIMO process.
106+
`woodberry()`
107+
108+
Returns a model for the Wood--Berry distillation column, which is a classic example from the literature on process control of MIMO process.
99109
100110
*References:*
101111
@@ -108,3 +118,6 @@ function woodberry()
108118
return [12.8/(1 + 16.7*s)*delay(1.0) -18.9/(1 + 21*s) * delay(3.0)
109119
6.6/(1 + 10.9*s) * delay(7.0) -19.4/(1 + 14.4*s) * delay(3.0)]
110120
end
121+
122+
123+
end

0 commit comments

Comments
 (0)