A model of a real asset or a real industrial process becomes a digital twin when it stays connected to the real machine and can say how far to trust itself. Otwin is open-source software for building those twins. You describe the equipment as components and connections, the way its drawing reads — or bring a model from Modelica or Julia — and Otwin fits it to the machine's measurements, forecasts with a range whose coverage is measured on data the model never saw, audits what the model promised against what the machine did, and refuses to answer outside what was validated. It reads the measurements from the plant itself, over Modbus, SunSpec and OPC UA.
pip install otwin| You want to | Start here | |
|---|---|---|
| See a complete twin working | otwin-hybrid, a battery degradation twin in Python, Julia and R |
|
| Try a twin on your own home, in the browser | otwin-home, a digital copy of a household built from its bills and meter readings — files never leave the computer |
|
| Build a model from physical parts | otwin, with ten tutorials that cover every component on real equipment |
|
| Check whether a model of your equipment can be trusted | otwin: fit, calibrate, audit and refuse, in tutorial 10 |
|
| Work in Julia | Otwin.jl, the same implementation with Julia types in and out |
|
| Connect a twin to the plant | otwin with the modbus, sunspec or opcua extras |
|
| Verify an implementation of the model format | otwin-spec, the specification and its test suite |
Real data from 44 cells the twin had never seen (Severson et al., 2019). On every one of them the replacement order came before end of life, a median of 76 cycles ahead.
The grid is simulated, with PMU noise; the twin is the swing equation built from Otwin's rotational parts. Across 43 small disturbances the median inertia estimate error was 1.1 %, and the twin asks for battery fast response two hours ahead. The numbers · the animation.
The line is built with Otwin's hydraulic parts; the cloth fouling is recovered from a pressure sensor with 2 % noise, and the cleaning is ordered when the extra energy passes its cost.
| Repository | What it is |
|---|---|
otwin |
The library: components in six physical domains, the port-Hamiltonian compiler, the Rust engine, estimation, forecasting, auditing and field connectors — and Otwin.jl inside it |
otwin-spec |
What an Otwin model means, written down, with a test suite any implementation must pass |
otwin-hybrid |
A complete example: a battery degradation twin that combines physics and machine learning |
otwin-home |
A digital copy of one household's home, built in the browser from the bills and readings the household already has; runs on Otwin |
otwin-systems |
A growing catalogue of physical systems with known reference results |
The code behind Otwin has been public for more than eight years. It began with a Towards Data Science post in 2021 at a time when very little open software for digital twins existed, and has grown since then into the library, the specification and the examples above. In 2026 the project was presented at the IEEE PES General Meeting, in a panel on digital twins, at the invitation of Sandia National Laboratories.
Documentation: otwin.readthedocs.io · Where the project is going: ROADMAP.md · Questions and ideas: Discussions · Bugs and agreed work: Issues · A new component, a system or an example is the easiest way to contribute: Contributing guide
Each repository includes a CITATION.cff. Otwin is released under the Apache License 2.0. Copyright Javier Marín, 2026
OPC UA® is a trademark of the OPC Foundation. Otwin's connector is an independent implementation; its use of the name follows the Foundation's trademark guideline (OPC 20100), and the logo is not shown here because that guideline governs who may display it.
