91ÊÓƵÍøÕ¾ÎÛ

Published

Monitoring Spindle-On Time

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

Share

Leaders-In background

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.

Related Content

CNC Tech Talks

5 Reasons Why You Should Know How to Write Custom Macros

Custom macros enhance what can be done in G-code programs, giving users the ability to code operations that were previously not possible.

Read More
Basics

Obscure CNC Features That Can Help (or Hurt) You

You cannot begin to take advantage of an available feature if you do not know it exists. Conversely, you will not know how to avoid CNC features that may be detrimental to your process.

Read More
Basics

Tips for Designing CNC Programs That Help Operators

The way a G-code program is formatted directly affects the productivity of the CNC people who use them. Design CNC programs that make CNC setup people and operators’ jobs easier.

Read More
Basics

4 Commonly Misapplied CNC Features

Misapplication of these important CNC features will result in wasted time, wasted or duplicated effort and/or wasted material.

Read More

Read Next

Registration Now Open for the Precision Machining Technology Show (PMTS) 2025

The precision machining industry’s premier event returns to Cleveland, OH, April 1-3.   

Read More
Automation

Why We Ask Machine Shop Leaders to Speak at TASC – The Automated Shop Conference

TASC is our industry’s premier peer-to-peer automation stage where America’s shop leaders refine the art of metalworking and CNC machining. For conference speakers, it's also an opportunity to showcase your skills and gain exposure for your business. Here are five why stepping into the spotlight at TASC could be your smartest move toward elevating your shop.

Read More
Workforce Development

Shop Tour Video: You've Never Seen a Manufacturing Facility Like This

In the latest installment of our “View From My Shop” series, explore Marathon Precision’s multi-process approach to manufacturing, where blacksmiths and hand-forged dies meet state-of-the-art CNC machining. Discover how restoring classic muscle cars and building custom art projects creates a dynamic shop culture — and draws top talent to this unique and innovative metalworking facility. 

Read More