Need help to orient spindle with analog VFD
- backtime
- Offline
- Senior Member
- Posts: 56
- Thank you received: 0
setp hm2_5i25.0.7i76.0.3.spinout-minlim 40
setp hm2_5i25.0.7i76.0.3.spinout-maxlim 6000
setp hm2_5i25.0.7i76.0.3.spinout-scalemax 6000
Now, for tool change, I need to orient spindle in a specific position, I was trying orient component, so I added a new pid and started to configure the orient component as shown in the documentation.
But reading orient.comp source I realized that command output is a position in spindle rounds, obviously I can't use orient pid output directly to drive hm2_5i25.0.7i76.0.3.spinout because the scale, and I don't understand how I can change configuration to make things work.
Any help would be appreciated.
Please Log in or Create an account to join the conversation.
- PCW
- Offline
- Moderator
- Posts: 17905
- Thank you received: 4774
of the two PID components
The (normal velocity mode and orient position mode) PIDs will both have to be disabled when inactive (using orient-enable and its complement) and the appropriate PID output selected via a mux component
The orient PID probably also wants a max_output of some safe speed.
Please Log in or Create an account to join the conversation.
- backtime
- Offline
- Senior Member
- Posts: 56
- Thank you received: 0
For what I know the velocity PID command input receive a value in RPM (in my case absolute value) and try to maintain stable this value using encoder velocity as feedback, actually the command is a value in RPM from 0 to 6000, then the output will be value in RPM from 0 to 6000 and the SPINDLEOUT scale allow to generate a voltage from 0 to 10V (because I have 0V on SPINDLE- and 10V on SPINDLE+), is this correct?
Now, orient PID command input can be any float number, positive and negative, calculated adding the desired position in fraction of turn to actual spindle position in revolutions (the encoder position output). The value sent to orient PID command pin maybe for example 300000 or -240000 (in spindle revolutions), but then what value should I expect from orient PID output? I thought it was close to command value, but you say that I can scale this value using PID tuning parameters. This is completely new for me, can you better explain the concept?
Thank you for your support.
Please Log in or Create an account to join the conversation.
- PCW
- Offline
- Moderator
- Posts: 17905
- Thank you received: 4774
Please Log in or Create an account to join the conversation.
- backtime
- Offline
- Senior Member
- Posts: 56
- Thank you received: 0
I think most orient schemes use index so the count is always bounded to +- 1 turn
Looking at source code of orient.comp I don't see any pin to connect to encoder index-enable, without this the counter is not reset at all, but even if the counter was reset the output of the PID values would not be adequate to drive the mesa spinout because I would have values in the range +-1 that is equals to ask the spindle to run at +-1RPM.
May be I'm losing something trivial, I hope that someone with a similar configuration can give me some hints.
Thanks for your help.
Please Log in or Create an account to join the conversation.
- PCW
- Offline
- Moderator
- Posts: 17905
- Thank you received: 4774
LinuxCNCs motion component deals with spindle index enable but I dont know if it has any smarts regarding spindle orient
As far as scaling goes, Imagine a spindle position PID loop with a P term of 6000
This would request a velocity of +-6000 RPM with a +-1 turn error (probably way too much gain)
so PID output scaling is simply done by scaling the PID parameters
Please Log in or Create an account to join the conversation.
- backtime
- Offline
- Senior Member
- Posts: 56
- Thank you received: 0
The few hal configs I have seen that do spindle orientation have specific spindle index enable wiring
LinuxCNCs motion component deals with spindle index enable but I dont know if it has any smarts regarding spindle orient
I can't find more example of orient comp use, but is clear that command output is within +-1 the actual position so the error magnitude is well known.
As far as scaling goes, Imagine a spindle position PID loop with a P term of 6000
This would request a velocity of +-6000 RPM with a +-1 turn error (probably way too much gain)
so PID output scaling is simply done by scaling the PID parameters
Ok, now I understand the point, this is true for a known magnitude error and because P is the linear term, I can do some experiment with the other PID term setting provided that the max_output is set at safe speed. I'll try this configuration with a more safe P value.
Many thanks for clarifications.
Please Log in or Create an account to join the conversation.
- andypugh
- Offline
- Moderator
- Posts: 23560
- Thank you received: 4858
I think the trick in your case is to alter the velocity PID to use the motion.spindle-speed-out-rps outputs, and work in revs-per-second throughout. Then the spindle encoder is scaled at one unit per revolution, and everything works out.
I made a schematic for spindle orient logic, I don't know if you have seen it:
wiki.linuxcnc.org/cgi-bin/wiki.pl?SpindleOrient
Please Log in or Create an account to join the conversation.
- backtime
- Offline
- Senior Member
- Posts: 56
- Thank you received: 0
The orient comp does not need the spindle index to be triggered.
Yes, this is clear reading source code, the trigger is on the positive edge of the enable signal.
I think the trick in your case is to alter the velocity PID to use the motion.spindle-speed-out-rps outputs, and work in revs-per-second throughout. Then the spindle encoder is scaled at one unit per revolution, and everything works out.
I can work in RPS, in this case the orient output (that will always be +-1) will result in +-60RMP, Is that your proposed solution?
It may work but I don't understand what do you mean with "reduce the encoder scale to one unit per rev". I have a 500ppr encoder, and encode scale is set to 500, so i have the right velocity and position of spindle.
I made a schematic for spindle orient logic, I don't know if you have seen it:
wiki.linuxcnc.org/cgi-bin/wiki.pl?SpindleOrient
This is actually very close to my configuration, the problem was to have the two PID output too different to correctly driver the mesa spinout pin. Using RPS may be I can resolve the problem, I'll give it a try.
Thanks to all
Please Log in or Create an account to join the conversation.
- andypugh
- Offline
- Moderator
- Posts: 23560
- Thank you received: 4858
This is actually very close to my configuration, the problem was to have the two PID output too different to correctly driver the mesa spinout pin.
I don't understand what you mean. The whole point of having two independent PID components is that you can tune them both to be correct for their tasks.
Please Log in or Create an account to join the conversation.