Skip to content

use_cases

Tom Russell edited this page Feb 11, 2019 · 52 revisions

Use Cases

See - Actors for a list of actors

Contents

^Top

Run

Use Case 1 : 🏠 Run an Analysis ☁️

Primary Actor: Modeller

Level: Enterprise

Main Success Scenario:

  1. Actor manages data
  2. Actor manages infrastructure sector models
  3. Actor manages system-of-systems models
  4. Actor manages model runs
  5. Some time later, Actor performs a model run
  6. Actor analyses results

^Top

Data

Use Case 2: ⬛ Manage Data ☁️

Primary Actor: Modeller

Level: System

Main Success Scenario:

  1. Actor Manages Scenario Sets
  2. Actor Manages Narrative Sets
  3. Actor Manages Spatial dimensions
  4. Actor Manages Temporal dimensions

^Top

Scenarios

A Scenario is a source of data which is used to manage uncertainties beyond the control of a decision maker. For all practical purposes, models treat scenarios as a source of model input values. As with other data sources, scenarios have a spatial and temporal resolution.

A Scenario Set is a collection of scenarios of the same type with the same facets. When configuring a SosModel, free inputs to a model will be associated with a Scenario Set, deferring the choice of scenario to the definition of the Model Run.

Usage Narrative: Adding a new scenario

Chris has a set of electricity demand data for different anticipated usage scenarios. He defines a new Scenario Set using the Scenario manager and names it electricity demand. Within the 'electricity demand' Scenario Set he creates a new Scenario for each anticipated scenario and names them electricity demand (low), electricity demand (med) and electricity demand (high). He adds a facet to the first scenario and notes that the same facet pops up at all other scenarios. He completes the entries for each scenario, by uploading the associated data sets and makes sure that the spatial, temporal resolutions and units are set right.

Use Case 3: Manage Scenario Sets

Actor: Data Guru

Main Success Scenario:

  1. Actor navigates to the data management page
  2. «system» displays list of existing Scenario Sets
  3. Actor creates a new scenario set and gives it a unique name and description
  4. Actor manages scenarios
  5. «system» writes changes to «store»

Alternative Flows:

3 a. Actor edits an existing Scenario Set

  1. Actor selects existing scenario from the list
  2. Actor amends attributes
  3. Actor save changes
  4. «system» write changes to store

3 b. Actor deletes an existing Scenario Set

  1. Actor clicks delete button on existing scenario set from the list
  2. «system» asks for a confirmation
  3. Actor confirms delete
  4. «system» write changes to store

Use Case 4: Manage Scenarios

Actor: Modeller

Scenario:

  1. «system» displays list of existing scenarios
  2. Actor creates a new scenario
  3. Actor adds facet to scenario
  4. «system» adds same facet to all existing scenarios
  5. Actor selects a flat file containing value, locational and time data
  6. Actor selects relevant metadata including appropriate spatial and temporal resolutions
  7. «system» reads in data and writes to «store»

Alternative Flows:

2 a. Actor edits an existing scenario

  1. Actor selects existing scenario from the list
  2. Actor amends attributes
  3. Actor save changes
  4. «system» write changes to store

2 b. Actor deletes an existing scenario

  1. Actor clicks delete button on existing scenario from the list
  2. «system» asks for a confirmation
  3. Actor confirms delete
  4. Actor saves scenario set
  5. «system» write changes to store

3 b. Actor removes a facet from a Scenario

  1. Actor clicks delete button on existing facet from the list
  2. «system» asks for a confirmation
  3. Actor confirms delete
  4. «system» removes faces from all scenarios within the set
  5. Actor save changes to scenario set
  6. «system» write changes to store

^Top

Narratives

Narratives provide a mechanism that allows users access to individual model parameters across a system-of-systems model in an organised manner. Narratives are held centrally and make visible the key model assumptions which can override the default values for model parameters. (Note that the only difference of model parameters from model inputs is that the data are provided by a user, and not by another model via a dependency).

By defining a new narrative variant, users can define one or more narrative policies that override the default values of the model parameters. These data are stored in a sparse manner, where only those entries that are present override the defaults.

Within a modelrun, where multiple narratives contain the same parameters, narratives are ordered into a hierarchy by the user to indicate which assumptions should take precedence.

User Narrative: Composing a Narrative for a SosModel

Freddy is conducting a system of systems analysis of energy and digital communications sectors. He has already configured two models of energy and digital systems and has defined a number of model parameters for each of the models.

Freddy wants to explore possible futures using these coupled models under high and low technological change in these sectors. He creates a 'technological change' narrative for his system-of-system model called 'SimEnergyDigital'. The narrative form shows the available parameters from each of the energy and digital comms models, and he picks from the list to choose only those relevant under the heading of 'technological change'. These include parameters for cost, efficiencies and also a behavioural parameter governing the rate of consumer adoption of new technology. He then creates two narrative variants titled "high tech" and "low tech". Freddy now fills in values for the parameters he wishes to override.

Freddy can now define and run modelruns that include either his "high tech" or "low tech" narratives. The assumptions included in these narratives pass through to each of the simulation models within the system-of-system model at run time. The narratives provide a handy mechanism that enable Freddy to organise his analysis of the system-of-systems model of energy and digital communications.

User Narrative: Composing a Narrative for a SosModel with global parameters

Freddy has now extended both his energy and digital models to include financial reporting. The models both require a discount rate parameter to be defined, and this should only be defined once at the SosModel level.

Freddy navigates to his SosModel and clicks clicks "Add New Global Parameter". He is greeted with the same "Add Parameter" form seen on the Sector Model page, so fills in the name "discount rate" and other metadata, attaching the data file.

Now, instead of attaching a file to his narrative variant definition, he can choose the global parameter defined within his SosModel.

Use Case 5: Compose Narrative

