Hi , Previously on this thread ,I had talked about some ideas regarding the control module as a project for GSOC'22 .I have done some research on them and come up with Broad Ideas In Scope To Work On . I request the community to comment on it and add to it .I would also request potential mentors Jason K Moore , Akshansh Bhatt to name a few to have a look at it and review it .I think there is a good scope of improvement in the control package. Once I am certain with the priority order of these ideas I will start drafting a concrete proposal .
These are the ideas that I have accumulated by observing work done in previous years and checking out other CST frameworks .Implementation of all ideas would take extensive discussions with mentors along with a bunch of new unit tests to check their functioning. 1. Complete pending work from previous years in the control package . Making a well documented module with examples and illustrations was one of Naman’s objectives .It was because people always tend to use softwares with top notch documentation. So PR #22124 <https://github.com/sympy/sympy/pull/22124> will be completed with more examples from documentation of MATLAB and python-control .I also have a course textbook for my control-systems course and can always refer to that for illustrations. Another pending thing I can observe which Akshansh had attempted but could not get merged due to some performance issues is the root_locus_plot , there are relevant comments on his PR #21763 <https://github.com/sympy/sympy/pull/21763> regarding this . Along with that the 2 other plots which were proposed to be added in the future were nyquist_plot and nichols_plot. 2. Some bugs need to be fixed and along with that minor changes can be made to the transfer function API ideas.Some of these were pointed out in previous year’s proposal but I believe are not fixed yet. 1. I have spotted a bug and raised an issue #23247 <https://github.com/sympy/sympy/issues/23247> .Transfer function should not be able to take non-polynomial expressions as input (eg -sin(x) , 2^(x)). 2. SymPy being a symbolic library ,subs( ) and rewrite( ) are useful properties. ‘TransferFunction’ is basically a rational function ,so it will be a good addition if users can access these methods. ‘TransferFunction’ inherits ‘Basic’,so this can be done. ‘TransferFunctionMatrix’ also lacks these properties. 3. Restructuring some parts of the code , I feel some functions are unutilized .Minor functionalities for ‘TransferFunction' that are a part of other CST frameworks like MATLAB can be made a part of SymPy too. Some of these are - - bandwidth(system) - First frequency where gain drops by -3dB of DC value. - margin(system) - Gives gain-margin and phase-margin which are used to visualize marginal stability that SymPy’s ‘is_stable()’ gives no information about. 4. Possible improvements in 'TransferFunction' / 'TransferFunctionMatrix' API - - Making input ‘var’ in ‘TransferFunction’ optional instead of compulsory. Users will only have to specify the variable when there is a conflict. - Allowing a MATLAB-like input scheme where users just have to input coefficients of particular degrees of the Transfer Function in order.I personally feel it is an efficient method of input and will itself eliminate many input issues, one of them pointed above as use of non-polynomials. For eg. - >>Sys = tf([1, 2] ,[1, 2, 3]) >>Sys(s) (s**2 + 2*s)/(s**2 + 2*s + 3) - Allowing a declared rational expression to be taken as input in ‘TransferFunction’ to reduce size - For eg. - # Current >>> tf1 = TransferFunction(1,1+s,s) >>> tf2 = TransferFunction(2,2+s,s) >>> t = TransferFunctionMatrix([[tf1, tf2],[-tf1,-tf2]]) # Proposing to allow >>> exp1 =1/1+s >>> exp1 = 1/(1+s) >>> exp2 = 2/(2+s) >>> t = TransferFunctionMatrix([[exp1, exp2],[-exp1,-exp2]]) - Adding support for ‘TransferFunctionMatrix’ objects to be instantiated by passing a list of numerators and a common denominator. This can be an alternative way of object creation. 3. Introducing ‘StateSpace’ model for effectively representing a State Space system symbolically. These 3 functions would be essential for State Space system- - is_observable( StateSpaceModel ) - observability_matrix( StateSpaceModel ) - observable_subspace( StateSpaceModel ) 4. Implementing Discrete-time ‘TransferFunction’ model. Discussing the API and making things compatible with the current implementation is a challenge as suggested in Akshansh’s Gsoc 2021 report. I hope this makes for a suitable project to work on ! Over the next few days I will be doing a more in depth research for more ideas / scope of improvement. Thanks for your time and efforts in going through the content . Regards, Anurag . On Saturday, March 12, 2022 at 10:31:02 AM UTC+5:30 Anurag Surendra Bhat (B20CS097) wrote: > Hi Eeshaan, > The control package in sympy is developing since 2020 but not nearly as > powerful as in MATLAB . Thanks for the suggestion ,I'll surely explore it ! > > Regards, > Anurag. > > On Friday, March 11, 2022 at 10:11:27 PM UTC+5:30 Eeshaan Jain wrote: > >> Hey, >> I'm somewhat unsure, but as far as I've used sympy for controls, I >> couldn't find an equivalent for finding the frequency response of a digital >> filter in sympy. There is freqz which does this in MATLAB. >> >> Thanks >> >> On Thu, Mar 10, 2022, 9:24 PM Anurag Surendra Bhat (B20CS097) < >> [email protected]> wrote: >> >>> Hello sympy community, >>> I am Anurag Bhat , a computer science and engineering sophomore at IIT >>> Jodhpur, India .I have been contributing to SymPy for quite a while now and >>> here is a link to my work - >>> https://github.com/sympy/sympy/pulls/faze-geek >>> >>> I have done work in the physics module and recently developed interest >>> in 'physics.control' module after Akshansh Bhatt( GSOC'21 contributor to >>> this module) recently merged my pr relevant to control plots - #23074 >>> <https://github.com/sympy/sympy/pull/23074> -* physics : Improved >>> Bode's phase and magnitude plots.* >>> I have previously covered a introduction to control systems in a college >>> course - Signals and Systems . I also had made a basic project like >>> implementation of a system for denoising then deblurring signals V.S. >>> system for deblurring then denoising signals.(File - >>> https://drive.google.com/file/d/1iZDy8O7V5Hi703P7BPFScx0bAFgrM6na/view?usp=sharing >>> ) >>> >>> Coming to the project I have gone over the online sympy documentation of >>> control systems .I have had a brief idea of what proposal writing is like >>> after I went through Akshansh's proposal for last year .I have read the >>> google groups discussion on what use/value does a control package bring to >>> sympy ( Re: [Discussion] GSoC 2020 -- Adding control package to >>> sympy.physics (google.com) >>> <https://groups.google.com/g/sympy/c/wX9BPLcJu50/m/wwxjlZTLAQAJ> ) . >>> Some ideas I got from seeing the previous work done are - >>> 1. Some minor functionalities that MATLAB provides but sympy currently >>> doesn't for transfer functions for it's bandwidth , partial stability etc. >>> 2. Adding more examples and illustrations for the previous work done . >>> 3. Implementing remaining plots in control.plots for eg - root-locus >>> plot , nyquist plot >>> 4. Making TransferFunctionMatrix take numerator/denominator inputs in >>> list format like MATLAB does . >>> >>> I have started finalizing/compiling all this matter since SymPy was >>> announced to participate in GSOC this year so I'm sure I would have missed >>> some ideas and improvements .Here I would like help from the members of the >>> community .Firstly I would appreciate any suggestions/help/resources >>> regarding this module .Secondly I would request past mentors ( Jason Moore) >>> and Gsocer's /potential co-mentors( Naman and Akshansh) to guide if these >>> are good ideas to work on, add ideas and show me proper direction since >>> this is my first time exploring the field of open source . >>> >>> >>> Regards >>> Anurag Bhat. >>> >>> -- >>> 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 [email protected]. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/sympy/0dfd01c5-ab44-4624-bdba-9cb76ebc28cbn%40googlegroups.com >>> >>> <https://groups.google.com/d/msgid/sympy/0dfd01c5-ab44-4624-bdba-9cb76ebc28cbn%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >> -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/ec6fbe70-0021-49d8-a642-5c10b9596ad6n%40googlegroups.com.
