Uncertainty modeling
We provide two general means of modeling uncertainty, the traditional $M\Delta$ framework [Skogestad][Doyle91], and using parametric uncertainty. Support for parametric uncertainty is almost universal in Julia, not only in ControlSystems.jl, by means of computing with uncertain number types. In this tutorial, we will use a Monte-Carlo approach using uncertain number types from MonteCarloMeasurements.jl.
Both the $M\Delta$ framework and parametric-uncertainty approaches are illustrated below.
- Uncertainty modeling
Uncertainty API
δc
Creates an uncertain complex parameter.δr
Creates an uncertain real parameter.δss
(Experimental) Creates an uncertain statespace model.neglected_delay
Create a multiplicative weight that represents uncertainty from an unmodeled delay.neglected_lag
Create a multiplicative weight that represents uncertainty from an unmodeled lag (pole).gain_and_delay_uncertainty
Create a multiplicative weight that represents uncertainty from uncertain gains and delay.makeweight
Create a custom weighting function.fit_complex_perturbations
- See MonteCarloMeasurements.jl to create uncertain parameters that are represented by samples.
See example uncertain.jl
.
Parametric uncertainty using MonteCarloMeasurements.jl
The most straightforward way to model uncertainty is to use uncertain parameters, using tools such as IntervalArithmetic (strict, worst case guarantees) or MonteCarloMeasurements (less strict worst-case analysis or probabilistic). In the following, we show an example with MIMO systems with both parametric uncertainty and diagonal, complex uncertainty, adapted from 8.11.3 in Skogestad, "Multivariable Feedback Control: Analysis and Design". This example is also available as a julia script in uncertain.jl
.
We will create uncertain parameters using the δr
constructor from this package. One may alternatively create uncertain parameters directly using any of the constructors from MonteCarloMeasurements.jl. Most functions from ControlSystemsBase.jl should work with systems containing parameters from MonteCarloMeasurements.jl.
Basic example
This example shows how to use MonteCarloMeasurements directly to build uncertain systems.
using ControlSystemsBase, MonteCarloMeasurements, Plots
ω = 1 ± 0.1 # Create an uncertain Gaussian parameter
1.0 ± 0.1 MonteCarloMeasurements.Particles{Float64, 2000}
ζ = 0.3..0.4 # Create an uncertain uniform parameter
0.35 ± 0.0289 MonteCarloMeasurements.Particles{Float64, 2000}
G = tf(ω^2, [1, 2ζ*ω, ω^2]) # systems accept uncertain parameters
TransferFunction{Continuous, ControlSystemsBase.SisoRational{MonteCarloMeasurements.Particles{Float64, 2000}}}
1.01 ± 0.2
----------------------------------
1.0s^2 + 0.7 ± 0.089s + 1.01 ± 0.2
Continuous-time transfer function model
w = exp10.(-2:0.02:2)
bodeplot(G, w)
plot(step(G, 0:0.1:20))
Example: Spinning satellite
This example makes use of real-valued uncertain parameters created using δr
, it comes from section 3.7.1 of Skogestad's book.
using RobustAndOptimalControl, ControlSystemsBase, MonteCarloMeasurements, Plots, LinearAlgebra
default(size=(640,480))
unsafe_comparisons(true)
a = 10
P = ss([0 a; -a 0], I(2), [1 a; -a 1], 0)
K = ss(1.0I(2))
w = 2π .* exp10.(LinRange(-2, 2, 500))
S, PS, CS, T = gangoffour(P, K)
sigmaplot(S, w, lab="S")
sigmaplot!(T, w, c=2, lab="T", ylims=(0.01, 45))
Both sensitivity functions are very large, expect a non-robust system!
Next, we add parametric uncertainty
a = 10*(1 + 0.1δr(100)) # Create an uncertain parameter with nominal value 10 and 10% uncertainty, represented by 100 samples
P = ss([0 a; -a 0], I(2), [1 a; -a 1], 0)
Sp, PSp, CSp, Tp = gangoffour(P, K)
sigmaplot(Sp, w, lab="S")
sigmaplot!(Tp, w, c=2, lab="T", ylims=(0.01, 100))