#Final Report + GSoC Blog
This is a report to showcase my final report during Google Summer of Code 2024 with SymPy project. SymPy is a library that provides API for symbolic mathematics and physics computations.
The SymPy community has been very welcoming and supportive for me. I started contributing in SymPy and later developed interest for the control package. I applied for GSoC 2024 and got selected in SymPy for the the project Improving and Expanding the Functionalities of the Control Module.
#About Me
I'm Abhishek Kumar a final-year undergraduate student pursuing a major in Electronics and Communication Engineering from National Institute of Technology (NIT) Delhi. I'm interested in physics, algorithms and computer science. I like to contribute on open source repositories and collaborate on interesting projects.
#Project: Improving and Expanding the Functionalities of the Control Module
Student: Abhishek Kumar abhiphile
Mentor: Nikhil Maan Sc0rpi0n101
Project Length: 350 Hours
Proposal Link: Improving and Expanding the Functionalities of the Control Module
GSoC Blog : My Journey with GSoC 2024
#Project Summary
In this project, I focused on enhancing the Series
, MIMOSeries
, Parallel
, MIMOParallel
, Feedback
, and MIMOFeedback
classes to support StateSpace
interconnections. I worked on solving the state space equations using dsolve()
. Additionally, I introduced a new PIDController
class which can be used for various regulatory applications. I also incorporated mechanics and electrical textbook problems that can be addressed using StateSpace
. Finally, I implemented new plotting features, including the Nyquist plot (nyquist_plot
) and Nichols plot (Nichols Plot
), utilizing SymPy's own plot_parametric
function.
#Related Work
Here’s a summary of my work on SymPy as part of Google Summer of Code (GSoC 24):
#Merged Pull Requests
- ( #26647 ) In this PR I've worked on refactoring the
Series
andMIMOSeries
classes to supportStateSpace
interconnections. Previously these connections were only possible withTransferFunctions
,doit()
forStateSpace
interconnections behave differently, for these interconnectionsdoit()
will return the resultingStateSpace
object. - ( #26718 ) In this I've # Added support of using
StateSpace
withParallel
andMIMOParallel
. It is similar to the PR described above. - ( #26863 ) This PR was related to make
Feedback
andMIMOFeedback
compatible withStateSpace
. - ( #26685 ) & ( 26736 ) Implemented a method to find out the output vector using the
dsolve
function inStateSpace
object. The first PR was related to adding functions likestate_vector
andoutput_vector
. In the second PR I've removed thestate_vector
method and renamed theoutput_vector
todsolve
. This was suggested by Jason K. Moore because it matches with existing functionality of SymPy. - ( #26768 ) Added test to check the functionality of
StateSpace
using symbolic matrices. - ( #26781 )
PIDController
class has been added to control. This class can be useful for various control applications which require regulation. Since it's parent class isTransferFunction
it supports all the functionality ofTransferFunctions
. - ( #26978 ) This PR add two problems related to state space in
electrical_problems.rst
file. These examples can help users to understand how SymPy's control module can be helpful in solving problems related to physics usingStateSpace
andSympy
. - ( #270009 ) Added a simple spring mass damper problem and a rotational system problem to control tutorials.
- ( #27052 ) Implemented Nyquist Plot, this plot uses SymPy's own
plot_parametric
method to plot the output. - ( #27067 ) Added Nichols plot to control plots.
#Open Pull Requests:
- ( #26836 ) Added a method to calculate bandwidth of a
TransferFunction
.
#Future Work
- Adding a Discrete time model that includes Discrete TransferFunction and Discrete StateSpace model. A discrete control system should have the following components.
- Discrete Transfer Function which lets use make the TransferFunction like
G = tf([numerator coefficients], [denominator coefficients], Ts);
. - Discrete StateSpace model which can be made by sampling time
Ts
.sys = ss(A, B, C, D, Ts);
. - Controller Discretization by functions like c2d.
- Discrete Transfer Function which lets use make the TransferFunction like
- Improving existing plots to use SymPy's own symbolic method rather than using other libraries for plotting.
#Acknowledgements
I am highly grateful to my mentor, Nikhil Maan for always being there with me whenever I was struck and needed help. I would also like to thank Anurag Bhat for reviewing my PR. I would like to thank Jason Moore (@moorepants), Oscar Benjamin(@oscarbenjamin), Christopher Smith(@smichr), Aaron Meurer(@asmeurer), S.Y. Lee (@sylee957), and other members and contributors in the community for their continuous support, allowing me to contribute to Sympy and learn a lot in the process.
#References
- My GSoC Proposal: Proposal
- Mathworks control system documentation: MATLAB Control Documentation
- python-control documentation: python-control
- The SymPy Github page is for issues/ pull requests/ comments.
- Book on Control by Karl J. Åström and Richard M. Murray
Written by
Abhishek Kumar
At
Fri Sep 20 2024