AI & IoT Applications in Mechanical Engineering

Chapter 8
Digital Twins and Simulation-Integrated AI

Bachelors Program in Mechnical Engineering
AI & IoT Applications in Mechanical Engineering   •   Bachelor

Digital Twins and Simulation-Integrated AI

Introduction and Context

A digital twin is a continuously usable digital representation of a physical asset, process, or system that is connected to its real counterpart through data. Unlike a conventional CAD model or a one-time simulation, a digital twin is intended to evolve as the physical system changes. It may support design, commissioning, operation, maintenance, optimization, and retirement.

In mechanical engineering, digital twins combine four principal elements:

  1. Geometric and engineering definitions from CAD, product data management, and CAE.
  2. Physics-based models representing mechanics, thermodynamics, fluid flow, controls, or multibody dynamics.
  3. Real-time or historical IoT data from sensors, controllers, inspection systems, and maintenance records.
  4. Data-driven models such as regression, machine learning, anomaly detection, and neural networks.

The central engineering challenge is not merely collecting data. It is establishing a trustworthy relationship between measured behavior and the physical mechanisms that produce it. A useful twin must therefore have a defined purpose, identifiable inputs and outputs, known assumptions, validated models, traceable data, and controlled interfaces.

Learning Objectives

By the end of this chapter, students should be able to:

  • distinguish a CAD model, simulation model, digital shadow, and digital twin;
  • describe an architecture integrating CAD/CAE, IoT, databases, and AI;
  • formulate a hybrid physics–data model;
  • explain model updating and state estimation;
  • apply virtual commissioning and what-if analysis;
  • evaluate validation, uncertainty, cybersecurity, and lifecycle risks; and
  • design a conceptual digital twin for a mechanical asset.

1. From Engineering Models to Digital Twins

A CAD model primarily describes geometry, materials, assemblies, tolerances, and design intent. A CAE model adds analysis assumptions, boundary conditions, meshes, and numerical solvers. A simulation model predicts behavior under specified inputs, but it does not necessarily receive live data or represent the current condition of a particular machine.

A digital shadow is a digital representation that is automatically updated by the physical system, generally in one direction. A digital twin normally implies a stronger, bidirectional or operational relationship: physical measurements update the digital representation, while predictions, commands, or optimized settings may influence decisions or control actions in the physical system. Terminology varies across industries, so the direction of data flow and intended use should always be stated explicitly.

A twin may exist at several levels:

LevelExampleMain purpose
ComponentBearing or gearCondition monitoring and life estimation
SubsystemPumping unitPerformance and fault diagnosis
AssetCNC machine or turbineMaintenance and optimization
ProcessProduction lineThroughput, quality, and scheduling
System of systemsFactory or fleetCoordination and lifecycle decisions

The level of detail should be selected according to the decision being supported. A high-fidelity finite-element model is unnecessary for a dashboard showing daily energy use, while a simple empirical model may be inadequate for predicting stress near a fatigue-critical feature.

2. Conceptual Architecture

A practical twin architecture can be organized into six layers:

  • Physical layer: machine, tooling, environment, operators, and material flow.
  • Sensing and actuation layer: temperature, pressure, vibration, force, position, current, flow, and control signals.
  • Connectivity layer: industrial Ethernet, fieldbus, wireless networks, gateways, and protocol conversion.
  • Data and context layer: time-series storage, asset hierarchies, units, timestamps, work orders, and operating modes.
  • Model layer: physics models, reduced-order models, statistical models, and machine-learning models.
  • Application layer: monitoring, diagnosis, prediction, optimization, virtual commissioning, and operator support.
Layered digital twin architecture Physical asset and environment Sensors, actuators, PLCs and connectivity Data, context, historians and asset identity Physics models, AI models and applications predictions and decisions
Layered digital twin architecture
Figure: Layered digital twin architecture

Figure: A layered architecture for a digital twin, showing measurement flow upward and decision or control flow toward the asset.

