-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
added bilinear() to tf in control lti #24558
Conversation
✅ Hi, I am the SymPy bot (v169). 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:
This will be added to https://github.com/sympy/sympy/wiki/Release-Notes-for-1.12. Click here to see the pull request description that was parsed.
Update The release notes on the wiki have been updated. |
🟠Hi, I am the SymPy bot (v169). 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:
The following commits delete files:
If these files were added/deleted on purpose, you can ignore this message. |
These commits will need to be squashed. We can't have a commit that introduces a file followed by another that deletes it. The file must not exist in the history at all. |
sympy/physics/control/lti.py
Outdated
T = Symbol('T') # and sample period T | ||
|
||
H = self.num/self.den | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see lot of blank lines in between the code which are not required.
As far as the failing test is concerned you should run |
you need to add your name and email in the |
thanks, just did that |
Check the .mailmap file
… Am 21.01.2023 um 08:51 schrieb ABHISHEK PATIDAR ***@***.***>:
you need to add your name and email in the .mailmap file and then run python bin/mailmap_check.py for instructions read here.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.
|
After adding your name and email in the |
Benchmark results from GitHub Actions Lower numbers are good, higher numbers are bad. A ratio less than 1 Significantly changed benchmark results (PR vs master) Significantly changed benchmark results (master vs previous release) before after ratio
[41d90958] [71817106]
<sympy-1.11.1^0>
- 965±2μs 606±3μs 0.63 solve.TimeSparseSystem.time_linear_eq_to_matrix(10)
- 2.79±0ms 1.14±0.01ms 0.41 solve.TimeSparseSystem.time_linear_eq_to_matrix(20)
- 5.56±0.01ms 1.67±0ms 0.30 solve.TimeSparseSystem.time_linear_eq_to_matrix(30)
Full benchmark results can be found as artifacts in GitHub Actions |
Thanks, now all checks have passed :) |
Co-authored-by: (Lazard) S.Y. Lee <[email protected]>
Could you add relevant examples in form of tests in https://github.com/sympy/sympy/blob/master/sympy/physics/control/tests/test_lti.py |
Ok, i‘ll prepare some tests |
@faze-geek, done e595caf |
I think two things should be changed:
|
@hanspi42, thank you for the feedback. Do I understand correctly, that concerning point 1, you propose that the function should be called as (for tf as TransferFunction, discrete_var the symbolic discrete variable (e.g. z) and sample_per the symbolic sample period) :
Concerning point 2, I don't see how to take advantage of your analysis, that is, how should I get the list of the numerator and denominator coeffcients of the discretized transfer function? Taking into account your point 1. it could look as follows. However, I as I wrote above, I have no idea of how to avoid the defining `def blinear(self, discrete_var, sample_per):
` |
For example:
|
Yes ;) |
@hanspi42 , thank you for the fast reply and the elegant compact code example, i‘ll test it and think about it! |
only use of poly as suggested by @hanspi42 , @faze-geek, @sylee957, mathematical formulae and code prototype by @hanspi42
@hanspi42 , commited the changes, thank you very much for the algebraic hints and the code prototype.
|
I think that general interface is good. I think that we can pull out as function outside if we are not clear. |
I think that adding additional features are okay if it is outside, but only want to avoid adding inside objects as much as possible because of SRP |
@sylee957 , thank you for the feedback. For me it would be OK to inlcude https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.bilinear.html |
It is OK for me now, but I would suggest one final change: show the formula of the bilinear-transform substitution in the doc string. |
-> done |
It looks OK, but does not appear in the documentation (preview here: https://output.circle-artifacts.com/output/job/1eb985ff-0719-4e5a-a222-ce27d1c7ee08/artifacts/0/doc/_build/html/index.html) Unfortunately I do not know how to do this; does any of the other reviewers know? |
You need to add a directive |
-> done |
1 similar comment
-> done |
This is done by github. Look under "All checks have passed", there is an entry "Click here to see a preview of the documentation" |
@sylee957: This now looks OK to me. |
I think that docs should be more readable because summary is too long and there are not many examples to figure out how it works for general cases. |
Also, I find that the release notes are misleading to |
bilinear discretization of continuous transfer function in Control API
References to other Issues or PRs
Fixes #24544
Brief description of what is fixed or changed
Added the function bilinear() to TransferFunction objects in sympy\physics\control\lti.py
It returns falling coeffs of H(z) from numerator and denominator. H(z) is the corresponding discretized tf, discretized with bilinear transform method. Coefficients are falling, i.e. H(z) = (az+b)/(cz+d) is returned as [a, b], [c, d].
Other comments
It is a useful function for numerical implementations of discrete signal processing and control with scipy.signal, control or matlab/simulink, once the symbolic continuous transfer function design is finished.
Release Notes
bilinear
, a function for the bilinear transform discretization of a continuous transfer function from Control API.