-
Notifications
You must be signed in to change notification settings - Fork 1
/
chapter8.py
75 lines (54 loc) · 1.66 KB
/
chapter8.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# Decentralised water storage model: master file - for control of multiple model runs. Neal Hughes
from __future__ import division
import numpy as np
import model
from para import Para
from results import chapter8
from results.chartbuilder import *
para = Para(rebuild=True, charts=False)
para.central_case(N = 100)
para.solve_para()
para.set_property_rights(scenario = 'CS')
mod = model.Model(para)
home = '/home/nealbob'
folder = '/Dropbox/Model/results/chapter8/'
out = '/Dropbox/Thesis/IMG/chapter8/'
SW = []
SWb = []
S = []
TIME = []
m = 5
sp = [False for i in range(m)]
t1 = [5000, 10000, 20000, 50000, 80000]
t2 = [5000, 10000, 20000, 50000, 80000]
d = [0.2] * m
"""
for j in range(m):
sw, s, time, _ = mod.chapter8(stage2=sp[j], T1=t1[j], T2=t2[j], d=d[j])
SW.append(sw)
S.append(s)
TIME.append(time)
myopicSW = mod.simulate_myopic(500000)
chapter8.planner(SW, S, TIME, myopicSW)
"""
t1 = [200000, 500000, 500000]
t2 = [0, 0, 0]
d = [0.4, 0.4, 0.4]
for j in range(3):
_, _, _, swb = mod.chapter8(stage2=sp[j], T1=t1[j], T2=t2[j], d=d[j], decentral_test=True)
SWb.append(swb)
print SWb
"""
#===========================================
# S x I state space chart
#===========================================
mod.plannerSDP()
mod.sim.simulate(mod.users, mod.storage, mod.utility, 10000, mod.para.CPU_CORES, planner=True, policy=True, polf=mod.sdp.W_f, delta=0, stats=True, planner_explore=False, t_cost_off=True)
S = mod.sim.series['S'] / 1000
I = mod.sim.series['I'] / 1000
data = [[S, I]]
chart = {'OUTFILE': home + out + 'SbyI.pdf',
'XLABEL': 'Storage (GL)',
'YLABEL': 'Inflow (GL)' }
build_chart(chart, data, chart_type='scatter')
"""