Upload
pepito
View
214
Download
0
Embed Size (px)
Citation preview
8/18/2019 NI Tutorial 2923 en Understanding Servo Tune
1/111/11 www.ni.c
1.2.3.
1.2.3.4.
Understanding Servo Tune
Publish Date: Feb 16, 2016
Overview
Servo systems contain error-driven control loops. Servo tuning is an integral part of any motion system and directly impacts the
accuracy and performance. A properly tuned system can provide higher precision and more stability. This document will walk
through the process to architect an effective set of parameters to best optimize your system for use with our SoftMotion Software
or PCI/PXI boards.
Table of Contents
Part I: Servo Tune FundamentalsPart II: Tuning Servo MotorsPart III: Advanced Tuning Techniques
1. Part I: Servo Tune Fundamentals
Introduction
Part I of the document provides information necessary for getting started with tuning servo tuneUnderstanding Servo Tune
motors. It requires basic knowledge of servo motors, controls, and motion control concepts. This section is dedicated to the basics
of servo tuning refer to part II and part III for specific systems.
Part I is divided into the following sections:
Getting Started: Accessing Servo Gain Tuning PanelPID Control Loop ParametersStep ResponseStability in the Time Domain
Analyzing the Step Response Plot
GETTING STARTED: ACCESSING SERVO GAIN TUNING
Both the PCI/PXI motion control boards and NI SoftMotion include a gain tuning panel. Depending on your system you will acces
this through Measurement & Automation Explorer (MAX) or the LabVIEW project. Use the Gain Tuning Panel to determine the
relative stability of a servo system and fine-tune the control loop gains. A system is considered stable if the actual position is finite
when the commanded position is finite. In other words, a system is stable if a commanded position results in the motor coming to
rest at a single position. A system is considered unstable when any commanded position typically results in an exponential
increase in position error. In other words, a system is unstable when the attempts to achieve a position result in oscillations that
never dampen.
If your system is a 7340 or 7350 PCI/PXI Board follow these steps to access Servo Tune:
Launch MAX.Expand the branch on the configuration tree.Devices and InterfacesExpand Motion Controller.PCI/PXI-73xxExpand , and click . Select the tab.Calibration Servo Tune Step Response
The following figure shows the Servo Tune Step Response interface.
8/18/2019 NI Tutorial 2923 en Understanding Servo Tune
2/11
8/18/2019 NI Tutorial 2923 en Understanding Servo Tune
3/113/11 www.ni.c
Figure 2
PID CONTROL LOOP PARAMETERS
—Proportional gain is the system . It determines the contribution of restoring force directlyProportional Gain (Kp) stiffness
proportional to the position error. Restoring force is comparable to a spring in a mechanical system.
A high proportional gain gives a stiff responsive system but can cause instability from overshooting and oscillation.
—Derivative gain is the effects on the system. It determines the contribution of restoring forceDerivative Gain (Kd) damping
proportional to the rate of change (derivative) of position error. This force is much like viscous damping in a damped spring and
mass mechanical system—a shock absorber, for example.
Increasing derivative gain reduces oscillation at the commanded position, or it rings because of high acceleration.
—Integral gain is the load on the system. It determines the contribution of restoring force thatIntegral Gain (Ki) static torque
increases with time, ensuring that the static position error in the servo loop is forced to 0. This restoring force works against
constant torque loads to help achieve zero position error when an axis is stopped.
Integral gain improves positional accuracy. High static torque loads need integral gains to minimize position error when stopped.
STEP RESPONSE
To view your system’s step response, click the tab in MAX. Use this panel to plot the transient response of your Step Response
system. Typically, the transient response is measured by first commanding a step, then measuring how quickly a system takes to
reach a steady state. Using the transient response, you can calculate the maximum overshoot, rise time, peak time, and settling
time of your system.
STABILITY IN THE TIME DOMAIN
Use Step Response to determine the relative stability of the system. A system is considered stable if the actual position is finite
when the commanded position is finite. In other words, a system is stable if a commanded position results in the motor coming to
rest at a single position.
A system is considered unstable when any commanded position typically results in an exponential increase in position error. In
other words, a system is unstable when its attempts to achieve a position result in oscillations that never dampen.
The following figure, taken from the tab in MAX, shows a typical step response for a servo motor. Following theStep Response
chart is a description of elements to consider when determining the stability of a servo motor axis.
8/18/2019 NI Tutorial 2923 en Understanding Servo Tune
4/114/11 www.ni.c
Figure 2
—the time required by the response curve to reach and stay within a range that is approximately the final value of Settling Time
size specified by the absolute percentage of the final value (2% to 5%).
—the time required by the response to rise from 10% to 90% of its final value; the faster the response time of theRise Time
system, the faster the rise time.
—the time required for a response to reach the first peak of the overshoot.Peak Time
—the maximum peak value of the response curve measured from the desired position. The maximumMaximum Overshoot
overshoot directly indicates the relative stability of the system.
—the desired position. In this case, the commanded position is 1,000 counts from 0.Commanded Position
—the error that occurs when the system is at rest.Steady-State Position Error
—the area the position must be within in order to determine settling time.Settling Band
Part IV of this document outlines what actions to apply in order to modify a Step Response chart and set the system into aNote:stable state.
ANALYZING THE STEP RESPONSE PLOT
This section provides definitions and sample diagrams of the six most common response types.
An system, shown below, produces an oscillatory, exponentially diverging step response. This kind of system never unstablesettles down; in fact, the oscillations tend to worsen over time.
Figure 3
An system produces a smoother, slower step response. An over-damped system is characterized by noover-dampedovershoot, and long rise and settling times.
8/18/2019 NI Tutorial 2923 en Understanding Servo Tune
5/11
8/18/2019 NI Tutorial 2923 en Understanding Servo Tune
6/116/11 www.ni.c
Derivative Sampling Period (Td)Understanding PID ParametersTutorial: Manually Tuning a System from Scratch
AUTO TUNE OPTIONS
The PCI/PXI 7340 and 7350 boards include an option to automatically tune your servo motors. When automatically tuning your
system, use the and parameters to customize your system. Smooth controls have a slower Control Type Response Time
response time. The smoother the control, the less the axis will overshoot its desired position before slowing. The more overshoot
the system can manage, the faster the response times. Take note that while this may provide a solution in the range that is
desired fine tuning using the steps below is still integral to creating a stable system.
TUNING THE SYSTEM
Use the tab to view and edit the PID parameters. Auto Tune provides a tuned system, but for an optimally tunedControl Loop
system, it is necessary to fine-tune the final PID parameters. It may also be necessary to alter the PID parameters, depending on
your specific circumstances.
pPROPORTIONAL GAIN (K )
For each sample period, the PID loop calculates the position error and multiplies it by Kp to produce the proportional component o
the 16-bit DAC command output. The position error is the difference between the instantaneous trajectory position and the primary
feedback position.
An axis with too small a value for Kp is unable to hold the motor in position and is very soft. Increasing Kp stiffens the axis and
improves its disturbance torque rejection (its resistance to torque disturbances). However, too large a value for Kp could cause
instability.DERIVATIVE GAIN (Kd)
Every derivative sampling period, the PID loop computes the derivative of the position error. This derivative term is multiplied by
Kd every PID sample period to produce the derivative component of 16-bit DAC command output. In order for the servo loop
operation to be stable, a nonzero value for Kd is required for all systems that use torque or current amplifiers (where the command
output is proportional to motor torque). Small Kd values result in oscillations and servo loop instability.
With velocity or voltage amplifiers in which the command output is proportional to motor velocity, set Kd to 0 or to a very small
positive value.
INTEGRAL GAIN (Ki)
For each sample period, the position error is added to the accumulation of previous position errors to form an integration sum.
Integration sum is scaled by dividing it by 256 before multiplying it by Ki.
Use the default value (0) for applications with small static torque loads. Static torque loads are those that apply torque to the shaft
but are not moving. For systems with high static torque loads, tune this value to minimize position error when the axis is stopped.
Ki has no effect when is equal to 0.Integration Limit
DERIVATIVE SAMPLING PERIOD (Td)
The derivative sampling period determines how often (in update samples) the derivative of position error is calculated. Adjust Td
for greater flexibility in tuning the PID loop derivative term.
As Td increases, you can use a proportionally lower Kd value for similar results. Start the Td parameter at its default value of 2,
and make small adjustments as required by your motion system configuration.
For low inertia systems, set Td to 0 or 1 so that the derivative is calculated often enough to provide adequate damping for servo
loop stability.
Systems with higher inertia can benefit from larger Td values. Because higher inertia means that the position error cannot change
quickly, it is acceptable to calculate the derivative less often. As a result, you can use a lower Kd value and have the same
effective amount of damping, and the system will be smoother with less torque noise from the derivative term. In higher inertia
systems, using a Td of 0, and therefore a larger value for Kd, increases torque noise and motor heating without improving system
stability.
Tutorial Manually Tuning a System from Scratch
For users of the PCI/PXI 7340 and 7350 you will need to click on the tab in MAX to change your coefficients. For Control Loop
those using the LabVIEW NI SoftMotion Module click the button located on the Step Response tab of theControl Loop Gains
8/18/2019 NI Tutorial 2923 en Understanding Servo Tune
7/117/11 www.ni.c
1.2.3.4.
5.
6.7.
8.9.
Gain Tuning Panel. With the Step Response window open you can see the reaction of your system to changes in parameters.
Both the PCI/PXI boards and NI SoftMotion follow the same procedure for gain adjustment, perform the following steps to tune
your PID control system.
Set all three PID parameters, K , K , and K to 0Start by tuning K . Set it to a number that is much lower than needed. If you are unsure, start with 1.Click the button to view a step response graph of your system.Step ResponseIf the graph shows the parameter is:
Too Low - Double the value of the parameter.Too High - Set the parameter to halfway between the current value and the previous value.
Repeat steps 3 and 4 until you achieve a reasonable value for K For most systems, this will mean that the response willapproach the input, and oscillate continually about the input with a small amount of dampening. If the oscillation does not
gradually decrease in amplitude as shown below, then the system is considered unstable. If this occurs, you may need to adda small amount of K while you are repeating steps 3 and 4 to increase K .
After you arrive at a reasonable value for K , move on to Kd.
Repeat steps 3 and 4 for K until you achieve a reasonable value for K . For most systems, this will mean that the responsewill no longer oscillate continually, but will quickly dampen to a steady state value. This steady state value may be slightlyoffset from the input value, and this offset can be corrected with an appropriate K value.
After you arrive at a reasonable value for K , move on to K .Repeat steps 3 and 4 for K until you achieve a reasonable value for K . This parameter works on the integral of the positionerror therefore taking out offset error. Please use this parameter conservatively as it can introduce instability into the system.
A Tuning Example
The table below provides an example of using this method to quickly tune a servo motor. This example took 20 iterations to arrive
at a reasonably well tuned system. The gains used in each iteration are shown as well as the step response graph and
characteristics. The screenshots from this tuning are also shown in the animated image of the Step Response window at the
beginning of this document.
Step K K K Settling Time
(ms)
Rise Time
(ms)
Peak Time
(ms)
Max Overshoot
(%)
Step Response
1 1 0 0 315 96 165 40
2 2 0 0 363 57 114 67
3 4 0 0 567 39 81 89
4 8 0 0 594 27 60 91
p d i
p
p.
d p
p d.
d d
i
d i
d i
p d i
8/18/2019 NI Tutorial 2923 en Understanding Servo Tune
8/118/11 www.ni.c
5 8 1 0 594 27 60 88
6 8 2 0 594 30 63 88
7 8 4 0 594 27 60 88
8 8 8 0 588 30 63 84
9 8 16 0 501 27 60 78
10 8 32 0 366 30 60 68
11 8 64 0 255 30 60 53
12 8 128 0 162 33 60 29
13 8 256 0 105 45 75 3
14 8 192 0 132 39 66 13
15 8 192 1 534 42 66 3
8/18/2019 NI Tutorial 2923 en Understanding Servo Tune
9/119/11 www.ni.c
16 8 192 2 582 36 69 28
17 8 192 4 561 36 69 27
18 8 192 8 237 33 66 54
19 8 192 16 462 30 63 75
20 8 192 12 546 30 63 63
Note: It is important to note the subtle differences that Kp and Kd have on your system. Increasing Kp increases the slope of the
initial rise to the commanded position. As you increase Kp, you approach the commanded position faster, and thus overshoot by a
greater amount. Kd reduces the oscillations over a period of time after the initial rise. When Kp decreases, Kd becomes dominant
and when Kd decreases, Kp becomes dominant. When tuning your system, the goal is to find a comfortable balance between Kp
and Kd such that there is adequate response time (primarily Kp) and minimal overshoot (primarily Kd), without having to
significantly increase or decrease the gains. Increasing or decreasing the gains too much can create an unstable system and
possibly damage the motor.3. Part III: Advanced Tuning Techniques
OVERVIEW
Part III of the document provides information on the advanced features of Servo Tune.Understanding Servo Tune
Part III is divided into the following sections:
Bode PlotsStability in the Frequency Domain
Advanced Control Loop Parameters
BODE PLOTS (PCI/PXI 7340 and 7350)
Bode plots are the frequency response of your system. The panel in MAX plots the bode diagram for your system. In order Bode
to perform the bode analysis, Servo Tune oscillates the axis to identify the system and to calculate the transfer function. Gain isthe measure of the amplitude difference of the input to the system and output from the system. Phase defines the time shift
between the input and output. Gain is plotted in decibels (dB), and phase is plotted in degrees.
STABILITY IN THE FREQUENCY DOMAIN
Use bode plots to measure system stability. At low frequencies, the gain is 0 dB for most systems and diminishes as frequency
increases. A rise in gain before a fall in gain indicates marginal stability. For most systems, the allowable rise in gain before falling
is below 6 dB, indicating approximately 50% overshoot. You can use the bode plots to ensure that at all significant velocities are
stable given the PID parameters.
is the gain of the system when the phase is at –180 degrees. is the difference between the actualGain margin Phase margin
phase and –180 degrees when the gain is at 0 dB. Typically, the phase margin should be between 35 and 80 degrees for a stable
and responsive system. The phase margin should be as large as possible. The gain margin should be between 10 and 25 dB.
8/18/2019 NI Tutorial 2923 en Understanding Servo Tune
10/1110/11 www.ni.c
The following graph represents an unstable system. The rise in gain before eventually falling is around 10 dB. This system is
unstable at frequencies of approximately 100 radians/sec and higher.
Figure 15
ADVANCED CONTROL LOOP PARAMETERSThe following control loop parameters are often necessary when using velocity or voltage amplifiers.
Velocity Feedback Gain (Kv)
Velocity feedback gain (Kv) is similar to derivative gain (Kd), except that velocity feedback scales only the velocity estimated from
the secondary feedback resource. The derivative gain scales the derivative of the position error, which is the difference between
the instantaneous trajectory position and the primary feedback position. Like the Kd term, the velocity feedback derivative is
calculated every derivative sample period, and the contribution is updated every PID sample period.
When configuring an axis with a secondary feedback encoder, you can use the secondary feedback encoder for velocity feedback
The velocity feedback gain (Kv) scales this velocity feedback before it is added to the other components in the 16-bit DAC
command output.
For example, you can use velocity feedback gain for backlash compensation if your system has gears. You can configure the
primary feedback to the linear encoder on your system, and the secondary feedback to the rotary encoder on the shaft of the
motor. Zero Kd and use Kv instead.
Velocity Feedforward (Vff)
Velocity feedforward determines the contribution in the 16-bit DAC command output that is directly proportional to the
instantaneous trajectory velocity. Your system uses this value to minimize following error during the constant velocity portion of a
move and can be changed at any time to tune the PID loop.
Because velocity feedforward is an open-loop compensation technique, it cannot affect system stability. However, if the Vff value
is too large, the following error during the constant velocity portion can reverse (providing negative following error), which can
degrade performance.
Velocity feedforward is rarely used when operating in PID mode with torque block amplifiers. In this case, because the Following
Error is proportional to the torque required, and not to the velocity, it is typically much smaller. In this case, velocity feedforward is
not required.
Acceleration Feedforward (Aff)
Acceleration feedforward determines the contribution in the 16-bit DAC command output that is directly proportional to the
instantaneous trajectory acceleration. Use Aff to minimize Following Error (position error) during acceleration and deceleration,
and can be changed at any time to tune the PID loop.
Because acceleration feedforward is an open-loop compensation technique, it cannot affect system stability. However, if the Aff
value is too large, following error during acceleration and deceleration can reverse, providing negative following error, which can
degrade performance.
8/18/2019 NI Tutorial 2923 en Understanding Servo Tune
11/11
COMPANY
About National Instruments (http://www.n
Events (http://www.ni.com/events/)
Careers (http://www.ni.com/careers/)
SUPPORT
Submit a service request (https://sine.ni.com/srm/app/myServiceRequests)
Manuals (http://www.ni.com/manuals/)
Drivers (http://www.ni.com/downloads/drivers/)
Alliance Partners (http://www.ni.com/alliance/)
PRODUCT
Order status and history (http://www.ni.com/status/)
Order by part number (http://sine.ni.com/apps/utf8/nios.store?action=purchase_form)
Activate a product (http://sine.ni.com/myproducts/app/main.xhtml?lang=en)
Order and payment information (http://www.ni.com/how-to-buy/)
MISSION
NI equips engineers and scientists with systems that accelerate productivity, innovation, and discovery.
(http://twitter.com/niglobal) (http://www.facebook.com/NationalInstruments) (http://www.linkedin.com/company/3433?trk=tyah)
(http://www.youtube.com/nationalinstruments)
Contact Us (http://www.ni.com/contact-us/)
© National Instruments. All rights reserved.Legal (http://www.ni.com/legal/) | | Site map (
http://www.ni.com/help/map.htm)
(http://privacy.truste.com/privacy-seal/National-Instruments-Corporation/validation?rid=bc6daa8f-7051-4eea-b7b5-fb24dcd96d95)
http://www.ni.com/company/http://www.ni.com/events/http://www.ni.com/careers/https://sine.ni.com/srm/app/myServiceRequestshttps://sine.ni.com/srm/app/myServiceRequestshttp://www.ni.com/manuals/http://www.ni.com/downloads/drivers/http://www.ni.com/alliance/http://www.ni.com/status/http://sine.ni.com/apps/utf8/nios.store?action=purchase_formhttp://sine.ni.com/apps/utf8/nios.store?action=purchase_formhttp://sine.ni.com/myproducts/app/main.xhtml?lang=enhttp://sine.ni.com/myproducts/app/main.xhtml?lang=enhttp://www.ni.com/how-to-buy/http://twitter.com/niglobalhttp://www.facebook.com/NationalInstrumentshttp://www.linkedin.com/company/3433?trk=tyahhttp://www.youtube.com/nationalinstrumentshttp://www.ni.com/contact-us/http://www.ni.com/legal/http://www.ni.com/help/map.htmhttp://www.ni.com/help/map.htmhttp://privacy.truste.com/privacy-seal/National-Instruments-Corporation/validation?rid=bc6daa8f-7051-4eea-b7b5-fb24dcd96d95http://privacy.truste.com/privacy-seal/National-Instruments-Corporation/validation?rid=bc6daa8f-7051-4eea-b7b5-fb24dcd96d95http://privacy.truste.com/privacy-seal/National-Instruments-Corporation/validation?rid=bc6daa8f-7051-4eea-b7b5-fb24dcd96d95http://www.ni.com/help/map.htmhttp://www.ni.com/help/map.htmhttp://www.ni.com/help/map.htmhttp://www.ni.com/help/map.htmhttp://www.ni.com/legal/http://www.ni.com/legal/http://www.ni.com/contact-us/http://www.ni.com/contact-us/http://www.youtube.com/nationalinstrumentshttp://www.ni.com/rss/http://www.linkedin.com/company/3433?trk=tyahhttp://www.facebook.com/NationalInstrumentshttp://twitter.com/niglobalhttp://www.ni.com/how-to-buy/http://sine.ni.com/myproducts/app/main.xhtml?lang=enhttp://sine.ni.com/myproducts/app/main.xhtml?lang=enhttp://sine.ni.com/myproducts/app/main.xhtml?lang=enhttp://sine.ni.com/apps/utf8/nios.store?action=purchase_formhttp://sine.ni.com/apps/utf8/nios.store?action=purchase_formhttp://sine.ni.com/apps/utf8/nios.store?action=purchase_formhttp://www.ni.com/status/http://www.ni.com/alliance/http://www.ni.com/downloads/drivers/http://www.ni.com/manuals/https://sine.ni.com/srm/app/myServiceRequestshttps://sine.ni.com/srm/app/myServiceRequestshttps://sine.ni.com/srm/app/myServiceRequestshttp://www.ni.com/careers/http://www.ni.com/events/http://www.ni.com/company/