Actor: Modeller

Main Success Scenario:

  1. Actor navigates to narratives page
  2. «system» displays list of existing Narratives ('Governance')
  3. Actor creates a new narrative and gives it a unique name and description (e.g. 'Technological Change')
  4. Actor adds a system-of-systems model to the narrative
  5. «system» displays list if all parameters contained within the simulation models
  6. Actor adds one or more parameters from the parameter list to narrative
  7. Actor adds one or more variants ('high tech', 'low tech')
  8. Actor links to data file for each of the parameters for each of the variants
  9. «system» writes changes to «store»

Alternative Flows:

3 a. Actor edits an existing Narrative

  1. Actor selects existing Narrative from the list
  2. Actor amends attributes
  3. Actor save changes
  4. «system» write changes to «store»

3 b. Actor deletes an existing Narrative

  1. Actor selects existing Narrative from the list
  2. «system» requests delete confirmation
  3. «system» write changes to «store»

Use Case 6: Manage Narrative Variants

Actor: Modeller

Main Success Scenario:

  1. «system» displays list of existing narrative variants
  2. Actor creates a new narrative variant
  3. Actor Configure Narrative Files
  4. «system» writes to «store»

Alternative Flows:

2 a. Actor edits an existing narrative variant

  1. Actor selects existing narrative variant from the list
  2. Actor amends attributes
  3. Actor save changes
  4. «system» write changes to «store»

2 b. Actor deletes an existing narrative variant

  1. Actor selects existing narrative variant from the list
  2. «system» requests confirmation
  3. «system» write changes to «store»

Use Case 7: Configure Narrative Files

Actor: Modeller

Main Success Scenario:

  1. «system» displays existing narrative files
  2. Actor creates a new narrative file
  3. Actor enters new values for parameters

^Top

Dimensions

Use Case 8: Manage dimensions

Primary Actor: Modeller

Main Success Scenario:

  1. «system» displays list of dimensions
  2. Actor creates new dimension
  3. Actor enters unique name, selects type (temporal or spatial) and enters path to the data file
  4. «system» validates and writes dimension to «store»

Alternative Flows:

2 a. Edit existing dimension

  1. Actor selects existing dimension
  2. Actor edits attributes
  3. «system» validates and writes changes to «store»

2 b. Delete existing dimension

  1. Actor selects existing dimension
  2. «system» confirms deletion action
  3. «system» writes changes to «store»

^Top

Defining Interventions

An Intervention is a possible action which has a name, a number of required attributes, including capital cost, economic_lifetime, capacity and operational_life, other attributes and location, but no build date.

Interventions are intrinsically linked to sector models in that they correspond to one, and only one simulation model.

Interventions are collected into a package so that the Decision Manager can choose which to perform, where and when. An Intervention is the smallest divisible unit of a decision within the framework.

Use Case 9: Manage Interventions

Primary Actor: Modeller

Main Success Scenario:

  1. Actor navigates to the intervention manager screen
  2. «system» displays list of existing interventions
  3. Actor adds new interventions with required attributes, suggested attributes and/or custom attributes
  4. Actor saves intervention
  5. «system» saves intervention to the «store»

Alternative Flows:

3 a. Import interventions from a yaml file

  1. Actor clicks "import interventions" button, dialogue asks Actor to select a file, (dialogue filters to *.yaml, *.yml files).
  2. Actor selects one or more yaml files and clicks "import" button. Dialogue box closes.
  3. Interventions are imported and appear in intervention list.

3 b. Edit an existing intervention

  1. Actor selects the intervention to edit
  2. «system» retrieves intervention from store
  3. Actor makes changes
  4. «system» writes changes to «store»

3 c. Delete an existing intervention

  1. Actor selects the intervention to delete
  2. «system» requests confirmation
  3. «system» writes changes to «store»

Extentions:

3 a. One or more interventions already exist in list

  1. «system» displays list of duplicate interventions.
  2. Actor chooses duplicate from the list to retain

^Top

Configuring Models

Usage Narrative: Configuring an energy supply model

Harpreet is an energy modeller who wishes to couple the energy supply simulation model she is developing with an existing water supply model. She wants to investigate the resilience of the electricity system to constraints on water abstractions during drought events. Harpreet has written a wrapper for her model executable using the smif.SectorModel class and identified one key input to the model (electricity_demand) and two key outputs (water_demand, unmet_demand). Harpreet also writes a spatial and a temporal dimension file which apply to all inputs and outputs.

Harpreet logs onto the «system» and navigates to her project. She chooses to create a new model configuration, which she names es_resilience. She then directs the system to her wrapper file, registers the spatial and temporal resolutions with the gazateer and uploads the data. She then adds the inputs and outputs, associating each of them with the spatial and temporal resolutions registered previously. She checks the visual representation of her model configuration and notes the one input and two outputs detailed on the diagram. Hovering her mouse over, she can view the meta-data associated with the input and outputs. She adds some notes to her configuration, and sets the model version to match that of the model from her version control system.

Open Questions

  • How do we manage simulation model versions from the interface?
  • Should we use a composite type approach, where a SosModel is a model, a SectorModel is a model and a SosModel comprises of a collection of models? In this situation, a scenario would also be a subclass of Model, with one ModelOutput deferring the actual data loaded to runtime (and specified in the model run).

Use Case 10: ⬛ Manage sector models 🌊

Primary Actor: Modeller

Level: User Goal

Description:

Each of the sector models needs to be configured so that it can be run by smif. Models are wrapped using the SectorModel class which exposes initialise and simulate methods. Models have inputs, outputs and parameters, each of which have associated dimensions.

