Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update prescale function #465

Closed
wants to merge 11 commits into from
Closed

Update prescale function #465

wants to merge 11 commits into from

Conversation

tfoliva
Copy link
Contributor

@tfoliva tfoliva commented Apr 4, 2021

Prescale function now actually balances the system matrices A, B and C instead of performing a similarity transformation into diagonal form.

C = sys.C*S
normalized_sys = iscontinuous(sys) ? ss(A, B, C, sys.D) : ss(A, B, C, sys.D, sys.Ts)
return normalized_sys, S
function prescale(sys::StateSpace) where ST <: AbstractStateSpace
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Suggested change
function prescale(sys::StateSpace) where ST <: AbstractStateSpace
function prescale(sys::ST) where ST <: AbstractStateSpace

@codecov
Copy link

codecov bot commented Apr 4, 2021

Codecov Report

Merging #465 (69f58c3) into master (25df9fe) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #465      +/-   ##
==========================================
+ Coverage   85.20%   85.21%   +0.01%     
==========================================
  Files          31       31              
  Lines        3102     3105       +3     
==========================================
+ Hits         2643     2646       +3     
  Misses        459      459              
Impacted Files Coverage Δ
src/matrix_comps.jl 88.07% <100.00%> (+0.13%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 25df9fe...69f58c3. Read the comment docs.

S, P, B = balance(metasys)

# reconstruct A, B and C by taking slices of the balanced metasystem
bal_metasys = P\B*P # undo permutation
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it be possible to use perm=false to avoid having to undo the permutation?

such that their column and row norms are closer.
This results in a system with overall better numerical conditioning.

Returns a new scaled state-space object.
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you have any reference to where this method is discussed?

Comment on lines +603 to +604
# create an augmented system to balance the whole system at once
metasys = [sys.A sys.B; sys.C zeros(p, m)]
Copy link
Contributor

Choose a reason for hiding this comment

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

You are using two terms here, both augmented and meta system. I seem to remember that it is instead typically called a packed representation? I think that is the term used in the Essentials of Robust Control by Zhou & Doyle,

I think it should be okay to just call the packed system representation M as you do in the tests.

Comment on lines +73 to +79
nsys = prescale(sys)
@test pole(nsys) ≈ pole(sys)
n, m = size(sys.B)
p = size(sys.C, 1)
M = [nsys.A nsys.B; nsys.C zeros(p, m)]
M2 = [sys.A sys.B; sys.C zeros(p, m)]
@test cond(M) <= cond(M2)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it would be reasonable with quite a few more tests. For example to see that the system dynamics isn't changed by the prescaling. E.g. by comparing the frequency response of a MIMO systems before and after.

@baggepinnen baggepinnen mentioned this pull request Jan 26, 2022
@baggepinnen
Copy link
Member

#614

@baggepinnen baggepinnen mentioned this pull request Jan 28, 2022
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.

3 participants