-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreproduce_results.py
52 lines (42 loc) · 3.36 KB
/
reproduce_results.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
import nemlite
import pandas as pd
# Note running this file as is will consume large amounts of disk space and take several weeks, probably try running it
# for a much smaller time window first.
# Specify some locations to save data. Create and specify your own!
raw_data = 'your folder path to cache raw data from AEMO'
filtered_data = 'your folder path to save filtered AEMO data for running nemlite'
# Specify the backcast period. Choose a short period, it will probably not work for some time back in history when the
# AEMO data was structured differently.
start_times = ['2017/01/01 00:00:00', '2017/02/01 00:00:00', '2017/03/01 00:00:00', '2017/04/01 00:00:00',
'2017/05/01 00:00:00', '2017/06/01 00:00:00', '2017/07/01 00:00:00', '2017/08/01 00:00:00',
'2017/09/01 00:00:00', '2017/10/01 00:00:00', '2017/11/01 00:00:00', '2017/12/01 00:00:00']
end_times = ['2017/02/01 00:00:00', '2017/03/01 00:00:00', '2017/04/01 00:00:00', '2017/05/01 00:00:00',
'2017/06/01 00:00:00', '2017/07/01 00:00:00', '2017/08/01 00:00:00', '2017/09/01 00:00:00',
'2017/10/01 00:00:00', '2017/11/01 00:00:00', '2017/12/01 00:00:00', '2018/01/01 00:00:00']
for start_time, end_time in zip(start_times, end_times):
# Create an generator of actual historical NEMDE inputs.
inputs = nemlite.actual_inputs_replicator(start_time, end_time, raw_data, filtered_data, True)
# Create a data frame to save the results
nemlite_results_cumulative = pd.DataFrame()
# Iterate other the inputs to
for [dispatch_unit_information, dispatch_unit_capacity_bids, initial_conditions, interconnectors,
regional_demand, dispatch_unit_price_bids, regulated_interconnectors_loss_model, connection_point_constraints,
interconnector_constraints, constraint_data, region_constraints, timestamp,
regulated_interconnector_loss_factor_model,
market_interconnectors, market_interconnector_price_bids, market_interconnector_capacity_bids,
market_cap_and_floor] in inputs:
price_results, dispatches, inter_flows = nemlite.run(dispatch_unit_information, dispatch_unit_capacity_bids,
initial_conditions, interconnectors,
regional_demand, dispatch_unit_price_bids,
regulated_interconnectors_loss_model,
connection_point_constraints,
interconnector_constraints, constraint_data,
region_constraints,
regulated_interconnector_loss_factor_model,
market_interconnectors, market_interconnector_price_bids,
market_interconnector_capacity_bids,
market_cap_and_floor)
price_results['DateTime'] = timestamp
nemlite_results_cumulative = pd.concat([nemlite_results_cumulative, price_results])
print(timestamp)
nemlite_results_cumulative.to_csv('your_path/price_results_{}_{}.csv'.format(start_time[:4], start_time[5:7]))