smif.model.sector_model module

This module acts as a bridge to the sector models from the controller

The SectorModel exposes several key methods for running wrapped sector models. To add a sector model to an instance of the framework, first implement SectorModel.

Key Functions

This class performs several key functions which ease the integration of sector models into the system-of-systems framework.

The user must implement the various abstract functions throughout the class to provide an interface to the sector model, which can be called upon by the framework. From the model’s perspective, SectorModel provides a bridge from the sector-specific problem representation to the general representation which allows reasoning across infrastructure systems.

The key functions include:

  • converting input/outputs to/from geographies/temporal resolutions
  • converting control vectors from the decision layer of the framework, to asset Interventions specific to the sector model
  • returning scalar/vector values to the framework to enable measurements of performance, particularly for the purposes of optimisation and rule-based approaches

Summary

Data:

SectorModel A representation of the sector model with inputs and outputs

Reference

class smif.model.sector_model.SectorModel(name)[source]

Bases: smif.model.model.Model

A representation of the sector model with inputs and outputs

Implement this class to enable integration of the wrapped simulation model into a system-of-system model.

Parameters:name (str) – The unique name of the sector model

Notes

Implement the various abstract functions throughout the class to provide an interface to the simulation model, which can then be called upon by the framework.

The key methods in the SectorModel class which must be overridden are:

An implementation may also override:

before_model_run(data)[source]

Implement this method to conduct pre-model run tasks

Parameters:data (smif.data_layer.DataHandle) – Access parameter values (before any model is run, no dependency input data or state is guaranteed to be available) Access decision/system state (i.e. initial_conditions)
simulate(data)[source]

Implement this method to run the model

Parameters:data (smif.data_layer.DataHandle) – Access state, parameter values, dependency inputs, results and interventions

Notes

See docs on DataHandle for details of how to access inputs, parameters and state and how to set results.

interval
should reference an id from the interval set corresponding to the output parameter, as specified in model configuration
region
should reference a region name from the region set corresponding to the output parameter, as specified in model configuration

To obtain simulation model data in this method, use the methods such as:

parameter_value = data.get_parameter('my_parameter_name')

Other useful methods are get_base_timestep_data(), get_previous_timestep_data(), get_parameter(), get_data(), get_parameters() and get_results().

get_state() returns a list of intervention dict for the current timestep get_current_interventions() returns a list of dict where each dict is an intervention