I have many trys to solve my problem but fail.Actually i want to control GAS engine speed.I am using AGB130 LINEAR ELECTRIC ACTUATOR to drive BUTTERFLY VALVE.I am using MAGNETIC PICKUP UNIT located on flyweel to sense engine speed.After F/V conversion i have 0-5000Hz to 0-5V.
Problem is that ACTUATOR drive only forward direction through given voltage
and reverse direction through SPRING located inside.
ACTUATOR always needed some voltage to remain in a position to maintain speed.But INCPID routine gives 0 output when no error found.
I am giving some examples in atachements which will help to identify problem.
Best regards
IFTIKHAR AHMAD
Hi,
Don't really know how the spring return will work here...Can't really see why it wouldn't work....
The 0V at 0 error isn't really true.... When the error is 0 output from the P- and D-term is indeed 0 (the D-term might not be 0 but for this discussion let's say it is). But the output from the I-term is whatever was needed to bring the error to 0. (It might be 0 but not necessarily).
Think of the car analogy, you're trying to keep the speed at 50mph and you're starting to climb a steep hill, if you simply keep the gas-pedal at the exact same position the speed will start to drop. The P-term adds a little effort based on the error but not enough since the load now is larger (we're climbing a hill). The I-term starts adding a little effort (giving some gas) and soon the velocity is back at 50mph. Now the P term is 0 (since there is no error) the D-term is 0 since there is no error but the I-term is not zero - if it were the speed would start to drop again.
With that said, simply add a little to the output of the PID-filter rto overcome the force of the spring - if that's what you want. This is often called feed-forward and means that for a particular speed, torque, position or whatever you have like a "starting point" for the "drive" - the PID filter then takes it from there.
/Henrik.
PID is a loop. If spring moves something, PID will detect it and it will correct it immediatly. Don't confuse error variable with PWM value. In my project it works fine and it responds to dynamic loads and it correct it as it should (read above post of my project). Sorry for answering you, as you only refer to Henrik.
"Beethoven had his critics too, see if you can name 3 of them"
You will need to find the required pwm to output 1500 rpm (1.5v) from your engine,(you will need this on startup to have your engine idling at no load) this you will use as your setpoint after adc. Anything above it will generate a negative P substracting from setpoint,slowing the engine down, above it adding to the setpoint,speeding up the engine. The gains of each part of p.i.d will be from the variable resistors via adcs. Have these initially set to one, set the p then p gain etc the idea is to have the engine fairly responsive to load change and the fine settings of the gains will limit the droop and overshoot.
Last edited by anonymouse; - 3rd September 2009 at 22:11.
Hi Alain and others,
Thank you all for info given, it is much appreciated.
Alain, regarding the linear problem - I have tested the actual distance travel of the servo arm by connecting a ruler to the arm.
To test I then adjusted the speed voltage, taking voltage readings and distance readings as I go along.
The distance values on Excel graph showed a non linear line in comparison to the linear nature of the voltage.
/Daan Joubert
Hi, Daan
I hope you've considered the rotation angle of the arm is linear to the signal ...
But, whatever your transmission system ... only rack and pinion or cable and pulley can give a linear travel !!!
You could use a LOOKUP Table to correct your output ... but, once more, if it is a real PID controller, it will compensate for non-linearities ...
Or try to use ... FUZZY LOGIC !!!
Or find an old LINEAR R/C servo ( Kraft, Robbe, Varioprop, Lextronic ... produced some in the 70-80's )
Alain
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
Your gains might need to be fractional all the way up to 20 times and more via your vresistors via adc. Example engine running no load 1500 rpm, adc 1.5/5 * 256 = 77. setpoint = 77,unknown but say pwm 25, all gains apart from p set to zero. 25% load applied engine droops to 500rpm,adc 0.5/5 * 256 = 26. 77-26= 51, pwm output 51. If output to much p gain * 0.8 etc,to little * 1.5 etc. You should get to the stage of engine hunting turn the gain slightly below this. This is then where the data from i and d comes into play and slightly tweaking each one results in a reactive genset regardless of load.
Thanks Mr Henrik,Mr RodSTAR and Mr Anonymouse for help.
I succesfully run the motor at constant speed.Motor speed also change through given speed refrence.
Now one problem that i face is motor overshoot in slow speed refrence whenever i turn on the power.Its overshoot cycle comes down when i increase speed refrence.At full speed refrence it get exact speed never overshoot.I am using same PID gains used in original file.I think i must change the GAIN value to overcome this problem.
And also i am using variable for 0-5V to 0-1023 value through ADC.How i use this value to put the gain as used under.
pid_Kp = $0700 'Set Kp to 7.0
Please give some code to convert the value.
Hello,
I thought I explained that in post #16 above. I'll simply quote myself:I don't really know how to explain it in any other way but let me know if doesn't make sense and I'll try, or perhaps someone else can attack it from another angle.Regarding the pots, you can set the PID gains in any number system you like. The reason I show it in hex is that it is easier IMO. You can simply do pid_Kp = myADResult if you like.
1023 in decimal is the same as $03FF which, in the PID filter, is treated as 3.996 basically. See, 03 is the number on the left side of the decimalpoint and FF is on the right side. FF represents 1/256*255 or 0.996. If you'd feed it 102 from the ADConverter it would be the same as $0066 or a gain of 0.258.
If you need more gain than 1023 then simply multiply your ADResult, pid_KP=myADResult*2, now you get a gain of 0-2046 or $0000-$07FE or 0.0-7.992
/Henrik.
Bookmarks