Nonlinear PWM
I have little problem as my PWM to spindleRPM interface is nonlinear. I look into documentation but I don't find any solution.
In one of My old controller I have simple lookup table with (I think) 8 points in LUT and do interpolation between.
Is it possible to make similar in linuxcnc?
For example I measure the PWM rate at 5, 10, 15, 20, 25, 30 x1000 RPM and store PWM result in table so the PID and PWM can work to close loop?
Please Log in or Create an account to join the conversation.
At least all the modern VFD that I worked on can adjust the input vs the output.
Please Log in or Create an account to join the conversation.
recently to master.
it looks like just what is needed
Please Log in or Create an account to join the conversation.
Just woodworking router with triac regulation.
I tided photoresistor instead potentiometer in woodworking spindle, and lit LED with pwm on it.
It works nice, just the ramp is not linear. Seems like to be logharitmic.
The PID works nice up to around 20000RPM, after that doesn't work as it take loooong time to reach speed. If I make PidI bigger then works little better but start to oscillate with low rpm. I will try to make regulation up to 20000 RPM with one set of parameters P.I.D, and over 20000RPM with other set of P.I.D parameters. Swiching parameters with mux should be easy. But if I need more "ranges" then this solution is not so good....
Will try...
Please Log in or Create an account to join the conversation.
The PID works nice up to around 20000RPM, after that doesn't work as it take loooong time to reach speed. If I make PidI bigger then works little better but start to oscillate with low rpm. I will try to make regulation up to 20000 RPM with one set of parameters P.I.D, and over 20000RPM with other set of P.I.D parameters. Swiching parameters with mux should be easy. But if I need more "ranges" then this solution is not so good.....
Changing PID with speed (etc) was exactly what "lincurve" was written for, but it might be easier to linearise the PWM using the same function.
Please Log in or Create an account to join the conversation.
For example if I setup this:
loadrt lincurve count=1 personality=3
setp lincurve.0.x-val-00 0
setp lincurve.0.x-val-01 10
setp lincurve.0.x-val-02 20
setp lincurve.0.y-val-00 0
setp lincurve.0.y-val-01 10
setp lincurve.0.y-val-02 100
What y I got for X=5? (0 or 5?)
What y I got for X=15? (10 or 45?)
If value is interpolated then it's ok for me. But in docs seems that it isn't?
Slavko.
Please Log in or Create an account to join the conversation.
If value is interpolated then it's ok for me.
It is interpolated.
If you need it then it should be relatively easy to get the file from git.linuxcnc.org and install it on your system with comp --install
Please Log in or Create an account to join the conversation.
for lincurve I missread that interpolation is done betwen range but not if input is outside of parameter.
.. now tryyng to make it work.
Please Log in or Create an account to join the conversation.
I do linearize the signal just before entering PWM. With personality=7 I can achive pretty precise open loop spindle speed.
But untill now I never used PID on linuxcnc, and something is strange there. (at least something I dont expect)
For example when I put number 500 to PWM (lincurve before pwm) the spindle run around 30000 RPM (500 RPS), and I have pid.command=500 and pid.feedback=500 too. But the output is not 500 but 0!
Test done with d P=1, I=0, D=0. If I change feedback to 499 I got output of 1. So PID output is only the error factors.
So if I assume correct I need to add command and error (the pid output) together and feed to pwm.
I suppose that connecting pid.N.bias and pid.N.command together is the right way?
...Or I make something wrong elsewhere?
Slavko
Please Log in or Create an account to join the conversation.
That might be good enough. My mill runs open-loop with automatic gear detection (described elsewhere in the forum) and I am perfectly happy with it.With personality=7 I can achive pretty precise open loop spindle speed.
That is exactly how PID works. Output is proportional to error. With no error, there is no output with a purely P-based setup.For example when I put number 500 to PWM (lincurve before pwm) the spindle run around 30000 RPM (500 RPS), and I have pid.command=500 and pid.feedback=500 too. But the output is not 500 but 0!
That would work, but there is a built-in feature of PID for this situation. Connect your command signal to the FF0 pin, and the command is added to the output.So if I assume correct I need to add command and error (the pid output) together and feed to pwm.
You will probably get the best results with FF0 connected, and using only I-gain to do most of the work, and just a hint of P to get it there faster.
Please Log in or Create an account to join the conversation.