Skip to content

LinearIOSystems cannot be multiplied by a scalar/array #541

Description

@sawyerbfuller

The following code causes a bug when it tries to raise an error:

import control as ct
import control.iosys as io
2*io.ss2io(ct.ss(1,1,1,1))

raise NotImplemented("Scalar multiplication not yet implemented")

This is because InputOutputSystems define various methods, e.g. __mul__ that override those in StateSpace and some are not implemented yet.

Options that come to mind if we want this to work better:

  1. Test for instances of StateSpace correctly and dispatch. This seems to be onerous and at odds with how inheritance ought to make things easier.
  2. In the __init__ method of LinearIOSystem, delete those methods
  3. move those operations to NonLinearIOSystem (and override as necessary in LinearIOSystem when it makes sense to create a new LinearICSystem)

Related: many of the methods like __mul__ don't act on self and other but rather sys1 and sys2. This might still work, but I think the first argument should be self according to Python convention.

Activity

  1. murrayrm commented on Feb 11, 2021

    @murrayrm
    Member

    See also issue #513, which has a long list of missing conversions.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions