-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathImpactAggregationComponent.jl
66 lines (58 loc) · 2.18 KB
/
ImpactAggregationComponent.jl
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
60
61
62
63
64
65
66
@defcomp impactaggregation begin
regions = Index()
eloss = Variable(index=[time,regions])
sloss = Variable(index=[time,regions])
loss = Variable(index=[time,regions])
income = Parameter(index=[time,regions])
water = Parameter(index=[time,regions])
forests = Parameter(index=[time,regions])
heating = Parameter(index=[time,regions])
cooling = Parameter(index=[time,regions])
agcost = Parameter(index=[time,regions])
drycost = Parameter(index=[time,regions])
protcost = Parameter(index=[time,regions])
entercost = Parameter(index=[time,regions])
hurrdam = Parameter(index=[time,regions])
extratropicalstormsdam = Parameter(index=[time,regions])
species = Parameter(index=[time,regions])
deadcost = Parameter(index=[time,regions])
morbcost = Parameter(index=[time,regions])
wetcost = Parameter(index=[time,regions])
leavecost = Parameter(index=[time,regions])
# Other economic losses
eloss_other = Parameter(index=[time,regions])
# Other non-economic losses
sloss_other = Parameter(index=[time,regions])
function run_timestep(p, v, d, t)
if is_first(t)
for r in d.regions
v.eloss[t, r] = 0.0
v.sloss[t, r] = 0.0
end
else
for r in d.regions
v.eloss[t, r] = min(
p.water[t, r] +
p.forests[t, r] +
p.heating[t, r] +
p.cooling[t, r] +
p.agcost[t, r] +
p.drycost[t, r] +
p.protcost[t, r] +
p.entercost[t, r] +
p.hurrdam[t, r] +
p.extratropicalstormsdam[t, r] +
p.eloss_other[t,r],
p.income[t, r])
v.sloss[t, r] = 0.0 +
p.species[t, r] +
p.deadcost[t, r] +
p.morbcost[t, r] +
p.wetcost[t, r] +
p.leavecost[t, r] +
p.sloss_other[t,r]
v.loss[t, r] = (v.eloss[t, r] + v.sloss[t, r]) * 1000000000.0
end
end
end
end