Skip to content

Kalasim Release History

1.0

Major & Breaking API Changes

  • Most importantly we have migrated the API to use org.kalasim.SimTime to track simulation. SimTime is a simple typealias for kotlinx.datetime.Instant, effectively giving users the full flexibility of using a well designed and established date-time concept. org.kalasim.TickTime is still available for backward compatibility reasons, but is opt-in or required to subclass TickedComponent.
  • Simplified the configurability for tracking of entity timelines and statistics. It's now more direct via constructor parameters in addition to environment defaults
  • #68 Improved arithmetics of metric timelines
  • #65 provide a statistics API for the internal event bus
  • #69 Allow activating processes with argument in a type-safe manner

Minor improvements

  • #51 Added description for better readiability when supepending exeuction for simulatoin states using wait()
  • #56 Improved support for duration distributions
  • Expose Environment.getOrNull<T>() from koin to check for presence of registered dependencies in simulation environment
  • #46 clarify use of collect with filter
  • #52 Improved visualization of metric timelines to support zoom range
  • #67 & #64 Added more safety guard mechanisms to prevent context violations when branching component processes.

Starting with this release we have switched to calendar versioning for better clarity regarding our release density, timing and schedule.

v0.11

Major improvements

  • significantly improved library performance
  • Added Int.Weeks extension
  • Introduced suspendable join(components: List<Component>) to wait for other components to become DATA

Documentation & Examples * New Example Shipyard - Multipart assembly

v0.10

Released 2023-06-16

Breaking API Changes

  • tick metrics and component-logger are now configured and not enabled via constructor parameter any longer (to minimize constructor complexity)

Improvements

Performance

  • Added jmh benchmark-suite and reporting

Documentation

  • Continued migration to Duration as replacement for Number in hold(), wait() etc.

v0.9

Released at 2023-04-13

Major

  • #49 Changed API to always favor kotlin.time.Duration to express durations. Previously untyped Numbers were used that often led to confusion in larger simulations models. Evey simulation environment has now a DurationUnit such as seconds, hours, etc. (defaulting to minutes if not specified).
  • New opt-in annotations were introduced to prevent use of untyped duration arguments in interaction functions such as ``
  • Migrated use of Instant to kotlinx.datetime.Instant for better API consistency
  • New sampling functions to sample durations directly: val uni = uniform(5.minutes, 2.hours); uni() // results in Duration

Minor

  • Overwrite shuffled() and random() as extensions on Collection<T> in simulation entities to enable better control over randomization by default

v0.8

Released announced at 2022-09-27

Milestone Enhancements

  • Implemented honor policies allowing for more configurable request queue consumption
    val r  = Resource(honorPolicy = RequestHonorPolicy.StrictFCFS)
    
  • Added Timeline Arithmetics. It is now possible to perform stream arithmetics on timeline attributes
  • Introduced different capacity modes if resource requests exceed resource capacity.
    val tank  = DepletableResource(capacity=100, initialLevel=60)
    
    put(gasSupply, 50, capacityLimitMode = CapacityLimitMode.CAP)
    
  • #23 Added support for duration extensions introduced in kotlin v1.6 to express durations more naturally with 2.hours, 3.minutes and so on. It is now possible to use java.time.Instant and kotlin.time.Duration in Component.hold() and Environment.run.
    createSimulation{
        object: Component{
            val driver = Resource(2) 
            override fun process() = sequence {
                request(driver) {
                    hold(23.minutes)
                }
                hold(3.hours)
            }
    
        }
    }.run(2.5.days) // incl. fractional support
    

Major Enhancements

  • #37 Simplified process activation in process definitions
  • #34 Added support for triangular distributions
  • #43 Simplified states to consume predicates directly in wait()
  • #27 Made resource events more informative and consistent. These event now include a request-id to enable simplified bottleneck analyses
  • Added RequestScopeContext to honor-block of request including requestingSince time
  • #35 Improved support for asynchronous event consumption (contributed by pambrose via PR)
  • Reduced memory requirements of resource monitoring by 50% by inferring occupancy and availability using Timeline Arithmetics
  • #38 Extended and improved API support for depletable resources.
  • Added ComponentQueue.asSortedList() to sorted copy of underlying priority queue
  • Ported data-frame-support from krangl to the more modern kotlin-dataframe.

Minor enhancements

Documentation

v0.7

Released 2021-11-27

See release announcement

