Skip to content
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
5 changes: 4 additions & 1 deletion control/iosys.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 "
Expand Down
7 changes: 5 additions & 2 deletions control/statesp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down
2 changes: 2 additions & 0 deletions control/tests/namedio_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
#
Expand Down
2 changes: 1 addition & 1 deletion control/tests/xferfcn_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion control/xferfcn.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down