fix blank bode plot in rootlocus_pid_designer by sawyerbfuller · Pull Request #883 · python-control/python-control

@sawyerbfuller

Starts with a small gain rather than zero to insure that the frequency response plots appear. Addresses #686

@sawyerbfuller

@coveralls

Coverage Status

Coverage: 94.649% (+0.1%) from 94.535% when pulling fabcb37 on sawyerbfuller:rlpd_blank into 1e1c8eb on python-control:main.

@murrayrm

I tried running this on the example I pointed out in #686 and when I click on the root locus, nothing changes. I then tried the same system in sisotool and that also didn't work. I'm assuming this works for others? Any clues about what I am doing wrong?

Also, why is 0.001 the right initial_gain to use? We have a default value for this (sisotool.initial_gain) that is set to 1. Shouldn't we use that instead?

@murrayrm

@murrayrm

Also, in looking at the code a bit, I am confused about the fact that the initial gain seems to be set using the Kp0, Ki0, and Kd0 parameters, but then it is reset to 0.001 for the gain that you choose to vary. Should you be able to override this through one of those parameters?

@sawyerbfuller

Regarding default gain: for rootlocus-pid-designer, in principle you are already starting with baseline nonzero kd0, kp0, and ki0, and the step responses show result of that. You are interested in any addition delta-k to one of those, so it makes sense to start that one with a small value. But a zero value erases Bose plot. Np.eps is another option but it would make a very low gain bode plot so I picked a kind of arbitrary small nonzero value.

@sawyerbfuller

Re non-interactive plot: doesn’t work in Jupiter, have to use magic command %matplotlib qt. Assuming you tried that, can you zoom? The way it works you have to click near one of its pre calculated points. It computes more if you zoom in.

@sawyerbfuller

@murrayrm On further thought based on your questions, I realized that a deltaK parameter would be useful needed for non-interactive use, so that the bode plot was usable. Added it in.

@murrayrm

@murrayrm

Using %matplotlib fixed the issues I was having, so I added a bit of documentation.