RA2CE feature: Multi-link losses analysis#
Multi-link losses Analysis#
[ ]:
from pathlib import Path
import geopandas as gpd
from ra2ce.ra2ce_handler import Ra2ceHandler
# Import config data
root_dir_multi = Path("data", "multi_link_losses")
assert root_dir_multi.exists()
# Load network data.
from ra2ce.network.network_config_data.network_config_data_reader import NetworkConfigDataReader
_network_config_data = NetworkConfigDataReader().read(root_dir_multi.joinpath("network.ini"))
# Load analysis data.
from ra2ce.analysis.analysis_config_data.analysis_config_data_reader import AnalysisConfigDataReader
_analysis_config_data = AnalysisConfigDataReader().read(root_dir_multi.joinpath("analysis.ini"))
Modify the analysis config data with custom properties#
[2]:
from ra2ce.analysis.analysis_config_data.analysis_config_data import AnalysisSectionLosses
# Modify the first analysis (assuming it's the only one)
_found_analysis: AnalysisSectionLosses = _analysis_config_data.analyses[0]
_input_analysis_path = root_dir_multi.joinpath("input_analysis_data")
_found_analysis.traffic_intensities_file = _input_analysis_path.joinpath("traffic_intensities.csv")
_found_analysis.resilience_curves_file = _input_analysis_path.joinpath("resilience_curve.csv")
_found_analysis.values_of_time_file = _input_analysis_path.joinpath("values_of_time.csv")
Run the analysis#
[ ]:
handler = Ra2ceHandler.from_config(_network_config_data, _analysis_config_data)
handler.configure()
handler.run_analysis()
Let’s inspect the results of the analysis. For every segment in the network, the losses are expressed in vehicle loss hour (vlh) for all the types of trip defined in the input files: business, commute, freight and other.
[ ]:
analysis_output_folder = root_dir_multi / "output" / "multi_link_losses" # specify path to output folder
losses_gdf = gpd.read_file(analysis_output_folder/"beira_multi_link_losses.gpkg") #specify the name of the geopackage holding your results (can be found in the analysis output folder)
losses_gdf.head() #display the attributes of the file
losses_roads_map = losses_gdf.explore(column='vlh_EV1_ma_total', tiles="CartoDB positron",)
display(losses_roads_map)