Fanuc FOCAS (CNC)
FOCAS stands for 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 like 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 only distributes the FwLib (Focas Library) C library to licensed subscribers. We have no plans to embed native FwLib JNI into 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; XML parsing via formula or in the reception pipeline) | HTTP push |
Option 2. Fanuc OPC UA option or KEPServerEX Fanuc Suite
Newer Fanuc controllers expose an OPC UA Server as an additional option. For older controllers, use 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)
If you have an FwLib license, you can run your own JNI module as a separate sidecar process (e.g., focas-grpc-server) and have PlantPulse poll its output.
Which Option to Choose
| Situation | Recommended |
|---|---|
| OEM (Mazak SmartBox / DMG MORI Celos / Okuma) already runs an MTConnect Agent | MTConnect → HTTP |
| Newer Fanuc 30i with OPC UA option available | Fanuc OPC UA → OPC UA |
| Older Fanuc 0i, licensed integrator available | KEPServerEX Fanuc Suite → OPC UA |
| Own FwLib license / custom data needed | focas-grpc sidecar → HTTP |
| Simple uptime (0/1) metric only | Controller digital output → Modbus/Ethernet IO module |
Common Data Items When Using MTConnect
DataItems frequently registered from the /current / /sample response XML of the MTConnect agent.
| DataItem name | Meaning | PlantPulse format |
|---|---|---|
Xact, Yact, Zact | Each axis actual position (mm) | Float |
Sspeed | Spindle speed (rpm) | Float |
Sload | Spindle load (%) | Float |
Sovr, Fovr | Spindle / feed override (%) | Integer |
execution | Executing 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 |
Stub Registration (for reference)
| Input field | What to enter |
|---|---|
| IP address | (Not used, dummy) |
| Port | 8193 (FOCAS standard — dummy) |
| Automatic collection | Disabled recommended |
Frequently Encountered Issues
| Symptom | Possible cause | Solution |
|---|---|---|
| No values after FOCAS registration | Stub driver | Re-register via MTConnect (HTTP) or KEPServerEX (OPC UA) path |
| MTConnect XML parsing is difficult | XML namespace + multiple DataItems | XPath / formula post-processing in HTTP push |
| Spindle load stuck at 0 | Missing Sload mapping in the Adapter | Check Fanuc PMC settings — add axis_event in the Adapter config |
| Program name garbled | Fanuc controller encoding (e.g., Shift_JIS) | Check charset option on the Adapter side |
| Alarm code shows only two digits | Condition category separation in MTConnect | Parse the <Condition> area of the XML separately |
| KEPServer license expired | KEPServerEX 7-day demo | Renew license or purchase a permanent license |
Next Steps
- Free spec documentation from the MTConnect Institute (mtconnect.org)
- Contact Fanuc HQ or Korea Fanuc for FwLib licensing (if implementing your own)
- See HTTP push registration / OPC UA registration pages
- Technical background: FOCAS driver (advanced)