LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Motor control in sinusoidal pattern and PID

Hello,

 

I need some help to implement some improvements on my motor control VI.

 

I have a voice coil motor driven by a PXIe-4138 Source measure unit and a displacement sensor connected to a PXIe-8301 DAQ. My target is to control the position of the motor using a PID to control the current applied to the motor. The challenge is that I want the position of the motor to change dynamically with time in a sinusoidal fashion.

 

So far I implemented a PID controller successfully, by calculating the point of the sine pattern at every iteration of a Timed loop to get some deterministic behavior. The point of the sine pattern at every iteration is set as a setpoint to the PID controller and the reading of the displacement sensor is the process variable. Finally the output is the commanded current to the Source measure unit. 

 

I try to implement some improvements in order to achieve the following:

 

  1. Follow Sinusoidal Pattern: Instead of calculating the position point-by-point, I want the VI to consider the sinusoidal nature of the displacement and adjust the control actions accordingly.

  2. Lack of Adaptive Tuning: After each oscillation, the PID controller doesn't adapt its gains parameters to the dynamically changing position.

I am trying to implement some gain scheduling or feedforwarding, but I am not sure how I can make the PID controller aware of the sinusoidal nature of the motor displacement.

 

Any suggestions are welcome,

Best,

Nikos

 

0 Kudos
Message 1 of 4
(1,106 Views)

Hi Nikos,

 


@nikoskal95 wrote:

I am trying to implement some gain scheduling or feedforwarding, but I am not sure how I can make the PID controller aware of the sinusoidal nature of the motor displacement.


I had good results with feed-forward structures added to a PID controller:

  • the feed-forward will give an expected output value for the current input conditions (in your case the position in the sine cycle)
  • the PID will handle deviations (aka "disturbances") from expected and measured position
  • output of PID and feed-forward will be added (and maybe range-limited) to drive your actuator

In my case I used it to control mass flow after a pump, with disturbances resulting from back-pressure in the system: the feed-forward can calculate an expected pump speed and the PID can compensate the back-pressure influence…

Best regards,
GerdW


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

Dear GerdW,

 

Thanks a lot for your reply!!

Would you mind sharing some code??

 

Nikos

0 Kudos
Message 3 of 4
(1,078 Views)

Hi Nikos,

 

here's an example of a PID combined with a feed-forward block:

(I cannot attach the code due to it's large code base, but the image should show the basic principles. All subVIs are located in my large testbench re-use functions folder.)

The feed-forward part is hidden in that "BIAS" subVI, but it just calculates the expected output value for the first valve from two input values.

I also use the bias value to limit the PID output range and to manipulate its "manual control" input value.

In the end two different valves (pressure regulating valve, needle valve) work together to control a system pressure over a large range of mass flow through those valves…

Best regards,
GerdW


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