ERA¶
Functions and classes fo rERA models. See paper by Ma et al. 2011, TCFD.
-
class
modred.era.
ERA
(put_array=<function save_array_text>, mc=None, mo=None, verbosity=1)[source]¶ Eigensystem realization algorithm (ERA), implemented for discrete-time systems.
- Kwargs:
put_array
: Function to put an array out of modred, e.g., write it to file.mc
: Number of Markov parameters for controllable dimension of Hankel array.mo
: Number of Markov parameters for observable dimension of Hankel array.verbosity
: 1 prints progress and warnings, 0 prints almost nothing.
Computes reduced-order model (ROM) of a discrete-time system, using output data from an impulse response.
Simple usage:
# Obtain array "Markovs" with dims [time, output, input] myERA = ERA() A, B, C = myERA.compute_model(Markovs, 50) sing_vals = myERA.sing_vals
Another example:
# Obtain Markov parameters myERA = ERA() myERA.compute_model(Markovs, 50) myERA.put_model('A.txt', 'B.txt', 'C.txt')
Notes:
- Default values of
mc
andmo
are equal and maximal for a balanced model. - The Markov parameters are to be given in the time-sampled format:
- The special case where results in
, see
make_sampled_format()
. - The functions
util.load_signals()
andutil.load_multiple_signals()
are often useful. - See convenience function
compute_ERA_model()
.
-
compute_model
(Markovs, num_states, mc=None, mo=None)[source]¶ Computes the A, B, and C arrays of the linear time-invariant (LTI) reduced-order model (ROM).
- Args:
Markovs
: Array of Markov parameters with indices [time, output, input].Markovs[i]
is the Markov parameter .num_states
: Number of states in reduced-order model.- Kwargs:
mc
: Number of Markov parameters for controllable dimension of Hankel array.mo
: Number of Markov parameters for observable dimension of Hankel array.
Assembles the Hankel arrays from self.Markovs and computes a singular value decomposition. Uses the results to form the A, B, and C arrays.
Note that the default values of
mc
andmo
are equal and maximal for a balanced model.Tip: For discrete time systems the impulse is applied over a time interval and so has a time-integral rather than . This means the reduced B array is “off” by a factor of . You can account for this by multiplying B by .
-
put_decomp
(sing_vals_dest, L_sing_vecs_dest, R_sing_vecs_dest, Hankel_array_dest, Hankel_array2_dest)[source]¶ Puts the decomposition arrays and Hankel arrays in destinations (file or memory).
- Args:
sing_vals_dest
: Destination in which to put Hankel singular values.L_sing_vecs_dest
: Destination in which to put left singular vectors of Hankel array.R_sing_vecs_dest
: Destination in which to put right singular vectors of Hankel array.Hankel_array_dest
: Destination in which to put Hankel array.Hankel_array2_dest
: Destination in which to put second Hankel array.
-
put_model
(A_dest, B_dest, C_dest)[source]¶ Puts the A, B, and C arrays of the linear time-invariant (LTI) reduced-order model (ROM) in destinations (file or memory).
- Args:
A_dest
: Destination in which to put A array of reduced-order model.B_dest
: Destination in which to put B array of reduced-order model.C_dest
: Destination in which to put C array of reduced-order model.
-
modred.era.
compute_ERA_model
(Markovs, num_states)[source]¶ Convenience function to compute linear time-invariant (LTI) reduced-order model (ROM) arrays A, B, and C using the eigensystem realization algorithm (ERA) with default settings.
- Args:
Markovs
: Array of Markov parameters with indices [time, output, input].Markovs[i]
is the Markov parameter .num_states
: Number of states in reduced-order model.- Returns:
A
: A array of reduced-order model.B
: B array of reduced-order model.C
: C array of reduced-order model.
Usage:
# Obtain ``Markovs`` array w/indicies [time, output, input] num_states = 20 A, B, C = compute_ERA_model(Markovs, num_states)
Notes:
- Markov parameters are defined as
- The functions
util.load_signals()
andutil.load_multiple_signals()
are often useful.
-
modred.era.
make_sampled_format
(times, Markovs, dt_tol=1e-06)[source]¶ Converts samples at [0 1 2 …] into samples at [0 1 1 2 2 3 …].
- Args:
times
: Array of time values or time step indices.Markovs
: Array of Markov parameters with indices [time, output, input].Markovs[i]
is the Markov parameter .- Kwargs:
dt_tol
: Allowable deviation from uniform time steps.- Returns:
time_steps
: Array of time step indices, [0 1 1 2 2 3 …].Markovs
: Output array at the time step indices.dt
: Time interval between each time step.
Takes a series of data at times and duplicates entries so that the result is sampled at . When the second format is used in the eigensystem realization algorithm (ERA), the resulting model has a time step of rather than .