1010
1111# Python 3 compatibility (needs to go here)
1212from __future__ import print_function
13- from __future__ import division # for _convertToStateSpace
13+ from __future__ import division # for _convert_to_statespace
1414
1515"""Copyright (c) 2010 by California Institute of Technology
1616All rights reserved.
@@ -527,7 +527,7 @@ def __add__(self, other):
527527 D = self .D + other
528528 dt = self .dt
529529 else :
530- other = _convertToStateSpace (other )
530+ other = _convert_to_statespace (other )
531531
532532 # Check to make sure the dimensions are OK
533533 if ((self .inputs != other .inputs ) or
@@ -577,7 +577,7 @@ def __mul__(self, other):
577577 D = self .D * other
578578 dt = self .dt
579579 else :
580- other = _convertToStateSpace (other )
580+ other = _convert_to_statespace (other )
581581
582582 # Check to make sure the dimensions are OK
583583 if self .inputs != other .outputs :
@@ -614,7 +614,7 @@ def __rmul__(self, other):
614614
615615 # is lti, and convertible?
616616 if isinstance (other , LTI ):
617- return _convertToStateSpace (other ) * self
617+ return _convert_to_statespace (other ) * self
618618
619619 # try to treat this as a matrix
620620 try :
@@ -839,7 +839,7 @@ def zero(self):
839839 def feedback (self , other = 1 , sign = - 1 ):
840840 """Feedback interconnection between two LTI systems."""
841841
842- other = _convertToStateSpace (other )
842+ other = _convert_to_statespace (other )
843843
844844 # Check to make sure the dimensions are OK
845845 if (self .inputs != other .outputs ) or (self .outputs != other .inputs ):
@@ -907,7 +907,7 @@ def lft(self, other, nu=-1, ny=-1):
907907 Dimension of (plant) control input.
908908
909909 """
910- other = _convertToStateSpace (other )
910+ other = _convert_to_statespace (other )
911911 # maximal values for nu, ny
912912 if ny == - 1 :
913913 ny = min (other .inputs , self .outputs )
@@ -1061,7 +1061,7 @@ def append(self, other):
10611061 The second model is converted to state-space if necessary, inputs and
10621062 outputs are appended and their order is preserved"""
10631063 if not isinstance (other , StateSpace ):
1064- other = _convertToStateSpace (other )
1064+ other = _convert_to_statespace (other )
10651065
10661066 self .dt = common_timebase (self .dt , other .dt )
10671067
@@ -1186,16 +1186,16 @@ def is_static_gain(self):
11861186
11871187
11881188# TODO: add discrete time check
1189- def _convertToStateSpace (sys , ** kw ):
1189+ def _convert_to_statespace (sys , ** kw ):
11901190 """Convert a system to state space form (if needed).
11911191
11921192 If sys is already a state space, then it is returned. If sys is a
11931193 transfer function object, then it is converted to a state space and
11941194 returned. If sys is a scalar, then the number of inputs and outputs can
11951195 be specified manually, as in:
11961196
1197- >>> sys = _convertToStateSpace (3.) # Assumes inputs = outputs = 1
1198- >>> sys = _convertToStateSpace (1., inputs=3, outputs=2)
1197+ >>> sys = _convert_to_statespace (3.) # Assumes inputs = outputs = 1
1198+ >>> sys = _convert_to_statespace (1., inputs=3, outputs=2)
11991199
12001200 In the latter example, A = B = C = 0 and D = [[1., 1., 1.]
12011201 [1., 1., 1.]].
@@ -1205,7 +1205,7 @@ def _convertToStateSpace(sys, **kw):
12051205
12061206 if isinstance (sys , StateSpace ):
12071207 if len (kw ):
1208- raise TypeError ("If sys is a StateSpace, _convertToStateSpace "
1208+ raise TypeError ("If sys is a StateSpace, _convert_to_statespace "
12091209 "cannot take keywords." )
12101210
12111211 # Already a state space system; just return it
@@ -1221,7 +1221,7 @@ def _convertToStateSpace(sys, **kw):
12211221 from slycot import td04ad
12221222 if len (kw ):
12231223 raise TypeError ("If sys is a TransferFunction, "
1224- "_convertToStateSpace cannot take keywords." )
1224+ "_convert_to_statespace cannot take keywords." )
12251225
12261226 # Change the numerator and denominator arrays so that the transfer
12271227 # function matrix has a common denominator.
@@ -1283,7 +1283,7 @@ def _convertToStateSpace(sys, **kw):
12831283 return StateSpace ([], [], [], D )
12841284 except Exception as e :
12851285 print ("Failure to assume argument is matrix-like in"
1286- " _convertToStateSpace , result %s" % e )
1286+ " _convert_to_statespace , result %s" % e )
12871287
12881288 raise TypeError ("Can't convert given type to StateSpace system." )
12891289
@@ -1662,14 +1662,14 @@ def tf2ss(*args):
16621662 from .xferfcn import TransferFunction
16631663 if len (args ) == 2 or len (args ) == 3 :
16641664 # Assume we were given the num, den
1665- return _convertToStateSpace (TransferFunction (* args ))
1665+ return _convert_to_statespace (TransferFunction (* args ))
16661666
16671667 elif len (args ) == 1 :
16681668 sys = args [0 ]
16691669 if not isinstance (sys , TransferFunction ):
16701670 raise TypeError ("tf2ss(sys): sys must be a TransferFunction "
16711671 "object." )
1672- return _convertToStateSpace (sys )
1672+ return _convert_to_statespace (sys )
16731673 else :
16741674 raise ValueError ("Needs 1 or 2 arguments; received %i." % len (args ))
16751675
@@ -1769,5 +1769,5 @@ def ssdata(sys):
17691769 (A, B, C, D): list of matrices
17701770 State space data for the system
17711771 """
1772- ss = _convertToStateSpace (sys )
1772+ ss = _convert_to_statespace (sys )
17731773 return ss .A , ss .B , ss .C , ss .D
0 commit comments