Machine Connection and Simulation Status v0.650 · 24/11/2026 Deutsch

Machine Connection and Simulation

Connecting machines through the Digital Twin: adapters, mapping, what productionOS makes of the data and how to demonstrate it with the simulators.

Status v0.65024/11/2026Digital Twin · Plant historian · Simulators

This manual supplements the productionOS user manual, namely chapters 1.3 Machines, 4.3 Machine and queue and 5.2 Performance balance. It describes three things:

Status: v0.624 · 16/11/2026 · DT 0.22.0

Technical reference for integrators: dt/README.md, documentation/schnittstelle_dt_v1.md (messages), dt/schema/ (JSON schemas).

Configuration keys and values (signal, merkmale, zyklus, …) are part of the DT's interface and stay in German. Enter them exactly as shown.


1. The principle in one picture

This chapter shows the path a signal takes from the machine into productionOS. Read it first. Its terms appear in every chapter that follows.

Machine ──► Adapter ──► Signals ──► Mapping ──► Messages ──► productionOS
 (contact,   (read       (name as    (selects,   (state, counter,   (downtime,
  controller, only)       at the      translates) cycle, measurement, quantity,
  file)                   source)                 alarm, summary)    characteristics,
                              │                                      alarms, CO2)
                              └──────► Plant historian (all signals, in the plant)

Digital twin: the building blocks

Digital twin: what it never does

Principles: The DT writes nothing to the machine. It sets no setpoints, sends no commands and acknowledges nothing. It also books nothing in productionOS. Quantities and phases are still booked at the terminal. Credentials for the machine and the historian stay in the plant and are never stored in productionOS.


2. Connection levels and matching adapter

How much productionOS learns about a machine depends on what the machine provides. The connection level describes this. The table names the matching adapter for each level.

LevelWhat the machine providesAdapterWhat productionOS gets
0no signalschattenstate follows the window at the terminal
1contact (running/stopped) and counter, e.g. via an I/O moduleio_mqtt, io_modbus, http_eingangstate, downtimes, piece count
2the machine writes a file per cycle (CSV, XML)dateiplus characteristics per cycle
2athe controller provides a data record at the end of each cycleopcua, mode zykluscycles with number, characteristics per part, gaps
3field protocol, continuously observableopcua, mode abtasten; io_modbusstate, counter, characteristics, alarms, energy

For demonstrations without a machine there is the adapter simulator (level 1) and the OPC UA simulator (levels 2a and 3), see chapter 6 – Simulation.


3. Setup

This chapter takes you through the setup in order: first the computer in the plant, then the DT in productionOS and on the computer, then historian and console. At the end it shows how a DT moves to another computer.

3.0 Prepare the computer

You do these steps once per computer, before the first DT or the historian goes onto it. The computer can be a device of its own or a virtual machine, for example on Proxmox or VMware. It runs continuously and unattended. It does not need a desktop.

DT computer: requirements

WhatHowPurpose
Operating systemDebian 13 or Ubuntu 24.04, server installationThe DT is tested on these systems (systemd, Podman 4.6 or later)
Addressfixed IP or DHCP reservation, fixed host nameDTs on other computers, Grafana links and the console reach it this way
Spacea data disk of its own for /home, e.g. 200 GBimages, the DTs' volumes and the historian's data live in the user's home
Clocktime synchronisation active (timedatectl shows synchronized: yes)The DT reports its clock offset; windows and signals are linked by time
AccessSSH with keys onlyremote maintenance
Updatesunattended-upgradessecurity updates without intervention
Usera regular user with sudo; DTs and historian run as this user (rootless)no service needs root

DT computer: install packages and set up the user

This is how you install the packages and set up the user on Debian 13:

sudo apt-get install -y podman uidmap passt fuse-overlayfs openssl unattended-upgrades
sudo loginctl enable-linger <user>
podman pull gitea.gall-nas-home.synology.me/productionos/dt:stable

DT computer: what the plant's IT has to allow

Only outgoing connections with TLS leave the plant. No port is opened to the outside.

DirectionPortTo / fromPurpose
outgoing443productionOS (e.g. dev.productionos.eu)enrollment and configuration
outgoing8883productionOS broker (address from the enrollment, same name on dev)the DT's messages (MQTT over TLS)
outgoing443registry gitea.gall-nas-home.synology.meimages and updates
incoming5432DTs on other computers in the plantplant historian (on the historian computer only)
incoming3000browsers in the plant networkGrafana (History)
incoming18443maintenance browsersDT console over the network (3.4)
incoming22maintenance computersSSH