Main Success Scenario:

  1. Actor navigates to simulation model configuration interface page
  2. «system» displays a list of existing simulation model configurations
  3. Actor adds a new simulation model configuration
  4. Actor enters unique model name and the path to the model wrapper (to execute the model)
  5. «system» displays list of classnames in model wrapper
  6. Actor chooses the classname from list
  7. Actor Manages Inputs/Outputs
  8. Actor Manages Interventions
  9. Actor Manages Parameter Configurations
  10. Actor saves simulation model configuration
  11. «system» saves configuration to «store»
  12. «system» returns focus to scetor model list page now displaying added sector model configuration

Alternative Flows:

3 a. Edit an existing simulation model configuration

  1. Actor views the list of model configurations
  2. Actor selects model configuration to edit
  3. «system» requests configuration data from «store»
  4. "Edit model configuration" form is displayed with entries for various attributes.
  5. Actor edits the entries and saves changes
  6. «system» saves changes to «store»

3 b. Delete an existing simulation model configuration

  1. Actor views the list of model configurations
  2. Actor selects model configuration to delete
  3. «system» requests confirmation of deletion
  4. Actor confirms deletion
  5. «system» saves changes to «store»

5 a. «system» cannot import model wrapper (compile error)

  1. Error reported back to Actor
  2. Return to step 2.

Extensions:

2 a. No model configurations exist

  1. «system» displays message saying that there are no existing configurations

8 a. store connection error

  1. Resolve connection problems

^Top

Use Case 15: Manage Inputs/Outputs

Primary Actor: Modeller

Supporting Actors:

Main Success Scenario:

  1. «system» displays list of sector model inputs and outputs
  2. Actor adds new input or output, choosing from list of spatial and temporal resolutions, and units, name and description
  3. Actor saves input/output, «system displays list of sector model inputs»

Extensions:

2 a. Spatial/temporal resolution or unit not defined.

  1. «system» directs Actor to add spatial/temporal resoltions prior to trying to add input to sector model
  2. «system» allows partial save of sector model

^Top

Wrapping a Simulation Model

Use Case: ⬜️ Implement Before_Run Method 🌊

Primary Actor: Modeller

Supporting Actors: ScenarioModel

Main Success Scenario:

Use Case: ⬜️ Implement Initialise Method 🌊

Primary Actor: Modeller

Supporting Actors: ScenarioModel

Main Success Scenario:

Use Case: ⬜️ Implement Simulation Method 🌊

The modeller implements the simulation method of the ScenarioModel class so that the wrapped simulation model can be run by smif. The implementation must receive parameter and scenario data passed into it for each timestep, and return results from the simulation model.

Primary Actor: Modeller

Supporting Actors: ScenarioModel

Main Success Scenario:

Use Case: 🔩 Request Data 🐟

At runtime a simulation model needs access to simulation parameters, scenario data and data output by other models.

A SectorModel makes requests to the data layer using a friendly API.

In one ModelRun a SectorModel might get its data from scenario data (e.g. 'High Population projection'), in another ModelRun that might be the output of a demographics model which runs each timestep too. These details are hidden from the SectorModel by the DataHandle.

The containing CompositeModel (a SosModel or ModelSet) has responsibility for creating (or adapting) a DataHandle with the correct ModelRun name, current timestep, timesteps, ModelSet iteration.

Where a ModelRun or ModelRunner simulates multiple options for decisions, it is responsible for creating (or adapting) a DataHandle specialised for a given decision iteration.

For example, within SectorModel.simulate(), we can call:

data_handle.get_data('population')
data_handle.get_base_timestep_data('road_trips')
data_handle.get_previous_timestep_data('dynamic_model_output')
data_handle.get_parameter('travel_cost_coefficient_alpha')

which will return the correct data or parameters, whatever the data source and indifferently to whether the parameters are local or global, default or overridden by a Narrative.

Primary Actor: SectorModel

Supporting Actors: DataHandle, SosModel, ModelSet

Main Success Scenario:

  1. SectorModel gains access to required data for the relevant modelrun (and for any sub-tasks within the modelrun such as iterations while solving decision algorithms or dependency loops).

Use Case: 🔩 Return Results 🐟

At runtime a simulation model needs to write out or return results.

A SectorModel makes requests to the data layer using the friendly DataHandle API. As with Request Data above, the containing CompositeModel or ModelRunner has responsibility for creating or adapting a DataHandle which will access the correct subset of data.

For example, within SectorModel.simulate(), we can call:

data_handle.set_results('population', data)

Primary Actor: SectorModel

Supporting Actors: DataHandle, SosModel, ModelSet

Main Success Scenario:

  1. SectorModel writes its results so that they are available to containing processes and other SectorModels.

Use Case: 🔩 Access Results 🐟

At runtime a containing process (e.g. ModelRunner, ModelSet or SosModel) needs to access the outputs from its contained models.

At test time or in an interactive session (notebook. REPL) it is also convenient to have straightforward access to results.

As with Request Data and Return Results, the details of accessing model results should be hidden behind the DataHandle API.

For example, within ModelSet.simulate(), we could call:

data_handle.get_results('population', model_name='demographics', modelset_iteration=10)
data_handle.get_results('population', model_name='demographics', modelset_iteration=11)
data_handle.get_results('population', model_name='demographics', modelset_iteration=12)

in order to then test whether a model's results are converging.

Primary Actor: ModelSet

Supporting Actors: DataHandle

Main Success Scenario:

  1. A ModelSet accesses results computed by any of the SectorModels which it contains.

^Top

Model Parameters

Usage Narrative: Adding Model Parameter Configurations

Gerald wishes to expose several of the energy demand model parameters to those who will use his model. There are two key model parameters he wishes to add today, smart meter energy savings and technology uptake which needs to be specified for each end-use and technology.

Gerald logs onto the system and navigates to the energy demand model configuration. He navigates to the model parameter list, and adds a new parameter.

