Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GSoC] Added PIDController class to control module. #26781

Merged
merged 4 commits into from
Aug 7, 2024

Conversation

abhiphile
Copy link
Contributor

@abhiphile abhiphile commented Jul 8, 2024

PIDController Class Added to Control Module

  • Introduced a new PIDController class in the control module.
    • The PIDController class allows for the creation of PID controllers with the following parameters:
      • kp : Proportional gain (defaults to Symbol('kp') if not provided).
      • ki : Integral gain (defaults to Symbol('ki') if not provided).
      • kd : Derivative gain (defaults to Symbol('kd') if not provided).
      • tf : Derivative filter time constant (defaults to 0 if not provided).
      • var : The complex frequency variable (defaults to s if not provided).

References to other Issues or PRs

Fixes: #26163

Brief description of what is fixed or changed

Other comments

Release Notes

  • physics.control
    • Introduced a PIDController class in the control module.

@sympy-bot
Copy link

sympy-bot commented Jul 8, 2024

Hi, I am the SymPy bot. I'm here to help you write a release notes entry. Please read the guide on how to write release notes.

Your release notes are in good order.

Here is what the release notes will look like:

  • physics.control
    • Introduced a PIDController class in the control module. (#26781 by @abhiphile)

This will be added to https://github.com/sympy/sympy/wiki/Release-Notes-for-1.14.

Click here to see the pull request description that was parsed.
<!-- Your title above should be a short description of what
was changed. Do not include the issue number in the title. -->

**PIDController Class Added to Control Module**
- Introduced a new `PIDController` class in the control module.
   - The `PIDController` class allows for the creation of PID controllers with the following parameters:
        - `kp` : Proportional gain (defaults to `Symbol('kp')` if not provided).
        - `ki` : Integral gain (defaults to `Symbol('ki')` if not provided).
        - `kd` : Derivative gain (defaults to `Symbol('kd')` if not provided).
        - `tf` : Derivative filter time constant (defaults to 0 if not provided).
        - `var` : The complex frequency variable (defaults to `s` if not provided).

#### References to other Issues or PRs
Fixes: https://github.com/sympy/sympy/issues/26163

<!-- If this pull request fixes an issue, write "Fixes #NNNN" in that exact
format, e.g. "Fixes #1234" (see
https://tinyurl.com/auto-closing for more information). Also, please
write a comment on that issue linking back to this pull request once it is
open. -->


#### Brief description of what is fixed or changed


#### Other comments


#### Release Notes

<!-- Write the release notes for this release below between the BEGIN and END
statements. The basic format is a bulleted list with the name of the subpackage
and the release note for this PR. For example:

* solvers
  * Added a new solver for logarithmic equations.

* functions
  * Fixed a bug with log of integers. Formerly, `log(-x)` incorrectly gave `-log(x)`.

* physics.units
  * Corrected a semantical error in the conversion between volt and statvolt which
    reported the volt as being larger than the statvolt.

or if no release note(s) should be included use:

NO ENTRY

See https://github.com/sympy/sympy/wiki/Writing-Release-Notes for more
information on how to write release notes. The bot will check your release
notes automatically to see if they are formatted correctly. -->

<!-- BEGIN RELEASE NOTES -->
* physics.control
  * Introduced a `PIDController` class in the control module. 
<!-- END RELEASE NOTES -->

Update

The release notes on the wiki have been updated.

@sympy-bot
Copy link

sympy-bot commented Jul 8, 2024

🟠

Hi, I am the SymPy bot. I've noticed that some of your commits add or delete files. Since this is sometimes done unintentionally, I wanted to alert you about it.

This is an experimental feature of SymPy Bot. If you have any feedback on it, please comment at sympy/sympy-bot#75.

The following commits add new files:

  • 260d6e5:
    • doc/src/modules/physics/control/pid-controller.png

The following commits delete files:

  • fc5a760:
    • doc/src/modules/physics/control/pid-controller.png

If these files were added/deleted on purpose, you can ignore this message.

Copy link

github-actions bot commented Jul 8, 2024

Benchmark results from GitHub Actions

Lower numbers are good, higher numbers are bad. A ratio less than 1
means a speed up and greater than 1 means a slowdown. Green lines
beginning with + are slowdowns (the PR is slower then master or
master is slower than the previous release). Red lines beginning
with - are speedups.

Significantly changed benchmark results (PR vs master)

Significantly changed benchmark results (master vs previous release)

Full benchmark results can be found as artifacts in GitHub Actions
(click on checks at the top of the PR).

Copy link
Contributor

@faze-geek faze-geek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if we should add the pid-controller image at doc/src/modules/physics/control/pid-controller.png, that is a place for our technical documentation .rst files.

Copy link
Contributor

@faze-geek faze-geek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can also showcase solving a good symbolic question on the pid-controller at doc/src/guides/physics/control_problems.rst using sympy. Maybe after this PR is merged.

@moorepants
Copy link
Member

Not sure if we should add the pid-controller image at doc/src/modules/physics/control/pid-controller.png, that is a place for our technical documentation .rst files.

Also, do not commit binary image files. This PR needs to be reopened without the png or it needs to be removed, squashed, and force pushed.

@moorepants
Copy link
Member

Make sure that comments are address from the prior attempts:

#26287
#26285
#26175

>>> s = Symbol('s')
>>> tf1 = TransferFunction(1, s + 1, s)
>>> tf1.bandwidth()
1.00000000000000
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens when you have a symbolic transferfunction:

 >>> tf1 = TransferFunction(a, s + a, s)

?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, for a symbolic power_gain=Symbol('b')?


When using symbolic TransferFunction, make sure to define symbols along with
their signs properly.
"""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please cite a reference for this "bandwidth" calculation. I'm not immediately familiar with this and what the "power gain" is.

Also, this should be in a separate PR, as it is not related to PID.

@abhiphile abhiphile changed the title [GSoC] Added PIDController class to control module and a method to calculate the bandwidth of TransferFunction. [GSoC] Added PIDController class to control module. Jul 22, 2024
@abhiphile
Copy link
Contributor Author

Not sure if we should add the pid-controller image at doc/src/modules/physics/control/pid-controller.png, that is a place for our technical documentation .rst files.

I've seen a similar thing in

.. image:: allowed-sign-conventions.png

And the image file is located in doc/src/modules/physics/continumm_mechanics/allowed-sign-conventions.png. Using this as a reference I've put my image file in doc/src/modules/physics/control/pid-controller.png

@Sc0rpi0n101 Sc0rpi0n101 merged commit 63371a5 into sympy:master Aug 7, 2024
37 of 38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create a PID controller object
5 participants