- Posts: 394
- Thank you received: 95
Current turning capabilities status
13 years 8 months ago #30670
by emcPT
Replied by emcPT on topic Current turning capabilities status
I managed to get a working configuration changing a bit of Andy code. Like cmorley said, there was already a pid.s, so I used that one to have a more equal syntax.
But there is something lacking. Unfortunately my knowledge is not enough.
It seams that the output is very low, as some scale was missing, it is similar to what I had (before trying the PID where I had to scale the output to 10V).
I post the current hal and ini files.
Once again thank you.
But there is something lacking. Unfortunately my knowledge is not enough.
It seams that the output is very low, as some scale was missing, it is similar to what I had (before trying the PID where I had to scale the output to 10V).
I post the current hal and ini files.
Once again thank you.
Please Log in or Create an account to join the conversation.
13 years 8 months ago #30671
by andypugh
Replied by andypugh on topic Current turning capabilities status
I think you need a positive FF0 and a negative encoder_scale.
That might also require you to switch FWD/REV pins.
The PID component isn't brilliant with negative coefficients.
Also, if FF0 is negative then a positive P-term will operate in the wrong direction..
That might also require you to switch FWD/REV pins.
The PID component isn't brilliant with negative coefficients.
Also, if FF0 is negative then a positive P-term will operate in the wrong direction..
Please Log in or Create an account to join the conversation.
13 years 8 months ago #30672
by emcPT
Replied by emcPT on topic Current turning capabilities status
I will try to change the signals once at time and post the results.
One thing that I want to ask is when there is a change in the hal and ini files, I always close linuxcnc and open again so that the changes are set up. Can this be done inside linuxcnc, like "reload init settings?" without closing linuxcnc?
One thing that I want to ask is when there is a change in the hal and ini files, I always close linuxcnc and open again so that the changes are set up. Can this be done inside linuxcnc, like "reload init settings?" without closing linuxcnc?
Please Log in or Create an account to join the conversation.
13 years 8 months ago #30674
by andypugh
You have to exit and reload to use the files.
However, you can change parameters and re-wire HAL live. (just not via the files)
For example, to tune the PID settings you can open the HAL window Machine->Show Hal Configuration, and then type commands like "setp pid.0.Pgain 10" in the text box at the bottom.
You might even be able to tune the spindle with the "Machine -> Calibration" tool. It's certainly worth trying this, as that also writes the new values to the INI file. (commands in the HAL window don't).
A third option is the normal command line "halcmd setp pid.0.Pgain" for example.
To experiment with HAL outside of LinuxCNC you can run a standalone HAL session with "halrun". I do a lot of my testing and development that way. www.linuxcnc.org/docs/html/man/man1/halcmd.1.html
Replied by andypugh on topic Current turning capabilities status
emcPT wrote: One thing that I want to ask is when there is a change in the hal and ini files, I always close linuxcnc and open again so that the changes are set up. Can this be done inside linuxcnc, like "reload init settings?" without closing linuxcnc?
You have to exit and reload to use the files.
However, you can change parameters and re-wire HAL live. (just not via the files)
For example, to tune the PID settings you can open the HAL window Machine->Show Hal Configuration, and then type commands like "setp pid.0.Pgain 10" in the text box at the bottom.
You might even be able to tune the spindle with the "Machine -> Calibration" tool. It's certainly worth trying this, as that also writes the new values to the INI file. (commands in the HAL window don't).
A third option is the normal command line "halcmd setp pid.0.Pgain" for example.
To experiment with HAL outside of LinuxCNC you can run a standalone HAL session with "halrun". I do a lot of my testing and development that way. www.linuxcnc.org/docs/html/man/man1/halcmd.1.html
Please Log in or Create an account to join the conversation.
13 years 8 months ago #30685
by emcPT
Replied by emcPT on topic Current turning capabilities status
I was able to make the spindle work but I add to change the OUTPUT_SCALE = 2500 (so I am not sure if I am doing correctly as explicitly Andy told me to use 1)
This is the most stable that I managed, but still not good enough.
[SPINDLE_9]
P = 4.0
I = 0.0
D = 0.0
# Tested 0, 10, 100, 1000 and 2000 (also negative)
FF0 = 58
ENCODER_SCALE = 4000.0
OUTPUT_SCALE = 2500
If I use FF0 with a lower value it is like the PID does not do anything. For example I issue S1000, the output will be like 300 without going up (like the PID should work).
If the FF0 value is for example 100, as soon I make S1000 or any other value the spindle goes to the maximum and stays there...
This is the most stable that I managed, but still not good enough.
[SPINDLE_9]
P = 4.0
I = 0.0
D = 0.0
# Tested 0, 10, 100, 1000 and 2000 (also negative)
FF0 = 58
ENCODER_SCALE = 4000.0
OUTPUT_SCALE = 2500
If I use FF0 with a lower value it is like the PID does not do anything. For example I issue S1000, the output will be like 300 without going up (like the PID should work).
If the FF0 value is for example 100, as soon I make S1000 or any other value the spindle goes to the maximum and stays there...
Please Log in or Create an account to join the conversation.
13 years 8 months ago #30686
by PCW
Replied by PCW on topic Current turning capabilities status
If you set output scale to VFD RPM at 10V, FF0 will have to be 60 since the PID inputs are in RPS, not RPM.
Can you make it stable with more P term? 4 is very low when full scale output is 2500, taking your example, at 1000 RPM commanded speed (16.6 RPS) the PID error at 300 RPM (5 RPS) is 11.6 RPS. 11.6 X Pgain =~46 RPM (since output is scaled in ~RPM)which is a negligible contribution to the output.
Once you get a reasonable P gain, you might try adding some I term
Can you make it stable with more P term? 4 is very low when full scale output is 2500, taking your example, at 1000 RPM commanded speed (16.6 RPS) the PID error at 300 RPM (5 RPS) is 11.6 RPS. 11.6 X Pgain =~46 RPM (since output is scaled in ~RPM)which is a negligible contribution to the output.
Once you get a reasonable P gain, you might try adding some I term
Please Log in or Create an account to join the conversation.
Time to create page: 0.071 seconds