From Manufacturing Event Logs to Simulation: Enabling SMEs with Agentic AI for SimPy Simulation Generation
Authors: Richard Reider, Lina Döring, Sebastian Lang, Tobias Reggelin, Sebastian Trojahn, Pascal Reusch
Organizations: Dept. for Eng. of Products and Systems, Otto von Guericke University, Magdeburg, GERMANY · Faculty of Eng. and Mathematics, Bielefeld University of Applied Sciences and Arts, GERMANY · Fraunhofer Institute for Factory Operation and Automation, Magdeburg, GERMANY · Dept. of Economics, Anhalt University of Applied Sciences, Bernburg, GERMANY
High expertise and cost barriers exclude small and medium-sized enterprises from discrete-event simulation (DES). We introduce GenAI4SimPy, a multi-agent framework powered by Qwen 3.6 (27B), an open-weight large language model, that automates end-to-end DES generation from manufacturing event logs to executable SimPy models through tool-augmented reasoning and human-in-the-loop validation. Evaluated on three execution blocks from a public smart factory dataset, the framework achieved a mean absolute percentage error of 7.9% and coverage of failure rate for all three blocks and of throughput for two of three. A fidelity paradox was observed: accurate process-level parameters did not ensure system-level behavioral fidelity, with flow-time and throughput errors driven by misinterpreted observation-window truncation and absent system-level calibration. These results demonstrate that local open-weight models can perform DES generation at accuracy comparable to cloud-based alternatives, while identifying parameter extraction as necessary but insufficient for behavioral validity. Source code and results are available at https://github.com/RaikoPipe/genai4simpy
Figures & tables
Figure 1: Architecture of the GenAI4SimPy framework. The workflow integrates data analysis, topology analysis, parameter extraction, and simulation generation—each step validated by a HITL. The result is a validated SimPy simulation.
Block
Day
Cases
Events
Conc.
Multifl.
Fail.
p90 wait
A
2021-07-06
18
576
7.1/12
14/18
7
139 s
B
2021-06-30
38
1383
5.9/9
34/38
7
67 s
C
2021-07-01
37
1137
6.1/9
25/37
5
62 s
Table 2: Profile of the three evaluation blocks. Concurrency is reported as mean/max simultaneously active cases; p90 wait denotes the 90th percentile of queue wait ( start − scheduled ). Multifloor and failure columns are counts relative to the block’s case total.
Metric
Block A
Block B
Block C
Wall-clock time (min)
109
118
145
Generated code (lines)
379
658
793
Self-repair iterations
2
1
0
Phase-level recovery events
1
2
1
Table 3: Pipeline execution profiles across three independent runs.
Figure 2: Per-block 95% confidence intervals for (a) coverage-based KPIs, shown as percentage deviation from ground truth (CIs crossing the zero line indicate coverage), and (b) threshold-based KPIs, shown as fraction of the acceptable-tier threshold (Jensen–Shannon divergence (JSD) ≤0.05 , mean absolute percentage error (MAPE) ≤20% ; CIs remaining below 100% indicate a pass). Block A throughput ( + 500%) exceeds the axis range and is indicated by an arrow. Block A threshold KPIs lack confidence intervals due to deterministic arrivals eliminating between-replication variance.
The design of manufacturing systems relies on discrete-event simulation (DES) models that experts still build in tool-specific interfaces. AI agents can now write simulation code, but every model they write from scratch is new, unverified software. We present SimuLean, an open-source 3D DES simulator on the Unity engine designed to be programmed by AI agents: its modelling semantics are verified once, in the platform, and the agent builds and studies one model through domain-level commands, in the 3D scene or headless; physically simulated durations are calibrated for fast headless studies. We evaluated it on 18 manufacturing modelling tasks, from single machines to published production lines. A frontier agent built valid models in 93 of 108 attempts (86%), in about two minutes each; on the benchmark's interface version, two frontier agents built 105 of 108 models through domain commands alone, so that each comes with a record of how it was built. Every residual failure was silent - a model that builds and runs but answers wrongly - and only comparison with reference models revealed them all. In an industrial case, one agent working alone rebuilt, verified and studied a robotised welding workshop from a published study, in SimuLean and in SimPy. Comparing them with the published, expert-built model exposed an error in it; against the corrected model, the agent-built models agree within 1%. One agent can already build complete, realistic and traceable models for the design of manufacturing systems; independent reference models are what make them trustworthy.
Javier Pernas-Álvarez, Diego Crespo-Pereira
University of A Coruña, CITENI, Grupo Integrado de Ingeniería, Campus Industrial de Ferrol, Campus de Esteiro s/n, Ferrol, 15403, Spain
Recent work has explored the use of Large Language Models (LLMs) to automate simulation model building, typically by generating executable code directly from natural language descriptions. However, this raises challenges for verification and reproducibility particularly for users without programming expertise. We propose Sketch2DES, a sketch-to-simulation workflow that converts diagrammatic representations of queuing networks into verifiable discrete-event simulation models using open-weight LLMs. The workflow has three stages: (1) translation of a diagram into a semi-structured textual description using a multimodal LLM; (2) conversion into schema-validated structured data (JSON) via an LLM with a reflection-based verification loop; and (3) deterministic transformation into an executable simulation model using a software adapter. Intermediate artefacts can therefore be inspected and automatically validated before execution. We evaluate the approach on eight queuing-network diagrams of varying complexity. The workflow achieved high reliability for all stages, and results were statistically indistinguishable from human-coded and analytical benchmarks. Compared to direct code generation, the workflow improves reproducibility, transparency, and verifiability, while reducing the need for programming expertise. Limitations include restricted model scope and dependence on accurate visual interpretation. The results demonstrate the feasibility of structured, workflow-based model generation as a robust foundation for LLM-assisted simulation modelling.
Generating executable simulations from natural language specifications remains a challenging problem due to the limited reasoning capacity of large language models (LLMs) when confronted with large, interconnected codebases. This paper presents FactorSmith, a framework that synthesizes playable game simulations in code from textual descriptions by combining two complementary ideas: factored POMDP decomposition for principled context reduction and a hierarchical planner-designer-critic agentic workflow for iterative quality refinement at every generation step. Drawing on the factored partially observable Markov decision process (POMDP) representation introduced by FactorSim [Sun et al., 2024], the proposed method decomposes a simulation specification into modular steps where each step operates only on a minimal subset of relevant state variables, limiting the context window that any single LLM call must process. Inspired by the agentic trio architecture of SceneSmith [Pfaff et al., 2025], FactorSmith embeds within every factored step a three-agent interaction: a planner that orchestrates workflow, a designer that proposes code artifacts, and a critic that evaluates quality through structured scoring, enabling iterative refinement with checkpoint rollback. This paper formalizes the combined approach, presents the mathematical framework underpinning context selection and agentic refinement, and describes the open-source implementation. Experiments on the PyGame Learning Environment benchmark demonstrate that FactorSmith generates simulations with improved prompt alignment, fewer runtime errors, and higher code quality compared to non-agentic factored baselines.