Research

A digital twin you can script, cite and check.

Studio is deterministic to the bit and documented down to the sources of its model parameters. Use it for control, machining, metrology, education or AI research — and reproduce every result.

Lockstep API

One JSON request per line; virtual time moves only when you say so. A standard-library Python package wraps it, with batch runs and parameter sweeps over processes.

FMI-shaped co-simulation

Variables, get/set and doStep with FMPy’s names, to couple the twin with models in Modelica, Simulink or Python.

MTConnect

An SHDR adapter with 35 data items and a device file, for dashboards and data pipelines.

Recordings

MCAP for Foxglove and PlotJuggler, VCD with every step pulse for GTKWave and logic-analyser comparisons, CSV curves.

Cutting mechanics

Mechanistic force model with kc(h, vc), time-domain regenerative chatter and a semi-discretization check, static deflection from the frame FEA.

Metrology on the twin

Geometric error model (lead, periodic, straightness, angular, squareness, backlash, thermal) with ISO 230-2 and 230-4 test scripts.

AI agents over MCP

Twenty-three tools, deterministic replay hashes and an audit log of every call make experiments with language models reproducible and checkable.

Per-line profiling

Time per program line that sums exactly to the run, and the reason each feed was not reached, from grblHAL's own planner arithmetic.

Optimizer and generator

Feed, speed and path optimization with explicit acceptance rules, verified on fresh twins; a benchmark over the fifteen example parts.

How the twin is checked

245 acceptance checks
run on every change; the full suite on Linux, the program's own 119-step window self-test and 23 checks on Windows
28 golden fingerprints
seven scenarios at four drive levels, identical on Windows and Linux
Upstream comparison
positions and answers equal to the grblHAL Simulator on the same lines
CAMotics cross-check
15 example parts, 97.7–100 % of cells identical
OpenCAMLib
drop-cutter comparison of the material-removal model
Property-based tests
randomised motion, holds and soft limits with shrinking to a minimal case
MCP replay
the same MCP session gives the same replay hash on Windows and Linux; result pictures are byte-identical

Known limits of the model

What the twin does not do well yet. We publish these so that results are read with them in mind.

  • Parameters are design and literature values until the prototypes are measured; before calibration, cutting forces can be off by up to a factor of two.
  • The force model uses one engagement arc per path segment and the flat end mill's formulas for every tool shape.
  • Thermal errors cover the ball screws and the spindle; the expansion of the aluminium frame and of the part is not modelled yet.
  • Material removal takes most of the computing time: cutting programs usually run several times faster than real time (example 02: 5.8×), and fine engraving can be slower than real time (example 06: 0.7×).
  • Sender software connects over TCP; a virtual USB serial port that looks like the real controller is planned.

Found by the twin, reported upstream

Running real firmware in a deterministic simulator exposes rare timing paths. These reports went to the grblHAL projects with reproductions and patches:

grblHAL/core #1023a resumed block can lose a step on a minor axis after a feed hold
grblHAL/core #1024the rest of a planner block is discarded during a hold and runs with the next motion
grblHAL/core #1026on 64-bit hosts an 8-bit offset in the settings sync loses G54 and other data at power-up
grblHAL/core #1027a refused G93/G95 block zeroes the feed rate
grblHAL/Simulator #27the validator build hangs and crashes on program end

Cite

BibTeX
@software{twinwright_studio_2026,
  title   = {Twinwright Studio: a deterministic digital twin of the MC-1 desktop CNC mill},
  author  = {{Twinwright}},
  year    = {2026},
  url     = {https://twinwright.com/research/}
}

Work with us

We welcome joint projects: twins of other machines, measurement campaigns on the MC-1 prototypes, machining data sets pairing recordings of the twin and the real machine, and teaching research.