On top of that come the connections to the machine: OPC UA, Modbus, MQTT of the I/O module or network folders. Which ones you need depends on the adapter (see chapter 4 – Adapters and mapping).

3.1 Create the DT (productionOS)

First you create the DT in productionOS. In doing so you get the command that starts it on the computer in the plant.

  1. Under Machines, open the machine and select the Connection tab.
  2. Choose the connection level. The help text next to it says what the plant has to provide.
  3. Select Create digital twin. productionOS assigns a DT ID (dt_…) and a one-time code. The code is valid for 15 minutes and is visible only now.
  4. Run the command shown on the computer in the plant (see 3.2 – Start the DT).
  5. Maintain adapter, settings and mapping in the same tab. The DT reloads every saved change without a restart.

New code and Revoke access block the previous access immediately.

3.2 Start the DT (computer in the plant)

On the computer in the plant you set up the DT as a service with a script. The prerequisite is Linux with systemd and Podman 4.6 or later (Debian 13, Ubuntu 24.04), prepared as in 3.0 – Prepare the computer.

DT computer: fetch and run the install script

podman run --rm --entrypoint cat gitea.gall-nas-home.synology.me/productionos/dt:stable \
  /opt/dt/host/install.sh > dt-install.sh
bash dt-install.sh --dt-id dt_xxxxxxxxxxxxxxxx --code ABCD-EFGH \
  --api-url https://dev.productionos.eu --name fraese1

The script sets up the DT as a service:

For each further machine on the same computer, run the script again. As a regular user you additionally need loginctl enable-linger <user>.

DT computer: important options of the script

bash dt-install.sh --help shows all options. The most important ones:

OptionPurpose
--env NAME=VALUEpasswords and tokens of the source (DT_OPCUA_PW, DT_IO_PASSWORT, DT_HTTP_TOKEN)
--eingang-port 8081expose the port of the http_eingang adapter in the plant network
--ordner PATH / --ablage PATHmachine folder for the datei adapter
--http-port PORThealth and simulator control on 127.0.0.1:PORT
--image IMAGEa different image, e.g. …/dt:edge for the latest build

DT computer: which image tag

Image tagContent
stablereleased build that all hosts follow
<version>a released version, e.g. 0.10.0
edgeevery build of main with a change to the DT, for testing

3.3 Plant historian (once per plant)

The plant historian stores all signals as time series in the plant. You set it up once per plant.

Historian: set it up and register it in productionOS

Set up the historian on the computer:

bash dt-install.sh --historian --grafana --sicherung ~/sicherung/historian

Then register it in productionOS:

  1. Under Organisation hierarchy, select the Plant historian button on the plant.
  2. Enter the type (TimescaleDB) and the address, for example postgresql://192.168.10.13:5432/historian.

The password does not belong in productionOS.

Historian: the right address

Important: Do not enter localhost. From the DT's container network, localhost does not point to the computer.

A DT on the same computer as the historian reaches its IP without further steps since DT 0.11.0. Under Podman 5 (Debian 13) the script gives the container an address of its own for this (10.0.2.100). If the computer itself has an address in 10.0.2.0/24, the script stops and asks for --netz-host --http-port <port>.

Historian: curves in Grafana

If Grafana is set up, History opens the machine's curves. You find the button in the Connection tab and in the Machine tile. The link works in the plant network only.

3.4 DT console (computer in the plant)

The DT console shows all DTs of a computer on one page. It works even while productionOS cannot be reached (since DT 0.12.0, actions since 0.13.0). You use it to check the DTs on site, carry out actions and set up new DTs.

Console: open it on the computer

bash dt-install.sh --konsole

Then open http://127.0.0.1:18080/ on the computer itself.

Console: over the plant network with TLS

Since DT 0.22.0 the console can also listen on the plant network, with TLS:

bash dt-install.sh --konsole --konsole-netz

It is then reachable at https://<computer>:18443/. The following applies:

Without --konsole-netz you can only reach the console from another computer through an SSH tunnel: ssh -L 18080:127.0.0.1:18080 <computer>.

