07-06-2015 02:38 AM
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 .
Solved! Go to Solution.
07-06-2015 02:46 AM
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"?
07-06-2015 02:52 AM
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
07-06-2015 02:55 AM
07-06-2015 04:25 AM
Hi Gerd,
Please refer the attachment in 2011 version .
Thanks & regards
Nitin
07-06-2015 04:33 AM - edited 07-06-2015 04:39 AM
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?
07-06-2015 06:18 AM
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
07-06-2015 06:52 AM - edited 07-06-2015 06:55 AM
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!
07-06-2015 07:44 AM
Thanks Gerd
Now its working , But stil i am not able to set derivative .