LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

PID Potentiometer's Voltage Control

Hello dear Community,

I'm new to LabVIEW and I'm trying to implement a simple control and monitor algorithm using PID Advanced.vi. I'm using cRIO in Scan Interface mode (1mS scan period) with AI (NI 9205) and AO (NI 9265) modules.
My input signal is a square wave 0-1V, DC:50%, 10Hz - AI ch.0.
AO ch.0 connected to 500ohm potentiometer, AI ch.1 connected to potentiometer too.
The purpose is to get the same output signal upon the potentiometer as the input signal, while changing the resistance of the potentiometer (AI ch0 = ch1).
I've tuned the pid gains manually, the best I got is attached in scope screenshot (red - input, yellow - output). Oscillations increasing as potentiometer's resistance increases.

How can I improve my results? In the next phase I would like to get auto tuning of PID gains.

Download All
0 Kudos
Message 1 of 4
(2,940 Views)

If the optimal PID gains change with the system then I would definitely recommend the auto tuning.  You would need to implement some check on the performance of the PID and when it fell out of "spec" stop the test, re-tune programmatically and then restart tests with new gains!

 

-Bear

Regards,

Ben Johnson
ʕง•ᴥ•ʔง
0 Kudos
Message 2 of 4
(2,887 Views)

Thanks for your response, Bear!

But is there a way to improve the the output signal (even with manual tuning) for a constant system state (constant output resistance in my case)? 

0 Kudos
Message 3 of 4
(2,856 Views)

Hi IG.B,

 

How can I improve my results?

- I suggest to remove the "PID to EGU": all you need to change is the output range directly at the PID VI and the P gain (by a factor of 100/0.02=5000)…

- It also would help to provide the very same dt at the PID VI as is used for the TWL: you configured a dt of 1ms at the TWL and 100ms at the PID…

- I'm sure you can find better PID gains than the ones you used for this "scope" image!

- You didn't set any PID gains in your snippet as default: because of the very small delays in your system I recommend to set the D gain to zero. Also keep in mind the PID VI expects the I gain with unit "min"…

Best regards,
GerdW


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