Console: what it shows

Console: actions and approval

The DT detail offers these actions:

Since DT 0.18.0 you need no password at the console for this. Instead you get an approval from productionOS:

  1. At the console, select Request approval. The console shows a code and a link.
  2. Someone with the admin role in productionOS opens the link, also on a phone.
  3. They confirm under Machines → Approve DT console and select the DTs.
  4. The console fetches a signed ticket. With it, it may carry out actions on these DTs for 30 minutes.

Every action is reported to productionOS and recorded in the audit there. Without a connection to productionOS no new approval can be fetched. A valid ticket, however, stays valid until it expires.

Console: set up a DT without a command line

Since DT 0.21.0, Set up DT lets you set up a DT without a command line. This applies to a machine whose DT already exists and is connected in productionOS but does not run on any computer yet.

  1. Select Set up DT. The console shows a code again.
  2. When confirming in productionOS, the admin chooses the DTs that should run on this computer.
  3. The console receives a new one-time code for each chosen DT and shows each as a tile.
  4. Set up asks only for what the computer needs to know:
    • the service name (suggested from the machine number),
    • for the adapter datei the machine folder. If the field stays empty, the folder of the simulator with the same name applies. Your own folder must lie below a path that someone with access to the computer has listed in ~/.config/productionos-dt/ordner-erlaubt (one line per path),
    • credentials, if the connection asks for them via *_env. They stay on the computer; productionOS does not see them.

The following applies:

Console: log, updates and local port

Each DT needs a local port for the console. If --http-port is missing, the script assigns one itself (from 18100). A DT set up without --http-port before DT 0.12.0 shows the note No local port. In that case, run the script for that DT once more.

3.5 Move a DT to another computer

When a computer moves or is replaced, you take the DTs along with their volume. It holds the access, configuration, buffer, sequence number and counter reading. You then need no new code, and the sequence number carries on.

Move: steps with the volume

Prerequisite: the new computer is prepared as in 3.0 – Prepare the computer and has dt-install.sh (see 3.2 – Start the DT).

podman ps on the old computer shows the ID (dt_…) and the name (<name>). The container is called dt-<name>, its volume dt-<id>.

# old computer: stop the DT (it empties its buffer) and save the volume
systemctl --user stop dt-<name>.service
podman volume export dt-<id> -o dt-<id>.tar

# new computer: load the volume, set the owner, set up the DT (without --code)
podman volume create dt-<id>
podman volume import dt-<id> dt-<id>.tar
podman unshare chown 10001:0 "$(podman volume inspect dt-<id> --format '{{.Mountpoint}}')"
bash dt-install.sh --dt-id <id> --api-url https://… --name <name>

# old computer: remove the service, the volume stays as a backup
bash dt-install.sh --entfernen <name>

Move: notes and special cases


4. Adapters and mapping

This chapter describes the adapter settings and the mapping. You need it when you connect a machine or change a connection.

You maintain all settings in the Connection tab, in fields that match the selected adapter. Edit as JSON shows the same as text. The examples below are this JSON.

4.1 Adapters

Adapters schatten and simulator

schatten has no settings. The state follows the window.

simulator reproduces level 1 without a machine, see 6.1 – Adapter simulator.

Adapter io_modbus

Reads an I/O module or controller via Modbus TCP, read-only.

{"host": "192.168.10.60", "port": 502, "geraet": 1, "takt_s": 0.5,
 "bereiche": [{"art": "eingaenge", "start": 0, "anzahl": 8, "name": "DI"},
              {"art": "register", "start": 100, "anzahl": 2, "name": "Z", "typ": "uint32"}]}

Adapter io_mqtt

Reads an I/O module or gateway with its own broker in the plant.

{"broker": "mqtt://192.168.10.50:1883", "topics": ["e1212/#"], "praefix": "e1212/",
 "benutzer": "dt", "passwort_env": "DT_IO_PASSWORT"}

The signal is the topic without the prefix. JSON messages are flattened, for example to di/0/value.

Adapter http_eingang

Here scripts and gateways send values to the DT via POST.

{"port": 8081, "token_env": "DT_HTTP_TOKEN"}
curl -X POST http://<host>:8081/signale -H "Authorization: Bearer $TOKEN" \
     -d '{"signal": "DI1", "wert": true}'