The architecture must preserve semantic context. A value of 80 is meaningless without its variable name, unit, sensor location, sampling time, calibration status, and operating mode. Asset identifiers and a common information model prevent the same physical component from being represented inconsistently in CAD, maintenance, and IoT systems.

3. Physics-Based, Data-Driven, and Hybrid Models

3.1 Physics-based models

A physics-based model is derived from conservation laws and constitutive relations. For a lumped thermal system, a simple model is:

Cth dT/dt = Pin − hA(T − Ta)

Here, T is component temperature in K or °C for temperature differences, t is time in s, Cth is thermal capacitance in J/K, Pin is heat input in W, h is the convective heat-transfer coefficient in W/(m²·K), A is exposed area in m², and Ta is ambient temperature. The model assumes lumped temperature, approximately uniform material temperature, and an approximately constant heat-transfer coefficient. It is appropriate when internal temperature gradients are small relative to the required prediction accuracy.

Mechanical models may use Newton’s law, finite-element equations, multibody equations, or fluid and thermal conservation equations. A semi-discrete structural model is often written as:

M q¨ + C q˙ + Kq = F(t)

where M, C, and K are mass, damping, and stiffness matrices; q is the displacement vector; and F(t) is the applied-force vector. The equation assumes that the chosen degrees of freedom and material model adequately represent the structure. In a finite-element setting, the matrices depend on geometry, mesh, material properties, and boundary conditions.

Physics models provide interpretability and often extrapolate better outside the training data. Their limitations include computational cost, uncertain parameters, simplified boundary conditions, and difficulty representing wear, defects, or human operating practices.

3.2 Data-driven models

A data-driven model learns a relationship from observations. For example, a regression model may estimate power consumption from speed, load, and temperature. Classification models can identify operating states, while anomaly detectors can flag behavior that differs from a learned baseline.

Data-driven models require representative data. Training data should cover relevant loads, speeds, temperatures, faults, maintenance states, and sensor quality conditions. Randomly splitting strongly time-dependent data can cause leakage: future behavior may inadvertently enter the training set. Time-based validation is usually more realistic.

3.3 Hybrid models

A hybrid model combines physical structure with learned terms. One general form is:

x˙ = fphys(x,u,θ) + rAI(x,u;w) + η

where x is the system state, u is the input vector, θ contains physical parameters, fphys is the physics-based model, rAI is a learned residual, w contains AI parameters, and η represents process-model error. The residual should be constrained so that it does not violate known conservation laws, safety limits, or dimensional consistency.

Hybrid models are valuable when the dominant mechanisms are known but some effects—such as friction variation, unmodeled heat loss, or degradation—are difficult to formulate exactly. They also support explainability: engineers can inspect the physical prediction and the learned correction separately.

4. State Estimation and Model Updating

Sensors rarely measure every state required by a model. Internal stress, tool wear, bearing clearance, and unmeasured temperature may be latent states. State estimation combines a model with noisy measurements to infer these quantities.

A discrete state-space model is:

xk = f(xk−1,uk−1) + wk
yk = h(xk) + vk

Here, xk is the state at sample k, uk is the input, yk is the measurement, f is the state-transition function, h is the measurement function, and wk and vk are process and measurement noise. A Kalman filter is suitable for linear Gaussian models; extended or unscented variants address certain nonlinear systems. Particle filters can represent non-Gaussian distributions but are computationally more demanding.

For a linear model:

xk = Axk−1 + Buk−1 + wk
yk = Cxk + vk

A, B, and C are system matrices. The filter predicts a state using the model and then corrects it using the measurement. The relative weighting depends on process-noise covariance Q and measurement-noise covariance R. Poorly chosen noise covariances can produce sluggish estimates or excessive sensitivity to noise.

Model updating changes parameters or structure so that simulation agrees with evidence. Parameters may include stiffness, damping, friction coefficient, heat-transfer coefficient, or efficiency. Updating should not simply force agreement with one data segment. The updated model must be tested on independent operating conditions and checked against physical plausibility.

