LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Need help in PID

Solved!
Go to solution

Hello ,

 

I am Trying to implement PID loop but facing some issues.

Input :- Feedback from motor in terms of PWM fixed duty cycle and varying frequency .

Output :-  is fixed frequency and varying duty cycle .

 

Observation is irrespective of set point motor is running in the range defined by PID output range .

Please help to resolve this thing .

 

Attachment :- Output by running Vi & Vi also attahced .

 

 

 

Download All
0 Kudos
Message 1 of 9
(3,498 Views)
Solution
Accepted by topic author Nitin_110051

Hi Nitin,

 

so you limit the PID output range to a very small range - and then you wonder, why the PID control doesn't go outside of that small working range???

 

Output :-  is fixed frequency and varying duty cycle .

Btw. Why do you set the output to [1700, 1900] when you want to have a duty cycle as output value? What kind of duty cycle uses values like "1800"?

Best regards,
GerdW


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

Good morning Gerd,

 

Even if i change the output range to 0 to 6000 , then i am getting the graph in which pulse is coming 0 to 6000 .

 

Practically it should maintain speed to setpoint, but i observe its behaving with ouptut range only .

 

Duty cycle :- this 1800 or whatever values in terms of 100 are the Rpm for the motor and i am coverting into duty cycle by dividing with the factor 6000.

 

 

Thanks & regards

Nitin

 

 

0 Kudos
Message 3 of 9
(3,488 Views)

Hi Nitin,

 

can you attach your VI in LV2011?

Best regards,
GerdW


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

Hi Gerd,

 

Please refer the attachment in 2011 version .

 

Thanks & regards

Nitin

 

0 Kudos
Message 5 of 9
(3,436 Views)

Hi Nitin,

 

thanks for conversion.

 

On your VI:

- Why are you using so many local variables, causing race conditions?

- Why are there controls and indicators with exactly the same name ("frequency")?

- Why is "Output PID" set as control, when it just displays a value like an indicator?

- Why are you reading "N samples" from your frequency input, but using just one sample for the PID?

- Why are you manipulating the measurement value with an Abs() function?

- Why are you providing a dt=0.0001 to the PID function, when you use a WaitForMultiple set to multiples of 180ms?

 

There is so much wrong with your VI! Please correct all other problems before you even attempt to integrate a PID control…

 

From an UX point of view: Why do you use gauges as input controls?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 9
(3,423 Views)

HI Gerd

Thanks for information .

I tried with your observations , its working now . Some problems are still there like if i change the parameters(Kp=1.0,Ki=0.001,Kd=0.000 to Kp=2,Ki=0.001,Kd=0.001) its osciallting to much in the output range . and also if i hold the motor with hands softly  it is gaining speed and not coming back while holding the motor, once i realeased motor it is coming back .

 

 

 

Awnser's

On your VI:

- Why are you using so many local variables, causing race conditions? I  didn't know that variables can create race condition , can you suggest me some document regarding this ?

- Why are there controls and indicators with exactly the same name ("frequency")? :- Changed Now

- Why is "Output PID" set as control, when it just displays a value like an indicator? :-  Changed Now

- Why are you reading "N samples" from your frequency input, but using just one sample for the PID?  if i am using single samples  it is not working at all .

- Why are you manipulating the measurement value with an Abs() function? Changed Now

- Why are you providing a dt=0.0001 to the PID function, when you use a WaitForMultiple set to multiples of 180ms? Removed Now

 

There is so much wrong with your VI! Please correct all other problems before you even attempt to integrate a PID control…  Corrected

 

From an UX point of view: Why do you use gauges as input controls?I used gauges just for representation .

 

 

Attachment :- New VI

 

0 Kudos
Message 7 of 9
(3,388 Views)

Hi Nitin,

 

Why are you using so many local variables, causing race conditions? I  didn't know that variables can create race condition , can you suggest me some document regarding this ?

The LabVIEW help explains the term "race condition"… (Googling for "labview help race condition" gives a lot of documentation!)

 

Why are there controls and indicators with exactly the same name ("frequency")? :- Changed Now

Now there are controls without a label: this is no good idea either…

 

Why are you providing a dt=0.0001 to the PID function, when you use a WaitForMultiple set to multiples of 180ms? Removed Now

 Now there is no timing at all in the loop - and you still provide the PID a wrong timing of 1e-4…

 

From an UX point of view: Why do you use gauges as input controls?I used gauges just for representation .

You still use gauges for inputs…

 

Some problems are still there like if i change the parameters(Kp=1.0,Ki=0.001,Kd=0.000 to Kp=2,Ki=0.001,Kd=0.001) its osciallting to much in the output range

Do you know how to get estimates for PID parameters? Have you heard about Ziegler-Nichols? Wikipedia explains this with a lot of details!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 9
(3,375 Views)

Thanks Gerd

Now its working , But stil i am not able to set derivative .

 

0 Kudos
Message 9 of 9
(3,355 Views)