LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

PID DC Motor -myRIO

Hi,

 

I'm currently tuning my 12V Geared DC Motor. I noticed whilst tuning my PID stuck to my setpoint (1 rev/s) in the counting up direction. However, when I changed the direction of the motor the motor doesn't stick to the set point and drops to around -1.2 rev/s. I think there's a mistake somwhere in the code but I've tried changing to constants but no luck.

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

Hi ar,

 


@ar38160 wrote:

I think there's a mistake somwhere in the code


Yes, I think that's the reason, too!

Unfortunately you didn't attach any code. (Remember: we cannot run/edit/debug images with LabVIEW!)

Best regards,
GerdW


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

Hi,

 

I've attached the code below. I've been using the following PID gains: P = 0.400, I = 0.004, D =0.001

 

Thanks

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

Hi ar,

 

I don't have hardware with me to test your VI, but can give some suggestions and questions:

  • Why do you place a sequence frame? It doesn't serve any purpose…
  • Why do you use local variables when the terminals are left unused?
  • Why do you need a timed while loop - at 10Hz iteration rate? Use a simple loop with a wait statement…
  • I prefer the PID-Advanced VI: it offers the options to switch between automatic and manual mode!
  • What happens when you go to manual mode and set some duty cycles manually? Does the motor behave as expected?
  • Can you (try to) reach a certain speed using the manual mode?
  • How did you determine your PID gains?
  • Why is the PID output range set to 0…100, when the "Duty" ExpressVI seems to expect values in the range of 0…1?
    Why do you calc "1 - PID_output"? What's the reason for this? What happens when the PID outputs values larger than 1? How does the motor handle a duty of, lets say, -50???

 

Best regards,
GerdW


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