An objective for parameter calibration can be written as:

J(θ) = ∑k=1N [yk − ŷk(θ)]ᵀ W [yk − ŷk(θ)]

where ŷk(θ) is the model prediction, W is a non-negative weighting matrix, and N is the number of observations. The weights account for differing sensor accuracies or units. Calibration is meaningful only when parameters are identifiable: different parameter combinations must not produce indistinguishable outputs over the available experiments.

5. Lifecycle Applications

Design and engineering

A twin can connect requirements, geometry, simulation results, and test data. Design alternatives can be assessed before prototypes are built. Reduced-order models enable rapid evaluation while high-fidelity CAE remains available for confirmation.

Virtual commissioning

Virtual commissioning tests control logic against a simulated machine before the physical machine is complete. The controller communicates with a virtual plant through the same interfaces intended for the real equipment. Engineers can test sequencing, interlocks, emergency stops, sensor failures, and abnormal timing.

Virtual commissioning reduces commissioning time and exposes logic errors early. It does not eliminate physical commissioning: network delays, wiring errors, unmodeled compliance, noise, and operator interaction may still produce differences.

Operation and maintenance

A twin can estimate efficiency, detect abnormal vibration, predict remaining useful life, and recommend inspection. A condition-monitoring system should distinguish an anomaly from a confirmed fault. A threshold crossing is evidence for investigation, not automatically proof of failure.

What-if analysis

What-if analysis evaluates counterfactual scenarios: increased production rate, altered coolant temperature, changed tool geometry, modified maintenance interval, or a new control policy. Each scenario should state which variables are changed and which are held constant. Predictions outside the model’s validated operating envelope must be labelled extrapolations.

For a decision variable u, a constrained optimization problem may be represented as:

minimize J(u) subject to g(u) ≤ 0 and umin ≤ u ≤ umax

Here, J may represent energy cost or production time, while g represents safety, quality, thermal, or mechanical constraints. An optimizer should never be allowed to bypass hard safety interlocks.

6. Worked Example: Updating a Thermal Twin

Consider a motor housing represented by the lumped thermal model:

Cth dT/dt = P − H(T − Ta)

Suppose Cth = 18,000 J/K, P = 900 W, Ta = 25 °C, and the measured steady-state temperature is 70 °C. At steady state, dT/dt = 0, so:

H = P/(T − Ta) = 900/(70 − 25) = 20 W/K

The estimated overall heat-loss coefficient is therefore 20 W/K. Its units are W/K because watts divided by kelvins gives W/K.

The time constant of this first-order model is:

τ = Cth/H = 18,000/20 = 900 s = 15 min

The steady-state temperature after a step in constant power is:

Tss = Ta + P/H = 25 + 900/20 = 70 °C

If power is increased to 1,100 W while H and ambient temperature remain unchanged, the predicted steady-state temperature is:

Tss,new = 25 + 1,100/20 = 80 °C

This is a what-if prediction, not a guarantee. It assumes unchanged airflow, contact conditions, material properties, and sensor calibration. If airflow changes with motor speed, H must be updated or modelled as a function of speed. The example illustrates how a measured operating point can update a model parameter and support a bounded operational decision.

7. Illustrative Case: Digital Twin for a CNC Spindle

Background. A manufacturer operates high-speed CNC spindles whose availability is limited by bearing degradation and thermal drift. The existing system records spindle speed, motor current, housing temperature, vibration, and tool-change events.

Problem. Operators receive false alarms during rapid acceleration, while some genuine bearing problems are detected only after surface-finish degradation. The original physics model predicts temperature but does not represent changing bearing friction.

Analysis. Engineers first define the decision: whether to continue production, reduce speed, inspect the spindle, or stop safely. They establish an asset identity linking the spindle serial number to CAD revision, bearing batch, maintenance records, and sensor locations. Data are segmented by operating mode because acceleration, cutting, idle, and tool-change signals have different distributions.

