Skip to content

Implement missing type conversions for block diagram algebra #513

Description

@murrayrm

As described in issue #459 and PR #498, there are a number of type conversions for various overloaded operators that are not yet implemented. A table of the current and desired operations can be found in control/tests/type_conversion_test.py.

A few of the more useful ones:

  • SISO StateSpace objects should be allowed to serve as a quotient under appropriate circumstances (so that you can write things like T = P*C/(1 + P*C) with state space objects, as you currently can with transfer functions.
  • FrequencyResponseData and InputOutputSystem objects should be able to interact with floats and arrays.
  • InputOutputSystem objects should be able to interact with LTI systems by converting the LTI system into a LinearIOSystem.
  • FrequencyResponseData systems should be able to be combined with StateSpace and TransferFunction options by evaluating the state space system or transfer function at the FRD frequencies.

Activity

  1. added this to the 0.9.x milestone on Jan 18, 2021
  2. sawyerbfuller commented on Feb 11, 2021

    @sawyerbfuller
    Contributor

    (this was originally its own issue, #541, but I copied the comment into here and closed that issue to keep discussion about its possible implementation in this more general thread.)

    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.

  3. murrayrm commented on Dec 30, 2021

    @murrayrm
    MemberAuthor

    A number of these conversions have been implemented in #672. Leaving this issue open since there are still a few cases that aren't handled (see table in tests/type_conversion_test.py).

  4. removed this from the 0.9.1 milestone on Dec 30, 2021
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