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

More
8 years 10 months ago #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
8 years 10 months ago - 8 years 10 months ago #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
Code:
#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.
Code:
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.21 KB
Last edit: 8 years 10 months ago by rodw.

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

More
8 years 10 months ago #103586 by tecno
Hi Rod, thanks.
a new output pin "gearbox2.speedratio" you can use to set the pid FF0 as per Andy's suggestions. = I am lost how this works.

I hope you will have a nice Christmas day.

Cheers
Bengt

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

More
8 years 10 months ago #103588 by rodw

tecno wrote: Hi Rod, thanks.
a new output pin "gearbox2.speedratio" you can use to set the pid FF0 as per Andy's suggestions. = I am lost how this works.

I hope you will have a nice Christmas day.

Cheers
Bengt


All I've done is extend the component to incorporate the maths Andy has suggested to keep your hal file tidy.
Use the gearbox2 component instead of the earlier one I provided.

Your max RPM seems to be 2500 rpm from your spreadsheet so I think it would look like this in addition to the hal code I published.
Code:
setp gearbox2.maxrpm 2500 net gbox-ratio <= gearbox2.speedratio net gbox-ratio => <your-spindle-ff0-pin>
Substitute the correct hal pin for ff0 as discussed in Andy's last thread. This is what he said

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.


If this works, it could be quite a handy template for a machine with a gearbox

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

More
8 years 10 months ago #103589 by tecno
Hi Rod,
Nameplate says 2500rpm but in reality just now ~2400rpm (still needs some tweaking obviously)

net gbox-ratio => <your-spindle-ff0-pin> sorry but I do not know what pin that is.

I think we will get there with Andys help.

Cheers

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

More
8 years 10 months ago #103599 by rodw
In your hal file you have
Code:
#******************* # 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

I think again you are going to be caught here as pid.s.FF0 is a parameter so it can't be changed. Maybe Andy will have a solution.

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

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