GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Bug: Incorrect ValueError: incompatible timebases · Issue #754 · python-control/python-control

Bug: Incorrect ValueError: incompatible timebases #754

New issue
Copy link
New issue
Copy link
Closed
Closed
Bug: Incorrect ValueError: incompatible timebases#754
Copy link
Assignees
murrayrm
Labels
bug

Description

@dc5048
dc5048
opened on Aug 2, 2022
Issue body actions

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 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.

Activity

  1. bnavigator
    added
    bug
    on Aug 3, 2022
  2. sawyerbfuller commented on Aug 3, 2022

    @sawyerbfuller
    sawyerbfuller
    on Aug 3, 2022 via email
    Contributor
    More actions
    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)
  3. dc5048 commented on Aug 3, 2022

    @dc5048
    dc5048
    on Aug 3, 2022
    Author
    More actions

    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()
    
  4. murrayrm
    self-assigned this
    on Aug 4, 2022
  5. murrayrm
    added 2 commits that reference this issue on Aug 4, 2022

    fix timebase bug in InterconnectedSystem (issue python-control#754)

    9341103

    fix timebase bug in InterconnectedSystem (issue python-control#754)

    f17c919
  6. bnavigator
    added a commit that references this issue on Aug 6, 2022

    Merge pull request #755 from murrayrm/timebase_bug-03Aug2022

    b9cf384
  7. bnavigator commented on Aug 6, 2022

    @bnavigator
    bnavigator
    on Aug 6, 2022
    Contributor
    More actions

    Fixed by #755. Thanks @murrayrm !

  8. bnavigator
    closed this as completedon Aug 6, 2022
  9. Ryton commented on Nov 4, 2022

    @Ryton
    Ryton
    on Nov 4, 2022
    More actions

    this still seems broken in
    commit = 'g3b5f199'
    VERSION
    0.9.2

    As the minimal example throws an error for me.

  10. bnavigator commented on Nov 4, 2022

    @bnavigator
    bnavigator
    on Nov 4, 2022
    Contributor
    More actions

    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.

  11. Ryton commented on Nov 9, 2022

    @Ryton
    Ryton
    on Nov 9, 2022
    More actions

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @murrayrm
    murrayrm

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402520 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.