Note: This is documentation for version 5.0 of Source. For a different version of Source, select the relevant space by using the Spaces menu in the toolbar above

Plugin Phase Details

In TIME.Scenario management we provide the following plugin hooks to allow a plugin to be called during model execution:

  1. IPluginPreInitialise: Gets called before any other subsystems get initialized - this is currently used for recorder set. Occurs before network and node reset methods
  2. IPluginInitialise: Gets called before the scenario is initialised (including its subsystems - e.g. data source etc..). This occurs before network and node reset methods. Input Sets use this hook. Functions with TimeOfEvaluation.InitializeRun will run after these plugins. Plugins will be executed in the following order:
    1. IAddProvenance plugins
    2. Plugins with type names alphabetically before ParameterSetManager (i.e. Scenario Input Sets)
    3. Input Sets
    4. Plugins with type names alphabetically after ParameterSetManager (i.e. Scenario Input Sets)
  3. IPluginRunStart: Called after Initialise, Scenario.Initialise, InputSets, network and node reset events. This is run after TimeOfEvaluation.InitializeRun but before TimeOfEvaluation.StartOfRun functions.
  4. IPluginBeforeStep: Called at the beginning of each time step but after TimeOfEvaluation.StartOfTimeStep functions
  5. IPluginAfterStep: Called at the end of each time step as the last thing executed (i.e. after subsystem post timesteps, after recorders and after TimeOfEvaluation.EndOfTimeStep
  6. IPluginRunEnd: Run at the very end of a run - only Finalize runs after this step. Run in the following order:
    1. IStoreProvenance
    2. IAddProvenance
    3. then by type name
  7. IPluginFinalise: Run in the following order:
    1. IStoreProvenance
    2. IAddProvenance
    3. then by type name

IPluginFinalise is really only used in the Provenance context. The idea is for plugins to create their provenance in the IPluginRunEnd step, then in the IPluginFinalise to write them out to disk.

Generally, plugins should use the IPluginRunEnd step unless you need specific dependent functionality like the provenance case.