@@ -6,6 +6,9 @@ pid \- proportional/integral/derivative controller
66\fB loadrt pid [num_chan= \fI num \fB | names= \fI name1 \fB [, \fI name2... \fB ]] [ \fB debug= \fI dbg \fR ]
77
88.SH DESCRIPTION
9+ \fB NOTE: \fR The auto-tuning part of this component have seen
10+ no development since 2011.
11+ .P
912\fB pid \fR is a classic Proportional/Integral/Derivative controller,
1013used to control position or speed feedback loops for servo motors and
1114other closed-loop applications.
@@ -161,6 +164,29 @@ output = bias + error * Pgain + errorI * Igain +
161164limit output to +/- maxoutput
162165.fi
163166
167+ .P
168+ This component has a built in auto tune mode. It works by setting up a limit
169+ cycle to characterize the process. From this, \fB Pgain/Igain/Dgain \fR or
170+ \fB Pgain/Igain/FF1 \fR can be determined using Ziegler-Nichols. When using
171+ \fB FF1 \fR , scaling must be set so that \fB output \fR is in user units per second.
172+ .P
173+ During auto tuning, the \fB command \fR input should not change. The limit
174+ cycle is setup around the commanded position. No initial tuning values are
175+ required to start auto tuning. Only \fB tune \- cycles \fR , \fB tune \- effort \fR
176+ and \fB tune \- mode \fR need be set before starting auto tuning. When auto tuning
177+ completes, the tuning parameters will be set. If running from LinuxCNC, the
178+ FERROR setting for the axis being tuned may need to be loosened up as it must
179+ be larger than the limit cycle amplitude in order to avoid a following error.
180+ .P
181+ To perform auto tuning, take the following steps. Move the axis to be tuned,
182+ to somewhere near the center of it's travel. Set \fB tune \- cycles \fR (the
183+ default value should be fine in most cases) and \fB tune \- mode \fR . Set
184+ \fB tune \- effort \fR to a small value. Set \fB enable \fR to true. Set
185+ \fB tune \- mode \fR to true. Set \fB tune \- start \fR to true. If no oscillation
186+ occurs, or the oscillation is too small, slowly increase \fB tune \- effort \fR .
187+ Auto tuning can be aborted at any time by setting \fB enable \fR or
188+ \fB tune \- mode \fR to false.
189+
164190.SH NAMING
165191The names for pins, parameters, and functions are prefixed as:
166192 \fB pid.N. \fR for N=0,1,...,num\- 1 when using \fB num_chan=num \fR
@@ -339,6 +365,40 @@ When true, the current PID output is saturated. That is,
339365\fB pid. \fI N \fB .saturated \- count \fR s32 out
340366When true, the output of PID was continually saturated for this many seconds
341367(\fB saturated \- s \fR ) or periods (\fB saturated \- count \fR ).
368+
369+ .SS Additional auto tuning pins
370+ .TP
371+ \fB pid. \fI N \fB .tune \- mode \fR bit in
372+ When true, enables auto tune mode. When false, normal PID calculations are
373+ performed.
374+ .TP
375+ \fB pid. \fI N \fB .tune \- start \fR bit io
376+ When set to true, starts auto tuning. Cleared when the auto tuning completes.
377+ .TP
378+ \fB pid. \fI N \fB .tune \- type \fR u32 rw
379+ When set to 0, \fB Pgain/Igain/Dgain \fR are calculated. When set to 1,
380+ \fB Pgain/Igain/FF1 \fR are calculated.
381+ .TP
382+ \fB pid. \fI N \fB .tune \- cycles \fR u32 rw
383+ Determines the number of cycles to run to characterize the process.
384+ \fB tune \- cycles \fR actually sets the number of half cycles. More cycles results
385+ in a more accurate characterization as the average of all cycles is used.
386+ .TP
387+ \fB pid. \fI N \fB .tune \- effort \fR float rw
388+ Determines the effort used in setting up the limit cycle in the process.
389+ \fB tune \- effort \fR should be set to a positive value less than \fB maxoutput \fR .
390+ Start with something small and work up to a value that results in a good
391+ portion of the maximum motor current being used. The smaller the value, the
392+ smaller the amplitude of the limit cycle.
393+ .TP
394+ \fB pid. \fI N \fB .ultimate \- gain \fR float ro (only if debug=1)
395+ Determined from process characterization. \fB ultimate \- gain \fR is the ratio of
396+ \fB tune \- effort \fR to the limit cycle amplitude multiplied by 4.0 divided by Pi.
397+ .TP
398+ \fB pid. \fI N \fB .ultimate \- period \fR float ro (only if debug=1)
399+ Determined from process characterization. \fB ultimate \- period \fR is the period
400+ of the limit cycle.
401+
342402.SH PARAMETERS
343403.TP
344404\fB pid. \fI N \fB .errorI \fR float ro (only if debug=1)
@@ -373,4 +433,4 @@ gains to fix it is a mistake; set the scaling correctly elsewhere
373433instead.
374434
375435.SH SEE ALSO
376- \fB at_pid \fR (9)
436+ \fB pid \fR (9)
0 commit comments