08-30-2023 04:30 AM
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:
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.
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
08-30-2023 04:48 AM
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:
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…
08-30-2023 05:32 AM
Dear GerdW,
Thanks a lot for your reply!!
Would you mind sharing some code??
Nikos
08-30-2023 02:05 PM - edited 08-30-2023 02:14 PM
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…