Furnace Monitor and Control System
Python
Oracle
Docker
PyQt5

FMCS (Furnace Monitor and Control System) is a Windows desktop application I designed and built during my placement at CERN. It runs in production in Building 163, automating the heat treatment of superconducting magnet cable across six furnaces.
Before FMCS, an operator had to read each heat treatment program from Oracle and key it into the furnace controller by hand, and there was no continuous record of what a furnace was doing during a run. FMCS sits between the CERN Oracle database and the Eurotherm furnace controllers: it retrieves programs, transfers them to the controllers, starts them, collects live data over OPC DA, and syncs measurements back to Oracle for full traceability. Operators only step in to assign an order or stop a program.

FMCS is deliberately a single multi-threaded process rather than a distributed system. Each control-room workstation runs one independent instance talking directly to the local OPC servers and the shared Oracle database, so resilience is per-machine and there's nothing to cluster or load-balance.
The Data Collection thread owns all OPC DA connections. Rather than polling each tag, it subscribes to OPC groups and receives OnDataChange COM events, filtering out duplicates so the cache only updates when a value, quality or timestamp actually changes. OPC quality codes are mapped to GOOD/BAD, and readings matching OPC's "no data" sentinels (NaN, Inf, near-float32-max) are rejected regardless of their reported quality.
Protocols sit behind a pluggable adapter interface, so OPC UA or Modbus could be added without touching the service layer.
A dead OPC link can leave the COM objects perfectly intact while no real data flows, so "connected" isn't enough. A source is treated as stale, and automatically reconnected, if any of these hold for longer than a configurable threshold:
Rather than writing every OPC reading to Oracle, FMCS aggregates in memory and persists just two rows per parameter per sync period, one at the start and one at the end. This keeps the buffer bounded to roughly the number of parameters, while preserving enough of the time series for traceability. The GUI still sees every reading live.
Each parameter carries its own run and idle logging intervals, chosen automatically from the furnace's live state. A furnace mid-treatment gets fine-grained writes, while an idle one syncs far less often, with no global setting changes.
Sending a program is a verified two-step sequence:
S2KPE.exe to write it to the controller, detecting failures from S2KPE's error log rather than trusting its exit code. It then reads the program name back from the controller to catch a transfer that silently landed the wrong program.A FurnaceStateManager maps Eurotherm's integer program status codes (1=RESET, 2=RUN, 4=HOLD, 8=HOLDBACK, 16=END) through a protocol-independent mapper into furnace states: UNKNOWN, IDLE, IDLE_HOT, RUNNING and START_FAILED. State changes are emitted as Qt signals.
Telling IDLE from IDLE_HOT depends on furnace temperature, which is computed defensively. It only averages parameters explicitly typed as actual temperatures, uses only readings in the majority unit (so one sensor misconfigured in °F can't skew a set of °C readings), and ignores readings older than 30 seconds so a single stuck sensor can't misreport a furnace that has genuinely cooled.
All threads share each furnace's in-memory state behind a lock, with snapshot copies handed out so no caller iterates data another thread is mutating. Background threads never touch Qt widgets; updates reach the GUI only through queued Qt signals. Work flowing the other way, such as subscribing newly configured parameters, goes through a thread-safe queue that the collection thread drains, because OPC's COM objects are only safe to use from the thread that created them.
Operators log in via CERN SSO (Keycloak OIDC) using the OAuth 2.0 Device Authorization Grant: the user completes login in a browser while the desktop app polls for the token. A valid CERN login isn't sufficient on its own, though. The username is also checked against an authorisation function in the furnace database, so permission to operate furnaces is controlled centrally. Tokens live only in memory.
Oracle credentials are never stored in plain text; they're kept in the Windows Credential Manager via keyring, separate from non-secret preferences.
The GUI is built with PyQt5 and styled with qtmodern.
FMCS ships as a self-contained Windows installer (PyInstaller + Inno Setup) that bundles the Python runtime and a 32-bit Oracle Instant Client, so end users need no separate Oracle install.
A GitLab CI pipeline runs linting, a compile check, pytest with coverage, and secret detection on every commit, and creates a GitLab Release when a version is tagged. Tests target the pure-logic modules (data models, the Eurotherm file adapters) with Qt, Oracle and Windows COM stubbed out. The installer itself is built on a dedicated Windows machine, since its 32-bit COM toolchain doesn't fit CERN's shared Linux runners.
On this page