Help needed to get my 7i76E + 7i85S + 7i73 on my mill going.

More
24 Dec 2017 07:16 #103526 by tecno

pin out float speed "speed in RPM";


How does this speed connect to my HAL?

#*******************
# SPINDLE S
#*******************

setp pid.s.Pgain [SPINDLE_9]P
setp pid.s.Igain [SPINDLE_9]I
setp pid.s.Dgain [SPINDLE_9]D
setp pid.s.bias [SPINDLE_9]BIAS
setp pid.s.FF0 [SPINDLE_9]FF0
setp pid.s.FF1 [SPINDLE_9]FF1
setp pid.s.FF2 [SPINDLE_9]FF2
setp pid.s.deadband [SPINDLE_9]DEADBAND
setp pid.s.maxoutput [SPINDLE_9]MAX_OUTPUT
setp pid.s.error-previous-target true

net spindle-index-enable <=> pid.s.index-enable
net spindle-enable => pid.s.enable
net spindle-vel-cmd-rpm => pid.s.command
net spindle-vel-fb-rpm => pid.s.feedback
net spindle-output <= pid.s.output

# ---Encoder feedback signals/setup---

setp hm2_7i76e.0.encoder.04.counter-mode 0
setp hm2_7i76e.0.encoder.04.filter 1
setp hm2_7i76e.0.encoder.04.index-invert 0
setp hm2_7i76e.0.encoder.04.index-mask 0
setp hm2_7i76e.0.encoder.04.index-mask-invert 0
# setp hm2_7i76e.0.encoder.00.scale [SPINDLE_9]ENCODER_SCALE

net spindle-revs <= hm2_7i76e.0.encoder.04.position
net spindle-vel-fb-rps <= hm2_7i76e.0.encoder.04.velocity
net spindle-index-enable <=> hm2_7i76e.0.encoder.04.index-enable

# ---setup spindle control signals---

net spindle-vel-cmd-rps <= motion.spindle-speed-out-rps
net spindle-vel-cmd-rps-abs <= motion.spindle-speed-out-rps-abs
net spindle-vel-cmd-rpm <= motion.spindle-speed-out
net spindle-vel-cmd-rpm-abs <= motion.spindle-speed-out-abs
net spindle-enable <= motion.spindle-on
net spindle-cw <= motion.spindle-forward
net spindle-ccw <= motion.spindle-reverse
net spindle-brake <= motion.spindle-brake
net spindle-revs => motion.spindle-revs
net spindle-at-speed => motion.spindle-at-speed
net spindle-vel-fb-rps => motion.spindle-speed-in
net spindle-index-enable <=> motion.spindle-index-enable

# ---Setup spindle at speed signals---

sets spindle-at-speed true

setp hm2_7i76e.0.7i76.0.0.spinout-scalemax 2400
setp hm2_7i76e.0.7i76.0.0.spinout-maxlim 2500

net spindle-enable hm2_7i76e.0.7i76.0.0.spinena
net spindle-vel-cmd-rpm-abs hm2_7i76e.0.7i76.0.0.spinout
net spindle-ccw hm2_7i76e.0.7i76.0.0.spindir

Please Log in or Create an account to join the conversation.

More
24 Dec 2017 07:29 #103527 by rodw

I might have done this if the hi/lo ratios could have been locked down to a simple multiple of the base ratio but that did not appear to be the case.


Lo is 50% of Hi or do I misunderstand this?


No I think I was the one that misunderstood not really knowing your mill.

Sorry but I don't really understand spindles as my plasma cutter does not have one. I suspect that the pin that needs to be connected instead of these setp commands.
setp hm2_7i76e.0.7i76.0.0.spinout-scalemax 2400
setp hm2_7i76e.0.7i76.0.0.spinout-maxlim 2500

You might need to mult the speed by say 0.9 for scalemax.

Please Log in or Create an account to join the conversation.

More
24 Dec 2017 07:39 #103528 by tecno
OK, let's hope that Andy or somebody else chimes in as I would like to get this 'comp' working and also learning how to do this.

Please Log in or Create an account to join the conversation.

More
24 Dec 2017 09:11 #103530 by Clive S
Tnx Rod I have no need for this but your posts do help a lot as you put comments in as to explain what is going on.
I find this very helpful with my hal leaning experience.
The following user(s) said Thank You: rodw

Please Log in or Create an account to join the conversation.

More
24 Dec 2017 11:03 #103534 by andypugh

Sorry but I don't really understand spindles as my plasma cutter does not have one. I suspect that the pin that needs to be connected instead of these setp commands.
setp hm2_7i76e.0.7i76.0.0.spinout-scalemax 2400
setp hm2_7i76e.0.7i76.0.0.spinout-maxlim 2500


