Skip to content

Commit 319a8ea

Browse files
committed
update flatsys() documentation
1 parent 1547326 commit 319a8ea

2 files changed

Lines changed: 36 additions & 14 deletions

File tree

control/flatsys/flatsys.py

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,30 @@ class FlatSystem(NonlinearIOSystem):
1717
"""Base class for representing a differentially flat system.
1818
1919
The FlatSystem class is used as a base class to describe differentially
20-
flat systems for trajectory generation. The output of the system does not
21-
need to be the differentially flat output.
20+
flat systems for trajectory generation. The output of the system does
21+
not need to be the differentially flat output. Flat systems are
22+
usually created with the :func:`~control.flatsys.flatsys` factory
23+
function.
24+
25+
Parameters
26+
----------
27+
forward : callable
28+
A function to compute the flat flag given the states and input.
29+
reverse : callable
30+
A function to compute the states and input given the flat flag.
31+
dt : None, True or float, optional
32+
System timebase.
33+
34+
Attributes
35+
----------
36+
ninputs, noutputs, nstates : int
37+
Number of input, output and state variables.
38+
shape : tuple
39+
2-tuple of I/O system dimension, (noutputs, ninputs).
40+
input_labels, output_labels, state_labels : list of str
41+
Names for the input, output, and state variables.
42+
name : string, optional
43+
System name.
2244
2345
Notes
2446
-----
@@ -197,10 +219,9 @@ def flatsys(*args, updfcn=None, outfcn=None, **kwargs):
197219
Description of the system states. Same format as `inputs`.
198220
199221
dt : None, True or float, optional
200-
System timebase. None (default) indicates continuous
201-
time, True indicates discrete time with undefined sampling
202-
time, positive number is discrete time with specified
203-
sampling time.
222+
System timebase. None (default) indicates continuous time, True
223+
indicates discrete time with undefined sampling time, positive
224+
number is discrete time with specified sampling time.
204225
205226
params : dict, optional
206227
Parameter values for the systems. Passed to the evaluation

control/tests/docstrings_test.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ def test_deprecated_functions(module, prefix):
272272

273273
# Dictionary of factory functions associated with primary classes
274274
class_factory_function = {
275-
# fs.FlatSystem: fs.flatsys,
275+
fs.FlatSystem: fs.flatsys,
276276
ct.FrequencyResponseData: ct.frd,
277277
ct.InterconnectedSystem: ct.interconnect,
278278
ct.LinearICSystem: ct.interconnect,
@@ -283,7 +283,7 @@ def test_deprecated_functions(module, prefix):
283283

284284
# List of arguments described in class docstrings
285285
class_args = {
286-
# fs.FlatSystem: ['forward', 'reverse', 'updfcn', 'outfcn'],
286+
fs.FlatSystem: ['forward', 'reverse'],
287287
ct.FrequencyResponseData: ['response', 'omega', 'dt'],
288288
ct.NonlinearIOSystem: [
289289
'updfcn', 'outfcn', 'inputs', 'outputs', 'states', 'params', 'dt'],
@@ -297,7 +297,7 @@ def test_deprecated_functions(module, prefix):
297297

298298
# List of attributes defined for specific I/O systems
299299
class_attributes = {
300-
# fs.FlatSystem: [],
300+
fs.FlatSystem: [],
301301
ct.FrequencyResponseData: [],
302302
ct.NonlinearIOSystem: [],
303303
ct.StateSpace: ['nstates', 'state_labels'],
@@ -315,7 +315,7 @@ def test_deprecated_functions(module, prefix):
315315
# List of arguments described (only) in factory function docstrings
316316
std_factory_args = ['inputs', 'outputs', 'name']
317317
factory_args = {
318-
# fs.flatsys: [],
318+
fs.flatsys: [],
319319
ct.frd: ['sys'],
320320
ct.nlsys: [],
321321
ct.ss: ['sys', 'states'],
@@ -337,7 +337,7 @@ def test_iosys_primary_classes(cls, fcn, args):
337337
# Make sure we reference the factory function
338338
if re.search(
339339
r"created.*(with|by|using).*the[\s]*"
340-
f":func:`~control.{fcn.__name__}`"
340+
f":func:`~control\\..*{fcn.__name__}`"
341341
r"[\s]factory[\s]function", docstring, re.DOTALL) is None:
342342
pytest.fail(
343343
f"{cls.__name__} does not reference factory function "
@@ -357,6 +357,7 @@ def test_iosys_attribute_lists(cls, ignore_future_warning):
357357

358358
# Create a system that we can scan for attributes
359359
sys = ct.rss(2, 1, 1)
360+
ignore_args = []
360361
match fcn:
361362
case ct.tf:
362363
sys = ct.tf(sys)
@@ -366,9 +367,9 @@ def test_iosys_attribute_lists(cls, ignore_future_warning):
366367
ignore_args = ['state_labels']
367368
case ct.nlsys:
368369
sys = ct.nlsys(sys)
369-
ignore_args = []
370-
case _:
371-
ignore_args = []
370+
case fs.flatsys:
371+
sys = fs.flatsys(sys)
372+
sys = fs.flatsys(sys.forward, sys.reverse)
372373

373374
docstring = inspect.getdoc(cls)
374375
for name, obj in inspect.getmembers(sys):

0 commit comments

Comments
 (0)