@@ -164,7 +164,7 @@ def parallel(sys1, *sysn, **kwargs):
164164 or `y`). See :class:`InputOutputSystem` for more information.
165165 states : str, or list of str, optional
166166 List of names for system states. If not given, state names will be
167- of of the form `x[i]` for interconnections of linear systems or
167+ of the form `x[i]` for interconnections of linear systems or
168168 '<subsys_name>.<state_name>' for interconnected nonlinear systems.
169169 name : string, optional
170170 System name (used for specifying signals). If unspecified, a generic
@@ -511,7 +511,7 @@ def connect(sys, Q, inputv, outputv):
511511
512512 return Ytrim * sys * Utrim
513513
514- def combine_tf (tf_array ):
514+ def combine_tf (tf_array , ** kwargs ):
515515 """Combine array-like of transfer functions into MIMO transfer function.
516516
517517 Parameters
@@ -527,6 +527,16 @@ def combine_tf(tf_array):
527527 TransferFunction
528528 Transfer matrix represented as a single MIMO TransferFunction object.
529529
530+ Other Parameters
531+ ----------------
532+ inputs, outputs : str, or list of str, optional
533+ List of strings that name the individual signals. If not given,
534+ signal names will be of the form `s[i]` (where `s` is one of `u`,
535+ or `y`). See :class:`InputOutputSystem` for more information.
536+ name : string, optional
537+ System name (used for specifying signals). If unspecified, a generic
538+ name <sys[id]> is generated with a unique integer id.
539+
530540 Raises
531541 ------
532542 ValueError
@@ -541,26 +551,22 @@ def combine_tf(tf_array):
541551 --------
542552 Combine two transfer functions
543553
544- >>> s = control.TransferFunction.s
545- >>> control .combine_tf([
546- ... [1 / (s + 1)],
547- ... [s / (s + 2)],
548- ... ])
549- TransferFunction([[array([1])], [array([1, 0])]],
550- [[array([1, 1])], [array([1, 2])]])
554+ >>> s = ct.tf('s')
555+ >>> ct .combine_tf(
556+ ... [[ 1 / (s + 1)],
557+ ... [s / (s + 2)] ],
558+ ... name='G'
559+ ... )
560+ <TransferFunction G: ['u[0]'] -> ['y[0]', 'y[1]']>
551561
552562 Combine NumPy arrays with transfer functions
553563
554- >>> control.combine_tf([
555- ... [np.eye(2), np.zeros((2, 1))],
556- ... [np.zeros((1, 2)), control.TransferFunction([1], [1, 0])],
557- ... ])
558- TransferFunction([[array([1.]), array([0.]), array([0.])],
559- [array([0.]), array([1.]), array([0.])],
560- [array([0.]), array([0.]), array([1])]],
561- [[array([1.]), array([1.]), array([1.])],
562- [array([1.]), array([1.]), array([1.])],
563- [array([1.]), array([1.]), array([1, 0])]])
564+ >>> ct.combine_tf(
565+ ... [[np.eye(2), np.zeros((2, 1))],
566+ ... [np.zeros((1, 2)), ct.tf([1], [1, 0])]],
567+ ... name='G'
568+ ... )
569+ <TransferFunction G: ['u[0]', 'u[1]', 'u[2]'] -> ['y[0]', 'y[1]', 'y[2]']>
564570 """
565571 # Find common timebase or raise error
566572 dt_list = []
@@ -616,10 +622,14 @@ def combine_tf(tf_array):
616622 "Mismatched number transfer function inputs in row "
617623 f"{ row_index } of denominator."
618624 )
619- return tf .TransferFunction (num , den , dt = dt )
625+ return tf .TransferFunction (num , den , dt = dt , ** kwargs )
626+
620627
621628def split_tf (transfer_function ):
622- """Split MIMO transfer function into NumPy array of SISO tranfer functions.
629+ """Split MIMO transfer function into NumPy array of SISO transfer functions.
630+
631+ System and signal names for the array of SISO transfer functions are
632+ copied from the MIMO system.
623633
624634 Parameters
625635 ----------
@@ -635,21 +645,18 @@ def split_tf(transfer_function):
635645 --------
636646 Split a MIMO transfer function
637647
638- >>> G = control.TransferFunction(
639- ... [
640- ... [[87.8], [-86.4]],
641- ... [[108.2], [-109.6]],
642- ... ],
643- ... [
644- ... [[1, 1], [1, 1]],
645- ... [[1, 1], [1, 1]],
646- ... ],
648+ >>> G = ct.tf(
649+ ... [ [[87.8], [-86.4]],
650+ ... [[108.2], [-109.6]] ],
651+ ... [ [[1, 1], [1, 1]],
652+ ... [[1, 1], [1, 1]], ],
653+ ... name='G'
647654 ... )
648- >>> control .split_tf(G)
649- array([[TransferFunction(array([87.8]), array([1, 1])) ,
650- TransferFunction(array([-86.4]), array([1, 1])) ],
651- [TransferFunction(array([108.2]), array([1, 1])) ,
652- TransferFunction(array([-109.6]), array([1, 1])) ]], dtype=object)
655+ >>> ct .split_tf(G)
656+ array([[< TransferFunction G: ['u[0]'] -> ['y[0]']> ,
657+ < TransferFunction G: ['u[1]'] -> ['y[0]']> ],
658+ [< TransferFunction G: ['u[0]'] -> ['y[1]']> ,
659+ < TransferFunction G: ['u[1]'] -> ['y[1]']> ]], dtype=object)
653660 """
654661 tf_split_lst = []
655662 for i_out in range (transfer_function .noutputs ):
@@ -660,6 +667,9 @@ def split_tf(transfer_function):
660667 transfer_function .num_array [i_out , i_in ],
661668 transfer_function .den_array [i_out , i_in ],
662669 dt = transfer_function .dt ,
670+ inputs = transfer_function .input_labels [i_in ],
671+ outputs = transfer_function .output_labels [i_out ],
672+ name = transfer_function .name
663673 )
664674 )
665675 tf_split_lst .append (row )
0 commit comments