{ "cells": [ { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "# RA2CE feature: Multi-link losses analysis" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Multi-link losses Analysis" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from pathlib import Path\n", "from ra2ce.ra2ce_handler import Ra2ceHandler\n", "\n", "# Import config data\n", "root_dir_multi = Path(\"data\", \"multi_link_losses\")\n", "assert root_dir_multi.exists()\n", "\n", "# Load network data.\n", "from ra2ce.network.network_config_data.network_config_data_reader import NetworkConfigDataReader\n", "_network_config_data = NetworkConfigDataReader().read(root_dir_multi.joinpath(\"network.ini\"))\n", "\n", "# Load analysis data.\n", "from ra2ce.analysis.analysis_config_data.analysis_config_data_reader import AnalysisConfigDataReader\n", "_analysis_config_data = AnalysisConfigDataReader().read(root_dir_multi.joinpath(\"analysis.ini\"))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Modify the analysis config data with custom properties" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from ra2ce.analysis.analysis_config_data.analysis_config_data import AnalysisSectionLosses\n", "\n", "# Modify the first analysis (assuming it's the only one)\n", "_found_analysis: AnalysisSectionLosses = _analysis_config_data.analyses[0]\n", "_input_analysis_path = root_dir_multi.joinpath(\"input_analysis_data\")\n", "_found_analysis.traffic_intensities_file = _input_analysis_path.joinpath(\"traffic_intensities.csv\")\n", "_found_analysis.resilience_curves_file = _input_analysis_path.joinpath(\"resilience_curve.csv\")\n", "_found_analysis.values_of_time_file = _input_analysis_path.joinpath(\"values_of_time.csv\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Run the analysis" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "handler = Ra2ceHandler.from_config(_network_config_data, _analysis_config_data)\n", "\n", "handler.configure()\n", "handler.run_analysis()" ] } ], "metadata": { "kernelspec": { "display_name": "ra2ce_env", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.13" } }, "nbformat": 4, "nbformat_minor": 2 }