Skip to content

Commit 3c0948a

Browse files
committed
forward balreal and balance_statespace on ess
1 parent 6d64fde commit 3c0948a

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

src/ExtendedStateSpace.jl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,18 @@ macro sizecompat(a,b)
370370
end
371371
end
372372

373+
function ControlSystems.balance_statespace(G::ExtendedStateSpace, perm::Bool=false)
374+
Gs = ss(G)
375+
Gs, T = ControlSystems.balance_statespace(Gs, perm)
376+
partition(Gs, G.nw, G.nz), T
377+
end
378+
379+
function ControlSystems.balreal(G::ExtendedStateSpace, args...; kwargs...)
380+
Gs = ss(G)
381+
Gs, S, T = ControlSystems.balreal(Gs, args...; kwargs...)
382+
partition(Gs, G.nw, G.nz), S, T
383+
end
384+
373385
# This version is not correct for the intended usage
374386
# function ControlSystems.feedback(s1::ExtendedStateSpace, s2::ExtendedStateSpace;
375387
# Wperm=:, Zperm=:)

test/test_extendedstatespace.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,10 @@ connections = [K.y .=> G.u; G.y .=> G.y; K.u .=> K.u]
5454
Gcl2 = connect([G, K, S], connections; z1, w1)
5555

5656
@test linfnorm(minreal(Gcl1 - Gcl2.sys))[1] < 1e-10
57+
58+
59+
##
60+
G = ssrand(3,4,5)
61+
Ge = partition(G, 1, 1)
62+
@test ss(balance_statespace(Ge)[1]) == balance_statespace(G)[1]
63+
@test ss(balreal(Ge)[1]) == balreal(G)[1]

0 commit comments

Comments
 (0)