curl -X POST http://<host>:8081/signale -H "Authorization: Bearer $TOKEN" \
     -d '{"signale": {"temp": 41.5, "stoerung": false}}'

Adapter datei

For machines that write a file per cycle.

{"ordner": "/maschine", "muster": "*.csv", "parser": "csv",
 "parser_einstellungen": {"zeitspalte": "Zeit", "zeitformat": "%d.%m.%Y %H:%M:%S"},
 "ruhe_s": 2, "bestand": "ignorieren", "ablage": "/ablage"}

Each column (CSV) or element (XML) becomes a signal. On top come zyklen (number of files) and datei. The DT only reads the files.

Adapter opcua

Reads a controller or OPC UA server, read-only.

{"url": "opc.tcp://192.168.10.20:4840", "modus": "zyklus",
 "trigger": {"id": "ns=2;s=DB10.Zyklus", "name": "zyklus"},
 "knoten": [{"id": "ns=2;s=DB10.Durchmesser", "name": "Durchmesser"}],
 "intervall_ms": 500, "benutzer": "dt", "passwort_env": "DT_OPCUA_PW",
 "sicherheit": "Basic256Sha256,SignAndEncrypt,/data/opcua/cert.der,/data/opcua/key.pem"}

The adapter has two modes:

The signal name is name; if it is missing, the node ID. User, password (only via --env) and security are optional.

4.2 Mapping

The mapping lives in the mapping entry. It defines which signal goes to productionOS as what.

Mapping: structure and example

Important: A mapping of your own replaces the adapter's default completely. Signals without an entry only go into the historian.

{"mapping": {
  "state":    {"signal": "Laeuft", "executing": [true], "glaetten_s": 1},
  "counters": [{"signal": "Zyklus", "name": "teile", "unit": "St"}],
  "merkmale": [{"signal": "Durchmesser", "merkmal": "D1", "unit": "mm",
                "art": "pruef", "melden": "zyklus"}],
  "cycle":    {"trigger": "Zyklus", "no": "Zyklus"},
  "alarme":   [{"signal": "Stoerung", "kennung": "STOERUNG",
                "meldung": "Maschine gestört", "schwere": 800}],
  "energie":  {"signal": "Energie", "faktor": 1}
}}

Mapping: the entries in detail

EntryMeaning
stateState. Executing if the value is in executing (default [true, 1]), otherwise NotExecuting. Quality bad gives NotAvailable. glaetten_s suppresses brief flicker.
countersCounters. name is the name in productionOS (teile). art: wert takes over a counter reading and keeps counting after the source is reset. art: impuls counts rising edges of an input. productionOS always receives an absolute reading.
merkmaleCharacteristics (measured quantities). merkmal is the name by which productionOS assigns them to the operation. melden: zyklus (with the next cycle), wert (individually, at most every mindest_s s, default 60) or nein (summary only).
cycleCycle. When trigger changes, a cycle with the characteristic values since the last cycle goes out. no names the signal with the machine's cycle number.
energieEnergy meter of the machine (meter reading). faktor converts to kWh (Wh: 0.001, default 1). After the source is reset the DT keeps counting. From it comes the energy per window: reading at the end minus reading at the start. Since DT 0.10.0.
alarmeAlarms. Active if the value is in aktiv (default as executing) or, with ueber, above a threshold. schwere (severity) 1–1000 (default 700, red from 700), kennung (identifier, default the signal name), komponente (component) optional.

The DT reports a faulty mapping as a problem (mapping_ungueltig). It is not silently ignored.

Mapping: which counter supplies the parts

If there are several counters under counters, exactly one counts for the parts in the window:

The others still go to productionOS and into the historian, but not into the parts. Enter an energy meter under energie, not under counters.

Mapping: energy per window

The energy per window appears in the Machine tile. From it productionOS calculates the measured actual CO2 (see 5.5 – Performance balance, Machine tile, CO2). Before DT 0.10.0 the DT did not deliver it.


5. What productionOS makes of it

This chapter shows where the DT's data arrives in productionOS and what becomes of it: state, downtimes, quantities, characteristics, alarms and CO2.

5.1 State and downtimes

5.2 Quantity

You see the counter from processing as a suggestion in the quantity field at STOP and at DONE ("Machine counter: …"). What is reported is what is in the field. If that differs from the counter, the deviation can still be analysed.

