Skip to content

Commit

Permalink
Merge pull request #22 from edwardoughton/update_vis
Browse files Browse the repository at this point in the history
Update vis
  • Loading branch information
edwardoughton committed Sep 5, 2019
2 parents 3e98605 + 15796c6 commit 11d2435
Show file tree
Hide file tree
Showing 2 changed files with 107 additions and 118 deletions.
11 changes: 7 additions & 4 deletions scripts/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -660,13 +660,14 @@ def write_cost_lookup_table(results, environment, site_radius,
'ran_sector_antenna_costs_km2',
'ran_remote_radio_unit_costs_km2',
'ran_baseband_unit_costs_km2',
'ran_router_costs_km2',
'site_rental_km2',
'civil_tower_costs_km2',
'civil_material_costs_km2',
'civil_transportation_costs_km2',
'civil_installation_costs_km2',
'power_system_costs_km2',
'backhaul_fiber_backhaul_costs_km2',
'backhaul_router_costs_km2',
)
)
else:
Expand All @@ -688,13 +689,14 @@ def write_cost_lookup_table(results, environment, site_radius,
result['sector_antenna_costs_km2'],
result['remote_radio_unit_costs_km2'],
result['baseband_unit_costs_km2'],
result['router_costs_km2'],
result['site_rental_km2'],
result['tower_costs_km2'],
result['civil_material_costs_km2'],
result['transportation_costs_km2'],
result['installation_costs_km2'],
result['power_system_costs_km2'],
result['fiber_backhaul_costs_km2'],
result['router_costs_km2'],
)
)

Expand Down Expand Up @@ -871,7 +873,7 @@ def run_simulator(simulation_parameters, spectrum_portfolio,
if __name__ == '__main__':

SIMULATION_PARAMETERS = {
'iterations': 100,
'iterations': 20,
'seed_value1': 1,
'seed_value2': 2,
'indoor_users_percentage': 50,
Expand Down Expand Up @@ -916,6 +918,7 @@ def run_simulator(simulation_parameters, spectrum_portfolio,
(1.8, 10, '4G'),
(2.6, 10, '4G'),
(3.5, 40, '5G'),
(26, 100, '5G'),
]

ANT_HEIGHT = [
Expand Down Expand Up @@ -964,7 +967,7 @@ def generate_site_radii(min, max, increment):
for n in range(min, max, increment):
yield n

INCREMENT = (200, 1000, 500)
INCREMENT = (200, 10000, 200)

SITE_RADII = {
'urban':
Expand Down
214 changes: 100 additions & 114 deletions vis/vis.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,61 +49,13 @@ def load_in_all_main_lut():
return output


def plotting_function1(data):

data_subset = data[['sites_per_km2','frequency_GHz','path_loss_dB', 'received_power_dB',
'interference_dB', 'sinr_dB', 'spectral_efficiency_bps_hz', 'capacity_mbps_km2']]

data_subset.columns = ['Density (km^2)', 'Frequency (GHz)', 'Path Loss',
'Received Power', 'Interference', 'SINR', 'SE',
'Channel Capacity']

long_data = pd.melt(data_subset,
id_vars=['Density (km^2)', 'Frequency (GHz)'],
value_vars=['Path Loss', 'Received Power', 'Interference', 'SINR', 'SE',
'Channel Capacity'])

long_data.columns = ['Density (km^2)', 'Frequency (GHz)', 'Metric', 'Value']

long_data['Frequency (GHz)'] = long_data['Frequency (GHz)'].astype(str) + 'GHz'

sns.set(font_scale=1.1)

plot = sns.catplot(x='Density (km^2)', y='Value', hue="Frequency (GHz)", kind="bar",
col="Metric", col_wrap=2, data=long_data, palette=sns.color_palette("husl", 5),
sharey=False, sharex=False, legend="full")

handles = plot._legend_data.values()
labels = plot._legend_data.keys()
plot._legend.remove()
plot.fig.legend(handles=handles, labels=labels, loc='lower center', ncol=5)

plot.axes[0].set_ylabel('Path Loss (dB)')
plot.axes[1].set_ylabel('Received Power (dBm)')
plot.axes[2].set_ylabel('Interference (dBm)')
plot.axes[3].set_ylabel('SINR (dB)')
plot.axes[4].set_ylabel('SE (Bps/Hz)')
plot.axes[5].set_ylabel('Capacity (Mbps/km^2)')

plot.axes[0].set_xlabel('Site Density (km^2)')
plot.axes[1].set_xlabel('Site Density (km^2)')
plot.axes[2].set_xlabel('Site Density (km^2)')
plot.axes[3].set_xlabel('Site Density (km^2)')
plot.axes[4].set_xlabel('Site Density (km^2)')
plot.axes[5].set_xlabel('Site Density (km^2)')

plt.subplots_adjust(hspace=0.3, wspace=0.3, bottom=0.07)

plot.savefig(DATA_OUTPUT + '/frequency_capacity_barplot_area.png')

return print('completed (frequency) barplot (area)')


def plotting_function1_isd(data):

data['capacity_mbps_km2_log'] = np.log(data['capacity_mbps_km2'])

data_subset = data[['inter_site_distance_km','frequency_GHz','path_loss_dB',
'received_power_dB', 'interference_dB', 'sinr_dB', 'spectral_efficiency_bps_hz',
'capacity_mbps_km2']]
'capacity_mbps_km2_log']]

data_subset.columns = ['Inter-Site Distance (km)', 'Frequency (GHz)', 'Path Loss',
'Received Power', 'Interference', 'SINR', 'SE',
Expand All @@ -120,22 +72,22 @@ def plotting_function1_isd(data):
sns.set(font_scale=1.1)

plot = sns.relplot(x="Inter-Site Distance (km)", y='Value', hue="Frequency (GHz)",
col="Metric", col_wrap=2, palette=sns.color_palette("husl", 5),
col="Metric", col_wrap=2, palette=sns.color_palette("husl", 6),
kind="line", data=long_data,
facet_kws=dict(sharex=False, sharey=False),
legend="full")

handles = plot._legend_data.values()
labels = plot._legend_data.keys()
plot._legend.remove()
plot.fig.legend(handles=handles, labels=labels, loc='lower center', ncol=6)
plot.fig.legend(handles=handles, labels=labels, loc='lower center', ncol=7)

plot.axes[0].set_ylabel('Path Loss (dB)')
plot.axes[1].set_ylabel('Received Power (dBm)')
plot.axes[2].set_ylabel('Interference (dBm)')
plot.axes[3].set_ylabel('SINR (dB)')
plot.axes[4].set_ylabel('SE (Bps/Hz)')
plot.axes[5].set_ylabel('Capacity (Mbps km^2)')
plot.axes[5].set_ylabel('Logged Capacity (Mbps km^2)')

plot.axes[0].set_xlabel('Inter-Site Distance (km)')
plot.axes[1].set_xlabel('Inter-Site Distance (km)')
Expand Down Expand Up @@ -210,16 +162,26 @@ def load_summary_lut(max_isd_distance):

output['inter_site_distance_km'] = output['inter_site_distance_m'] / 1e3

output = output[['inter_site_distance_km', 'site_area_km2', 'sites_per_km2',
'capacity_mbps_km2', 'capacity_mbps',
'environment',
output['capacity_mbps_km2_log'] = np.log(output['capacity_mbps_km2'])

output = output[['inter_site_distance_km',
#'site_area_km2',
# 'sites_per_km2',
'capacity_mbps_km2',
'capacity_mbps_km2_log',#'capacity_mbps',
'strategy',
#'environment',
'ran_sector_antenna_costs_km2',
'ran_remote_radio_unit_costs_km2', 'ran_baseband_unit_costs_km2',
'ran_router_costs_km2', 'civil_tower_costs_km2',
'civil_material_costs_km2', 'civil_transportation_costs_km2',
'civil_installation_costs_km2', 'power_battery_system_costs_km2',
'ran_remote_radio_unit_costs_km2',
'ran_baseband_unit_costs_km2',
'site_rental_km2',
'civil_tower_costs_km2',
'civil_material_costs_km2',
'civil_transportation_costs_km2',
'civil_installation_costs_km2',
'power_system_costs_km2',
'backhaul_fiber_backhaul_costs_km2',
'backhaul_microwave_backhaul_1m_costs_km2'
'backhaul_router_costs_km2'
]]

output = output.reset_index().reset_index(drop=True)
Expand All @@ -233,42 +195,50 @@ def generate_long_data(data, x_axis_metric_lower, x_axis_metric_final):

output = data[[
x_axis_metric_lower,
'strategy',
'capacity_mbps_km2',
'environment',
'ran_sector_antenna_costs_km2',
'ran_remote_radio_unit_costs_km2', 'ran_baseband_unit_costs_km2',
'ran_router_costs_km2', 'civil_tower_costs_km2',
'civil_material_costs_km2', 'civil_transportation_costs_km2',
'civil_installation_costs_km2', 'power_battery_system_costs_km2',
'ran_remote_radio_unit_costs_km2',
'ran_baseband_unit_costs_km2',
'site_rental_km2',
'civil_tower_costs_km2',
'civil_material_costs_km2',
'civil_transportation_costs_km2',
'civil_installation_costs_km2',
'power_system_costs_km2',
'backhaul_fiber_backhaul_costs_km2',
'backhaul_microwave_backhaul_1m_costs_km2'
'backhaul_router_costs_km2'
]]

output = pd.melt(output,
id_vars=[x_axis_metric_lower, 'environment'],
id_vars=[x_axis_metric_lower, 'strategy', 'capacity_mbps_km2'],
value_vars=[
'ran_sector_antenna_costs_km2',
'ran_remote_radio_unit_costs_km2',
'ran_baseband_unit_costs_km2',
'ran_router_costs_km2', 'civil_tower_costs_km2',
'civil_material_costs_km2', 'civil_transportation_costs_km2',
'civil_installation_costs_km2', 'power_battery_system_costs_km2',
'site_rental_km2',
'civil_tower_costs_km2',
'civil_material_costs_km2',
'civil_transportation_costs_km2',
'civil_installation_costs_km2',
'power_system_costs_km2',
'backhaul_fiber_backhaul_costs_km2',
'backhaul_microwave_backhaul_1m_costs_km2'
'backhaul_router_costs_km2'
])

output.columns = ['x_axis_value', 'Environment', 'Component', 'gross_value']
output.columns = ['ISD', 'Strategy', 'Capacity', 'Component', 'gross_value']

output['Value'] = round(output['gross_value'] / 1000)
output['Cost'] = round(output['gross_value'] / 1000)

output = output[['x_axis_value', 'Environment', 'Component', 'Value']]
output = output[['ISD', 'Strategy', 'Capacity', 'Component', 'Cost']]

output['Metric'] = output['Component'].str.split("_", n = 1, expand = True) [0]
output['Metric'] = output['Component'].str.split("_", n = 1, expand = True)[0]

output = output.replace(
{
'Metric':{
'ran': 'RAN',
'site': 'Site',
'civil': 'Civil works',
'power': 'Power',
'backhaul': 'Backhaul',
Expand All @@ -278,50 +248,68 @@ def generate_long_data(data, x_axis_metric_lower, x_axis_metric_final):

output = output.replace(
{
'Environment':{
'urban': 'Urban',
'suburban': 'Suburban',
'rural': 'Rural',
'Strategy':{
'baseline': 'Baseline (No Sharing)',
'passive_site_sharing': 'Passive (Site Sharing)',
'passive_backhaul_sharing': 'Passive (Backhaul Sharing)',
'active_moran': 'Active (Multi Operator RAN)',
}
}
)

return output


def plotting_function3(data):

data_isd = generate_long_data(data, 'inter_site_distance_km', 'ISD')
data_isd['Density Metric'] = 'ISD (km)'

#'site_area_km2', 'sites_per_km2',
data_density = generate_long_data(data, 'sites_per_km2', 'Site Density (km^2)')
data_density['Density Metric'] = 'Site Density (km^2)'

all_data = pd.concat([data_isd, data_density], axis= 0)

all_data['x_axis_value'] = round(all_data['x_axis_value'], 3)

bins = [0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5]
all_data['x_axis_value_binned'] = pd.cut(all_data['x_axis_value'], bins)

plot = sns.catplot(x='x_axis_value_binned', y='Value', hue="Metric", kind='bar',
row="Environment", col='Density Metric',# col_wrap=1,
data=all_data, palette=sns.color_palette("husl", 5),
sharey=True, sharex=False, legend="full")
data = generate_long_data(data, 'inter_site_distance_km', 'ISD')

data['ISD'] = round(data['ISD'], 3)

bins = [0, 1, 2, 3, 4, 5]
data['ISD_binned'] = pd.cut(data['ISD'], bins, labels=["1", "2", "3", "4", "5"])

bins = [100, 200, 300]
data['Capacity'] = pd.cut(data['Capacity'], bins)
# print(data.Capacity.unique())
# plot = sns.relplot(x="ISD", y="Value", hue="Metric", size="Capacity",
# col="Strategy", col_wrap=2,
# # hue_order=['(200, 300]', '(100, 200]'],
# # sizes=(40, 400),
# # alpha=.5,
# # palette="muted",
# # height=6,
# data=data)

plot = sns.catplot(x='ISD_binned', y='Cost',
hue="Metric",
# size="Capacity",
col="Strategy", col_wrap=2,
# hue_order=['RAN','Site','Civil Works', 'Power', 'Backhaul'],
kind='bar',
data=data,
palette=sns.color_palette("husl", 10),
sharex=False,
sharey=False,
legend="full"
)

plot.set_xticklabels(rotation=45)
handles = plot._legend_data.values()
labels = plot._legend_data.keys()
plot._legend.remove()
plot.fig.legend(handles=handles, labels=labels,
loc='lower center', ncol=6)

plot.axes[0,0].set_ylabel('Cost (USD$k)')
plot.axes[1,0].set_ylabel('Cost (USD$k)')
plot.axes[2,0].set_ylabel('Cost (USD$k)')
plot.axes[0].set_ylabel('Cost (USD$k km^2)')
plot.axes[1].set_ylabel('Cost (USD$k km^2)')
plot.axes[2].set_ylabel('Cost (USD$k km^2)')
plot.axes[3].set_ylabel('Cost (USD$k km^2)')

plot.axes[0,1].set_xlabel('')
plot.axes[1,1].set_xlabel('')
plot.axes[2,1].set_xlabel('')
plot.axes[2,0].set_xlabel('')
plot.axes[0].set_xlabel('ISD (km)')
plot.axes[1].set_xlabel('ISD (km)')
plot.axes[2].set_xlabel('ISD (km)')
plot.axes[3].set_xlabel('ISD (km)')

plt.subplots_adjust(hspace=0.4, wspace=0.05, bottom=0.3)
plt.subplots_adjust(hspace=0.3, wspace=0.2, bottom=0.12)

plot.savefig(DATA_OUTPUT + '/costs_capacity_barplot_isd_density.png')

Expand All @@ -330,13 +318,11 @@ def plotting_function3(data):

if __name__ == '__main__':

# data = load_in_all_main_lut()

# plotting_function1(data)
data = load_in_all_main_lut()

# plotting_function1_isd(data)
plotting_function1_isd(data)

# plotting_function2(data)
plotting_function2(data)

max_isd_distance = 10

Expand Down

0 comments on commit 11d2435

Please sign in to comment.