Scenario
A scenario is a specification of a model to run with a fixed set of inputs and run parameters. Each call to simulate produces a new SimulationRun.
In the context of running multiple scenarios it is important that scenario names are unique so that each experiment can be identified within a ksl.utilities.io.dbutil.KSLDatabase. The scenario name is used as the experiment name for the simulation run.
Model construction semantics
modelBuilder is called at the start of each simulate invocation to produce a fresh Model instance. This design enables concurrent execution of independent scenarios via ConcurrentScenarioRunner: each run is isolated and leaves no shared state behind.
For backward compatibility, constructors that accept a pre-built Model are provided. They wrap the supplied instance in a ModelBuilderIfc that always returns the same model, so the sequential behaviour is identical to the previous implementation.
Concurrency note: scenarios constructed via the model: Model backward-compatible constructors wrap a single shared model instance. They are safe for sequential execution via ScenarioRunner but must not be submitted to ConcurrentScenarioRunner, which requires each scenario to produce a fresh, independent Model on every simulate call.
Run-parameter semantics
scenarioRunParameters is an owned snapshot captured at construction time. All 15 fields of ExperimentRunParameters are stored. The snapshot's experiment name is automatically set to name.
At run time the snapshot is applied to the model via Model.changeRunParameters inside SimulationRunner.
Parameters
Factory that creates the Model instance for each run.
The scenario name. Must be unique within the set of scenarios executed by a runner. Also used as the experiment name.
Numeric control and RV-parameter overrides (key → Double).
String control overrides (key → String).
JSON control overrides (key → JSON String).
Full experimental run configuration for this scenario.
Optional model configuration map forwarded to ModelBuilderIfc.build before each run.
Constructors
Backward-compatible constructor. The supplied model is wrapped so that each simulate call operates on the same instance.
Convenience constructor for the common case where only the three scalar run-parameter values need to differ from model's current settings.
Convenience constructor for use with a ModelBuilderIfc. The builder is invoked once at construction time to extract default run parameters; the returned model is then discarded. The three scalar values override the defaults.
Properties
Read-only view of the JSON control overrides for this scenario. Used by runner classes that build the model and invoke SimulationRunner directly.
Replication length configured for this scenario.
Warm-up length configured for this scenario.
The model configuration map forwarded to ModelBuilderIfc.build at run time, or null if no configuration was supplied at construction time. Used by runner classes that build the model directly.
Number of replications configured for this scenario.
The run parameters that will be applied when this scenario is simulated. This is the scenario's owned snapshot — not the model's live state.
The SimulationRun produced by the most recent call to simulate, or null if simulate has not yet been called.
Read-only view of the string control overrides for this scenario. Used by runner classes that build the model and invoke SimulationRunner directly.
True when this scenario is not known to reuse a pre-built model instance.
Functions
Convenience method for standalone scenario execution.
Builds a ReportNode.Document containing a standalone scenario report via scenario.
Restores default common-random-number behavior for this scenario by clearing any pre-run sub-stream advance.
Sets the number of sub-stream advances applied before this scenario runs.