The first parameter, smart meter energy savings is a floating point number, with a suggested range from the literature of between 3%-10%. He adds the unique name smart meter energy savings, a helpful description of what this parameter does, the type (float), an absolute range [0, 1] and a suggested range [0.03-0.1], a default value of 0.03 and % for the units attribute.

Gerald adds another new parameter with the name technology uptake %%tech%% %%end-use%%. First, Gerald defines the two dimensions over which the technology uptake parameter will be expanded. He adds the set tech contains a list of three technologies [washing machine, dishwasher, incandescent lighting, LED lighting] and the set end-use contains [wet, lighting] to the parameter configuration. He then appends the default values of the parameter attributes to the parameter, including range: [0, 1], type: float, description: "Technology uptake for %%tech%% for end-use %%end-use%%". After saving the parameters are visible for each of the tech and end-use combinations e.g.

name: technology uptake washing machine wet
range: [0, 1]
type: float
description: "Technology uptake for washing machine for end-use wet"

^Top

Use Case 11: Manage Parameter Configurations

Description

Defining a model parameter is a special case of defining a model input or output. Model parameters may have one or more dimensions, have a default value, a unit, may require exhaustive definition, and have a data type.

Examples include::

technology uptake - the proportion of an enduse within a sector which is
serviced by a technology at a year, (the intermediate values are interpolated
in the model)

vehicle fleet composition - the proportion of engine types within a vehicle
type category for each year

One implementation could be:

An inputs.yaml file::

inputs:
  name: technology_uptake
  dimensions:
  - year
  - end-use
  - sector
  - technology
  default value: 0
  ranges: (0,1)
  dtype: float
  constraints: 'sum over technologies supplying end-use - sector sum == 1'
  unit: '%'
dimensions:
  year:
  - 2010
  - 2020
  - 2030
  - 2040
  sector:
  - residential
  technology:
  - washing machine
  - dishwasher
  - incandescent lighting
  - LED lighting
  end-use:
  - wet
  - lighting

A data_file for each input:

technology_uptake.csv

year,end-use,sector,technology,value
2010,wet,residential,washing machine,0.35

Primary Actor: Modeller

Main Success Scenario

  1. «system» displays list of model parameters
  2. Actor creates new parameter configuration with a unique (to the simulation model) name, plus attributes including description, range, suggested range, dimension, type (float, int, bool)
  3. Default data is added separately after definition of the parameter metadata
  4. «system» validates changes and writes parameter configuration to «store»

Alternative Flows:

2 a. Edit an existing parameter

  1. Actor selects a parameter to edit from the list
  2. Actor amends parameter attributes
  3. «system» validates changes and writes changes to «store»

2 b. Delete an existing parameter

  1. Actor selects parameter to delete
  2. «system» requests confirmation of deletion
  3. «system» saves changes to «store»

Extensions:

1 a. No parameters exist yet

  1. «system» prompts Actor to create a new parameter configuration

2 a. Parameter fails validation checks e.g. default value not in range

  1. «system» prompts Actor to amend parameter attributes

Configure a System-of-system Model (SosModel)

A SosModel is a collection of sector models with a requirement for data input.

Usage Narrative: Configuring a water energy resilience system of systems model

Chris, Harpreet's colleague, has finished work on the water supply model, and has already configured it using the «system». He's now ready to define a new system-of-systems model (SosModel), which will couple the two sector models together.

Chris logs into the «system» and selects the water-energy-resilience project. He navigates to the SosModel configuration page and follows the instructions shown as this is the first time he's configured a SosModel. The instructions direct him to create a new SosModel configuration. Presented with a list of previously defined sector models, he selects the energy model which was configured by his colleague Harpreet called es_resilience. He reviews the notes and description associated with the energy model and scans them for any particular issues Harpreet identified. He then selects his water model and confirms the additions to his SosModel project.

Now two models exist in the SosModel configuration, Chris needs to link the model input and outputs to one another to define dependencies. The «system» displays a visual representation of the models inputs and outputs. He connects the water_demand output from energy model to the water_demand input of the water supply model. A «system» warning notifies Chris that he has connected inputs and outputs with a different spatio-temporal resolution. Luckily, Chris is prepared, and has written a function to cope with this which he wishes to use instead of the default assumption of area weighting. He selects the function and adds it to the configuration. Chris now selects the remaining input to the energy model, electricity demand, and categorises its source as a scenario input. Then, he selects the rainfall input to the water supply model and categorises its source as a scenario input. This will allow him to select multiple different scenarios when running this SosModel i.e. defer the selection of the model inputs to the definition of the model run.

Chris saves the SosModel configuration and goes for a cup of tea.

Use Case 12: ⬛ Manage SosModels 🌊

Actor: Modeller

Scenario:

  1. Actor navigates to SosModel configuration
  2. «system» shows list of existing SosModel configurations
  3. Actor creates a new SosModel
  4. «system» displays a list of available simulation model configurations
  5. Actor selects one or more sector models from list
  6. Actor manages sector models as required
  7. «system» provides list of the aggregate model inputs required and the model outputs produced by the collection of sector models
  8. Actor manages dependencies
  9. «system» computes the running order of the models suggested by the graph of dependencies and indicates where iteration will be necessary
  10. When happy with the collection of sector models in the SosModel, the defined dependencies, the running order, and the remaining inputs and outputs, the Actor saves the configuration
  11. «system» validates SosModel configuration
  12. The focus returns to the list of existing SosModel configurations, now displaying the newly created SosModel

Extensions:

4 a. There are no existing simulation model configurations

  1. «system» asks Actor to add a new SosModel configuration

4 b. The required simulatiom model configuration does not exist

  1. «system» asks Actor to add a new SosModel configuration

7 None of the simulation model configurations have inputs or outputs

  1. Edge case - no use for smif in this situation. Simulation model configurations are invalid

