smif.modelrun module¶
The Model Run collects scenarios, timesteps, narratives, and model collection into a package which can be built and passed to the ModelRunner to run.
The ModelRunner is responsible for running a ModelRun, including passing in the correct data to the model between timesteps and calling to the DecisionManager to obtain decisions.
ModeRun has attributes: - id - description - sosmodel - timesteps - scenarios - narratives - strategy - status
Summary¶
Exceptions:
ModelRunError |
Raise when model run requirements are not satisfied |
Classes:
ModelRun |
Collects timesteps, scenarios , narratives and a SosModel together |
ModelRunBuilder |
Builds the ModelRun object from the configuration |
ModelRunner |
Runs a ModelRun |
Reference¶
-
class
smif.modelrun.
ModelRun
[source]¶ Bases:
object
Collects timesteps, scenarios , narratives and a SosModel together
-
name
¶ str – The unique name of the model run
-
timestamp
¶ datetime.datetime
– An ISO8601 compatible timestamp of model run creation time
-
description
¶ str – A friendly description of the model run
-
sos_model
¶ smif.model.sos_model.SosModel
– The contained SosModel
-
scenarios
¶ dict – For each scenario set, a mapping to a valid scenario within that set
-
narratives
¶ list – A list of
smif.parameters.Narrative
objects
-
strategies
¶ dict
-
status
¶ str
-
logger
¶ logging.Logger
-
results
¶ dict
-
as_dict
()[source]¶ Serialises
smif.modelrun.ModelRun
Returns a dictionary definition of a ModelRun which is equivalent to that required by
smif.modelrun.ModelRunBuilder
to construct a new model runReturns: Return type: dict
-
-
class
smif.modelrun.
ModelRunner
[source]¶ Bases:
object
Runs a ModelRun
-
solve_model
(model_run, store)[source]¶ Solve a ModelRun
This method first calls
smif.model.SosModel.before_model_run()
with parameter data, then steps through the model horizon, callingsmif.model.SosModel.simulate()
with parameter data at each timestep.Parameters: model_run ( smif.modelrun.ModelRun
) –
-