Jump to content

Welcome to eMastercam

Register now to participate in the forums, access the download area, buy Mastercam training materials, post processors and more. This message will be removed once you have signed in.

Use your display name or email address to sign in:

Cycle time ?


Recommended Posts

Define the difference between cycle time and operating time?

 

Time calculations are pretty straightforward. For every type of movement, you need calculations to measure the distance that is traveled, and the speed of the movement. Simply add the time for each movement, and output them where desired... A time for each tool, or a total time for the program.

 

I will say that placing the time statement in the header of a program will require the use of buffer files to process the entire program prior to outputting to the NC file.

  • Like 1
Link to comment
Share on other sites

The other issue you run into with Cycle Time calculations is the use of canned cycles. In the .SET files, we disable the Canned Cycle output, which causes MP to linearize the Drill Cycle motion into G0/G1 moves, so that the time can be calculated properly and added to the total time.

 

Adding Cycle Time to your output is not a trivial task. There are many steps you must take to calculate the time values and then add them to your NC output.

  • Like 1
Link to comment
Share on other sites

I agree with Colin, there are a lot of things to evaluate when adding times. With canned cycles, the easier way to do time calculations is as Colin described... disable the canned cycles and force longhand output. However, it is possible to calculate time while still using the canned cycle output. The formulas required are more complex, and must factor in the parameters of the cycle.

  • Like 1
Link to comment
Share on other sites

Lemme' share my workaround. I stolen from .set and merged with a 3ax Mill post 'bout 3 years ago.

I made some test than, and we used at many machine. As I remember all of them worked well.

Including canned drill cycles...witttt dwell too... ;)

 

Not really easy, but works pretty well... ;)

Here ya go a HAAS sample:

 

Variables:

# --- Ciklus idő változói ---
# *IMPORTANT* -
# Note that the Program TOTAL TIME includes the Toolchange time(s),
# so it will be longer than the Total RAPID time + Total FEED time!
# Set the time it takes for machine to do a toolchange
tlchgtime	 : 0.066 #Tool Change Time (* in Minutes *) I'ts 4 sec now
ttltime		 : 0	 #Total operation time
tltime		 : 0	 #Feed time
trtime		 : 0	 #Rapid time
total		 : 0	 #Total machine time
tot_ltime	 : 0	 #Total FEED time
tot_rtime	 : 0	 #Total RAPID time
len			 : 0	 #Length for calculation
dx			 : 0	 #Delta x
dy			 : 0	 #Delta y
dz			 : 0	 #Delta z
drill_length_r : 0	 # Drill length - RAPID
drill_length_f : 0	 # Drill length - FEED
actual_drl_depth: 0	 # Actual drill depth variable
peck_safe_dist : 0.3 # Peck/Chip break safe distance for retratct into hole
use_TC_pos	 : yes$ # Calculate with Home positions @ TC? 0=No, 1=Yes
sav_X_Pos	 : 0	 # Saved X position, use X_home/Y_home/Z_home in rapids at TC
sav_Y_Pos	 : 0	 # Saved Y position, use X_home/Y_home/Z_home in rapids at TC
sav_Z_Pos	 : 0	 # Saved Z position, use X_home/Y_home/Z_home in rapids at TC
time_format	 : 2	 # Time format of output times in NC code:
				 # 1 = 2h 14:25
				 # 2 = 2hrs, 14mins, 25.08sec
fs2 8 0^2 0^2n	 #Decimal, 2 place, omit decimal if whole number, non-modal
fmt	 2 llen	 #Feed cut length
fmt	 2 rlen	 #Rapid traverse cut length
fmt	 2 llen_total #Feed cut length (program total)
fmt	 2 rlen_total #Rapid traverse cut length (program total)
fmt	 2 total	 #Total part time
fmt	 2 ttltime	 #Total operation time
fmt	 4 thrs	 #Time in hours
fmt	 4 tmin	 #Time in minutes
fmt	 8 tsec	 #Time in seconds
# ---------------------------

 

 

Postblocks for time:

# --- Cycle Time Postblocks ---
psetup		 #Output of toolchange information
 !gcode$
 llen = zero	 #Reset counter for next tool
 rlen = zero	 #Reset counter for next tool
 tltime = zero #Reset counter for next tool
 trtime = zero #Reset counter for next tool
 ttltime = zero #Reset counter for next tool
 if use_TC_pos,
 [
 sav_X_Pos = x$, sav_Y_Pos = y$, sav_Z_Pos = z$
 x$ = xh$, y$ = yh$, z$ = zh$
 ptime_calc
 x$ = sav_X_Pos, y$ = sav_Y_Pos, z$ = sav_Z_Pos,
 ]

