Most versions of parametric programming provide some kind of timer that gives you the ability to time events in a CNC program. With Fanuc’s version of parametric programming (custom macro B), two timers—a millisecond timer and an hour timer—are available for this purpose.
System variable #3001 is the millisecond timer; system variable #3002 is the hour timer. It is important to know that these timers are always running. To time an event, you must set the timer to zero. From that instant, the accumulated time will be the time from when you last reset the timer to the present moment. To reset the millisecond timer, give the command #3001 = 0. To reset the hour timer, give the command #3002 = 0.
There is a rather severe limitation to the millisecond timer. It overflows (stops timing) at about 65 seconds, so the individual events being timed cannot be much more than a minute long.
When timing any event, you will need a place to store total accumulated time. Either a common variable (in the #100 series) or a permanent common variable (in the #500 series) can be used. If time must be accumulated from day to day (with the power being turned off during the accumulating of time), you must, of course, use a permanent common variable.
To time an event, you must first initialize the total accumulated time variable to zero when you want to start accumulating time, possibly at the beginning of the program. We’ll use permanent common variable #500 for our examples. Just prior to each event being timed, reset the appropriate timer (#3001 or #3002) to zero. After the event occurs, step the total accumulated time variable (#500 in our case) by the current value of the timer. At the completion of the program, #500 will be the total accumulated time for the event.
This may seem a little confusing, so let’s look an example. Say you want to track the amount of rapid motion time in a program. We’ll use #500 to accumulate time, so once the program is completed, #500 will show the amount of rapid time in the program (you can view this permanent common variable on the display screen on the offset or setting page of most Fanuc controls).
At the very beginning of the program, give the command:
#500 = 0
This initializes the accumulated time to zero. For each rapid motion command in the program, add the timing commands:
#3001 = 0 (Set milliseconds timer to zero)
G00 Xxx.xxxx Yxx.xxxx (Rapid motion command)
#500 = #500 + #3001 (Step accumulated time by the rapid motion time)
If you include the timing commands around every rapid motion (G00) command in the program, then when the program ends, the value of #500 will be equal to the amount of rapid motion time. For this particular application to work, you must, of course, ensure that the rapid override switch is set to 100 percent.
You can see that timing an event could require quite a few cumbersome commands in your program. To simplify things, look for ways to minimize (or eliminate) the need to include the timing commands every time the event occurs. It might be possible, for example, to create a user defined G or M code that activates a custom macro that does the timing. For example, if you’re trying to time total tool changing time on a vertical machining center, and if M06 is the M code used to make a tool change, then you can create a user defined M-code program that will be run every time M06 is executed. Consider this program:
O9001 (Program that is executed when M06 is read)
#3001 = 0 (Set millisecond timer to zero)
G91 G28 Z0 M19 (Move to tool change position)
M06 (Perform tool change)
#500 = #500 + #3001 (Accumulate time in #500)
M99 (End of custom macro)
You must still, of course, include the command #500 = 0 at the very beginning of the program to initialize the accumulated time variable to zero. But notice that all other timing commands are included in the user-defined M-code custom macro. They need only be written one time, regardless of how many tool changes there are in the program.
Creating a user defined M- or G-code requires a parameter to be changed. Reference the custom macro section of your control manual to find the parameters related to user defined G- and M-codes.blog comments powered by Disqus