Fix MIMO Ai-disturbance, resonant disturbance shape and docs#141
Merged
Conversation
- add_low_frequency_disturbance(sys, Ai::Integer): Ad is now 1x1 (was nu x nu, which silently broke for any MIMO plant). Docstring expanded to cover ϵ and discrete/continuous pole placement. - add_resonant_disturbance(sys, ω, ζ, Bd): validate Bd row/column counts with informative errors; accept a 2-column Bd so both resonant states can inject into the plant. Document the shape constraints. - add_resonant_disturbance docstring: ω is the damped frequency, ζ the decay rate; eigenvalues at -ζ ± iω. Replaced the incorrect polynomial s² + 2ζωs + ω² with s² + 2ζs + (ζ² + ω²). - add_resonant_disturbance: promote Ad and Cd to eltype(sys.A) for non-Float64 element types. - add_input_integrator: rename Ad/Bd/Cd locals to A_int/B_int_row/ C_int_row to avoid clashing with the disturbance-augmentation naming used elsewhere in the file. - test_augmentation: add a MIMO integer-Ai regression test, a two-column Bd test, Bd-shape-validation tests, and wrap a silent equality check in @test.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #141 +/- ##
==========================================
+ Coverage 91.45% 91.81% +0.35%
==========================================
Files 20 20
Lines 3056 3065 +9
==========================================
+ Hits 2795 2814 +19
+ Misses 261 251 -10
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Summary
Review-driven cleanup of
src/model_augmentation.jl.add_low_frequency_disturbance(sys, Ai::Integer):Adis now1×1. The previousAd = -ϵ*I(nu)only worked for SISO plants; fornu > 1the augmentedA = [A Cd; 0 Ad]had mismatched column counts.add_resonant_disturbance(sys, ω, ζ, Bd): validateBdshape with informative errors and accept a 2-columnBdso both resonant states can inject into the plant. The non-measurement branch previously assumedBdhad exactly one column and silently constructed an ill-shapedCdotherwise.add_resonant_disturbancedocs: corrected the polynomial / parameter meaning. The implementedAd = [-ζ -ω; ω -ζ]has eigenvalues-ζ ± iωand characteristic polynomials² + 2ζs + (ζ² + ω²), not the previously documenteds² + 2ζωs + ω².ζis now described as the decay rate andωas the damped frequency.Ad/Cdinadd_resonant_disturbancenow useeltype(sys.A)for consistency with the other augmentation routines.add_input_integrator: renamed localAd/Bd/CdtoA_int/B_int_row/C_int_rowto disambiguate from the disturbance-augmentation naming used elsewhere in the file.Test plan
julia --project -e 'using LinearAlgebra, RobustAndOptimalControl, Test; include("test/test_augmentation.jl")'— passes, including the new MIMOAi-integer regression, the new two-columnBdtest, and the newBd-shape validation tests.julia --project -e 'using Plots, LinearAlgebra, RobustAndOptimalControl, Test; include("test/test_lqg.jl")'— passes (add_input_differentiator/add_output_integratorcallers).Pkg.test()in CI.🤖 Generated with Claude Code