ptooldata	 #Total ending data for tool (Path Length and Times)
 llen_total = llen_total + llen #Keep running total for Program
 rlen_total = rlen_total + rlen #Keep running total for Program
 tot_ltime = tot_ltime + tltime	 #Total FEED time
 tot_rtime = tot_rtime + trtime	 #Total RAPID time
 ttltime = tltime + trtime		 #Calc. current Tool Time
 total = ttltime + total + tlchgtime #Calc. total Program Time

pthrminsec	 #Convert minutes to hr/min/sec format
 thrs = int(ttltime / 60)
 tmin = int(ttltime - thrs * 60)
 tsec = (ttltime - thrs * 60 - tmin) * 60

ptimeout		 #Output "times"
 pthrminsec #Convert minutes to hr/min/sec format
 if time_format = one,
 [
 #Output 'HOURS'
 if thrs = one, *thrs, "hr, "
 if thrs > one, *thrs, "hrs, "
 #Output 'MINUTES'
 if tmin = one, *tmin, "min, "
 if tmin > one, *tmin, "min, "
 #Output 'SECONDS'
 if tsec > zero, *tsec, "sec"
 ]
 else,
 [
 result = newfs(five, tsec)
 #Output 'HOURS'
 if thrs > zero, *thrs, "h "
 #Output 'MINUTES' and 'SECONDS'
 *tmin, ":", *tsec
 ]

ptimer		 #Rapid time and length calc
 rlen = rlen + len		 #Running total RAPID length
 trtime = rlen / pst_rpd_fr$ #Running total RAPID time

ptimel		 #Feed time and length calc
 llen = llen + len
 tltime = tltime + len / fr_pos$

ptime_calc		 #Distance calculations
 # Delta Distances
 dx = x$ - prv_x$
 dy = y$ - prv_y$
 dz = z$ - prv_z$
 # Distance at linear movement
 if gcode$ = zero | gcode$ = one, len = sqrt(dx^2 + dy^2 + dz^2)
 # Distance at circular movement
 if gcode$ = two | gcode$ = three, len = (abs(sweep$)/360) * 2 * arcrad$ * pi$
 # Distance at drilling
 if gcode$ = 81 | gcode$ = 100,
 [
 if gcode$ = 100, ptime_drill_XY
 if drillcyc$ = 0, ptime_drill_0 # Simple Drill
 if drillcyc$ = 1, ptime_drill_1 # Peck Drill
 if drillcyc$ = 2, ptime_drill_2 # Chip Break Drill
 if drillcyc$ = 3, ptime_drill_3 # Tapping
 if drillcyc$ = 4, ptime_drill_4 # Bore, feed out, Reaming
 if drillcyc$ = 5, ptime_drill_0 # Bore, stop, rapid out, SAME movements as "Simple Drill"
 if drillcyc$ = 6, ptime_drill_0 # Bore, fine, SAME movements as "Simple Drill"
 if drillcyc$ = 7, ptime_drill_0 # Bore, standard, SAME movements as "Simple Drill"
 ]
 # Time calculations by feed type
 if gcode$ = zero, ptimer #RAPID time and length calc
 if gcode$ = one | gcode$ = two | gcode$ = three, ptimel #FEED time and length calc
 !x$, !y$, !z$, !fr_pos$ #Update previous [prv_?] variables

ptime_drill_0 # Simple Drill lengths
 # Move length with FEED, straight down to hole depth
 len = abs(refht$ - depth$)
 ptimel
 # Move length with RAPID, IN & OUT of hole
 if initht$ <> refht$,
 [
	 # Rapid between Initial & Retract, Move TO hole
	 len = abs(initht$ - refht$)
	 # Rapid between Initial & Depth, Move OUT of hole
	 len = len + abs(initht$ - depth$)
	 ptimer
 ]
 else,
 [
	 # Rapid between Retract & Depth, ONLY Move OUT of hole
	 len = abs(refht$ - depth$)
	 ptimer
 ]
 # Convert and add dwell$ seconds to total minutes
 if dwell$ <> zero, total = total + (dwell$ / 60)

ptime_drill_1 # Peck Drill
 # Move length with FEED, hole depth
 drill_length_f = abs(refht$ - depth$)
 actual_drl_depth = peck1$
 while actual_drl_depth < drill_length_f,
 [
	 # FEED moves in hole
	 len = peck1$ + peck_safe_dist
	 ptimel
	 # RAPID moves in hole
	 len = (actual_drl_depth * 2) - peck_safe_dist
	 ptimer
	 actual_drl_depth = actual_drl_depth + peck1$
 ]
 # Last cut, it's equal or less than peck1$
 len = (drill_length_f - actual_drl_depth) + peck_safe_dist + peck1$
 ptimel
 # Move length with RAPID, IN & OUT of hole
 if initht$ <> refht$,
 [
	 # Rapid between Initial & Retract, Move TO hole
	 len = abs(initht$ - refht$)
	 # Rapid between Initial & Depth, Move OUT of hole
	 len = len + abs(initht$ - depth$)
	 ptimer
 ]
 else,
 [
	 # Rapid between Retract & Depth, ONLY Move OUT of hole
	 len = abs(refht$ - depth$)
	 ptimer
 ]
 # Convert and add dwell$ seconds to total minutes
 if dwell$ <> zero, total = total + (dwell$ / 60)

