Closed terrencetec closed 1 year ago
See 99d6ee5. Added oscillatory
option.
Instead of using the plant itself to calculate the phase margin, we decompose the plant and use the first mode instead. This has a phase response as the lower bound of the plant. So we find UGFs from the original plant but phase margins from the first mode plant.
From the figure below, see how the single-mode plant "filters" out the phase responses of the higher frequency modes. Using the single-mode plant will avoid having UGFs that fall in the steep phase drop regions.
The issue is not closed just in case there's bug in the new function. The function is very complex and very long and we might need to break it down in the future.
Try not to use the UGFs from control.stability_margins() directly. It's not very robust for phase response that changes drastically over a small frequency range, i.e. the peaks of the high Q systems. Instead, try to scan the phase around the UGFs (define a range) and use that instead.