From b602faae6b5e563dccfe2ccbc2329607a8e1a0a4 Mon Sep 17 00:00:00 2001 From: <> Date: Mon, 18 Nov 2024 05:47:35 +0000 Subject: [PATCH] Deployed 18f773d with MkDocs version: 1.6.1 --- .nojekyll | 0 404.html | 1780 +++++ CNAME | 1 + about/index.html | 2116 ++++++ advanced/index.html | 2110 ++++++ analysis/index.html | 2022 +++++ animation/1136px-FullMoon2010.jpg | Bin 0 -> 217750 bytes animation/LunarMiningKt.uml | 26 + animation/index.html | 2169 ++++++ animation/lunar_mining.ipynb | 335 + animation/lunar_mining/index.html | 2177 ++++++ .../lunar_mining_files/lunar_mining_10_0.jpg | Bin 0 -> 287190 bytes .../lunar_mining_files/lunar_mining_12_0.jpg | Bin 0 -> 151981 bytes .../lunar_mining_domain_model.png | Bin 0 -> 60686 bytes articles/2021-11-27-kalasim-v07/index.html | 1963 +++++ articles/2022-09-27-kalasim-v08/index.html | 1988 +++++ .../2022-11-25-kalasim-at-wsc22/index.html | 1828 +++++ articles/articles/index.html | 1829 +++++ assets/images/favicon.png | Bin 0 -> 1870 bytes assets/javascripts/bundle.83f73b43.min.js | 16 + assets/javascripts/bundle.83f73b43.min.js.map | 7 + assets/javascripts/lunr/min/lunr.ar.min.js | 1 + assets/javascripts/lunr/min/lunr.da.min.js | 18 + assets/javascripts/lunr/min/lunr.de.min.js | 18 + assets/javascripts/lunr/min/lunr.du.min.js | 18 + assets/javascripts/lunr/min/lunr.el.min.js | 1 + assets/javascripts/lunr/min/lunr.es.min.js | 18 + assets/javascripts/lunr/min/lunr.fi.min.js | 18 + assets/javascripts/lunr/min/lunr.fr.min.js | 18 + assets/javascripts/lunr/min/lunr.he.min.js | 1 + assets/javascripts/lunr/min/lunr.hi.min.js | 1 + assets/javascripts/lunr/min/lunr.hu.min.js | 18 + assets/javascripts/lunr/min/lunr.hy.min.js | 1 + assets/javascripts/lunr/min/lunr.it.min.js | 18 + assets/javascripts/lunr/min/lunr.ja.min.js | 1 + assets/javascripts/lunr/min/lunr.jp.min.js | 1 + assets/javascripts/lunr/min/lunr.kn.min.js | 1 + assets/javascripts/lunr/min/lunr.ko.min.js | 1 + assets/javascripts/lunr/min/lunr.multi.min.js | 1 + assets/javascripts/lunr/min/lunr.nl.min.js | 18 + assets/javascripts/lunr/min/lunr.no.min.js | 18 + assets/javascripts/lunr/min/lunr.pt.min.js | 18 + assets/javascripts/lunr/min/lunr.ro.min.js | 18 + assets/javascripts/lunr/min/lunr.ru.min.js | 18 + assets/javascripts/lunr/min/lunr.sa.min.js | 1 + .../lunr/min/lunr.stemmer.support.min.js | 1 + assets/javascripts/lunr/min/lunr.sv.min.js | 18 + assets/javascripts/lunr/min/lunr.ta.min.js | 1 + assets/javascripts/lunr/min/lunr.te.min.js | 1 + assets/javascripts/lunr/min/lunr.th.min.js | 1 + assets/javascripts/lunr/min/lunr.tr.min.js | 18 + assets/javascripts/lunr/min/lunr.vi.min.js | 1 + assets/javascripts/lunr/min/lunr.zh.min.js | 1 + assets/javascripts/lunr/tinyseg.js | 206 + assets/javascripts/lunr/wordcut.js | 6708 +++++++++++++++++ .../workers/search.6ce7567c.min.js | 42 + .../workers/search.6ce7567c.min.js.map | 7 + assets/stylesheets/main.0253249f.min.css | 1 + assets/stylesheets/main.0253249f.min.css.map | 1 + assets/stylesheets/palette.06af60db.min.css | 1 + .../stylesheets/palette.06af60db.min.css.map | 1 + atom.xml | 83 + basics/index.html | 2443 ++++++ basics_images/event_loop.png | Bin 0 -> 109399 bytes basics_images/event_loop.pptx | Bin 0 -> 91703 bytes basics_images/event_loop.svg | 1 + basics_images/honor_policies.pptx | Bin 0 -> 44450 bytes changes/index.html | 2391 ++++++ collections/index.html | 2038 +++++ component/index.html | 3017 ++++++++ component_state_summed.png | Bin 0 -> 33423 bytes event_hierarchy.png | Bin 0 -> 22652 bytes events/index.html | 2263 ++++++ examples/Vintage_Gas_Pump_Unsplash.jpg | Bin 0 -> 157329 bytes examples/atm_queue.ipynb | 425 ++ examples/atm_queue/index.html | 2074 +++++ examples/atm_queue_files/atm_queue_14_0.jpg | Bin 0 -> 109656 bytes examples/bank_office/index.html | 2739 +++++++ examples/bridge_game.ipynb | 538 ++ examples/bridge_game/index.html | 2080 +++++ .../bridge_game_files/bridge_game_14_0.jpg | Bin 0 -> 116508 bytes .../bridge_game_files/bridge_game_16_0.jpg | Bin 0 -> 132427 bytes .../bridge_game_files/bridge_game_22_0.jpg | Bin 0 -> 140546 bytes examples/callcenter.ipynb | 604 ++ examples/callcenter/index.html | 2164 ++++++ examples/callcenter_files/callcenter_14_0.jpg | Bin 0 -> 165802 bytes examples/callcenter_files/callcenter_15_0.jpg | Bin 0 -> 165802 bytes examples/callcenter_files/callcenter_21_0.jpg | Bin 0 -> 228256 bytes examples/callcenter_files/callcenter_22_0.jpg | Bin 0 -> 228256 bytes examples/callcenter_files/callcenter_23_0.jpg | Bin 0 -> 211832 bytes examples/callcenter_files/callcenter_24_0.jpg | Bin 0 -> 211832 bytes examples/callcenter_plantronics.jpg | Bin 0 -> 883622 bytes examples/car/index.html | 1906 +++++ examples/car_wash/index.html | 1875 +++++ examples/dining_philosophers/index.html | 1932 +++++ examples/emergency_room.ipynb | 1615 ++++ examples/emergency_room/index.html | 2024 +++++ examples/ferry_left_right.png | Bin 0 -> 30520 bytes examples/ferry_right_left.png | Bin 0 -> 33909 bytes examples/ferryman/index.html | 1970 +++++ examples/gas_station.ipynb | 403 + examples/gas_station/index.html | 2094 +++++ examples/index.html | 1845 +++++ examples/machine_parts/index.html | 1876 +++++ examples/machine_shop/index.html | 1935 +++++ examples/movie_theater/index.html | 1903 +++++ examples/occupancy_progressions.png | Bin 0 -> 73360 bytes examples/office_tower/index.html | 1937 +++++ examples/office_tower_model.svg | 1273 ++++ examples/office_tower_snapshot.jpg | Bin 0 -> 281567 bytes examples/philosophers.png | Bin 0 -> 56648 bytes examples/shipyard/bom_example/index.html | 1842 +++++ examples/shipyard/shipyard/index.html | 1882 +++++ examples/spaghetti_time.png | Bin 0 -> 46858 bytes examples/squid_game_bridge_scene.png | Bin 0 -> 844349 bytes examples/squid_game_poster.png | Bin 0 -> 708704 bytes examples/traffic/index.html | 1906 +++++ examples/trafficlight.jpg | Bin 0 -> 236628 bytes faq/index.html | 1976 +++++ getting_started/index.html | 1845 +++++ index.html | 2000 +++++ jupyter_event_log.png | Bin 0 -> 56698 bytes monitors/index.html | 2220 ++++++ monitors_images/monitor.png | Bin 0 -> 46292 bytes openrndr_features.png | Bin 0 -> 174943 bytes resource/index.html | 2682 +++++++ resource_timeline.png | Bin 0 -> 32946 bytes search/search_index.json | 1 + setup/index.html | 1939 +++++ sitemap.xml | 167 + sitemap.xml.gz | Bin 0 -> 512 bytes state/index.html | 2162 ++++++ stylesheets/extra.css | 5 + theory/index.html | 1956 +++++ timeline_example.png | Bin 0 -> 44406 bytes visualization/index.html | 1997 +++++ 136 files changed, 99649 insertions(+) create mode 100644 .nojekyll create mode 100644 404.html create mode 100644 CNAME create mode 100644 about/index.html create mode 100644 advanced/index.html create mode 100644 analysis/index.html create mode 100644 animation/1136px-FullMoon2010.jpg create mode 100644 animation/LunarMiningKt.uml create mode 100644 animation/index.html create mode 100644 animation/lunar_mining.ipynb create mode 100644 animation/lunar_mining/index.html create mode 100644 animation/lunar_mining_files/lunar_mining_10_0.jpg create mode 100644 animation/lunar_mining_files/lunar_mining_12_0.jpg create mode 100644 animation/lunar_mining_files/lunar_mining_domain_model.png create mode 100644 articles/2021-11-27-kalasim-v07/index.html create mode 100644 articles/2022-09-27-kalasim-v08/index.html create mode 100644 articles/2022-11-25-kalasim-at-wsc22/index.html create mode 100644 articles/articles/index.html create mode 100644 assets/images/favicon.png create mode 100644 assets/javascripts/bundle.83f73b43.min.js create mode 100644 assets/javascripts/bundle.83f73b43.min.js.map create mode 100644 assets/javascripts/lunr/min/lunr.ar.min.js create mode 100644 assets/javascripts/lunr/min/lunr.da.min.js create mode 100644 assets/javascripts/lunr/min/lunr.de.min.js create mode 100644 assets/javascripts/lunr/min/lunr.du.min.js create mode 100644 assets/javascripts/lunr/min/lunr.el.min.js create mode 100644 assets/javascripts/lunr/min/lunr.es.min.js create mode 100644 assets/javascripts/lunr/min/lunr.fi.min.js create mode 100644 assets/javascripts/lunr/min/lunr.fr.min.js create mode 100644 assets/javascripts/lunr/min/lunr.he.min.js create mode 100644 assets/javascripts/lunr/min/lunr.hi.min.js create mode 100644 assets/javascripts/lunr/min/lunr.hu.min.js create mode 100644 assets/javascripts/lunr/min/lunr.hy.min.js create mode 100644 assets/javascripts/lunr/min/lunr.it.min.js create mode 100644 assets/javascripts/lunr/min/lunr.ja.min.js create mode 100644 assets/javascripts/lunr/min/lunr.jp.min.js create mode 100644 assets/javascripts/lunr/min/lunr.kn.min.js create mode 100644 assets/javascripts/lunr/min/lunr.ko.min.js create mode 100644 assets/javascripts/lunr/min/lunr.multi.min.js create mode 100644 assets/javascripts/lunr/min/lunr.nl.min.js create mode 100644 assets/javascripts/lunr/min/lunr.no.min.js create mode 100644 assets/javascripts/lunr/min/lunr.pt.min.js create mode 100644 assets/javascripts/lunr/min/lunr.ro.min.js create mode 100644 assets/javascripts/lunr/min/lunr.ru.min.js create mode 100644 assets/javascripts/lunr/min/lunr.sa.min.js create mode 100644 assets/javascripts/lunr/min/lunr.stemmer.support.min.js create mode 100644 assets/javascripts/lunr/min/lunr.sv.min.js create mode 100644 assets/javascripts/lunr/min/lunr.ta.min.js create mode 100644 assets/javascripts/lunr/min/lunr.te.min.js create mode 100644 assets/javascripts/lunr/min/lunr.th.min.js create mode 100644 assets/javascripts/lunr/min/lunr.tr.min.js create mode 100644 assets/javascripts/lunr/min/lunr.vi.min.js create mode 100644 assets/javascripts/lunr/min/lunr.zh.min.js create mode 100644 assets/javascripts/lunr/tinyseg.js create mode 100644 assets/javascripts/lunr/wordcut.js create mode 100644 assets/javascripts/workers/search.6ce7567c.min.js create mode 100644 assets/javascripts/workers/search.6ce7567c.min.js.map create mode 100644 assets/stylesheets/main.0253249f.min.css create mode 100644 assets/stylesheets/main.0253249f.min.css.map create mode 100644 assets/stylesheets/palette.06af60db.min.css create mode 100644 assets/stylesheets/palette.06af60db.min.css.map create mode 100644 atom.xml create mode 100644 basics/index.html create mode 100644 basics_images/event_loop.png create mode 100644 basics_images/event_loop.pptx create mode 100644 basics_images/event_loop.svg create mode 100644 basics_images/honor_policies.pptx create mode 100644 changes/index.html create mode 100644 collections/index.html create mode 100644 component/index.html create mode 100644 component_state_summed.png create mode 100644 event_hierarchy.png create mode 100644 events/index.html create mode 100644 examples/Vintage_Gas_Pump_Unsplash.jpg create mode 100644 examples/atm_queue.ipynb create mode 100644 examples/atm_queue/index.html create mode 100644 examples/atm_queue_files/atm_queue_14_0.jpg create mode 100644 examples/bank_office/index.html create mode 100644 examples/bridge_game.ipynb create mode 100644 examples/bridge_game/index.html create mode 100644 examples/bridge_game_files/bridge_game_14_0.jpg create mode 100644 examples/bridge_game_files/bridge_game_16_0.jpg create mode 100644 examples/bridge_game_files/bridge_game_22_0.jpg create mode 100644 examples/callcenter.ipynb create mode 100644 examples/callcenter/index.html create mode 100644 examples/callcenter_files/callcenter_14_0.jpg create mode 100644 examples/callcenter_files/callcenter_15_0.jpg create mode 100644 examples/callcenter_files/callcenter_21_0.jpg create mode 100644 examples/callcenter_files/callcenter_22_0.jpg create mode 100644 examples/callcenter_files/callcenter_23_0.jpg create mode 100644 examples/callcenter_files/callcenter_24_0.jpg create mode 100644 examples/callcenter_plantronics.jpg create mode 100644 examples/car/index.html create mode 100644 examples/car_wash/index.html create mode 100644 examples/dining_philosophers/index.html create mode 100644 examples/emergency_room.ipynb create mode 100644 examples/emergency_room/index.html create mode 100644 examples/ferry_left_right.png create mode 100644 examples/ferry_right_left.png create mode 100644 examples/ferryman/index.html create mode 100644 examples/gas_station.ipynb create mode 100644 examples/gas_station/index.html create mode 100644 examples/index.html create mode 100644 examples/machine_parts/index.html create mode 100644 examples/machine_shop/index.html create mode 100644 examples/movie_theater/index.html create mode 100644 examples/occupancy_progressions.png create mode 100644 examples/office_tower/index.html create mode 100644 examples/office_tower_model.svg create mode 100644 examples/office_tower_snapshot.jpg create mode 100644 examples/philosophers.png create mode 100644 examples/shipyard/bom_example/index.html create mode 100644 examples/shipyard/shipyard/index.html create mode 100644 examples/spaghetti_time.png create mode 100644 examples/squid_game_bridge_scene.png create mode 100644 examples/squid_game_poster.png create mode 100644 examples/traffic/index.html create mode 100644 examples/trafficlight.jpg create mode 100644 faq/index.html create mode 100644 getting_started/index.html create mode 100644 index.html create mode 100644 jupyter_event_log.png create mode 100644 monitors/index.html create mode 100644 monitors_images/monitor.png create mode 100644 openrndr_features.png create mode 100644 resource/index.html create mode 100644 resource_timeline.png create mode 100644 search/search_index.json create mode 100644 setup/index.html create mode 100644 sitemap.xml create mode 100644 sitemap.xml.gz create mode 100644 state/index.html create mode 100644 stylesheets/extra.css create mode 100644 theory/index.html create mode 100644 timeline_example.png create mode 100644 visualization/index.html diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 00000000..e69de29b diff --git a/404.html b/404.html new file mode 100644 index 00000000..5292c375 --- /dev/null +++ b/404.html @@ -0,0 +1,1780 @@ + + + +
+ + + + + + + + + + + + + + + + + + +kalasim
is licensed under MIT License.
kalasim
started off as a blunt rewrite of salabim. We are deeply thankful for its permissive licence that enabled setting up kalasim
. A great starting point was in particular the wonderful article salabim: discrete event simulation and animation in Python.
salabim
s excellent documentation and wonderful examples made this project possible after all. kalasim
reimplements all core APIs of salabim
in a more typesafe API while also providing better test coverage, real-time capabilities and (arguably) more modern built-in support for visualization.
simmer is a process-oriented and trajectory-based Discrete-Event Simulation (DES) package for R.
+It centres around the concept of a trajectory that defines a component lifecycle. To enable scale it is built on top of Rcpp (C++ backend for R).
+We have adopted several examples and documentation bits from simmer
, and are deeply grateful to the simmer developers for providing such a great and well maintained tool. simmer
has also been a great source of inspiration to implement in particular the monitoring and visualization API of kalasim
.
SimJulia is a combined continuous time / discrete event process oriented simulation framework written in Julia inspired by the Simula library DISCO and the Python library SimPy.
+We have adopted several examples and documentation bits from SimJulia
, and are deeply grateful its developers for providing such a great and well maintained tool.
SimPy is a process-based discrete-event simulation framework based on standard Python. Processes in SimPy
are defined by Python generator functions. SimPy
also provides various types of shared resources to model limited capacity congestion points (like servers, checkout counters and tunnels).
We have adopted several examples and documentation bits from SimPy
, and are deeply grateful its developers for providing such a great and well maintained tool.
DSOL3 which is an open source, Java based suite of Java classes for continuous and discrete event simulation
+kalasim
is built on top of some great libraries. It was derived as merger of ideas, implementation and documentation from the following projects:
kalasim
provides a machine-readable log-format for all basics in a simulation.Visualization
+Inspirations
+With kalasim
, we strive to enable large-scale time-discrete simulation models.
+To optimize the API and the engine for perormance, we rely
+on YourKit profiler.
+With its wonderful interface into JDK performace metrics,
+YourKit profiler allows us to signifantly improve the overall speed while reducing the memory footprint of kalasim
.
YourKit supports open source projects with innovative and intelligent tools for monitoring and profiling Java and .NET +applications. YourKit is the creator of YourKit Java Profiler.
+Holger Brandl holds a Ph.D. degree in machine learning and has developed new concepts in the field of computational linguistics. More recently he has co-authored publications in high-ranking journals such as Nature and Science.
+To stay in sync with what's happening in tech, he's developing open-source tools, methods and algorithms for bioinformatics, high-performance computing and data science. He's passionate about machine learning, AI, analytics, elegant APIs and data visualisation. His professional scope mainly centers around systems biology and industrial manufacturing.
+ + + + + + + + + + + + + +In simulation a clear distinction is made between real time and simulation time. With real time we refer to the wall-clock time. It represents the execution time of the experiment. The simulation time is an attribute of the simulator.
+To support use cases where a simulation may drive a demonstration or system check, the kalasim
API allows to run a simulation at a defined clock speed. Such real-time simulations may be necessary
import org.kalasim.*
+import kotlin.time.Duration.Companion.seconds
+
+val timeBefore = System.currentTimeMillis()
+
+createSimulation {
+ enableComponentLogger()
+
+ // enable real-time clock synchronization
+ ClockSync(tickDuration = 1.seconds)
+
+ run(10)
+}
+
+println("time passed ${System.currentTimeMillis() - timeBefore})")
+
To enable clock synchronization, we need to add a ClockSync
to our simulation. We need to define what one tick in simulation time corresponds to in wall time. In the example, one tick equals to one second wall time. This is configured with the parameter tickDuration
. It defines the duration of a simulation tick in wall clock coordinates. It can be created with Duration.ofSeconds(1)
, Duration.ofMinutes(10)
and so on.
ClockSync
also provides settings for more advanced uses-cases
speedUp
to run a simulation faster (speedUp
> 1) or slower (speedUp
< 1) than realtime. It defaults to 1
, that is no speed-up will be applied.syncsPerTick
defines how often a clock synchronization should happen. Per default it synchronizes once per tick (i.e. an 1-increment of simulation time).It may happen that a simulation is too complex to run at a defined clock. In such a situation, it (i.e. Environment.run()
) will throw a ClockOverloadException
if the user has specified a maximum delay maxDelay
parameter between simulation and wall clock coordinates.
Even if kalasim
tries to provide a simplistic, efficient, declarative approach to define a simulation, it may come along with computational demands simulation. To allow introspection into time-complexity of the underlying computations, the user may want to enable the built-in env.tickMetrics
monitor to analyze how much time is spent per time unit (aka tick). This monitor can be enabled by calling enableTickMetrics()
when configuring the simulation.
import org.kalasim.*
+import org.kalasim.plot.letsplot.display
+
+createSimulation {
+ enableTickMetrics()
+
+ object : Component() {
+ override fun process() = sequence {
+ while(true) {
+ // create some artificial non-linear compute load
+ if(nowTT.value < 7)
+ Thread.sleep((nowTT.value * 100).toLong())
+ else {
+ Thread.sleep(100)
+ }
+
+ hold(1.minutes)
+ }
+ }
+ }
+
+ run(10.hours)
+
+ tickMetrics.display().show()
+}
+
There are multiple ways to improve the performance of a simulation.
+AssertMode
: The assertion mode determines which internal consistency checks are being performed. The mode can be set to Full
(Slowest), Light
(default) or Off
(Fastest). Depending on simulation logic and complexity, this will improve performance by ~20%.To further fine-tune and optimize simulation performance and to reveal bottlenecks, a JVM profiler (such as yourkit or the built-in profiler of Intellij IDEA Ultimate) can be used. Both call-counts and spent-time analysis have been proven useful here.
+For some use-cases, simulations may run for a very long simulation and wall time. To prevent internal metrics gathering from consuming all available memory, it needs to be disabled or at least configured carefully. This can be achieved, but either disabling timelines and monitors manually on a per-entity basis, or by setting a sensible default policy via Environment.entityTrackingDefaults
For each entity type a corresponding tracking-policy TrackingConfig
can be provisioned along with an entity matcher to narrow down its scope. A tracking-policy allows to change
There are different default implementations, but the user can also implement and register custom tracking-configurations.
+//import org.kalasim.*
+import org.kalasim.misc.*
+import kotlin.time.Duration.Companion.hours
+import kotlin.time.Duration.Companion.minutes
+
+
+class Driver : Resource(trackingConfig = ResourceTrackingConfig(trackUtilization = false))
+class TrafficLight : State<String>("red", trackingConfig = StateTrackingConfig(logCreation = false))
+
+class Car : Component(
+ trackingConfig = ComponentTrackingConfig(logInteractionEvents = false)
+) {
+
+ val trafficLight = get<TrafficLight>()
+ val driver = get<Driver>()
+
+ override fun process() = sequence {
+ request(driver) {
+ hold(30.minutes, description = "driving")
+
+ wait(trafficLight, "green")
+ }
+ }
+}
+
+createSimulation {
+ enableComponentLogger()
+
+ // in addition or alternatively we can also change the environment defaults
+ entityTrackingDefaults.DefaultComponentConfig =
+ ComponentTrackingConfig(logStateChangeEvents = false)
+
+ // create simulation entities
+ dependency { TrafficLight() }
+ dependency { Driver() }
+
+ Car()
+}.run(5.hours)
+
Note
+Tracking configuration policies defaults must be set before instantiating simulation entities to be used
+To disable all metrics and to minimize internal event logging, the user can run env.entityTrackingDefaults.disableAll()
The same mechanism applies also fine-tune the internal event logging. By disabling some - not-needed for production - events, simulation performance can be improved significantly.
+kalasim
does not include a default mechanism to serialize and deserialize simulations yet. However, it seems that with xstream that Environment
can be saved including its current simulation state across all included entities. It can be restored from the xml snapshot and continued with run()
.
We have not succeeded to do the same with gson yet. Also, some experiments with kotlinx.serialization were not that successful.
+The simulation engine provides different levels of internal consistency checks. As these are partially computationally expensive these can be be/disabled. There are 3 modes
+OFF
- Productive mode, where asserts that may impact performance are disabled.LIGHT
- Disables compute-intensive asserts. This will have a minimal to moderate performance impact on simulations.FULL
- Full introspection, this will have a measurable performance impact on simulations. E.g. it will validate that passive components are not scheduled, and queued components have unique names.Switching off asserts, will typically optimize performance by another ~20% (depending on simulation logic).
+ + + + + + + + + + + + + +A core aspect when building simulations is to understand, define and modulate the inherent system dynamics. To build a correct simulation, the designer/developer must carefully analyze how states progress over time.
+To facilitate this process, kalasim
offers various means to analyze data created by a simulation
See chapter about monitors.
+See chapter about event logging.
+See chapter about visualization.
+The state transition of a component provide value insight into its behavior. This is facilitated by lifecycle statistics ComponentLifecycleRecord
that summarize a component's states history.
These data can also be transformed easily into a table as well +
val customers : List<Component> // = ...
+val records: List<ComponentLifecycleRecord> = customers.map { it.toLifeCycleRecord() }
+
+records.asDataFrame()
+
This transforms the customers
straight into a krangl
dataframe with the following structure
A DataFrame: 1034 x 11
+ component createdAt inCurrent inData inDataSince inInterrupted inPassive
+ 1 Vehicle.1 0.366 0 989.724 10.276 0 0
+ 2 Vehicle.2 1.294 0 984.423 15.577 0 0
+ 3 Vehicle.3 1.626 0 989.724 10.276 0 0
+ 4 Vehicle.4 2.794 0 989.724 10.276 0 0
+and 1024 more rows, and and 4 more variables: inScheduled, inStandby, inWaiting
+
Clearly if needed, the user may also work with the records directly. For instance to configure a visualization.
+Running a simulation just once, often does not provide sufficient insights into the dynamics of the system under consideration. Often, the user may want to execute a model many times with altered initial conditions, and then perform a statistical analysis over the output. This is also considered as what-if analyis. See here for simple example.
+By design kalasim
does not make use of parallelism. So when scaling up execution to run in paralell, we need to be careful, that the internal dependency injection (which relates by default to a global context variable) does not cause trouble. See here for an example that defines a parameter grid to be assessed with multi-threading with a simulation run per hyper-parameter.
To prevent memory leaks, the environment just keeps track of scheduled components, that is components that are queued for execution. In some situations the user may want to track all components irrespective of their queuing status. This can be achieved by setting up a component collector before creating the components
+createSimulation{
+ val cc = componentCollector()
+
+ // create components
+ Component("foo")
+ Component("bar")
+
+ // analyze all components created until this point
+ cc.size // will be 2
+}
+
O08E7Fql*OS}Z8O}%%J+{iG z;j(k!9fB{|kC*S~eVKmSTt^m#cn5t)8Z~?~S@xFaLA95u(wDVrofLfSbscB(oh7^8OR;%HpJ`%ZAJkJgvtc6q_P*> zQf^MjAA{0Pfd1R?qGP=)pW|vJyds2aeF(&%q%ZWKpFgff>lsIPvs? 011{Wo*Q|J>vTu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