-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.py
76 lines (69 loc) · 2.93 KB
/
main.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
# Python based power market clearing model
# Author: Qiwei Zhang
import argparse
import input_Parse
import market_obj as MO
import core
import streaming
if __name__ == '__main__':
# input parser
parser = argparse.ArgumentParser(description='LTB Market Module')
parser.add_argument('-ED', '--Economic Dispatch', help='Perform Economic dispatch')
parser.add_argument('-L', '--Load Profile', help='Input Load Profile')
parser.add_argument('-UC', '--Unit Commitment', help='Perform Unit commitment')
parser.add_argument('-XGD', '--UC gen data', help='Input gen Profile')
parser.add_argument('-DM', '--Day ahead market', help='Perform Whole UC+ED')
parser.add_argument('-RT', '--Real time market', help='Perform Whole Ex_ante+Ex_post')
parser.add_argument('-DI', '--Dime', help='Send data to dime')
args = parser.parse_args()
args = vars(args)
# Bid/Post system
market = MO.Market('run UC ED')
if bool(args['Dime']):
market.dime = True
port = int(args['Dime'])
market.streaming = streaming.Streaming(market, port)
if bool(args['Economic Dispatch']):
input_Parse.read_structure(market, args['Economic Dispatch'])
if market.dime:
market.streaming.send_init()
if bool(args['Load Profile']):
input_Parse.read_load(market, args['Load Profile'])
market.Load_profile_flg = True
core.multi_ED(market)
else:
core.ecnomic_dispatch(market)
if bool(args['Unit Commitment']):
input_Parse.read_structure(market, args['Unit Commitment'])
if market.dime:
market.streaming.send_init()
try:
input_Parse.read_xgd(market, args['UC gen data'])
input_Parse.read_load(market, args['Load Profile'])
except:
print("Error: fail to load xgd and load file")
else:
print("xgd and load file loaded")
market.Load_profile_flg = True
core.unit_commitment(market)
if bool(args['Day ahead market']):
input_Parse.read_structure(market, args['Day ahead market'])
if market.dime:
market.streaming.send_init()
try:
input_Parse.read_xgd(market, args['UC gen data'])
input_Parse.read_load(market, args['Load Profile'])
except:
print("Error: fail to load xgd and load file")
else:
print("xgd and load file loaded")
market.Load_profile_flg = True
core.unit_commitment(market)
core.multi_ED(market)
# market.streaming.finalize(market.streaming)
if bool(args['Real time market']):
input_Parse.read_structure(market, args['Real time market'])
input_Parse.read_load(market, args['Load Profile'])
market.Load_profile_flg = True
core.multi_ED(market)
core.real_time(market)