5.3 Characteristics (concept 4.6)

productionOS distributes characteristics by the operation currently running on the machine. A characteristic is a measured quantity such as a diameter or a temperature.

Characteristics: where a value from the DT goes

The characteristic is, at the operation, …it becomes …
an inspection characteristic in the inspection plana measured value as at the terminal, origin DT, with limits, control chart and quality event
a setting characteristic in the setting instructionthe actual value; an actual value entered at the terminal stays
otherwisesummary and historian only; the Connection tab lists unknown characteristics (often a typo in the mapping)

If no operation is running, nothing is distributed. The name in the mapping (merkmal) must match the characteristic in the inspection plan or setting instruction.

Characteristics: cycle number and gap

This applies to level 2a. If the cycle number jumps by more than one, productionOS marks the window with a gap. A gap means lost cycles. A smaller number counts as a reset of the counter, not as a gap.

5.4 Alarms

Each alarm becomes an event of type Maschine:

At the terminal, open alarms are shown below the state, the most severe first. From severity 700 they are red, otherwise yellow. If an operation is running, the alarm is attached to it. You then find it among the operation's warnings and through the link in the event list.

5.5 Performance balance, Machine tile, CO2

The performance balance of an operation shows in the Machine tile what the DT has measured. From the measured energy productionOS calculates the actual CO2.

Machine tile: what it shows

Actual CO2 from measured energy

If there is an energy value for every window of a phase, the actual CO2 is calculated like this:

actual CO2 = measured energy × electricity mix

This replaces the calculation power × time. The calculation with measured energy needs two things:

5.6 Fleet

Machines → Digital twins shows all DTs with these details: connected since, last contact, state, adapter, version, configuration applied, clock offset, last gap and warnings. The view refreshes every 30 seconds.


6. Simulation

With the simulators you demonstrate and test the connection without a real machine. Two simulators come with the DT. On top comes the route via the HTTP input. All three run without a machine and take the same paths in productionOS as a real machine.

SimulatorLevelShowsFault/alarm can be demonstrated
adapter simulator1state, piece count, downtimesyes (automatically or via curl)
OPC UA simulator2a / 3cycles with number, characteristics, energy, gapno (see 6.2.5)
adapter http_eingang + curlanyany signal by handyes

6.1 Adapter simulator (level 1)

The adapter behaves like an I/O module on a machine. The machine produces as long as a processing window is open in productionOS.

Simulator adapter: settings

{"takt_s": 10, "zaehler": "teile", "stoerung_alle_s": 0, "stoerung_dauer_s": 0}
FieldMeaningDefault
takt_sseconds per piece10
zaehlername of the counterteile
stoerung_alle_sautomatic fault every … seconds of processing0 = never
stoerung_dauer_sduration of the automatic fault0 = never

Simulator adapter: signals

SignalContentGoes to productionOS
laeufttrue in the processing window without a fault, otherwise falseyes, as state (default mapping)
teile (or zaehler)absolute counter reading, +1 per takt_s during processing; survives restartsyes, as counter
spindel_temp°C, rises towards 55 while running, falls towards 25 when stoppedno, historian only
stromA, 11.5–12.5 while running, 0.4–0.6 when stoppedno, historian only

spindel_temp and strom show that the historian holds more than productionOS.

Simulator adapter: fault by hand

You switch a fault by hand at the DT's local port. This only works on the DT's computer. The port is DT_HTTP_PORT (default 8080, as in the example). If you set up the DT with dt-install.sh, it is the port from --http-port. If the option is missing, the script assigns one from 18100 and prints it during setup.

curl -X POST 'http://localhost:8080/sim/stoerung?an=1'   # machine stops
curl -X POST 'http://localhost:8080/sim/stoerung?an=0'   # runs again

Simulator adapter: demonstration sequence

  1. Connect a machine with adapter simulator, takt_s set to 5.
  2. At the terminal, start an operation on this machine and go to processing. After a few seconds it shows "running since …", and the counter rises.
  3. Switch the fault on. After the debounce time (default 60 s), a downtime without reason appears in the list. Add the reason at the terminal.
  4. Switch the fault off. At STOP, the counted quantity appears as a suggestion.
  5. Open the performance balance of the operation. The Machine tile shows run time, downtime and parts.

