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 forkotlinx.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 subclassTickedComponent
. - 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 usingwait()
- #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 becomeDATA
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
- More robust dependency injection
Performance
- Added jmh benchmark-suite and reporting
Documentation
- Continued migration to
Duration
as replacement forNumber
inhold()
,wait()
etc.
v0.9
Released at 2023-04-13
Major
- #49 Changed API to always favor
kotlin.time.Duration
to express durations. Previously untypedNumbers
were used that often led to confusion in larger simulations models. Evey simulation environment has now aDurationUnit
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
tokotlinx.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()
andrandom()
as extensions onCollection<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 usejava.time.Instant
andkotlin.time.Duration
inComponent.hold()
andEnvironment.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 ofrequest
includingrequestingSince
time - #35 Improved support for asynchronous event consumption (contributed by pambrose via PR)
- Reduced memory requirements of resource monitoring by 50% by inferring
occupancy
andavailability
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
- #47 Added entity auto-indexing to allow for more descriptive names
- #50 Fixed
trigger()
- Introduced more event-types and improved structured logging capabilities
- Renamed all
info
attributes tosnapshot
to convey intent better - Unified naming resource attributes
- #28 Added support API to sample UUIDs with engine-controlled randomization
- Added
capacity
to component collections - Reworked distribution support API for better API experience to enable controlled randomization in process models
- Removed
Resource.release()
because of incomplete and unclear semantics - #53 Generified
MetricsTimeline
Documentation
- #38 Rewritten gas-station example to illustrate depletable resource usage
- Added new datalore example workbook: Extended Traffic
- Reworked The Office Tower to include better model description and animation
- New: Lunar Mining model to illustrate new animation toolbox of kalasim
v0.7
Released 2021-11-27
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 (includingResource
,Component
orList<Component>
,MetricTimeline
) (fixes #18) - Thread-local context registry enabled via Koin Context Isolation (fixes #20)
- Dramatically improved simulation performance
Documentation
- New chapter about collections
- Revised resource documentation
- Rewritten ATM example to better illustrate parallelization and generators
- New example Bridge Games
- Started new canonical complex simulation example: emergency room
Minor enhancements
- Added possibility stop a simulation from a process definition using
`stopSimulation
- Introduced
AssertMode
s (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 fromComponentQueue
- Fixed
oneOf
inrequest()
- Redesigned
honorBlock
inrequest()
to returnUnit
and to provide claimed resource viait
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
fromEnvironment
and createdcomponentCollector
as optional replacement - Redesigned events & metrics API
- Updated to
koin
v3.1 (fixes #15):GlobalContext
has been replaced withDependencyContext
- Established use of
SimTime
across the entire API to disambiguate simulation time instants from durations, which are still modelled asDouble
- Changed
Component.now
andEnvironment.now
to new value classSimTime
for better type safety - Simplified
ClockSync
API by removing redundantspeedUp
parameter Component.status
has been renamed toComponent.componentState
to enable extending classes to use the property namestatus
for domain modelling- Removed requirement to implement
info
inSimulationEntity
- Moved stochastic distributions support API to from
Component
toSimulationEntity
- Removed
Component::setup
because the user can just use aninit{}
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 policyval doctors = List(3) { Resource() } val selected = selectResource( doctors, policy = ShortestQueue )
-
New suspending
batch
interaction to group an entity stream into blocksval 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 justComponent
s)ComponentGenerator(uniform(0,1)){ counter -> "smthg no${counter}"}
-
Added
forceStart
toComponentGenerator
to define if an arrival should be happen when it is activated for the first time -
Changed scheduling priority from
Int
to inline classPriority
(with defaultsNORMAL
,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
- Added first jupyter notebook example
- New depletable resource type
- New statistical distributions API
- New more structured event logging. See user manual
- Implemented support for real-time simulations
- New example Dining Philosophers
- New example Movie Theater
- New API to add dependencies in simulation context using
dependency {}
Notable Fixes
- Fixed
failAt
inrequest
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: ReplacedscheduledTime = Double.MAX_VALUE
withnull
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