10 Running order is infeasible

  1. Raise an error and return to linking of inputs and outputs step

13 store connection fails and unable to save configuration

  1. Save configuration locally to text file

Alternative Flows:

3 a. Edit an existing SosModel

  1. Actor selects SosModel to edit
  2. «system» retrieves SosModel configuration
  3. Actor edits SosModel configuration and saves changes
  4. «system» writes changes to «store»

3 b. Copy an existing SosModel

  1. Actor selects SosModel to copy
  2. «system» duplicates SosModel configuration and requests unique name
  3. Actor enters unique name for new SosModel
  4. «system» writes changes to «store»

3 c. Delete an existing SosModel

  1. Actor views the list of SosModel configurations
  2. Actor selects SosModel to delete
  3. «system» requests confirmation of deletion
  4. Actor confirms deletion
  5. «system» saves changes to «store»

^Top

Use Case: Manage Dependencies

Main Success Scenario:

  1. «system» displays lists of model outputs and inputs and spatio-temporal resolutions for current SosModel
  2. Actor adds dependency by choosing a pair of inputs and outputs between two models
  3. Actor defines custom spatio-temporal conversion functions along each of the dependencies, or accepts the default assumption of area weighting

Configure Model Runs

Usage Narrative: Configuring a Model Run to study energy water resilience

Harpreet and Chris now wish to conduct a number of model runs using their combined energy and water system-of-systems model. They start by defining a reference scenario model run. Harpreet navigates to the model run configuration page, and observes the empty list of model runs. Clicking on the 'New Model Run' button, she enters a description of the model run, and selects the SosModel configuration es_resilience from a list. A visual graphic representing the SosModel pops up showing the inputs rainfall and electricity demand and the outputs unmet demand. The unmet demand parameter is automatically linked to a results node. The rainfall and electricity demand are unlinked. Harpreet selects the rainfall sub-category of climate scenario central case from a series of drop down menus, and rainfall appears as a data source on the visualisation. She drags a link between the two rainfall nodes to link them, accepting the default area-weighting for spatio-temporal conversion. She then selects the electricity demand data source from the New Data Source menu and links that to the electricity demand node.

Use Case 13: ⬜ Manage Model Runs 🌊

Description:

The Model Run collects scenarios, timesteps, narratives, and system-of-system models into a package which can be deployed and run.

Once a Model Run has been performed (simulated) successfully, then the configuration is locked to maintain data provenance. Model Runs can only be duplicated, edited and rerun.

Trigger:

Actor chooses to create a new model run

Primary Actor: Modeller

Supporting Actors: store

Main Success Scenario:

  1. Actor navigates to the model run screen
  2. «system» displays a list of model runs
  3. Actor creates a new model run, entering a unique name, and choosing a SosModel from the list of available SosModel
  4. Actor chooses from a list of time steps which define the years for which the model will run
  5. For all inputs to the SosModel which do not match to a data source (either an external data source or another model output), «system» displays a warning
  6. For each Narrative, Actor chooses a Variant
  7. For each Scenario, Actor choose a Variant
  8. For each model input: Actor provides data for model input
  9. Actor saves the model run configuration
  10. «system» saves new configuration to the «store»
  11. «system» adds displays configuration name and summary metadata in the Model Run list

Extensions

  1. No SosModel definitions have been configured

    1. Configure a SosModel

Alternative Flows:

2 a. Configure a new model run from an existing model run

  1. Actor creates a new Model Run, checking a tick box indicating that she wishes to copy an existing Model Run
  2. «system» notifies Actor to choose an existing Model Run
  3. Actor selects from a list of model run configurations
  4. New model run is created on «system»
  5. «system» notifies Actor to enter a unique name for the model run
  6. Actor is able to edit the configuration and save/cancel the changes.
  7. «system» tags the model run with a warning symbol if it appears to duplicate an existing model run (nothing is different from the parent model run).

2 b. Copy an existing Model Run

2 c. Delete an existing Model Run

2 d. Edit an existing Model Run. Only non-running

Use Case: ⬜ Provide data for model input 🌊

Scope:

Within a Model Run definition, any free-hanging model inputs in the chosen SosModel must be linked to scenario data

Primary Actor: Modeller

Main Success Scenario:

  1. Actor chooses to add scenario data for the model input.
  2. «system» displays list of available scenarios within the scenario set defined wihtin the sector model definition.
  3. Actor selects one of the scenarios

Extensions:

  1. No scenarios have been defined

    1. «system» asks Actor to define scenario data sources

^Top

Run a Model Run

Usage Narrative: Running a Model Run to study energy water resilience

After finishing the configuration of the model run, Harpreet navigates to the Model Run list, and scans through the list. She filters by model run status, to show only runs with the status Ready. She selects the model run, and clicks Submit Model Run. The system responds informing her that the run has been submitted to the job queue

Use Case 6: ⬛ Perform Concurrent Model Run 🌊

Primary Actor: Modeller

Supporting Actors: store

Main Success Scenario:

  1. Actor selects a model run
  2. Actor submits run for simulation
  3. «system» locks and deploys model run
  4. «system» notifies Actor that model run has been submitted
  5. «system» creates results entry for model run
  6. «system» notifies Actor of successful completion
  7. «system» populates results entry with data from «store»

Extentions:

3 a. Model run fails 3 b. Model is infeasible (optimisation)

Use Case: 🔩 Deploy Model Run 🕊️

Description:

  • PlanningHorizon is a parameter of the ModelRun
  • Behaviour of Decision Manager is a function of PlanningHorizon and DecisionModule type (planning/rules/optimisation)

Primary Actor: ModelRun

Supporting Actors: ModelRunner

Main Success Scenario:

  1. Actor builds SosModel object adding SectorModels and Dependencies
  2. Actor creates instance of ModelRunner and passes SosModel object to ModelRunner
  3. ModelRunner Run the SosModel and returns results
  4. «system» saves results to store

