diff --git a/control/iosys.py b/control/iosys.py index 2881c5d64..4d697cf3d 100644 --- a/control/iosys.py +++ b/control/iosys.py @@ -2405,7 +2405,10 @@ def ss(*args, **kwargs): # Create a state space system from an LTI system sys = LinearIOSystem( - _convert_to_statespace(sys, use_prefix_suffix=True), **kwargs) + _convert_to_statespace( + sys, + use_prefix_suffix=not sys._generic_name_check()), + **kwargs) else: raise TypeError("ss(sys): sys must be a StateSpace or " diff --git a/control/statesp.py b/control/statesp.py index d3d1ab1d0..d1fa16b63 100644 --- a/control/statesp.py +++ b/control/statesp.py @@ -1914,8 +1914,11 @@ def tf2ss(*args, **kwargs): if not isinstance(sys, TransferFunction): raise TypeError("tf2ss(sys): sys must be a TransferFunction " "object.") - return StateSpace(_convert_to_statespace(sys, use_prefix_suffix=True), - **kwargs) + return StateSpace( + _convert_to_statespace( + sys, + use_prefix_suffix=not sys._generic_name_check()), + **kwargs) else: raise ValueError("Needs 1 or 2 arguments; received %i." % len(args)) diff --git a/control/tests/namedio_test.py b/control/tests/namedio_test.py index cf30b94aa..80b085b5a 100644 --- a/control/tests/namedio_test.py +++ b/control/tests/namedio_test.py @@ -135,6 +135,8 @@ def test_io_naming(fun, args, kwargs): sys_r.set_states(state_labels) assert sys_r.state_labels == state_labels + sys_r.name = 'sys' # make sure name is non-generic + # # Set names using keywords and make sure they stick # diff --git a/control/tests/xferfcn_test.py b/control/tests/xferfcn_test.py index 7d561e770..078ad4453 100644 --- a/control/tests/xferfcn_test.py +++ b/control/tests/xferfcn_test.py @@ -1254,7 +1254,7 @@ def test_zpk(zeros, poles, gain, args, kwargs): ]) def test_copy_names(create, args, kwargs, convert): # Convert a system with no renaming - sys = create(*args, **kwargs) + sys = create(*args, **kwargs, name='sys') cpy = convert(sys) assert cpy.input_labels == sys.input_labels diff --git a/control/xferfcn.py b/control/xferfcn.py index 60a40eca0..7664c16ac 100644 --- a/control/xferfcn.py +++ b/control/xferfcn.py @@ -1813,7 +1813,8 @@ def ss2tf(*args, **kwargs): if not kwargs.get('outputs'): kwargs['outputs'] = sys.output_labels return TransferFunction( - _convert_to_transfer_function(sys, use_prefix_suffix=True), + _convert_to_transfer_function( + sys, use_prefix_suffix=not sys._generic_name_check()), **kwargs) else: raise TypeError(