Skip to content

Welcome to kalasim

Download Build Status slack github-discussions

kalasim is a discrete event simulator. It provides a statically typed API, dependency injection, modern persistence, structured logging and automation capabilities.

kalasim is designed for simulation practitioners, process analysts and industrial engineers, who need to go beyond the limitations of existing simulation tools to model and optimize their business-critical use-cases.

In contrast to many other simulation tools, kalasim is neither low-code nor no-code. It is code-first to enable change tracking, scaling, refactoring, CI/CD, unit-tests, and the rest of the gang that makes simulation development fun.

kalasim is written in Kotlin, is designed around suspendable coroutines for process definitions, runs on the JVM for performance and scale, is built with koin as dependency wiring framework, and is using common-math for stats and distributions. See acknowledgements for further references. kalasim is agnostic regarding a visualization frontend, but we provide bindings/examples using plotly.kt, lets-plot as well as kravis.

Core Features

kalasim is a generic process-oriented discrete event simulation (DES) engine.

Find out more about the basics of a kalasim simulation.

First Example

Let’s start with a very simple model. The example demonstrates the main mode of operation, the core API and the component process model implemented in kalasim. We want to build a simulation where a single car is driving around for a some time before stopping in front of a red traffic light.

import org.kalasim.*

class Driver : Resource()
class TrafficLight : State<String>("red")

class Car : Component() {

    val trafficLight = get<TrafficLight>()
    val driver = get<Driver>()

    override fun process() = sequence {
        request(driver) {
            hold(1.0, description = "driving")

            wait(trafficLight, "green")

createSimulation(enableConsoleLogger = true) {
    dependency { TrafficLight() }
    dependency { Driver() }


Curious about an in-depth analysis of this example? It's your lucky day, see here.

How to contribute?

Feel welcome to post ideas and suggestions to the project tracker.

We always welcome pull requests. :-)


Feel welcome to post questions and ideas in the project's discussion forum

Feel also invited to chat with us in the in the #kalasim channel.