Skip to content

Commit

Permalink
Added some notes and hard coded parameterisation to decision module
Browse files Browse the repository at this point in the history
  • Loading branch information
willu47 committed Mar 21, 2019
1 parent 0cca069 commit 6906c20
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 6 deletions.
3 changes: 0 additions & 3 deletions models/digital_comms/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,10 @@
import csv
import os


import fiona # type: ignore
import numpy as np # type: ignore

from digital_comms.fixed_network.model import NetworkManager
from digital_comms.fixed_network.interventions import decide_interventions
from digital_comms.fixed_network.adoption import update_adoption_desirability
from digital_comms.runner import read_csv, read_assets, read_links

from smif.model.sector_model import SectorModel # type: ignore
Expand Down
31 changes: 28 additions & 3 deletions planning/digital_decisions.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
from smif.data_layer.data_array import DataArray
from logging import getLogger
import pandas as pd
from typing import Dict, List

from digital_comms.fixed_network.interventions import decide_interventions
from digital_comms.fixed_network.adoption import update_adoption_desirability


class DigitalDecisions(RuleBased):
Expand All @@ -19,7 +23,24 @@ def from_dict(config):
register = config['register']
return DigitalDecisions(timesteps, register)

def get_decision(self, data_handle):
def get_decision(self, data_handle) -> List[Dict]:
"""Return decisions for a given timestep and decision iteration
Parameters
----------
results_handle : smif.data_layer.data_handle.ResultsHandle
Returns
-------
list of dict
Examples
--------
>>> register = {'intervention_a': {'capital_cost': {'value': 1234}}}
>>> dm = DecisionModule([2010, 2015], register)
>>> dm.get_decision(results_handle)
[{'name': 'intervention_a', 'build_year': 2010}])
"""

# Get the technology strategy parameter - this should consist of a string
# which describes the policy and
Expand All @@ -29,7 +50,11 @@ def get_decision(self, data_handle):
# -----------------------
# Get scenario adoption rate
# -----------------------
annual_adoption_rate = data_handle.get_data('adoption').data
# annual_adoption_rate = data_handle.get_data('adoption').data

distributions = data_handle.get_data('distributions')

annual_adoption_rate = 40

# get adoption desirability from previous timestep
adoption_desirability = [
Expand Down Expand Up @@ -68,7 +93,7 @@ def get_decision(self, data_handle):

interventions = decide_interventions(
self.system,
now,
data_handle.current_timestep,
technology,
policy,
data_handle.get_parameter('annual_budget').data,
Expand Down

0 comments on commit 6906c20

Please sign in to comment.