TwinCAT 3 Β· Track 13 Β· the laptop dress-rehearsal

Simulation & Digital Twin

A controller does one stubborn thing, forever: read its inputs β†’ solve its task β†’ write its outputs, a thousand times a second. The clever bit about TwinCAT is that this runtime isn't trapped in the steel cabinet β€” it also lives on your laptop. Activate onto the local target and the very same boot project runs with the EtherCAT bus simulated and nothing physical attached. Below isn't a diagram. It's a real glazing line you can run, wind to 20Γ—, and break on purpose.

🧠 the runtime, on a PC🍩 a virtual machine⏩ faster than real life
01 Β· The living line

One machine, watched three ways at once

Here is the whole point of simulation in one picture. The same running task drives three windows in lockstep: the machine moving, the I/O signals flickering TRUE/FALSE, and the Structured Text deciding what to do next. Hit play and watch a donut roll in, the photo-eye catch it, the nozzle glaze it, and the line index on. Nothing here is wired to anything real β€” it's the TwinCAT runtime cycling a 1 ms task on your PC.

STOP Β· task halted
glaze on the floor: 0 g
GLAZE
Live I/O Β· the process imagetask
bDonutAtStation FALSE
bGlazeComplete FALSE
bConveyor FALSE
bGlazeValve FALSE
scan #00 donuts glazed
The task Β· Structured Text, every cycle
L1 IF NOT bDonutAtStation THEN bConveyor := TRUE; bGlazeValve := FALSE; END_IF
L2 IF bDonutAtStation AND NOT bGlazeComplete THEN bGlazeValve := TRUE; bConveyor := FALSE; END_IF
L3 IF bGlazeComplete THEN bGlazeValve := FALSE; bConveyor := TRUE; END_IF
speed

πŸ‘€ Watch the link: when bDonutAtStation flips TRUE, line L2 lights, bGlazeValve goes green, and only then does glaze pour. Machine, signals, and Structured Text are never out of step β€” because they are all the same task. That is what "running in simulation" actually feels like. Hit ⏭ Step to advance one slice at a time, exactly like single-cycle mode in the online view.

02 Β· How TwinCAT fakes the world

Same project. One click picks where it runs.

This is the TwinCAT-specific magic, and it trips up newcomers from other brands. There is no separate "simulator program." The runtime (XAR) already sits on your engineering PC next to the IDE (XAE). When you press Activate Configuration and the controller drops into Run Mode, you simply chose a target. Point it at the real CX, or point it at 127.0.0.1.1.1 β€” your own machine. Flip the switch and see what actually changes.

βš™οΈ Activate this project onto…
Config Mode 🟦 β†’ Run Mode 🟩
Your engineering PC Β· XAE
πŸ“¦ The boot project
PLC code Β· 1 ms task
GVLs Β· libraries Β· HMI
byte-for-byte identical
Activate
Configuration
β†’
Chosen target
πŸ’» Local Runtime
runs on this laptop

🟩 Run Mode, no hardware. The local runtime executes the real task. EtherCAT is simulated β€” virtual terminals, virtual bus timing β€” and inputs come from Free Run (you toggle them) or a machine model (it toggles them for you).

πŸ”Œ What never moves. Your code, the task, ADS port 851, the HMI and the Scope all connect to the local runtime exactly as they would to steel β€” they genuinely cannot tell. That's why a green simulation builds real confidence.

03 Β· The cheap mistake

You just broke a machine and it cost nothing

Go back up and hit ⚑ Jam the valve. Watch it: bGlazeComplete goes TRUE, line L3 tries to shut the valve β€” but it's stuck open. The donut drowns, the glaze counter climbs, the line faults out. Now picture that on the real floor: pink syrup over a machine, a stopped line, a very sticky afternoon and a maintenance callout. Here it is a number you reset with a button.

πŸ›
A bug caught here is basically free
The same defect costs seconds on your laptop and can mean wrecked product, downtime and a callout on the real line. The overflow you triggered is the whole pitch in one click.
€0
πŸ”
It is the real task, not a cartoon
The runtime you watched read its inputs, solved the Structured Text, and wrote its outputs β€” exactly the cycle the physical CX runs. Logic proven in simulation behaves the same when the hardware shows up.
read→solve→write
⏩
You can bend time
At 20Γ— you tested minutes of production in seconds β€” and you could just as easily Step a single cycle to inspect one scan. Same bug, two ways of seeing it.
20Γ—
🧯
Rehearse the disasters safely
Jams, sensor failures, e-stops mid-pour β€” every nightmare you'd never dare provoke on real steel, you fire at will here. Nobody gets hurt and nothing actually breaks.
no risk
04 Β· The real vocabulary

"Simulation" and "twin" aren't the same word

Engineers don't say "running without hardware" β€” they say where the real bits sit. It's a ladder called X-in-the-loop: as you climb it, more of the setup becomes real and the test gets more trustworthy. Tap each rung.

The thread through all three: a model of the machine feeding inputs back to the controller automatically. Plain simulation needs you to fake those inputs by hand (Free Run); a twin generates them itself β€” over ADS or OPC UA, from Simulink or a 3D game-engine model. That feedback loop is the whole difference.

05 Β· Check yourself

Two that separate the pros

1 Β· You have no controller on your desk, only the TwinCAT IDE on your laptop. How do you run and test the actual task today?

2 Β· Your virtual line glazed a donut, the photo-eye tripped on its own, and the valve opened β€” all with no clicking from you. Which setup were you running?