Skip to content

Commit 2bd912d

Browse files
committed
added keyword arguments to xferfcn.tf and statesp.ss to set dt
1 parent 606975d commit 2bd912d

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

control/statesp.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ def __init__(self, *args, **kwargs):
226226
elif len(args) == 5:
227227
dt = args[4]
228228
if 'dt' in kwargs:
229-
warn('received multiple dt arguments, using positional arg'%dt)
229+
warn('received multiple dt arguments, using positional arg dt=%s'%dt)
230230
elif len(args) == 1:
231231
try:
232232
dt = args[0].dt
@@ -1243,7 +1243,7 @@ def _mimo2simo(sys, input, warn_conversion=False):
12431243

12441244
return sys
12451245

1246-
def ss(*args):
1246+
def ss(*args, **kwargs):
12471247
"""ss(A, B, C, D[, dt])
12481248
12491249
Create a state space system.
@@ -1319,7 +1319,7 @@ def ss(*args):
13191319
"""
13201320

13211321
if len(args) == 4 or len(args) == 5:
1322-
return StateSpace(*args)
1322+
return StateSpace(*args, **kwargs)
13231323
elif len(args) == 1:
13241324
from .xferfcn import TransferFunction
13251325
sys = args[0]
@@ -1331,7 +1331,7 @@ def ss(*args):
13311331
raise TypeError("ss(sys): sys must be a StateSpace or \
13321332
TransferFunction object. It is %s." % type(sys))
13331333
else:
1334-
raise ValueError("Needs 1 or 4 arguments; received %i." % len(args))
1334+
raise ValueError("Needs 1, 4, or 5 arguments; received %i." % len(args))
13351335

13361336

13371337
def tf2ss(*args):

control/xferfcn.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ def __init__(self, *args, **kwargs):
217217
elif len(args) == 3:
218218
# Discrete time transfer function
219219
if 'dt' in kwargs:
220-
warn('received multiple dt arguments, using positional arg'%dt)
220+
warn('received multiple dt arguments, using positional arg dt=%s'%dt)
221221
elif len(args) == 1:
222222
# TODO: not sure this can ever happen since dt is always present
223223
try:
@@ -1301,7 +1301,7 @@ def _convert_to_transfer_function(sys, **kw):
13011301
raise TypeError("Can't convert given type to TransferFunction system.")
13021302

13031303

1304-
def tf(*args):
1304+
def tf(*args, **kwargs):
13051305
"""tf(num, den[, dt])
13061306
13071307
Create a transfer function system. Can create MIMO systems.
@@ -1391,7 +1391,7 @@ def tf(*args):
13911391
"""
13921392

13931393
if len(args) == 2 or len(args) == 3:
1394-
return TransferFunction(*args)
1394+
return TransferFunction(*args, **kwargs)
13951395
elif len(args) == 1:
13961396
# Look for special cases defining differential/delay operator
13971397
if args[0] == 's':
@@ -1412,7 +1412,7 @@ def tf(*args):
14121412
raise ValueError("Needs 1 or 2 arguments; received %i." % len(args))
14131413

14141414

1415-
def ss2tf(*args):
1415+
def ss2tf(*args, **kwargs):
14161416
"""ss2tf(sys)
14171417
14181418
Transform a state space system to a transfer function.
@@ -1477,7 +1477,7 @@ def ss2tf(*args):
14771477
from .statesp import StateSpace
14781478
if len(args) == 4 or len(args) == 5:
14791479
# Assume we were given the A, B, C, D matrix and (optional) dt
1480-
return _convert_to_transfer_function(StateSpace(*args))
1480+
return _convert_to_transfer_function(StateSpace(*args, **kwargs))
14811481

14821482
elif len(args) == 1:
14831483
sys = args[0]

0 commit comments

Comments
 (0)