Use Case: 🔩 Run the SosModel 🌊

Primary Actor: ModelRunner

Main Success Scenario:

  1. Actor receives the run order from ModelRun along with SosModel, ModelHorizon and DecisionManager
  2. While the DecisionManager is not yet satisfied:
  3. Actor runs decision models, awaiting decisions
  4. Actor runs simulation models, awaiting results

Use Case: 🔩 Run Decision Models 🐟

Primary Actor: ModelRunner

Supporting Actors: DecisionManager

Main Success Scenario:

  1. Actor creates a JobGraph of decision models from the DecisionManager
  2. Actor submits JobGraph to JobScheduler
  3. Actor awaits JobGraph completion

Use Case: 🔩 Run Simulation Models 🐟

Primary Actor: ModelRunner

Supporting Actors: SosModel

Main Success Scenario:

  1. Actor creates a JobGraph of simulation models from the SosModel
  2. Actor submits JobGraph to JobScheduler
  3. Actor awaits JobGraph completion

Use Case: 🔩 Run Model for timestep in context 🐟

Primary Actor: Model

Supporting Actors: JobScheduler

Main Success Scenario

  1. JobScheduler (perhaps interfacing with other systems) eventually triggers 'run' to execute a model, in the context of a given model run (hence scenarios/parameters/other models), timestep and decision iteration, with a given shared store available for input, data and results.
  2. JobScheduler writes contextual information to a context.properties file
  3. JobScheduler starts Model process with environment variable and/or command line argument pointing to context.properties
  4. Model constructs DataHandle or uses its own approach to data-access, initialises itself, runs, writes results.

Alternative Scenario

  1. JobScheduler posts context and run-instruction to model server.
  2. Model server instantiates a model run and runs, etc., writes results.

^Top

Analyse Model Results

Usage Narrative: Analysing Results

Harpreet returns to the Model Run screen and filters on Successful status. No model run appears, as her run has not yet finished. She removes the filter and sorts by Submission Time and finds her Model Run at the top of the list. She selects it and tries to click View Results, but the button is greyed out.

Later, Harpreet returns to the Model Run screen and filters on Successful status. He model run appears at the top of the list. She selects it and clicks View Results. The black results dashboard is displayed with space where a range of useful metrics could be shown. She configures the dashboard with a number of useful result widgets, so that she can ensure at a glance that the model is performing as it should.

Use Case 7: View model run results

Actor: Modeller

Scenario:

  1. Actor navigates to results viewer
  2. «system» displays list of completed model runs with linked results
  3. Actor selects model run
  4. «system» displays model results

Use Case 8: Compare the result model runs

Actor: Analyst

Scenario:

  1. Actor navigates to bundle viewer
  2. «system» displays list of bundles
  3. Actor Manage bundles
  4. Actor selects a bundle
  5. «system» retrieves bundle from «store» and displays results comparison

Extentions:

4 a. Bundle contains model runs with no results

  1. «system» shows results of only model runs with results and warning for others

5 a. Model run results are identical

  1. «system» displays warning that results difference cannot be shown as results are identical

Use Case 8b: Manage Bundles

Description

A bundle is a collection of model runs within a project which enables results comparison of one or more model runs.

Actor: Analyst

Main Success Scenario:

  1. Actor navigates to bundle viewer
  2. «system» displays list of existing bundles
  3. Actor creates new bundle
  4. «system» displays list of model runs of all statuses
  5. Actor selects one or more model runs to add to bundle
  6. «system» saves bundle to «store»

Use Case 9: View results for a recent model run

Actor: Modeller

Precondition:

Actor is on the model run page and a successfully completed model run exists in the model run list

Scenario:

  1. «system» displays list of model runs
  2. Actor selects completed model run in the list of model runs
  3. «system» displays results dashboard for model run

^Top

Decisions

The choice of decision mechanism changes the manner in which the model is run. For example, with pre-specified planning, the model state is pre-specified and the simulation can run straight through (could be parallelised along years if no state is passed from year to year).

With the rule-based approach, decision iterations are required until the rule thresholds pass successfully. Previous timesteps need to complete before moving to the next timestep.

With the MOEA approach, each decision iteration contains an entire pre-specified pathway over all timesteps in the model horizon which can be simulated in parallel. Bundles of decision iterations make up a generation, and new generations are generated upon completion of each bundle.

User Narrative: Pre-Specified Planning

Carol defines a pre-specified planning pipeline by choosing combinations of interventions, locations and build-years according to the pool of available interventions and constraints imposed by the governance, technology and behavioural narratives.

Carol begins the model run. The model runner initalises the ModelRun and timesteps which builds the SosModel and contained objects. The ModelRunner also initialises the DecisionManager, which references the sector-specific planning pipeline as its sole strategy and sets the decision_iteration to 0. The ModelRunner calls the SosModel simulate method for the first year contained in the decision_iteration (note that a decision iteration can hold between 1 and H planning timesteps, where H is the length/cardinality of the set of time intervals). For each set in the list of ModelSets: for each model in the set: the sector model obtains the current state of the system by calling the DecisionManager.get_state() method

Initial conditions are the list of cumulative interventions that make up the structure of the infrastructure networks contained within the SectorModel.

Each decision iteration represents one route through the decision space.

The DataHandle provides a get_decisions() method, which returns the list of interventions for the current planning timestep.

User Narrative: Rule-Based Approach

Derek defines a series of business rules in the rule-based decision layer which represent how the solid waste sector performs its regulatory duties. He does this by linking the value of model outputs with conditions and defining actions to be taken when those conditions are not met.