The spindle analogue output scale values can not be linked, they are parameters rather than pins.

I am not 100% sure what is required here, but I am assuming that the intention is that LinuxCNC sends the right motor speed to get the required spindle speed.

You could set the scalemax and maxlim to the actual motor speed. Or scale it from 0 to 100% or from 0 to 1.

The best approach probably depends on where the spindle speed feedback is from, is it from a spindle encoder, a motor encoder or from the VFD?

It is possible that the custom component output only needs to connect to the pid.s.ff0

(Having a closed-loop spindle-speed configuration does slightly complicate things, the feedback might need scaling too)

Please Log in or Create an account to join the conversation.

More
24 Dec 2017 11:52 #103539 by rodw
As I said, I don't know anything about spindles. Maybe this component should return something else than spindle maximum speed. Maybe it should only be used to update the GUI with the gear selection parameters.

It seems that the requirement to use a parameter to set maximum spindle speed is not designed with a gearbox in mind.

Please Log in or Create an account to join the conversation.

More
24 Dec 2017 11:53 #103540 by tecno


I am not 100% sure what is required here, but I am assuming that the intention is that LinuxCNC sends the right motor speed to get the required spindle speed.

You could set the scalemax and maxlim to the actual motor speed. Or scale it from 0 to 100% or from 0 to 1.

The best approach probably depends on where the spindle speed feedback is from, is it from a spindle encoder, a motor encoder or from the VFD?

It is possible that the custom component output only needs to connect to the pid.s.ff0

(Having a closed-loop spindle-speed configuration does slightly complicate things, the feedback might need scaling too)

Please Log in or Create an account to join the conversation.

More
24 Dec 2017 11:56 #103541 by tecno

File Attachment:

File Name: combimillx...2-24.hal
File Size:17 KB
Attachments:

Please Log in or Create an account to join the conversation.

More
24 Dec 2017 13:48 #103546 by andypugh
So, you have a PID looking at the spindle speed, taking command from LinuxCNC.

In theory the PID ought to be able to work in any gear, and adjust the spindle control voltage accordingly.

But, in practice it will need a bit of help to set the speed correctly at a reasonable speed.

PID output is partly made up of FF0 * input. So just setting FF0 of the PID for each gear might have the desired effect.

I would be tempted to scale the spindle control voltage to motor speed. Assuming a 1500 rpm motor then the parameter you want out of the component is 1500/max_speed for each gear (rather than the actual top speed) then link that to the PID FF0 pin.

Please Log in or Create an account to join the conversation.

More
24 Dec 2017 22:18 - 24 Dec 2017 22:19 #103577 by rodw
Ok, seeing it is Christmas, here is gearbox2 component (Note the name change) with enhancements suggested by Andy.

I've added a parameter called maxrpm
#set as per Andy's example
setp gearbox2.maxrpm 1500
and also a new output pin "gearbox2.speedratio" you can use to set the pid FF0 as per Andy's suggestions.
component gearbox2 "LinuxCNC HAL component for Techno's gearbox";

author "Rod Webster";

pin   in  bit input_a      "input a";
pin   in  bit input_b      "input b";
pin   in  bit input_c      "input c";
pin   in  bit input_d      "input d";
pin   in  bit input_e      "input e";
pin   in  bit gear_shift   "gear shift, true if high";
pin   in  bit higear       "true if in high gear";
pin   out float speed      "speed in RPM";
pin   out float speedratio "max RPM for machine divided by maximum RPM for gear";
param rw  float maxrpm     "maximum RPM for machine";
   

function _;
license "GPL";
;;

#include <rtapi_math.h>


FUNCTION(_) {
    static double speedarray[4][5] = {
        {2500.0, 1500.0, 900.0, 540.0, 325.0},
        {1500.0, 900.0,  540.0, 325.0, 195.0},
        {1250.0, 750.0,  450.0, 270.0, 160.0},
        { 750.0, 450.0,  270.0, 160.0, 100.0}
    };
    int idx;
    
    idx  = (higear) ? 0:1 +  (gear_shift) ? 0:2;
    if(input_a)
        speed = speedarray[idx][0];
    if(input_b)
        speed = speedarray[idx][1];
    if(input_c)
        speed = speedarray[idx][2];
    if(input_d)
        speed = speedarray[idx][3];
    if(input_e)
        speed = speedarray[idx][4];
    speedratio = maxrpm/speed;
} 

File Attachment:

File Name: gearbox2_2...-24.comp
File Size:1 KB
Attachments:
Last edit: 24 Dec 2017 22:19 by rodw.

Please Log in or Create an account to join the conversation.

Moderators: cmorley
Time to create page: 0.142 seconds
Powered by Kunena Forum