Skip to content

Commit f533bad

Browse files
authored
Merge pull request #60 from decargroup/59-implement-uncertainty-measure-computation
59 - Implement uncertainty measure computation
2 parents cbcc674 + 0cdcf09 commit f533bad

29 files changed

Lines changed: 2557 additions & 677 deletions

File tree

35.4 KB
Loading
34.4 KB
Loading
-44.7 KB
Binary file not shown.
-38.3 KB
Binary file not shown.
25.9 KB
Loading

doc/examples.rst

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -204,17 +204,17 @@ by the variation in parameters.
204204
Next, the uncertainty residual can be computed for each off-nominal system and
205205
uncertainty model. `dkpy` implements six unstructured uncertainty models:
206206

207-
* Additive uncertainty ("A");
207+
* Additive uncertainty ("A")
208208
.. image:: _static/example_7/7_sval_residual_A.png
209-
* Multiplicative input uncertainty ("I");
209+
* Multiplicative input uncertainty ("I")
210210
.. image:: _static/example_7/7_sval_residual_I.png
211-
* Multiplicative output uncertainty ("O");
211+
* Multiplicative output uncertainty ("O")
212212
.. image:: _static/example_7/7_sval_residual_O.png
213-
* Inverse additive uncertainty ("iA");
213+
* Inverse additive uncertainty ("iA")
214214
.. image:: _static/example_7/7_sval_residual_iA.png
215-
* Inverse multiplicative input uncertainty ("iI");
215+
* Inverse multiplicative input uncertainty ("iI")
216216
.. image:: _static/example_7/7_sval_residual_iI.png
217-
* Inverse multiplicative output uncertainty ("iO").
217+
* Inverse multiplicative output uncertainty ("iO")
218218
.. image:: _static/example_7/7_sval_residual_iO.png
219219

220220
See Chapter 8.2.3 of [SP06]_ for more information on these unstructured
@@ -239,7 +239,10 @@ stable and minimum phase linear time-invariant (LTI) system can be fit to the
239239
frequency response of the weights to obtain a LTI description of the uncertainty
240240
set. The optimal weight frequency responses and fitted weights are shown below.
241241

242-
.. image:: _static/example_7/7_uncertainty_weight.png
242+
* Left:
243+
.. image:: _static/example_7/7_sval_uncertainty_weight_left.png
244+
* Right:
245+
.. image:: _static/example_7/7_sval_uncertainty_weight_right.png
243246

244247
Multi-Model Uncertainty Characterization: Aircraft Actuator Model
245248
-----------------------------------------------------------------
@@ -269,7 +272,7 @@ weight is constrained to the identity matrix. Given that the right uncertainty
269272
weight is the identity matrix, a fit does not need to be performed for this weight
270273
as it will be neglected in the generalized plant.
271274

272-
.. image:: _static/example_8/8_magnitude_uncertainty_weight.png
275+
.. image:: _static/example_8/8_sval_uncertainty_weight_left.png
273276

274277

275278

examples/7_uncertainty_characterization.py

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,26 @@ def example_uncertainty_characterization():
3232
)
3333

3434
# Compute uncertainty weight frequency response
35-
response_weight_left, response_weight_right = (
35+
complex_weight_left, complex_weight_right = (
3636
dkpy.compute_uncertainty_weight_response(
3737
response_residuals_dict["inverse_additive"], "diagonal", "diagonal"
3838
)
3939
)
4040

4141
# Fit overbounding stable and minimum-phase uncertainty weight system
42-
weight_left = dkpy.fit_uncertainty_weight(response_weight_left, omega, [4, 5])
43-
weight_right = dkpy.fit_uncertainty_weight(response_weight_right, omega, [3, 5])
42+
weight_left = dkpy.fit_uncertainty_weight(
43+
complex_weight_left, omega, [4, 5], "left", "diagonal"
44+
)
45+
weight_right = dkpy.fit_uncertainty_weight(
46+
complex_weight_right, omega, [3, 5], "right", "diagonal"
47+
)
48+
49+
measure = dkpy.compute_uncertainty_measure_response(
50+
complex_nominal,
51+
complex_weight_left,
52+
complex_weight_right,
53+
"multiplicative_input",
54+
)
4455

4556
# Plot: Magnitude response of nominal and off-nominal systems
4657
dkpy.plot_magnitude_response_uncertain_model_set(
@@ -72,15 +83,20 @@ def example_uncertainty_characterization():
7283
response_residuals_dict, omega
7384
)
7485

75-
# Plot: Magnitude response of uncertainty weight frequency response and overbounding
76-
# fit
77-
dkpy.plot_magnitude_response_uncertainty_weight(
78-
response_weight_left,
79-
response_weight_right,
86+
# Plot: Singular value response of left uncertainty weight
87+
dkpy.plot_singular_value_response_uncertainty_weight(
88+
complex_weight_left,
8089
omega,
8190
weight_left,
91+
)
92+
93+
# Plot: Singular value response of right uncertainty weight
94+
dkpy.plot_singular_value_response_uncertainty_weight(
95+
complex_weight_right,
96+
omega,
8297
weight_right,
8398
)
99+
84100
plt.show()
85101

86102

examples/8_aircraft_actuator_uncertainty_characterization.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def example_aircraft_uncertainty_characterization():
2626
)
2727

2828
# Compute the optimal uncertainty weights with a given structure
29-
response_weight_left, response_weight_right = (
29+
complex_weight_left, complex_weight_right = (
3030
dkpy.compute_uncertainty_weight_response(
3131
response_residual["multiplicative_input"],
3232
"scalar",
@@ -35,7 +35,9 @@ def example_aircraft_uncertainty_characterization():
3535
)
3636

3737
# Fit an overbounding LTI system to the optimal uncertainty weight response
38-
weight_left = dkpy.fit_uncertainty_weight(response_weight_left, omega, 1)
38+
weight_left = dkpy.fit_uncertainty_weight(
39+
complex_weight_left, omega, 1, "left", "scalar"
40+
)
3941

4042
# Plot: Singular value response of nominal and off-nominal systems
4143
dkpy.plot_singular_value_response_uncertain_model_set(
@@ -48,15 +50,13 @@ def example_aircraft_uncertainty_characterization():
4850
response_residual, omega, hz=True
4951
)
5052

51-
# Plot: Magnitude response of uncertainty weight frequency response and overbounding
52-
# fit
53-
dkpy.plot_magnitude_response_uncertainty_weight(
54-
response_weight_left,
55-
response_weight_right,
53+
# Plot: Singular value response of left uncertainty weight
54+
dkpy.plot_singular_value_response_uncertainty_weight(
55+
complex_weight_left,
5656
omega,
57-
weight_left=weight_left,
58-
hz=True,
57+
weight_left,
5958
)
59+
6060
plt.show()
6161

6262

src/dkpy/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from .controller_synthesis import *
44
from .dk_iteration import *
55
from .d_scale_fit import *
6+
from .lti_system_fit import *
67
from .structured_singular_value import *
78
from .uncertainty_structure import *
89
from .uncertainty_characterization import *

0 commit comments

Comments
 (0)