Approach. A reduced thermal model estimates winding and bearing temperatures. A state estimator infers an unmeasured bearing-temperature state. A residual model learns the difference between measured and physics-predicted temperature using speed, load, ambient temperature, and age. Vibration features are calculated in defined frequency bands, but the system retains raw data for audit and investigation. A fault classifier is trained only on labelled events and is supplemented by an unsupervised baseline for previously unseen behavior.

The twin is deployed in stages. First, it runs in shadow mode and produces predictions without influencing operations. Engineers compare predictions against later measurements and assess false alarms, missed detections, calibration drift, and performance across spindle models. Next, it provides advisory recommendations. Only after safety review are limited automatic speed derating functions enabled, with independent PLC interlocks remaining authoritative.

Outcome. The combined model reduces nuisance alerts because normal acceleration transients are explained by the physical model. It detects gradual thermal changes earlier than a fixed temperature threshold. Maintenance planners use the estimated condition together with inspection evidence rather than relying on an AI score alone.

Learning points. The success of the twin depends on asset identity, operating-mode context, sensor quality, validation, and human decision design. The most sophisticated neural network cannot compensate for missing timestamps, inconsistent units, or poorly defined maintenance labels.

8. Validation, Uncertainty, and Trustworthiness

Validation asks whether the model is sufficiently accurate for its intended use. Verification asks whether the model and software have been implemented correctly. Both are necessary.

Useful evaluation measures include mean absolute error:

MAE = (1/N) ∑i=1N |yi − ŷi|

and root mean square error:

RMSE = √[(1/N) ∑i=1N (yi − ŷi)²]

yi is the measured value, ŷi is the prediction, and N is the number of samples. MAE has the same units as the output. RMSE also has those units but weights large errors more strongly. Neither metric alone establishes safety or usefulness.

Uncertainty has several sources: sensor noise, uncertain parameters, changing boundary conditions, numerical approximation, model-form error, and distribution shift. Predictions should include confidence or prediction intervals when possible, but intervals must be calibrated against independent data. A narrow interval from an overconfident model is not evidence of accuracy.

Validation should include:

  • independent time periods and operating conditions;
  • tests near, but not beyond, the intended operating envelope;
  • sensor-failure and missing-data scenarios;
  • comparison with engineering limits and first-principles expectations;
  • versioned datasets, models, and configuration files; and
  • acceptance criteria tied to a real engineering decision.

9. Challenges and Limitations

Data quality and synchronization. Different clocks, sampling rates, delays, and missing values can create false causal relationships. Timestamp standards and calibration records are essential.

Model fidelity versus computational cost. High-fidelity simulation may be accurate but too slow for real-time use. Reduced-order modelling, surrogate models, and adaptive fidelity provide practical compromises.

Concept drift. Tool wear, retrofits, seasonal conditions, and maintenance alter the relationship between inputs and outputs. A model requires monitoring and controlled retraining, not uncontrolled automatic updating.

Identifiability. If two faults produce the same measured response, additional sensors or experiments may be necessary. AI cannot infer information that the measurement system does not contain.

Interoperability. CAD, CAE, PLC, manufacturing-execution, enterprise, and maintenance systems often use different identifiers and data schemas. Open interfaces and semantic mapping reduce integration risk.

Human factors. Operators may ignore unexplained alerts or over-trust numerical predictions. Interfaces should show evidence, operating context, confidence, and recommended actions.

10. Governance, Safety, and Cybersecurity

A digital twin can influence production rate, energy use, maintenance, and machine commands; therefore it is an engineering control system, not merely an analytics dashboard. Safety functions should remain independently designed and validated. Automatic recommendations should have authority limits, fail-safe behavior, manual override, and event logging.

