From: Ryan K. <rk...@si...> - 2011-04-07 17:18:40
|
I think the idea of having toSISO be a property of the system makes a lot of sense. At worst, I would have to override it once for each system that I analyze. We could allow it to be overwritten in the function calls if we wanted to, but default to the instance property if it is not passed in: def bode(self, ...., toSISO=None): if toSISO is None: toSISO = self.toSISO Just my thoughts. Ryan On Thu, Apr 7, 2011 at 11:47 AM, Steve Brunton <sbr...@pr...> wrote: > Hi All, > > This idea of having keywords to change the output format is what we had in mind when extending to MIMO (as well as whether to plot or just return output for a command like 'bode'). A a nice interface might have a SISO system default toSISO=True, a MIMO system would default toMIMO=True, and there would be the option to have a SISO system output as a MIMO system (for example if you have scripts that work on both SISO and MIMO outputs). > > Even Matlab doesn't have this completely sorted out. When I do [m,p,w]=bode(sys,w), I still have to squeeze the output for a SISO system. > > -S,L,K,B > > > On Apr 7, 2011, at 11:15 AM, Ryan Krauss wrote: > >> I think this essentially makes sense, but I use the toolbox with my >> undergrads who are new to python. They might find it annoying to have >> to pass in the extra keyword argument toSISO=True every time they >> generate a Bode plot or something. Can we try to intelligently guess >> what toSISO should be in the code? i.e. if the system has only one >> input and one output, assume toSISO=True. We may be able to make this >> work by using numpy.squeeze on all array outputs. >> >> Ryan >> >> -- >> Ryan Krauss, Ph.D. >> Assistant Professor >> Mechanical Engineering >> Southern Illinois University Edwardsville >> >> >> >> On Thu, Apr 7, 2011 at 9:56 AM, Richard Murray <mu...@cd...> wrote: >>> I noticed this change as well. If you are just using the various functions in python-control, everything works fine (eg, none of the examples had to change). But if you are extracting frequency responses or otherwise playing with data generated from your system, this is a bit of a hassle. >>> >>> Here is a proposal: >>> >>> * For all functions in python-control that accept MIMO systems (all of them eventually), we add two keywords: >>> >>> - toSISO=True will force output to be SISO-like (v0.3) if inputs==1, outputs==1 >>> - toSISO=(n, m) will give you SISO-like output for the nth input to mth output >>> - toMIMO=True will force the output to be MIMO-like even if inputs==1, outputs==1 >>> >>> * For the Python interface, the default will be toMIMO=True, so that you get the current behavior. If you want the scalar version of the outputs, you just add toSISO=True as a keyword. >>> >>> * For the MATLAB interface, the default will toSISO=True, so that you get MATLAB-like behavior if you extract data from bode(), freqresp(), etc. >>> >>> One problem with this is that you can have conflicts if you give *both* sets of keywords. Sometimes this makes sense ("toSISO=(2,3) toMIMO=True"), but sometimes it doesn't ("toSISO=True, toMIMO=True"). So probably needs a bit more thought. But the idea is that the following code: >>> >>> (mag, phase, omega) = bode(sys) >>> plot(omega[0][0]), mag[0][0]) >>> >>> becomes >>> >>> (mag, phase, omega) = bode(sys, toSISO=True) >>> plot(omega, mag) >>> >>> which I think is a bit cleaner. >>> >>> Comments, suggestions? >>> >>> -richard >>> >>> >>> >>> On 6 Apr 2011, at 14:19 , Sawyer Fuller wrote: >>> >>>> Hey i just downloaded the latest version of python-control and it looks like everything has gone MIMO. Pretty cool, but is there any way to way to stick to SISO, eg a subclass or flag? A little bit of a drag to constantly be appending [0][0] to every frequency response for the most common use case. I think matlab does a special-case for SISO. Anything like that in the works or somewhere i'm not finding it? >>>> >>>> S >>>> >>>> >>>> ------------------------ >>>> Sawyer B. Fuller >>>> Ph.D. Candidate, Bioengineering >>>> California Institute of Technology >>>> http://www.cds.caltech.edu/~minster/ >>>> >>>> >>>> ------------------------------------------------------------------------------ >>>> Xperia(TM) PLAY >>>> It's a major breakthrough. An authentic gaming >>>> smartphone on the nation's most reliable network. >>>> And it wants your games. >>>> http://p.sf.net/sfu/verizon-sfdev_______________________________________________ >>>> python-control-discuss mailing list >>>> pyt...@li... >>>> https://lists.sourceforge.net/lists/listinfo/python-control-discuss >>> >>> >>> ------------------------------------------------------------------------------ >>> Xperia(TM) PLAY >>> It's a major breakthrough. An authentic gaming >>> smartphone on the nation's most reliable network. >>> And it wants your games. >>> http://p.sf.net/sfu/verizon-sfdev >>> _______________________________________________ >>> python-control-discuss mailing list >>> pyt...@li... >>> https://lists.sourceforge.net/lists/listinfo/python-control-discuss >>> >> >> ------------------------------------------------------------------------------ >> Xperia(TM) PLAY >> It's a major breakthrough. An authentic gaming >> smartphone on the nation's most reliable network. >> And it wants your games. >> http://p.sf.net/sfu/verizon-sfdev >> _______________________________________________ >> python-control-discuss mailing list >> pyt...@li... >> https://lists.sourceforge.net/lists/listinfo/python-control-discuss > > > ------------------------------------------------------------------------------ > Xperia(TM) PLAY > It's a major breakthrough. An authentic gaming > smartphone on the nation's most reliable network. > And it wants your games. > http://p.sf.net/sfu/verizon-sfdev > _______________________________________________ > python-control-discuss mailing list > pyt...@li... > https://lists.sourceforge.net/lists/listinfo/python-control-discuss > |