smif.model.model module

Model abstract class

Summary

Data:

Model Abstract class represents the interface used to implement the model classes SectorModel and ScenarioModel.
ModelOperation Enumerate that describes the possible operations on Models
ScenarioModel Represents exogenous scenario data

Reference

class smif.model.model.ModelOperation[source]

Bases: enum.Enum

Enumerate that describes the possible operations on Models

BEFORE_MODEL_RUN = 'before_model_run'
SIMULATE = 'simulate'
class smif.model.model.Model(name)[source]

Bases: object

Abstract class represents the interface used to implement the model classes SectorModel and ScenarioModel.

Parameters:name (str) –
classmethod from_dict(config)[source]

Create object from dictionary serialisation

as_dict()[source]

Serialize the SectorModel object as a dictionary

Returns:
Return type:dict
inputs

All model inputs defined at this layer

Returns:dict of {input_name
Return type:smif.metadata.Spec}
parameters

Model parameters

Returns:dict of {parameter_name
Return type:smif.data_layer.data_array.DataArray}
add_input(spec)[source]

Add an input

Parameters:spec (smif.metadata.Spec) –
add_parameter(spec)[source]

Add a parameter

Parameters:spec (smif.metadata.Spec) –
outputs

All model outputs defined at this layer

Returns:dict of {output_name
Return type:smif.metadata.Spec}
add_output(spec)[source]

Add an output

Parameters:spec (smif.metadata.Spec) –
simulate(data)[source]

Override to implement the generation of model results

Generate results for timestep using data

Parameters:data (smif.data_layer.DataHandle) – Access state, parameter values, dependency inputs.
class smif.model.model.ScenarioModel(name)[source]

Bases: smif.model.model.Model

Represents exogenous scenario data

Parameters:name (str) – The name of this scenario (scenario set/abstract scenario/scenario group) - like sector model name
name

Name of this scenario

Type:str
scenario

Instance of scenario (concrete instance)

Type:str
classmethod from_dict(data)[source]

Create ScenarioModel from dict serialisation

as_dict()[source]

Serialise ScenarioModel to dict

simulate(data)[source]

No-op, as the data is assumed to be already available in the store