===Bode PlotsLead Compensator vs Derivative Gain===A Bode Plot Derivative (D) Gain is a powerful tool for characterizing and providing insight into a dynamic system. It can often used to help determine closed loop stability, bandwidth/performance, resonant frequencies, and more. It is entirely based on the system being linear. Linear in the sense that if the amplitude of some input signal is changed then the output signal will change proportionally as well. Unfortunately most systems are not entirely linear. Stiction, backlash, encoder quantization, amplifier saturation, and other effects are non-linear. For example driving stabilize a system with a signal too small to overcome stiction will result in no output at all whereas a larger signal will result in some output. This is clearly non-linear behavior. It would be nice helps to use a technique that handles non-linear systems but basically none are known.<br /><br />A Bode Plot is made injecting a stimulus to the system and observing how the system responds. For the reasons of non-linearity it is very important to perform a Bode Plot measurement using a representative level of stimulus similar to what the system will actually have during normal operation. If the Stimulus is not adjusted properly the result is likely to be completely invalid. Additionally the system should be reasonably tuned and stable so that it is responding in a reasonable way to the stimulus. If the system is unstable or very poorly tuned the result is likely to be completely invalid.<br /><br />You might think of it somewhat like shaking a box to determine what is in it. You should shake it with enough intensity and at frequencies to get some reaction, but not so high of intensity to break or distort the object inside.<br /><br />To create a Bode Plot use the KMotion.exe Bode Plot Screen. First select Plot: Time domain - Command, Position, Output vs Time and adjust the Amplitude and cutoff Freq until there is small but significant Position (red) changes (ie 50 encoder counts), at a frequency low enough that the Position at least somewhat attempts Frequency Domain to follow help understand how the Command (blue), and where the Output (green) is not near saturation for the Drive being usedtwo forms of compensation help.<br /><br />After the Stimulus/Noise Injection settings are set switch to Plot: Open Loop - Magnitude Please read below and Phase vs Frequency. Set the number of Samples to average (ie 20) and perform a Measurement. [http://dynomotion.com/Help/BodeScreen/BodeScreen.htm See here this] for more information]on the Frequency Domain. Both Compensation methods add positive phase to help stabilize the system. Unfortunately both methods increase gain at higher frequencies possibly causing the system to go unstable at higher frequency. A Lead Compensator provides the benefit of positive phase but without as much gain increase at higher frequencies. This figure shows a simplified Gain Plot comparison:
[[File:DGainvsLead.png|none|link=|593x593px]]
Here is a Bode Plot of a P=0.5 D=20 Compensator. Note the KMotion.exe Bode Plot Screen has the capability of plotting the Frequency Domain Response of the PID+Filters Compensation. Assume we desire positive phase to be added at 40Hz. Notice the positive phase of 40 degrees at 40Hz which is good. However the Gain increase in the 1KHz region of about 21db which is bad.
[[File:P.5D20Annotate.png|none|link=|621x460px]]
Here is a Bode Plot of a P=0.5 N1=N2=25Hz D1=D2=70Hz Compensator. Assume we desire positive phase to be added at 40Hz. We choose N1 N2 and D1 D2 to surround the frequency where the positive phase is desired. Moving them further apart will increase the amount of positive phase but also increase the added Gain. Notice the positive phase of 60 degrees at 40Hz which is good. However the Gain increase in the 1KHz region of about 12db which is bad. However both are improvements over the D Gain compensator.
[[File:PoleZeroFilter.png|none|link=|210x319px]]
[[File:P.5D0N25D70Annotate.png|none|link=|644x478px]]
===Bode Plots===
A Bode Plot is a powerful tool for characterizing and providing insight into a dynamic system. It can help determine closed loop stability, bandwidth/performance, resonant frequencies, and more. It is entirely based on the system being linear. Linear in the sense that if the amplitude of some input signal is changed then the output signal will change proportionally as well. Unfortunately most systems are not entirely linear. Stiction, backlash, encoder quantization, amplifier saturation, and other effects are non-linear. For example driving a system with a signal too small to overcome stiction will result in no output at all whereas a larger signal will result in some output. This is clearly non-linear behavior. It would be nice to use a technique that handles non-linear systems but basically none are known.<br data-attributes="%20/"><br data-attributes="%20/">A Bode Plot is made injecting a stimulus to the system and observing how the system responds. For the reasons of non-linearity it is very important to perform a Bode Plot measurement using a representative level of stimulus similar to what the system will actually have during normal operation. If the Stimulus is not adjusted properly the result is likely to be completely invalid. Additionally the system should be reasonably tuned and stable so that it is responding in a reasonable way to the stimulus. If the system is unstable or very poorly tuned the result is likely to be completely invalid.<br data-attributes="%20/"><br data-attributes="%20/">You might think of it somewhat like shaking a box to determine what is in it. You should shake it with enough intensity and at frequencies to get some reaction, but not so high of intensity to break or distort the object inside.<br data-attributes="%20/"><br data-attributes="%20/">To create a Bode Plot use the KMotion.exe Bode Plot Screen. First select Plot: Time domain - Command, Position, Output vs Time and adjust the Amplitude and cutoff Freq until there is small but significant Position (red) changes (ie 50 encoder counts), at a frequency low enough that the Position at least somewhat attempts to follow the Command (blue), and where the Output (green) is not near saturation for the Drive being used.<br data-attributes="%20/"><br data-attributes="%20/">After the Stimulus/Noise Injection settings are set switch to Plot: Open Loop - Magnitude and Phase vs Frequency. Set the number of Samples to average (ie 20) and perform a Measurement. [http://dynomotion.com/Help/BodeScreen/BodeScreen.htm See here for more information].
===Links to other Information on Tuning and Bode Plots===