Note: This simulator is not suitable as a source of characteristics or for alarms. It delivers no characteristics, and mapping laeuft as an alarm would be misleading.

6.2 OPC UA simulator (levels 2a and 3)

The OPC UA simulator is a separate OPC UA server that imitates a controller. The DT reads it with the opcua adapter like a real PLC (programmable logic controller). It has existed since DT 0.9.0, in the image from tag edge or from the version that stable has been moved to.

6.2.1 Start

# in a container (port 4840 on the computer's network)
podman run -d --name sim-opcua -p 4840:4840 \
  --entrypoint productionos-dt-sim-opcua \
  gitea.gall-nas-home.synology.me/productionos/dt:edge --port 4840 --takt 5

# or locally from the repository
cd dt && python -m productionos_dt.sim_opcua --port 4840 --takt 5
OptionMeaningDefault
--portTCP port of the server4840
--taktseconds per cycle5

Address as seen by the DT: If the DT runs in its own container network, localhost is not the computer. Use the computer's IP, for example opc.tcp://192.168.10.13:4840/sim.

6.2.2 Nodes (signals)

All nodes are below the object Maschine:

Node IDTypeUnitBehaviour
ns=2;s=Maschine.ZyklusUInt32–cycle counter, +1 per cycle, starts at 0
ns=2;s=Maschine.DurchmesserDoublemmnew each cycle, normally distributed around 12.5 (σ 0.03), 3 decimals
ns=2;s=Maschine.TemperaturDouble°Cnew each cycle, normally distributed around 80 (σ 1), 2 decimals
ns=2;s=Maschine.EnergieDoublekWhmeter, +0.02 per cycle, starts at 0
ns=2;s=Maschine.LaeuftBoolean–true as soon as the simulator runs; stays that way
ns=2;s=Maschine.StoerungBoolean–stays false (see 6.2.5)

Sequence of a cycle: Every --takt seconds the simulator first writes diameter, temperature and energy. Then it increments the cycle. So the data record is already in place when the DT reads in response to the counter change. It stays until the next cycle. This is exactly what a controller has to do for level 2a.

The simulator knows nothing of productionOS. It cycles all the time, even without a processing window. productionOS still distributes the values only while an operation is running on the machine.

6.2.3 Settings for level 2a (mode zyklus)

{"url": "opc.tcp://192.168.10.13:4840/sim", "modus": "zyklus",
 "trigger": {"id": "ns=2;s=Maschine.Zyklus", "name": "zyklus"},
 "knoten": [{"id": "ns=2;s=Maschine.Durchmesser", "name": "D1"},
            {"id": "ns=2;s=Maschine.Temperatur", "name": "Temp"},
            {"id": "ns=2;s=Maschine.Energie", "name": "energie"}]}

Without a mapping of your own, the adapter's default applies. The trigger zyklus is then both trigger and cycle number, and each node is a characteristic of the cycle. Each cycle sends a cycle with number and the values D1, Temp and energie to productionOS.

To also count the pieces, you need a mapping of your own. It replaces the default and must therefore be complete:

{"mapping": {
  "cycle":    {"trigger": "zyklus", "no": "zyklus"},
  "counters": [{"signal": "zyklus", "name": "teile", "unit": "St"}],
  "merkmale": [{"signal": "D1", "merkmal": "D1", "unit": "mm", "melden": "zyklus"},
               {"signal": "Temp", "merkmal": "Temp", "unit": "°C", "melden": "zyklus"}],
  "energie":  {"signal": "energie"}
}}

The Machine tile then shows parts and energy per window (0.02 kWh per cycle). The actual CO2 then uses the measured energy.

For productionOS to distribute the values, the running operation must have a characteristic with the same name:

Demonstrating a gap: Stop the simulator (podman stop sim-opcua), wait briefly and start it again. The counter then starts at 0. That counts as a reset, not a gap. A real gap occurs when the DT misses cycles while the simulator keeps running. To do this, stop the DT briefly (systemctl --user stop dt-<name>) and start it again after a few cycles. The window then carries the note Gap.

6.2.4 Settings for level 3 (mode abtasten)

