91ÊÓƵÍøÕ¾ÎÛ

Published

Monitoring Time for Preventive Maintenance Tasks

Not all maintenance tasks should be performed based on a calendar date. You can use a custom macro to monitor your machines.

Share

Leaders-In background

Machine builders recommend preventive maintenance (PM) tasks that you should perform and the intervals at which you should perform them. Common tasks include CNC and encoder backup-battery replacement, air/oil filter replacement, way lube replenishment, hydraulic system oil replacement, coolant replenishment/replacement, and inspection and cleaning of key machine components, such as the spindle, way system and others.

It doesn’t make sense to perform certain PM tasks based on calendar dates since machines can often sit idle or be turned off for long periods of time. A more logical approach is to monitor certain PM issues on an individual basis, based upon specific criteria related to the machine function requiring maintenance. With spindle bearing inspection, for instance, spindle run time should be the determining factor.

Many modern CNCs do have comprehensive PM programs built in, and there are many software-based machine monitoring systems that can provide PM data. Some may allow you to specify intervals for the various tasks and even alert you when the interval has elapsed. However, with older FANUC or FANUC-compatible CNCs or if you want to take full control of a given PM issue, you can do so using custom macro.

Our example utilizes the custom macro presented in the May column. It makes an excellent way to monitor the passage of time, converting date and time into the number of hours since the beginning of 2019. Consider this command that calls the date/time converting custom macro:

  • G65 P9060 D#3011 T#3012 H531.0

The current time in hours since the beginning of 2019 will be placed in permanent common variable #531.

Here are the variables used to track the four PM tasks for our example, based upon four different criteria.

PM Task:

Interval:

Started:

Current Time:

Monitored by:

Battery change

#521

#531

#541

Total elapsed time

Change coolant

#522

#532

#542

Coolant on time

Inspect spindle bearing

#523

#533

#543

Spindle on time

Inspect way system

#524

#534

#544

Machine in-cycle time

 

Specifying intervals

This program can be run once to specify intervals for PM tasks based on machine builder recommendations:

  • O0032
  • #521=8736.0 (replace CNC battery)
  • #522=3000.0 (change coolant)
  • #523=6000.0 (inspect spindle bearings)
  • #524=5000.0 (inspect way system)
  • M30

Initializing

Another program is needed to initialize the system and to reset the monitoring variable for PM tasks when they have been completed. After performing maintenance, the operator must scan to the appropriate sequence number for the task to reset. N1: Battery replacement, N2: Coolant change, N3: Spindle bearing inspection, N4: Way system inspection.

  • %
  • O0033
  • N1 (Reset battery time)
  • G65 P9060 D#3011 T#3012 H531.0
  • #541=0
  • M30
  •  
  • N2 (Reset coolant change time)
  • G65 P9060 D#3011 T#3012 H532.0
  • #542=0
  • M30
  •  
  • N3 (Reset spindle bearing time)
  • G65 P9060 D#3011 T#3012 H533.0
  • #543=0
  • M30
  •  
  • N4 (Reset way system time)
  • G65 P9060 D#3011 T#3012 H534.0
  • #544=0
  • M30
  • %

Updating

Machine functions require different updating methods.

Battery change: We can update total elapse time every time a program is run by using a user-defined M code for the end of program word: M30.

Coolant change: We can update coolant-on time in user-defined M codes that turn the coolant on and off (M08/M09).

Spindle bearing inspection: We can update spindle-on time in user-defined M codes that turn the spindle on and off (M03/M04/M05/M19/M06).

Way system inspection: We can update in-cycle time in user-defined G or M codes that are executed only at the beginning and end of the program, like G20/G21 and M30.

User-defined G- and M-code programs

These programs will run when the designated G or M code is executed. A parameter specifies which G or M code is related to each program. With current FANUC CNCs, parameter 6071 specifies the value of the M code that will execute program O9001. If you set parameter 6071 to 30, for instance, the CNC will run program O9001 whenever an M30 is executed.

  • O9001 (M30)
  • G65 P9060 D#3011 T#3012 H141.0
  • #541=#141-#531 (Current total elapsed time)
  • #544=#544+[#141-#140]
  • M30
  • M99
  • O9011 (G20 or G21 at program start)
  • G65 P9060 D#3011 T#3012 H140.0
  • G20 (or G21)
  • M99
  • O9002 (Coolant start M08)
  • G65 P9060 D#3011 T#3012 H142.0
  • M08
  • M99
  • O9003(Coolant stop M09)
  • G65 P9060 D#3011 T#3012 H143.0
  • #542=#542+[#143-#142]
  • M09
  • M99
  • O9004 (Spindle start M03 or M04)
  • G65 P9060 D#3011 T#3012 H144.0
  • M03 (or M04)
  • M99
  • O9005(Spindle stop M05 or M19 or M06)
  • G65 P9060 D#3011 T#3012 H145.0
  • #544=#544+[#145-#144]
  • M19 (or M05 or M06)
  • M99

Monitoring and testing

Finally, there must be a way to alert maintenance personnel when a PM task is required. You could place the detection sequence in machining programs, but to keep from disrupting a production run, it may be better to create a separate program. The operator or a maintenance person will run the detection program when they want to find out if PM tasks are required.

  • O100 (Detection program)
  • IF[#541LE#521] GOTO 5
  • #3000=101(REPLACE BATTERY)
  • N5 [IF#542LE#522] GOTO 10
  • #3000=102(REPLACE COOLANT)
  • N10 IF[#543LE#523] GOTO 15
  • #3000=103(INSPECT SPINDLE BEARINGS)
  • N15 IF[#544LE#524] GOTO 20
  • #3000=104(INSPECT WAY SYSTEM)
  • N20 #3000=105(NO MAINTENANCE REQUIRED)
  • M30

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
Sponsored

Swiss-Type Control Uses CNC Data to Improve Efficiency

Advanced controls for Swiss-type CNC lathes uses machine data to prevent tool collisions, saving setup time and scrap costs.

Read More
Sponsored

How this Job Shop Grew Capacity Without Expanding Footprint

This shop relies on digital solutions to grow their manufacturing business. With this approach, W.A. Pfeiffer has achieved seamless end-to-end connectivity, shorter lead times and increased throughput.

Read More
Measurement

6 Machine Shop Essentials to Stay Competitive

If you want to streamline production and be competitive in the industry, you will need far more than a standard three-axis CNC mill or two-axis CNC lathe and a few measuring tools.

Read More

Read Next

Automation

Setting Up the Building Blocks for a Digital Factory

Woodward Inc. spent over a year developing an API to connect machines to its digital factory. Caron Engineering’s MiConnect has cut most of this process while also granting the shop greater access to machine information.

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