andreasvarga / DescriptorSystems.jl

Manipulation of generalized state-space (descriptor) system representations using Julia
MIT License
24 stars 3 forks source link

Obtaining minimal realization of concatenated coprime factorization #11

Closed baggepinnen closed 2 years ago

baggepinnen commented 2 years ago

Hello! I wonder if it's somehow possible to obtain the concatenated coprime factorization [N M] without going the route of forming the concatenation of N and M which will be non-minimal. The corresponding matlab command lncf appears to output some version of this factorization https://se.mathworks.com/help/robust/ref/lti.lncf.html The ultimate purpose I have in mind is model reduction of unstable models.

andreasvarga commented 2 years ago

N and M share the same A, E and C so the realization of [N M] can be simply built concatenating the B and D matrices.

Fredrik Bagge Carlson @.***> schrieb am So., 20. Feb. 2022, 08:34:

Hello! I wonder if it's somehow possible to obtain the concatenated coprime factorization [N M] without going the route of forming the concatenation of N and M which will be non-minimal. The corresponding matlab command lncf appears to output some version of this factorization https://se.mathworks.com/help/robust/ref/lti.lncf.html The ultimate purpose I have in mind is model reduction of unstable models.

— Reply to this email directly, view it on GitHub https://github.com/andreasvarga/DescriptorSystems.jl/issues/11, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALJDHEABSYQVVDMO3WLIHVTU4CKSFANCNFSM5O4BZHSA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you are subscribed to this thread.Message ID: @.***>

baggepinnen commented 2 years ago

Thanks for getting back to me! That sounds perfect. Then, I may obtain reduced factors Mr, Nr like so:

sys = DescriptorSystems.rss(10,2,3) # start at order 10
n = 5                               # Reduce to order 5
N,M = DescriptorSystems.glcf(sys)
nu = size(N.B, 2)
A,E,B,C,D = DescriptorSystems.dssdata(N)
NM = DescriptorSystems.dss(A,E,[B M.B],C,[D M.D])
sysr, hs = DescriptorSystems.gbalmr(NM; matchdc=residual, ord=n, kwargs...)

A,E,B,C,D = DescriptorSystems.dssdata(sysr)

Nr = DescriptorSystems.dss(A,E,B[:, 1:nu],C,D[:, 1:nu])         # Both of order 5
Mr = DescriptorSystems.dss(A,E,B[:, nu+1:end],C,D[:, nu+1:end])

However, I'm still unclear about how to form the final reduced-order model without doubling the degree when forming

sysr = Mr \ Nr # Back to order 10

is there an equally clever trick to handle this situation?

andreasvarga commented 2 years ago

You can use grsol using the compound system realization.

Fredrik Bagge Carlson @.***> schrieb am Mo., 21. Feb. 2022, 07:33:

Thanks for getting back to me! That sounds perfect. Then, I may obtain reduced factors Mr, Nr like so:

sys = DescriptorSystems.rss(10,2,3) # start at order 10 n = 5 # Reduce to order 5 N,M = DescriptorSystems.glcf(sys) nu = size(N.B, 2) A,E,B,C,D = DescriptorSystems.dssdata(N) NM = DescriptorSystems.dss(A,E,[B M.B],C,[D M.D]) sysr, hs = DescriptorSystems.gbalmr(NM; matchdc=residual, ord=n, kwargs...)

A,E,B,C,D = DescriptorSystems.dssdata(sysr)

Nr = DescriptorSystems.dss(A,E,B[:, 1:nu],C,D[:, 1:nu]) # Both of order 5 Mr = DescriptorSystems.dss(A,E,B[:, nu+1:end],C,D[:, nu+1:end])

However, I'm still unclear about how to form the final reduced-order model without doubling the degree when forming

sysr = Mr \ Nr # Back to order 10

is there an equally clever trick to handle this situation?

— Reply to this email directly, view it on GitHub https://github.com/andreasvarga/DescriptorSystems.jl/issues/11#issuecomment-1046519134, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALJDHEGYVYPBBCDFAGPUCV3U4HMBXANCNFSM5O4BZHSA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>

andreasvarga commented 2 years ago

A better way is to use an explicit realization of inv(Mr)*Nr taking into acount that Nr an Mr share the same A,E, and C.

Fredrik Bagge Carlson @.***> schrieb am Mo., 21. Feb. 2022, 07:33:

Thanks for getting back to me! That sounds perfect. Then, I may obtain reduced factors Mr, Nr like so:

sys = DescriptorSystems.rss(10,2,3) # start at order 10 n = 5 # Reduce to order 5 N,M = DescriptorSystems.glcf(sys) nu = size(N.B, 2) A,E,B,C,D = DescriptorSystems.dssdata(N) NM = DescriptorSystems.dss(A,E,[B M.B],C,[D M.D]) sysr, hs = DescriptorSystems.gbalmr(NM; matchdc=residual, ord=n, kwargs...)

A,E,B,C,D = DescriptorSystems.dssdata(sysr)

Nr = DescriptorSystems.dss(A,E,B[:, 1:nu],C,D[:, 1:nu]) # Both of order 5 Mr = DescriptorSystems.dss(A,E,B[:, nu+1:end],C,D[:, nu+1:end])

However, I'm still unclear about how to form the final reduced-order model without doubling the degree when forming

sysr = Mr \ Nr # Back to order 10

is there an equally clever trick to handle this situation?

— Reply to this email directly, view it on GitHub https://github.com/andreasvarga/DescriptorSystems.jl/issues/11#issuecomment-1046519134, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALJDHEGYVYPBBCDFAGPUCV3U4HMBXANCNFSM5O4BZHSA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>

andreasvarga commented 2 years ago

I am copying out the formulas from the SLICOT subroutine SB08GD

C     PURPOSE
C
C     To construct the state-space representation for the system
C     G = (A,B,C,D) from the factors Q = (AQR,BQ,CQR,DQ) and
C     R = (AQR,BR,CQR,DR) of its left coprime factorization
C                   -1
C              G = R  * Q,
C
C     where G, Q and R are the corresponding transfer-function matrices.

C     METHOD
C
C     The subroutine computes the matrices of the state-space
C     representation G = (A,B,C,D) by using the formulas:
C
C                      -1              -1
C     A = AQR - BR * DR  * CQR,  C = DR  * CQR,
C                      -1              -1
C     B = BQ  - BR * DR  * DQ,   D = DR  * DQ.
C
C     REFERENCES
C
C     [1] Varga A.
C         Coprime factors model reduction method based on
C         square-root balancing-free techniques.
C         System Analysis, Modelling and Simulation,
C         vol. 11, pp. 303-311, 1993.

The coprime factorization based reduction method is implemented in AB09FD.

Just a remark: you can further exploit the fact that the resulting coprime factorization has the matrices A and E in generalized Schur form (so this expensive step in gbalmr is not any more necessary).

baggepinnen commented 2 years ago

Many thanks for your inputs! I'll see what I can do with this :)

andreasvarga commented 2 years ago

Here are inversion-free formulas for the realization.