[SciPy-user] signal.lti __mul__ and feedback

Ryan Krauss ryanlists at gmail.com
Sat Oct 21 13:11:03 CDT 2006


As I continue to try to make scipy.signal a replacment for the Matlab
controls toolbox, I need to be able to multiply signal.lti instances
by other instances and by constants (to model a controller transfer
function times a plant transfer function) and I need to create a
feedback command (i.e. closed-loop tf= Gc*Gp/(1+Gc*Gp) if Gc is the
controller transfer function and Gp is the plant transfer function -
assuming unity feedback).  I wanted to make sure these things haven't
already been done and ask for any input before I get started.  I was
basically planning to define __mul__ and __rmul__ for multiplication
by integers, floats, or other lti instances.  When multpliying by
other instances, I was going to just multiply the numerators and
denominators seperately and let poly1d handle that.  The only problem
with that is what to do when there should be a cancelation (i.e.
(s+1)/(s+2)*(s+3)/(s+1)= [(s+3)*(s+1)]/[(s+2)*(s+1)]).  Once an
__add__ method is defined as well, feedback is easy (I guess I would
need a __div__ and probably an __rdiv_ as well).

I had started a seperate controls module before I knew about the
signal.lti stuff.  It is attached.  It would have to be seperated from
some of my other modules to make it more portable, but most of what I
am talking about could be done by making my TransferFunction class
derive from signal.lti (or incorporate all of its methods into
signal.lti).  Any thoughts on this?

Thanks,

Ryan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: controls.py
Type: text/x-python
Size: 9441 bytes
Desc: not available
Url : http://projects.scipy.org/pipermail/scipy-user/attachments/20061021/c27f70ef/attachment.py 


More information about the SciPy-user mailing list