From a62b58139d17f3dece12a252b0bad0586757106e Mon Sep 17 00:00:00 2001 From: Fredrik Bagge Carlson Date: Wed, 16 Mar 2022 10:08:41 +0100 Subject: [PATCH] add delay margin and frequency to diskmargin printout --- docs/src/uncertainty.md | 9 --------- src/diskmargin.jl | 9 ++++++++- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/docs/src/uncertainty.md b/docs/src/uncertainty.md index a767c706..7eccf02d 100644 --- a/docs/src/uncertainty.md +++ b/docs/src/uncertainty.md @@ -175,20 +175,14 @@ In robust control, we often find ourselves having to consider the feedback inter │ │ y┌───┤ │◄───┐u │ └─────────┘ │ - │ │ │ ┌───┐ │ - │ │ │ │ └─────►│ K ├───────┘ - │ │ └───┘ ``` ``` ┌───┐ - │ │ ┌─────►│ Δ ├───────┐ - │ │ │ │ │ └───┘ │ - │ │ │ ┌─────────┐ │ zΔ└───┤ │◄───┘wΔ │ │ @@ -196,11 +190,8 @@ In robust control, we often find ourselves having to consider the feedback inter │ │ y┌───┤ │◄───┐u │ └─────────┘ │ - │ │ │ ┌───┐ │ - │ │ │ │ └─────►│ K ├───────┘ - │ │ └───┘ ``` diff --git a/src/diskmargin.jl b/src/diskmargin.jl index 8e09fb7d..a55336ae 100644 --- a/src/diskmargin.jl +++ b/src/diskmargin.jl @@ -57,13 +57,20 @@ Base.propertynames(dm::Diskmargin) = (fieldnames(typeof(dm))..., :margin, :gainm function Base.show(io::IO, dm::Diskmargin) println(io, "Disk margin with:") println(io, "Margin: ", dm.α) - println(io, "Frequency: ", dm.ω0) + println(io, "Frequency: ", dm.ω0, " rad/s, ", dm.ω0/(2π), " Hz") if dm.γmax < dm.γmin # In this case, we have an "inverted circle" println(io, "Gain margins: [$(dm.γmin), Inf]") else println(io, "Gain margins: [$(dm.γmin), $(dm.γmax)]") end println(io, "Phase margin: ", dm.ϕm) + delaymarg = π/180 * dm.ϕm / dm.ω0 + print(io, "Delay margin: ", delaymarg, " s") + if isdiscrete(dm.L) + println(io, ", ", floor(Int, delaymarg / dm.L.Ts), " samples") + else + println(io) + end println(io, "Skew: ", dm.σ) println(io, "Worst-case perturbation: ", dm.f0) end