Skip to content

Commit

Permalink
New function mdgenspec and modified examples.
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasvarga committed Jan 3, 2023
1 parent 9a19502 commit 923feb0
Show file tree
Hide file tree
Showing 28 changed files with 249 additions and 75 deletions.
6 changes: 3 additions & 3 deletions Examples/CS1_1.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ using JLD2

## CS1_1 - Case-study example: Monitoring flight actuator faults
# No measurements of control surface angles are used
println("Case study CS1_1 with Fig8.2 and Fig8.3")
println("Case study CS1_1 with Fig8.2(fig1) and Fig8.3(fig2)")

## Part 1 - Model setup
# load matrices of the aircraft multiple-model SYSACM,
Expand Down Expand Up @@ -132,11 +132,11 @@ display([NormRu NormRd NormRfmRfnom])
# generate figures
y, tout, x = stepresp(Rftilde,10);
include("Fig8_2.jl")
Fig8_2 = f
Fig8_2 = fig1

y = [stepresp(Rtot[i][:,indf],10)[1] for i in 1:N];
include("Fig8_3.jl")
Fig8_3 = f
Fig8_3 = fig2

end # module

Expand Down
2 changes: 1 addition & 1 deletion Examples/CS1_2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ display([NormRu NormRd NormRfmRfnom])
y = [stepresp(Rtot[i][:,indf],2)[1] for i in 1:N];
tout = Vector(0:0.02:2.)
include("Fig8_4.jl")
Fig8_4 = f
Fig8_4 = fig

end # module
using Main.CS1_2
Expand Down
8 changes: 4 additions & 4 deletions Examples/CS2_1.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ using FaultDetectionTools, DescriptorSystems, LinearAlgebra,

## CS2_1 - Case-study example: Monitoring air data sensor faults
# Robust least order LTI synthesis
println("Case study CS2_1 with Fig8.5, Fig8.6 and Fig8.7")
println("Case study CS2_1 with Fig8.5(fig1), Fig8.6(fig2) and Fig8.7(fig3)")

## Part 1 - Model setup
# load matrices of the aircraft multiple-model SYSACSM and
Expand Down Expand Up @@ -81,7 +81,7 @@ end

tout = Vector(0:0.1:10.)
include("Fig8_5.jl")
Fig8_5 = f
Fig8_5 = fig1

## Part 5 - Assesment of synthesis results for nominal synthesis

Expand All @@ -99,7 +99,7 @@ end

tout = Vector(0:0.1:10.)
include("Fig8_6.jl")
Fig8_6 = f
Fig8_6 = fig2


## Part 6 - Assesment of synthesis results for mean value gains
Expand Down Expand Up @@ -196,7 +196,7 @@ display(norms)

tout = Vector(0:0.1:10.)
include("Fig8_7.jl")
Fig8_7 = f
Fig8_7 = fig3

end # module
using Main.CS2_1
Expand Down
2 changes: 1 addition & 1 deletion Examples/CS2_2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ display(Nintp)

tout = Vector(0:0.1:10.)
include("Fig8_8.jl")
Fig8_8 = f
Fig8_8 = fig

end # module
using Main.CS2_2
Expand Down
2 changes: 1 addition & 1 deletion Examples/Ex5_16c.jl
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ yl = y .- yerr; yu = y .+ yerr # lower and upper bounds

# plot step responses
include("Fig5_2.jl")
Fig5_2 = f
Fig5_2 = fig

end
using Main.Ex5_16c
Expand Down
2 changes: 1 addition & 1 deletion Examples/Ex6_1c.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module Ex6_1c
using FaultDetectionTools, DescriptorSystems, LinearAlgebra, Test

# Example 6.1c - Solution of an EMDP
println("Example 6.1c with Fig6.1 and Fig6.2")
println("Example 6.1c with Fig6.1(fig1) and Fig6.2(fig2)")

