Depth dependent speed

More
05 Jun 2014 00:09 #47681 by etnur
Depth dependent speed was created by etnur
Hello Guys, excused my bad English !!
So what I want is an depth dependent speed.

I think, I quest in a Loop (Servo thread) the relative Z-Position and increase or decrease the speedfader.

abstract:
Speedfader = absolute(F / Z)

Example:
F = 200, Z = -5 ,Fader = ?

40% = absolute(200/-5)

That's my idea, but I can't formulate it for the hal.ini.
Who can help me to solve my Problem.

Thanks a lot
best regards
Frank

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

More
05 Jun 2014 20:33 - 05 Jun 2014 23:14 #47718 by ArcEye
Replied by ArcEye on topic Depth dependent speed
Hi

It is quite easy to code, but I think the concept is flawed, the Z height does not always correspond to increased cutting depth and a corresponding requirement to reduce feed.

If you cut a 20mm deep trench in 1 mm increments, the only thing making the cut at 19mm more difficult than the one at 1mm, is the swarf build up probably.

These things are quite easy to program in gcode in a loop, I have done similar for a peck drilling routine for ngcgui, the important thing is to set limits to the amount of reduction
that can take place, or you will end up going no where.

For what it is worth here is a sample component that you could use, but I think the way to do it is in gcode through a sub when the actual cutting task requires it
component depth                 "This component returns feed divided by Z depth";

pin in float zin = 0		"receives Z height";
pin in float feedin = 0         "Receives feed in";
pin out float feedout = 0       "Output feed";
param rw float zstop = -4.0000	"Depth below which not to reduce further";
function _;
author "ArcEye";
license "GPL";
;;


FUNCTION(_)
{    
    if((zin < zstop)&&(zin < 0))
	feedout = (feedin / zstop);
    else if(zin < 0)
        feedout = (feedin / zin);
    else
        feedout = feedin;
}

regards
Last edit: 05 Jun 2014 23:14 by ArcEye.

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

More
05 Jun 2014 22:06 #47721 by ArcEye
Replied by ArcEye on topic Depth dependent speed
Just as some food for thought as to what you can do in a simple gcode program through loops

The below is a ngcgui sub that essentially replaces G81 and G83 and allows multiple holes and multiple rows, all with optional peck drilling, with optional full or partial retraction etc.
;;*************************************************************************
;; Notes
;; Straight drilling in row or grid of rows, may be offset by X and Y 
;; but offset applied incrementally to each row so Y offset applications
;; perhaps limited
;;
;; Fully adjustable pecking, defaults are quite conservative, but may want 
;; to begin pecking at 2x drill diam in difficult materials
;;
;; TODO 
;; allow different number of holes in each row?
;; allow different offsets between rows?
;; probably best achieved by chaining individual row drilling subs together
;;
;;*************************************************************************
(info: Metric Mill - stand alone adjustable peck drilling - multiple rows and / or holes - all values positive, will be converted)

o<peck_drill> sub

#<_move_feed> = #1              (=175 linear feed)
#<_drill_feed> = #2             (=50  drill feed )
#<_spindle_speed> = #3          (=800 spindle speed)
#<_depth> = #4                  (=50 depth hole-s)
#<_drill_diameter> = #5         (=10 Drill Diameter)
#<_holes_in_row> = #6           (=1 holes in row)
#<_rows> = #7                   (=1 number of rows)
#<_X_start>= #8                 (=0 X centre hole 1)           
#<_Y_start>= #9                 (=0 Y center hole 1)
#<_X_hole_increment> =#10       (=0 X inc. between holes)
#<_Y_hole_increment> = #11      (=0 Y inc. between holes)
#<_X_row_increment> =#12        (=0 X inc. between rows)
#<_Y_row_increment> = #13       (=0 Y inc. between rows)
#<_Z_standoff> = #14            (=20 Z start and finish)
#<_Z_safe> = #15                (=2 Z between holes & retract)
#<_coolant> = #16               (=9 coolant 7=Mist 8=Flood 9=Off)
#<_pecking> = #17               (=1 Peck Drill 0 = No 1 = Yes)
#<_peck_start> = #18            (=3 start pecking, N x drill dia)
#<_retraction_model> = #19      (=0 Retract 0=full 1=drill dia)
#<_pause> =#20                  (=4 Pause at top of retraction)
#<_feed_reduction_ratio> = #21  (=0.90 feed reduction ratio)
#<_speed_reduction_ratio> = #22 (=0.95 speed reduction ratio)
#<_peck_ratio> = #23            (=0.90 peck reduction ratio)
#<_min_feed> = #24              (=10 min feed)
#<_min_speed> = #25             (=450 min speed)
#<_min_peck> = #26              (=0.50 min peck fractn of drill dia)


#<NoPeckDepth> = [#<_drill_diameter> * #<_peck_start>]