{"url": "opc.tcp://192.168.10.13:4840/sim", "modus": "abtasten",
 "knoten": [{"id": "ns=2;s=Maschine.Laeuft", "name": "Laeuft"},
            {"id": "ns=2;s=Maschine.Stoerung", "name": "Stoerung"},
            {"id": "ns=2;s=Maschine.Zyklus", "name": "Zyklus"},
            {"id": "ns=2;s=Maschine.Temperatur", "name": "Temp"},
            {"id": "ns=2;s=Maschine.Energie", "name": "energie"}],
 "mapping": {
   "state":    {"signal": "Laeuft", "executing": [true]},
   "counters": [{"signal": "Zyklus", "name": "teile", "unit": "St"}],
   "merkmale": [{"signal": "Temp", "merkmal": "Temp", "unit": "°C", "melden": "wert", "mindest_s": 30}],
   "energie":  {"signal": "energie"},
   "alarme":   [{"signal": "Stoerung", "kennung": "STOERUNG", "meldung": "Maschine gestört", "schwere": 800}]
 }}

In mode abtasten the adapter has no default mapping. Without a mapping the signals only go into the historian. Every change of a node is a signal with the server's timestamp.

6.2.5 Limits of the OPC UA simulator

curl -X POST 'http://localhost:18200/sim/stoerung?an=1'
curl -X PATCH http://localhost:18200/sim -d '{"takt_s": 4, "ausschuss_quote": 0.1}'

For downtime and alarms, use the adapter simulator (see 6.1) or http_eingang (see 6.3).

6.3 Signals by hand via http_eingang

If you want to set every signal yourself, for example to demonstrate an alarm, use the http_eingang adapter. You send the values with curl.

HTTP input: set up the DT

bash dt-install.sh --dt-id dt_… --code … --api-url https://dev.productionos.eu \
  --name demo1 --env DT_HTTP_TOKEN=secret --eingang-port 8081

HTTP input: settings and mapping

{"port": 8081, "token_env": "DT_HTTP_TOKEN",
 "mapping": {
   "state":    {"signal": "laeuft", "executing": [true]},
   "counters": [{"signal": "teile", "name": "teile", "unit": "St"}],
   "merkmale": [{"signal": "D1", "merkmal": "D1", "unit": "mm", "melden": "wert", "mindest_s": 1}],
   "alarme":   [{"signal": "schmierung", "kennung": "SCHMIERUNG",
                 "meldung": "Lubrication: pressure too low", "schwere": 800},
                {"signal": "oeltemp", "kennung": "OELTEMP",
                 "meldung": "Oil temperature high", "ueber": 90, "schwere": 500}]
 }}

HTTP input: demonstration

H='Authorization: Bearer secret'; U=http://<host>:8081/signale
curl -X POST $U -H "$H" -d '{"signale": {"laeuft": true, "teile": 100}}'
curl -X POST $U -H "$H" -d '{"signal": "D1", "wert": 12.51}'
curl -X POST $U -H "$H" -d '{"signal": "schmierung", "wert": true}'   # red alarm
curl -X POST $U -H "$H" -d '{"signal": "oeltemp", "wert": 95}'        # yellow alarm
curl -X POST $U -H "$H" -d '{"signal": "laeuft", "wert": false}'      # downtime after debounce
curl -X POST $U -H "$H" -d '{"signale": {"schmierung": false, "oeltemp": 70, "laeuft": true}}'

At the terminal the alarms appear below the state, and in Events as type Maschine. The last call resolves them.

6.4 Checking that it arrives

These places show you whether the DT's data arrives:

WhereWhat you see
Connection tab of the machineconnected, last state, version, configuration applied, problems, unknown characteristics
Machines → Digital twinsall DTs at a glance
terminal, machine selection / headerstate, alarms
performance balance, Machine tilewindows, run time, downtime, parts, energy, characteristics
the plant's Grafanaall signals as curves
computer in the plantpodman logs -f dt-<name>, curl localhost:<http-port>/health, since DT 0.11.0 curl localhost:<http-port>/status (signals with raw value and mapping target, window, buffer, warnings)

6.5 Simulators as machines of their own (since DT 0.17.0)

A simulator is a reproduced machine in a container of its own (image productionos/dt-sim, not for delivery to a plant). The DT reads it with its real adapter, just as it will read the real machine later.

Simulator containers: set them up

