@@ -148,7 +148,7 @@ def __init__(self, inputs=None, outputs=None, states=None, params={},
148148# timebase
149149self .dt = kwargs .pop ('dt' ,config .defaults ['control.default_dt' ])
150150
151- # Make sure there were no extraneouskeyworks
151+ # Make sure there were no extraneouskeywords
152152if kwargs :
153153raise TypeError ("unrecognized keywords: " ,str (kwargs ))
154154
@@ -560,7 +560,7 @@ def linearize(self, x0, u0, t=0, params={}, eps=1e-6,
560560
561561# Create the state space system
562562linsys = LinearIOSystem (
563- StateSpace (A ,B ,C ,D ,self .dt ,remove_useless = False ),
563+ StateSpace (A ,B ,C ,D ,self .dt ,remove_useless_states = False ),
564564name = name ,** kwargs )
565565
566566# Set the names the system, inputs, outputs, and states
@@ -660,7 +660,7 @@ def __init__(self, linsys, inputs=None, outputs=None, states=None,
660660states = linsys .nstates ,params = {},dt = linsys .dt ,name = name )
661661
662662# Initalize additional state space variables
663- StateSpace .__init__ (self ,linsys ,remove_useless = False )
663+ StateSpace .__init__ (self ,linsys ,remove_useless_states = False )
664664
665665# Process input, output, state lists, if given
666666# Make sure they match the size of the linear system
@@ -790,9 +790,9 @@ def __init__(self, updfcn, outfcn=None, inputs=None, outputs=None,
790790params = params ,dt = dt ,name = name
791791 )
792792
793- # Make sureall input arguments got parsed
793+ # Make surethere were no extraneous keywords
794794if kwargs :
795- raise TypeError ("unknown parameters %s" % kwargs )
795+ raise TypeError ("unrecognized keywords: " , str ( kwargs ) )
796796
797797# Check to make sure arguments are consistent
798798if updfcn is None :
@@ -1551,7 +1551,7 @@ def __init__(self, io_sys, ss_sys=None):
15511551io_sys .nstates != ss_sys .nstates :
15521552raise ValueError ("System dimensions for first and second "
15531553"arguments must match." )
1554- StateSpace .__init__ (self ,ss_sys ,remove_useless = False )
1554+ StateSpace .__init__ (self ,ss_sys ,remove_useless_states = False )
15551555
15561556else :
15571557raise TypeError ("Second argument must be a state space system." )
@@ -1656,14 +1656,14 @@ def input_output_response(
16561656raise ValueError ("ivp_method specified more than once" )
16571657solve_ivp_kwargs ['method' ]= kwargs .pop ('solve_ivp_method' )
16581658
1659+ # Make sure there were no extraneous keywords
1660+ if kwargs :
1661+ raise TypeError ("unrecognized keywords: " ,str (kwargs ))
1662+
16591663# Set the default method to 'RK45'
16601664if solve_ivp_kwargs .get ('method' ,None )is None :
16611665solve_ivp_kwargs ['method' ]= 'RK45'
16621666
1663- # Make sure all input arguments got parsed
1664- if kwargs :
1665- raise TypeError ("unknown parameters %s" % kwargs )
1666-
16671667# Sanity checking on the input
16681668if not isinstance (sys ,InputOutputSystem ):
16691669raise TypeError ("System of type " ,type (sys )," not valid" )
@@ -1829,7 +1829,7 @@ def ivp_rhs(t, x):
18291829
18301830def find_eqpt (sys ,x0 ,u0 = [],y0 = None ,t = 0 ,params = {},
18311831iu = None ,iy = None ,ix = None ,idx = None ,dx0 = None ,
1832- return_y = False ,return_result = False , ** kw ):
1832+ return_y = False ,return_result = False ):
18331833"""Find the equilibrium point for an input/output system.
18341834
18351835 Returns the value of an equilibrium point given the initial state and
@@ -1933,7 +1933,7 @@ def find_eqpt(sys, x0, u0=[], y0=None, t=0, params={},
19331933# Take u0 as fixed and minimize over x
19341934# TODO: update to allow discrete time systems
19351935def ode_rhs (z ):return sys ._rhs (t ,z ,u0 )
1936- result = root (ode_rhs ,x0 , ** kw )
1936+ result = root (ode_rhs ,x0 )
19371937z = (result .x ,u0 ,sys ._out (t ,result .x ,u0 ))
19381938else :
19391939# Take y0 as fixed and minimize over x and u
@@ -1944,7 +1944,7 @@ def rootfun(z):
19441944return np .concatenate (
19451945 (sys ._rhs (t ,x ,u ),sys ._out (t ,x ,u )- y0 ),axis = 0 )
19461946z0 = np .concatenate ((x0 ,u0 ),axis = 0 )# Put variables together
1947- result = root (rootfun ,z0 , ** kw ) # Find the eq point
1947+ result = root (rootfun ,z0 ) # Find the eq point
19481948x ,u = np .split (result .x , [nstates ])# Split result back in two
19491949z = (x ,u ,sys ._out (t ,x ,u ))
19501950
@@ -2056,7 +2056,7 @@ def rootfun(z):
20562056z0 = np .concatenate ((x [state_vars ],u [input_vars ]),axis = 0 )
20572057
20582058# Finally, call the root finding function
2059- result = root (rootfun ,z0 , ** kw )
2059+ result = root (rootfun ,z0 )
20602060
20612061# Extract out the results and insert into x and u
20622062x [state_vars ]= result .x [:nstate_vars ]
@@ -2134,7 +2134,8 @@ def _parse_signal_parameter(value, name, kwargs, end=False):
21342134value = kwargs .pop (name )
21352135
21362136if end and kwargs :
2137- raise TypeError ("unknown parameters %s" % kwargs )
2137+ raise TypeError ("unrecognized keywords: " ,str (kwargs ))
2138+
21382139return value
21392140
21402141
@@ -2237,7 +2238,15 @@ def ss(*args, **kwargs):
22372238 >>> sys2 = ss(sys_tf)
22382239
22392240 """
2240- sys = _ss (* args ,keywords = kwargs )
2241+ # Extract the keyword arguments needed for StateSpace (via _ss)
2242+ ss_kwlist = ('dt' ,'remove_useless_states' )
2243+ ss_kwargs = {}
2244+ for kw in ss_kwlist :
2245+ if kw in kwargs :
2246+ ss_kwargs [kw ]= kwargs .pop (kw )
2247+
2248+ # Create the statespace system and then convert to I/O system
2249+ sys = _ss (* args ,keywords = ss_kwargs )
22412250return LinearIOSystem (sys ,** kwargs )
22422251
22432252