Sonith Manakkat

Industry software, part 3 of 39 min read12 visuals

Digital twins and simulators in industrial automation, explained

What a PLC does, what a digital twin is, how simulators let engineers test control software safely before it touches a real machine, and why this matters.

  • A PLC repeats read inputs, run the program, write outputs
  • A digital twin is the model and a simulator is what runs it
  • Test virtually first, then check on site

Share on LinkedIn

Share
Reading level

Factories run on software that most people never see. Conveyor belts start and stop, robots move parts, tanks fill and empty, and behind each of these is a small, tough computer called a PLC. This article explains what a PLC is, what a digital twin is, and how engineers use simulators to test control software without risking real equipment. It is general education, not a description of any particular company's systems. Each section has a plain picture and an Expert view.

Industrial automation in one paragraph

Industrial automation means machines doing repetitive or dangerous work under the control of software. The software senses what is happening (a part has arrived, a tank is full), decides what to do, and acts (start a motor, open a valve). It must do this reliably, many times a second, for years.

Sensors seeControllerdecidesMotors andvalves actThe processmoves on
Sense, decide, act.

What is a PLC?

A PLC, or programmable logic controller, is a rugged industrial computer built for exactly this job. It sits in a cabinet on the factory floor, connected to sensors (inputs) and to motors, lamps and valves (outputs).

Read inputsRun the programWrite outputsrepeat
A PLC repeats one simple cycle again and again, many times every second.
Expert viewThe scan cycle and determinism

The repeating routine is the scan cycle: read all inputs into memory, execute the user program once using that snapshot, then write the results to the outputs (plus housekeeping such as communications). Reading a consistent snapshot of inputs means the logic never sees an input change half-way through a scan. Scan times are typically short and consistent, which is the point: the same inputs should give the same outputs in a time you can count on. PLC programs are traditionally written in languages such as ladder logic, structured text and function block diagrams; the details depend on the vendor and standard used.

The problem: testing on real machines is risky

On the real line

  • A mistake can jam the line or damage equipment
  • Stopping a line costs money by the minute
  • Rare dangerous cases cannot be tried on purpose

In a simulation

  • Mistakes cost nothing
  • Dangerous cases can be tried safely
  • The same scenario can be run again and again
Testing new control logic.

What is a digital twin?

A digital twin is a virtual copy of a real machine or process, kept close enough to the real thing to be useful. It is a software model that behaves like the equipment: belts move parts, sensors trigger, motors take time to speed up, and things can go wrong in realistic ways.

Before the machine exists

  • Used to design and test control logic early
  • No hardware needed yet

Alongside the live machine

  • Fed real data so it mirrors the live equipment
  • Used to predict, compare and experiment
Two common uses of a twin.
  1. 1Build the modelBelts, sensors and how they behave
  2. 2SimulateRun scenarios against the model
  3. 3CompareCheck against measured data from the real equipment
  4. 4Improve the modelFix assumptions that do not match reality

Takeaway. A twin is trusted only as far as it has been compared with real behaviour.

The twin loop. A twin stays useful only while it is checked against the real thing.

What is a simulator?

A simulator is the software that runs the twin. It imitates the physical world: how fast a belt moves, how long a part takes to arrive, how a sensor responds. The control program, or a copy of it, is connected to the simulated machine instead of the real one.

A digital twin is the model. A simulator is what makes the model run.

EngineerControllerSimulatorPick scenarioSensor valuesRun programOutputsUpdate modelResults123456
  1. Engineer to Simulator The engineer chooses a case to run, such as a normal run or a failed sensor.
  2. Simulator to Controller The simulated sensors report the state of the model, as real ones would.
  3. Controller (to itself) The control program runs once on that snapshot of inputs.
  4. Controller to Simulator The controller drives simulated motors and valves.
  5. Simulator (to itself) The model moves on: belts advance, parts arrive, sensors change. The loop repeats.
  6. Simulator to Engineer (reply) The engineer sees what happened, including any jam, before real equipment is involved.

Takeaway. The loop is the same as on site, but nothing real can be damaged.

