instantiateΒΆ

Instantiates an SSP model for simulation by creating an internal runtime representation. After instantiation, users can modify parameter values on the instantiated model and specify the simulation result file before running the simulation.

Notes:
  • All start values from SSV files and inline SSP setValue calls are applied initially.

  • Values set via setValue on the instantiated model override the initial values.

  • The instantiated model is independent of the SSP file on disk

  • After instantiation, simulation methods such as initialize(), simulate(), terminate(), and delete() can be used.

  • The instantiated model should be deleted using delete() to free resources after simulation.

  • setResultFile() should be called before simulation to define the output file for logged results.

Syntax:

instantiated_model = model.instantiate() -> InstantiatedSSP
Returns:
  • (InstantiatedSSP): A runtime object representing the SSP model, ready for simulation.

Example usage:

from OMSimulator import SSP, CRef, Settings

# import SSP
model2 = SSP("SimpleSimulation2.ssp")
model2.list()

# Instantiate the model for simulation
instantiated_model = model2.instantiate()  # Start values from SSV and inline setValue are applied

# Set result file
instantiated_model.setResultFile("SimpleSimulation6_res.mat")

# Override parameter values at runtime
instantiated_model.setValue(CRef("default", "Gain1", "k"), 2.0)
instantiated_model.setValue(CRef("default", "Gain1", "u"), 6.0)