# Tale of the Bode Plot Failure

By Mike Jones |
It is not too often that a tool fails me. Most of the time I have made some mistake, so when a Bode Plot failed to predict an unstable system, I came down with a bad case of myopia. I spent so much time chasing my tail, I thought I better write about the experience so others can learn from it.I was trying to port an analog instrument with two control loops to a different platform. I thought the port was all software. A few days of code hacking and I'd be done. But, I ran into an oscillation in a precision DC control system shown in this scope shot:Let's take a look at the design, and then I'll walk you though my analysis, failure, and final success.Their are three loops in the design. VDAC controls voltage, and +/-IDAC control current. When the current loop is in control, the voltage loop is pushed aside. It is the current loop that oscillates. Kp, Hn, and Kg are all op-amps with single poles at 100Hz, and a second pole at 1Mhz. This means the two poles from Kp/Kg or Kn/Kg give 180 degrees of phase shift, and you would expect oscillation.After building a rather complex MATLAB loop gain transfer function, I created this Bode Plot. 40dB/Decade roll off and 180 deg phase shift from 100Hz to 100Khz. The scope shot shows oscillations in this range, and my intuition immediately said, gain > 1 and 180 deg equals oscillator.However, a friend pointed out that phase margin only applies when gain = 1. So with some playing around you can move the phase and get some margin like this plot:In this case, we have over 45 deg margin. But, the system still oscillated. My intuition would not let go of the phase from 100Hz to 100Khz, so my friend pointed out the Barkhausen Criteria. The Wikipedia entry says:bq). ...if $$A$$, is the gain of the amplifying element in the circuit and $$\beta(j\omega)$$, is the transfer function of the feedback path, so $$\beta A$$ is the loop gain around the feedback loop of the circuit, the circuit will sustain steady-state oscillations only at frequencies for which:bq). # The loop gain is equal to unity in absolute magnitude, that is, $$|\beta A| = 1\$$; # There must be a positive feedback i.e., the phase shift around the loop is zero or an integer multiple of $$2 \pi: \angle \beta A = 2 \pi n, n \in 0, 1, 2,\dots$$.Reality and theory still did not agree. By some luck, I ran into a compensation article on EE Times. There was a similar Bode Plot:The phase margin is defined at gain = 1, not where the phase approaches 180 deg. This seemed to agree with the Barkhausen Criteria. I posted a question in the comments and got confirmation and a link to a discussion about stability. Deep into the discussion was a comment by Frank Wiedmann:bq). In case of doubt (if there is more than one crossing of 180 degrees or 0 dB), you should always apply the Nyquist stability criterion (see http://en.wikipedia.org/wiki/Stability_criterion). In the case presented here, by applying this criterion, you will find that the circuit is in fact stable (if the gain remains below 0 dB for higher frequencies).bq). When phase margin is specified for a system, it is usually assumed that the loop gain has two significant poles and no zeros. In this case, you can derive from the phase margin the shape of the closed-loop response of the system (damping of the step response etc.). The loop gain in the example presented here does not satisfy this condition, so giving a phase margin does not make very much sense.Reusing my MATLAB model to produce a Nyquist Plot:There she is! We are wrapped around -1 and the system is unstable, even though the phase/gain margin is ok!By tweaking Hp and Kn, I was able to get a Nyquist Plot like this one:This should be stable. Now I recheck my margins:All good. Might want a little more margin, but it should be stable.The change only required adding a 1500pF capacitor in the lead network of Hp and Kn. With a little soldering, I rechecked the instrument and all the oscillations were gone.The lesson was quite clear: Know your tools and how to use them. If a tool depends on an assumption, you must know it's assumptions, or know someone else who does :-)

## Join the Conversation!

User must log-in to comment.