Merge pull request #497 from murrayrm/linearize_named_signals · python-control/python-control@4103688

@@ -1264,7 +1264,7 @@ def _convertToStateSpace(sys, **kw):

126412641265126512661266

# TODO: add discrete time option

1267-

def _rss_generate(states, inputs, outputs, type):

1267+

def _rss_generate(states, inputs, outputs, type, strictly_proper=False):

12681268

"""Generate a random state space.

1269126912701270

This does the actual random state space generation expected from rss and

@@ -1374,7 +1374,7 @@ def _rss_generate(states, inputs, outputs, type):

13741374

# Apply masks.

13751375

B = B * Bmask

13761376

C = C * Cmask

1377-

D = D * Dmask

1377+

D = D * Dmask if not strictly_proper else zeros(D.shape)

1378137813791379

return StateSpace(A, B, C, D)

13801380

@@ -1649,7 +1649,7 @@ def tf2ss(*args):

16491649

raise ValueError("Needs 1 or 2 arguments; received %i." % len(args))

16501650165116511652-

def rss(states=1, outputs=1, inputs=1):

1652+

def rss(states=1, outputs=1, inputs=1, strictly_proper=False):

16531653

"""

16541654

Create a stable *continuous* random state space object.

16551655

@@ -1661,6 +1661,9 @@ def rss(states=1, outputs=1, inputs=1):

16611661

Number of system inputs

16621662

outputs : integer

16631663

Number of system outputs

1664+

strictly_proper : bool, optional

1665+

If set to 'True', returns a proper system (no direct term). Default

1666+

value is 'False'.

1664166716651668

Returns

16661669

-------

@@ -1684,10 +1687,11 @@ def rss(states=1, outputs=1, inputs=1):

1684168716851688

"""

168616891687-

return _rss_generate(states, inputs, outputs, 'c')

1690+

return _rss_generate(states, inputs, outputs, 'c',

1691+

strictly_proper=strictly_proper)

16881692168916931690-

def drss(states=1, outputs=1, inputs=1):

1694+

def drss(states=1, outputs=1, inputs=1, strictly_proper=False):

16911695

"""

16921696

Create a stable *discrete* random state space object.

16931697

@@ -1722,7 +1726,8 @@ def drss(states=1, outputs=1, inputs=1):

1722172617231727

"""

172417281725-

return _rss_generate(states, inputs, outputs, 'd')

1729+

return _rss_generate(states, inputs, outputs, 'd',

1730+

strictly_proper=strictly_proper)

172617311727173217281733

def ssdata(sys):