# FANUC FOCAS

FANUC control state and load over FOCAS2 right in the chat

Стойки ЧПУ FANUC по FOCAS2 через назначенный шлюз и библиотеку FANUC площадки, только чтение

## How the agent works with FANUC FOCAS

A FANUC control sits on the site's network, so the gateway reaches it: a program installed on a computer on the same network. The gateway is added on the Gateways tab and assigned to the connection. The connection takes the control address, for example tcp://10.0.12.5:8193, and if needed the library file and a tag list. While there is no link outside, the gateway keeps the data on disk.

FOCAS is FANUC's library, not an open network protocol, so the gateway does not talk to port 8193 itself but calls the library from your site's FOCAS2 package: FANUC lets only buyers of the package ship it. The library is loaded in a separate helper process for each round, and a crash or hang inside it ends only that round while the gateway's other connections keep reading.

Only read calls of the library are declared: the gateway has no parameter or PMC writes, no program download and no control commands. The agent reads status, program, spindle, feed, axes, parameters, macro variables and PMC, but changes nothing in the control. The state word comes from run and motion by the same rules as FANUC's MTConnect adapter, so one control reads the same by either path.

The control is polled every Scan interval (1000 ms by default), and an answer is awaited up to the Timeout (3000 ms by default). If the control lacks a function or option, that value arrives with the FOCAS refusal code while the other tags keep reading. The gateway does not read alarm texts: it sees the alarm flag, the alarm mask and the emergency stop. History builds up from the moment of connection.

## Integration scenarios

### How the machines are now
The agent shows each control with its state word (running, interrupted, stopped, idle), its mode and the alarm and emergency stop flags.

### Running and downtime per shift
The agent takes state observations for a period and works out how long the control ran a program, sat in HOLD or waited.

### Program and parts
The agent reads the name and number of the running and main program and the part count and shows how many parts were added over a period.

### Spindle and feed
The agent collects the history of spindle speed and load and actual feed in intervals: minimum, maximum and average.

### Axis positions
The agent shows the absolute and machine coordinates of every axis the control names, with its decimal places.

### Macro variables and PMC
The agent reads the macro variables, parameters and PMC addresses you list, such as a door closed bit or a cycle counter.

## How to connect

**Before you connect**

- A FANUC control with FOCAS2 over embedded Ethernet, TCP port 8193
- The FANUC library from your FOCAS2 package (A02B-0207-K737)
- A computer on the site's network for the gateway, matching the library's bitness
- Network access to the control from the gateway computer

### Put the FANUC library on the gateway
Copy Fwlib64.dll with its fwlib*.dll files (Windows) or libfwlib32.so (Linux) from your FOCAS2 package into the focas folder in the gateway's data.

### Check the library's bitness
The library must match the gateway program's bitness. A file of another bitness is refused before anything starts, with its path named.

### Open port 8193 to the control
The FOCAS2 library talks to the control's embedded Ethernet on TCP 8193. The gateway computer must reach the control at that address and port.

### Add your own tags if needed
With no list the gateway reads status, program, spindle, feed, parts and axes. Add a parameter, macro variable (#500) or PMC address as a line: path, address, type.

## FAQ

### How do I connect FANUC FOCAS?
Install the gateway on a computer on the site's network and add it on the Gateways tab. Copy the library from your FOCAS2 package into the focas folder in the gateway's data, and in the connection enter the control address, for example tcp://10.0.12.5:8193.

### What does the agent see in a FANUC control?
Without a tag list: status, mode, the alarm and emergency stop flags, program name and number, spindle speed and load, actual feed, part count, the control model and axis positions. With a list: parameters, macro variables and PMC addresses as well.

### Does the agent send commands to the machine?
No. The gateway declares only read calls of the FANUC library: it has no parameter or PMC writes, no program download and no control commands.

### Why does the gateway not work without the FANUC file?
FANUC lets only buyers of the FOCAS2 package ship the FOCAS library, so the gateway does not contain it. Put the file from your package into the gateway's focas folder; on an error the connection names the path that did not load.
