GSOC 2014 Idea: Control Theory

110 views
Skip to first unread message

Maciek Barański

unread,
Mar 10, 2014, 3:25:46 PM3/10/14
to sy...@googlegroups.com
Hello everyone! I'm Maciej Barański, a student of Automatics and Robotics from University of Science and Technology in Cracov (AGH). 
I'd like to make a functionality for dealing with LTI systems, like linearization, getting output of the system, checking if the system is stable, controllable and observable, making feedback control and implement a linear kalman's filter. Is it a valid idea for GSOC project? I've seen http://www.mcs.anl.gov/~wozniak/papers/wozniak_mmath.pdf

My github account: https://github.com/getrox
My IRC nickname: getrox

I've made a pull request: https://github.com/sympy/sympy/pull/7254

Thank you
Maciej

Jason Moore

unread,
Mar 11, 2014, 4:08:26 PM3/11/14
to sy...@googlegroups.com
Maciej,

Why do you think this is appropriate for a CAS like SymPy? Most control work is done numerically, probably because most systems are such high order that symbolics become less useful. Are there even any commercial examples of symbolic control toolboxes? What is the ultimate utility of having one?

--
You received this message because you are subscribed to the Google Groups "sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sympy+un...@googlegroups.com.
To post to this group, send email to sy...@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/34a44d07-2b5e-47f0-be21-52b1206dcacd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Tim Lahey

unread,
Mar 11, 2014, 4:10:36 PM3/11/14
to sy...@googlegroups.com
Maple has a symbolic control toolbox.

Jason Moore

unread,
Mar 11, 2014, 4:12:33 PM3/11/14
to sy...@googlegroups.com

Tim Lahey

unread,
Mar 11, 2014, 4:25:42 PM3/11/14
to sy...@googlegroups.com

That's not the one I was talking about. I'm talking about the Control Design Toolbox,

http://www.maplesoft.com/products/toolboxes/control_design/

That said, MapleSim is a symbolic tool that uses a numerical back-end to solve the system of DAEs. MapleSim uses graph theory to derive the set of equations symbolically. I know because the core of it was developed by people in my department. I was a system called DynaFlex that they built a more user-friendly UI and added new capabilities. The original version of DynaFlex was co-supervised by my PhD supervisor.

Cheers,

Tim.

---
Tim Lahey, Ph.D.
Post-Doctoral Fellow
Systems Design Engineering
University of Waterloo
> To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAP7f1AiQPfHDOAZiPXFkUiFrO2YONaZz%3DSSJw8yg8g6WKS0k0Q%40mail.gmail.com.

Tim Lahey

unread,
Mar 11, 2014, 4:28:28 PM3/11/14
to sy...@googlegroups.com
Oh,

I misread your e-mail. You had the right toolbox, but if you read, you'll find that it does a lot of symbolic manipulation and derivation. The toolbox then supports bringing the designed controller into MapleSim.

Cheers,

Tim.

Jason Moore

unread,
Mar 11, 2014, 4:54:41 PM3/11/14
to sy...@googlegroups.com
Maciej,

Can you provide us with some example SymPy code demonstrating how you want the control tool box to work?

Maciek Barański

unread,
Mar 16, 2014, 8:32:49 AM3/16/14
to sy...@googlegroups.com

Jason Moore

unread,
Mar 16, 2014, 11:10:16 AM3/16/14
to sy...@googlegroups.com
Cool. That looks useful. If you start using Symbols the results get more complicated but with this change:

from sympy import symbols
from sympy.matrices import Matrix
from sympy.core.symbol import Symbol
from sympy.polys.polytools import Poly
from sympy.solvers.solvers import solve


def place(A, B, p):
    K_symbols = symbols('k0:{0}'.format(A.rows))
    K = Matrix([[ k for k in K_symbols]])
    closed_coeffs = Matrix((A - B * K).berkowitz()[2])
    desired_poly = Poly([1],Symbol('lambda'))
    for pole in p:
        desired_poly = desired_poly * Poly([1, -pole],Symbol('lambda'))
    desired_coeffs = Matrix(desired_poly.all_coeffs())
    return K.subs(solve(closed_coeffs - desired_coeffs, K_symbols))


if __name__ == "__main__":
    from sympy.abc import a, b, c, d
    A = Matrix([[0, 0, a], [a, 0, a], [a, 0, 0]])
    B = Matrix([0, 0, a])
    p = [b, c, d]
    print place(A, B, p)

You get some interesting symbolic functions for the gains:

moorepants@moorepants-UL30A:Desktop$ python pole_placement.py
Matrix([[(a*(a**2 + b*c + b*d + c*d) + b*c*d)/a**3, -b*c*d/a**3, -(b + c + d)/a]])

The symbolic form, for simple systems, can be very powerful for seeing how the gains are a function of the system (A, B) and the desired poles.

Maciek Barański

unread,
Mar 16, 2014, 9:14:34 PM3/16/14
to sy...@googlegroups.com
I've fixed an easier bug to be sure that it will be merged in the right time.

Reply all
Reply to author
Forward
0 new messages