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.

Related Topics:

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

Related Content

Converting Time and Date to a More Useful Format

FANUC and FANUC-compatible CNCs have multiple ways to monitor time. They are accessed by four system variables: milliseconds clock, hours clock, current date and current time. Here’s how to format information in a helpful way.