Fanuc FOCAS — CNC
FOCAS = Fanuc Open CNC API Specification. It is the de facto standard API for reading spindle load, axis positions, machining programs, alarms, and OEE metrics from Fanuc CNC (Computer Numerical Control) controllers. Machine tool OEMs such as Mazak, DMG MORI, and Doosan expose the same interface when they adopt Fanuc as their controller.
The FOCAS driver in this gateway is a stub. The FOCAS wire protocol is proprietary, and Fanuc distributes the FwLib (Focas Library) C library only to licensed subscribers. There is no plan to embed native FwLib JNI in PlantPulse Edge, which aims for a single-jar distribution.
Recommended integration path: use an MTConnect Adapter (HTTP/XML) or the OPC UA option on newer Fanuc controllers.
Recommended integration paths
Option 1. MTConnect Adapter / Agent (most common pattern — recommended)
Most modern machine tools and Fanuc CNCs adopt MTConnect (ANSI/MTC1.4) as their primary integration path. Fanuc provides its own FOCAS-MTConnect Adapter free of charge, and OEMs (Okuma, DMG MORI, Mazak SmartBox) follow the same standard.
| PlantPulse driver to use | Page |
|---|---|
HTTP (REST polling; parse XML with a formula or in the ingest pipeline) | HTTP push |
Option 2. Fanuc OPC UA option or KEPServerEX Fanuc Suite
Newer Fanuc controllers expose an OPC UA Server as an add-on option. Older controllers can be converted using a commercial gateway such as Kepware KEPServerEX Fanuc Suite or Matrikon FOCAS OPC Server.
| PlantPulse driver to use | Page |
|---|---|
OPCUA | OPC-UA |
Option 3. Sidecar + gRPC (if you hold your own license)
Sites holding an FwLib license can run their own JNI module as a separate sidecar process (for example focas-grpc-server) and have PlantPulse poll its output.
Which option to choose
| Situation | Recommendation |
|---|---|
| OEM (Mazak SmartBox / DMG MORI Celos / Okuma) already runs an MTConnect Agent | MTConnect → HTTP |
| Newer Fanuc 30i, OPC UA option can be added | Fanuc OPC UA → OPCUA |
| Older Fanuc 0i, licensed SI available | KEPServerEX Fanuc Suite → OPCUA |
| Own FwLib license / custom data required | focas-grpc sidecar → HTTP |
| Only a simple availability (0/1) metric is needed | Controller digital output → Modbus/Ethernet IO module |
Commonly used data items with MTConnect
DataItems frequently registered from the /current / /sample response XML of an MTConnect agent.
| DataItem name | Meaning | PlantPulse type |
|---|---|---|
Xact, Yact, Zact | Actual position of each axis (mm) | Float |
Sspeed | Spindle speed (rpm) | Float |
Sload | Spindle load (%) | Float |
Sovr, Fovr | Spindle / feed override (%) | Integer |
execution | Execution state (ACTIVE / INTERRUPTED / READY) | String |
program | Current program name (e.g. O1234) | String |
mode | MANUAL / AUTOMATIC / MDI | String |
Tool_number | Current tool number | Integer |
block | Current block (NC line) | String |
alarm | Alarm code (e.g. PS 0506) | String |
Registering the stub (for reference)
| Input field | What to enter |
|---|---|
| IP address | (not used, dummy) |
| Port | 8193 (FOCAS standard — dummy) |
| Auto collection | Disabled recommended |
Common problems
| Symptom | Possible cause | Resolution |
|---|---|---|
| No values after registering FOCAS | stub driver | Re-register via the MTConnect (HTTP) or KEPServerEX (OPCUA) path |
| MTConnect XML is hard to parse | XML namespace + multiple DataItems | Post-process with XPath / formula as described in HTTP push |
| Spindle load stuck at 0 | Missing Sload mapping in the Adapter | Check the Fanuc PMC settings — add axis_event to the Adapter config |
| Program name is garbled | Fanuc controller encoding (Shift_JIS, etc.) | Check the charset option on the Adapter side |
| Alarm code shows only two digits | MTConnect splits condition categories | Parse the <Condition> section of the XML separately |
| KEPServer license expired | KEPServerEX 7-day demo | Renew the license or purchase a permanent license |
Next steps
- Free spec documents from the MTConnect Institute (mtconnect.org)
- Contact Fanuc headquarters / Fanuc Korea about FwLib licensing (for in-house implementation)
- See the HTTP push registration / OPC-UA registration pages
- Technical background: FOCAS driver (advanced)