o200 if[ #<NoPeckDepth> GE #<_depth>]
    #<_pecking> = 0
o200 endif

#<HoleNum> = 1
#<RowNum> = 1
#<X> = #<_X_start>
#<Y> = #<_Y_start>

o202 if[ #<_pecking> EQ 1 ]
    #<Z> = #<NoPeckDepth>
    o201 if[ #<NoPeckDepth> GT #<_depth> ]
        #<Z> = #<_depth>
    o201 endif
o202 else
    #<Z> = #<_depth>
o202 endif    
    

#<F> = #<_drill_feed>
#<S> = #<_spindle_speed>
#<Peck> = #<_drill_diameter>
#<MinPeck> = [#<Peck> * #<_min_peck> ]
#<OldZ> = #<Z>

G17 G21 G8 G40 G49
G80
G90
F#<_move_feed> S#<_spindle_speed>
M3

M#<_coolant>

G00 X#<X> Y#<Y> Z#<_Z_StandOff>

o100 while[#<RowNum> LE #<_rows>]

    o101 while[#<HoleNum> LE #<_holes_in_row> ]
            
            G00 X#<X> Y#<Y> Z#<_Z_safe>
            G00 Z0.1
            G01 Z-#<Z> F#<F>
            o104 if[#<_pecking> EQ 1]
                o102 if[ #<_retraction_model> EQ 0]
                    G00 Z#<_Z_safe>
                o102 else
                    G00 Z -[#<Z> - #<_drill_diameter> ]
                o102 endif
                o112 if[#<Z> LT #<_depth> ] ;; prevent pause at end of hole drilling
                    G4 P#<_pause> 
                o112 endif
            o104 endif
                    
            o103 while[#<Z> LT #<_depth> ]
                
                o110 if[ #<_pecking> EQ 1 ]
                    #<OldZ> = #<Z>
                    G00 Z-[#<OldZ> -0.5]
                            
                   #<Peck> = [#<Peck> * #<_peck_ratio>]
                    o104 if[#<Peck> LT #<MinPeck> ]
                        #<Peck> = #<MinPeck>
                    o104 endif               
                    #<F> = [#<F> * #<_feed_reduction_ratio>]
                    o105 if[#<F> LT #<_min_feed> ]
                        #<F> = #<_min_feed>
                    o105 endif
                
                    #<S> = [#<S> * #<_speed_reduction_ratio>]
                    o106 if[#<S> LT #<_min_speed> ]
                        #<S> = #<_min_speed>
                    o106 endif
                                
                    #<Z> = [#<Z> + #<Peck>]
                    o107 if[ #<Z> GT #<_depth>]
                        #<Z> = #<_depth>
                    o107 endif
                
                    S#<S>
                o110 endif
                
                G01 Z-#<Z> F#<F>

                o109 if[ #<_pecking> EQ 1 ]
                    o108 if[ #<_retraction_model> EQ 0]
                        G00 Z#<_Z_safe>
                    o108 else
                        G00 Z -[#<Z> - #<_drill_diameter> ]
                    o108 endif
                    o111 if[#<Z> LT #<_depth> ] ;; prevent pause at end of hole drilling
                        G4 P#<_pause> 
                    o111 endif
                o109 endif
                        
            o103 endwhile
            
            G00 Z#<_Z_safe>
            
            #<F> = #<_drill_feed>
            #<S> = #<_spindle_speed>
            #<Peck> = #<_drill_diameter>
            
            o202 if[ #<_pecking> EQ 1 ]
                 #<Z> = #<NoPeckDepth>
                o201 if[ #<NoPeckDepth> GT #<_depth> ]
                    #<Z> = #<_depth>
                o201 endif
            o202 else
                #<Z> = #<_depth>
            o202 endif    
                        
            #<X> = [#<X> + #<_X_hole_increment>]               
            #<Y> = [#<Y> + #<_Y_hole_increment>]               
            
            #<HoleNum> = [#<HoleNum> + 1] 
               
    o101 endwhile
    
;    G00 Z#<_Z_safe>
    #<HoleNum> = 1
    #<X> = [#<_X_start> + [#<_X_row_increment> * #<RowNum>] ]
    #<Y> = [#<_Y_start> + [#<_Y_row_increment> * #<RowNum>] ] 
    #<RowNum> = [#<RowNum> + 1]
    
o100 endwhile

G00 Z#<_Z_safe>

M9
M5

G00 X#<_X_start> Y#<_Y_start> Z#<_Z_StandOff>

M2


o<peck_drill> endsub

regards

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

More
06 Jun 2014 18:26 #47750 by etnur
Replied by etnur on topic Depth dependent speed
Thank you very much for the solution.
I don't know NGCGUI, it can be implemented in EMC. What I found is this www.linuxcnc.org/docs/devel/html/gui/ngcgui.html.
I will read the guide. I hope I can quest you when I have problems.

THANKS a Lot.
best regards
Frank

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

More
06 Jun 2014 18:45 #47751 by BigJohnT
Replied by BigJohnT on topic Depth dependent speed
Here is the docs for ngcgui.

linuxcnc.org/docs/html/gui/ngcgui.html

I use ngcgui for 98% of my lathe ops.

JT

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

More
09 Jun 2014 20:54 #47811 by andypugh
Replied by andypugh on topic Depth dependent speed

Speedfader = absolute(F / Z)


This isn't trivial, because the HAL layer doesn't actually know the current Z depth. It knows where the joints are in machine-coordinates, but has no idea about part coordinates.
(or, at least, I don't _think_ that there are any HAL pins that have that function)

As others have said, it is probably better to do this in G-code. If you _really_ want to do it in HAL then I think we can find a way, but it won't be pretty.

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

Time to create page: 0.115 seconds
Powered by Kunena Forum