abhishek

Menu

Close

Google Summer of Code Blog + Final Report

GSoC @SymPy 2024 (This a final report of my contributions during GSoC 2024)

Back

#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.

Here’s a summary of my work on SymPy as part of Google Summer of Code (GSoC 24):

#Merged Pull Requests

  1. ( #26647 ) In this PR I've worked on refactoring the Series and MIMOSeries classes to support StateSpace interconnections. Previously these connections were only possible with TransferFunctions, doit() for StateSpace interconnections behave differently, for these interconnections doit() will return the resulting StateSpace object.
  2. ( #26718 ) In this I've # Added support of using StateSpace with Parallel and MIMOParallel. It is similar to the PR described above.
  3. ( #26863 ) This PR was related to make Feedback and MIMOFeedback compatible with StateSpace.
  4. ( #26685 ) & ( 26736 ) Implemented a method to find out the output vector using the dsolve function in StateSpace object. The first PR was related to adding functions like state_vector and output_vector. In the second PR I've removed the state_vector method and renamed the output_vector to dsolve. This was suggested by Jason K. Moore because it matches with existing functionality of SymPy.
  5. ( #26768 ) Added test to check the functionality of StateSpace using symbolic matrices.
  6. ( #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 is TransferFunction it supports all the functionality of TransferFunctions.
  7. ( #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 using StateSpace and Sympy.
  8. ( #270009 ) Added a simple spring mass damper problem and a rotational system problem to control tutorials.
  9. ( #27052 ) Implemented Nyquist Plot, this plot uses SymPy's own plot_parametric method to plot the output.
  10. ( #27067 ) Added Nichols plot to control plots.

#Open Pull Requests:

  1. ( #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.
  • 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

  1. My GSoC Proposal: Proposal
  2. Mathworks control system documentation: MATLAB Control Documentation
  3. python-control documentation: python-control
  4. The SymPy Github page is for issues/ pull requests/ comments.
  5. Book on Control by Karl J. Åström and Richard M. Murray

Written by

Abhishek Kumar

At

Fri Sep 20 2024