04-04-2013 01:13 PM
I want to control a choke which regulates pressure in a pump application. The application already exists, but the customer wants the software to automatically control the choke around a pressure setpoint. The manual operator controls, output scaling, feedback scaling and documentation all refer to the control signal as 100% opens the choke (corresponding to minimum pressure) while 0% attempts to fully close the choke, corresponding to maximum pressure. Basically, the process variable and control variable have an inverse relationship.
I'd like the use the PID toolkit Vi's without modification. Apprently there is no built in way to invert the control action. Allow me to demonstrate with some simplified block diagrams.
First, I tried inverting the process variable, which I thought would just invert the error of the PID equation and do what I wanted. But it for some reason, it still drives the output to 0 (full pressure) with 0 setpoint.
Next, I tried inverting the proportional gain. This caused some very strange behavior and it was still out of phase.
Finally, I applied some brute force - subtract the PID control variable from the max value. Becuase my control variable only goes from 0 to 100% this works fairly well. Now 100% from the PID vi gives me 0% (full pressure), and 0% gives me 100% (fully open), which is what I want. For instance, when the controller is enabled and the setpoint is 0% the PID output drives the choke to 100%, which makes sense. However, this seems cludgy.
Is there a better, more elegant way of inverting the control action?
Solved! Go to Solution.
04-04-2013 03:38 PM
If you want to invert the controller response, multiply output of controller by -1.
This can also be done by inverting the proportional gain (as you have tried) providing the proportional gain acts on the whole controller - which it should do given the standard PID structure used in the toolkit blocks (see this thread which describes the PID structure used - as confirmed by NI control people).
Inverting the process variable only won't work, you also need to invert the setpoint - though if setpoint is zero, it makes no difference.
Even if you have sign correct, there are plenty of things that can make the resulting behaviour "strange".
04-04-2013 04:18 PM
I understand what you're saying. Inverting the control variable would work if I had a bipolar output, but since it only swings 0 to 100 and 100 is the "minimum", I don't see a clean way to do it. I guess subtracting the output of the PID from 100 is the simplest way to ensure it starts at 100 for 0 setpoint and works it's way down to zero to increase the pressure.
04-04-2013 04:31 PM
Fundamentally you need to do it the way you're doing it, and I don't think it's messy. Proportional control will always drive the output towards zero as the error - the difference between setpoint and process variable - approaches zero, so if you need the output to be something other than 0 when the error is zero, you need to add in an offset.
04-04-2013 04:34 PM
Agreed, thanks for the clarification.
04-04-2013 05:15 PM
You may be thinking about the control action in the wrong way - its all about the error.
If the measured pressure is below the setpoint, it sounds like you want to close (decrease) the choke to give an increase in the actual pressure ?
Error is SP-PV, so in this case you get a positive error, and a inverse action would be needed to have the controller closing the choke.
What you have done in that last diagram is actually an inversion of the controller output and the addition of a bias term (a fixed offset on the controller output). Bias terms are typically used to give a non-zero controller output, for a zero error - but that can also be achieved using the integral action part of the controller. Bias terms are not part of the corrective feedback action of a conroller, but are open loop (or feedforward). Nevertheless they can be very useful. It seems you are using it to accomodate inappropriate initial conditions - which is a separate issue from the direction of the control action.
Do you want the controller to start up with the choke fully opened (i.e. 100% output) ? Whether or not an inital value of 100 is appropriate depends upon what the starting value for the setpoint and measured pressure are within the system.
Assuming it is you can do that with what you have (a bias of +100) or by setting the initial value of the intergrator in the PID controller to 100. Bias terms are normally set to whatever value you need in steady-state (i.e. controller output when SP = PV). But here the bias is fixed to 100%, (which I hope isn't what you need in steady-state) and the difference has to be provided by the feedback action.
If you set the bias to 50 (i.e. in the middle of the range, or better the value needed for steady state) you might be able to see the corrective action of the feedback controller better - it may be far too slow to be correcting, or it could be far too fast and unstable (diverging). You could start by having Ti = 10 (I think it is in minutes) and see how the feedback part works with proportional only. You may not get zero error, but you should see things change in the right direction.
Hope this is clear and not confusing .... welcome to the world of feedback control.