Monitoring Spindle-On Time

Custom macro can help you easily track a CNC machine’s productivity.

Managers like to track productivity, and a good way to do so with a CNC machine is to determine the percentage of available time that a machine’s spindle is “on.” Presumably, if the spindle is running, the machine is making chips. Monitoring spindle-on time is pretty easy with custom macro. It simply requires an understanding of the hours-timer system variable and how to create user-defined M codes.

The system variable numbered #3002 (or named #_CLOCK2 with newer FANUC controls) provides access to the hours timer. This timer is always running and will accumulate to a value of more than 9,500 hours before it resets itself. Consider this command, which will reset the timer:
#3002 = 0
From the instant this command is executed, the timer will begin accumulating time in hours, starting from a value of zero.

Our example will use a permanent common variable (#501) to accumulate time. Consider this command:
#501 = #501 + #3002
It will increase the value of permanent common variable #501 by the amount of time (in hours) that has elapsed since the timer was reset.

We will modify the functions of spindle activation words M03 and M04 (with parameter settings) to include resetting the hours timer. We will modify the function of the spindle stop word (M05) to accumulate time in hours with permanent common variable #501.

Parameters vary among FANUC control models. For a 0iD control, set the value of parameters numbered 6071, 6072 and 6073 to 3, 4 and 5, respectively. From this point on, the CNC will execute program O9001 when its reads an M03, program O9002 when it reads an M04, and O9003 when it reads an M05. 

Next, enter these programs into the CNC’s memory:
O9001 (M03)
M03
#3002 = 0 (Reset hours timer)
M99

O9002 (M04)
M04
#3002 = 0 (Reset hours timer)
M99

O9003 (M05)
M05
#501 = #501 + #3002 (Accumulate time in hours)
M99

If you want to keep things simple, just (manually) set permanent common variable #501 to zero at the beginning of the day or shift. Then run production in the normal fashion. Whenever the spindle is turned on (commanded by M03 or M04), the related custom macro program is executed. The hours timer will be reset to zero and will begin accumulating again. When an M05 is read, program O9003 will be executed and permanent common variable #501 will be stepped by the time (in hours) that elapsed since the spindle was turned on.

At the end of the day or shift, look at permanent common variable #501 on the variables display screen page to see the number of hours the spindle has run since you set permanent common variable #501 to zero. 

If the shift is 8.0 hours long and the value in permanent common variable #500 is 5.2 hours, the spindle was running 65 percent of the available time (5.2 is 65 percent of 8.0).

Going a step further, you could have the machine track the running totals for you. For example, use permanent common variable #500 to track machine-on time, #501 to track spindle-on time and #502 to show the current percentage.

Load this program into the CNC and run it whenever you want to reset the system and start tracking spindle-on time:
O1000
#500 = 0 (Total machine-on time)
#501 = 0 (Total spindle-on time)
#503 = 0 (Percentage)
#3002 = 0 (Reset hours timer)
M30

Also modify programs O9001, O9002 and O9003 as follows:
O9001 (M03)
M03
#500 = #500 + #3002 (Accumulate machine-on time)
#3002 = 0 (Reset hours timer)
M99

O9002 (M04)
M04
#500 = #500 + #3002 (Accumulate machine-on time)
#3002 = 0 (Reset hours timer)
M99

O9003 (M05)
M05
#501 = #501 + #3002 (Accumulate spindle-on time)
#502 = #501 / #500 * 100 (Percentage of spindle-on time) 
M99

This will enable you to track the time your machine spindle is running and therefore monitor the overall productivity of your CNC machine.