TDS Archive

An archive of data science, data analytics, data engineering, machine learning, and artificial intelligence writing from the former Towards Data Science Medium publication.

What Is a Supply Chain Digital Twin?

Discover digital twins with Python: model supply chain networks, enhance decision-making & optimize operations.

Samir Saci
TDS Archive
Published in
11 min readDec 15, 2022

--

Illustration of a supply chain digital twin concept, showing a factory, warehouse, and store, with Python logos indicating the use of Python scripts (factory.py, warehouse.py, store.py) to represent and simulate different parts of the supply chain process.
What Is a Supply Chain Digital Twin? (Image by Author)

A digital twin is a digital replica of a physical object or system.

A Supply Chain digital twin is a computer model representing various components and processes involved in the supply chain, such as warehouses, transportation networks, and production facilities.

Visual representation of a supply chain flow, featuring a factory, warehouse, and store connected by transportation, with Python logos indicating different scripts for simulating processes at each step (factory, warehouse, store).
Supply Chain Digital Twin with Python — (Image by Author)

In previous articles, I shared examples of Python models for specific applications such as transportation routing optimization, supply chain network design or production planning.

In this article, we will step back and build a Supply Chain Digital Twin that represents your complete end-to-end operations, from production to store delivery.

I. What is a Supply Chain Digital Twin?
Let us define a supply chain to understand why we need a digital twin
1. A goal-oriented network of processes
Let us define what is a supply chain
2. Data, Parameters & Simulation blocks
How do we build a supply chain digital twin?
II. Examples of building blocks
Let us illustrate the definition by building 4 blocks
1. How to simulate warehouse operations?
A location that receives and prepare orders
2. How to simulate road transportation?
The trucks loading goods at the warehouse to deliver them at the store
3. How do we simulate store inventory management?
Monitoring inventory levels and sending orders to the warehouse
III. Next Steps
Let us test our digital twin with actual applications
1. Connect the blocks
The warehouse sending pallets to the trucks to be delivered to the store
2. Simulate scenarios to answer business questions
What if we increase the truck capacity? What if we ...
IV. Examples of applications
1. Digital Twin for Sustainability: Green Inventory Management
Can we reduce CO2 emissions by reducing the delivery frequency?
2. Digital Twin x Sustainability: Fashion Circular Economy
Simulate the logistics challenges of a rental model for a Fashion retailer
3. What is Supply Chain Analytics?
Discover more case studies to feed your digital twin

What is a Supply Chain Digital Twin?

A goal-oriented network

A supply chain is a goal-oriented network of processes and stock points that delivers goods and services to customers.

As a data scientist, how can I support the optimization of this network?

To create a digital twin of a supply chain using Python, you first need to define the various components and processes that make up the supply chain.

A supply chain process diagram depicting the flow from a factory to a warehouse and then to a store. The factory generates production plans and sends replenishment orders to the warehouse. The warehouse sends delivery orders to the store, and the store generates sales data that loops back to inform production planning at the factory.
End-to-End Supply Chain Network — (Image by Author)

This could involve creating data structures representing warehouses, transportation operations, and production facilities and defining the relationships between these components.

What kind of data is required?

Data & parameters

Next, you would need to collect data on the various components and processes of the supply chain, such as

  • Locations and capacities of warehouses
  • Routes and capacities of transportation networks
  • Production rates of production facilities
  • Customer and store demand
A graphic illustrating four key components of a factory process: location (a map pin icon), production line (a machine), cost (a price tag), and personnel (a worker). The visual highlights the stages of manufacturing, cost evaluation, and human involvement in the production process.
Factory Parameters — (Image by Author)

This data could be stored in databases or other data storage systems or directly connected to your warehouse management systems and ERP.

How do we build this structure?

Simulation blocks

Once you have the data on the supply chain components and processes, you can use Python to create algorithms and simulations that replicate the supply chain's behaviour.

A supply chain digital twin diagram created with Python depicting the flow from production to replenishment. The flow includes factories, transportation, warehouses, and stores, with Python icons representing automation and algorithms at various stages. The historical sales data feeds into the system to generate replenishment orders, demonstrating how a digital twin can model and optimize the entire supply chain process.
Additional Optimization Models — (Image by Author)

This could involve using optimization algorithms to

  • Determine the most efficient routes(output) to deliver stores using replenishment orders (input) coming from the store model
  • Improve the picking processes (output) in your warehouse to prepare store replenishment orders (input)
  • Schedule your production (output) based on demand forecasts built with the stores’ sales historical data (input)

Now that you have the general definition, let us look at an example.

Examples of building blocks

Overall, creating a supply chain digital twin with Python would involve a combination of data collection and analysis, algorithm development, and simulation modelling.

It requires a deep understanding of supply chain management and experience with Python programming.

