Ejemplo n.º 1
0
# Different layouts

method = ['dir_rect.json', 'dir_dakota.json']
layout = ['grid', 'amalia', 'optimized', 'random']

n = 45  # number of points to consider

fig, ax = plt.subplots(4,
                       3,
                       figsize=(12, 12),
                       gridspec_kw={'width_ratios': [0.2, 1, 1]})
# Loop over all the axes and prettify the graph.  # later have that in the prettify
for Ax in ax:
    for AX in Ax:
        prettify.set_color_cycle(AX)
        prettify.remove_junk(AX)

for i, lay in enumerate(layout):
    # Get the baseline
    f = open(method[0], 'r')
    r = json.load(f)
    f.close()
    mu_base = r[lay]['average']['mu'][-1]

    # Plot the layout
    ax[i][0].scatter(tx[i], ty[i])
    ax[i][0].set_axis_off()
    ax[i][0].set_xlim([-190, 3990])
    ax[i][0].set_ylim([-245, 5145])
    ax[i][0].set_aspect('equal')
Ejemplo n.º 2
0
# method_dir = ['dir_dakotar_average.json', 'dir_dakota.json']
# method_speed = ['speed_rect.json', 'speed_dakota.json']
method_speed = ['speed_recttrunc.json', 'speed_dakotaqtrunc.json']
#method_speed = ['speed_chaospy.json', 'speed_dakota.json']
method_2d = ['2d_rect_average.json', '2d_dakotaq_average_trunc.json']
# method_2d = ['2d_dakotaq_average.json', '2d_dakotaq_average_trunc.json']
layout = ['grid', 'amalia', 'optimized', 'random']

n = 45  # number of points to consider

fig, ax = plt.subplots(4, 4, figsize=(17, 12), gridspec_kw={'width_ratios': [0.2, 1, 1, 1]})
# Loop over all the axes and prettify the graph.  # later have that in the prettify
for Ax in ax:
    for AX in Ax:
        prettify.set_color_cycle(AX)
        prettify.remove_junk(AX)

ax[0][0].set_title('layout', position=(0.5, 1.6))
method = method_dir
for i, lay in enumerate(layout):
    # Get the baseline
    f = open(method[0], 'r')
    r = json.load(f)
    f.close()
    mu_base = r[lay]['average']['mu'][-1]

    # Plot the layout
    ax[i][0].scatter(tx[i], ty[i])
    ax[i][0].set_axis_off()
    ax[i][0].set_xlim([-190, 3990])
    ax[i][0].set_ylim([-245, 5145])
Ejemplo n.º 3
0
    3600,
    'GWh - AEP of the layout as\nmeasured by rectangle rule\nwith n=100 directions',
    fontsize=20)
ax[0][6].text(
    2800,
    -2000,
    'The number of wind directions used\nto calculate AEP in the optimization',
    fontsize=20)
ax[0][0].text(0, 6000, 'polynomial chaos', fontsize=24)
ax[1][0].text(0, 6000, 'rectangle rule', fontsize=24)
fig.tight_layout()
plt.savefig('optimization_results.pdf')

samples_dakota = np.array([5, 10, 15, 20, 30, 40])
samples_rect = np.array([5, 10, 15, 20, 30, 40, 66, 100])
fig, ax = plt.subplots()
prettify.set_color_cycle(ax)
prettify.remove_junk(ax)
ax.plot(samples_rect, rect_mu, 'o-', label='rectangle rule', linewidth=2)
ax.plot(samples_dakota, dakota_mu, '-o', label='polynomial chaos', linewidth=2)
ax.set_xlim(-2, 102)
ax.set_ylim(689, 731)
ax.legend(loc=2, frameon=False, fontsize=16)
ax.set_xlabel('number of wind directions', fontsize=16)
ax.set_ylabel('optimized AEP (GWh)', fontsize=16)
ax.tick_params(axis='both', which='major', labelsize=14)
fig.tight_layout()

plt.savefig('PC_vs_rect_opt_AEP.pdf')
plt.show()
Ejemplo n.º 4
0
# Clear the last grids
ax[0][7].set_axis_off()
ax[0][8].set_axis_off()

ax[0][6].text(5000, 3600, 'GWh - AEP of the layout as\nmeasured by rectangle rule\nwith n=100 directions', fontsize=20)
ax[0][6].text(2800, -2000, 'The number of wind directions used\nto calculate AEP in the optimization', fontsize=20)
ax[0][0].text(0, 6000, 'polynomial chaos', fontsize=24)
ax[1][0].text(0, 6000, 'rectangle rule', fontsize=24)
fig.tight_layout()
plt.savefig('optimization_results.pdf')


samples_dakota = np.array([5,10,15,20,30,40])
samples_rect = np.array([5,10,15,20,30,40,66,100])
fig, ax = plt.subplots()
prettify.set_color_cycle(ax)
prettify.remove_junk(ax)
ax.plot(samples_rect, rect_mu, 'o-', label='rectangle rule', linewidth=2)
ax.plot(samples_dakota, dakota_mu, '-o', label='polynomial chaos', linewidth=2)
ax.set_xlim(-2,102)
ax.set_ylim(689,731)
ax.legend(loc=2, frameon=False, fontsize=16)
ax.set_xlabel('number of wind directions', fontsize=16)
ax.set_ylabel('optimized AEP (GWh)', fontsize=16)
ax.tick_params(axis='both', which='major', labelsize=14)
fig.tight_layout()

plt.savefig('PC_vs_rect_opt_AEP.pdf')
plt.show()