Major enhancements

  • Reworked event & metrics logging API
  • Introduced ComponentList
  • Implemented ticks metrics monitor (fixes #9)
  • New timeline and activity log attributes to resources for streamlined usage and capacity analysis
  • Extended display() support API on all major components and their collections (including Resource, Component or List<Component>, MetricTimeline) (fixes #18)
  • Thread-local context registry enabled via Koin Context Isolation (fixes #20)
  • Dramatically improved simulation performance

Documentation

Minor enhancements

  • Added possibility stop a simulation from a process definition using `stopSimulation
  • Introduced AssertModes (Full, Light (default), None) to enable/disable internal consistency checks. This will optimize performance by another ~20% (depending on simulation logic)
  • Improved request priority API
  • Allow for runtime reconfiguration of ClockSync to enable adjustable simulation speed
  • Lifted Component sub-type requirement from ComponentQueue
  • Fixed oneOf in request()
  • Redesigned honorBlock in request() to return Unit and to provide claimed resource via it
    request(doctorFoo, doctorBar, oneOf = true) { doctor ->
        println("patient treated by $doctor")
    }
    
  • Added RealDistribution.clip to allow zero-inflated distribution models with controlled randomization

Breaking changes

  • Removed components from Environment and created componentCollector as optional replacement
  • Redesigned events & metrics API
  • Updated to koin v3.1 (fixes #15): GlobalContext has been replaced with DependencyContext
  • Established use of SimTime across the entire API to disambiguate simulation time instants from durations, which are still modelled as Double
  • Changed Component.nowand Environment.now to new value class SimTime for better type safety
  • Simplified ClockSync API by removing redundant speedUp parameter
  • Component.status has been renamed to Component.componentState to enable extending classes to use the property name status for domain modelling
  • Removed requirement to implement info in SimulationEntity
  • Moved stochastic distributions support API to from Component to SimulationEntity
  • Removed Component::setup because the user can just use an init{} block instead
  • Migrated release channel from jcenter to maven-central

v0.6

Released 2021-02-12 -> Updated to v0.6.6 on 2021-05-05

Major Enhancements

  • Added selectResource() to select from resources with policy

    val doctors = List(3) { Resource() }
    val selected = selectResource( doctors, policy = ShortestQueue )
    

  • New suspending batch interaction to group an entity stream into blocks

    val queue = ComponentQueue<Customer>()
    val batchLR: List<Customer> = batch(queue, 4, timeout = 10)
    

  • Added option to configure a tick to wall time transformer

    createSimulation {
        tickTransform = OffsetTransform(Instant.now(), DurationUnit.MINUTES)
    
        run(Duration.ofMinutes(90).asTicks())
        println(asSimTime(now))
    }
    

  • Added lifecycle records to streamline component state analyses

  • Changed ComponentGenerator to allow generating arbitrary types (and not just Components)

    ComponentGenerator(uniform(0,1)){ counter -> "smthg no${counter}"}
    

  • Added forceStart to ComponentGenerator to define if an arrival should be happen when it is activated for the first time

  • Changed scheduling priority from Int to inline class Priority (with defaults NORMAL, HIGH, LOW) in all interaction methods for more typesafe API

  • Started bundled simulations for adhoc experimentation and demonstration by adding M/M/1 queue MM1Queue

  • Added support for pluggable visualization backend. Currently kravis and lets-plot are supported. For jupyter-notebook examples mm1-queue analysis

    // simply toggle backend by package import
    import org.kalasim.plot.letsplot.display
    // or
    //import org.kalasim.plot.kravis.display
    
    MM1Queue().apply {
        run(100)
        server.claimedMonitor.display()
    }
    

  • New Example: "The ferryman"

  • New Example: Office Tower

v0.5

Released 2021-01-12

Major Enhancements

Notable Fixes

  • Fixed failAt in request

v0.4

Released 2021-01-03

Major Enhancements

  • Implemented interrupt interaction
  • Reworked documentation and examples
  • Implemented standby
  • Implement disable/enable for monitors
  • Yield internally, to simplify process definitions

    // before
    object : Component() {
        override fun process() = sequence { yield(hold(1.minutes)) }
    }
    
    // now
    object : Component() {
        override fun process() = sequence { hold(1.hours) }
    }
    

  • Made scheduledTime nullable: Replaced scheduledTime = Double.MAX_VALUE with null where possible to provide better mental execution model

  • Provide lambda parameter to enable auto-releasing of resources
    // before
    object : Component() {
        override fun process() = sequence { 
            request(r)
            hold(1)
            release(r)
        }
    }
    
    // now
    object : Component() {
        override fun process() = sequence { 
            request(r){
                hold(1)
            }
        }
    }
    
  • Implemented Environment.toString to provide json description
  • Various bug-fixes

v0.3

  • Reimplemented monitors
  • Continued salabim core API reimplementation
  • Fixed: Decouple simulation with different koin application contxts

v0.2

  • Reimplement core salabim examples in kotlin
  • Port all salabim examples
  • Started MkDocs manual

v0.1

  • Reimplement salabim's main component lifecycle
  • Add timing API