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
Hello,
It seems to me that when I try to define a non-minimal state representation (e.g. with a state that can't be controlled or that doesn't have a dynamic) the system returned by the StateSpace class is automatically reduced, by eliminating such "non meaningful" states.
As example consider the following code:
from control import StateSpace
a = [[0., 0., 0.], [0., 0., 0.], [0., 0., 0.]]
b = [[1, 0], [0, 0], [0, 1]]
c = [[1, 0, 0], [0, 1, 0], [0, 0, 1]]
d = [[0, 0], [0, 0], [0, 0]]
x = StateSpace(a,b,c,d)
the obtained state representation is the following :
>>> x
A = [[0. 0.]
[0. 0.]]
B = [[1. 0.]
[0. 1.]]
C = [[1. 0.]
[0. 0.]
[0. 1.]]
D = [[0. 0.]
[0. 0.]
[0. 0.]]
where the second state has been removed. Is it possible to not have this automatic model reduction (regardless of the fact that such state is not meaningful ) ? I couldn't find anything in the documentation
@murrayrm@bnavigator
I am really sorry to keep bothering you, but this is still not working for me.
Do I need the package above a specific version (have 0.8.3)?
Am I doing anything stupid ?
I tried with both numpy array and lists for the definition of matrices A,B,C,D:
Python 3.8.5 (default, Jul 28 2020, 12:59:40)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import control as ctr
>>> ctr.config.set_defaults('statesp', remove_useless_states=False)
>>> a = [[0., 0., 0.], [0., 0., 0.], [0., 0., 0.]]
>>> b = [[1, 0], [0, 0], [0, 1]]
>>> c = [[1, 0, 0], [0, 1, 0], [0, 0, 1]]
>>> d = [[0, 0], [0, 0], [0, 0]]
>>> x = ctr.StateSpace(a,b,c,d)
>>> ctr.config._get_param('statesp', 'remove_useless_states')
False
>>> x
A = [[0. 0.]
[0. 0.]]
B = [[1. 0.]
[0. 1.]]
C = [[1. 0.]
[0. 0.]
[0. 1.]]
D = [[0. 0.]
[0. 0.]
[0. 0.]]
>>>
Python 3.8.5 (default, Jul 28 2020, 12:59:40)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from numpy import array
>>> from control import StateSpace
>>> from control.config import set_defaults, _get_param
>>> a = array([[0., 0., 0.], [0., 0., 0.], [0., 0., 0.]])
>>> b = array([[1, 0], [0, 0], [0, 1]])
>>> c = array([[1, 0, 0], [0, 1, 0], [0, 0, 1]])
>>> d = array([[0, 0], [0, 0], [0, 0]])
>>> set_defaults('statesp', remove_useless_states=False)
>>> x = StateSpace(a,b,c,d)
>>> _get_param('statesp', 'remove_useless_states')
False
>>> x
A = [[0. 0.]
[0. 0.]]
B = [[1. 0.]
[0. 1.]]
C = [[1. 0.]
[0. 0.]
[0. 1.]]
D = [[0. 0.]
[0. 0.]
[0. 0.]]
>>>
The _get_param function correctly reports the considered setting as False, still getting a reduced model
Activity
bnavigator commentedon Jan 30, 2021
Hello Dario,
this has recently been fixed in #509. Until it lands in a release, you can manually set
remove_useless_states=False:murrayrm commentedon Jan 30, 2021
Closing since this has been fixed (also duplicates #244).
DarioTurchi commentedon Jan 31, 2021
@murrayrm @bnavigator
I am really sorry to keep bothering you, but this is still not working for me.
Do I need the package above a specific version (have 0.8.3)?
Am I doing anything stupid ?
I tried with both numpy array and lists for the definition of matrices A,B,C,D:
The
_get_paramfunction correctly reports the considered setting asFalse, still getting a reduced modelsawyerbfuller commentedon Jan 31, 2021
murrayrm commentedon Jan 31, 2021
Yes, in v0.8.3 the keyword was called
remove_useless, so you have to useNote also that v0.8.3 did not use the
configmodule to set the default value, so callingset_defaultswon't work in that version.v0.8.4 changes the name of the keyword to
remove_useless_statesand sets the default value toTrue(but you can useset_defaultsto override).v0.9.0 (upcoming) sets the default value to
False.DarioTurchi commentedon Jan 31, 2021
Many thanks