r/Julia • u/Evening-Weather1852 • 5d ago
SimCore.jl & SimDES.jl: Discrete-event simulation with analytical queueing benchmarks, conveyor kinematics, and Makie visualization
Hi everyone, I’ve been working on discrete-event simulation in Julia and wanted to share an early release of two packages: SimCore.jl and SimDES.jl.
- SimCore.jl provides foundational event scheduling primitives (
FutureEventList, virtual clocks, and $O(1)$-memory streaming statistics). - SimDES.jl builds on top of SimCore to model queueing networks, material handling, and physical conveyor kinematics.
- GitHub: SimDES.jl | SimCore.jl
Motivation & Where This Fits in the Ecosystem
Julia already has great simulation packages, and I want to acknowledge them upfront:
- If you prefer process-oriented simulation (SimPy-style coroutines with
@resumableand@yield), ConcurrentSim.jl is mature and well-suited for that workflow. - If your problem revolves around agent-based modeling with complex spatial interactions, Agents.jl is the standard and far more established.
- For clock-based discrete event generation, DiscreteEvents.jl offers a clean, native approach.
Why SimCore and SimDES?
My work required a specific combination of needs that led me to build this framework:
- Automated Verification Against Queueing Theory: I wanted the engine's test suite to continuously assert empirical simulation results against closed-form queueing equations ($M/M/1$, $M/M/c$, $M/M/1/K$, Pollaczek-Khinchine for $M/G/1$, open Jackson product-form networks, and Little's Law invariance).
- Physical Conveyor Accumulation (ZPA): In material handling, items have physical dimensions and cannot overlap. I needed deterministic 1D conveyor kinematics where items queue up behind obstacles (Zero-Pressure Accumulation), observe safety gaps, and respect optical sensor interlocks without needing a heavy continuous physics engine.
- Constant-Memory Streaming Statistics: To run long simulations without blowing up RAM,
SimCoreintegrates single-pass Welford variance, Jain-Chlamtac $P^2$ streaming quantiles ($P_{50}, P_{95}, P_{99}$), and Welch moving-average warmup detection in $O(1)$ memory. - Decoupled Visualizations: The core engine has zero graphics dependencies, but optionally connects to Makie (
CairoMakiefor vector reports, orGLMakiefor interactive desktop GUIs with live observable streaming).
Quick Example: M/M/1 Queue
using Pkg
Pkg.add(["SimCore", "SimDES"])
using SimDES, Distributions
# 1. Setup simulation world with an arrival source and single server
world = SimWorld()
source_id = register_zone!(world, ZoneConfig(name = "Arrivals", arrival_dist = Exponential(1.0 / 2.0)))
server_id = register_zone!(world, ZoneConfig(name = "Server", capacity = 1, service_dist = Exponential(1.0 / 4.0)))
connect_zones!(world, source_id, server_id)
# 2. Run simulation
run_sim!(world; t_end = 1000.0)
# 3. Inspect results
stats = get_zone_stats(world, server_id)
println("Utilization ρ: ", stats.utilization) # Expected ≈ 0.50
println("Mean System Time W: ", stats.mean_sojourn) # Expected ≈ 0.50
There is also an interactive physical conveyor example in the repo (examples/06_interactive_conveyor_makie.jl) that demonstrates dynamic package routing, optical interlock gating, and ZPA queuing in GLMakie (an animated GIF of this is also embedded in the README).
Current Limitations & Honest Caveats
This is an early v0.1.0 release, and there are several limitations worth noting:
-
Early API: While the underlying queueing math passes all automated test suites, the public API may still evolve as we receive feedback.
-
Paradigm: It is based on explicit event scheduling and state transitions rather than coroutine-based yielding. If your mental model relies heavily on SimPy-style generators,
ConcurrentSim.jlmight feel more natural. -
Documentation: More work towrads tutorials and real-world industrial case studies is required .
Feedback Welcome!
If you work in operations research, queueing theory, industrial engineering, or discrete-event modeling, I would be very grateful if you could try running your models or take a look at the code. Any feedback, critique of the API design, bug reports, or feature suggestions on our GitHub Issues would be immensely appreciated. Thank you!