Scenario

class Scenario @JvmOverloads constructor(val model: Model, name: String, inputs: Map<String, Double> = emptyMap(), numberReplications: Int = model.numberOfReplications, lengthOfReplication: Double = model.lengthOfReplication, lengthOfReplicationWarmUp: Double = model.lengthOfReplicationWarmUp) : Identity, ExperimentIfc(source)

A scenario represents the specification of a model to run, with some inputs. Each scenario will produce a simulation run. In the context of running multiple scenarios, it is important that the scenario names be unique to permit automated storage within a KSL database. The name of the scenario is used to assign the name of the model's experiment prior to simulating the model. In this manner, each experiment can have a unique name.

Parameters

model

The model to be simulated

name

The name of the scenario. It should be unique within the context of a set of scenario being executed by a ScenarioRunner.

inputs

The map of inputs (based on control names) to apply to the model.

numberReplications

the number of replications for the scenario. By default, this is the current setting of the model.

lengthOfReplication

the length of each replication for the scenario. By default, this is the current setting of the model.

lengthOfReplicationWarmUp

the length of the warmup period for each replication for the scenario. By default, this is the current setting of the model.

Constructors

Link copied to clipboard
constructor(modelCreator: () -> Model, name: String, inputs: Map<String, Double> = emptyMap())

Uses the supplied model creation function to creat the model. The specification of model run parameters relies on the created model to correctly specify its running parameter.

constructor(model: Model, name: String, inputs: Map<String, Double> = emptyMap(), numberReplications: Int = model.numberOfReplications, lengthOfReplication: Double = model.lengthOfReplication, lengthOfReplicationWarmUp: Double = model.lengthOfReplicationWarmUp)

Properties

Link copied to clipboard
Link copied to clipboard

Can be used to supply a function that will set up the model prior to being run. This would allow for the assignment properties or invoking of additional logic prior to simulating the model.

Link copied to clipboard

returns the last generated simulation run

Functions

Link copied to clipboard
fun simulate()

Simulates the scenario by simulating the model at its current experimental run parameters using the supplied inputs. Generates a new simulation run with each execution.