GithubHelp home page GithubHelp logo

Comments (8)

bnavigator avatar bnavigator commented on June 21, 2024 1

There is no hosted doc of Slycot (yet) (python-control/Slycot#202).

  • You can look at the documentation of SLICOT's SB03MD
  • There are the docstrings, which are used by IDEs like spyder to render documentation on-the-fly.

You are probably looking for the dico='D' parameter of slycot.sb03md57.
image

image

from python-control.

billtubbs avatar billtubbs commented on June 21, 2024

Expected output should be this I think:

array([[ 2.06193690, -0.57482614],
       [-0.57482614,  0.78661650]])

from python-control.

billtubbs avatar billtubbs commented on June 21, 2024

Where is the documentation on slycot? I tried googling and found the API but couldn't find anything specific on sb03md.

From wikipedia, the two equations that need to be solved are quite similar:

Observability Gramian for a continuous-time system:
$$A^T W_o + W_o A = -C^T C$$

Observability Gramian for a discrete-time system:
$$A^T W_{o} A - W_{o} = -C^T C$$

So I guess I just need to figure out how to do the second one.

Any advice/pointers would be appreciated.

from python-control.

billtubbs avatar billtubbs commented on June 21, 2024

Okay well that was easy. If I simply allow dico='D' option it calculates the correct Gramians.

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 isCont and isDisc didn't exist and the author was planning to come back and finish it but didn't perhaps?

from python-control.

billtubbs avatar billtubbs commented on June 21, 2024

Unless anyone knows of a problem with this, I'll just go ahead and implement it, including updated unit tests.

from python-control.

billtubbs avatar billtubbs commented on June 21, 2024

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 sys.isstable method yet.

from python-control.

billtubbs avatar billtubbs commented on June 21, 2024

I've submitted the pull request.

One other thing I noticed, the gram function has an argument type which is a reserved Python keyword.

def gram(sys, type):

Should we change this to something else?

Or we could replace gram with obsv_gram and ctrl_gram.

from python-control.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.