# Lateral aircraft model without faults
A = [-.4492 0.046 .0053 -.9926;
Expand Down
2 changes: 1 addition & 1 deletion Examples/Ex7_1.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ using DescriptorSystems, Polynomials
Makie.inline!(false)

# Example 7.1 - Illustrating polynomial root sensitivity
println("Example 7.1 with Fig7_1")
println("Example 7.1 with Fig7.1")


Makie.inline!(false)
Expand Down
2 changes: 1 addition & 1 deletion Examples/Ex7_1a.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Makie.inline!(false)


# Example 7.1 - Illustrating high precision polynomial root computation
println("Example 7.1 with alternative Fig7_1a")
println("Example 7.1 with alternative Fig7.1a")


pexact = BigFloat.(Vector(-25.:1.:-1.))
Expand Down
17 changes: 9 additions & 8 deletions Examples/Fig5_2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@
# yl - the lower bounds of step responses
# yu - the upper bounds of step responses
# tout - the time samples
using CairoMakie, LaTeXStrings
using Makie, CairoMakie, LaTeXStrings
Makie.inline!(false)

title_u = [ latexstring("From: \$f_1\$") latexstring("From: \$f_2\$") latexstring("From: \$u_1\$") latexstring("From: \$u_2\$")]
ylabel_r = [ latexstring("To: \$r_1\$") latexstring("To: \$r_2\$") ]

ns, p, m = size(y)
f = Figure(resolution = (800, 600))
fig = Figure(resolution = (800, 600))

axs = [Axis(f[row, col]) for row in 1:p, col in 1:m]
axs = [Axis(fig[row, col]) for row in 1:p, col in 1:m]

for row in 1:p
for col in 1:m
Expand All @@ -31,17 +32,17 @@ for row in 1:p
end
end

Label(f[0, :], text = "Step Responses", fontsize = 20,
Label(fig[0, :], text = "Step Responses", fontsize = 20,
font = "TeX Gyre Heros Bold", valign = :bottom,
padding = (0, 0, -10, 0))
Label(f[end+1, :], text = "Time (seconds)", font = "TeX Gyre Heros Bold",
Label(fig[end+1, :], text = "Time (seconds)", font = "TeX Gyre Heros Bold",
valign = :top,padding = (0, 0, 5, -10))
Label(f[0:end, 0], text = "Residuals", font = "TeX Gyre Heros Bold", rotation = pi/2,
Label(fig[0:end, 0], text = "Residuals", font = "TeX Gyre Heros Bold", rotation = pi/2,
valign = :center, padding = (0, -20, 0, 0))
axs[1,1].yticks = [0,0.5,1,1.5]
axs[2,1].yticks = [0,0.5,1,1.5]

f
fig

# comment out next line to save plot
# save("Fig5_2.pdf", f, resolution = (800, 600))
# save("Fig5_2.pdf", fig, resolution = (800, 600))
10 changes: 5 additions & 5 deletions Examples/Fig8_2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ yticks = [[-20,0,20],[-20,0,20],[-20,0,20],[0,10,20],[0,1,2],[0,1,2]]
yhighs = [20,20,20,20,2,2]
ylows = [-20,-20,-20,-1,-0.1,-0.1]
ns, p, m = size(y)
f = Figure(resolution = (800, 600))
fig1 = Figure(resolution = (800, 600))

axs = [Axis(f[row, col]) for row in 1:p, col in 1:m]
axs = [Axis(fig1[row, col]) for row in 1:p, col in 1:m]

for row in 1:p
for col in 1:m
Expand All @@ -33,10 +33,10 @@ for row in 1:p
end
end

Label(f[end+1, :], text = "Time (seconds)", font = "TeX Gyre Heros Bold",
Label(fig1[end+1, :], text = "Time (seconds)", font = "TeX Gyre Heros Bold",
valign = :top,padding = (0, 0, 5, -10))

f
fig1

# comment out next line to save plot
#save("Fig8_2.pdf", f, resolution = (800, 600))
#save("Fig8_2.pdf", fig1, resolution = (800, 600))
10 changes: 5 additions & 5 deletions Examples/Fig8_3.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ yticks = [[-50,0,50],[-50,0,50],[-50,0,50],[-50,0,50],[-10,0,10],[" 0"," 1",
yhighs = [50,50,50,51,10,2]
ylows = [-50,-51,-51,-50,-10,-0.2]
ns, p, m = size(y[1])
f = Figure(resolution = (800, 600))
fig2 = Figure(resolution = (800, 600))

axs = [Axis(f[row, col]) for row in 1:p, col in 1:m]
axs = [Axis(fig2[row, col]) for row in 1:p, col in 1:m]

for row in 1:p
for col in 1:m
Expand All @@ -37,10 +37,10 @@ for row in 1:p
end
end

Label(f[end+1, :], text = "Time (seconds)", font = "TeX Gyre Heros Bold",
Label(fig2[end+1, :], text = "Time (seconds)", font = "TeX Gyre Heros Bold",
valign = :top,padding = (0, 0, 5, -10))

f
fig2

# comment out next line to save plot
#save("Fig8_3.pdf", f, resolution = (800, 600))
#save("Fig8_3.pdf", fig2, resolution = (800, 600))
10 changes: 5 additions & 5 deletions Examples/Fig8_4.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ N = length(y)
title_u = reshape([ latexstring("From: \$f_$i\$") for i in 1:mf],1,mf)
ylabel_r = reshape([ latexstring("To: \$r_$i\$") for i in 1:mf],1,mf)
ns, pp, mm = size(y[1])
f = Figure(resolution = (800, 600))
fig = Figure(resolution = (800, 600))

axs = [Axis(f[row, col]) for row in 1:pp, col in 1:mm]
axs = [Axis(fig[row, col]) for row in 1:pp, col in 1:mm]

for row in 1:pp
for col in 1:mm
Expand All @@ -34,10 +34,10 @@ for row in 1:pp
end
end

Label(f[end+1, :], text = "Time (seconds)", font = "TeX Gyre Heros Bold",
Label(fig[end+1, :], text = "Time (seconds)", font = "TeX Gyre Heros Bold",
valign = :top,padding = (0, 0, 5, -10))

f
fig

# comment out next line to save plot
# save("Fig8_4.pdf", f, resolution = (800, 600))
# save("Fig8_4.pdf", fig, resolution = (800, 600))
10 changes: 5 additions & 5 deletions Examples/Fig8_5.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ N = length(y)
title_u = [ L"From: $f_1$" L"From: $f_2$" L"From: $u_1$" L"From: $u_2$" L"From: $u_3$" L"From: $d_1$" L"From: $d_2$"]
ylabel_r = [ latexstring("To: \$r_1\$") latexstring("To: \$r_2\$") ]
ns, pp, mm = size(y[1])
f = Figure(resolution = (800, 500))
fig1 = Figure(resolution = (800, 500))

axs = [Axis(f[row, col]) for row in 1:pp, col in 1:mm]
axs = [Axis(fig1[row, col]) for row in 1:pp, col in 1:mm]
inputs = [mu+md .+ (1:mf); 1:mu+md]
for row in 1:pp
for col in 1:mm
Expand All @@ -34,10 +34,10 @@ for row in 1:pp
end
end

Label(f[end+1, :], text = "Time (seconds)", font = "TeX Gyre Heros Bold",
Label(fig1[end+1, :], text = "Time (seconds)", font = "TeX Gyre Heros Bold",
valign = :top,padding = (0, 0, 5, -10))

f
fig1

# comment out next line to save plot
# save("Fig8_5.pdf", f, resolution = (800, 500))
# save("Fig8_5.pdf", fig1, resolution = (800, 500))
10 changes: 5 additions & 5 deletions Examples/Fig8_6.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ yticks = [[" -1", "0", "1", "2"],[-50,0,50,100]]
yhighs = [2,100]
ylows = [-1,-50]
ns, pp, mm = size(y[1])
f = Figure(resolution = (800, 500))
fig2 = Figure(resolution = (800, 500))

axs = [Axis(f[row, col]) for row in 1:pp, col in 1:mm]
axs = [Axis(fig2[row, col]) for row in 1:pp, col in 1:mm]
inputs = [mu+md .+ (1:mf); 1:mu+md]
for row in 1:pp
for col in 1:mm
Expand All @@ -37,10 +37,10 @@ for row in 1:pp
end
end

Label(f[end+1, :], text = "Time (seconds)", font = "TeX Gyre Heros Bold",
Label(fig2[end+1, :], text = "Time (seconds)", font = "TeX Gyre Heros Bold",
valign = :top,padding = (0, 0, 5, -10))

f
fig2

# comment out next line to save plot
# save("Fig8_6.pdf", f, resolution = (800, 500))
# save("Fig8_6.pdf", fig2, resolution = (800, 500))
10 changes: 5 additions & 5 deletions Examples/Fig8_7.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ N = length(y)
title_u = [ L"From: $f_1$" L"From: $f_2$" L"From: $u_1$" L"From: $u_2$" L"From: $u_3$" L"From: $d_1$" L"From: $d_2$"]
ylabel_r = [ latexstring("To: \$r_1\$") latexstring("To: \$r_2\$") ]
ns, pp, mm = size(y[1])
f = Figure(resolution = (800, 500))
fig3 = Figure(resolution = (800, 500))

axs = [Axis(f[row, col]) for row in 1:pp, col in 1:mm]
axs = [Axis(fig3[row, col]) for row in 1:pp, col in 1:mm]
inputs = [mu+md .+ (1:mf); 1:mu+md]
for row in 1:pp
for col in 1:mm
Expand All @@ -34,10 +34,10 @@ for row in 1:pp
end
end

Label(f[end+1, :], text = "Time (seconds)", font = "TeX Gyre Heros Bold",
Label(fig3[end+1, :], text = "Time (seconds)", font = "TeX Gyre Heros Bold",
valign = :top,padding = (0, 0, 5, -10))

f
fig3

# comment out next line to save plot
# save("Fig8_7.pdf", f, resolution = (800, 500))
# save("Fig8_7.pdf", fig3, resolution = (800, 500))
10 changes: 5 additions & 5 deletions Examples/Fig8_8.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ N = length(y)
title_u = [ L"From: $f_1$" L"From: $f_2$" L"From: $u_1$" L"From: $u_2$" L"From: $u_3$" L"From: $d_1$" L"From: $d_2$"]
ylabel_r = [ latexstring("To: \$r_1\$") latexstring("To: \$r_2\$") ]
ns, pp, mm = size(y[1])
f = Figure(resolution = (800, 500))
fig = Figure(resolution = (800, 500))

axs = [Axis(f[row, col]) for row in 1:pp, col in 1:mm]
axs = [Axis(fig[row, col]) for row in 1:pp, col in 1:mm]
inputs = [mu+md .+ (1:mf); 1:mu+md]
for row in 1:pp
for col in 1:mm
Expand All @@ -34,10 +34,10 @@ for row in 1:pp
end
end

Label(f[end+1, :], text = "Time (seconds)", font = "TeX Gyre Heros Bold",
Label(fig[end+1, :], text = "Time (seconds)", font = "TeX Gyre Heros Bold",
valign = :top,padding = (0, 0, 5, -10))

f
fig

# comment out next line to save plot
# save("Fig8_8.pdf", f, resolution = (800, 500))
# save("Fig8_8.pdf", fig, resolution = (800, 500))
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "FaultDetectionTools"
uuid = "fbfc5fa0-0005-11ec-19bb-b3a492551a0b"
authors = ["Andreas Varga <[email protected]>"]
version = "1.1.1"
version = "1.2.0"

[deps]
Combinatorics = "861a8166-3701-5b0c-9a16-15d98fcdc6aa"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ using FaultDetectionTools
cd(joinpath(pkgdir(FaultDetectionTools), "Examples"))
include("CS2_1.jl")
````
_Note:_ For the execution of the test examples and case study examples, the packages **Measurements**, **Makie**, **CairoMakie**, **LaTeXStrings**, **JLD2** and **Optim** are also required and must be additionally installed.
_Note:_ For the execution of the test examples and case study examples, the packages **Measurements**, **GenericLinearAlgebra**, **Makie**, **CairoMakie**, **LaTeXStrings**, **JLD2** and **Optim** are also required and must be additionally installed.

## About

Expand Down
4 changes: 4 additions & 0 deletions ReleaseNotes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Release Notes

## Version 1.2.0

New analysis function `mdgenspec` and changed functionality and improvements in `mdsspec` and `mdspec`.

## Version 1.1.1

Version bump to use Makie 0.19. Bugs fixed in MDObjects.jl.
Expand Down
2 changes: 2 additions & 0 deletions docs/src/MDanalysis.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# Analysis of model detection synthesis models

* **[`mdgenspec`](@ref)** Generation of achievable model detection specifications.
* **[`mddist`](@ref)** Computation of distances between component models.
* **[`mddist2c`](@ref)** Computation of pairwise distances between two sets of component models.

```@docs
mdgenspec
mddist
mddist2c
```
1 change: 1 addition & 0 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ The available functions in the current version of the `FaultDetectionTools.jl` p

**Analysis of model detection synthesis models**

* **[`mdgenspec`](@ref)** Generation of achievable model detection specifications.
* **[`mddist`](@ref)** Computation of distances between component models.
* **[`mddist2c`](@ref)** Computation of pairwise distances between two sets of component models.

Expand Down
2 changes: 1 addition & 1 deletion src/FDIanalysis.jl
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ The keyword argument `sdeg = β` specifies a prescribed stability degree `β` fo
generated candidate filters, such that the real parts of
filters poles must be less than or equal to `β`, in the continuous-time case, and
the magnitudes of filter poles must be less than or
equal to `β`, in the discrete-time case. If `sdeg = missing` then no then no stabilization is performed if and `FDFreq = missing`.
equal to `β`, in the discrete-time case. If `sdeg = missing` then no stabilization is performed if `FDFreq = missing`.
If `sdeg = missing` and `FDFreq = freq`, then the following default values are employed : `β = -0.05`, in continuous-time case, and `β = 0.95`,
in discrete-time case.
Expand Down
Loading

2 comments on commit 923feb0

@andreasvarga
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/74991

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v1.2.0 -m "<description of version>" 923feb05556ea987786facf31814b6f181ebbe90
git push origin v1.2.0

Please sign in to comment.