-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
executable file
·106 lines (87 loc) · 3.63 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
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
"""OSE2Ameba: Script to convert an OSE2000 database into Ameba CSV format.
_______________________________________________________________________________
Copyright (c) 2017 AMEBA-Dev - Consultora SPEC Limitada
This software cannot be distributed.
For more information, visit ameba.spec.cl
Current version developer: Ameba Team
_______________________________________________________________________________
"""
import argparse
# import csv
import os
from module import busbar, branch, generator, demandload, profiles_ERNC, fuel, inflow, profile_GNL, dam, irrigation
from module import demandload_block, inflow_block, profiles_ERNC_block
parser = argparse.ArgumentParser(description='OSE2000 to Ameba converter')
parser.add_argument(
'model', default='opt', type=str, help='select model to get data from (Opt or Ope)')
args = parser.parse_args()
print 'starting process..........'
# - - - - - - LEER RUTAS DE DATOS Y RESULTADOS - - - - - - #
config_rutas = open('config_rute.txt', 'r')
path_datos = ''
path_resultados = ''
tmp_line = ''
for line in config_rutas:
if tmp_line == '[data]':
path_datos = line.split()[0]
elif tmp_line == '[output]':
path_resultados = line.split()[0]
tmp_line = line.split()[0]
if not os.path.exists(path_resultados):
print "output directory: " + path_resultados + " does not exists. Creating..."
os.mkdir(path_resultados)
# - - - - - - CONFIG PARAMETERS - - - - - - #
BLOCK_RESOLUTION = False
# - - - - - - BUSBAR - - - - - - #
print '-- processing busbar data --'
busbar = busbar.Busbar(path_datos, path_resultados, args.model)
# busbar.run()
# - - - - - - BRANCH - - - - - - #
print '-- processing branch data --'
branch = branch.Branch(path_datos, path_resultados, args.model)
# branch.run()
# - - - - - - GENERATOR - - - - - - #
print '-- processing generator data --'
generator = generator.Generator(path_datos, path_resultados, args.model)
# generator.run()
# - - - - - - DEMAND - - - - - - #
print '-- processing demand data --'
dem_year_ini='2017'
dem_year_end='2017'
dem_year_ose='2013'
demand = demandload.DemandLoad(path_datos, path_resultados, args.model, dem_year_ini, dem_year_end, dem_year_ose)
demand_block = demandload_block.DemandLoadBlock(path_datos, path_resultados, args.model, dem_year_ini, dem_year_end, dem_year_ose)
# demand.run()
demand_block.run()
# - - - - - - PROFILE - - - - - - #
print '-- processing profile data --'
profile_power_year_ini='2017'
profile_power_year_ose='2013'
profile_power = profiles_ERNC.ProfilePower(path_datos, path_resultados, args.model, profile_power_year_ini,
profile_power_year_ose)
profile_power_block = profiles_ERNC_block.ProfilesBlock(path_datos, path_resultados, args.model)
# profile_power.run()
profile_power_block.run()
# - - - - - - FUEL - - - - - - #
print '-- processing fuel data --'
fuel = fuel.Fuel(path_datos, path_resultados, args.model)
# fuel.run()
# - - - - - - INFLOW - - - - - - #
print '-- processing inflow data --'
inflow = inflow.ProfileInflow(path_datos, path_resultados, args.model)
inflow_block = inflow_block.InflowBlock(path_datos, path_resultados, args.model)
# inflow.run()
inflow_block.run()
# - - - - - - GNL - - - - - - #
print '-- processing GNL indexed data --'
gnl = profile_GNL.ProfileGnl(path_datos, path_resultados, args.model)
# gnl.run()
# - - - - - - DAM - - - - - - #
print '-- processing dam data --'
dam = dam.DamCot(path_datos, path_resultados, args.model)
# dam.run()
# - - - - - - IRRIGATION - - - - - - #
print '-- processing irrigation data --'
irrigation = irrigation.Irrigation(path_datos, path_resultados, args.model)
# irrigation.run()
print "process finished"