4747 'interconnect' , 'summing_junction' ]
4848
4949# Define module default parameter values
50- _iosys_defaults = {
51- 'iosys.state_name_delim' : '_' ,
52- 'iosys.duplicate_system_name_prefix' : '' ,
53- 'iosys.duplicate_system_name_suffix' : '$copy' ,
54- 'iosys.linearized_system_name_prefix' : '' ,
55- 'iosys.linearized_system_name_suffix' : '$linearized'
56- }
50+ _iosys_defaults = {}
5751
5852
5953class InputOutputSystem (NamedIOSystem ):
@@ -515,7 +509,7 @@ def feedback(self, other=1, sign=-1, params=None):
515509 return newsys
516510
517511 def linearize (self , x0 , u0 , t = 0 , params = None , eps = 1e-6 ,
518- name = None , copy = False , ** kwargs ):
512+ name = None , copy_names = False , ** kwargs ):
519513 """Linearize an input/output system at a given state and input.
520514
521515 Return the linearization of an input/output system at a given state
@@ -571,25 +565,26 @@ def linearize(self, x0, u0, t=0, params=None, eps=1e-6,
571565
572566 # Create the state space system
573567 linsys = LinearIOSystem (
574- StateSpace (A , B , C , D , self .dt , remove_useless_states = False ),
575- name = name , ** kwargs )
568+ StateSpace (A , B , C , D , self .dt , remove_useless_states = False ))
576569
577- # Set the names the system, inputs, outputs, and states
578- if copy :
570+ # Set the system name, inputs, outputs, and states
571+ if 'copy' in kwargs :
572+ copy_names = kwargs .pop ('copy' )
573+ warn ("keyword 'copy' is deprecated. please use 'copy_names'" ,
574+ DeprecationWarning )
575+
576+ if copy_names :
577+ linsys ._copy_names (self )
579578 if name is None :
580579 linsys .name = \
581- config .defaults ['iosys.linearized_system_name_prefix' ] + \
582- self .name + \
583- config .defaults ['iosys.linearized_system_name_suffix' ]
584- linsys .ninputs , linsys .input_index = self .ninputs , \
585- self .input_index .copy ()
586- linsys .noutputs , linsys .output_index = \
587- self .noutputs , self .output_index .copy ()
588- linsys .nstates , linsys .state_index = \
589- self .nstates , self .state_index .copy ()
590-
591- return linsys
580+ config .defaults ['namedio.linearized_system_name_prefix' ]+ \
581+ linsys .name + \
582+ config .defaults ['namedio.linearized_system_name_suffix' ]
583+ else :
584+ linsys .name = name
592585
586+ # re-init to include desired signal names if names were provided
587+ return LinearIOSystem (linsys , ** kwargs )
593588
594589class LinearIOSystem (InputOutputSystem , StateSpace ):
595590 """Input/output representation of a linear (state space) system.
@@ -966,7 +961,7 @@ def __init__(self, syslist, connections=None, inplist=None, outlist=None,
966961
967962 if states is None :
968963 states = []
969- state_name_delim = config .defaults ['iosys .state_name_delim' ]
964+ state_name_delim = config .defaults ['namedio .state_name_delim' ]
970965 for sys , sysname in sysobj_name_dct .items ():
971966 states += [sysname + state_name_delim +
972967 statename for statename in sys .state_index .keys ()]
@@ -2197,19 +2192,17 @@ def linearize(sys, xeq, ueq=None, t=0, params=None, **kw):
21972192 params : dict, optional
21982193 Parameter values for the systems. Passed to the evaluation functions
21992194 for the system as default values, overriding internal defaults.
2200- copy : bool, Optional
2201- If `copy` is True, copy the names of the input signals, output signals,
2202- and states to the linearized system. If `name` is not specified,
2203- the system name is set to the input system name with the string
2204- '_linearized' appended.
22052195 name : string, optional
22062196 Set the name of the linearized system. If not specified and
2207- if `copy ` is `False`, a generic name <sys[id]> is generated
2208- with a unique integer id. If `copy ` is `True`, the new system
2197+ if `copy_names ` is `False`, a generic name <sys[id]> is generated
2198+ with a unique integer id. If `copy_names ` is `True`, the new system
22092199 name is determined by adding the prefix and suffix strings in
2210- config.defaults['iosys .linearized_system_name_prefix'] and
2211- config.defaults['iosys .linearized_system_name_suffix'], with the
2200+ config.defaults['namedio .linearized_system_name_prefix'] and
2201+ config.defaults['namedio .linearized_system_name_suffix'], with the
22122202 default being to add the suffix '$linearized'.
2203+ copy_names : bool, Optional
2204+ If True, Copy the names of the input signals, output signals, and
2205+ states to the linearized system.
22132206
22142207 Returns
22152208 -------
@@ -2221,7 +2214,7 @@ def linearize(sys, xeq, ueq=None, t=0, params=None, **kw):
22212214 ---------------------
22222215 inputs : int, list of str or None, optional
22232216 Description of the system inputs. If not specified, the origional
2224- system inputs are used. See :class:`InputOutputSystem ` for more
2217+ system inputs are used. See :class:`NamedIOSystem ` for more
22252218 information.
22262219 outputs : int, list of str or None, optional
22272220 Description of the system outputs. Same format as `inputs`.
@@ -2733,8 +2726,8 @@ def interconnect(syslist, connections=None, inplist=None, outlist=None,
27332726 If a system is duplicated in the list of systems to be connected,
27342727 a warning is generated and a copy of the system is created with the
27352728 name of the new system determined by adding the prefix and suffix
2736- strings in config.defaults['iosys .linearized_system_name_prefix']
2737- and config.defaults['iosys .linearized_system_name_suffix'], with the
2729+ strings in config.defaults['namedio .linearized_system_name_prefix']
2730+ and config.defaults['namedio .linearized_system_name_suffix'], with the
27382731 default being to add the suffix '$copy'$ to the system name.
27392732
27402733 It is possible to replace lists in most of arguments with tuples instead,
0 commit comments