He starts up the model run. The model runner configures the decision manager with the rule-based algorithm. The algorithm compiles the rules, runs the SosModel simulation (which includes the solid waste model) for the first time period in a first iteration. A high 'emissions' model output causes one of the rule conditions to fail, and the algorithm chooses one intervetion from a set of interventions as the action. The algorithm reruns for a second iteration and the new action corrects the path of the model. Now all the conditions are met, the model completes successfully, and the sequence of decisions is returned to the model runner.

While the model is running, Derek observes the log which details the actions which are triggered by the model outputs and the performance of the model.

User Narrative: Optimisation

Jenny sets up her model-run with an optimisation algorithm which chooses decisions according to the criteria of least cost. The planning window is set to the default value, which is the same length as the model horizon. She sets the model running. The algorithm runs a number of iterations until it arrives at the lowest cost.

In each iteration, the algorithm selects, for each timestep in the horizon, a number of interventions from the list of available interventions and runs the simulation on the SosModel.

After each run of the SosModel, the algorithm now receives results of the simulation and assesses whether it should continue exploring the decision space or exploit the current best available decision.

Jenny views the progress of the algorithm via the logs, which detail the time, interventions and model results for each iteration and timestep the algorithm visited.

Once the algorithm terminates, it returns the sequence of interventions in each timestep that meet the objective function and constraints.

Use Narrative: Optimisation with Myopic Planning

Jenny modifies her optimisation algorithm to try to represent the short-term decision horizon in the water supply sector. She sets the planning window to 10 years, meaning that in each timestep, the algorithm only looks 10 years ahead when assessing whether the current decision is optimal, all other information is disregarded. This results in the creation of a sub-problem with a horizon of 10 years rather than the entire model horizon. The algorithm iterates over this sub-problem until it finds an optimal solution, fixes the decisions in the initial timestep, and then moves to the next timestep whereupon the process begins again.

User Narrative: Multi-Objective Optimisation with an Evolutionary Algorithm

Fred wishes to explore the trade-offs between three objectives, cost, resilience and carbon emissions (the trilemma). He develops a multi-objective evolutionary algorithm which finds a pareto optimal set of decision options. In each iteration, called a generation, the algorithm evaluates a number of candidate decision options individuals, which denote which interventions are made when and where. In a typical analysis, the algorithm is run for 250 generations, where each generation contains 100 individuals. Given a time horizon of 50 years with 10 time steps of 5 years, this require 10 * 100 * 250 = 250,000 executions of the system-of-systems model.

The algorithm views the decisions available to the system-of-systems model as a binary array. This array is permuted with the population of individuals within a generation over generations. Each individual represents a different combination of the available decisions. The decision module is responsible for providing the algorithm with an interface to the system-of-systems model. The decision module accumulates the available interventions from each of the simulation models in the system-of-systems model and presents them two the algorithm as a binary array. For each individual combination chosen by the algorithm, the decision module then converts the binary array back into interventions which are passed to the simulation models at runtime. The decision module then passes back the objective values for the three objectives cost, resilience and carbon emissions.

Use Case: Planning Window

Description

Interventions are chosen in each timestep in a Planning View. Interventions are only persisted for the first timestep in the Planning View.

The set of Planning Views is a deterministic function of the model horizon and the planning window. If the planning window does not cover the model horizon, on each iteration, the algorithm moves to the PlanningView which begins with the next timestep and continues until the whole model horizon has been covered. The system state is copied from the end of the previous timestep.

An Iteration is a single pass through the timesteps in a planning view.

PreCondition:

Modeller sets PlanningWindow parameter to 1

Main Success Scenario

  1. ModelRunner requests PlanningView for SosModel configuration
  2. PlanningView returns decision epochs (set of timesteps for which to make decisions) for first year
  3. ModelRunner creates new Iteration with current year and planning view.
  4. ModelRunner sends iteration to decision manager with a request for decisions.
  5. Decision Manager adds decisions to Iteration.
  6. ModelRunner performs Iteration by sending decisions to SosModel with simulate command.
  7. SosModel sends ModelRunner results.
  8. ModelRunner attaches results to Iteration

Extensions

