control.iosys.InterconnectedSystem

class control.iosys.InterconnectedSystem(syslist, connections=[], inplist=[], outlist=[], inputs=None, outputs=None, states=None, params={}, dt=None, name=None)

Interconnection of a set of input/output systems.

This class is used to implement a system that is an interconnection of input/output systems. The sys consists of a collection of subsystems whose inputs and outputs are connected via a connection map. The overall system inputs and outputs are subsets of the subsystem inputs and outputs.

__init__(syslist, connections=[], inplist=[], outlist=[], inputs=None, outputs=None, states=None, params={}, dt=None, name=None)

Create an I/O system from a list of systems + connection info.

The InterconnectedSystem class is used to represent an input/output system that consists of an interconnection between a set of subystems. The outputs of each subsystem can be summed together to to provide inputs to other subsystems. The overall system inputs and outputs can be any subset of subsystem inputs and outputs.

Parameters:
  • syslist (array_like of InputOutputSystems) – The list of input/output systems to be connected
  • connections (tuple of connection specifications, optional) –

    Description of the internal connections between the subsystems. Each element of the tuple describes an input to one of the subsystems. The entries are are of the form:

    (input-spec, output-spec1, output-spec2, …)

    The input-spec should be a tuple of the form (subsys_i, inp_j) where subsys_i is the index into syslist and inp_j is the index into the input vector for the subsystem. If subsys_i has a single input, then the subsystem index subsys_i can be listed as the input-spec. If systems and signals are given names, then the form ‘sys.sig’ or (‘sys’, ‘sig’) are also recognized.

    Each output-spec should be a tuple of the form (subsys_i, out_j, gain). The input will be constructed by summing the listed outputs after multiplying by the gain term. If the gain term is omitted, it is assumed to be 1. If the system has a single output, then the subsystem index subsys_i can be listed as the input-spec. If systems and signals are given names, then the form ‘sys.sig’, (‘sys’, ‘sig’) or (‘sys’, ‘sig’, gain) are also recognized, and the special form ‘-sys.sig’ can be used to specify a signal with gain -1.

    If omitted, the connection map (matrix) can be specified using the set_connect_map() method.

  • inplist (tuple of input specifications, optional) –

    List of specifications for how the inputs for the overall system are mapped to the subsystem inputs. The input specification is the same as the form defined in the connection specification. Each system input is added to the input for the listed subsystem.

    If omitted, the input map can be specified using the set_input_map method.

  • outlist (tuple of output specifications, optional) –

    List of specifications for how the outputs for the subsystems are mapped to overall system outputs. The output specification is the same as the form defined in the connection specification (including the optional gain term). Numbered outputs must be chosen from the list of subsystem outputs, but named outputs can also be contained in the list of subsystem inputs.

    If omitted, the output map can be specified using the set_output_map method.

  • params (dict, optional) – Parameter values for the systems. Passed to the evaluation functions for the system as default values, overriding internal defaults.
  • dt (timebase, optional) –

    The timebase for the system, used to specify whether the system is operating in continuous or discrete time. It can have the following values:

    • dt = None No timebase specified
    • dt = 0 Continuous time system
    • dt > 0 Discrete time system with sampling time dt
    • dt = True Discrete time with unspecified sampling time
  • name (string, optional) – System name (used for specifying signals).

Methods

__init__(syslist[, connections, inplist, …]) Create an I/O system from a list of systems + connection info.
copy() Make a copy of an input/output system.
feedback([other, sign, params]) Feedback interconnection between two input/output systems
find_input(name) Find the index for an input given its name (None if not found)
find_output(name) Find the index for an output given its name (None if not found)
find_state(name) Find the index for a state given its name (None if not found)
linearize(x0, u0[, t, params, eps]) Linearize an input/output system at a given state and input.
set_connect_map(connect_map) Set the connection map for an interconnected I/O system.
set_input_map(input_map) Set the input map for an interconnected I/O system.
set_inputs(inputs[, prefix]) Set the number/names of the system inputs.
set_output_map(output_map) Set the output map for an interconnected I/O system.
set_outputs(outputs[, prefix]) Set the number/names of the system outputs.
set_states(states[, prefix]) Set the number/names of the system states.
copy()

Make a copy of an input/output system.

feedback(other=1, sign=-1, params={})

Feedback interconnection between two input/output systems

Parameters:
  • sys1 (InputOutputSystem) – The primary process.
  • sys2 (InputOutputSystem) – The feedback process (often a feedback controller).
  • sign (scalar, optional) – The sign of feedback. sign = -1 indicates negative feedback, and sign = 1 indicates positive feedback. sign is an optional argument; it assumes a value of -1 if not specified.
Returns:

out

Return type:

InputOutputSystem

Raises:

ValueError – if the inputs, outputs, or timebases of the systems are incompatible.

find_input(name)

Find the index for an input given its name (None if not found)

find_output(name)

Find the index for an output given its name (None if not found)

find_state(name)

Find the index for a state given its name (None if not found)

linearize(x0, u0, t=0, params={}, eps=1e-06)

Linearize an input/output system at a given state and input.

Return the linearization of an input/output system at a given state and input value as a StateSpace system. See linearize() for complete documentation.

set_connect_map(connect_map)

Set the connection map for an interconnected I/O system.

Parameters:connect_map (2D array) – Specify the matrix that will be used to multiply the vector of subsystem outputs to obtain the vector of subsystem inputs.
set_input_map(input_map)

Set the input map for an interconnected I/O system.

Parameters:input_map (2D array) – Specify the matrix that will be used to multiply the vector of system inputs to obtain the vector of subsystem inputs. These values are added to the inputs specified in the connection map.
set_inputs(inputs, prefix='u')

Set the number/names of the system inputs.

Parameters:
  • inputs (int, list of str, or None) – Description of the system inputs. This can be given as an integer count or as a list of strings that name the individual signals. If an integer count is specified, the names of the signal will be of the form u[i] (where the prefix u can be changed using the optional prefix parameter).
  • prefix (string, optional) – If inputs is an integer, create the names of the states using the given prefix (default = ‘u’). The names of the input will be of the form prefix[i].
set_output_map(output_map)

Set the output map for an interconnected I/O system.

Parameters:output_map (2D array) – Specify the matrix that will be used to multiply the vector of subsystem outputs to obtain the vector of system outputs.
set_outputs(outputs, prefix='y')

Set the number/names of the system outputs.

Parameters:
  • outputs (int, list of str, or None) – Description of the system outputs. This can be given as an integer count or as a list of strings that name the individual signals. If an integer count is specified, the names of the signal will be of the form u[i] (where the prefix u can be changed using the optional prefix parameter).
  • prefix (string, optional) – If outputs is an integer, create the names of the states using the given prefix (default = ‘y’). The names of the input will be of the form prefix[i].
set_states(states, prefix='x')

Set the number/names of the system states.

Parameters:
  • states (int, list of str, or None) – Description of the system states. This can be given as an integer count or as a list of strings that name the individual signals. If an integer count is specified, the names of the signal will be of the form u[i] (where the prefix u can be changed using the optional prefix parameter).
  • prefix (string, optional) – If states is an integer, create the names of the states using the given prefix (default = ‘x’). The names of the input will be of the form prefix[i].