Skip to content

Welcome to kalasim

Download Build Status slack github-discussions

kalasim is a discrete event simulation framework providing a statically typed API, dependency injection, enterprise-grade persistence, structured logging, and comprehensive automation capabilities for building digital twins.

kalasim is designed for simulation practitioners, process analysts, and industrial engineers who require advanced modeling capabilities beyond conventional simulation tools to analyze and optimize business-critical systems and processes.

Unlike many simulation tools, kalasim is neither low-code nor no-code. It follows a code-first philosophy, enabling version control, scalability, refactoring, continuous integration and deployment (CI/CD), comprehensive unit testing, and modern software engineering practices that ensure robust simulation development.

kalasim is implemented in Kotlin, leveraging suspendable coroutines for intuitive process definitions. The framework operates on the JVM to deliver enterprise-level performance and scalability, utilizes koin for dependency injection, and integrates Apache Commons Math for statistical analysis and probability distributions. For additional technical references, see acknowledgements. kalasim maintains visualization framework independence while providing integration examples for plotly.kt, lets-plot, and kravis.

2026 - Advancing Digital Twin Development

Building on our deep understanding of the challenges faced by simulation practitioners, we are pleased to announce significant enhancements to kalasim in 2026, further strengthening its capabilities for enterprise digital twin development.

  • Enhanced Performance: Significant improvements in simulation performance through optimized event processing and memory management architectures, enabling accurate modeling of larger, more complex industrial systems
  • Modern Technology Stack: Full compatibility with Kotlin 2.2, providing access to advanced language features and state-of-the-art development tooling for professional simulation engineering
  • Industry-Validated: kalasim has been successfully deployed across diverse industrial sectors—from automotive supply chain optimization to precision execution control in semiconductor manufacturing—demonstrating proven reliability in production-critical environments
  • Expanding Professional Community: A growing network of researchers, practitioners, and industrial engineers actively contributing to the framework through comprehensive documentation, peer-reviewed case studies, and collaborative knowledge exchange

KotlinConf Presentation

We presented at KotlinConf in Amsterdam, joining technology leaders from cloud computing, mobile development, and data science for collaborative knowledge exchange. Our presentation on "Make more money by modeling and optimizing your business processes with Kotlin" was well-received by the professional community:


Core Features

kalasim is a comprehensive process-oriented discrete event simulation (DES) engine designed for industrial applications.

  • Simulation entities employ generative process descriptions that define interactions and dependencies with other system entities
  • A well-defined, expressive process interaction vocabulary, including hold, request, wait, and passivate operations
  • An event trigger queue that maintains scheduled future actions and serves as the primary mechanism for simulation state progression
  • Integrated monitoring and statistical analysis capabilities throughout the entire API

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.

////Cars.kts
import org.kalasim.*
import kotlin.time.Duration.Companion.hours
import kotlin.time.Duration.Companion.minutes


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(30.minutes, description = "driving")

            wait(trafficLight, "green")
        }
    }
}

createSimulation {
    enableComponentLogger()

    dependency { TrafficLight() }
    dependency { Driver() }

    Car()
}.run(5.hours)

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

How to Contribute

We welcome contributions from the community. Please submit ideas and suggestions to the project issue tracker.

Pull requests are always appreciated and will be reviewed promptly.

Support

For questions and discussions, please visit the project's discussion forum.

You are also invited to join our community on kotlinlang.slack.com in the #kalasim channel.