Let us take three examples of elementary blocks built with Python.

How to simulate warehouse operations?

We will build a model of a warehouse delivering products to stores.

We define a Warehouse class with attributes for the warehouse’s location, capacity, and inventory.

The add_inventory and remove_inventory methods can add or remove items from the warehouse’s inventory.

Can we improve this model?

To improve the model, you can add additional attributes and methods by considering process productivity, warehouse cost structure, workforce management, or picking processes.

At this stage, involve operational teams and continuous improvement engineers to ensure your model replicates the operations.

Your simulation must include bottlenecks, unproductive tasks, and quality issues that occur in real life to validate your model.

💡 Do not forget the “Twin”
If your model is too far from reality, it will lose credibility.

Indeed, if your final goal is to use the insights this model provides, ensure that all the stakeholders validate the assumptions and parameters used to build it.

What do you need to keep in mind?

That means rushing to design a quick, dirty model with gross assumptions is useless.

You can be sure that the operations will carefully analyze its results if you use them to drive continuous improvement initiatives or challenge their management.

Let’s be specific!

For instance, make sure to consider:

  • Reasonable productivity per worker and capacities in your factories and warehouse
  • External constraints like holidays, labour regulations or equipment sourcing limitations when assessing the robustness of your operations (for instance, you cannot double your picking capacity in 1 day)
  • Transportation constraints like truck sourcing, road restrictions or traffic jams

Now that we have our warehouse, we need trucks.

How to simulate road transportation?

We define a Truck class with attributes for the truck’s location, capacity, and load.

The move_to method can be used to move the truck to a new location, and the load_cargo and unload_cargo methods can be used to load and unload cargo, respectively.

The solution above can be improved by adding loading and unloading times, timestamps for lead time calculations, costing parameters, or detailing the handling units (pallets, cartons, …).

What about the stores now?

How to simulate store inventory management?

We define a Store class with attributes for the store’s location and inventory.

The place_order method can be used to order a given item and quantity.

  • If the store has enough items in inventory, the order will be fulfilled, and the inventory will be updated accordingly.
  • Otherwise, an error message will be printed.

I kept the model to have a concise article, but you can improve it by

  • Adding the requested delivery date
  • Managing several handling units
  • Including the outbound sales and lead times

Outbound sales will represent the most critical parameters linked to the demand.

Now that you have all the blocks of your distribution network. Let’s play!

You can test the resilience of your supply chain by

  • Simulating the variability of this demand (for instance, using a normal distribution)
  • Create seasonality and peak periods to replicate the promotions and collection launches
  • Project future sales and new store openings to stress test your network and get insights on how to improve it
A three-part chart illustrating supply chain simulations. The first graph, in red, shows fluctuating demand over time. The second graph, in blue, shows fixed production rates with dotted and dashed lines. The third graph, in green, depicts the inventory on hand (IOH) decreasing and replenishing in cycles, illustrating a typical stock replenishment pattern. These visualizations simulate the effects of demand variability, seasonality, and inventory management in a supply chain network.
Example of the impact of demand variability with a bad inventory rule — (Image by Author)

🏫 Discover 70+ case studies using data analytics for supply chain sustainability🌳and business optimization 🏪 in this: Cheat Sheet

Next Steps

Connect the blocks

Now that you have built your elementary independent blocks, you must connect them.

  • Your store is sending replenishment orders to the warehouse management system using the ERP
  • Your warehouse prepares the orders, packs them, and puts them on pallets.
  • Pallets are loaded in a truck
  • The truck delivers the pallets to the store

And add external parameters such as customer demand or raw materials supply constraints.

What do we do with it now?

Simulate several scenarios to answer business questions

Scenario 1: stores demand is doubling

  • What would be the impact on the warehouse(s) capacity?
  • How many days of stock coverage would we need to avoid stock-outs at stores?

Scenario 2: You merge all local warehouses into a central distribution centre:

  • What would be the impact on the service level?
  • Can we reduce transportation and warehousing costs by delivering stores directly from factories (for some SKUs)?

Scenario 3: You want a 25% reduction of your warehouse(s) inventory

  • What should be the maximum replenishment lead time from the factories?
  • What is the minimum accuracy of demand planning needed to avoid stock-outs?
  • What would impact the stability of production levels in the factories?

Scenario 4: you would like to stop air freight to reduce your CO2 emissions

  • What would be the impact on the stores' replenishment lead times?
  • How far ahead do the distribution planners need to create replenishment orders?

For each scenario, you can manipulate the parameter linked to the question to see how much your overall performance decreases.

Then, you can adapt the other metric (warehouse capacity, replenishment lead time, …) until you reach the initial target.

This will show you the improvements you need to make in your Supply Chain to achieve the robustness needed to adapt to these new business needs.

