Learn How Your Control System Can Retune Itself When Conditions Change
Proportional integral derivative (PID) control is the most common type of feedback control algorithm used in industry today. Because you can tune the PID algorithm, it has been successfully used to control a wide range of processes that involve sensor feedback – from temperature chambers to motion control systems. One drawback of PID control, however, is that tuning can be a time-consuming manual process and the PID gains are optimized for the particular conditions that existed at the time of tuning. If conditions change, those PID tuning gains may no longer result in acceptable performance. Increases in friction due to normal wear and tear on mechanical assemblies, changes in temperature, or changes in payload mass may all necessitate retuning.
You can overcome these traditional limitations of the PID algorithm by making the control system detect, respond, and adapt to changes. This approach can increase robustness, eliminate downtime for manual retuning, help the system automatically deal with system wear and tear over time, and even reduce energy consumption by optimizing the control performance for a given set of operating conditions.
First, you can use the NI LabVIEW System Identification Toolkit to identify changes in the system by creating an updated model based on live measurement data. This is called “online system identification” because you can perform the task in real time while the control system is operating, and the process does not have to be interrupted. Next, a new set of PID gains are automatically selected based on the updated system model to optimize performance for the new conditions.
Figure 1. LabVIEW code continuously updates the system identification model during operation.
1. Case Study – Linear Motor Adaptive PID Control System
Engineers at National Instruments recently demonstrated this approach on a linear motor control system using the NI CompactRIO reconfigurable I/O platform, which features a field-programmable gate array (FPGA), real-time processor, and NI C Series I/O modules. The adaptive PID control system automatically detected and retuned itself for changes in the payload mass from unloaded (no weight) to fully loaded (54 kg) conditions. For position feedback, an NI 9411 high-speed 5 V TTL digital input module read the linear encoder signals, which were converted to position and velocity values in the LabVIEW FPGA application. The forward and reverse limit switches on the linear motor were connected to an NI 9421 24 V digital input module to provide a reference for the home position and to enable the enforcement of interlocks in the FPGA application to disable the drive if the linear motor traveled outside the valid range of motion. The drive control signals for enabling, disabling, and stopping motion were driven by an NI 9477 24 V digital output module. To increase performance, NI engineers executed the PID control algorithm in the FPGA at high speeds to control the high-bandwidth linear motor system. The output of the FPGA-based PID controller was a torque command, which was transmitted to the servo drive using an NI 9263 analog output module.
Figure 2. This adaptive linear motor control system is based on the CompactRIO reconfigurable I/O platform.
NI engineers simplified application development by placing the PID control algorithm in the FPGA while executing the system identification functions in the real-time processor. After successfully performing system identification and calculating new PID gains for the FPGA application, the real-time processor application sent the updated PID gains to the FPGA. This provided a clean architecture in which the FPGA was responsible for the time-sensitive control tasks, while the processor could execute the system identification functions at slower loop rates and sent updated PID gains only when valid system identification results were available. In this case, the system identification loop executed at a 5 Hz loop rate while the motion PID control loop in the FPGA executed at loop rates up to and beyond 20 kHz.
To estimate the inertia of the linear motor system, NI engineers used a recursive ARX model estimator function from the LabVIEW System Identification Toolkit. They used the torque command sent to the drive as the stimulus signal and used the velocity measured by the encoder as the response signal. With this, the ARX model estimator could detect the change in load on the system. By choosing the torque output of the PID algorithm to be the stimulus signal, the model estimation was not affected by changing PID gains. The engineers used the recursive least squares (RLS) method, so the model could be updated dynamically while the system was running. To determine the appropriate PID gain configuration for each load condition, they manually tuned the control system under unloaded (no weight) and fully loaded (120 lbs) conditions. Next, they used the gain scheduling function in the LabVIEW PID Control Toolkit to adjust the PID gains based on the estimated load conditions calculated online using system identification.
To test the adaptive control system, NI engineers added five 9 kg (20 lb) weights to the linear motor carriage while it was in motion, creating the need for the PID values to be retuned. The system identification algorithm quickly determined the load inertia change and retuned the PID control system to provide optimal performance whenever the load conditions changed.
Thousands of years ago an ancient Greek philosopher wrote, “Nothing endures but change.” The next time your PID loop has trouble staying in tune, consider using these online system identification techniques to help it adapt.
Brian MacCleery is a senior product manager for industrial and embedded control. He holds a bachelor’s and master’s degree in electrical engineering from Virginia Polytechnic Institute and Virginia State University, respectively.