Chapter 3
Using the PID Control Toolkit
LabWindows/CVI PID Control Toolkit User Manual
3-8
ni.com
Using PID with Lead-Lag
The lead-lag compensator uses a positional algorithm that approximates a true exponential
lead-lag. Feed forward control schemes often use this kind of algorithm as a dynamic
compensator. Using lead-lag, you can simulate inertia of motors, slow settling times in pipes,
and so on. Lead compensation stabilizes a closed loop by reacting to how fast something is
changing rather than its current state. This process speeds up the reaction. Lag compensation
stabilizes a closed loop by slowing down the reaction to the present value so that the
correction is made more slowly and does not overshoot. This process slows down the reaction.
The typical usage of the lead-lag follows:
1.
Pass gains to
PidLeadLagCreate
to create a lead-lag compensator.
PidLeadLagCreate
returns a handle you can use to identify the lead-lag compensator
in subsequent function calls.
2.
Use
PidSetLeadLagAttribute
and
PidGetLeadLagAttribute
to set and get the
lead-lag compensator attributes such as time intervals and minimum/maximum output
values. Provide the input to the compensator in a loop and use
PidLeadLagNextOutput
to obtain the output. This output is either applied to the system or to the controller, based
on whether the lead-lag is being used as an input or an output filter.
3.
Once the control loop ends, call
PidLeadLagDiscard
to discard the lead-lag
compensator and release its resources. Also call
PidDiscard
to discard the PID
controller.
The lead-lag compensator can be used either as an input or an output filter to the PID
controller. The default output range is –100 to 100, which corresponds to values specified in
terms of percentage of full scale. However, you can change this range so that the controller
gain relates engineering units to engineering units instead of percentage to percentage. The
lead-lag compensator coerces the controller output to the specified range.
Using PID with Setpoint Profiling
Using the setpoint profiling feature, you can generate a profile of setpoint values over time for
a “ramp and soak” type PID application. For example, you might want to ramp the setpoint
temperature of an oven control system over time and then hold, or soak, the setpoint at a
certain temperature for another period of time. Use this feature to implement any arbitrary
combination of ramp, hold, and step functions. Provide (setpoint, time) pairs to the setpoint
profile. The setpoint profile maintains the setpoint specified in each pair for the corresponding
times specified in the time array.