Repository navigation
Compute phase margins independently of the unwrapped phase - #1094
Open
baggepinnen wants to merge 1 commit into
Open
baggepinnen wants to merge 1 commit into
baggepinnen wants to merge 1 commit into
Conversation
|
This is an automated message.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1094 +/- ##
==========================================
+ Coverage 92.29% 92.32% +0.02%
==========================================
Files 42 42
Lines 6177 6174 -3
==========================================
- Hits 5701 5700 -1
+ Misses 476 474 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.












Phase margins depend on the chosen unwrapped Bode phase. For
2.7(s+1)^2/((s-ε)^2*(s+ε)), nonzeroεcan produce a phase margin near 413° and a delay margin near 2.403 s, although the relevant values are approximately 53° and 0.309 s.Compute signed phase margins in
[-180°, 180°)directly from the frequency response at each gain crossover. Return the margin closest to zero whenallMargins=false. Integrator-based phase adjustment applies only to the unwrapped phase returned for plotting, so changing the integrator classification or initial phase branch does not change the margins.Delay margins use the smallest nonnegative additional phase lag divided by frequency over all gain crossovers. This also corrects a stable four-crossover example where selecting the smallest phase margin gives 0.588 s instead of the limiting delay of 0.159 s. The documentation states the assumption of nominal closed-loop stability.
The signed convention preserves negative margins and changes an existing unwrapped result near −320° to its equivalent signed value near +40°.
Fixes ControlSystems.jl#1093.
Validation on Linux with Julia 1.13.1: 573 checks pass across
test_analysis.jl,test_margin_phase.jl, andtest_plots.jl.git diff --checkpasses. The new regression suite has 148 checks; 34 fail against the previous implementation. Tests include transfer-function, zero-pole-gain, and state-space representations, phase adjustment enabled/disabled, negative margins, multiple crossovers, discrete-time delay units, zero-frequency crossovers, and Padé stability checks on either side of the predicted delay limits.Host:
demeter2; Codex session:01a15eb9-1234-7a03-a4be-7f8814d35ca2; working directory:/tmp/controlsystems-phase-margin.