-
Notifications
You must be signed in to change notification settings - Fork 0
/
irr_dice.py
59 lines (32 loc) · 1.47 KB
/
irr_dice.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# -*- coding: utf-8 -*-
"""
Created on Tue Jul 28 15:15:46 2020
@author: kcaldeira
Computer ROI on ramp down to 50 as function of abatement cost and
"""
from DICEeq import *
from plot_utilities import *
from io_utilities import *
import cProfile
import numpy as np
variationVec = 10**np.arange(-1,1.1,0.1)
tlist = [0,5, 35, 300]
tmax = 300
resList = []
for damageScale in variationVec:
initState, initParams = createGlobalVariables(tmax,1,tlist,1)
initParams['a1'] = initParams['a1'] * damageScale
initParams['a2'] = initParams['a2'] * damageScale
initParams['saveOutput'] = True
baseResults = DICE_fun([0,0,0,0],initState,initParams)
baseConsumption = np.array(baseResults[1]['c'])
for abateScale in variationVec:
initState, initParams = createGlobalVariables(tmax,1,tlist,1)
initParams['a1'] = initParams['a1'] * damageScale
initParams['a2'] = initParams['a2'] * damageScale
initParams['pbacktime'] = initParams['pbacktime'] * abateScale
initParams['saveOutput'] = True
results = DICE_fun([0,0,1,1],initState,initParams)
consumption = np.array(results[1]['c'])
deltaConsumption = consumption - baseConsumption
resList = np.append(resList, [damageScale, abateScale, np.irr(deltaConsumption),[i for i, x in enumerate(deltaConsumption) if x > 0][0]] )