Commit 7f5ce00b authored by aeish's avatar aeish 🎯
Browse files

Updates to generate load profiles.

parent 4b95bb22
import numpy as np
import geopandas as gpd
import pandas as pd
from dtw import *
from scipy.optimize import minimize
from docplex.mp.model import Model
from math import floor, ceil
from datetime import datetime
from scipy.stats import pearsonr, spearmanr
import matplotlib.pyplot as plt
import seaborn as sns
from run_profileAllocation import unconstrained_unbounded, bounded_objective, bounded
from bokeh.plotting import figure, output_file, show
from bokeh.layouts import column, row
from my_color_scheme import color_scheme
from openpyxl import load_workbook
import math
import csv
node_60kV_name = [ 'KRE','GLO','STY','VND','BLL','GNG','LAN','LMS','HOL','RAV','RSM','RSL','DUR','SPK','SVL', 'EGR','EGB']
for node in node_60kV_name:
params = {'node_60kV' : node, # Node name in the 60kV network
'data_loc': '..\\data\\', # location for all the data
'dinemo_loc': '..\\data\\DiNeMo Data\\', # location for DiNeMo Data
'corres_loc':'..\\data\\corres_data\\', # corres data location
'netvind_loc':'..\\data\\netvind_loads_and_network\\', # netvind data location
'plots_loc': 'C:\\workingDirectory\\Programs\\benchmarkgrid\\plots\\ERA5\\'}
dinemo_filename = params['dinemo_loc'] + params['node_60kV'] + '\\'+ 'MVLVSubstation.csv' # Data for DiNeMo.
mvlv_substation = len(np.genfromtxt(dinemo_filename, dtype=['f8'], delimiter=',', skip_header=True, usecols=[2]).tolist())
dinemo_filename = params['dinemo_loc'] + params['node_60kV'] + '\\'+ 'HVMVSubstation.csv' # Data for DiNeMo.
hvmv_substation = len(np.genfromtxt(dinemo_filename, dtype=['f8'], delimiter=',', skip_header=True, usecols=[2]).tolist())
dinemo_filename = params['dinemo_loc'] + params['node_60kV'] + '\\'+ 'CElectricalLines.csv' # Data for DiNeMo.
lines = np.array(np.genfromtxt(dinemo_filename, dtype=['f8','f8'], delimiter=',', skip_header=True, usecols=[4,5]).tolist())
lv_line_length = sum(lines[lines[:,0]==0.4, 1])
mv_line_length = sum(lines[lines[:,0]==20, 1])
wb = load_workbook('.\\results\\benchmark_model_ERA5.xlsx')
ws = wb['Stats']
names = ws['A']
keep_looking = True
k = 0
while keep_looking:
if names[k].value == params['node_60kV']:
keep_looking = False
else:
k = k+1
k = k+1
ws_stat = wb['Stats']
ws_stat['P'+str(k)] = mvlv_substation
ws_stat['Q'+str(k)] = hvmv_substation
ws_stat['R'+str(k)] = lv_line_length
ws_stat['S'+str(k)] = mv_line_length
# Finally save
wb.save('.\\results\\benchmark_model_ERA5.xlsx')
\ No newline at end of file
......@@ -12,9 +12,8 @@ def unconstrained_unbounded(mdl, coef, params):
num_wind_profiles = wind_pp.shape[1]
num_timestamps_NV = len(netvind_MVA)
mdl.minimize(mdl.sumsq(
(netvind_MVA[i] \
- (mdl.sum( coef[j + num_wind_profiles+1] * simbench_load_profiles[i, j] for j in range(num_profiles_from_simbench)) \
- coef[0] * solar_pp[i,0] - mdl.sum(coef[k+1] * wind_pp[i,k] for k in range(num_wind_profiles)))) \
(netvind_MVA[i] + coef[0] * solar_pp[i,0] + mdl.sum(coef[k+1] * wind_pp[i,k] for k in range(num_wind_profiles)) \
- mdl.sum( coef[j + num_wind_profiles+1] * simbench_load_profiles[i, j] for j in range(num_profiles_from_simbench))) \
for i in range(num_timestamps_NV))/num_timestamps_NV)
# Netvind - (Load -generation)
sol = mdl.solve(log_output=True)
......
from wrapper_ProfileAllocation import run_wrapper
import numpy as np
import geopandas as gpd
import pandas as pd
from scipy.optimize import minimize
from docplex.mp.model import Model
from math import floor, ceil
from datetime import datetime
from scipy.stats import pearsonr, spearmanr
import matplotlib.pyplot as plt
import seaborn as sns
from run_profileAllocation import unconstrained_unbounded, bounded_objective, bounded
from bokeh.plotting import figure, output_file, show
from bokeh.layouts import column, row
from my_color_scheme import color_scheme
from openpyxl import load_workbook
import math
import csv
category,capacity
L2-A,G3-H,H0-G,G3-H,G3-M,G3-M,G3-M,BL-H,G4-A,G4-A,H0-G,L0-A,L0-A,L2-A,H0-B,L2-A,L1-A,L1-A,H0-A,H0-A,G3-H,H0-A,H0-B,G3-M,G3-H,H0-G,H0-A,G5-A,H0-B,H0-A,H0-A,L1-A,G5-A,L2-A,G3-A,H0-B,L0-A,H0-A,G3-H,L2-A,L0-A,H0-G,H0-C,H0-C,H0-C,H0-C,G5-A,G4-A,BL-H
0.1306,0.09496,0.027425,0.09496,0.173375,0.173375,0.173375,0.08005,0.1588,0.1588,0.027425,0.156275,0.156275,0.1306,0.10065,0.1306,0.15746666666666667,0.15746666666666667,0.13228571428571428,0.13228571428571428,0.09496,0.13228571428571428,0.10065,0.173375,0.09496,0.027425,0.13228571428571428,0.05853333333333333,0.10065,0.13228571428571428,0.13228571428571428,0.15746666666666667,0.05853333333333333,0.1306,0.0059,0.10065,0.156275,0.13228571428571428,0.09496,0.1306,0.156275,0.027425,0.1295,0.1295,0.1295,0.1295,0.05853333333333333,0.1588,0.08005
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment