Skip to content

Commit 1061445

Browse files
committed
addressed @slivingston review comments
1 parent bf19193 commit 1061445

File tree

4 files changed

+10
-5
lines changed

4 files changed

+10
-5
lines changed

control/nlsys.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1333,8 +1333,11 @@ def nlsys(updfcn, outfcn=None, **kwargs):
13331333
sys_ss.name, prefix_suffix_name='converted'))
13341334

13351335
sys_nl = NonlinearIOSystem(
1336-
lambda t, x, u, params: sys.A @ x + sys.B @ u,
1337-
lambda t, x, u, params: sys.C @ x + sys.D @ u, **kwargs)
1336+
lambda t, x, u, params:
1337+
sys_ss.A @ np.atleast_1d(x) + sys_ss.B @ np.atleast_1d(u),
1338+
lambda t, x, u, params:
1339+
sys_ss.C @ np.atleast_1d(x) + sys_ss.D @ np.atleast_1d(u),
1340+
**kwargs)
13381341

13391342
if sys_nl.nstates != sys_ss.nstates or sys_nl.shape != sys_ss.shape:
13401343
raise ValueError(

control/statefbk.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,7 @@ def create_statefbk_iosystem(
754754
755755
params : dict, optional
756756
System parameter values. By default, these will be copied from
757-
`sys` and `ctrl`, but can be overriden with this keyword.
757+
`sys` and `ctrl`, but can be overridden with this keyword.
758758
759759
Examples
760760
--------

control/statesp.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1529,8 +1529,7 @@ def ss(*args, **kwargs):
15291529
systems, `B` and `C` can be given as 1D arrays and D can be given
15301530
as a scalar.
15311531
1532-
``ss(*args, inputs=['u1', ..., 'up'], outputs=['y1', ..., 'yq'],
1533-
states=['x1', ..., 'xn'])``
1532+
``ss(*args, inputs=['u1', ..., 'up'], outputs=['y1', ..., 'yq'], states=['x1', ..., 'xn'])``
15341533
Create a system with named input, output, and state signals.
15351534
15361535
Parameters

control/tests/nlsys_test.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,9 @@ def test_ss2io():
169169
for attr in ['nstates', 'ninputs', 'noutputs']:
170170
assert getattr(nlsys, attr) == getattr(sys, attr)
171171
assert nlsys.name == 'sys$converted'
172+
np.testing.assert_allclose(
173+
nlsys.dynamics(0, [1, 2, 3, 4], [0, 0], {}),
174+
sys.A @ np.array([1, 2, 3, 4]))
172175

173176
# Put names back to defaults
174177
nlsys = ct.nlsys(

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy