I am writing a test application that attempts to control the pressure on the output side of a small pump by using PID to adjust the position of a valve that restricts flow through the pump. The valve is a ball valve controlled by a 0-10V servo.
I am using hardware-timed DAQ and have synchronized the analog input and output clocks using the RTSI bus as described in
Optimized Hardware-Timed PID Loop.
My problem boils down to how does one go about determining the optimum values for the PID gains (Kc, Ti, and Td).
Of course the response of the system is quite non-linear in relation to changes in the valve postition. For example, if I begin to manually open the valve by changing the analog output connected to the servo (0V = closed) there is very little change in the output pressure until the control value gets up to around 4V. Then the response to the valve setting increases up to as much as about a 3.5 psi pressure drop for a 0.25V increase in the valve control and then decreases back to near zero response as the valve control gets close to around 9V or so (10V=fully open). As a result I assumed from the beginning that I would need to use a Gain Scheduled approach. In order to determine the proper PID gain values I first attempted to use the Autotune PID feature supplied in the PID Toolkit but I could never get this to work properly. I then turned to the PID Control Toolset User Manual and attempted to use the Open-Loop (Step Test) Tuning Procedure described on page 3-5 of this manual. I wrote a simple hardware-timed DAQ routine that would step the analog output value applied to the servo in increments of 0.25V and measure the output pressure at a typical frequency of 50Hz for several seconds at each level. This data was then used to compute the deadtime, time constant, and process gain as described in the manual. From these values I got results for Kc, Ti, and Td by following the recommendations. The values for Ti and Td did not show much variation at different settings of the valve (typical results Ti=0.008 min ~ 0.5 sec, Td = 0.002 min ~ 0.1 sec). But the values for Kc varied from near zero up to near 20 (actually -20 since an increase in the valve setting causes a decrease in pressure).
When I attempt to use these values I still cannot get the system to control properly. I have gotten the best results by using only one small gain value (Kc ~ -0.25, Ti = 0.008, Td = 0.002) and not using the gain scheduled approach. But, this value for Kc was obtained pretty much by trial and error and it is still not very ideal. I get some overshoot and a bit of oscillation, and sometimes the system ends up offset from the setpoint a bit.
In addition, I have a some additional types of pumps that have different characteristics that I can't seem to luck upon any reasonable gain values.
Any ideas as to what I could be doing wrong here.