A diagram outlining the Monte Carlo simulation methodology for robust supply chain network design. It includes three stages: Generating 50 demand fluctuation scenarios using a normal distribution to simulate variability. Running the optimization model to find the optimal solution for each scenario. Analyzing the results to identify the most frequent and robust factory combination solution. Visuals include charts representing demand fluctuations, optimization outputs and pie charts solutions.
Supply Chain Network Design Approach — (Image by Author)

You get inspiration from the methodology used for Supply Chain Network Design, where we try to simulate demand volatility for 50 scenarios assuming a normal demand distribution.

What is the best network to provide good results across all scenarios?

For each scenario, we use linear programming with Python to find the best combination of factories to produce and deliver products to markets at the lowest cost.

Description: A matrix of dark and light blue squares, representing 50 scenarios on the horizontal axis. Each square represents the open or closed status of a factory in each scenario. The matrix is binary with blue for active/open and white for inactive/closed for each scenario of the supply chain network optimization exercice.
Results for the 50 scenarios — (Image by Author)

You can decide which combination to implement to improve your robustness while reducing costs.

Let’s not forget about sustainability!

Digital Twin x Sustainability: Green Inventory Management

Green inventory management can be defined as managing inventory in an environmentally sustainable way.

Illustration comparing CO2 emissions for two delivery strategies. On the left, 2 deliveries per week result in 24 tons CO2 emissions, with a 90% fill rate and 35% additional cartons. On the right, 1 delivery per week results in 15 tons CO2 emissions, with a 100% fill rate and 15% additional cartons.”
(Image by Author)

For a distribution network, this can involve a set of processes and rules that aim to reduce the environmental impact of order transmission, preparation and delivery.

A process flowchart showing steps in replenishment order management: store inventory alert, order creation, transmission to warehouse, preparation, and delivery to store.
(Image by Author)

What would be the impact on CO2e emissions if we reduce the frequency of store replenishments?

Use data analytics to simulate the variation of store replenishment frequency and measure the impact on the overall environmental impact.

Rent instead of buying, the best way to cut emissions!

Digital Twin x Sustainability: Fashion Circular Economy

A circular economy is an economic model that aims to minimize waste and maximize resource efficiency.

(Image by Author)

It involves designing products and processes focusing on longevity, reuse, and recycling.

A diagram showing a circular rental process for fashion items. On the left, a garment is displayed, and on the right, the process is depicted in a timeline. Day 1 indicates the start of the rental, with the item being collected from a store. Day 14 marks the return of the garment by the customer. The circular economy model focuses on renting garments to reduce waste.
(Image by Author)

Some companies have implemented a subscription model where customers pay a regular fee to access a product or service for a specific period.

Use data analytics to simulate the impacts of several circular subscription model scenarios on emissions reductions and water usage at a fast-fashion retailer.

  • What if we rent our clothes for at least one month?
  • How many items do we need to cover ten sales vs. ten rentals?

For more details, have a look at the article linked below 👇

What are the different types of Supply Chain Analytics?

Now that you have the replica of your supply chain, you can play with the parameters and use data to perform.

Descriptive Analytics: monitor your processes with dashboards and visuals.

A set of tools to provide visibility and a single source of truth across the supply chain to track your shipments, detect incidents and measure the performance of your operations.

Diagnostic Analytics: automate root cause analysis processes

This can be summarized as incident root cause analysis.

Predictive and Prescriptive Analytics: add forecasting and optimization models into your digital twin to improve ordering rules or planning

Support the operations to understand the most likely outcome or future scenario and its business implications.

Thus, you can assist the operations in solving problems and optimize the resources to maximise efficiency.

For more details,

Your digital twin can be seen as a core model in which you can add models that solve specific issues.

About Me

Let’s connect on Linkedin and Twitter. I am a Supply Chain Engineer who uses data analytics to improve logistics operations and reduce costs.

For consulting or advice on analytics and sustainable supply chain transformation, feel free to contact me via Logigreen Consulting.

If you are interested in Data Analytics and Supply Chain, look at my website.

💌 New articles straight in your inbox for free: Newsletter
📘 Your complete guide for Supply Chain Analytics: Analytics Cheat Sheet

💡 Follow me on Medium for more articles related to 🏭 Supply Chain Analytics, 🌳 Sustainability and 🕜 Productivity.

--

--

TDS Archive
TDS Archive

Published in TDS Archive

An archive of data science, data analytics, data engineering, machine learning, and artificial intelligence writing from the former Towards Data Science Medium publication.

Samir Saci
Samir Saci

Written by Samir Saci

Top Supply Chain Analytics Writer — Case studies using Data Science for Supply Chain Sustainability 🌳 and Productivity: https://bit.ly/supply-chain-cheat

Responses (1)