All simulators share the same machine model: cycle time, running/fault, automatic faults, scrap, characteristics with drift, energy and alarms. They also share the same control interface (GET/PATCH /sim, POST /sim/stoerung?an=1|0, POST /sim/alarm, on 127.0.0.1 only).

bash dt-install.sh --sim-broker
bash dt-install.sh --sim fraese1 --sim-ausgang mqtt --sim-einstellungen '{"takt_s": 8}'
bash dt-install.sh --sim drehe2 --sim-ausgang modbus
bash dt-install.sh --dt-id dt_… --api-url https://… --name fraese1 --io-zertifikat

Simulator containers: outputs and security

OutputDT adapterSecurity
mqttio_mqttTLS; simulator and DT identify themselves with certificates of this computer's simulator CA, without a password. The simulator may write, the DT only read.
opcuaopcuaoptionally certificate and trusted clients only (6.2.5)
modbusio_modbusnone: Modbus knows neither login nor encryption. Protection only through a separate machine network.
dateidateipermissions of the folder

Simulator containers: certificates and settings for io_mqtt

--sim-broker creates a certificate authority of its own per computer and certificates for broker, simulator and DT. They are valid for 825 days. To renew one, delete the certificate in ~/.config/productionos-dt/sim-pki/ and run the script again. --io-zertifikat places the DT's certificate under /pki.

The matching settings of the io_mqtt adapter:

KeyValue
brokermqtts://<IP of the computer>:8883
topics / praefixsim/<name>/# / sim/<name>/
ca, zertifikat, schluessel/pki/ca.crt, /pki/dt.crt, /pki/dt.key
Mappingdi/0 state, cnt/zyklen counter, ai/energie_wh energy (factor 0.001)

Note: The simulator runs independently of the window in productionOS. If it is set to running, the DT reports the machine as running, even without an order. Follow the window in the simulator panel helps here.

Simulator panel: operate the simulators

The simulator panel has existed since DT 0.19.0. You set it up with bash dt-install.sh --sim-pult and then open http://127.0.0.1:18081/ on the computer.

For each simulator the panel shows a tile with state, cycles, good/scrap, energy and the DT that reads it. In the detail view you find:

The panel has no sign-in and can only be reached on the computer itself. From elsewhere you reach it through an SSH tunnel. The reason: the simulators' control is open there anyway. A sign-in only at the panel would protect nothing.

Simulator panel: add simulators and a demo plant

Since DT 0.20.0 the panel also adds and removes simulators:

An admin creates the matching DTs in productionOS, on their own computer and with their own sign-in:

python3 scripts/demo_werk_anbinden.py --api https://… --werk Bereich/Werk/Abteilung \
    --rechner-ip <IP des Rechners> --benutzer <admin> --ausgabe demo_werk_install.sh

The script sets each machine's level and creates the DTs with a matching connection. It also writes the lines for install.sh, which then run on the computer. The one-time codes in them are valid for 15 minutes.


7. Problems and how they are reported

This chapter helps you when a DT does not work as expected. The Connection tab shows problems of the DT at the top in the box The DT reports a problem. The machine then counts as not available. No downtime results from it.

DT problems: the codes and their remedies

CodeMeaningRemedy
adapter_unbekanntadapter name not present in the imagecheck the spelling, build the extension into the image
adapter_fehleradapter does not start or aborts (usually settings)read the message text, correct the settings
adapter_schnittstelleextension built for a different interface versionrebuild the extension
mapping_ungueltigfaulty mappingcorrect the mapping
quelle_nicht_erreichbarmachine, module or server does not respondcheck network, address, port, access; the DT reconnects by itself
http_ohne_tokenHTTP input without tokenset --env DT_HTTP_TOKEN=…
datei_unlesbarfile in the folder not readablepermissions, parser settings
historian_nicht_erreichbarhistorian not reachable; the DT buffersaddress on the plant (not localhost), password in the plant
historian_art_nicht_unterstuetztthis type of historian is not supportedenter TimescaleDB
spool_vollbuffer for the historian fullmake the historian reachable again
erfassung_obergrenzemore signals/points than allowedadjust erfassung (max_signale, max_punkte_s)

DT problems: clock offset and lost connection

If the DT's clock deviates by more than 5 s, the tab warns as well.

If the connection to productionOS drops, the DT keeps observing. As soon as the connection is back, it delivers what it has collected, in order. Counters stay absolute.