Model reduction

Model reduction using balanced truncation is available through the functions

Reduction of very large models

Balanced truncation requires the solution to a Lyapunov equation which may be prohibitively expensive for large systems. For systems of order above about 500, a method based on frequency-domain fitting may be substantially faster if the desired model order is less than about 100. The following example illustrates the procedure.

using JuliaSimControls, ControlSystemIdentification
ny,nu,nx = 5,5,1000                     # number of outputs, inputs and states
Ts = 1                                  # Sample time
G = ssrand(ny,nu,nx; Ts, proper=true);  # Generate a random system

N = 200                                 # Number of frequency points
w = range(0, stop=pi/Ts-1/N, length=N)  # Frequency vector

frd = FRD(w, G);                        # Build a frequency-response data object
nxr = 60                                # Reduced model order
@time Gh, x0 = subspaceid(frd, G.Ts, nxr; r=nxr+1, zeroD=true); # Fit frequency response

sigmaplot([G, Gh], w[2:end], lab=["Full order" "Reduced order"])

The frequency-fitting method does not have support for exact DC matching like the balanced-truncation method does, but there exists an option for frequency-based weighting which can achieve similar results. See subspaceid for additional details.