ptime_drill_2 # Chip Break Drill
 # Move length with FEED, hole depth
 drill_length_f = abs(refht$ - depth$)
 actual_drl_depth = peck1$
 while actual_drl_depth < drill_length_f,
 [
	 # FEED moves in hole
	 len = peck1$ + peck_safe_dist
	 ptimel
	 # RAPID moves in hole, only chip break moves - BACKWARD
	 len = peck_safe_dist
	 ptimer
	 actual_drl_depth = actual_drl_depth + peck1$
 ]
 # Last cut, it's equal or less than peck1$
 len = (drill_length_f - actual_drl_depth) + peck_safe_dist + peck1$
 ptimel
 # Move length with RAPID, IN & OUT of hole
 if initht$ <> refht$,
 [
	 # Rapid between Initial & Retract, Move TO hole
	 len = abs(initht$ - refht$)
	 # Rapid between Initial & Depth, Move OUT of hole
	 len = len + abs(initht$ - depth$)
	 ptimer
 ]
 else,
 [
	 # Rapid between Retract & Depth, ONLY Move OUT of hole
	 len = abs(refht$ - depth$)
	 ptimer
 ]
 # Convert and add dwell$ seconds to total minutes
 if dwell$ <> zero, total = total + (dwell$ / 60)

ptime_drill_3 # Tapping
 # Moving length added directly to "feed length"
 drill_length_f = (abs(refht$ - depth$)) * 2
 llen = llen + drill_length_f
 # Moving time added directly to "Total FEED time", minutes
 tot_ltime = tot_ltime + ((drill_length_f / (feed / speed)) / speed)
 # Move length with RAPID, IN & OUT of hole
 if initht$ <> refht$,
 [
	 # Rapid between Initial & Retract, Move TO hole & OFF from hole
	 len = (abs(initht$ - refht$)) * 2
	 ptimer
 ]
 # Convert and add dwell$ seconds to total minutes
 if dwell$ <> zero, total = total + (dwell$ / 60)

ptime_drill_4 # Bore, feed out, Reaming
 # Move length with FEED, hole depth
 len = (abs(refht$ - depth$)) * 2
 ptimel
 # Move length with RAPID, IN & OUT of hole
 if initht$ <> refht$,
 [
	 # Rapid between Initial & Retract, Move TO hole & OFF from hole
	 len = (abs(initht$ - refht$)) * 2
	 ptimer
 ]
 # Convert and add dwell$ seconds to total minutes
 if dwell$ <> zero, total = total + (dwell$ / 60)

ptime_drill_XY # Moves between additional points
 sav_gcode = gcode$
 gcode$ = zero
 ptime_calc
 gcode$ = sav_gcode
# -----------------------------

 

 

Okay, now you have to change some basic postblock:

See inserted "psetup" call and AUX file stuff

psof$		 #Start of file for non-zero tool number			
 pcuttype
 toolchng = one
 #
 #
 "()", e$
 #
 psetup
 #
 # Open temp AUX file & set output to 2
 snameaux$ = snamenc$ + "_TEMP"
 newaux$
 subout$ = 2
 #

 

 

OK, now we have to insert into some other basic postblocks:

See "ptooldata" and "psetup"

ptlchg$		 #Tool change									
 pcuttype
 toolchng = one
 #
 ptooldata #Total ending data for tool (Path Length and Times)
 #
 psetup
 #
 if mi1$ = one, #Work coordinate system

 

 

OK, now we use "ptime_calc" postblock:

In 3D moves:

pncoutput	 #Movement output
 pcom_moveb
 comment$
 pcan
 ptime_calc
 if cuttype = zero, ppos_cax_lin #Toolplane rotary positioning
 if gcode$ = zero, prapidout
 if gcode$ = one, plinout
 if gcode$ > one & gcode$ < four, pcirout
 if mr_rt_actv, #Restore absolute/incremental for G51/G68
 [
 absinc$ = sav_absinc
 mr_rt_actv = zero
 ]
 pcom_movea

 

 

And in drilling too:

pdrlcommonb	 #Canned Drill Cycle common call, before
 if sav_dgcode = 81,
 [
 result = newfs (two, zinc)
 if drillcyc$ = three, drlgsel = fsg1(-ss$) + drillcyc$ * two
 else, drlgsel = fsg2(dwell$) + drillcyc$ * two
 if initht$ <> refht$, drillref = zero
 else, drillref = one
 prv_refht_a = c9k
 prv_refht_i = c9k
 prv_dwell$ = zero
 ]
 if cuttype = three, sav_dgcode = gcode$
 else, z$ = depth$
 if cuttype = one, prv_zia = initht$ + (rotdia$/two)
 else, prv_zia = initht$
 pcom_moveb
 feed = fr_pos$
 comment$
 pcan
 #5 axis must map the true Z, correct Z calculation here
 if cuttype = three,
 [
 prv_zia = zabs + (-depth$) + initht$
 zia = fmtrnd(zabs)
 zinc = zia - prv_zia
 ]
 ptime_calc

pcanceldc$	 #Cancel canned drill cycle
 ptime_calc
 result = newfs (three, zinc)
 z$ = initht$
 if cuttype = one, prv_zia = initht$ + (rotdia$/two)
 else, prv_zia = initht$
 pxyzcout
 !zabs, !zinc
 prv_gcode$ = zero
 pcan
 pcan1, pbld, n$, "G80", strcantext, e$
 pcan2

 

 

Annnnd at the end we do a tricky stuffy in peof:

@ end we merge our time calc into our NC file and also

merge the posted sub back as NC code.

See commented and old "mergesub" and "mergeaux" stuff, use mine at very EndOfFile:

peof$		 #End of file for non-zero tool		
 pretract
 comment$
 #Remove pound character to output first tool with staged tools
 #if stagetool = one, pbld, n, *first_tool, e
 n$, "M30", e$
 #mergesub$
 #clearsub$
 #mergeaux$
 #clearaux$
 "%", e$
 #
 subout$ = 0
 ptooldata #Total ending data for tool (Path Length and Times)
 sav_spc = spaces$
 spaces$ = 0
 #
 "( *** Path Length/Time *** )", e$
 "( Rapid Path Lengh = ", *rlen_total, "mm )", e$
 "( Feed Path Length = ", *llen_total, "mm )", e$
 ttltime = total			 #Transfer TOTAL program time
 "( Full Cycle Time = ", ptimeout, " )", e$ #Program Total time output
 ttltime = tot_rtime
 "( Full Rapid Time : ", ptimeout, " )", e$
 ttltime = tot_ltime
 "( Full Feed Time : ", ptimeout, " )", e$
 "()", e$
 "()", e$
 #
 spaces$ = sav_spc
 #
 mergeaux$
 clearaux$

 

 

Sorry for the long post... :blushing:

 

 

Edit: ptimeout had a bug:

else,

[

result = newfs(five, tsec)

#Output 'HOURS'

if thrs > zero, *thrs, "h " # <<<---- WAS: thrs > one

#Output 'MINUTES' and 'SECONDS'

*tmin, ":", *tsec

]

Edited by Peter - PannonCAD
  • Thanks 1
  • Like 4
Link to comment
Share on other sites

In the program I have 5 Tools

postprocessor writes

 

(T271 - 75 FACE MILL)

(T219 - 10. FLAT ENDMILL)

(T213 - 4. FLAT ENDMILL)

(T237 - 3. BALL ENDMILL)

(T47 - 3.7 DRILL)

(RAPID TIME = 0:12)

 

but - tlchgtime 0.066 # Tool Change Time I'ts 4 sec

 

Approach X Y + 4 sec

1 tool change + 4 seconds

2 tool change + 4 seconds

3 tool change + 4 seconds

4 tool change + 4 seconds

5 tool change + 4 seconds

retraction to the starting position XYZ + 6 sec

 

RAPID TIME = 0: 30 sec

Link to comment
Share on other sites

At peof$ you can add some plus rapid time (before time output) to tot_rtime. Like tot_rtime = tot_rtime + 0.066 (plus 4 sec)

 

And keep in mind the note in post:

# *IMPORTANT* -
# Note that the Program TOTAL TIME includes the Toolchange time(s),
# so it will be longer than the Total RAPID time + Total FEED time!

Link to comment
Share on other sites

And how to display time for each operation?

 

The easiest thing from now... ;)

Define another variable for OP or Tool times only, add into calculations, and push into NC code @ OP or Tool change and reset then.

Or you can collect them into a buffer and create a detailed list @ beginning of NC code...

The biggest part of cycle time is already done now, this need just a little more workaround. ;)

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.

Join us!

eMastercam - your online source for all things Mastercam.

Together, we are the strongest Mastercam community on the web with over 56,000 members, and our online store offers a wide selection of training materials for all applications and skill levels.

Follow us

×
×
  • Create New...