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 and mo are equal and maximal for a balanced model.
  • The Markov parameters are to be given in the time-sampled format: dt*[0, 1, P, P+1, 2P, 2P+1, ... ]
  • The special case where P=2 results in dt*[0, 1, 2, 3, ... ], see make_sampled_format().
  • The functions util.load_signals() and util.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 C A^i B.

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 and mo are equal and maximal for a balanced model.

Tip: For discrete time systems the impulse is applied over a time interval dt and so has a time-integral 1*dt rather than 1. This means the reduced B array is “off” by a factor of dt. You can account for this by multiplying B by dt.

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.

put_sing_vals(sing_vals_dest)[source]

Puts the singular values to sing_vals_dest.

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 C A^i B.

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 [CB, CAB, CA^PB, CA^(P+1)B, ...]
  • The functions util.load_signals() and util.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 C A^i B.

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 dt*[0 1 2 3 ...] and duplicates entries so that the result is sampled at dt*[0 1 1 2 2 3 ...]. When the second format is used in the eigensystem realization algorithm (ERA), the resulting model has a time step of dt rather than 2*dt.