-
Notifications
You must be signed in to change notification settings - Fork 438
Observability Gramian for discrete-time systems #967
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Expected output should be this I think:
|
Where is the documentation on slycot? I tried googling and found the API but couldn't find anything specific on From wikipedia, the two equations that need to be solved are quite similar: Observability Gramian for a continuous-time system: Observability Gramian for a discrete-time system: So I guess I just need to figure out how to do the second one. Any advice/pointers would be appreciated. |
There is no hosted doc of Slycot (yet) (python-control/Slycot#202).
You are probably looking for the |
Okay well that was easy. If I simply allow The code is all there, just commented-out: # TODO: Check for continuous or discrete, only continuous supported for now
# if isCont():
# dico = 'C'
# elif isDisc():
# dico = 'D'
# else: I simply replaced above with: if sys.isctime():
dico = 'C'
elif sys.isdtime():
dico = 'D'
else:
raise ValueError("sys") Is there a reason this wasn't implemented? Maybe at the time of writing |
Unless anyone knows of a problem with this, I'll just go ahead and implement it, including updated unit tests. |
I noticed this check for stability in the continuous-time case: # Check for continuous or discrete
if sys.isctime():
dico = 'C'
# TODO: Check system is stable, perhaps a utility in ctrlutil.py
# or a method of the StateSpace class?
if np.any(np.linalg.eigvals(sys.A).real >= 0.0):
raise ValueError("Oops, the system is unstable!") Is this the right way to do this for discrete-time systems? elif sys.isdtime():
dico = 'D'
if np.any(np.abs(sys.poles()) >= 1.):
raise ValueError("Oops, the system is unstable!") Correct me if I'm wrong but we don't have an |
I've submitted the pull request. One other thing I noticed, the gram function has an argument def gram(sys, type): Should we change this to something else? Or we could replace |
Fixed in #969. |
I noticed in the source code for the gram function that it says only continuous-time systems are supported for now:
python-control/control/statefbk.py
Lines 1122 to 1127 in 85328d9
I checked and it doesn't raise an exception when you pass a discrete time system but I don't think this means it is calculating a gramian for a discrete-time system:
What would it take to get it working for discrete time systems? Is it simply a different call to the same slycot module, sb03md, or is it more involved?
Since I need it I'd be happy to try implementing it.
The text was updated successfully, but these errors were encountered: