Skip to content

Commit

Permalink
before release
Browse files Browse the repository at this point in the history
  • Loading branch information
Sven Eggimann authored and Sven Eggimann committed May 8, 2018
1 parent f077920 commit dc26ad0
Show file tree
Hide file tree
Showing 7 changed files with 302 additions and 295 deletions.
30 changes: 14 additions & 16 deletions energy_demand/geography/weather_region.py
Expand Up @@ -275,55 +275,52 @@ def __init__(
shape_y_dh=tech_lp['rs_profile_hp_y_dh'],
shape_peak_dh=tech_lp['rs_lp_heating_hp_dh']['peakday'])



# flat lp
rs_profile_hp_y_dh = flat_shape_y_dh

flat_rs_fuel_shape_hp_yh, rs_hp_shape_yd = get_fuel_shape_heating_hp_yh(
rs_fuel_shape_hp_yh, rs_hp_shape_yd = get_fuel_shape_heating_hp_yh(
rs_profile_hp_y_dh,
self.rs_tech_stock,
self.rs_hdd_cy,
assumptions.model_yeardays)
#else:
# not flat lp
rs_fuel_shape_hp_yh, rs_hp_shape_yd = get_fuel_shape_heating_hp_yh(
rs_profile_hp_y_dh,

# Flat lp
flat_rs_fuel_shape_hp_yh, rs_hp_shape_yd = get_fuel_shape_heating_hp_yh(
flat_shape_y_dh,
self.rs_tech_stock,
self.rs_hdd_cy,
assumptions.model_yeardays)



#TODO Info: Same load for space and water heating for HP
if assumptions.strategy_variables['flat_heat_pump_profile_both']['scenario_value']:
flat_space_heating = True
flat_water_heating = True
elif assumptions.strategy_variables['flat_heat_pump_profile_only_water']['scenario_value']:
flat_space_heating = False
flat_water_heating = False
flat_water_heating = True
else:
flat_space_heating = False
flat_water_heating = False

if flat_water_heating and flat_space_heating: #Improve
if flat_water_heating and flat_space_heating:
# Flat load profiles for water and space heating
self.rs_load_profiles.add_lp(
unique_identifier=uuid.uuid4(),
technologies=assumptions.tech_list['heating_non_const'],
enduses=['rs_space_heating', 'rs_water_heating'],
shape_y_dh=rs_profile_hp_y_dh,
shape_y_dh=flat_shape_y_dh,
shape_yd=rs_hp_shape_yd,
shape_yh=flat_rs_fuel_shape_hp_yh,
model_yeardays=assumptions.model_yeardays)
elif flat_water_heating and not flat_space_heating:

# Flat load profiles for water heating
self.rs_load_profiles.add_lp(
unique_identifier=uuid.uuid4(),
technologies=assumptions.tech_list['heating_non_const'],
enduses=['rs_water_heating'],
shape_y_dh=rs_profile_hp_y_dh,
shape_y_dh=flat_shape_y_dh,
shape_yd=rs_hp_shape_yd,
shape_yh=flat_rs_fuel_shape_hp_yh,
model_yeardays=assumptions.model_yeardays)

self.rs_load_profiles.add_lp(
unique_identifier=uuid.uuid4(),
technologies=assumptions.tech_list['heating_non_const'],
Expand All @@ -333,6 +330,7 @@ def __init__(
shape_yh=rs_fuel_shape_hp_yh,
model_yeardays=assumptions.model_yeardays)
else:
# No flat load profile
self.rs_load_profiles.add_lp(
unique_identifier=uuid.uuid4(),
technologies=assumptions.tech_list['heating_non_const'],
Expand Down
13 changes: 5 additions & 8 deletions energy_demand/plotting/plotting_multiple_scenarios.py
Expand Up @@ -6,14 +6,10 @@
import collections
import numpy as np
import matplotlib.pyplot as plt
import logging

from energy_demand.plotting import plotting_styles
from energy_demand.plotting import plotting_program
from energy_demand.basic import conversions
from energy_demand.plotting import plotting_results
from energy_demand.basic import lookup_tables
from energy_demand.technologies import tech_related
from energy_demand import enduse_func
from energy_demand.profiles import load_factors

Expand Down Expand Up @@ -848,8 +844,7 @@ def plot_radar_plots_average_peak_day(
fueltype_to_model,
fueltypes,
year_to_plot,
fig_name,
plotshow
fig_name
):
"""Compare averaged dh profile overall regions for peak day
for future year and base year
Expand All @@ -869,7 +864,7 @@ def plot_radar_plots_average_peak_day(

for scenario_cnt, scenario in enumerate(scenario_data):

print("scenario {} {} ".format(scenario, fueltype_to_model))
print("-------Scenario: {} {}".format(scenario, fueltype_to_model))
base_yr = 2015

# Future year load profile
Expand Down Expand Up @@ -900,7 +895,9 @@ def plot_radar_plots_average_peak_day(
label_max_h = "scen: {} by: {} cy: {} d: {}".format(
scenario, round(by_max_h, 2), round(cy_max_h, 2), round(diff_max_h, 2))
list_diff_max_h.append(label_max_h)
print("Calculation of diff in peak: {} {} {} {}".format(scenario, round(diff_max_h, 2), round(by_max_h, 2), round(cy_max_h, 2)))

print("Calculation of diff in peak: {} {} {} {}".format(
scenario, round(diff_max_h, 2), round(by_max_h, 2), round(cy_max_h, 2)))

# ----------------------------------
# Plot dh for peak day for base year
Expand Down
57 changes: 26 additions & 31 deletions energy_demand/plotting/plotting_results.py
Expand Up @@ -2057,7 +2057,12 @@ def plot_radar_plot_multiple_lines(
for i in range(nr_of_plot_steps * 2):
minor_ticks.append(minor_tick_interval * i)

# Colors with scenarios
color_scenarios = plotting_styles.color_list_scenarios()

# Colors for plotting Fig. 13
color_scenarios = plotting_styles.color_list_selection()

color_lines = ['black'] + color_scenarios
years = ['2015', '2050']
linewidth_list = [1.0, 0.7]
Expand Down Expand Up @@ -2123,16 +2128,6 @@ def plot_radar_plot_multiple_lines(
# Draw ylabels (numbers)
ax.set_rlabel_position(0)

# Remove last and first element
'''if len(axis_plots_inner) == 2:
axis_plots_inner = axis_plots_inner[1:]
axis_plots_innter_position = axis_plots_innter_position[1:]
elif len(axis_plots_inner) > 2:
axis_plots_inner = axis_plots_inner[1:1]
axis_plots_innter_position = axis_plots_innter_position[1:1]
else:
pass'''

# Working alternative
plt.yticks(
axis_plots_inner,
Expand All @@ -2155,7 +2150,7 @@ def plot_radar_plot_multiple_lines(
# Plot data
ax.plot(
angles_smoothed,
values_smoothed,
values_smoothed,
color=color_line,
linestyle=linestyle_list[cnt_year],
linewidth=linewidth_list[cnt_year],
Expand All @@ -2181,12 +2176,7 @@ def plot_radar_plot_multiple_lines(
# ------------
# Title
# ------------
font_additional_info = plotting_styles.font_info()
font_additional_info['size'] = 4

#title_info = " lf_y_by: {} lf_y_cy: {}".format(
# lf_y_by,
# lf_y_cy)
font_additional_info = plotting_styles.font_info(size=4)
#plt.title(
# title_info,
# loc='left',
Expand All @@ -2196,12 +2186,11 @@ def plot_radar_plot_multiple_lines(
# Legend
# ------------
plt.legend(
ncol=2,
#loc='best',
bbox_to_anchor=(0.6, -0.1),
ncol=1,
bbox_to_anchor=(0.5, -0.1),
prop={
'family': 'arial',
'size': 5},
'size': 4},
frameon=False)

plt.savefig(fig_name)
Expand Down Expand Up @@ -2625,6 +2614,8 @@ def plot_cross_graphs_scenarios(
'blue',
'darkolivegreen',
'firebrick']'''
all_x_values = []
all_y_values = []

for scenario_nr, scenario in enumerate(all_scenarios):

Expand Down Expand Up @@ -2659,6 +2650,8 @@ def plot_cross_graphs_scenarios(
#y_val_national_lf_demand_cy = [national_tot_demand_p]
y_val_national_lf_demand_cy = [national_peak_h_p]

all_x_values += x_values
all_y_values += y_values
# -------------------------------------
# Plot
# -------------------------------------
Expand Down Expand Up @@ -2736,18 +2729,20 @@ def plot_cross_graphs_scenarios(
# -------
# Title information
# -------
max_peak_h = max(x_values)
min_peak_h = min(x_values)
min_lf = min(y_values)
max_lf = max(y_values)
max_lf = round(max(all_x_values), 2)
min_lf = round(min(all_x_values), 2)
min_peak_h = round(min(all_y_values), 2)
max_peak_h = round(max(all_y_values), 2)

font_additional_info = plotting_styles.font_info(size=4)

plt.title(
"max_peak_h: {} min_peak_h: {}, min_lf: {} max_lf: {}",
max_peak_h,
min_peak_h,
min_lf,
max_lf,
fontsize=10)
"max_peak_h: {} min_peak_h: {}, min_lf: {} max_lf: {}".format(
max_peak_h,
min_peak_h,
min_lf,
max_lf),
fontdict=font_additional_info)

# --------
# Legend
Expand Down

0 comments on commit dc26ad0

Please sign in to comment.