# balfreq

Method for frequency limited balancing.

The Observability and controllability Gramians over the frequencies kv are solved in factorised form. Balanced modes are then obtained with a square-root method.

Details:

Observability and controllability Gramians are solved in factorised form through explicit integration. The number of integration points determines both the accuracy and the maximum size of the balanced model.

Stability over all (Nb) balanced states is achieved if:

one of the Gramian is integrated through the full Nyquist range

the integration points are enough.

Input:

DictBalFreq: dictionary specifying integration method with keys:

`frequency`

: defines limit frequencies for balancing. The balancedmodel will be accurate in the range

`[0,F]`

, where`F`

is the value of this key. Note that`F`

units must be consistent with the units specified in the`self.ScalingFacts`

dictionary.

`method_low`

:`['gauss','trapz']`

specifies whether to use gauss quadrature or trapezoidal rule in the low-frequency range`[0,F]`

.`options_low`

: options to use for integration in the low-frequencies. These depend on the integration scheme (See below).`method_high`

: method to use for integration in the range [F,F_N], where F_N is the Nyquist frequency. See ‘method_low’.`options_high`

: options to use for integration in the high-frequencies.`check_stability`

: if True, the balanced model is truncated to eliminate unstable modes - if any is found. Note that very accurate balanced model can still be obtained, even if high order modes are unstable. Note that this option is overridden if “”`get_frequency_response`

: if True, the function also returns the frequency response evaluated at the low-frequency range integration points. If True, this option also allows to automatically tune the balanced model.

- Future options:
Ncpu: for parallel run

- The following integration schemes are available:
`trapz`

: performs integration over equally spaced points using trapezoidal rule. It accepts options dictionaries with keys:`points`

: number of integration points to use (including domain boundary)

`gauss`

performs gauss-lobotto quadrature. The domain can be partitioned in Npart sub-domain in which the gauss-lobotto quadrature of order Ord can be applied. A total number of Npart*Ord points is required. It accepts options dictionaries of the form:`partitions`

: number of partitions`order`

: quadrature order.

Examples

The following dictionary

```
>>> DictBalFreq={'frequency': 1.2,
>>> 'method_low': 'trapz',
>>> 'options_low': {'points': 12},
>>> 'method_high': 'gauss',
>>> 'options_high': {'partitions': 2, 'order': 8},
>>> 'check_stability': True }
```

balances the state-space model in the frequency range [0, 1.2] using:

12 equally-spaced points integration of the Gramians in the low-frequency range [0,1.2] and

A 2 Gauss-Lobotto 8-th order quadratures of the controllability Gramian in the high-frequency range.

A total number of 28 integration points will be required, which will result into a balanced model with number of states

```
>>> min{ 2*28* number_inputs, 2*28* number_outputs }
```

The model is finally truncated so as to retain only the first Ns stable modes.