ReplicationDataAttachment

Opt-in attachment that captures per-replication observation arrays for all ksl.modeling.variable.Response and ksl.modeling.variable.Counter elements present in the model at the time onAttach is called.

Add to RunRequest.SingleRun.attachments when box-plot or Welch analysis is needed after the run. Not attached by default: RunResult.Completed.snapshot covers across-replication aggregates for most use cases without the extra memory cost of per-replication arrays.

val repData = ReplicationDataAttachment()
val handle = runner.submit(RunRequest.SingleRun(model, attachments = listOf(repData)))
handle.result.await()
val arrays: Map<String, DoubleArray> = repData.replicationData

replicationData is available after RunHandle.result resolves. Each array has length equal to model.numberOfReplications; values are the replication average for ksl.modeling.variable.Response elements and the final counter value for ksl.modeling.variable.Counter elements.

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard

Per-replication data arrays keyed by element name. Empty if onAttach has not been called or the model had no responses/counters.

Functions

Link copied to clipboard
open override fun onAttach(model: Model, scope: CoroutineScope)

Called once on the simulation thread before the experiment is initialized.

Link copied to clipboard
open override fun onDetach()

Called once after the worker run ends, provided onAttach was called.