mcwatch watches the load of the axes and spindles of a channel during every cutting process against learned curves and fixed limits, trips on a tool break or an overload, runs a retract routine and rates the wear of a tool from several learning curves. The load signals are any HAL float pins: the actual torque of an EtherCAT drive (CiA402 object 0x6077, lcec..torque-actual), the current or power of a frequency converter (serial vfd components or EtherCAT), or an analog input.

This chapter describes phase A1 (the real-time check, the daemon, the curves, the reaction); the panel page with the chart, the wear rating and the thread retract follow.

Processes and curves

A process is a cutting section of a program: it starts with the first feed block (G1, G2, G3, the drilling cycles G81..G89, the threads G33.1, G84, G76) after a rapid and ends with the next rapid, a tool change or the end of the program. Its kind (milling, drilling, threading) comes from the G code of its first block and selects the retract routine. Its key is the program, the tool and the number of the process within program and tool, counted from 1 at every program start; the statement MCWATCH(n) (alias PROCMON(n)) in a block before the process gives it the fixed number n instead, so that the curves survive an edit of the program:

MCWATCH(7)
G0 X20
G81 X20 Y0 Z-5 R2 F200     ; process N7 of this tool: drilling
G0 Z5

The load signals of the channel are recorded over the time since the process start, at [MCWATCH]RATE samples per second. A recording is a learning curve of the process with a name; the first run of a process records the curve "neu" automatically, the command learn records the next run under a name of your choice. Two roles are assigned among the curves: the reference (the envelope is laid about it; the first curve by default) and the curve of the worn tool.

Limits and the trip

Per process, the limits are: the envelope about the reference (± tol_pct percent of the reference value, plus tol_abs), a fixed maximum and a fixed minimum per signal, or any combination. The envelope is checked only while the feed override is the one the reference was learned with; after a change of the override only the fixed limits apply (the user’s decision: a changed override changes the time axis). A limit must be exceeded for delay_ms (default [MCWATCH]DELAY, 20 ms) to count.

The check itself runs in real time: the component mcwatchrt (one instance per channel, loadrt mcwatchrt count=<channels>) compares its load-0..7 with max-N / min-N of the armed signals while enable is TRUE and latches trip (with which and value) after delay milliseconds. The daemon keeps max-N / min-N up to date from the curve at the current process time, so the trip is a servo period away from the limit violation. trip is netted to motion.N.feed-inhibit: the channel holds at once. The daemon then aborts the channel, runs the retract routine of the process kind ([MCWATCH_CHANNEL_n]RETRACT_MILL, RETRACT_DRILL, RETRACT_THREAD: MDI blocks separated by ;, e.g. G53 G0 Z0), sets mcwatch.N.alarm and records the run as a trip. The alarm is acknowledged by the pin mcwatch.N.ack or the command ack. The thread retract (synchronized unwinding from the break point) is a planner extension of a later phase; until then RETRACT_THREAD is an ordinary routine.

The daemon and its files

loadusr -W mcwatch in the HAL file (after loadrt mcwatchrt and the threads) starts the daemon; it reads the INI from INI_FILE_NAME. Its HAL pins: mcwatch.N.active (a process runs), mcwatch.N.process (its number), mcwatch.N.alarm, mcwatch.N.ack (in).

The curves live below [MCWATCH]DIR (default mcwatch beside the INI) as <program>/T<tool>_P<key>.json with the curves, the roles, the limits and the statistics of the runs (peak values, wear percentage, result). The daemon writes state.json (10 Hz: the running process, the live samples with their zones, the reference and worn curves, the limits) for the panel and reads commands from cmd.json (learn, role, limits, enable, ack).

Switching the monitoring off: as a whole, per tool, per process

Besides the limits of a process (enable above) the daemon keeps a policy (<DIR>/policy.json) with three levels, set from the panel or with the commands global, tool and process in cmd.json, each with "enabled": true|false:

  • the monitoring as a whole (global): e.g. while a machine is run in with new parts and nothing is learnt yet;

  • one tool (tool, by its number): all processes of that tool, in every program;

  • one process (process, by program, tool and key).

What is switched off is still recorded - its curves can be learnt and looked at - but gets no limits and no trip; the message of the running process names the reason ("Überwachung aus: gesamt / Werkzeug / Prozess"), the state.json carries the policy and, per record of the channel’s program, the switches, curves, runs and wear (processes).

The panel in mchmi

The area Prozessüberwachung of mchmi (left bar, or the M key) shows the selected channel: the banner with the global switch, the running process (program, tool, key, kind, time, override) and whether it is monitored; the chart with the live loads of one signal (softkey Signal weiter) coloured by their zone (black inside, red above the limit, blue below, orange above the worn curve), the reference curve with its envelope band, the worn curve and the fixed limits; and the table of the program’s processes with their curves, reference, runs, last result, wear and switches. The right softkeys switch the monitoring as a whole, the selected (or running) process and its tool off and on, acknowledge the alarm, learn the next run, and make the newest curve of the selected process the reference or the worn curve; the bottom softkeys switch the envelope, change its tolerance in steps of 5 % and switch the limits of the process. The commands go through cmd.json, the view follows state.json.

INI and HAL

[MCWATCH]
DIR = mcwatch
RATE = 100
TOL_PCT = 30
DELAY = 20

[MCWATCH_CHANNEL_0]
SIGNAL_0 = Spindellast
SIGNAL_1 = X Drehmoment
RETRACT_MILL = G53 G0 Z0
RETRACT_DRILL = G53 G0 Z0
RETRACT_THREAD = G53 G0 Z0
loadrt mcwatchrt count=1
addf mcwatchrt.0 servo-thread
net spindle-load lcec.0.spindle.torque-actual => mcwatchrt.0.load-0
net x-torque lcec.0.x.torque-actual => mcwatchrt.0.load-1
net mcwatch-trip-0 mcwatchrt.0.trip => motion.feed-inhibit
loadusr -W mcwatch

The DMU 60 sim uses the path velocity (motion.current-vel) as a stand-in for a torque on signal 0.