Skip to content

Fix MIMO Ai-disturbance, resonant disturbance shape and docs#141

Merged
baggepinnen merged 1 commit into
masterfrom
model-augmentation-fixes
May 15, 2026
Merged

Fix MIMO Ai-disturbance, resonant disturbance shape and docs#141
baggepinnen merged 1 commit into
masterfrom
model-augmentation-fixes

Conversation

@baggepinnen
Copy link
Copy Markdown
Member

Summary

Review-driven cleanup of src/model_augmentation.jl.

  • add_low_frequency_disturbance(sys, Ai::Integer): Ad is now 1×1. The previous Ad = -ϵ*I(nu) only worked for SISO plants; for nu > 1 the augmented A = [A Cd; 0 Ad] had mismatched column counts.
  • add_resonant_disturbance(sys, ω, ζ, Bd): validate Bd shape with informative errors and accept a 2-column Bd so both resonant states can inject into the plant. The non-measurement branch previously assumed Bd had exactly one column and silently constructed an ill-shaped Cd otherwise.
  • add_resonant_disturbance docs: corrected the polynomial / parameter meaning. The implemented Ad = [-ζ -ω; ω -ζ] has eigenvalues -ζ ± iω and characteristic polynomial s² + 2ζs + (ζ² + ω²), not the previously documented s² + 2ζωs + ω². ζ is now described as the decay rate and ω as the damped frequency.
  • Element types: Ad/Cd in add_resonant_disturbance now use eltype(sys.A) for consistency with the other augmentation routines.
  • add_input_integrator: renamed local Ad/Bd/Cd to A_int/B_int_row/C_int_row to 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 MIMO Ai-integer regression, the new two-column Bd test, and the new Bd-shape validation tests.
  • julia --project -e 'using Plots, LinearAlgebra, RobustAndOptimalControl, Test; include("test/test_lqg.jl")' — passes (add_input_differentiator / add_output_integrator callers).
  • Full Pkg.test() in CI.

🤖 Generated with Claude Code

- 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-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.81%. Comparing base (e199e36) to head (72a5e5a).

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     
Flag Coverage Δ
unittests 91.81% <100.00%> (+0.35%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@baggepinnen baggepinnen merged commit c7bdec7 into master May 15, 2026
2 checks passed
@baggepinnen baggepinnen deleted the model-augmentation-fixes branch May 15, 2026 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants