Practical Implementation
If implementing a PID controller in controls code, write the PID controller code away from the field, if possible, to avoid distractions and code mistakes especially if you are testing the code on active process or motion systems. This will allow you to make minor changes out in the field and save time and unnecessary disruptions testing out in the field. No one wants to manage or rewrite field developed spaghetti code that was created to “to make things work” without fully understanding most of the process being controlled. Typically, most PLCs can be run in simulation mode where you can add test variables to simulate the dynamics to a certain degree on your PLC where you can switch between modes and test your PID controller initial gains & logic. These initial gains are typically very small, I typically use only proportional and integral gains without a derivative term especially if I’m unsure how much noise rides on a feedback sensor signal. Simulating certain dynamics are quite immediate on a PLC and have very little delay, you can simulate certain first and higher order dynamics in MATLAB Simulink running on a RTOS platform like Speedgoat for HIL simulation systems. For initial small test gains, it is fine for the controller to respond slowly initially during field testing and then adjusting gains to improve responsivity, overshoot, and overall robustness. No one would like to see high overshoot initially and instability potentially causing equipment or process safety issues. Keep in mind the PID controller can only be used for linear dynamics that respond to an input in a linear fashion. Note, linear dynamics may have a delay which can be accounted for using a delay term in your controller that may be dependent on the dynamics. I prefer manually tuning for different levels of dynamics (levels of flow, pressure, velocity, acceleration/deceleration, load) and see how the system performs and add modular controls features to improve the PID controller performance (like gain scheduling for abnormal conditions that can be detected and compensated for etc.). Control Modes Typically, most controls code will have two modes of operation, Manual and Auto operation. Manual mode is typically open loop while Auto mode is closed loop with controller and sensor feedback. In motion control, it may be the Manual jog mode where a linear speed in the X, Y, or Z direction is specified, and the DC servo motor moves rotationally to match the constant linear speed. Or it may be the Auto position mode, where a displacement is specified (X, Y, & Z position), and the Servo motors (X, Y, & Z motors) move to that position with given configured speeds and acceleration until the final displacement is met which is determined when the Servo 24 VDC pulses sent and received by the shaft encoder match. These configured parameterized speeds and accelerations would obviously change based on the size and shape of load one is trying to move in three-dimensional space. These configured parameters would be tuned to reduce displacement overshoot for various loads. On the other hand, in process control, one will have a Manual speed mode for setting the speed of the VFD which will rotate an AC motor which is then coupled to a centrifugal or a positive displacement pump controlling the pressure and flow of the process fluid in a system. The Manual speed mode will open-loop control the speed of the motor and pump. It is important to note, the VFD will typically have its own internal cascaded PID control speed control loop with voltage output of the drive as speed feedback (Voltage relates to speed, Current relates to torque). The Auto mode may consist of Auto pressure mode or Auto flow mode which consists of a PID controller with an Analog pressure or flow sensor on the output of the pump fed back into the controller. The PID controller will take a pressure or flow set-point and pressure or flow sensor feedback and convert it to speed set-point into the VFD. Bump-less transfer between modes When switching from Manual to Auto modes while running the equipment, it is desired that the PID controller does not receive a step change in the set-point (from a zero set-point to a valid non-zero set-point). To accomplish this, it is imperative that a Feed-forward term is added to the output of the PID controller. For example, when switching from Manual to Auto mode, the Feed-forward term would be the current speed of the motor that is added to the output of the PID controller. In this way, the PID controller has a sense of where it currently is and does not overcompensate by starting from a zero set-point to a non-zero set-point. Likewise, for motion control one would use current displacement as the feedforward value for the controller output when switching from Manual to Auto mode while the Servo motors are moving. Resetting integral windup When the operator switches back to Manual mode, it is critical that the PID controller resets the integral windup to zero, or the integral error term will increase over time when the set-point and feedback values do not match as the operator controls the equipment manually. Also, it is important to reset the Gains to default Gains if the Gains were changed due to gain scheduling. In general, when in Manual mode you do not want the Auto PID controller running. Also, if the Pump controls are held back by a closed valve while running in Auto, it is critical reset the integral windup so the PLC control does not overcompensate when the valve is re-opened and creates an unstable control system. An analogy in the aerospace world would be holding back a drone if it was give a set-point to go to 100 feet.
0 Comments
|
AuthorGraham is a control system engineer enthusiastic about controls, design, hockey, and art! Archives
April 2023
Categories |