@@ -113,9 +113,9 @@ def place(A, B, p):
113113 return K
114114
115115
116- def place_varga (A , B , p , DICO = 'C' , alpha = None ):
116+ def place_varga (A , B , p , dtime = False , alpha = None ):
117117 """Place closed loop eigenvalues
118- K = place_varga(A, B, p, DICO='C' , alpha=None)
118+ K = place_varga(A, B, p, dtime=False , alpha=None)
119119
120120 Required Parameters
121121 ----------
@@ -128,8 +128,8 @@ def place_varga(A, B, p, DICO='C', alpha=None):
128128
129129 Optional Parameters
130130 ---------------
131- DICO : 'C' for continuous time pole placement or 'D' for discrete time.
132- The default is DICO='C' .
131+ dtime: False for continuous time pole placement or True for discrete time.
132+ The default is dtime=False .
133133 alpha: double scalar
134134 If DICO='C', then place_varga will leave the eigenvalues with real
135135 real part less than alpha untouched.
@@ -160,7 +160,7 @@ def place_varga(A, B, p, DICO='C', alpha=None):
160160 --------
161161 >>> A = [[-1, -1], [0, 1]]
162162 >>> B = [[0], [1]]
163- >>> K = place (A, B, [-2, -5])
163+ >>> K = place_varga (A, B, [-2, -5])
164164
165165 See Also:
166166 --------
@@ -184,25 +184,32 @@ def place_varga(A, B, p, DICO='C', alpha=None):
184184 system_eigs = np .linalg .eig (A_mat )[0 ]
185185 placed_eigs = np .array (p )
186186
187+ # Need a character parameter for SB01BD
188+ if dtime :
189+ DICO = 'D'
190+ else :
191+ DICO = 'C'
192+
187193 if alpha is None :
188194 # SB01BD ignores eigenvalues with real part less than alpha
189195 # (if DICO='C') or with modulus less than alpha
190196 # (if DICO = 'D').
191- if DICO == 'C' :
197+ if dtime :
198+ # For discrete time, slycot only cares about modulus, so just make
199+ # alpha the smallest it can be.
200+ alpha = 0.0
201+ else :
192202 # Choosing alpha=min_eig is insufficient and can lead to an
193203 # error or not having all the eigenvalues placed that we wanted.
194204 # Evidently, what python thinks are the eigs is not precisely
195205 # the same as what slicot thinks are the eigs. So we need some
196206 # numerical breathing room. The following is pretty heuristic,
197207 # but does the trick
198208 alpha = - 2 * abs (min (system_eigs .real ))
199- elif DICO == 'D' :
200- # For discrete time, slycot only cares about modulus, so just make
201- # alpha the smallest it can be.
202- alpha = 0.0
203- elif DICO == 'D' and alpha < 0.0 :
209+ elif dtime and alpha < 0.0 :
204210 raise ValueError ("Need alpha > 0 when DICO='D'" )
205211
212+
206213 # Call SLICOT routine to place the eigenvalues
207214 A_z ,w ,nfp ,nap ,nup ,F ,Z = \
208215 sb01bd (B_mat .shape [0 ], B_mat .shape [1 ], len (placed_eigs ), alpha ,
0 commit comments