LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

PID Manual to Auto bumpless transfer

Solved!
Go to solution

 

Hi,

 

I am trying to use PID control for an ISCO syringe pump with bumpless manual to automatic control but I cannot seem to get it working.

 

This syringe pump has input and output in pressure and is used to apply a force in order to keep vertical displacement of a sample constant. The amount of pressure applied is related to vertical displacement through an equation that is shown in the attached VI. The goal of this VI is to apply a variable force depending on the displacement of the sample in order to try to keep the displacement 0.

 

Here is some background information about the pump I am using:

The pump is self contained and can independently maintain a pressure regardless of the LabVIEW PID controller. The pump only takes pressure commands from LabVIEW and will maintain that pressure until another pressure command is received (I believe that the pump's built in controller itself is a PID controller.)

 

The problem I am having is if I start the VI with the pump holding a constant pressure (using manual control with PID Advanced VI) and then transition over to automatic control, the PID Advanced VI immediately tells the pump to set the pressure to maximum and then slowly brings it back down to steady state. This occurs even if the manual control pressure is stable and identical to the automatic setpoint pressure. This following image details what I am talking about:

 

PID-bumpless.png

 

The pump is in steady state as shown in the pressure and setpoint chart in manual mode initially and then switched over the automatic control (where the huge bump is). I did this twice to show what happens when I transition back and forth. Automatic to manual is bumpless because I used a local variable to constantly change the manual setpoint.

 

I did some troubleshooting and experimenting and here are some of the results I have found:

1. When transitioning from manual to automatic control, the PID controller sets the pressure to maximum and then slowly brings it back down to the setpoint value

 

2. When cold starting the VI in automatic control mode with true for reinitialize, the PID controller sets the pressure to the minimum and then slowly brings it back up to the setpoint value. This occurs even if the original process value is close to the setpoint (feeding the process value into the PID controller before running also does not help.)

 

I also tried to play with the PID gains in the VI and found that if I disable the "I" and "D" parameters (set both to 0), I no longer suffer from the huge bump, but the PID controller cannot bring the process value to the setpoint as there is always an offset.

 

I am not sure whether or not this is a result of poor PID tuning, but after the initial bump during transition from manual to automatic, the PID controller seems to be able to maintain the correct pressure nicely.

 

The reason why I am using a PID controller rather than sending the pump commands (since it can independently maintain a pressure) is because it is a lot more smooth.

 

In the attached VI, there are a few sub-VIs that are called that are specific to the pump and the LVDTs used for sensing vertical displacement. I don't think these have any effect on why I am not getting a smooth bumpless transfer, so I only put comments to explain what they do.

 

I did find another forum thread with a similar issue, but none of the solutions posted there seemed to have helped me. Here is the link to that forum thread:

http://forums.ni.com/t5/LabVIEW/PID-Manual-to-Auto-bumpless-transfer/m-p/3180609#M920098

 

Thanks.

 

Best regards,

 

Victor

0 Kudos
Message 1 of 8
(4,934 Views)

Hi Victor,

 

also tried to play with the PID gains in the VI and found that if I disable the "I" and "D" parameters (set both to 0), I no longer suffer from the huge bump, but the PID controller cannot bring the process value to the setpoint as there is always an offset.

That's THE typical behaviour of a plain P control loop: it has an offset…

 

I am not sure whether or not this is a result of poor PID tuning

You have set an I gain of 0.01min in your image: less than a second. This means: the I part of the PID controller contributes with the same amount as the P part in less than a second - rather fast. And your loop is set to iterate at 500ms loop rate (in your VI) - a really bad combination…

Did you try to find good PID gains using Ziegler-Nichols or similar?

 

but after the initial bump during transition from manual to automatic, the PID controller seems to be able to maintain the correct pressure nicely

Why do you use the Autotuning version of PID? Why not use the "simple" PID-Advanced (without autotuning)?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 8
(4,922 Views)

Hi GerdW,

 

Thanks for the reply.

 

I tried finding better PID gains using the trial and error method as described in the following link, but I still have not managed to get the system to stabilize. Oddly, the system appears to be the most stable with the PID parameters that I previously used in the screenshot before.

 

http://www.ni.com/white-paper/3782/en/

 

Without any derivative action, I tried a variety of values for both P and I ranging from 0 to 10 and I cannot seem to find one that allows for the system to stabilize. The process value always ends up having large oscillations which prevents the system from stabilizing.

 

I used the autotuning advanced PID vi to test out autotuning; however, the Vi would also output maximum pressure and the PID parameters would not change.

 

Is there a specific tutorial on how to tune a PID controller using the Ziegler-Nichols method? The white paper I linked isn't very helpful in terms of step-by-step instructions.

 

I am likely doing something wrong, but I can't seem to figure out what it is.

 

Thanks.

Best regards,

Victor

0 Kudos
Message 3 of 8
(4,894 Views)

Victor,

 

I've run into this problem with the NI PID algorigthms as well.  The problem has to do with the way the NI VI stores old information for calculating the integral and deravitive that go into the PID.

 

The best way I found to solve this problem was to create my own PID VI, that way I can control how old information is written and stored.

 

-DR2

0 Kudos
Message 4 of 8
(4,888 Views)

Hi Victor,

 

the system appears to be the most stable with the PID parameters that I previously used in the screenshot before.

Then again: why do you use the autotuning PID instead of normal "Advanced PID"?

When you know your PID gains you don't need to autotune…

 

Without any derivative action, I tried a variety of values for both P and I ranging from 0 to 10 and I cannot seem to find one that allows for the system to stabilize. The process value always ends up having large oscillations which prevents the system from stabilizing.

Just "trying" some PI(D) gains isn't what I suggested before…

Did you do any usual way of finding PID gains? Wkipedia explains it quite extensive!

Can you show your system's reaction on a jump of the control variable u(t) (without any PID control enabled)?

How fast does your system react?

Does your system react in a linear fashion? PIDs are good for (more or less) linear systems! Otherwise did you try to use gain scheduling to adapt for certain working points/areas?

Can you provide measurement data for such a reaction?

 

To get back to your thread title: I never had any problems with bumpless switch from manual to auto mode with AdvancedPID from NI - once the PID gains were set according to your system…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 5 of 8
(4,851 Views)
Solution
Accepted by topic author victorzhao

Your topology is not quite how we recommend to do bumpless transfer. Can you do something like this?

 

pid connection 2.PNG

 

That will make manual setpoint to be in Pressure (Units) and you will need to update your gain, but this should track it better. Is this an option?

Barp - Control, Simulation, RTT and HIL - National Instruments
Message 6 of 8
(4,826 Views)

try to edit the advanced pid vi (or a temporary version of it), and force the output of the integrator to the manual control value, (if manual mode).

When you set the control back to auto mode again, it should tranfer smoothly

0 Kudos
Message 7 of 8
(4,818 Views)

Hi Barp,

 

My program works after making the changes that you have suggested.

 

It looks like the cause of the bump from manual to automatic was a result of the topology being incorrect.

 

The only thing left is to tune the PID parameters, but since that is specific to each system, I will try the suggestions in previous posts and take it from there.

 

Thanks for taking the time to help me solve this issue.

 

Best regards,

 

Victor

 

 

0 Kudos
Message 8 of 8
(4,798 Views)