Important governance practices include:

  • role-based access and least privilege;
  • encryption in transit and at rest where appropriate;
  • network segmentation between enterprise, industrial, and safety networks;
  • signed software and model versions;
  • audit trails for data, parameter updates, and decisions;
  • retention and ownership rules for operational data; and
  • documented responsibility when an AI recommendation causes harm.

Privacy may matter even in mechanical systems when operator identity, productivity, or work patterns are recorded. Ethical deployment requires proportional data collection, transparent use, and consultation with affected workers. Regulatory obligations depend on the application and jurisdiction, particularly where machinery safety, critical infrastructure, environmental emissions, or personal data are involved.

11. Contemporary Developments and Best Practices

Current development trends include physics-informed machine learning, differentiable simulation, edge inference, federated learning, probabilistic digital twins, and fleet-level learning. These approaches can improve adaptability, but they also introduce new risks such as opaque gradients, communication failure, privacy leakage, and incorrect transfer between assets.

A sound implementation sequence is:

  1. define the engineering decision and success metric;
  2. identify the asset, system boundary, and operating envelope;
  3. inventory sensors, CAD/CAE models, maintenance data, and interfaces;
  4. establish units, timestamps, asset identity, and data quality checks;
  5. build the simplest adequate physics model;
  6. add estimation, calibration, or AI only where it solves a known gap;
  7. validate against independent evidence;
  8. deploy in shadow or advisory mode;
  9. monitor drift, uncertainty, and human response; and
  10. control updates through engineering change management.

The principle of fit-for-purpose fidelity is central. A twin should be as complex as necessary to support the decision, but no more complex than can be validated, maintained, and explained.

Chapter Summary

A digital twin is a purpose-defined digital representation connected to a physical asset across its lifecycle. It combines engineering definitions, physics-based models, IoT data, and data-driven methods. Physics models provide mechanism-based interpretation and extrapolation; AI models capture residual, empirical, or highly complex behavior; hybrid models combine their strengths.

State estimation infers unmeasured conditions from models and sensors, while model updating calibrates parameters or structures using evidence. Virtual commissioning tests control logic before physical installation, and what-if analysis evaluates proposed operating or design changes. Reliable twins require semantic asset identity, synchronized data, independent validation, uncertainty assessment, cybersecurity, safety boundaries, and controlled lifecycle management. The appropriate twin is not the most elaborate one, but the one whose fidelity, transparency, and computational cost match the engineering decision.

Key Terms

Digital twin: A connected digital representation of a physical asset, process, or system.

Digital shadow: A digital representation updated by the physical system, usually in one direction.

CAD: Computer-aided design used to define geometry and product structure.

CAE: Computer-aided engineering used for engineering analysis and simulation.

Physics-based model: A model derived from physical laws and constitutive relations.

Data-driven model: A model learned primarily from measured data.

Hybrid model: A model combining physical equations with learned components.

State estimation: Inference of internal system states from models, inputs, and measurements.

Model updating: Adjustment of model parameters or structure using observed behavior.

Reduced-order model: A computationally efficient approximation of a higher-fidelity model.

Virtual commissioning: Testing control logic against a simulated plant before physical commissioning.

What-if analysis: Evaluation of hypothetical changes in inputs, designs, or operating policies.

Residual: The difference between an observation and a model prediction.

Concept drift: Change over time in the relationship represented by a model.

Identifiability: The ability to determine parameters or states uniquely from available data.

Model verification: Checking that a model and its implementation are mathematically and computationally correct.

Model validation: Checking that a model adequately represents reality for its intended purpose.

Prediction interval: A range intended to contain a future observation with stated uncertainty.

Semantic context: Meaning attached to data through identity, units, location, time, and operating condition.

Fit-for-purpose fidelity: A level of model detail appropriate to the supported engineering decision.

Review Questions

Short Answer Questions

  1. Distinguish a CAD model, a digital shadow, and a digital twin.
  2. Why is semantic context important for IoT measurements?
  3. State two advantages and two limitations of physics-based models.
  4. What is the purpose of state estimation?
  5. Explain why virtual commissioning cannot completely replace physical commissioning.

