Generic selectors
Exact matches only
Search in title
Search in content
Search in posts
Search in pages
System Dynamics Blog


Kotlin System Dynamics Toolkit

Kotlin System Dynamics Toolkit

by | Aug 17, 2021 | Co-Author : Darko Etinger | Zlatko Sirotic | Kresimir Pripuzic

.We developed Kotlin SD Toolkit, or ksdtoolkit, in late 2019/20 as a tool that is suitable for both modelling large, hierarchical System Dynamics (SD) models (supporting modules) and for automatic generation of interactive simulators for multiple target platforms: desktop, web or mobile using Kotlin programming language.

Kotlin first appeared in 2011 as a statically-typed programming language, with modern, more expressive syntax, null-pointer exception safety, and both object-oriented and functional programming capabilities. It is interoperable with all existing Java libraries and frameworks, and it is Google’s preferred language for Android application development since 2017. Kotlin also excels in developing internal, domain-specific language (internal DSL), which allows adapting general-purpose language (e.g. Kotlin) to solve problems of a specific domain (e.g. system dynamics).

We found that Kotlin programming language is a new, good choice for SD modelling and simulation since it provides many new benefits:

  • Kotlin has an expressive and concise syntax (in comparison to Java), making SD model definition concise

  • Kotlin allows us to develop an internal domain-specific language (DSL) specially tailored for the SD domain

  • Kotlin is a statically-typed programming language (in comparison to dynamically-typed Python) meaning it detects type-errors at compile time instead of failing at runtime

  • prevents null-pointer exceptions at runtime by tracking values, making SD model robust and stable

  • Kotlin combines both the object-oriented and functional programming approaches allowing us to develop large hierarchical SD models, reusing previously developed and tested SD submodels as modules

  • Kotlin is completely interoperable with any existing Java libraries, allowing us to do any data-processing, storing or visualization developed so far in Java.

For the development of Kotlin SD Toolkit we used IntelliJ IDEA (Ultimate Edition, 2019.1 version) integrated development environment for programming in Java/Kotlin languages, from company JetBrains (JetBrains s.r.o, Prague, Czech Republic), the same company that developed Kotlin. We also used: OpenJDK 11 – open Java development kit, OpenJFX – open JavaFX, Gradle – dependency management & build automation tool, Vaadin 8 – Vaadin web framework, and Android SDK – Android software development kit.

The simulation speed was not in our primary focus and could be further improved. A preliminary test on 10 million (1E7) time steps with a very simple SD model (comprised of just one stock and one flow) runs 7.08 seconds on Kotlin SD Toolkit using a laptop computer (Intel i7-8550U CPU at 1.80 GHz with 16 GB of RAM) , while in BPTK-Py runs 153.0 seconds (thus 22x times slower), and in Vensim 6.2 Double Precision runs 30.0 seconds (thus 4x times slower).

Kotlin SD Toolkit in this stage of development has several limitations since we have not implemented: 1) GUI for graphical model design, 2) XMILE transpiler, 3) simulation scenario management, and 4) SD functions or collection of archetypes (e.g. SD molecules). In the near future, we plan to expand the toolkit and overcome these limitations.

Kotlin SD Toolkit is available as a free, open-source GitHub project and we present it as our contribution to the System Dynamics community.



Sovilj, Etinger, Sirotić, and Pripužić are coauthors of “System dynamics modeling and simulation with Kotlin”, available on the System Dynamics Review.



Recent Posts

ISDC 2021 Highlights: Food “Wickedness”

The International System Dynamics Conference (ISDC) convenes practitioners who demonstrate what’s new and developing in their fields with System Dynamics. This section of the WiSDom Blog, “Conference Highlights,” asks system dynamicists to spotlight key presentations...

ISDC 2021 Highlights: Tackling Structural Racism with Modeling

The International System Dynamics Conference (ISDC) convenes practitioners who demonstrate what’s new and developing in their fields with System Dynamics. This section of the WiSDom Blog, “Conference Highlights,” asks system dynamicists to spotlight key presentations...

Housing Dynamics

Housing Dynamics We had an insightful conversation with David Stroh, Martijn Eskinasi, and Kaveh Dianati at our latest seminar. We learned about how using causal loop diagrams based on simple archetypes, illuminate interdependencies across housing availability, wealth...

Upcoming Events

En-Roads: an online Climate Action Simulation

En-Roads: an online Climate Action Simulation

SYDIC is proud to announce the “En-Roads: an online Climate Action Simulation” workshop, that will be held on 21-22 September 2021 on the occasion of the “#All4Climate – Italy 2021” manifestation, promoted by the Italian Ministry for Ecological Transition (MiTE), and...

Recent Business cases

General Motors OnStar

Name The General Motors OnStar Project Modelers Vince Barabba, Chet Huber, Fred Cooke, Nick Pudar, Jim Smith, Mark Paich Client General Motors Client Type Corporation The Official Website is the official website in which you can become a member, get...

Pharmaceutical Product Branding Strategies

Pharmaceutical Product Branding Strategies Name Pharmaceutical Product Branding Strategies — Simulating Patient Flow and Portfolio Dynamics Modelers Mark Paich, Corey Peck, Jason Valant Contact Jason Valant or Corey Peck Client Numerous Pharmaceutical Companies Client...

Polio Eradication

Polio Eradication Name Polio Eradication Modelers Kimberly M. Thompson,and Radboud J. Duintjer Tebbens Client World Health Organization (WHO) Client Type NGO The Issue You Tackled Following successful eradication of smallpox and impressive progress in the elimination...

Join us

Siniša Sovilj
Siniša Sovilj


Darko Etinger

Zlatko Sirotic

Kresimir Pripuzic

One thought on “Kotlin System Dynamics Toolkit

  1. Has the Kotlin SD extension, units and tests the unit dimensions? Ewample: wage (dollar/(person*month)) number of people (person)
    total wage per month = wage * number of people (dollar/month)?

Leave a Reply