You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Implement missing type conversions for block diagram algebra #513
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.
(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:
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:
Test for instances of StateSpace correctly and dispatch. This seems to be onerous and at odds with how inheritance ought to make things easier.
In the __init__ method of LinearIOSystem, delete those methods
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.
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).
Activity
sawyerbfuller commentedon Feb 11, 2021
(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:
raise NotImplemented("Scalar multiplication not yet implemented")This is because
InputOutputSystemsdefine various methods, e.g.__mul__that override those inStateSpaceand some are not implemented yet.Options that come to mind if we want this to work better:
StateSpacecorrectly and dispatch. This seems to be onerous and at odds with how inheritance ought to make things easier.__init__method ofLinearIOSystem, delete those methodsLinearIOSystemwhen it makes sense to create a newLinearICSystem)Related: many of the methods like
__mul__don't act onselfandotherbut rathersys1andsys2. This might still work, but I think the first argument should beselfaccording to Python convention.murrayrm commentedon Dec 30, 2021
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).