Skip to content

Change function names in modelsimp, add aliases #1028

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions control/modelsimp.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,17 @@
from .statesp import StateSpace
from .statefbk import gram

__all__ = ['hsvd', 'balred', 'modred', 'era', 'markov', 'minreal']
__all__ = ['hankel_singular_values', 'balanced_reduction', 'model_reduction',
'minimal_realization', 'eigensys_realization', 'markov', 'hsvd',
'balred', 'modred', 'minreal', 'era']


# Hankel Singular Value Decomposition
#
# The following returns the Hankel singular values, which are singular values
# of the matrix formed by multiplying the controllability and observability
# Gramians
def hsvd(sys):
def hankel_singular_values(sys):
"""Calculate the Hankel singular values.

Parameters
Expand Down Expand Up @@ -106,7 +108,7 @@ def hsvd(sys):
return hsv[::-1]


def modred(sys, ELIM, method='matchdc'):
def model_reduction(sys, ELIM, method='matchdc'):
"""
Model reduction of `sys` by eliminating the states in `ELIM` using a given
method.
Expand Down Expand Up @@ -216,7 +218,7 @@ def modred(sys, ELIM, method='matchdc'):
return rsys


def balred(sys, orders, method='truncate', alpha=None):
def balanced_reduction(sys, orders, method='truncate', alpha=None):
"""Balanced reduced order model of sys of a given order.
States are eliminated based on Hankel singular value.
If sys has unstable modes, they are removed, the
Expand Down Expand Up @@ -340,7 +342,7 @@ def balred(sys, orders, method='truncate', alpha=None):
return rsys


def minreal(sys, tol=None, verbose=True):
def minimal_realization(sys, tol=None, verbose=True):
'''
Eliminates uncontrollable or unobservable states in state-space
models or cancelling pole-zero pairs in transfer functions. The
Expand Down Expand Up @@ -368,7 +370,7 @@ def minreal(sys, tol=None, verbose=True):
return sysr


def era(YY, m, n, nin, nout, r):
def eigensys_realization(YY, m, n, nin, nout, r):
"""Calculate an ERA model of order `r` based on the impulse-response data
`YY`.

Expand Down Expand Up @@ -556,3 +558,10 @@ def markov(Y, U, m=None, transpose=False):

# Return the first m Markov parameters
return H if transpose else np.transpose(H)

# Function aliases
hsvd = hankel_singular_values
balred = balanced_reduction
modred = model_reduction
minreal = minimal_realization
era = eigensys_realization
10 changes: 5 additions & 5 deletions doc/control.rst
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,11 @@ Model simplification tools
.. autosummary::
:toctree: generated/

minreal
balred
hsvd
modred
era
minimal_realization
balanced_reduction
hankel_singular_values
model_reduction
eigensys_realization
markov

Nonlinear system support
Expand Down
Loading