Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit98fba6e

Browse files
sawyerbfullerbnavigator
authored andcommitted
use standard method to assess whether a system is a static gain, so that it has dt=None by default, when constructing a LinearIOSystem
1 parentdc633d0 commit98fba6e

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

‎control/statesp.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,9 +346,8 @@ def __init__(self, *args, init_namedio=True, **kwargs):
346346
defaults=args[0]iflen(args)==1else \
347347
{'inputs':D.shape[1],'outputs':D.shape[0],
348348
'states':A.shape[0]}
349-
static= (A.size==0)
350349
name,inputs,outputs,states,dt=_process_namedio_keywords(
351-
kwargs,defaults,static=static,end=True)
350+
kwargs,defaults,static=self._isstatic(),end=True)
352351

353352
# Initialize LTI (NamedIOSystem) object
354353
super().__init__(

‎control/tests/iosys_test.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ class TSys:
4141
[[-1,1], [0,-2]], [[0,1], [1,0]],
4242
[[1,0], [0,1]],np.zeros((2,2)))
4343

44+
# Create a static gain linear system
45+
T.staticgain=ct.StateSpace(0,0,0,1)
46+
4447
# Create simulation parameters
4548
T.T=np.linspace(0,10,100)
4649
T.U=np.sin(T.T)
@@ -70,6 +73,12 @@ def test_linear_iosys(self, tsys):
7073
# system results in a LinearIOSystem
7174
assertisinstance(linsys*iosys,ios.LinearIOSystem)
7275

76+
# Make sure that a static linear system has dt=None
77+
# and otherwise dt is as specified
78+
assertios.LinearIOSystem(tsys.staticgain).dtisNone
79+
assertios.LinearIOSystem(tsys.staticgain,dt=.1).dt==.1
80+
81+
7382
deftest_tf2io(self,tsys):
7483
# Create a transfer function from the state space system
7584
linsys=tsys.siso_linsys

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp