GeezerVison is showing github.com — Bug: Incorrect ValueError: incompatible timebases · Issue #754 · python-control/python-control
Bug: Incorrect ValueError: incompatible timebases #754DescriptionUsing control.series to connect several discrete state-space systems, all with dt=0.05, is resulting in "ValueError:Systems have incompatible timebases" from "common_timebase" in namedio.py line 340 in release 0.9.2.
File "/usr/local/anaconda3/envs/c/lib/python3.9/site-packages/control/bdalg.py", line 108, in series return reduce(lambda x, y:y*x, sysn, sys1)
File "/usr/local/anaconda3/envs/c/lib/python3.9/site-packages/control/bdalg.py", line 108, in return reduce(lambda x, y:y*x, sysn, sys1)
File "/usr/local/anaconda3/envs/c/lib/python3.9/site-packages/control/iosys.py", line 184, in mul newsys = InterconnectedSystem(
File "/usr/local/anaconda3/envs/c/lib/python3.9/site-packages/control/iosys.py", line 895, in init dt = common_timebase(dt, sys.dt)
File "/usr/local/anaconda3/envs/c/lib/python3.9/site-packages/control/namedio.py", line 340, in common_timebase raise ValueError("Systems have incompatible timebases")
ValueError: Systems have incompatible timebases
In my case, the calling function init in iosys.py, line 895 is initializing "dt" as 0 from the global default then passing this as the first arg to common_timebase, while the second arg is the sys.dt from the first system in the list of systems being combined. This results in the ValueError. All systems in syslist have dt = 0.05 and pass common_timebase with each other when passed as args manually while stopped in debugger.
It seems like the intent for the object init functions in this module is probably that dt should be initialized as the dt of the first system in the syslist, but that is not what the code is doing.
As a work-around, running the same script with release 0.9.1 works. Activitysawyerbfuller commented on Aug 3, 2022 Thanks for the pointer. Sounds like a bug might have been introduced in a
change to underlying code for how state-space systems are handled. Could
you post code that reproduces the bug?
S
On Tue, Aug 2, 2022 at 4:08 PM DC ***@***.***> wrote:
Using control.series to connect several discrete state-space systems, all
with dt=0.05, is resulting in "ValueError:Systems have incompatible
timebases" from "common_timebase" in namedio.py line 340 in release 0.9.2.
File
"/usr/local/anaconda3/envs/c/lib/python3.9/site-packages/control/bdalg.py",
line 108, in series return reduce(lambda x, y:y*x, sysn, sys1)
File
"/usr/local/anaconda3/envs/c/lib/python3.9/site-packages/control/bdalg.py",
line 108, in return reduce(lambda x, y:y*x, sysn, sys1)
File
"/usr/local/anaconda3/envs/c/lib/python3.9/site-packages/control/iosys.py",
line 184, in *mul* newsys = InterconnectedSystem(
File
"/usr/local/anaconda3/envs/c/lib/python3.9/site-packages/control/iosys.py",
line 895, in *init* dt = common_timebase(dt, sys.dt)
File
"/usr/local/anaconda3/envs/c/lib/python3.9/site-packages/control/namedio.py",
line 340, in common_timebase raise ValueError("Systems have incompatible
timebases")
ValueError: Systems have incompatible timebases
In my case, the calling function *init* in iosys.py, line 895 is
initializing "dt" as 0 from the global default then passing this as the
first arg to common_timebase, while the second arg is the sys.dt from the
first system in the list of systems being combined. This results in the
ValueError. All systems in syslist have dt = 0.05 and pass common_timebase
with each other when passed as args manually.
It seems like the intent for the object *init* functions in this module
is probably that dt should be initialized as the dt of the first system in
the syslist, but that is not what the code is doing.
As a work-around, running the same script with release 0.9.1 works.
—
Reply to this email directly, view it on GitHub
< #754>, or
unsubscribe
< https://github.com/notifications/unsubscribe-auth/AN74SSKKIWBHOWVEAL3O2H3VXGS55ANCNFSM55M2Z4CA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
--
Sawyer Fuller
Assistant Professor of Mechanical Engineering
Adjunct, Paul G Allen School of Computer Science
University of Washington
http://faculty.washington.edu/~minster/
(Typed with my thumbs) dc5048 commented on Aug 3, 2022 The following prints a 4-state state-space object in 0.9.1, but fails with ValueError in 0.9.2:
import control
def main():
''' recreate discrete state-space bug '''
A = [[1, 1], [0, 1]]
B = [[0], [1]]
C = [[1, 0]]
D = 0
sys1 = control.ss(A,B,C,D,0.05)
sys2 = control.ss(A,B,C,D,0.05)
sys3 = control.series(sys1, sys2)
print(sys3)
if __name__ == '__main__':
main()
bnavigator commented on Aug 6, 2022 Ryton commented on Nov 4, 2022 this still seems broken in
commit = 'g3b5f199'
VERSION
0.9.2
As the minimal example throws an error for me. bnavigator commented on Nov 4, 2022 I cannot find a commit g3b5f199. Where did you install python-control from?
The fix has been merged into the main branch with b9cf384 in August. It is not part of the 0.9.2 release as that one was in May. The next release will have the fix. Ryton commented on Nov 9, 2022 Installed it through anaconda
'''conda install -c conda-forge control slycot'''
print(control.version) gives: 0.9.2
conda list gives:
control 0.9.2 pyhd8ed1ab_0 conda-forge
No worries, just mentioning it, bc the issue was closed, i thought it should've been included already in the release.
But i can pull the main repo cherrypick the fixes.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|