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

Commita8b72f5

Browse files
committed
avoid different realizations with and without slycot
1 parent4404169 commita8b72f5

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

‎control/tests/timeresp_test.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,18 @@ def tsystem(self, request):
126126
[0. ,-0.1097,-0.1902,-0.2438,-0.2729,
127127
-0.2799,-0.2674,-0.2377,-0.1934,-0.1368])
128128

129+
"""dtf1 converted statically, because Slycot and Scipy produce
130+
different realizations, wich means different initial condtions,"""
129131
siso_dss1=copy(siso_dtf1)
130-
siso_dss1.sys=tf2ss(siso_dtf1.sys)
131-
siso_dss1.yinitial=np.array([-1.,-0.5,0.75,-0.625,0.4375])
132+
siso_dss1.sys=StateSpace([[-1.,-0.25],
133+
[1.,0.]],
134+
[[1.],
135+
[0.]],
136+
[[0.,1.]],
137+
[[0.]],
138+
True)
139+
siso_dss1.X0= [0.5,1.]
140+
siso_dss1.yinitial=np.array([1.,0.5,-0.75,0.625,-0.4375])
132141

133142
siso_dss2=copy(siso_dtf2)
134143
siso_dss2.sys=tf2ss(siso_dtf2.sys)
@@ -647,12 +656,10 @@ def test_forced_response_legacy(self):
647656
@pytest.mark.parametrize(
648657
"tsystem, fr_kwargs, refattr",
649658
[pytest.param("siso_ss1",
650-
{'X0': [0.5,1],'T':np.linspace(0,1,10)},
651-
'yinitial',
659+
{'T':np.linspace(0,1,10)},'yinitial',
652660
id="ctime no U"),
653661
pytest.param("siso_dss1",
654-
{'T':np.arange(0,5,1,),
655-
'X0': [0.5,1]},'yinitial',
662+
{'T':np.arange(0,5,1,)},'yinitial',
656663
id="dt=True, no U"),
657664
pytest.param("siso_dtf1",
658665
{'U':np.ones(5,)},'ystep',
@@ -670,6 +677,8 @@ def test_forced_response_legacy(self):
670677
indirect=["tsystem"])
671678
deftest_forced_response_T_U(self,tsystem,fr_kwargs,refattr):
672679
"""Test documented forced_response behavior for parameters T and U."""
680+
ifrefattr=='yinitial':
681+
fr_kwargs['X0']=tsystem.X0
673682
t,y=forced_response(tsystem.sys,**fr_kwargs)
674683
np.testing.assert_allclose(t,tsystem.t)
675684
np.testing.assert_allclose(y,getattr(tsystem,refattr),rtol=1e-3)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp