David Tiw Minjie
← All work

01 · Industrial simulation

TBM Simulator

A tunnel boring machine you can train on. A Go physics core writes machine state to OPC UA and streams it to live 3D and analytics in the browser.

Go / GinOPC UAWebSocketPostgreSQLD3.jsThree.js

Overview

A training replica of an Earth Pressure Balance tunnel boring machine. Operators drive the cutterhead, screw conveyor, shield and navigation, and the machine responds the way a real one would. Advance speed and face pressure shift as the ground profile changes.

The goal is safety. Crews rehearse abnormal conditions in a simulator before they meet them underground.

Architecture

A Go service owns the simulation. Operator input arrives from the browser over WebSocket. The service steps the physics, writes the resulting machine state to OPC UA nodes, and streams the same state back to every connected client.

  1. ReactHMI, 3D, analytics
  2. WebSocketControls in, state out
  3. Go · GinPhysics, events, state
  4. OPC UANode writes

Sessions and telemetry are persisted in PostgreSQL. If the database connection fails, the service falls back to a local SQLite store, so a training session keeps running and recording.

Simulation core

Physics. The model covers TBM behaviour (thrust, torque, face pressure and advance rate) and responds to ground conditions along the alignment.

Event curation. Trainers script and inject events into a running session, so each scenario is repeatable and can be assessed.

Machine state. An explicit state machine governs what the TBM can do at any moment and keeps the simulation consistent with the controls.

Room management. Each room runs its own simulation, and trainees and trainers join it over WebSocket.

Visualisation

Machine scenes are modelled in Blender and rendered in the browser with Three.js. Process data such as pressures, torque and advance is charted live with D3.js for operators and in review for trainers.