- Notifications
You must be signed in to change notification settings - Fork441
Update place to use scipy.signal.place_poles#176
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
…. Also, aadd tests for control dimension checks.
coveralls commentedJan 3, 2018 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
murrayrm commentedJan 3, 2018 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I like this change, but it brings up an interesting issue: what should we do when there are multiple algorithms available to solve a certain problem, each with different limitations? The previous version of the place command use a method by Varga (IEEE TAC, 1981), implemented via As an alternative, what if we implement an
We could have Would be interested in getting thoughts on this from anyone paying attention, especially@rabraker,@vmatos, and@robertobucher (who have been involved in the conversation and code up to now). |
I like the suggestion to add a keyword argument to specify the algorithm. I also think it would be good to retain the repeated-pole test, somehow marking it as "expected to fail" if the YT algorithm is used. Also, note that |
I think trying to cram too much functionality into a single function makes the code more difficult to test, maintain, use and document. Part of the problem is that varga and YT require different parameters. For example, to place discrete poles using varga, you need to pass We already have My proposal would be the following:
|
ilayn commentedJan 3, 2018
Note that, the arbitrary eigenstructure assignment problem has gained a lot of attention lately and people like R. Schmid et al. seem to have the general solution to pole placement. I have asked Amit Pandey from UCSD and he kindly shared his matlab code with me. I will try to propose a PR to SciPy whenever I can find time. This means, if accepted, there will be at least one additional SciPy method. |
murrayrm commentedJan 3, 2018 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Creating separate functions for now seems OK. @rabraker Can you implement your proposal above by updating this PR to pull out the previous functionality as @ilayn If you (or someone) wants to convert the MATLAB code for the R. Schmid et al method into a separate |
will do |
…y implementation of YT stays in place() proper
coveralls commentedJan 3, 2018 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
As requested, I have submitted thebug report and have put the old |
coveralls commentedJan 3, 2018 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
control/tests/matlab_test.py Outdated
def testPlace(self): | ||
place(self.siso_ss1.A, self.siso_ss1.B, [-2, -2]) |
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 think we should leave this test in place, but callingplace_varga
(assumingslycot
is installed). Also, can we add a check for the right type of error if we callplace
with repeated poles?
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 have made this change. I have also added two place-holder tests (or whatever they are called) into matlab_test.py for place and acker.
I added an assert_raises(ValueError....) test for place() to statefbk_test.py.
[0, 0,], | ||
[-3.146, 0]]) | ||
P = np.array([-0.5+1j, -0.5-1j, -5.0566, -8.6659]) | ||
K = place(A, B, P) |
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.
Can we also add some tests forplace_varga
andacker
here, as a way to increase coverage?
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 thinkacker
already has a test(line 125)...
I added a test for place_varga.
…or repeated poles in place. Added placeholder tests in matlab_test for place and acker and reverted the repeated pole test for place varga.
coveralls commentedJan 4, 2018 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
coveralls commentedJan 4, 2018 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
ilayn commentedJan 4, 2018
I will get back to this asap and let you know. |
This PR addresses issue#117 by using the
place_poles
function inscipy.signals
.Aside from just being run in
matlab_test.py
, there wasn't, as far as I could tell, a unit test forplace
previously, so I added one.The one limitation of the algorithm used in scipy.signals is that it can't place multiple poles at the same location for SISO systems, which made the "test" in
matlab_tests.place
fail, so I modified the requested pole location there.Also worth pointing that the previous implementation would fail for discrete time systems because the slycot function needed to be called with a different flag and the
alpha
parameter needed to be computed differently.