Thanks to visit codestin.com
Credit goes to github.com

Skip to content

I/O system enhancements #1082

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 16 commits into from
Jan 4, 2025
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
8 changes: 4 additions & 4 deletions control/bdalg.py
Original file line number Diff line number Diff line change
Expand Up @@ -600,8 +600,8 @@ def combine_tf(tf_array):
f"row {row_index}."
)
for j_in in range(col.ninputs):
num_row.append(col.num[j_out][j_in])
den_row.append(col.den[j_out][j_in])
num_row.append(col.num_array[j_out, j_in])
den_row.append(col.den_array[j_out, j_in])
num.append(num_row)
den.append(den_row)
for row_index, row in enumerate(num):
Expand Down Expand Up @@ -657,8 +657,8 @@ def split_tf(transfer_function):
for i_in in range(transfer_function.ninputs):
row.append(
tf.TransferFunction(
transfer_function.num[i_out][i_in],
transfer_function.den[i_out][i_in],
transfer_function.num_array[i_out, i_in],
transfer_function.den_array[i_out, i_in],
dt=transfer_function.dt,
)
)
Expand Down
76 changes: 33 additions & 43 deletions control/flatsys/flatsys.py
Original file line number Diff line number Diff line change
@@ -1,42 +1,5 @@
# flatsys.py - trajectory generation for differentially flat systems
# RMM, 10 Nov 2012
#
# This file contains routines for computing trajectories for differentially
# flat nonlinear systems. It is (very) loosely based on the NTG software
# package developed by Mark Milam and Kudah Mushambi, but rewritten from
# scratch in python.
#
# Copyright (c) 2012 by California Institute of Technology
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# 3. Neither the name of the California Institute of Technology nor
# the names of its contributors may be used to endorse or promote
# products derived from this software without specific prior
# written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CALTECH
# OR THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.

import itertools
import numpy as np
Expand All @@ -54,8 +17,30 @@ class FlatSystem(NonlinearIOSystem):
"""Base class for representing a differentially flat system.

The FlatSystem class is used as a base class to describe differentially
flat systems for trajectory generation. The output of the system does not
need to be the differentially flat output.
flat systems for trajectory generation. The output of the system does
not need to be the differentially flat output. Flat systems are
usually created with the :func:`~control.flatsys.flatsys` factory
function.

Parameters
----------
forward : callable
A function to compute the flat flag given the states and input.
reverse : callable
A function to compute the states and input given the flat flag.
dt : None, True or float, optional
System timebase.

Attributes
----------
ninputs, noutputs, nstates : int
Number of input, output and state variables.
shape : tuple
2-tuple of I/O system dimension, (noutputs, ninputs).
input_labels, output_labels, state_labels : list of str
Names for the input, output, and state variables.
name : string, optional
System name.

Notes
-----
Expand Down Expand Up @@ -234,10 +219,9 @@ def flatsys(*args, updfcn=None, outfcn=None, **kwargs):
Description of the system states. Same format as `inputs`.

dt : None, True or float, optional
System timebase. None (default) indicates continuous
time, True indicates discrete time with undefined sampling
time, positive number is discrete time with specified
sampling time.
System timebase. None (default) indicates continuous time, True
indicates discrete time with undefined sampling time, positive
number is discrete time with specified sampling time.

params : dict, optional
Parameter values for the systems. Passed to the evaluation
Expand All @@ -252,6 +236,12 @@ def flatsys(*args, updfcn=None, outfcn=None, **kwargs):
sys: :class:`FlatSystem`
Flat system.

Other Parameters
----------------
input_prefix, output_prefix, state_prefix : string, optional
Set the prefix for input, output, and state signals. Defaults =
'u', 'y', 'x'.

"""
from .linflat import LinearFlatSystem
from ..statesp import StateSpace
Expand Down
Loading
Loading