- Notifications
You must be signed in to change notification settings - Fork441
Description
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, inmul newsys = InterconnectedSystem(
File "/usr/local/anaconda3/envs/c/lib/python3.9/site-packages/control/iosys.py", line 895, ininit 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 functioninit 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 objectinit 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.