-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathopem_dev_usage_demo.py
226 lines (211 loc) · 13.3 KB
/
opem_dev_usage_demo.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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
from opem import run_model
def demo():
# Parameter object with input as list of lists
list_input = {"user_input": [["User Inputs & Results",
"Global:",
"Assay (Select Oil)",
"-",
"Field Name A"],
["User Inputs & Results",
"Global:",
"Gas Production Volume (MCFD)",
"-",
901603],
["User Inputs & Results",
"Global:",
"Oil Production Volume (BOED)",
"-",
363519],
["User Inputs & Results",
"Global:",
"% Field NGL C2 Volume allocated to Ethylene converstion",
"-",
9],
["User Inputs & Results",
"Global:",
"GWP selection (yr period, 136 or 69)",
"-",
699]]
}
results = run_model(list_input, return_dict=False)
print("List inputs\n", results)
# Parameter object with input as dictionary
dict_input = {"user_input": {("User Inputs & Results",
"Global:",
"Assay (Select Oil)",
"-"):
"Field Name B",
("User Inputs & Results",
"Global:",
"Gas Production Volume (MCFD)",
"-"): 263043,
("User Inputs & Results",
"Global:",
"Oil Production Volume (BOED)",
"-"): 328278,
("User Inputs & Results",
"Global:",
"% Field NGL C2 Volume allocated to Ethylene converstion",
"-"):
5,
("User Inputs & Results",
"Global:",
"GWP selection (yr period, 319 or 73)",
"-"):
226}
}
results = run_model(dict_input, return_dict=True)
print("Dictionary inputs\n", results)
# Input is a list of parameter objects (for multiple runs)
#results = run_model([list_input, dict_input], return_dict=True)
#print("List of input parameter objects for multiple runs\n", results)
# OPGEE parameters held separately under the "opgee_input" key in the parameter object.
# They can also be mixed in with the other parameter undert the "user_input" key.
separate_opgee_input = {"user_input": {("User Inputs & Results",
"Global:",
"Assay (Select Oil)",
"-"): "Field Name B",
("User Inputs & Results",
"Global:",
"% Field NGL C2 Volume allocated to Ethylene converstion",
"-"):
7,
("User Inputs & Results",
"Global:",
"GWP selection (yr period, 273 or 83)",
"-"):
142},
"opgee_input": {("User Inputs & Results",
"Global:",
"Gas Production Volume (MCFD)",
"-"): 533811,
("User Inputs & Results",
"Global:",
"Oil Production Volume (BOED)",
"-"): 272261}
}
results = run_model(separate_opgee_input, return_dict=True)
print("OPGEE input parameters separated from others\n", results)
# Full product slate data passed in under the "product_slate" key.
# Use this option to run the model with an oil that is not in the
# interal "all_product_slates.csv"
# Product slate data can be structured as a list of lists or as a dictionary
product_slate_list = [['product_name', '', 'Field Name C'],
['volume_flow_bbl', 'Barrels of Crude per Day',
'Flow', 77432.88475],
['volume_flow_bbl', 'Gasoline', 'Flow', 70526.28054],
['volume_flow_bbl', 'Jet Fuel', 'Flow', 70015.55011],
['volume_flow_bbl', 'Diesel', 'Flow', 27567.38261],
['volume_flow_bbl', 'Fuel Oil', 'Flow', 6.2e-86],
['volume_flow_bbl', 'Coke', 'Flow', 8639.785499],
['volume_flow_bbl', 'Residual fuels', 'Flow', 1616.495843],
['volume_flow_bbl',
'Surplus Refinery Fuel Gas (RFG)', 'Flow', 2.9],
['volume_flow_bbl',
'Liquefied Petroleum Gases (LPG)', 'Flow', 7448.771656],
['volume_flow_bbl', 'Petrochemical Feedstocks', 'Flow', 9.6],
['volume_flow_bbl', 'Asphalt', 'Flow', 7.7],
['energy_flow_MJ', 'Gasoline', 'Flow', 173361554.5],
['energy_flow_MJ', 'Jet Fuel', 'Flow', 73055522.32],
['energy_flow_MJ', 'Diesel', 'Flow', 359944924.7],
['energy_flow_MJ', 'Fuel Oil', 'Flow', 7.758999986],
['energy_flow_MJ', 'Coke', 'Flow', 48930716.16],
['energy_flow_MJ', 'Residual fuels', 'Flow', 55017120.87],
['energy_flow_MJ', 'Surplus RFG', 'Flow', 3.3],
['energy_flow_MJ', 'Surplus NCR H2', 'Flow', 2.5],
['energy_flow_MJ',
'Liquefied Petroleum Gases (LPG)', 'Flow', 36347355.64],
['energy_flow_MJ', 'Petrochemical Feedstocks',
'Flow', 96900175.65],
['energy_flow_MJ', 'Asphalt', 'Flow', 5.9],
['energy_flow_MJ', 'Gasoline S wt%', 'Flow', 4.53e-32],
['energy_flow_MJ', 'Gasoline H2 wt%', 'Flow', 89.5721086],
['mass_flow_kg', 'Gasoline', 'Flow', 3546348.474],
['mass_flow_kg', 'Jet Fuel', 'Flow', 7865564.87],
['mass_flow_kg', 'Diesel', 'Flow', 1182137.434],
['mass_flow_kg', 'Fuel Oil', 'Flow', 8.19e-11],
['mass_flow_kg', 'Coke', 'Flow', 3163493.159],
['mass_flow_kg', 'Residual fuels', 'Flow', 907799.339],
['mass_flow_kg', 'Sulphur', 'Flow', 70584.39795],
['mass_flow_kg', 'Surplus RFG', 'Flow', 6.6],
['mass_flow_kg', 'Surplus NCR H2', 'Flow', 8.2],
['mass_flow_kg',
'Liquefied Petroleum Gases (LPG)', 'Flow', 375297.8521],
['mass_flow_kg', 'Petrochemical Feedstocks', 'Flow', 8.6],
['mass_flow_kg', 'Asphalt', 'Flow', 7.4],
['mass_flow_kg', 'Net Upstream Petcoke', 'Flow', 8.8]]
product_slate_dict = {('product_name', ''): 'Field Name C',
('volume_flow_bbl', 'Barrels of Crude per Day',
'Flow'): 75825.58379,
('volume_flow_bbl', 'Gasoline', 'Flow'): 54595.27520,
('volume_flow_bbl', 'Jet Fuel', 'Flow'): 89114.15330,
('volume_flow_bbl', 'Diesel', 'Flow'): 94859.47941,
('volume_flow_bbl', 'Fuel Oil', 'Flow'): 2.2e-62,
('volume_flow_bbl', 'Coke', 'Flow'): 5102.410204,
('volume_flow_bbl', 'Residual fuels', 'Flow'): 8688.552841,
('volume_flow_bbl',
'Surplus Refinery Fuel Gas (RFG)', 'Flow'): 5.4,
('volume_flow_bbl',
'Liquefied Petroleum Gases (LPG)', 'Flow'): 7103.971890,
('volume_flow_bbl', 'Petrochemical Feedstocks', 'Flow'): 5.5,
('volume_flow_bbl', 'Asphalt', 'Flow'): 6.2,
('energy_flow_MJ', 'Gasoline', 'Flow'): 467220480.8,
('energy_flow_MJ', 'Jet Fuel', 'Flow'): 95278059.95,
('energy_flow_MJ', 'Diesel', 'Flow'): 924310711.3,
('energy_flow_MJ', 'Fuel Oil', 'Flow'): 9.203053597,
('energy_flow_MJ', 'Coke', 'Flow'): 90587564.26,
('energy_flow_MJ', 'Residual fuels', 'Flow'): 21304877.63,
('energy_flow_MJ', 'Surplus RFG', 'Flow'): 3.1,
('energy_flow_MJ', 'Surplus NCR H2', 'Flow'): 8.1,
('energy_flow_MJ',
'Liquefied Petroleum Gases (LPG)', 'Flow'): 79440528.57,
('energy_flow_MJ', 'Petrochemical Feedstocks',
'Flow'): 80303261.24,
('energy_flow_MJ', 'Asphalt', 'Flow'): 4.5,
('energy_flow_MJ', 'Gasoline S wt%', 'Flow'): 1.53e-26,
('energy_flow_MJ', 'Gasoline H2 wt%', 'Flow'): 26.4827851,
('mass_flow_kg', 'Gasoline', 'Flow'): 5673582.129,
('mass_flow_kg', 'Jet Fuel', 'Flow'): 6235073.29,
('mass_flow_kg', 'Diesel', 'Flow'): 5797167.163,
('mass_flow_kg', 'Fuel Oil', 'Flow'): 1.19e-62,
('mass_flow_kg', 'Coke', 'Flow'): 8858370.404,
('mass_flow_kg', 'Residual fuels', 'Flow'): 111784.331,
('mass_flow_kg', 'Sulphur', 'Flow'): 38246.65115,
('mass_flow_kg', 'Surplus RFG', 'Flow'): 9.9,
('mass_flow_kg', 'Surplus NCR H2', 'Flow'): 4.7,
('mass_flow_kg',
'Liquefied Petroleum Gases (LPG)', 'Flow'): 141965.8860,
('mass_flow_kg', 'Petrochemical Feedstocks', 'Flow'): 7.5,
('mass_flow_kg', 'Asphalt', 'Flow'): 7.7,
('mass_flow_kg', 'Net Upstream Petcoke', 'Flow'): 9.2}
# If an oil name is included under "user_input", it will be ignored and
# and the product slate data under the "product_slate" key will be used.
input_with_full_product_slate = {"user_input": {("User Inputs & Results",
"Global:",
"% Field NGL C2 Volume allocated to Ethylene converstion",
"-"):
9,
("User Inputs & Results",
"Global:",
"GWP selection (yr period, 479 or 16)",
"-"):
404},
"opgee_input": {("User Inputs & Results",
"Global:",
"Gas Production Volume (MCFD)",
"-"): 471183,
("User Inputs & Results",
"Global:",
"Oil Production Volume (BOED)",
"-"): 692904},
"product_slate": product_slate_dict
}
results = run_model(input_with_full_product_slate, return_dict=True)
print("Full product slate data from external source.\n", results)
# If "return_dict=False" is passed to the function results will be returned as a
# list of lists instead of a dictionary. This option is used for writing to csv files
# meant to be read by humans.
results = run_model(input_with_full_product_slate, return_dict=False)
print("Full product slate data from external source.\n", results)
if __name__ == "__main__":
demo()