Long Answer Questions

  1. Explain a layered digital twin architecture and the function of each layer.
  2. Compare physics-based, data-driven, and hybrid models for predicting bearing degradation.
  3. Describe a systematic procedure for model updating and independent validation.
  4. Discuss uncertainty, concept drift, and identifiability in operational digital twins.
  5. Explain the safety, cybersecurity, and governance requirements for a twin that can influence machine operation.

Analytical / Application Questions

  1. Design a conceptual digital twin for a centrifugal pump. Specify sensors, physics models, AI components, state variables, validation data, and operator decisions.
  2. A thermal model predicts 75 °C while a calibrated sensor reads 82 °C during a new production regime. Analyze possible causes and propose a decision process before changing the model.
  3. Propose a virtual commissioning and what-if analysis plan for a robotic assembly cell. Identify assumptions, failure scenarios, constraints, and criteria for moving from advisory to automatic control.

Multiple Choice Questions with Answers

Question 1

Which feature most clearly distinguishes a digital twin from a conventional simulation model?

A. It always uses a finite-element mesh.

B. It is connected to a physical counterpart and can be updated with operational data.

C. It contains only geometric information.

D. It can operate without sensors or assumptions.

Correct Answer: B. It is connected to a physical counterpart and can be updated with operational data.

Question 2

In the structural equation M q¨ + C q˙ + Kq = F(t), what does K normally represent?

A. The stiffness matrix

B. The temperature vector

C. The measurement-noise covariance

D. The input time step

Correct Answer: A. The stiffness matrix

Question 3

For the thermal example, with P = 900 W, T = 70 °C, and Ta = 25 °C, the estimated H is:

A. 0.05 W/K

B. 15 W/K

C. 20 W/K

D. 45 W/K

Correct Answer: C. 20 W/K

Question 4

What is the principal purpose of a Kalman-type state estimator?

A. To replace all physical sensors

B. To infer internal states using a model and noisy measurements

C. To create CAD geometry automatically

D. To guarantee that a model is valid outside its operating envelope

Correct Answer: B. To infer internal states using a model and noisy measurements

Question 5

Why should time-dependent data generally not be randomly split without consideration of time order?

A. It always reduces the number of sensors.

B. It can allow future information to leak into training.

C. It prevents calculation of MAE.

D. It makes physical models nonlinear.

Correct Answer: B. It can allow future information to leak into training.

Question 6

Virtual commissioning primarily involves:

A. Testing control logic against a simulated plant before physical installation

B. Replacing all safety interlocks with AI

C. Measuring only final product dimensions

D. Updating CAD geometry from photographs only

Correct Answer: A. Testing control logic against a simulated plant before physical installation

Question 7

In the worked thermal example, the time constant for Cth = 18,000 J/K and H = 20 W/K is:

A. 15 s

B. 180 s

C. 900 s

D. 36,000 s

Correct Answer: C. 900 s

Question 8

Which statement about RMSE is correct?

A. It has no units.

B. It weights large errors more strongly than MAE.

C. It can be used only for classification.

D. It proves that a model is safe.

Correct Answer: B. It weights large errors more strongly than MAE.

Question 9

What is concept drift in a digital-twin application?

A. A permanent loss of CAD files

B. A change over time in the relationship represented by a model

C. A method for increasing sensor sampling rate

D. A type of finite-element boundary condition

Correct Answer: B. A change over time in the relationship represented by a model

Question 10

Which deployment practice is most appropriate before allowing a twin to influence machine commands?

A. Deploy immediately with unrestricted authority.

B. Remove independent safety controls.

C. Run in shadow or advisory mode, validate performance, and define authority limits.

D. Train only on simulated data and omit field testing.

Correct Answer: C. Run in shadow or advisory mode, validate performance, and define authority limits.

AI & IoT Applications in Mechanical Engineering
Chapter 8 of 15