@@ -375,18 +375,30 @@ macro sizecompat(a,b)
375375 end
376376end
377377
378- function ControlSystems. balance_statespace (G:: ExtendedStateSpace , perm:: Bool = false )
379- Gs = ss (G)
380- Gs, T = ControlSystems. balance_statespace (Gs, perm)
381- partition (Gs, G. nw, G. nz), T
382- end
383378
384- function ControlSystems. balreal (G:: ExtendedStateSpace , args... ; kwargs... )
385- Gs = ss (G)
386- Gs, S, T = ControlSystems. balreal (Gs, args... ; kwargs... )
387- partition (Gs, G. nw, G. nz), S, T
379+ function esswrap (f, sys, args... ; kwargs... )
380+ Gs = ss (sys)
381+ ret = f (Gs, args... ; kwargs... )
382+ if ret isa AbstractStateSpace
383+ Gs = ret
384+ return partition (Gs, sys. nw, sys. nz)
385+ else
386+ Gs = first (ret)
387+ return (partition (Gs, sys. nw, sys. nz), Base. tail (ret)... )
388+ end
388389end
389390
391+ ControlSystems. balance_statespace (G:: ExtendedStateSpace , args... ; kwargs... ) = esswrap (balance_statespace, G, args... ; kwargs... )
392+
393+ ControlSystems. similarity_transform (G:: ExtendedStateSpace , args... ; kwargs... ) = esswrap (similarity_transform, G, args... ; kwargs... )
394+
395+ ControlSystems. balreal (G:: ExtendedStateSpace , args... ; kwargs... ) = esswrap (balreal, G, args... ; kwargs... )
396+ modal_form (G:: ExtendedStateSpace , args... ; kwargs... ) = esswrap (modal_form, G, args... ; kwargs... )
397+ schur_form (G:: ExtendedStateSpace , args... ; kwargs... ) = esswrap (schur_form, G, args... ; kwargs... )
398+ hess_form (G:: ExtendedStateSpace , args... ; kwargs... ) = esswrap (hess_form, G, args... ; kwargs... )
399+
400+
401+
390402# This version is not correct for the intended usage
391403# function ControlSystems.feedback(s1::ExtendedStateSpace, s2::ExtendedStateSpace;
392404# Wperm=:, Zperm=:)
0 commit comments