Re: [Linuxptp-devel] Optimal P, I constants
PTP IEEE 1588 stack for Linux
Brought to you by:
rcochran
From: Richard C. <ric...@gm...> - 2013-04-27 07:15:58
|
On Thu, Apr 25, 2013 at 01:08:13PM +0200, Miroslav Lichvar wrote: > On Wed, Apr 24, 2013 at 08:51:36PM +0200, Richard Cochran wrote: > > > Your simulation results are interesting. Do you propose to find PI > > values for different sync rates in this way? > > I think the simulations show that the constants can be scaled > proportionally with the update rate. I didn't expect that the constants may be scaled, and so a wrote a simulator of my own (not to be compared with clknetsim, of course). http://linuxptp.sourceforge.net/pi_const/ This program only simulates the PI controller with an ideal, noise-free error signal. By starting out with a time offset of 100 microseconds, the program plots the step response of the servo. First let us look at what linuxptp does today when the actual sync rate is faster than the default of 1 Hz. http://linuxptp.sourceforge.net/pi_const/plot1.png The x-axis is the simulation time, and the y-axis is the output of the servo in PPM. The red 2^0 line shows how the default constants cause the servo to settle within the expected 15 second interval. If we just use these same constants with an increased sync rate (2^ -1, -2, and -3), the the servo still converges in the same interval, but with over-steering. The faster the sync rate, the greater the overshooting. If the actual sync rate is slower than the default of 1 Hz, then the servo becomes unstable: http://linuxptp.sourceforge.net/pi_const/plot2.png So the current linuxptp behavior of applying constants tuned for a 1 Hz sync to other rates does not work very well, or not at all, unless the user provides constants tuned to the expected sync rate. Now let us consider scaling the constants to the sync rate. http://linuxptp.sourceforge.net/pi_const/plot3.png With rates over 1 Hz, the shape of convergence is improved, but you can still see the over-steering effect. For example, the 2^-3 case produces an initial 800 PPM adjustment for the 100 microsecond offset. When the sync rate is slower than 1 Hz, http://linuxptp.sourceforge.net/pi_const/plot4.png the result appears at first glance acceptable, but any noise in the error signal would probably spoil things. So my conclusion is that, although automatically scaling the constants is an improvement over blindly applying the defaults, still scaling is not the right solution. What we really want is a set of tuned PI constants, one for each combination of supported sync interval and HW/SW time stamping. As an example, compare the using the scaled defaults with using hand tuned constants for the 2^-3 sync interval. http://linuxptp.sourceforge.net/pi_const/plot5.png Thoughts? Thanks, Richard |