The closed loop in a simulation. The controller is connected to a simulated machine.
Expert viewFidelity, time and the closed loop

A simulation is a closed loop: the controller reads simulated sensors and drives simulated actuators, and the simulator updates the model in response. Fidelity is a choice: a simple model of belt speed and sensor positions may be enough to test sequencing logic, while testing a control loop that depends on motor dynamics needs a more detailed model. Time handling matters too: running faster than real time speeds up testing, while hardware-in-the-loop setups run in real time with a real controller attached to a simulated plant.

How engineers use them

  1. Build the modelBelts, sensors, robots, tanks and how they connect
  2. Connect the control softwareThe PLC program or a software version of it
  3. Run scenariosNormal production first, then the awkward cases
  4. Find problems earlyA jam, a failed sensor, an emergency stop
  5. Move to the real lineWith logic already exercised many times
A typical workflow.

Testing control software against a virtual plant before the real one is ready is often called virtual commissioning.

EngineerSimulatorReal line
1EngineerBuild modelBelts, sensors, robots, tanks and how they connect.
2EngineerConnect softwareThe PLC program or a software version of it.
3SimulatorRun scenariosNormal production first, then the awkward cases.
4EngineerFix problemsA jam or a failed sensor is fixed on screen.
5Real lineMove to lineThe logic has already been exercised many times.
6Real lineCheck on siteReal equipment, including safety checks, is still tested.

Takeaway. Most problems are found on screen, but the checks on site still happen.

Virtual commissioning, step by step. The real line comes last.

Benefits

  • SafetyDangerous cases tested without danger
  • SpeedSoftware tested before the hardware is installed
  • Lower costFewer surprises during commissioning
  • TrainingOperators practise on a twin
  • Experiments"What if we speed up the line?" tried virtually first
Why teams do it.

Limits to remember

Myth

A simulator replaces testing on the real machine

Fact

It reduces risk and finds many problems early, but real equipment still needs checks on site, including safety checks.

Myth

A twin is always right

Fact

A model is only as good as its assumptions. Real equipment wears, vibrates and behaves unexpectedly.

  1. 1Does the result concern a safety function?Yes Verify it on the real system under the applicable standards. A simulation is evidence, not certification.No keep going
  2. 2Does it depend on motor behaviour or tight timing?Yes The model needs more detail, or use hardware-in-the-loop with a real controller.No keep going
  3. 3Has the plant changed since the model was built?Yes Update the model first, because a drifted model misleads.No keep going
  4. 4OtherwiseUse the result as strong evidence for the cases the model covers, and still check on site.

Takeaway. Ask what the model leaves out before trusting what it says.

How far to trust a simulation result. My own rule of thumb, drawn from the points above.
Expert viewKeeping the twin honest

Typical weaknesses are model drift (the plant changes and the model does not), unmodelled behaviour (friction, wear, sensor noise, timing jitter) and the cost of building a detailed twin. Good practice is to validate the model against measured behaviour from the real equipment, record the assumptions, and keep the model under the same change control as the control software. Safety functions in particular must be verified on the real system according to the applicable standards and procedures; a simulation result is evidence, not certification.

Where software engineers come in

Automation is no longer only wiring and ladder diagrams. Modern systems involve programs written in general-purpose languages such as C#, user interfaces for operators, data collection, and simulation software. Engineers who can combine control logic with ordinary software skills, and who learn the factory's language, are valuable. Understanding how the plant really behaves is as important as the code.

  • PLCThe controller that runs the machine
  • Digital twinA virtual copy of the machine
  • SimulatorThe software that makes the copy behave
  • TogetherTest the brain on a virtual body before the real one
A short way to remember it.

Frequently asked questions

Is a digital twin always connected to the live machine?

No. Some twins mirror live data. Others are used offline to design and test before the machine is built.

Does a simulator replace testing on the real machine?

No. It reduces risk and finds many problems early, but real equipment still needs checks on site.

Do I need to be an electrical engineer to work in this field?

Many roles combine control, electrical and software knowledge. Software engineers can contribute if they learn how the process works.

Back to all articles