1 a. Planning Window is 1 < x < ModelHorizon

  1. In each timestep, decisions are chosen for the current timestep, and then each timestep in the PlanningView is performed to assess performance. Algorithm then moves to the next timestep. 1 b. Planning Window is set to 0 (don't use window)
  2. ModelRunner runs over all timesteps in the model horizon

Use Case 11: Define a pre-specified planning strategy

Precondition:

Actor: Modeller

Scenario:

  1. Actor navigates to planning interface
  2. «system» displays list of strategies
  3. Actor creates a new pre-specified planning strategy with a unique name and a description
  4. For each of the sectors in turn, Actor associates one or more interventions from the list populated by the sector models with a timestep from the Model Run
  5. «system» writes the data to the «store»

Extension: No interventions are defined

  1. {as above}
  2. Interface doesn't let Actor create a new planning strategy and displays a warning message saying that no interventions have been defined.

Use Case: Pre-specified planning

Actor: Decision Manager

Scenario:

Use Case: Make Decision

Scope: Decision Layer

Actor: Decision Manager (DM)

Supporting Actors: Model Runner

Scenario:

  1. Model Runner initialises Decision Manager with strategy bundle
  2. DM requests the list of interventions from the <>
  3. Model Runner iterates over each iteration-timestep pairing yielded by the DM
  4. For each timestep, Model Runner solves the SosModel
  5. For each sector model in the SosModel, sector model gets the current state of the system from the decision manager.

^Top

Notes

Title: Actor: Scenario:

Extensions: (when things go wrong)

Precondition: (what must be true to begin this use case)

Postcondition: Stakeholders: Technology list: Scope: Level:

^Top

Notes and ideas

TODO: process these into use cases as above.

Design running multiple scenario variants in a model run (variability)

Labels:

  • smif

Main objective is to support consistent analysis of variability:

  • e.g. weather data with 100 realisations for a climate scenario, drives energy demand, generation, and hydrology hence water supply

Currently can imagine 100 model runs created by script - does the job.

Imaginative hack - a fake decision module that iterates over scenario realisations instead of/as well as making decisions.

Can we do better? Single model run with realisations as a dimension in the scenario/s, 'explode' sos model graph to include 100 copies of each model (in the case where each model is ignorant of the 'realisations' dimension going on around it).

Maybe just a presentational thing in the GUI - group model runs, assert that all attributes are identical except for varying along realisation.

Other motivations to group model runs: strategy/scenario exploration, sensitivity analysis, parameter sweeps...

Design smif-sdk / smif-runner refactor

Labels:

  • smif
  • smif ideas

Motivations:

  • clean separation between coordination and simulation/model-running
  • avoid need to load wrappers into the same python process as smif
  • performance: (eventually) reduce layers of IO
  • distribution/platforms: switch local method call to call subprocess, other job-runner, container/orchestration..

Design ideas:

  • smif SDK essentially implements DataLayer connection/DataHandle creation, could be in multiple languages
  • then building a model to be smif-runnable is a matter of importing a language-specific SDK and defining a CLI entrypoint, and munging from DataArray/list[dict] to model types. That is, smif-SDK has functions that directly read/write to the scratch store, and exposes the DataHandle API to the model at runtime for some simplicity.
  • could avoid a layer of IO e.g. smif reads data from scratch backing store and passes to wrapper, wrapper writes to txt/CSV and starts model subprocess, model subprocess reads txt/CSV again...
  • could look at distributed (in-memory?) object store as backing too - plasma, shm, ... maybe avoiding touching disk and a layer of de/serialization

So smif-runner or job-scheduler calls a series of subprocesses (no python dynamic class-loading) or runs a series of containers.

Create sample projects/add to smif sample_project to feature all functionality - collect ideas here

Labels:

  • smif
  • smif ideas

Add the following to a sample project:

  • example of a custom dimension. Example project does not currently use any interval definitions, or csv based dimension data, only shapefiles
  • demonstrate data conversion using default DataAdapters
  • demonstrate custom data conversion using user specified DataAdapter

(See comments for more items to add).

Investigate python logging filter objects to reduce logging noise

Labels:

  • errors
  • logging
  • smif
  • smif ideas

At present, all logs get dumped into one stream which is very noisy. It would be good to separate the multiple log streams according to the simulation models and integration framework (and decisions).

Provide wrapper with loggerHandle

Labels:

  • logging
  • smif
  • smif ideas

Provide modellers with a logger handle that writes out custom log messages for an integrated sector model. This helps modellers to debug or analyse their models within a system-of-systems without having to scroll through smif system messages.

  • One log per modelrun
  • Each modelrun should results in a new empty logfile
  • A tag should show the source of the log message
[energy_demand] Finished run in 23s
[water_supply] Start run timestep 2020

see also

Include pre-commit in dev docs/dev requirements

Labels:

  • documentation
  • smif
  • smif ideas

see if pre-commit install can be added to setup script

ModelRun configuration holds warm-start meta data

Labels:

  • modelrun
  • smif
  • smif ideas

Add configuration metadata to modelrun results and protect the user from warm-start when the config changes (from PR #153)

Use an MD5 hash of the configuration folder, check on new run, and refuse warm run if the configuration has changed.

Protect the user from warm-start when the config changes

Labels:

  • cli
  • integration
  • smif
  • smif ideas

When the modelrun / sector_model / .. configuration changes, results from a previous modelrun cannot be used anymore to resume a modelrun using a --warm start.

Warm start from last decision or iteration

Labels:

  • cli
  • integration
  • smif
  • smif ideas

The warm start now resumes the modelrun from the last timestep. Extending this on the last modelrun decision or iteration would speed this up even more.

Benchmark text datafile interface

Labels:

  • smif
  • smif ideas

Synthesise a dataset e.g. as might be used by energy demand, benchmark I/O costs of using csv and yaml

The GUI and data interface check Types of data

Labels:

  • data_handle
  • gui
  • smif
  • smif ideas

Delegate type checking to the data interface, and handle errors in HTTP/GUI. Some inline checking on forms.

Provide a "dashboard" facility which allows modellers to easily specify visualisations to analyse model runs

Labels:

  • smif ideas
  • visualisation

Obtaining quick feedback on the outputs of a model run is useful while conducting individual scenario analyses. Modellers may have interests in viewing information focussed on their sector, and so the ability to collate a dashboard which provides relevant summaries to the modeller is useful.

Add a custom logging level to smif for data level information

Labels:

  • data_handle
  • smif
  • smif ideas

It's useful to log some data-level information (such as adding time intervals), but this results in data overload at runtime when using debug level.

We could add a low debugging level to handle these, or we could move most logging to the info level?

Generalise time to decision timesteps and simulation intervals, with intervals contained within each timestep.

Labels:

  • fundamentals
  • smif
  • smif ideas

We can implement a more general treatment of time within smif where the timesteps used for decision making can be a super-set of the intervals over which the system is simulated. This would allow a move towards lock-step type use of smif where models increment over smaller intervals of time rather than the simulation of entire years before information is exchanged.

The framework should facilitate meta-studies of the models, such as global sensitivity analysis

Labels:

  • smif
  • smif ideas

The framework should facilitate meta-studies (e.g. global sensitivity analysis) of the sector models to enable selection of the dependencies for inclusion in the study. For example, the global sensitivity analysis library SALib requires definition of parameter names and ranges and produces a sample which can then be used to run a Monte-Carlo type simulation of the model. Subsequent analysis of the input sample and results provides a number of useful sensitivity metrics.

Clone this wiki locally