-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.py
178 lines (133 loc) · 5.97 KB
/
test.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
from project import Project
from scenario import Scenario
from sources2 import Source, SourceManager
import pandas as pd
import time
source_manager = None
def read_prereq_data():
try:
global source_manager
print('Reading Pre req data')
Project.read_load_projection("data")
Project.read_load_solar_data_from_folder('data/load_solar_profile')
Project.create_load_data()
source_manager = SourceManager('data/input_data.xlsx')
return True
except Exception as e:
print('Pre req data could not be loaded.')
return False
def set_baseline_src_config():
#configure(self, start_year, end_year,rating, rating_unit,
#spin_reserve, priority, min_loading, max_loading):
#5MW solar plant (SRC_4)
#9 x 1.5MW Captive Gas Generators (SRC_6)
sources = []
#==========================================
#5MW existing solar plant SRC_4
src = source_manager.get_source_types_by_name('SRC_4')
src.configure(start_year=1, end_year = 12,rating=5, rating_unit='MW', spin_reserve=0,
priority=1, min_loading=0, max_loading=100)
sources.append(src)
src = source_manager.get_source_types_by_name('SRC_4')
src.configure(start_year=1, end_year = 12,rating=5, rating_unit='MW', spin_reserve=0,
priority=1, min_loading=0, max_loading=100)
sources.append(src)
src = source_manager.get_source_types_by_name('SRC_4')
src.configure(start_year=1, end_year = 12,rating=5, rating_unit='MW', spin_reserve=0,
priority=1, min_loading=0, max_loading=100)
sources.append(src)
src = source_manager.get_source_types_by_name('SRC_4')
src.configure(start_year=1, end_year = 12,rating=5, rating_unit='MW', spin_reserve=0,
priority=1, min_loading=0, max_loading=100)
sources.append(src)
src = source_manager.get_source_types_by_name('SRC_4')
src.configure(start_year=1, end_year = 12,rating=5, rating_unit='MW', spin_reserve=0,
priority=1, min_loading=0, max_loading=100)
sources.append(src)
src = source_manager.get_source_types_by_name('SRC_4')
src.configure(start_year=1, end_year = 12,rating=5, rating_unit='MW', spin_reserve=0,
priority=1, min_loading=0, max_loading=100)
sources.append(src)
#==========================================
"""
#5MW new solar plant
solar_src_list = []
for i in range(1,3):
solar_src = source_manager.get_source_types_by_name('SRC_1')
solar_src.configure(start_year=2, end_year = 12, rating=2.5, rating_unit='MW', spin_reserve=0,
priority=2, min_loading=0, max_loading=100)
solar_src_list.append(solar_src)
sources.extend(solar_src_list)
"""
#==========================================
"""
#1.5MW captive generators SRC_6
captive_src_list = []
for i in range(1,7):
captive_src = source_manager.get_source_types_by_name('SRC_6')
captive_src.configure(start_year=1, end_year = 12, rating=1.5, rating_unit='MW', spin_reserve=100,
priority=4, min_loading=10, max_loading=100)
captive_src_list.append(captive_src)
sources.extend(captive_src_list)
"""
#==========================================
"""
#PPA HFO generators SRC_2
hfo_src_list = []
for i in range(1,3):
hfo_src = source_manager.get_source_types_by_name('SRC_2')
hfo_src.configure(start_year=2, end_year = 12, rating=4, rating_unit='MW', spin_reserve=100,
priority=2, min_loading=10, max_loading=100)
hfo_src_list.append(hfo_src)
sources.extend(hfo_src_list)
hfo_src_list = []
for i in range(1,2):
hfo_src = source_manager.get_source_types_by_name('SRC_2')
hfo_src.configure(start_year=9, end_year = 12, rating=4, rating_unit='MW', spin_reserve=0,
priority=3, min_loading=25, max_loading=100)
hfo_src_list.append(hfo_src)
sources.extend(hfo_src_list)
"""
#==========================================
"""
#10MW steam (SRC_5)
src = source_manager.get_source_types_by_name('SRC_5')
src.configure(start_year=3, end_year = 12,rating=10, rating_unit='MW', spin_reserve=20,
priority=0, min_loading=0, max_loading=60)
sources.append(src)
"""
#==========================================
#6 x 0.5MW BESS (SRC_3)
bess_src_list = []
for i in range(1,10):
bess_src = source_manager.get_source_types_by_name('SRC_3')
bess_src.configure(start_year=1, end_year = 12, rating = 5,
rating_unit='MWh', spin_reserve=0, priority=5, min_loading=0, max_loading=100)
bess_src_list.append(bess_src)
sources.extend(bess_src_list)
return sources
def simulate_scenario(scenario):
scenario.simulate()
# Main program
if __name__ == "__main__":
start_time = time.time()
if read_prereq_data():
print('Prereq data is loaded')
output_filepath = 'data/summary_output.csv'
src_list = set_baseline_src_config()
print('sources created and configured')
#BESS non-Em mode: 0 means none, 1 means yes with equal distribution, 2 means yes with selection utilization
sc = Scenario(name = "Baseline", client_name = "Engro",selected_sources=src_list,spin_reserve_perc=0,bess_non_emergency_use=2)
print('scenario created, strting simulation')
sc.simulate()
print('simulation complete.')
print('printing yearly summary')
sc.write_yearly_data_to_csv(output_filepath)
print('printing complete')
print('printing hourly data')
sc.write_hourly_data_to_csv()
print('printing complete')
print('Scenario KPIs below:')
print(sc.scenario_kpis)
end_time = time.time()
print(f"Run completed in {end_time - start_time} seconds")