{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Multiple runs" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Perform Multiple Optimization Runs with EnergyScope\n", "\n", "In this tutorial, we will demonstrate how to perform multiple optimization runs using the EnergyScope model. This is useful for sensitivity analysis, scenario exploration, and understanding how changes in parameters affect the energy system configuration.\n", "\n", "### Import Necessary Libraries\n", "\n", "We begin by importing the required libraries and modules:" ] }, { "cell_type": "code", "metadata": { "ExecuteTime": { "end_time": "2025-03-17T14:52:48.069855Z", "start_time": "2025-03-17T14:52:47.943040Z" } }, "source": [ "import pandas as pd\n", "import pickle \n", "from energyscope.energyscope import Energyscope\n", "from energyscope.models import infrastructure_ch_2050\n", "from energyscope.result import postprocessing\n", "from energyscope.plots import plot_sankey, plot_parametrisation" ], "outputs": [], "execution_count": 1 }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "\n", "- **`pandas`**: For data manipulation and handling data frames.\n", "- **`pickle`**: For saving and loading Python objects to and from files.\n", "- **`Energyscope`**: The main class for initializing and running the EnergyScope model.\n", "- **`infrastructure_ch_2050`**: A predefined model configuration focusing on energy infrastructure In Switzerland in 2050.\n", "- **`postprocessing`**: Functions for processing and analyzing results after optimization.\n", "- **`plot_sankey`**, **`plot_parametrisation`**: Functions for visualizing results.\n", "\n", "### Define Solver Options\n", "\n", "We specify the solver options to control the optimization process:" ] }, { "cell_type": "code", "metadata": { "ExecuteTime": { "end_time": "2025-03-17T14:52:48.072059Z", "start_time": "2025-03-17T14:52:48.070532Z" } }, "source": [ "solver_options = {\n", " 'solver': 'gurobi',\n", " 'solver_msg': 0,\n", "}" ], "outputs": [], "execution_count": 2 }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "\n", "- **`'solver': 'gurobi'`**: Specifies that the Gurobi solver should be used.\n", "- **`'solver_msg': 0`**: Suppresses solver messages during execution.\n", "\n", "### Initialize and Run the Base Model\n", "\n", "We initialize the EnergyScope model with the chosen dataset and solver options:" ] }, { "cell_type": "code", "metadata": { "ExecuteTime": { "end_time": "2025-03-17T14:52:48.074121Z", "start_time": "2025-03-17T14:52:48.072574Z" } }, "source": [ "# Load the model with the chosen dataset and solver options\n", "es_infra_ch = Energyscope(model=infrastructure_ch_2050, solver_options=solver_options)" ], "outputs": [], "execution_count": 3 }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "\n", "Then, we perform an initial calculation to ensure the model is set up correctly:" ] }, { "cell_type": "code", "metadata": { "ExecuteTime": { "end_time": "2025-03-17T14:52:49.069638Z", "start_time": "2025-03-17T14:52:48.074719Z" } }, "source": [ "# Solve the model\n", "results_ch = es_infra_ch.calc()" ], "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Gurobi 11.0.3: " ] } ], "execution_count": 4 }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "\n", "> **Note**: This initial run is optional but recommended to verify that the model and solver are functioning properly before proceeding to multiple runs.\n", "\n", "### Load Parameter Sequence Data\n", "\n", "We load a sequence of parameters from an Excel file, which will be used to perform multiple optimization runs:" ] }, { "cell_type": "code", "metadata": { "ExecuteTime": { "end_time": "2025-03-17T14:52:49.139340Z", "start_time": "2025-03-17T14:52:49.070403Z" } }, "source": [ "# Load the parameter sequence DataFrame\n", "seq_data = pd.read_excel(\"tutorial_input/param_run_es_n_infrastructure_ch_2050.xlsx\")\n", "display(seq_data)" ], "outputs": [ { "data": { "text/plain": [ " param index0 index1 index2 index3 \\\n", "0 f_min PV NaN NaN NaN \n", "1 f_max PV NaN NaN NaN \n", "2 end_uses_demand_year MOBILITY_FREIGHT TRANSPORTATION NaN NaN \n", "3 c_inv WIND NaN NaN NaN \n", "\n", " value1 value2 value3 value4 value5 value6 value7 \\\n", "0 2 2.60 5.20 7.80 10.40 13.00 15.60 \n", "1 2 2.60 5.20 7.80 10.40 13.00 15.60 \n", "2 45000 33226.71 33226.71 33226.71 33226.71 33226.71 33226.71 \n", "3 800 850.00 900.00 950.00 1000.00 1050.00 1100.00 \n", "\n", " value8 value9 value10 value11 \n", "0 18.20 20.80 23.40 26.00 \n", "1 18.20 20.80 23.40 26.00 \n", "2 33226.71 33226.71 33226.71 33226.71 \n", "3 1150.00 1200.00 1250.00 1300.00 " ], "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
paramindex0index1index2index3value1value2value3value4value5value6value7value8value9value10value11
0f_minPVNaNNaNNaN22.605.207.8010.4013.0015.6018.2020.8023.4026.00
1f_maxPVNaNNaNNaN22.605.207.8010.4013.0015.6018.2020.8023.4026.00
2end_uses_demand_yearMOBILITY_FREIGHTTRANSPORTATIONNaNNaN4500033226.7133226.7133226.7133226.7133226.7133226.7133226.7133226.7133226.7133226.71
3c_invWINDNaNNaNNaN800850.00900.00950.001000.001050.001100.001150.001200.001250.001300.00
\n", "
" ] }, "metadata": {}, "output_type": "display_data" } ], "execution_count": 5 }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "\n", "- **`seq_data`**: A DataFrame containing different sets of parameters for each run.\n", "- **`display(seq_data)`**: Displays the DataFrame to inspect the parameters being varied.\n", "\n", "### Perform Multiple Optimization Runs\n", "\n", "We use the `calc_sequence` method to run the model multiple times based on the parameter changes specified in `seq_data`:" ] }, { "cell_type": "code", "metadata": { "ExecuteTime": { "end_time": "2025-03-17T14:52:59.468649Z", "start_time": "2025-03-17T14:52:49.140035Z" } }, "source": [ "# Run multiple optimizations based on parameters changed in seq_data\n", "results_ch_n = es_infra_ch.calc_sequence(seq_data)" ], "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Gurobi 11.0.3: Run 1 complete.\n", "Gurobi 11.0.3: Run 2 complete.\n", "Gurobi 11.0.3: Run 3 complete.\n", "Gurobi 11.0.3: Run 4 complete.\n", "Gurobi 11.0.3: Run 5 complete.\n", "Gurobi 11.0.3: Run 6 complete.\n", "Gurobi 11.0.3: Run 7 complete.\n", "Gurobi 11.0.3: Run 8 complete.\n", "Gurobi 11.0.3: Run 9 complete.\n", "Gurobi 11.0.3: Run 10 complete.\n", "Gurobi 11.0.3: Run 11 complete.\n" ] } ], "execution_count": 6 }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "\n", "- **`results_ch_n`**: A `Result` object that contains the outputs of all runs.\n", "\n", "### Post-Process the Results\n", "\n", "After obtaining the results from multiple runs, we apply post-processing to compute Key Performance Indicators (KPIs) and prepare the data for visualization:" ] }, { "cell_type": "code", "metadata": { "ExecuteTime": { "end_time": "2025-03-17T14:52:59.525452Z", "start_time": "2025-03-17T14:52:59.469453Z" } }, "source": [ "# Postcompute KPIs\n", "results_ch_n = postprocessing(results_ch_n)" ], "outputs": [], "execution_count": 7 }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "\n", "### Visualize Results with Sankey Diagrams\n", "\n", "We can visualize the energy flows for specific runs using Sankey diagrams.\n", "\n", "#### Generate and Display Sankey Diagram for Run 1" ] }, { "cell_type": "code", "metadata": { "ExecuteTime": { "end_time": "2025-03-17T14:52:59.765876Z", "start_time": "2025-03-17T14:52:59.526158Z" } }, "source": [ "# Generate the Sankey diagram for run 1\n", "fig = plot_sankey(results_ch_n, run_id=1)\n", "fig.show()" ], "outputs": [ { "data": { "text/html": [ " \n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/vnd.plotly.v1+json": { "data": [ { "link": { "color": [ "rgba(181, 31, 31, 0.50)", "rgba(181, 31, 31, 0.50)", "rgba(181, 31, 31, 0.50)", "rgba(181, 31, 31, 0.50)", "rgba(255, 225, 0, 0.50)", "rgba(181, 31, 31, 0.50)", "rgba(181, 31, 31, 0.50)", "rgba(181, 31, 31, 0.50)", "rgba(255, 225, 0, 0.50)", "rgba(179, 123, 68, 0.50)", "rgba(205, 133, 63, 0.50)", "rgba(181, 31, 31, 0.50)", "rgba(181, 31, 31, 0.50)", "rgba(181, 31, 31, 0.50)", "rgba(0, 0, 0, 0.50)", "rgba(0, 206, 209, 0.50)", "rgba(0, 0, 0, 0.50)", "rgba(0, 206, 209, 0.50)", "rgba(0, 0, 0, 0.50)", "rgba(0, 0, 255, 0.50)", "rgba(250, 128, 114, 0.50)", "rgba(250, 128, 114, 0.50)", "rgba(250, 128, 114, 0.50)", "rgba(0, 206, 209, 0.50)", "rgba(205, 133, 63, 0.50)", "rgba(0, 0, 0, 0.50)", "rgba(0, 0, 0, 0.50)", "rgba(0, 0, 0, 0.50)", "rgba(0, 0, 0, 0.50)", "rgba(0, 0, 0, 0.50)", "rgba(0, 0, 0, 0.50)", "rgba(0, 191, 255, 0.50)", "rgba(0, 191, 255, 0.50)", "rgba(0, 191, 255, 0.50)", "rgba(0, 191, 255, 0.50)", "rgba(0, 191, 255, 0.50)", "rgba(0, 191, 255, 0.50)", "rgba(0, 191, 255, 0.50)", "rgba(0, 191, 255, 0.50)", "rgba(0, 191, 255, 0.50)", "rgba(0, 191, 255, 0.50)", "rgba(0, 191, 255, 0.50)", "rgba(0, 191, 255, 0.50)", "rgba(0, 191, 255, 0.50)", "rgba(0, 191, 255, 0.50)", "rgba(0, 191, 255, 0.50)", "rgba(0, 191, 255, 0.50)", "rgba(0, 191, 255, 0.50)", "rgba(0, 191, 255, 0.50)", "rgba(0, 191, 255, 0.50)", "rgba(0, 191, 255, 0.50)", "rgba(0, 191, 255, 0.50)", "rgba(0, 191, 255, 0.50)", "rgba(255, 215, 0, 0.50)", "rgba(255, 225, 0, 0.50)", "rgba(255, 215, 0, 0.50)" ], "label": [ 38548.4876, 9158.674243356207, 15277.116458613333, 4.260304609864107E-4, 5850.597700374788, 712.0177401356117, 434.20087200000034, 434.20087200000034, 5284.745762711866, 12471.999999999998, 7906.497732286486, 1621.0913131864368, 3123.0668452745654, 11466.754973403391, 9158.674243356207, 16580.16, 902.88, 16122.6096, 3606.3732, 40299.36, 1976.9208564308597, 6940.079143569139, 8917.0, 12472.000000000004, 7906.497732286488, 4239.54083, 520.5841569600001, 1919.9472004999996, 2458.8000000000006, 1994.8719692999996, 1028.6999999999996, 5822.675819038101, 11466.754973403391, 12848.21091708, 3819.279114653333, 1.6793819824027878E-4, 16580.16, 211.38983050847463, 16122.6096, 1387.890906040017, 902.88, 3606.3732, 1982.1599999999999, 1299.584785864683, 40299.36, 8895.76, 25871.84, 7403.6, 4239.54083, 520.5841569600001, 1919.9472004999996, 4453.6719693000005, 1028.6999999999996, 11135.343463086652, 11135.34346308665, 11135.34346308665 ], "source": [ 16, 7, 16, 29, 13, 13, 14, 17, 19, 21, 22, 0, 4, 8, 30, 31, 31, 31, 31, 32, 37, 37, 38, 39, 41, 1, 3, 5, 35, 35, 36, 2, 9, 9, 9, 9, 18, 19, 20, 4, 25, 26, 28, 28, 40, 9, 9, 9, 9, 9, 9, 9, 9, 27, 33, 34 ], "target": [ 15, 15, 15, 15, 33, 14, 17, 15, 33, 39, 41, 14, 14, 14, 7, 18, 25, 20, 26, 40, 0, 4, 37, 19, 13, 24, 24, 24, 23, 24, 23, 9, 8, 16, 16, 6, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 11, 12, 1, 3, 5, 35, 36, 2, 34, 27 ], "value": [ 38548.4876, 9158.674243356207, 15277.116458613333, 4.260304609864107E-4, 5850.597700374788, 712.0177401356117, 434.20087200000034, 434.20087200000034, 5284.745762711866, 12471.999999999998, 7906.497732286486, 1621.0913131864368, 3123.0668452745654, 11466.754973403391, 9158.674243356207, 16580.16, 902.88, 16122.6096, 3606.3732, 40299.36, 1976.9208564308597, 6940.079143569139, 8917.0, 12472.000000000004, 7906.497732286488, 4239.54083, 520.5841569600001, 1919.9472004999996, 2458.8000000000006, 1994.8719692999996, 1028.6999999999996, 5822.675819038101, 11466.754973403391, 12848.21091708, 3819.279114653333, 1.6793819824027878E-4, 16580.16, 211.38983050847463, 16122.6096, 1387.890906040017, 902.88, 3606.3732, 1982.1599999999999, 1299.584785864683, 40299.36, 8895.76, 25871.84, 7403.6, 4239.54083, 520.5841569600001, 1919.9472004999996, 4453.6719693000005, 1028.6999999999996, 11135.343463086652, 11135.34346308665, 11135.34346308665 ] }, "node": { "color": "#DCDCDC", "label": [ "BOILER", "CAR", "CCGT_CC", "COACH", "COGEN", "COMMUTER", "DEEP_SALINE", "DHN_DEEP_GEO", "DIRECT_ELEC", "ELECTRICITY", "EUD_ELECTRICITY_HV", "EUD_ELECTRICITY_LV", "EUD_ELECTRICITY_MV", "GASIFICATION_SNG", "HEAT_HIGH_T", "HEAT_LOW_T", "HP", "HT_LT", "HYDRO_DAM", "HYDRO_GAS", "HYDRO_RIVER", "IMP_WET_BIOMASS", "IMP_WOOD", "MOBILITY", "MOBILITY_PASSENGER", "NEW_HYDRO_DAM", "NEW_HYDRO_RIVER", "NG", "PV", "RENOVATION", "RES_GEO", "RES_HYDRO", "RES_WIND", "SNG", "SNG_NG", "TRAIN", "TRUCK", "WASTE", "WASTE_BIO", "WET_BIOMASS", "WIND", "WOOD" ], "line": { "color": "black", "width": 0.5 }, "pad": 15, "thickness": 15 }, "valueformat": ".0f", "valuesuffix": "", "type": "sankey" } ], "layout": { "template": { "data": { "histogram2dcontour": [ { "type": "histogram2dcontour", "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0.0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1.0, "#f0f921" ] ] } ], "choropleth": [ { "type": "choropleth", "colorbar": { "outlinewidth": 0, "ticks": "" } } ], "histogram2d": [ { "type": "histogram2d", "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0.0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1.0, "#f0f921" ] ] } ], "heatmap": [ { "type": "heatmap", "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0.0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1.0, "#f0f921" ] ] } ], "heatmapgl": [ { "type": "heatmapgl", "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0.0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1.0, "#f0f921" ] ] } ], "contourcarpet": [ { "type": "contourcarpet", "colorbar": { "outlinewidth": 0, "ticks": "" } } ], "contour": [ { "type": "contour", "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0.0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1.0, "#f0f921" ] ] } ], "surface": [ { "type": "surface", "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0.0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1.0, "#f0f921" ] ] } ], "mesh3d": [ { "type": "mesh3d", "colorbar": { "outlinewidth": 0, "ticks": "" } } ], "scatter": [ { "fillpattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 }, "type": "scatter" } ], "parcoords": [ { "type": "parcoords", "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } } } ], "scatterpolargl": [ { "type": "scatterpolargl", "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } } } ], "bar": [ { "error_x": { "color": "#2a3f5f" }, "error_y": { "color": "#2a3f5f" }, "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "bar" } ], "scattergeo": [ { "type": "scattergeo", "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } } } ], "scatterpolar": [ { "type": "scatterpolar", "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } } } ], "histogram": [ { "marker": { "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "histogram" } ], "scattergl": [ { "type": "scattergl", "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } } } ], "scatter3d": [ { "type": "scatter3d", "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } } } ], "scattermapbox": [ { "type": "scattermapbox", "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } } } ], "scatterternary": [ { "type": "scatterternary", "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } } } ], "scattercarpet": [ { "type": "scattercarpet", "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } } } ], "carpet": [ { "aaxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "baxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "type": "carpet" } ], "table": [ { "cells": { "fill": { "color": "#EBF0F8" }, "line": { "color": "white" } }, "header": { "fill": { "color": "#C8D4E3" }, "line": { "color": "white" } }, "type": "table" } ], "barpolar": [ { "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "barpolar" } ], "pie": [ { "automargin": true, "type": "pie" } ] }, "layout": { "autotypenumbers": "strict", "colorway": [ "#636efa", "#EF553B", "#00cc96", "#ab63fa", "#FFA15A", "#19d3f3", "#FF6692", "#B6E880", "#FF97FF", "#FECB52" ], "font": { "color": "#2a3f5f" }, "hovermode": "closest", "hoverlabel": { "align": "left" }, "paper_bgcolor": "white", "plot_bgcolor": "#E5ECF6", "polar": { "bgcolor": "#E5ECF6", "angularaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "radialaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "ternary": { "bgcolor": "#E5ECF6", "aaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "baxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "caxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "coloraxis": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "colorscale": { "sequential": [ [ 0.0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1.0, "#f0f921" ] ], "sequentialminus": [ [ 0.0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1.0, "#f0f921" ] ], "diverging": [ [ 0, "#8e0152" ], [ 0.1, "#c51b7d" ], [ 0.2, "#de77ae" ], [ 0.3, "#f1b6da" ], [ 0.4, "#fde0ef" ], [ 0.5, "#f7f7f7" ], [ 0.6, "#e6f5d0" ], [ 0.7, "#b8e186" ], [ 0.8, "#7fbc41" ], [ 0.9, "#4d9221" ], [ 1, "#276419" ] ] }, "xaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "automargin": true, "zerolinewidth": 2 }, "yaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "automargin": true, "zerolinewidth": 2 }, "scene": { "xaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white", "gridwidth": 2 }, "yaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white", "gridwidth": 2 }, "zaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white", "gridwidth": 2 } }, "shapedefaults": { "line": { "color": "#2a3f5f" } }, "annotationdefaults": { "arrowcolor": "#2a3f5f", "arrowhead": 0, "arrowwidth": 1 }, "geo": { "bgcolor": "white", "landcolor": "#E5ECF6", "subunitcolor": "white", "showland": true, "showlakes": true, "lakecolor": "white" }, "title": { "x": 0.05 }, "mapbox": { "style": "light" } } }, "title": { "text": "Sankey Diagram" }, "font": { "size": 10, "color": "black" } }, "config": { "plotlyServerURL": "https://plot.ly" } }, "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "execution_count": 8 }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "\n", "- **`run_id=1`**: Specifies that we want to visualize the results from the first run.\n", "\n", "#### Generate and Display Sankey Diagram for Run 11" ] }, { "cell_type": "code", "metadata": { "ExecuteTime": { "end_time": "2025-03-17T14:52:59.802623Z", "start_time": "2025-03-17T14:52:59.766480Z" } }, "source": [ "# Generate the Sankey diagram for run 11\n", "fig = plot_sankey(results_ch_n, run_id=11)\n", "fig.show()" ], "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "data": [ { "link": { "color": [ "rgba(181, 31, 31, 0.50)", "rgba(181, 31, 31, 0.50)", "rgba(181, 31, 31, 0.50)", "rgba(181, 31, 31, 0.50)", "rgba(181, 31, 31, 0.50)", "rgba(181, 31, 31, 0.50)", "rgba(211, 211, 211, 0.50)", "rgba(211, 211, 211, 0.50)", "rgba(211, 211, 211, 0.50)", "rgba(181, 31, 31, 0.50)", "rgba(211, 211, 211, 0.50)", "rgba(181, 31, 31, 0.50)", "rgba(181, 31, 31, 0.50)", "rgba(181, 31, 31, 0.50)", "rgba(255, 225, 0, 0.50)", "rgba(179, 123, 68, 0.50)", "rgba(205, 133, 63, 0.50)", "rgba(181, 31, 31, 0.50)", "rgba(181, 31, 31, 0.50)", "rgba(181, 31, 31, 0.50)", "rgba(0, 0, 0, 0.50)", "rgba(0, 206, 209, 0.50)", "rgba(0, 206, 209, 0.50)", "rgba(0, 0, 0, 0.50)", "rgba(0, 0, 255, 0.50)", "rgba(211, 211, 211, 0.50)", "rgba(250, 128, 114, 0.50)", "rgba(250, 128, 114, 0.50)", "rgba(250, 128, 114, 0.50)", "rgba(0, 206, 209, 0.50)", "rgba(205, 133, 63, 0.50)", "rgba(0, 0, 0, 0.50)", "rgba(0, 0, 0, 0.50)", "rgba(0, 0, 0, 0.50)", "rgba(0, 0, 0, 0.50)", "rgba(0, 0, 0, 0.50)", "rgba(0, 0, 0, 0.50)", "rgba(211, 211, 211, 0.50)", "rgba(0, 191, 255, 0.50)", "rgba(0, 191, 255, 0.50)", "rgba(0, 191, 255, 0.50)", "rgba(0, 191, 255, 0.50)", "rgba(0, 191, 255, 0.50)", "rgba(0, 191, 255, 0.50)", "rgba(0, 191, 255, 0.50)", "rgba(0, 191, 255, 0.50)", "rgba(0, 191, 255, 0.50)", "rgba(0, 191, 255, 0.50)", "rgba(0, 191, 255, 0.50)", "rgba(0, 191, 255, 0.50)", "rgba(0, 191, 255, 0.50)", "rgba(0, 191, 255, 0.50)", "rgba(0, 191, 255, 0.50)", "rgba(0, 191, 255, 0.50)", "rgba(0, 191, 255, 0.50)", "rgba(0, 191, 255, 0.50)", "rgba(0, 191, 255, 0.50)", "rgba(0, 191, 255, 0.50)", "rgba(255, 215, 0, 0.50)", "rgba(255, 215, 0, 0.50)", "rgba(255, 215, 0, 0.50)", "rgba(255, 215, 0, 0.50)", "rgba(255, 215, 0, 0.50)", "rgba(255, 225, 0, 0.50)", "rgba(255, 215, 0, 0.50)", "rgba(255, 215, 0, 0.50)" ], "label": [ 38548.99149429136, 0.3563930158476304, 0.1456570722530616, 3640.401387846197, 18121.739021169742, 6.851050982619076E-4, 825.0105514861057, 825.0105514861059, 825.0105514861057, 2673.650033878966, 6775.793095538685, 1526.9646354687472, 434.2008719999991, 434.2008719999991, 5284.745762711864, 12472.0, 15278.000000000004, 1844.9895507468752, 3000.1958612474955, 13604.710095474378, 3640.401387846197, 16122.6096, 16580.16, 0.3563930158476304, 27924.62441529818, 825.0105514861059, 6667.035242864184, 2249.964757135814, 8917.0, 12471.999999999996, 15278.000000000004, 4239.540829999999, 520.5841569600002, 1919.9472004999996, 1366.5620760173772, 1994.8719692999994, 6775.793095538686, 6775.793095538686, 2763.3450218006565, 13604.710095474378, 12848.37886504731, 4530.4347552924355, 3.454052819993215E-4, 218.1378050669639, 221.53116736208952, 16580.16, 211.38983050847457, 16122.6096, 1333.2870407383868, 25768.08, 27924.62441529818, 8895.76, 25871.84, 7403.6, 4239.540829999999, 520.5841569600002, 1919.9472004999996, 3361.4340453173763, 697.5469985964089, 5284.648653141793, 0.09710957007111616, 697.5469985964089, 697.5469985964089, 5284.745762711864, 5284.745762711864, 697.5469985964089 ], "source": [ 21, 7, 21, 9, 21, 34, 10, 11, 12, 18, 18, 19, 19, 22, 24, 26, 27, 0, 4, 13, 35, 36, 36, 37, 38, 41, 45, 45, 46, 47, 49, 1, 3, 5, 43, 43, 44, 10, 2, 14, 14, 14, 14, 14, 14, 23, 24, 25, 4, 33, 48, 14, 14, 14, 14, 14, 14, 14, 30, 30, 30, 31, 32, 39, 40, 42 ], "target": [ 20, 20, 20, 20, 20, 20, 12, 41, 11, 20, 10, 6, 22, 20, 39, 47, 49, 19, 19, 19, 9, 25, 23, 7, 48, 10, 4, 0, 45, 24, 18, 29, 29, 29, 28, 29, 28, 44, 14, 13, 21, 21, 8, 6, 18, 14, 14, 14, 14, 14, 14, 15, 16, 17, 1, 3, 5, 43, 32, 2, 21, 42, 31, 40, 30, 30 ], "value": [ 38548.99149429136, 0.3563930158476304, 0.1456570722530616, 3640.401387846197, 18121.739021169742, 6.851050982619076E-4, 825.0105514861057, 825.0105514861059, 825.0105514861057, 2673.650033878966, 6775.793095538685, 1526.9646354687472, 434.2008719999991, 434.2008719999991, 5284.745762711864, 12472.0, 15278.000000000004, 1844.9895507468752, 3000.1958612474955, 13604.710095474378, 3640.401387846197, 16122.6096, 16580.16, 0.3563930158476304, 27924.62441529818, 825.0105514861059, 6667.035242864184, 2249.964757135814, 8917.0, 12471.999999999996, 15278.000000000004, 4239.540829999999, 520.5841569600002, 1919.9472004999996, 1366.5620760173772, 1994.8719692999994, 6775.793095538686, 6775.793095538686, 2763.3450218006565, 13604.710095474378, 12848.37886504731, 4530.4347552924355, 3.454052819993215E-4, 218.1378050669639, 221.53116736208952, 16580.16, 211.38983050847457, 16122.6096, 1333.2870407383868, 25768.08, 27924.62441529818, 8895.76, 25871.84, 7403.6, 4239.540829999999, 520.5841569600002, 1919.9472004999996, 3361.4340453173763, 697.5469985964089, 5284.648653141793, 0.09710957007111616, 697.5469985964089, 697.5469985964089, 5284.745762711864, 5284.745762711864, 697.5469985964089 ] }, "node": { "color": "#DCDCDC", "label": [ "BOILER", "CAR", "CCGT_CC", "COACH", "COGEN", "COMMUTER", "DAC_LT", "DEC_SOLAR", "DEEP_SALINE", "DHN_DEEP_GEO", "DIESEL", "DIESEL_S", "DIE_STO", "DIRECT_ELEC", "ELECTRICITY", "EUD_ELECTRICITY_HV", "EUD_ELECTRICITY_LV", "EUD_ELECTRICITY_MV", "FT", "HEAT_HIGH_T", "HEAT_LOW_T", "HP", "HT_LT", "HYDRO_DAM", "HYDRO_GAS", "HYDRO_RIVER", "IMP_WET_BIOMASS", "IMP_WOOD", "MOBILITY", "MOBILITY_PASSENGER", "NG", "NG_S", "NG_STO", "PV", "RENOVATION", "RES_GEO", "RES_HYDRO", "RES_SOLAR", "RES_WIND", "SNG", "SNG_NG", "STO_DIE", "STO_NG", "TRAIN", "TRUCK", "WASTE", "WASTE_BIO", "WET_BIOMASS", "WIND", "WOOD" ], "line": { "color": "black", "width": 0.5 }, "pad": 15, "thickness": 15 }, "valueformat": ".0f", "valuesuffix": "", "type": "sankey" } ], "layout": { "template": { "data": { "histogram2dcontour": [ { "type": "histogram2dcontour", "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0.0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1.0, "#f0f921" ] ] } ], "choropleth": [ { "type": "choropleth", "colorbar": { "outlinewidth": 0, "ticks": "" } } ], "histogram2d": [ { "type": "histogram2d", "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0.0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1.0, "#f0f921" ] ] } ], "heatmap": [ { "type": "heatmap", "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0.0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1.0, "#f0f921" ] ] } ], "heatmapgl": [ { "type": "heatmapgl", "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0.0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1.0, "#f0f921" ] ] } ], "contourcarpet": [ { "type": "contourcarpet", "colorbar": { "outlinewidth": 0, "ticks": "" } } ], "contour": [ { "type": "contour", "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0.0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1.0, "#f0f921" ] ] } ], "surface": [ { "type": "surface", "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0.0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1.0, "#f0f921" ] ] } ], "mesh3d": [ { "type": "mesh3d", "colorbar": { "outlinewidth": 0, "ticks": "" } } ], "scatter": [ { "fillpattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 }, "type": "scatter" } ], "parcoords": [ { "type": "parcoords", "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } } } ], "scatterpolargl": [ { "type": "scatterpolargl", "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } } } ], "bar": [ { "error_x": { "color": "#2a3f5f" }, "error_y": { "color": "#2a3f5f" }, "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "bar" } ], "scattergeo": [ { "type": "scattergeo", "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } } } ], "scatterpolar": [ { "type": "scatterpolar", "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } } } ], "histogram": [ { "marker": { "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "histogram" } ], "scattergl": [ { "type": "scattergl", "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } } } ], "scatter3d": [ { "type": "scatter3d", "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } } } ], "scattermapbox": [ { "type": "scattermapbox", "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } } } ], "scatterternary": [ { "type": "scatterternary", "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } } } ], "scattercarpet": [ { "type": "scattercarpet", "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } } } ], "carpet": [ { "aaxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "baxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "type": "carpet" } ], "table": [ { "cells": { "fill": { "color": "#EBF0F8" }, "line": { "color": "white" } }, "header": { "fill": { "color": "#C8D4E3" }, "line": { "color": "white" } }, "type": "table" } ], "barpolar": [ { "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "barpolar" } ], "pie": [ { "automargin": true, "type": "pie" } ] }, "layout": { "autotypenumbers": "strict", "colorway": [ "#636efa", "#EF553B", "#00cc96", "#ab63fa", "#FFA15A", "#19d3f3", "#FF6692", "#B6E880", "#FF97FF", "#FECB52" ], "font": { "color": "#2a3f5f" }, "hovermode": "closest", "hoverlabel": { "align": "left" }, "paper_bgcolor": "white", "plot_bgcolor": "#E5ECF6", "polar": { "bgcolor": "#E5ECF6", "angularaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "radialaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "ternary": { "bgcolor": "#E5ECF6", "aaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "baxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "caxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "coloraxis": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "colorscale": { "sequential": [ [ 0.0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1.0, "#f0f921" ] ], "sequentialminus": [ [ 0.0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1.0, "#f0f921" ] ], "diverging": [ [ 0, "#8e0152" ], [ 0.1, "#c51b7d" ], [ 0.2, "#de77ae" ], [ 0.3, "#f1b6da" ], [ 0.4, "#fde0ef" ], [ 0.5, "#f7f7f7" ], [ 0.6, "#e6f5d0" ], [ 0.7, "#b8e186" ], [ 0.8, "#7fbc41" ], [ 0.9, "#4d9221" ], [ 1, "#276419" ] ] }, "xaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "automargin": true, "zerolinewidth": 2 }, "yaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "automargin": true, "zerolinewidth": 2 }, "scene": { "xaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white", "gridwidth": 2 }, "yaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white", "gridwidth": 2 }, "zaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white", "gridwidth": 2 } }, "shapedefaults": { "line": { "color": "#2a3f5f" } }, "annotationdefaults": { "arrowcolor": "#2a3f5f", "arrowhead": 0, "arrowwidth": 1 }, "geo": { "bgcolor": "white", "landcolor": "#E5ECF6", "subunitcolor": "white", "showland": true, "showlakes": true, "lakecolor": "white" }, "title": { "x": 0.05 }, "mapbox": { "style": "light" } } }, "title": { "text": "Sankey Diagram" }, "font": { "size": 10, "color": "black" } }, "config": { "plotlyServerURL": "https://plot.ly" } }, "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "execution_count": 9 }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "\n", "- **`run_id=11`**: Visualizes the results from the eleventh run.\n", "\n", "> **Optional**: You can save the generated Sankey diagrams as HTML files or images by uncommenting and modifying the following lines:" ] }, { "cell_type": "code", "metadata": { "ExecuteTime": { "end_time": "2025-03-17T14:52:59.806392Z", "start_time": "2025-03-17T14:52:59.804970Z" } }, "source": [ "# Save the generated Sankey diagram as an HTML file\n", "# fig.write_html(\"tutorial_output/Sankey_results_ch_1.html\")\n", "\n", "# Save the generated Sankey diagram as an image\n", "# fig.write_image('tutorial_output/Sankey_results_ch_1.png')" ], "outputs": [], "execution_count": 10 }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "\n", "### Analyze Parametrization Results\n", "\n", "We can further analyze how the changes in parameters affect the results using the `plot_parametrisation` function.\n", "\n", "#### Inspect Annual Results DataFrame" ] }, { "cell_type": "code", "metadata": { "ExecuteTime": { "end_time": "2025-03-17T14:52:59.811830Z", "start_time": "2025-03-17T14:52:59.806974Z" } }, "source": [ "# Display a sample from the annual results DataFrame\n", "display(results_ch_n.postprocessing['df_annual'].sample())" ], "outputs": [ { "data": { "text/plain": [ " C_inv C_maint Annual_Prod F_Mult tau C_op \\\n", " Run \n", "METHANE_TO_METHANOL 7 0.0 0.0 0.0 0.0 0.062433 0.0 \n", "\n", " C_inv_an Annual_Use Category Category_2 Sector \n", " Run \n", "METHANE_TO_METHANOL 7 0.0 0.0 Others Industry Others " ], "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
C_invC_maintAnnual_ProdF_MulttauC_opC_inv_anAnnual_UseCategoryCategory_2Sector
Run
METHANE_TO_METHANOL70.00.00.00.00.0624330.00.00.0OthersIndustryOthers
\n", "
" ] }, "metadata": {}, "output_type": "display_data" } ], "execution_count": 11 }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "\n", "- Displays a random sample from the annual results DataFrame for inspection.\n", "\n", "#### Plot Investment Costs by Sector" ] }, { "cell_type": "code", "metadata": { "ExecuteTime": { "end_time": "2025-03-17T14:52:59.945882Z", "start_time": "2025-03-17T14:52:59.812442Z" } }, "source": [ "# Plot annualized investment costs aggregated by sector\n", "plot_parametrisation(results=results_ch_n, variable=\"C_inv_an\", category=\"Sector\", \n", " labels = {\"Run\": \"Simulation Run\",\"C_inv_an\": \"Annualized investment costs [MCHF/y]\"})" ], "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "data": [ { "fillpattern": { "shape": "" }, "hovertemplate": "Sector=Domestic Heat
Simulation Run=%{x}
Annualized investment costs [MCHF/y]=%{y}", "legendgroup": "Domestic Heat", "line": { "color": "#1F77B4" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "Domestic Heat", "orientation": "v", "showlegend": true, "stackgroup": "1", "x": [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ], "xaxis": "x", "y": [ 744.2583566896311, 744.2583566896311, 709.4960869660656, 703.7231343763057, 693.4909222297684, 660.826131776772, 673.3635221668984, 686.2379596346959, 687.4808707025605, 687.4808707025636, 687.480870702559 ], "yaxis": "y", "type": "scatter" }, { "fillpattern": { "shape": "" }, "hovertemplate": "Sector=Electricity
Simulation Run=%{x}
Annualized investment costs [MCHF/y]=%{y}", "legendgroup": "Electricity", "line": { "color": "#FF7F0E" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "Electricity", "orientation": "v", "showlegend": true, "stackgroup": "1", "x": [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ], "xaxis": "x", "y": [ 3720.5608970541202, 3750.0141910454913, 3887.1511276471847, 3966.803951468049, 4081.8473936338814, 4240.1088901767325, 4343.244019000886, 4448.126409445342, 4560.906914663374, 4669.94089030537, 4776.434418571071 ], "yaxis": "y", "type": "scatter" }, { "fillpattern": { "shape": "" }, "hovertemplate": "Sector=Industrial Heat
Simulation Run=%{x}
Annualized investment costs [MCHF/y]=%{y}", "legendgroup": "Industrial Heat", "line": { "color": "#2CA02C" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "Industrial Heat", "orientation": "v", "showlegend": true, "stackgroup": "1", "x": [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ], "xaxis": "x", "y": [ 112.57201968581916, 112.61328738237103, 113.2731918098319, 113.48948615631265, 113.99099930508297, 114.17128223726608, 114.34670388309257, 114.70672734951765, 117.86151549545816, 122.13311531192477, 127.30021675987963 ], "yaxis": "y", "type": "scatter" }, { "fillpattern": { "shape": "" }, "hovertemplate": "Sector=Mobility
Simulation Run=%{x}
Annualized investment costs [MCHF/y]=%{y}", "legendgroup": "Mobility", "line": { "color": "#D62728" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "Mobility", "orientation": "v", "showlegend": true, "stackgroup": "1", "x": [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ], "xaxis": "x", "y": [ 235.85173800995022, 226.93399462442395, 228.57142696937237, 229.52868446382087, 236.61702191913076, 240.90632862842327, 242.26808067910775, 242.26808067910778, 242.2680806791074, 242.26808067910775, 242.2680806791078 ], "yaxis": "y", "type": "scatter" }, { "fillpattern": { "shape": "" }, "hovertemplate": "Sector=Others
Simulation Run=%{x}
Annualized investment costs [MCHF/y]=%{y}", "legendgroup": "Others", "line": { "color": "#9467BD" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "Others", "orientation": "v", "showlegend": true, "stackgroup": "1", "x": [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ], "xaxis": "x", "y": [ 1354.8752800586137, 1350.550306650175, 1341.689680701846, 1346.91669325061, 1343.4735185991974, 1352.0734865327668, 1360.068262616446, 1367.7294369172303, 1375.6205516875166, 1383.5690358045981, 1391.4809757300147 ], "yaxis": "y", "type": "scatter" } ], "layout": { "template": { "data": { "barpolar": [ { "marker": { "line": { "color": "white", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "barpolar" } ], "bar": [ { "error_x": { "color": "rgb(36,36,36)" }, "error_y": { "color": "rgb(36,36,36)" }, "marker": { "line": { "color": "white", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "bar" } ], "carpet": [ { "aaxis": { "endlinecolor": "rgb(36,36,36)", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "rgb(36,36,36)" }, "baxis": { "endlinecolor": "rgb(36,36,36)", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "rgb(36,36,36)" }, "type": "carpet" } ], "choropleth": [ { "colorbar": { "outlinewidth": 1, "tickcolor": "rgb(36,36,36)", "ticks": "outside" }, "type": "choropleth" } ], "contourcarpet": [ { "colorbar": { "outlinewidth": 1, "tickcolor": "rgb(36,36,36)", "ticks": "outside" }, "type": "contourcarpet" } ], "contour": [ { "colorbar": { "outlinewidth": 1, "tickcolor": "rgb(36,36,36)", "ticks": "outside" }, "colorscale": [ [ 0.0, "#440154" ], [ 0.1111111111111111, "#482878" ], [ 0.2222222222222222, "#3e4989" ], [ 0.3333333333333333, "#31688e" ], [ 0.4444444444444444, "#26828e" ], [ 0.5555555555555556, "#1f9e89" ], [ 0.6666666666666666, "#35b779" ], [ 0.7777777777777778, "#6ece58" ], [ 0.8888888888888888, "#b5de2b" ], [ 1.0, "#fde725" ] ], "type": "contour" } ], "heatmapgl": [ { "colorbar": { "outlinewidth": 1, "tickcolor": "rgb(36,36,36)", "ticks": "outside" }, "colorscale": [ [ 0.0, "#440154" ], [ 0.1111111111111111, "#482878" ], [ 0.2222222222222222, "#3e4989" ], [ 0.3333333333333333, "#31688e" ], [ 0.4444444444444444, "#26828e" ], [ 0.5555555555555556, "#1f9e89" ], [ 0.6666666666666666, "#35b779" ], [ 0.7777777777777778, "#6ece58" ], [ 0.8888888888888888, "#b5de2b" ], [ 1.0, "#fde725" ] ], "type": "heatmapgl" } ], "heatmap": [ { "colorbar": { "outlinewidth": 1, "tickcolor": "rgb(36,36,36)", "ticks": "outside" }, "colorscale": [ [ 0.0, "#440154" ], [ 0.1111111111111111, "#482878" ], [ 0.2222222222222222, "#3e4989" ], [ 0.3333333333333333, "#31688e" ], [ 0.4444444444444444, "#26828e" ], [ 0.5555555555555556, "#1f9e89" ], [ 0.6666666666666666, "#35b779" ], [ 0.7777777777777778, "#6ece58" ], [ 0.8888888888888888, "#b5de2b" ], [ 1.0, "#fde725" ] ], "type": "heatmap" } ], "histogram2dcontour": [ { "colorbar": { "outlinewidth": 1, "tickcolor": "rgb(36,36,36)", "ticks": "outside" }, "colorscale": [ [ 0.0, "#440154" ], [ 0.1111111111111111, "#482878" ], [ 0.2222222222222222, "#3e4989" ], [ 0.3333333333333333, "#31688e" ], [ 0.4444444444444444, "#26828e" ], [ 0.5555555555555556, "#1f9e89" ], [ 0.6666666666666666, "#35b779" ], [ 0.7777777777777778, "#6ece58" ], [ 0.8888888888888888, "#b5de2b" ], [ 1.0, "#fde725" ] ], "type": "histogram2dcontour" } ], "histogram2d": [ { "colorbar": { "outlinewidth": 1, "tickcolor": "rgb(36,36,36)", "ticks": "outside" }, "colorscale": [ [ 0.0, "#440154" ], [ 0.1111111111111111, "#482878" ], [ 0.2222222222222222, "#3e4989" ], [ 0.3333333333333333, "#31688e" ], [ 0.4444444444444444, "#26828e" ], [ 0.5555555555555556, "#1f9e89" ], [ 0.6666666666666666, "#35b779" ], [ 0.7777777777777778, "#6ece58" ], [ 0.8888888888888888, "#b5de2b" ], [ 1.0, "#fde725" ] ], "type": "histogram2d" } ], "histogram": [ { "marker": { "line": { "color": "white", "width": 0.6 } }, "type": "histogram" } ], "mesh3d": [ { "colorbar": { "outlinewidth": 1, "tickcolor": "rgb(36,36,36)", "ticks": "outside" }, "type": "mesh3d" } ], "parcoords": [ { "line": { "colorbar": { "outlinewidth": 1, "tickcolor": "rgb(36,36,36)", "ticks": "outside" } }, "type": "parcoords" } ], "pie": [ { "automargin": true, "type": "pie" } ], "scatter3d": [ { "line": { "colorbar": { "outlinewidth": 1, "tickcolor": "rgb(36,36,36)", "ticks": "outside" } }, "marker": { "colorbar": { "outlinewidth": 1, "tickcolor": "rgb(36,36,36)", "ticks": "outside" } }, "type": "scatter3d" } ], "scattercarpet": [ { "marker": { "colorbar": { "outlinewidth": 1, "tickcolor": "rgb(36,36,36)", "ticks": "outside" } }, "type": "scattercarpet" } ], "scattergeo": [ { "marker": { "colorbar": { "outlinewidth": 1, "tickcolor": "rgb(36,36,36)", "ticks": "outside" } }, "type": "scattergeo" } ], "scattergl": [ { "marker": { "colorbar": { "outlinewidth": 1, "tickcolor": "rgb(36,36,36)", "ticks": "outside" } }, "type": "scattergl" } ], "scattermapbox": [ { "marker": { "colorbar": { "outlinewidth": 1, "tickcolor": "rgb(36,36,36)", "ticks": "outside" } }, "type": "scattermapbox" } ], "scatterpolargl": [ { "marker": { "colorbar": { "outlinewidth": 1, "tickcolor": "rgb(36,36,36)", "ticks": "outside" } }, "type": "scatterpolargl" } ], "scatterpolar": [ { "marker": { "colorbar": { "outlinewidth": 1, "tickcolor": "rgb(36,36,36)", "ticks": "outside" } }, "type": "scatterpolar" } ], "scatter": [ { "fillpattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 }, "type": "scatter" } ], "scatterternary": [ { "marker": { "colorbar": { "outlinewidth": 1, "tickcolor": "rgb(36,36,36)", "ticks": "outside" } }, "type": "scatterternary" } ], "surface": [ { "colorbar": { "outlinewidth": 1, "tickcolor": "rgb(36,36,36)", "ticks": "outside" }, "colorscale": [ [ 0.0, "#440154" ], [ 0.1111111111111111, "#482878" ], [ 0.2222222222222222, "#3e4989" ], [ 0.3333333333333333, "#31688e" ], [ 0.4444444444444444, "#26828e" ], [ 0.5555555555555556, "#1f9e89" ], [ 0.6666666666666666, "#35b779" ], [ 0.7777777777777778, "#6ece58" ], [ 0.8888888888888888, "#b5de2b" ], [ 1.0, "#fde725" ] ], "type": "surface" } ], "table": [ { "cells": { "fill": { "color": "rgb(237,237,237)" }, "line": { "color": "white" } }, "header": { "fill": { "color": "rgb(217,217,217)" }, "line": { "color": "white" } }, "type": "table" } ] }, "layout": { "annotationdefaults": { "arrowhead": 0, "arrowwidth": 1 }, "autotypenumbers": "strict", "coloraxis": { "colorbar": { "outlinewidth": 1, "tickcolor": "rgb(36,36,36)", "ticks": "outside" } }, "colorscale": { "diverging": [ [ 0.0, "rgb(103,0,31)" ], [ 0.1, "rgb(178,24,43)" ], [ 0.2, "rgb(214,96,77)" ], [ 0.3, "rgb(244,165,130)" ], [ 0.4, "rgb(253,219,199)" ], [ 0.5, "rgb(247,247,247)" ], [ 0.6, "rgb(209,229,240)" ], [ 0.7, "rgb(146,197,222)" ], [ 0.8, "rgb(67,147,195)" ], [ 0.9, "rgb(33,102,172)" ], [ 1.0, "rgb(5,48,97)" ] ], "sequential": [ [ 0.0, "#440154" ], [ 0.1111111111111111, "#482878" ], [ 0.2222222222222222, "#3e4989" ], [ 0.3333333333333333, "#31688e" ], [ 0.4444444444444444, "#26828e" ], [ 0.5555555555555556, "#1f9e89" ], [ 0.6666666666666666, "#35b779" ], [ 0.7777777777777778, "#6ece58" ], [ 0.8888888888888888, "#b5de2b" ], [ 1.0, "#fde725" ] ], "sequentialminus": [ [ 0.0, "#440154" ], [ 0.1111111111111111, "#482878" ], [ 0.2222222222222222, "#3e4989" ], [ 0.3333333333333333, "#31688e" ], [ 0.4444444444444444, "#26828e" ], [ 0.5555555555555556, "#1f9e89" ], [ 0.6666666666666666, "#35b779" ], [ 0.7777777777777778, "#6ece58" ], [ 0.8888888888888888, "#b5de2b" ], [ 1.0, "#fde725" ] ] }, "colorway": [ "#1F77B4", "#FF7F0E", "#2CA02C", "#D62728", "#9467BD", "#8C564B", "#E377C2", "#7F7F7F", "#BCBD22", "#17BECF" ], "font": { "color": "rgb(36,36,36)" }, "geo": { "bgcolor": "white", "lakecolor": "white", "landcolor": "white", "showlakes": true, "showland": true, "subunitcolor": "white" }, "hoverlabel": { "align": "left" }, "hovermode": "closest", "mapbox": { "style": "light" }, "paper_bgcolor": "white", "plot_bgcolor": "white", "polar": { "angularaxis": { "gridcolor": "rgb(232,232,232)", "linecolor": "rgb(36,36,36)", "showgrid": false, "showline": true, "ticks": "outside" }, "bgcolor": "white", "radialaxis": { "gridcolor": "rgb(232,232,232)", "linecolor": "rgb(36,36,36)", "showgrid": false, "showline": true, "ticks": "outside" } }, "scene": { "xaxis": { "backgroundcolor": "white", "gridcolor": "rgb(232,232,232)", "gridwidth": 2, "linecolor": "rgb(36,36,36)", "showbackground": true, "showgrid": false, "showline": true, "ticks": "outside", "zeroline": false, "zerolinecolor": "rgb(36,36,36)" }, "yaxis": { "backgroundcolor": "white", "gridcolor": "rgb(232,232,232)", "gridwidth": 2, "linecolor": "rgb(36,36,36)", "showbackground": true, "showgrid": false, "showline": true, "ticks": "outside", "zeroline": false, "zerolinecolor": "rgb(36,36,36)" }, "zaxis": { "backgroundcolor": "white", "gridcolor": "rgb(232,232,232)", "gridwidth": 2, "linecolor": "rgb(36,36,36)", "showbackground": true, "showgrid": false, "showline": true, "ticks": "outside", "zeroline": false, "zerolinecolor": "rgb(36,36,36)" } }, "shapedefaults": { "fillcolor": "black", "line": { "width": 0 }, "opacity": 0.3 }, "ternary": { "aaxis": { "gridcolor": "rgb(232,232,232)", "linecolor": "rgb(36,36,36)", "showgrid": false, "showline": true, "ticks": "outside" }, "baxis": { "gridcolor": "rgb(232,232,232)", "linecolor": "rgb(36,36,36)", "showgrid": false, "showline": true, "ticks": "outside" }, "bgcolor": "white", "caxis": { "gridcolor": "rgb(232,232,232)", "linecolor": "rgb(36,36,36)", "showgrid": false, "showline": true, "ticks": "outside" } }, "title": { "x": 0.05 }, "xaxis": { "automargin": true, "gridcolor": "rgb(232,232,232)", "linecolor": "rgb(36,36,36)", "showgrid": false, "showline": true, "ticks": "outside", "title": { "standoff": 15 }, "zeroline": false, "zerolinecolor": "rgb(36,36,36)" }, "yaxis": { "automargin": true, "gridcolor": "rgb(232,232,232)", "linecolor": "rgb(36,36,36)", "showgrid": false, "showline": true, "ticks": "outside", "title": { "standoff": 15 }, "zeroline": false, "zerolinecolor": "rgb(36,36,36)" } } }, "xaxis": { "anchor": "y", "domain": [ 0.0, 1.0 ], "title": { "text": "Simulation Run" } }, "yaxis": { "anchor": "x", "domain": [ 0.0, 1.0 ], "title": { "text": "Annualized investment costs [MCHF/y]" } }, "legend": { "title": { "text": "Sector" }, "tracegroupgap": 0 }, "margin": { "t": 60 } }, "config": { "plotlyServerURL": "https://plot.ly" } }, "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "execution_count": 12 }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "\n", "- **`variable=\"C_inv_an\"`**: Specifies that we want to plot annual investment costs.\n", "- **`category=\"Sector\"`**: Aggregates the costs by sector.\n", "\n", "#### Plot Investment Costs by Category\n" ] }, { "cell_type": "code", "metadata": { "ExecuteTime": { "end_time": "2025-03-17T14:52:59.993906Z", "start_time": "2025-03-17T14:52:59.946535Z" } }, "source": [ "# Plot annualized investment costs aggregated by category\n", "plot_parametrisation(results=results_ch_n, variable=\"C_inv_an\", category=\"Category\")" ], "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "data": [ { "fillpattern": { "shape": "" }, "hovertemplate": "Category=ELECTRICITY_EHV
Run=%{x}
C_inv_an=%{y}", "legendgroup": "ELECTRICITY_EHV", "line": { "color": "#1F77B4" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "ELECTRICITY_EHV", "orientation": "v", "showlegend": true, "stackgroup": "1", "x": [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ], "xaxis": "x", "y": [ 1537.418334035706, 1480.63980947611, 1480.63980947611, 1480.63980947611, 1480.6295771721861, 1480.623385383188, 1480.6214196386195, 1480.6214196386195, 1480.6214196386195, 1480.6214196386195, 1480.6214196386195 ], "yaxis": "y", "type": "scatter" }, { "fillpattern": { "shape": "" }, "hovertemplate": "Category=ELECTRICITY_HV
Run=%{x}
C_inv_an=%{y}", "legendgroup": "ELECTRICITY_HV", "line": { "color": "#FF7F0E" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "ELECTRICITY_HV", "orientation": "v", "showlegend": true, "stackgroup": "1", "x": [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ], "xaxis": "x", "y": [ 886.5731816202042, 878.9051341594278, 817.1365015490295, 813.425458400796, 804.8987978591344, 801.9228581188185, 802.0194770991218, 802.0725019244644, 802.1737168157837, 802.2781628483326, 802.3730022116611 ], "yaxis": "y", "type": "scatter" }, { "fillpattern": { "shape": "" }, "hovertemplate": "Category=ELECTRICITY_LV
Run=%{x}
C_inv_an=%{y}", "legendgroup": "ELECTRICITY_LV", "line": { "color": "#2CA02C" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "ELECTRICITY_LV", "orientation": "v", "showlegend": true, "stackgroup": "1", "x": [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ], "xaxis": "x", "y": [ 105.13894360047418, 136.652061566275, 273.2089060847453, 409.7657506032156, 546.3225951216859, 682.8794396401563, 819.4362841646, 955.9931295145699, 1092.5499738613864, 1229.106818379857, 1365.6636628983272 ], "yaxis": "y", "type": "scatter" }, { "fillpattern": { "shape": "" }, "hovertemplate": "Category=ELECTRICITY_MV
Run=%{x}
C_inv_an=%{y}", "legendgroup": "ELECTRICITY_MV", "line": { "color": "#D62728" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "ELECTRICITY_MV", "orientation": "v", "showlegend": true, "stackgroup": "1", "x": [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ], "xaxis": "x", "y": [ 1191.4304377977357, 1253.8171858436788, 1316.1659105372996, 1262.9729329879272, 1249.9964234808751, 1274.6832070345704, 1241.166838098544, 1209.4393583676879, 1185.5618043475838, 1157.9344894385615, 1127.7763338224634 ], "yaxis": "y", "type": "scatter" }, { "fillpattern": { "shape": "" }, "hovertemplate": "Category=HEAT_HIGH_T
Run=%{x}
C_inv_an=%{y}", "legendgroup": "HEAT_HIGH_T", "line": { "color": "#9467BD" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "HEAT_HIGH_T", "orientation": "v", "showlegend": true, "stackgroup": "1", "x": [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ], "xaxis": "x", "y": [ 112.57201968581916, 112.61328738237103, 113.2731918098319, 113.48948615631265, 113.99099930508297, 114.17128223726608, 114.34670388309257, 114.70672734951765, 117.86151549545816, 122.13311531192477, 127.30021675987963 ], "yaxis": "y", "type": "scatter" }, { "fillpattern": { "shape": "" }, "hovertemplate": "Category=HEAT_LOW_T_DECEN
Run=%{x}
C_inv_an=%{y}", "legendgroup": "HEAT_LOW_T_DECEN", "line": { "color": "#8C564B" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "HEAT_LOW_T_DECEN", "orientation": "v", "showlegend": true, "stackgroup": "1", "x": [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ], "xaxis": "x", "y": [ 551.447972189342, 551.447972189342, 551.447972189342, 551.4479721893416, 551.447972189342, 551.447972189342, 551.4480368600381, 551.462312084204, 551.5005939263652, 551.5005939263683, 551.5005939263636 ], "yaxis": "y", "type": "scatter" }, { "fillpattern": { "shape": "" }, "hovertemplate": "Category=HEAT_LOW_T_DHN
Run=%{x}
C_inv_an=%{y}", "legendgroup": "HEAT_LOW_T_DHN", "line": { "color": "#E377C2" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "HEAT_LOW_T_DHN", "orientation": "v", "showlegend": true, "stackgroup": "1", "x": [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ], "xaxis": "x", "y": [ 192.81038450028922, 192.81038450028922, 158.04811477672365, 152.27516218696402, 142.04295004042646, 109.37815958742999, 121.91548530686032, 134.77564755049198, 135.98027677619527, 135.98027677619527, 135.9802767761953 ], "yaxis": "y", "type": "scatter" }, { "fillpattern": { "shape": "" }, "hovertemplate": "Category=MOB_AVIATION
Run=%{x}
C_inv_an=%{y}", "legendgroup": "MOB_AVIATION", "line": { "color": "#7F7F7F" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "MOB_AVIATION", "orientation": "v", "showlegend": true, "stackgroup": "1", "x": [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ], "xaxis": "x", "y": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "yaxis": "y", "type": "scatter" }, { "fillpattern": { "shape": "" }, "hovertemplate": "Category=MOB_FREIGHT_RAIL
Run=%{x}
C_inv_an=%{y}", "legendgroup": "MOB_FREIGHT_RAIL", "line": { "color": "#BCBD22" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "MOB_FREIGHT_RAIL", "orientation": "v", "showlegend": true, "stackgroup": "1", "x": [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ], "xaxis": "x", "y": [ 16.125339578581666, 11.906488485090115, 11.90648848509013, 11.90648848509013, 10.26825918084475, 9.276931102806593, 8.962208203591896, 8.96220820359189, 8.962208203591887, 8.962208203591883, 8.96220820359189 ], "yaxis": "y", "type": "scatter" }, { "fillpattern": { "shape": "" }, "hovertemplate": "Category=MOB_FREIGHT_ROAD
Run=%{x}
C_inv_an=%{y}", "legendgroup": "MOB_FREIGHT_ROAD", "line": { "color": "#17BECF" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "MOB_FREIGHT_ROAD", "orientation": "v", "showlegend": true, "stackgroup": "1", "x": [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ], "xaxis": "x", "y": [ 17.960158387465732, 13.26126609543093, 14.898698440379363, 15.855955934826813, 24.58252269438316, 29.863157481713817, 31.53963243161303, 31.539632431613043, 31.53963243161306, 31.53963243161306, 31.539632431613043 ], "yaxis": "y", "type": "scatter" }, { "fillpattern": { "shape": "" }, "hovertemplate": "Category=MOB_PRIVATE_LOCAL
Run=%{x}
C_inv_an=%{y}", "legendgroup": "MOB_PRIVATE_LOCAL", "line": { "color": "#1F77B4" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "MOB_PRIVATE_LOCAL", "orientation": "v", "showlegend": true, "stackgroup": "1", "x": [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ], "xaxis": "x", "y": [ 1.4922087126997734E-7, 1.4922087126997708E-7, 1.492208712699774E-7, 1.4922087126997726E-7, 1.4922087126997726E-7, 1.4922087126997726E-7, 1.492208712699772E-7, 1.4922087126997734E-7, 1.4922087126997726E-7, 1.4922087126997726E-7, 1.4922087126997726E-7 ], "yaxis": "y", "type": "scatter" }, { "fillpattern": { "shape": "" }, "hovertemplate": "Category=MOB_PRIVATE_LONGD
Run=%{x}
C_inv_an=%{y}", "legendgroup": "MOB_PRIVATE_LONGD", "line": { "color": "#FF7F0E" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "MOB_PRIVATE_LONGD", "orientation": "v", "showlegend": true, "stackgroup": "1", "x": [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ], "xaxis": "x", "y": [ 2.1473247329094284E-7, 2.1473247329095962E-7, 2.1473247329094302E-7, 2.1473247329094302E-7, 2.147324732909429E-7, 2.1473247329094302E-7, 2.1473247329094284E-7, 2.1473247329094297E-7, 2.147324732909439E-7, 2.147324732909429E-7, 2.147324732909429E-7 ], "yaxis": "y", "type": "scatter" }, { "fillpattern": { "shape": "" }, "hovertemplate": "Category=MOB_PUBLIC_LOCAL
Run=%{x}
C_inv_an=%{y}", "legendgroup": "MOB_PUBLIC_LOCAL", "line": { "color": "#2CA02C" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "MOB_PUBLIC_LOCAL", "orientation": "v", "showlegend": true, "stackgroup": "1", "x": [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ], "xaxis": "x", "y": [ 136.59372582351688, 136.5937258235169, 136.59372582351688, 136.59372582351688, 136.59372582351688, 136.5937258235169, 136.59372582351688, 136.59372582351688, 136.59372582351654, 136.59372582351685, 136.59372582351688 ], "yaxis": "y", "type": "scatter" }, { "fillpattern": { "shape": "" }, "hovertemplate": "Category=MOB_PUBLIC_LONGD
Run=%{x}
C_inv_an=%{y}", "legendgroup": "MOB_PUBLIC_LONGD", "line": { "color": "#D62728" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "MOB_PUBLIC_LONGD", "orientation": "v", "showlegend": true, "stackgroup": "1", "x": [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ], "xaxis": "x", "y": [ 65.17251385643263, 65.17251385643263, 65.17251385643266, 65.1725138564337, 65.17251385643263, 65.17251385643263, 65.17251385643263, 65.17251385643263, 65.1725138564326, 65.17251385643262, 65.17251385643263 ], "yaxis": "y", "type": "scatter" }, { "fillpattern": { "shape": "" }, "hovertemplate": "Category=Others
Run=%{x}
C_inv_an=%{y}", "legendgroup": "Others", "line": { "color": "#9467BD" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "Others", "orientation": "v", "showlegend": true, "stackgroup": "1", "x": [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ], "xaxis": "x", "y": [ 1354.8752800586137, 1350.550306650175, 1341.689680701846, 1346.91669325061, 1343.4735185991974, 1352.0734865327668, 1360.068262616446, 1367.7294369172303, 1375.6205516875166, 1383.5690358045981, 1391.4809757300147 ], "yaxis": "y", "type": "scatter" } ], "layout": { "template": { "data": { "barpolar": [ { "marker": { "line": { "color": "white", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "barpolar" } ], "bar": [ { "error_x": { "color": "rgb(36,36,36)" }, "error_y": { "color": "rgb(36,36,36)" }, "marker": { "line": { "color": "white", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "bar" } ], "carpet": [ { "aaxis": { "endlinecolor": "rgb(36,36,36)", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "rgb(36,36,36)" }, "baxis": { "endlinecolor": "rgb(36,36,36)", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "rgb(36,36,36)" }, "type": "carpet" } ], "choropleth": [ { "colorbar": { "outlinewidth": 1, "tickcolor": "rgb(36,36,36)", "ticks": "outside" }, "type": "choropleth" } ], "contourcarpet": [ { "colorbar": { "outlinewidth": 1, "tickcolor": "rgb(36,36,36)", "ticks": "outside" }, "type": "contourcarpet" } ], "contour": [ { "colorbar": { "outlinewidth": 1, "tickcolor": "rgb(36,36,36)", "ticks": "outside" }, "colorscale": [ [ 0.0, "#440154" ], [ 0.1111111111111111, "#482878" ], [ 0.2222222222222222, "#3e4989" ], [ 0.3333333333333333, "#31688e" ], [ 0.4444444444444444, "#26828e" ], [ 0.5555555555555556, "#1f9e89" ], [ 0.6666666666666666, "#35b779" ], [ 0.7777777777777778, "#6ece58" ], [ 0.8888888888888888, "#b5de2b" ], [ 1.0, "#fde725" ] ], "type": "contour" } ], "heatmapgl": [ { "colorbar": { "outlinewidth": 1, "tickcolor": "rgb(36,36,36)", "ticks": "outside" }, "colorscale": [ [ 0.0, "#440154" ], [ 0.1111111111111111, "#482878" ], [ 0.2222222222222222, "#3e4989" ], [ 0.3333333333333333, "#31688e" ], [ 0.4444444444444444, "#26828e" ], [ 0.5555555555555556, "#1f9e89" ], [ 0.6666666666666666, "#35b779" ], [ 0.7777777777777778, "#6ece58" ], [ 0.8888888888888888, "#b5de2b" ], [ 1.0, "#fde725" ] ], "type": "heatmapgl" } ], "heatmap": [ { "colorbar": { "outlinewidth": 1, "tickcolor": "rgb(36,36,36)", "ticks": "outside" }, "colorscale": [ [ 0.0, "#440154" ], [ 0.1111111111111111, "#482878" ], [ 0.2222222222222222, "#3e4989" ], [ 0.3333333333333333, "#31688e" ], [ 0.4444444444444444, "#26828e" ], [ 0.5555555555555556, "#1f9e89" ], [ 0.6666666666666666, "#35b779" ], [ 0.7777777777777778, "#6ece58" ], [ 0.8888888888888888, "#b5de2b" ], [ 1.0, "#fde725" ] ], "type": "heatmap" } ], "histogram2dcontour": [ { "colorbar": { "outlinewidth": 1, "tickcolor": "rgb(36,36,36)", "ticks": "outside" }, "colorscale": [ [ 0.0, "#440154" ], [ 0.1111111111111111, "#482878" ], [ 0.2222222222222222, "#3e4989" ], [ 0.3333333333333333, "#31688e" ], [ 0.4444444444444444, "#26828e" ], [ 0.5555555555555556, "#1f9e89" ], [ 0.6666666666666666, "#35b779" ], [ 0.7777777777777778, "#6ece58" ], [ 0.8888888888888888, "#b5de2b" ], [ 1.0, "#fde725" ] ], "type": "histogram2dcontour" } ], "histogram2d": [ { "colorbar": { "outlinewidth": 1, "tickcolor": "rgb(36,36,36)", "ticks": "outside" }, "colorscale": [ [ 0.0, "#440154" ], [ 0.1111111111111111, "#482878" ], [ 0.2222222222222222, "#3e4989" ], [ 0.3333333333333333, "#31688e" ], [ 0.4444444444444444, "#26828e" ], [ 0.5555555555555556, "#1f9e89" ], [ 0.6666666666666666, "#35b779" ], [ 0.7777777777777778, "#6ece58" ], [ 0.8888888888888888, "#b5de2b" ], [ 1.0, "#fde725" ] ], "type": "histogram2d" } ], "histogram": [ { "marker": { "line": { "color": "white", "width": 0.6 } }, "type": "histogram" } ], "mesh3d": [ { "colorbar": { "outlinewidth": 1, "tickcolor": "rgb(36,36,36)", "ticks": "outside" }, "type": "mesh3d" } ], "parcoords": [ { "line": { "colorbar": { "outlinewidth": 1, "tickcolor": "rgb(36,36,36)", "ticks": "outside" } }, "type": "parcoords" } ], "pie": [ { "automargin": true, "type": "pie" } ], "scatter3d": [ { "line": { "colorbar": { "outlinewidth": 1, "tickcolor": "rgb(36,36,36)", "ticks": "outside" } }, "marker": { "colorbar": { "outlinewidth": 1, "tickcolor": "rgb(36,36,36)", "ticks": "outside" } }, "type": "scatter3d" } ], "scattercarpet": [ { "marker": { "colorbar": { "outlinewidth": 1, "tickcolor": "rgb(36,36,36)", "ticks": "outside" } }, "type": "scattercarpet" } ], "scattergeo": [ { "marker": { "colorbar": { "outlinewidth": 1, "tickcolor": "rgb(36,36,36)", "ticks": "outside" } }, "type": "scattergeo" } ], "scattergl": [ { "marker": { "colorbar": { "outlinewidth": 1, "tickcolor": "rgb(36,36,36)", "ticks": "outside" } }, "type": "scattergl" } ], "scattermapbox": [ { "marker": { "colorbar": { "outlinewidth": 1, "tickcolor": "rgb(36,36,36)", "ticks": "outside" } }, "type": "scattermapbox" } ], "scatterpolargl": [ { "marker": { "colorbar": { "outlinewidth": 1, "tickcolor": "rgb(36,36,36)", "ticks": "outside" } }, "type": "scatterpolargl" } ], "scatterpolar": [ { "marker": { "colorbar": { "outlinewidth": 1, "tickcolor": "rgb(36,36,36)", "ticks": "outside" } }, "type": "scatterpolar" } ], "scatter": [ { "fillpattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 }, "type": "scatter" } ], "scatterternary": [ { "marker": { "colorbar": { "outlinewidth": 1, "tickcolor": "rgb(36,36,36)", "ticks": "outside" } }, "type": "scatterternary" } ], "surface": [ { "colorbar": { "outlinewidth": 1, "tickcolor": "rgb(36,36,36)", "ticks": "outside" }, "colorscale": [ [ 0.0, "#440154" ], [ 0.1111111111111111, "#482878" ], [ 0.2222222222222222, "#3e4989" ], [ 0.3333333333333333, "#31688e" ], [ 0.4444444444444444, "#26828e" ], [ 0.5555555555555556, "#1f9e89" ], [ 0.6666666666666666, "#35b779" ], [ 0.7777777777777778, "#6ece58" ], [ 0.8888888888888888, "#b5de2b" ], [ 1.0, "#fde725" ] ], "type": "surface" } ], "table": [ { "cells": { "fill": { "color": "rgb(237,237,237)" }, "line": { "color": "white" } }, "header": { "fill": { "color": "rgb(217,217,217)" }, "line": { "color": "white" } }, "type": "table" } ] }, "layout": { "annotationdefaults": { "arrowhead": 0, "arrowwidth": 1 }, "autotypenumbers": "strict", "coloraxis": { "colorbar": { "outlinewidth": 1, "tickcolor": "rgb(36,36,36)", "ticks": "outside" } }, "colorscale": { "diverging": [ [ 0.0, "rgb(103,0,31)" ], [ 0.1, "rgb(178,24,43)" ], [ 0.2, "rgb(214,96,77)" ], [ 0.3, "rgb(244,165,130)" ], [ 0.4, "rgb(253,219,199)" ], [ 0.5, "rgb(247,247,247)" ], [ 0.6, "rgb(209,229,240)" ], [ 0.7, "rgb(146,197,222)" ], [ 0.8, "rgb(67,147,195)" ], [ 0.9, "rgb(33,102,172)" ], [ 1.0, "rgb(5,48,97)" ] ], "sequential": [ [ 0.0, "#440154" ], [ 0.1111111111111111, "#482878" ], [ 0.2222222222222222, "#3e4989" ], [ 0.3333333333333333, "#31688e" ], [ 0.4444444444444444, "#26828e" ], [ 0.5555555555555556, "#1f9e89" ], [ 0.6666666666666666, "#35b779" ], [ 0.7777777777777778, "#6ece58" ], [ 0.8888888888888888, "#b5de2b" ], [ 1.0, "#fde725" ] ], "sequentialminus": [ [ 0.0, "#440154" ], [ 0.1111111111111111, "#482878" ], [ 0.2222222222222222, "#3e4989" ], [ 0.3333333333333333, "#31688e" ], [ 0.4444444444444444, "#26828e" ], [ 0.5555555555555556, "#1f9e89" ], [ 0.6666666666666666, "#35b779" ], [ 0.7777777777777778, "#6ece58" ], [ 0.8888888888888888, "#b5de2b" ], [ 1.0, "#fde725" ] ] }, "colorway": [ "#1F77B4", "#FF7F0E", "#2CA02C", "#D62728", "#9467BD", "#8C564B", "#E377C2", "#7F7F7F", "#BCBD22", "#17BECF" ], "font": { "color": "rgb(36,36,36)" }, "geo": { "bgcolor": "white", "lakecolor": "white", "landcolor": "white", "showlakes": true, "showland": true, "subunitcolor": "white" }, "hoverlabel": { "align": "left" }, "hovermode": "closest", "mapbox": { "style": "light" }, "paper_bgcolor": "white", "plot_bgcolor": "white", "polar": { "angularaxis": { "gridcolor": "rgb(232,232,232)", "linecolor": "rgb(36,36,36)", "showgrid": false, "showline": true, "ticks": "outside" }, "bgcolor": "white", "radialaxis": { "gridcolor": "rgb(232,232,232)", "linecolor": "rgb(36,36,36)", "showgrid": false, "showline": true, "ticks": "outside" } }, "scene": { "xaxis": { "backgroundcolor": "white", "gridcolor": "rgb(232,232,232)", "gridwidth": 2, "linecolor": "rgb(36,36,36)", "showbackground": true, "showgrid": false, "showline": true, "ticks": "outside", "zeroline": false, "zerolinecolor": "rgb(36,36,36)" }, "yaxis": { "backgroundcolor": "white", "gridcolor": "rgb(232,232,232)", "gridwidth": 2, "linecolor": "rgb(36,36,36)", "showbackground": true, "showgrid": false, "showline": true, "ticks": "outside", "zeroline": false, "zerolinecolor": "rgb(36,36,36)" }, "zaxis": { "backgroundcolor": "white", "gridcolor": "rgb(232,232,232)", "gridwidth": 2, "linecolor": "rgb(36,36,36)", "showbackground": true, "showgrid": false, "showline": true, "ticks": "outside", "zeroline": false, "zerolinecolor": "rgb(36,36,36)" } }, "shapedefaults": { "fillcolor": "black", "line": { "width": 0 }, "opacity": 0.3 }, "ternary": { "aaxis": { "gridcolor": "rgb(232,232,232)", "linecolor": "rgb(36,36,36)", "showgrid": false, "showline": true, "ticks": "outside" }, "baxis": { "gridcolor": "rgb(232,232,232)", "linecolor": "rgb(36,36,36)", "showgrid": false, "showline": true, "ticks": "outside" }, "bgcolor": "white", "caxis": { "gridcolor": "rgb(232,232,232)", "linecolor": "rgb(36,36,36)", "showgrid": false, "showline": true, "ticks": "outside" } }, "title": { "x": 0.05 }, "xaxis": { "automargin": true, "gridcolor": "rgb(232,232,232)", "linecolor": "rgb(36,36,36)", "showgrid": false, "showline": true, "ticks": "outside", "title": { "standoff": 15 }, "zeroline": false, "zerolinecolor": "rgb(36,36,36)" }, "yaxis": { "automargin": true, "gridcolor": "rgb(232,232,232)", "linecolor": "rgb(36,36,36)", "showgrid": false, "showline": true, "ticks": "outside", "title": { "standoff": 15 }, "zeroline": false, "zerolinecolor": "rgb(36,36,36)" } } }, "xaxis": { "anchor": "y", "domain": [ 0.0, 1.0 ], "title": { "text": "Run" } }, "yaxis": { "anchor": "x", "domain": [ 0.0, 1.0 ], "title": { "text": "C_inv_an" } }, "legend": { "title": { "text": "Category" }, "tracegroupgap": 0 }, "margin": { "t": 60 } }, "config": { "plotlyServerURL": "https://plot.ly" } }, "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "execution_count": 13 }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "\n", "- Aggregates the costs by category.\n", "\n", "#### Plot Investment Costs by Sub-Category" ] }, { "cell_type": "code", "metadata": { "ExecuteTime": { "end_time": "2025-03-17T14:53:00.042719Z", "start_time": "2025-03-17T14:52:59.994951Z" } }, "source": [ "# Plot annualized investment costs aggregated by sub-category\n", "plot_parametrisation(results=results_ch_n, variable=\"C_inv_an\", category=\"Category_2\")" ], "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "data": [ { "fillpattern": { "shape": "" }, "hovertemplate": "Category_2=Carbon Capture
Run=%{x}
C_inv_an=%{y}", "legendgroup": "Carbon Capture", "line": { "color": "#1F77B4" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "Carbon Capture", "orientation": "v", "showlegend": true, "stackgroup": "1", "x": [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ], "xaxis": "x", "y": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 4.742042822433, 14.474289301051162, 24.3140447557379, 34.1857678647343, 44.14184656343071 ], "yaxis": "y", "type": "scatter" }, { "fillpattern": { "shape": "" }, "hovertemplate": "Category_2=Electric Infrastructure
Run=%{x}
C_inv_an=%{y}", "legendgroup": "Electric Infrastructure", "line": { "color": "#FF7F0E" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "Electric Infrastructure", "orientation": "v", "showlegend": true, "stackgroup": "1", "x": [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ], "xaxis": "x", "y": [ 104.368040504081, 103.13490800828957, 102.78505780061874, 100.056370158022, 98.49837355885617, 99.76309276184655, 96.23440950578764, 92.75565416489906, 90.62160082056079, 88.87838856812557, 87.41335322235254 ], "yaxis": "y", "type": "scatter" }, { "fillpattern": { "shape": "" }, "hovertemplate": "Category_2=Electricity
Run=%{x}
C_inv_an=%{y}", "legendgroup": "Electricity", "line": { "color": "#2CA02C" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "Electricity", "orientation": "v", "showlegend": true, "stackgroup": "1", "x": [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ], "xaxis": "x", "y": [ 52.29506744087264, 51.58606487486675, 40.24853039920755, 36.5324701515846, 27.916188190785302, 24.818824581839714, 24.81882458184327, 24.81877162694835, 24.818368524823306, 24.81836852482327, 24.818368524823317 ], "yaxis": "y", "type": "scatter" }, { "fillpattern": { "shape": "" }, "hovertemplate": "Category_2=Electrolysis
Run=%{x}
C_inv_an=%{y}", "legendgroup": "Electrolysis", "line": { "color": "#D62728" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "Electrolysis", "orientation": "v", "showlegend": true, "stackgroup": "1", "x": [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ], "xaxis": "x", "y": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "yaxis": "y", "type": "scatter" }, { "fillpattern": { "shape": "" }, "hovertemplate": "Category_2=Gas Infrastructure
Run=%{x}
C_inv_an=%{y}", "legendgroup": "Gas Infrastructure", "line": { "color": "#9467BD" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "Gas Infrastructure", "orientation": "v", "showlegend": true, "stackgroup": "1", "x": [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ], "xaxis": "x", "y": [ 0.46351632718958213, 0.45675044116154107, 0.34855835585863176, 0.31309665047950086, 0.23087299639508793, 0.20131540355930683, 0.20331401325910617, 0.36690975165740713, 0.40785691076796843, 0.41496187269421175, 0.41363602305065655 ], "yaxis": "y", "type": "scatter" }, { "fillpattern": { "shape": "" }, "hovertemplate": "Category_2=Geothermal
Run=%{x}
C_inv_an=%{y}", "legendgroup": "Geothermal", "line": { "color": "#8C564B" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "Geothermal", "orientation": "v", "showlegend": true, "stackgroup": "1", "x": [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ], "xaxis": "x", "y": [ 103.90603536815455, 103.90603536815455, 59.89732686496027, 53.81955186539537, 42.56460536641809, 0.0, 17.425333254286485, 34.79401693778767, 36.42096561703176, 36.42096561703176, 36.4209656170318 ], "yaxis": "y", "type": "scatter" }, { "fillpattern": { "shape": "" }, "hovertemplate": "Category_2=High Temperature Heat
Run=%{x}
C_inv_an=%{y}", "legendgroup": "High Temperature Heat", "line": { "color": "#E377C2" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "High Temperature Heat", "orientation": "v", "showlegend": true, "stackgroup": "1", "x": [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ], "xaxis": "x", "y": [ 112.57201968581916, 112.61328738237103, 113.2731918098319, 113.48948615631265, 113.99099930508297, 114.17128223726608, 114.34670388309257, 114.70672734951765, 117.86151549545816, 122.13311531192477, 127.30021675987963 ], "yaxis": "y", "type": "scatter" }, { "fillpattern": { "shape": "" }, "hovertemplate": "Category_2=Hydro River & Dam
Run=%{x}
C_inv_an=%{y}", "legendgroup": "Hydro River & Dam", "line": { "color": "#7F7F7F" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "Hydro River & Dam", "orientation": "v", "showlegend": true, "stackgroup": "1", "x": [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ], "xaxis": "x", "y": [ 2505.690509417487, 2498.731464522717, 2448.3003663879776, 2332.73881264827, 2257.371698695909, 2257.371698695909, 2257.371698695909, 2257.371698695909, 2257.371698695909, 2257.371698695909, 2257.371698695909 ], "yaxis": "y", "type": "scatter" }, { "fillpattern": { "shape": "" }, "hovertemplate": "Category_2=Industry
Run=%{x}
C_inv_an=%{y}", "legendgroup": "Industry", "line": { "color": "#BCBD22" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "Industry", "orientation": "v", "showlegend": true, "stackgroup": "1", "x": [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ], "xaxis": "x", "y": [ 202.38488485094382, 199.25974564598215, 193.5230290069811, 203.0046350714673, 203.60535846234555, 213.29812730966776, 220.72964520935463, 220.7705664478416, 220.81193734212246, 220.85344540580357, 220.89530816310304 ], "yaxis": "y", "type": "scatter" }, { "fillpattern": { "shape": "" }, "hovertemplate": "Category_2=Low Temperature Heat
Run=%{x}
C_inv_an=%{y}", "legendgroup": "Low Temperature Heat", "line": { "color": "#17BECF" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "Low Temperature Heat", "orientation": "v", "showlegend": true, "stackgroup": "1", "x": [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ], "xaxis": "x", "y": [ 803.3474442460463, 803.3474442460463, 809.586496156382, 808.1331734872681, 806.5331247756151, 814.8458367802433, 809.4540267908869, 804.9597805751833, 804.5757429638038, 804.5757429638069, 804.5757429638022 ], "yaxis": "y", "type": "scatter" }, { "fillpattern": { "shape": "" }, "hovertemplate": "Category_2=Mobility
Run=%{x}
C_inv_an=%{y}", "legendgroup": "Mobility", "line": { "color": "#1F77B4" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "Mobility", "orientation": "v", "showlegend": true, "stackgroup": "1", "x": [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ], "xaxis": "x", "y": [ 1119.3455197268208, 1110.4277763413343, 1112.065208686243, 1113.0224661806915, 1120.1108036360013, 1124.400110345294, 1125.761862395978, 1125.7618623959786, 1125.761862395978, 1125.7618623959781, 1125.7618623959784 ], "yaxis": "y", "type": "scatter" }, { "fillpattern": { "shape": "" }, "hovertemplate": "Category_2=Nuclear
Run=%{x}
C_inv_an=%{y}", "legendgroup": "Nuclear", "line": { "color": "#FF7F0E" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "Nuclear", "orientation": "v", "showlegend": true, "stackgroup": "1", "x": [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ], "xaxis": "x", "y": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "yaxis": "y", "type": "scatter" }, { "fillpattern": { "shape": "" }, "hovertemplate": "Category_2=Others
Run=%{x}
C_inv_an=%{y}", "legendgroup": "Others", "line": { "color": "#2CA02C" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "Others", "orientation": "v", "showlegend": true, "stackgroup": "1", "x": [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ], "xaxis": "x", "y": [ 2.9887439448000586, 2.9887439448000586, 2.9887439448000586, 2.9887439448000586, 2.9887439448000586, 2.9887439448000586, 3.087493607040472, 3.3504052532672044, 3.490572091009389, 3.752285240570232, 3.8911063397394985 ], "yaxis": "y", "type": "scatter" }, { "fillpattern": { "shape": "" }, "hovertemplate": "Category_2=PV
Run=%{x}
C_inv_an=%{y}", "legendgroup": "PV", "line": { "color": "#D62728" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "PV", "orientation": "v", "showlegend": true, "stackgroup": "1", "x": [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ], "xaxis": "x", "y": [ 161.82960538782493, 136.55807948089412, 273.11615896178824, 409.6742384426824, 546.2323179235765, 682.7903974044707, 819.3484768853648, 955.9065563662589, 1092.464635847153, 1229.0227153280473, 1365.5807948089414 ], "yaxis": "y", "type": "scatter" }, { "fillpattern": { "shape": "" }, "hovertemplate": "Category_2=Resources
Run=%{x}
C_inv_an=%{y}", "legendgroup": "Resources", "line": { "color": "#9467BD" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "Resources", "orientation": "v", "showlegend": true, "stackgroup": "1", "x": [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ], "xaxis": "x", "y": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "yaxis": "y", "type": "scatter" }, { "fillpattern": { "shape": "" }, "hovertemplate": "Category_2=Storage
Run=%{x}
C_inv_an=%{y}", "legendgroup": "Storage", "line": { "color": "#8C564B" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "Storage", "orientation": "v", "showlegend": true, "stackgroup": "1", "x": [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ], "xaxis": "x", "y": [ 0.0, 0.0, 0.25607804679472074, 0.4632057478871601, 0.718138083658165, 0.2235082497559474, 0.23989239978755816, 1.3772352343001903, 1.5771773496414454, 1.577177349641447, 1.5771773496414438 ], "yaxis": "y", "type": "scatter" }, { "fillpattern": { "shape": "" }, "hovertemplate": "Category_2=Wind
Run=%{x}
C_inv_an=%{y}", "legendgroup": "Wind", "line": { "color": "#E377C2" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "Wind", "orientation": "v", "showlegend": true, "stackgroup": "1", "x": [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ], "xaxis": "x", "y": [ 998.9269045980943, 1061.3598361354752, 1123.7927676728561, 1186.225699210237, 1248.658630747618, 1273.2131816373087, 1239.5268643014067, 1207.6541399252935, 1183.6399544180194, 1155.6254976644743, 1124.8024850149488 ], "yaxis": "y", "type": "scatter" } ], "layout": { "template": { "data": { "barpolar": [ { "marker": { "line": { "color": "white", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "barpolar" } ], "bar": [ { "error_x": { "color": "rgb(36,36,36)" }, "error_y": { "color": "rgb(36,36,36)" }, "marker": { "line": { "color": "white", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "bar" } ], "carpet": [ { "aaxis": { "endlinecolor": "rgb(36,36,36)", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "rgb(36,36,36)" }, "baxis": { "endlinecolor": "rgb(36,36,36)", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "rgb(36,36,36)" }, "type": "carpet" } ], "choropleth": [ { "colorbar": { "outlinewidth": 1, "tickcolor": "rgb(36,36,36)", "ticks": "outside" }, "type": "choropleth" } ], "contourcarpet": [ { "colorbar": { "outlinewidth": 1, "tickcolor": "rgb(36,36,36)", "ticks": "outside" }, "type": "contourcarpet" } ], "contour": [ { "colorbar": { "outlinewidth": 1, "tickcolor": "rgb(36,36,36)", "ticks": "outside" }, "colorscale": [ [ 0.0, "#440154" ], [ 0.1111111111111111, "#482878" ], [ 0.2222222222222222, "#3e4989" ], [ 0.3333333333333333, "#31688e" ], [ 0.4444444444444444, "#26828e" ], [ 0.5555555555555556, "#1f9e89" ], [ 0.6666666666666666, "#35b779" ], [ 0.7777777777777778, "#6ece58" ], [ 0.8888888888888888, "#b5de2b" ], [ 1.0, "#fde725" ] ], "type": "contour" } ], "heatmapgl": [ { "colorbar": { "outlinewidth": 1, "tickcolor": "rgb(36,36,36)", "ticks": "outside" }, "colorscale": [ [ 0.0, "#440154" ], [ 0.1111111111111111, "#482878" ], [ 0.2222222222222222, "#3e4989" ], [ 0.3333333333333333, "#31688e" ], [ 0.4444444444444444, "#26828e" ], [ 0.5555555555555556, "#1f9e89" ], [ 0.6666666666666666, "#35b779" ], [ 0.7777777777777778, "#6ece58" ], [ 0.8888888888888888, "#b5de2b" ], [ 1.0, "#fde725" ] ], "type": "heatmapgl" } ], "heatmap": [ { "colorbar": { "outlinewidth": 1, "tickcolor": "rgb(36,36,36)", "ticks": "outside" }, "colorscale": [ [ 0.0, "#440154" ], [ 0.1111111111111111, "#482878" ], [ 0.2222222222222222, "#3e4989" ], [ 0.3333333333333333, "#31688e" ], [ 0.4444444444444444, "#26828e" ], [ 0.5555555555555556, "#1f9e89" ], [ 0.6666666666666666, "#35b779" ], [ 0.7777777777777778, "#6ece58" ], [ 0.8888888888888888, "#b5de2b" ], [ 1.0, "#fde725" ] ], "type": "heatmap" } ], "histogram2dcontour": [ { "colorbar": { "outlinewidth": 1, "tickcolor": "rgb(36,36,36)", "ticks": "outside" }, "colorscale": [ [ 0.0, "#440154" ], [ 0.1111111111111111, "#482878" ], [ 0.2222222222222222, "#3e4989" ], [ 0.3333333333333333, "#31688e" ], [ 0.4444444444444444, "#26828e" ], [ 0.5555555555555556, "#1f9e89" ], [ 0.6666666666666666, "#35b779" ], [ 0.7777777777777778, "#6ece58" ], [ 0.8888888888888888, "#b5de2b" ], [ 1.0, "#fde725" ] ], "type": "histogram2dcontour" } ], "histogram2d": [ { "colorbar": { "outlinewidth": 1, "tickcolor": "rgb(36,36,36)", "ticks": "outside" }, "colorscale": [ [ 0.0, "#440154" ], [ 0.1111111111111111, "#482878" ], [ 0.2222222222222222, "#3e4989" ], [ 0.3333333333333333, "#31688e" ], [ 0.4444444444444444, "#26828e" ], [ 0.5555555555555556, "#1f9e89" ], [ 0.6666666666666666, "#35b779" ], [ 0.7777777777777778, "#6ece58" ], [ 0.8888888888888888, "#b5de2b" ], [ 1.0, "#fde725" ] ], "type": "histogram2d" } ], "histogram": [ { "marker": { "line": { "color": "white", "width": 0.6 } }, "type": "histogram" } ], "mesh3d": [ { "colorbar": { "outlinewidth": 1, "tickcolor": "rgb(36,36,36)", "ticks": "outside" }, "type": "mesh3d" } ], "parcoords": [ { "line": { "colorbar": { "outlinewidth": 1, "tickcolor": "rgb(36,36,36)", "ticks": "outside" } }, "type": "parcoords" } ], "pie": [ { "automargin": true, "type": "pie" } ], "scatter3d": [ { "line": { "colorbar": { "outlinewidth": 1, "tickcolor": "rgb(36,36,36)", "ticks": "outside" } }, "marker": { "colorbar": { "outlinewidth": 1, "tickcolor": "rgb(36,36,36)", "ticks": "outside" } }, "type": "scatter3d" } ], "scattercarpet": [ { "marker": { "colorbar": { "outlinewidth": 1, "tickcolor": "rgb(36,36,36)", "ticks": "outside" } }, "type": "scattercarpet" } ], "scattergeo": [ { "marker": { "colorbar": { "outlinewidth": 1, "tickcolor": "rgb(36,36,36)", "ticks": "outside" } }, "type": "scattergeo" } ], "scattergl": [ { "marker": { "colorbar": { "outlinewidth": 1, "tickcolor": "rgb(36,36,36)", "ticks": "outside" } }, "type": "scattergl" } ], "scattermapbox": [ { "marker": { "colorbar": { "outlinewidth": 1, "tickcolor": "rgb(36,36,36)", "ticks": "outside" } }, "type": "scattermapbox" } ], "scatterpolargl": [ { "marker": { "colorbar": { "outlinewidth": 1, "tickcolor": "rgb(36,36,36)", "ticks": "outside" } }, "type": "scatterpolargl" } ], "scatterpolar": [ { "marker": { "colorbar": { "outlinewidth": 1, "tickcolor": "rgb(36,36,36)", "ticks": "outside" } }, "type": "scatterpolar" } ], "scatter": [ { "fillpattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 }, "type": "scatter" } ], "scatterternary": [ { "marker": { "colorbar": { "outlinewidth": 1, "tickcolor": "rgb(36,36,36)", "ticks": "outside" } }, "type": "scatterternary" } ], "surface": [ { "colorbar": { "outlinewidth": 1, "tickcolor": "rgb(36,36,36)", "ticks": "outside" }, "colorscale": [ [ 0.0, "#440154" ], [ 0.1111111111111111, "#482878" ], [ 0.2222222222222222, "#3e4989" ], [ 0.3333333333333333, "#31688e" ], [ 0.4444444444444444, "#26828e" ], [ 0.5555555555555556, "#1f9e89" ], [ 0.6666666666666666, "#35b779" ], [ 0.7777777777777778, "#6ece58" ], [ 0.8888888888888888, "#b5de2b" ], [ 1.0, "#fde725" ] ], "type": "surface" } ], "table": [ { "cells": { "fill": { "color": "rgb(237,237,237)" }, "line": { "color": "white" } }, "header": { "fill": { "color": "rgb(217,217,217)" }, "line": { "color": "white" } }, "type": "table" } ] }, "layout": { "annotationdefaults": { "arrowhead": 0, "arrowwidth": 1 }, "autotypenumbers": "strict", "coloraxis": { "colorbar": { "outlinewidth": 1, "tickcolor": "rgb(36,36,36)", "ticks": "outside" } }, "colorscale": { "diverging": [ [ 0.0, "rgb(103,0,31)" ], [ 0.1, "rgb(178,24,43)" ], [ 0.2, "rgb(214,96,77)" ], [ 0.3, "rgb(244,165,130)" ], [ 0.4, "rgb(253,219,199)" ], [ 0.5, "rgb(247,247,247)" ], [ 0.6, "rgb(209,229,240)" ], [ 0.7, "rgb(146,197,222)" ], [ 0.8, "rgb(67,147,195)" ], [ 0.9, "rgb(33,102,172)" ], [ 1.0, "rgb(5,48,97)" ] ], "sequential": [ [ 0.0, "#440154" ], [ 0.1111111111111111, "#482878" ], [ 0.2222222222222222, "#3e4989" ], [ 0.3333333333333333, "#31688e" ], [ 0.4444444444444444, "#26828e" ], [ 0.5555555555555556, "#1f9e89" ], [ 0.6666666666666666, "#35b779" ], [ 0.7777777777777778, "#6ece58" ], [ 0.8888888888888888, "#b5de2b" ], [ 1.0, "#fde725" ] ], "sequentialminus": [ [ 0.0, "#440154" ], [ 0.1111111111111111, "#482878" ], [ 0.2222222222222222, "#3e4989" ], [ 0.3333333333333333, "#31688e" ], [ 0.4444444444444444, "#26828e" ], [ 0.5555555555555556, "#1f9e89" ], [ 0.6666666666666666, "#35b779" ], [ 0.7777777777777778, "#6ece58" ], [ 0.8888888888888888, "#b5de2b" ], [ 1.0, "#fde725" ] ] }, "colorway": [ "#1F77B4", "#FF7F0E", "#2CA02C", "#D62728", "#9467BD", "#8C564B", "#E377C2", "#7F7F7F", "#BCBD22", "#17BECF" ], "font": { "color": "rgb(36,36,36)" }, "geo": { "bgcolor": "white", "lakecolor": "white", "landcolor": "white", "showlakes": true, "showland": true, "subunitcolor": "white" }, "hoverlabel": { "align": "left" }, "hovermode": "closest", "mapbox": { "style": "light" }, "paper_bgcolor": "white", "plot_bgcolor": "white", "polar": { "angularaxis": { "gridcolor": "rgb(232,232,232)", "linecolor": "rgb(36,36,36)", "showgrid": false, "showline": true, "ticks": "outside" }, "bgcolor": "white", "radialaxis": { "gridcolor": "rgb(232,232,232)", "linecolor": "rgb(36,36,36)", "showgrid": false, "showline": true, "ticks": "outside" } }, "scene": { "xaxis": { "backgroundcolor": "white", "gridcolor": "rgb(232,232,232)", "gridwidth": 2, "linecolor": "rgb(36,36,36)", "showbackground": true, "showgrid": false, "showline": true, "ticks": "outside", "zeroline": false, "zerolinecolor": "rgb(36,36,36)" }, "yaxis": { "backgroundcolor": "white", "gridcolor": "rgb(232,232,232)", "gridwidth": 2, "linecolor": "rgb(36,36,36)", "showbackground": true, "showgrid": false, "showline": true, "ticks": "outside", "zeroline": false, "zerolinecolor": "rgb(36,36,36)" }, "zaxis": { "backgroundcolor": "white", "gridcolor": "rgb(232,232,232)", "gridwidth": 2, "linecolor": "rgb(36,36,36)", "showbackground": true, "showgrid": false, "showline": true, "ticks": "outside", "zeroline": false, "zerolinecolor": "rgb(36,36,36)" } }, "shapedefaults": { "fillcolor": "black", "line": { "width": 0 }, "opacity": 0.3 }, "ternary": { "aaxis": { "gridcolor": "rgb(232,232,232)", "linecolor": "rgb(36,36,36)", "showgrid": false, "showline": true, "ticks": "outside" }, "baxis": { "gridcolor": "rgb(232,232,232)", "linecolor": "rgb(36,36,36)", "showgrid": false, "showline": true, "ticks": "outside" }, "bgcolor": "white", "caxis": { "gridcolor": "rgb(232,232,232)", "linecolor": "rgb(36,36,36)", "showgrid": false, "showline": true, "ticks": "outside" } }, "title": { "x": 0.05 }, "xaxis": { "automargin": true, "gridcolor": "rgb(232,232,232)", "linecolor": "rgb(36,36,36)", "showgrid": false, "showline": true, "ticks": "outside", "title": { "standoff": 15 }, "zeroline": false, "zerolinecolor": "rgb(36,36,36)" }, "yaxis": { "automargin": true, "gridcolor": "rgb(232,232,232)", "linecolor": "rgb(36,36,36)", "showgrid": false, "showline": true, "ticks": "outside", "title": { "standoff": 15 }, "zeroline": false, "zerolinecolor": "rgb(36,36,36)" } } }, "xaxis": { "anchor": "y", "domain": [ 0.0, 1.0 ], "title": { "text": "Run" } }, "yaxis": { "anchor": "x", "domain": [ 0.0, 1.0 ], "title": { "text": "C_inv_an" } }, "legend": { "title": { "text": "Category_2" }, "tracegroupgap": 0 }, "margin": { "t": 60 } }, "config": { "plotlyServerURL": "https://plot.ly" } }, "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "execution_count": 14 }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "\n", "- **`Category_2`**: A more detailed level of categorization, allowing for a finer analysis.\n", "\n", "### Save and Load Results\n", "\n", "To preserve the results of the multiple runs and avoid re-running the optimizations, we can save the results to a file and load them later.\n", "\n", "#### Define Save Function" ] }, { "cell_type": "code", "metadata": { "ExecuteTime": { "end_time": "2025-03-17T14:53:00.045898Z", "start_time": "2025-03-17T14:53:00.043619Z" } }, "source": [ "def save_result_to_pickle(data, filename):\n", " \"\"\"\n", " Save the Result object to a pickle file.\n", "\n", " Parameters:\n", " data: The Result object to save.\n", " filename (str): The file path to save the object to.\n", " \"\"\"\n", " with open(filename, 'wb') as fp:\n", " pickle.dump(data, fp, protocol=pickle.HIGHEST_PROTOCOL)" ], "outputs": [], "execution_count": 15 }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "\n", "#### Define Load Function" ] }, { "cell_type": "code", "metadata": { "ExecuteTime": { "end_time": "2025-03-17T14:53:00.048871Z", "start_time": "2025-03-17T14:53:00.046721Z" } }, "source": [ "def load_result_from_pickle(filename):\n", " \"\"\"\n", " Load the Result object from a pickle file.\n", "\n", " Parameters:\n", " filename (str): The file path to load the object from.\n", "\n", " Returns:\n", " The loaded Result object.\n", " \"\"\"\n", " with open(filename, 'rb') as handle:\n", " result = pickle.load(handle)\n", " return result" ], "outputs": [], "execution_count": 16 }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "\n", "> **Note**: These utility functions could be integrated into the EnergyScope library for convenience.\n", "\n", "#### Save the Results" ] }, { "cell_type": "code", "metadata": { "ExecuteTime": { "end_time": "2025-03-17T14:53:00.066600Z", "start_time": "2025-03-17T14:53:00.049436Z" } }, "source": [ "# Save the result object to a pickle file\n", "save_result_to_pickle(results_ch_n, \"tutorial_input/results_ch_n.pickle\")" ], "outputs": [], "execution_count": 17 }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "\n", "#### Clear the Results Variable" ] }, { "cell_type": "code", "metadata": { "ExecuteTime": { "end_time": "2025-03-17T14:53:00.072920Z", "start_time": "2025-03-17T14:53:00.068115Z" } }, "source": [ "# Empty the variable to simulate a fresh environment\n", "results_ch_n = None " ], "outputs": [], "execution_count": 18 }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "\n", "#### Load the Results" ] }, { "cell_type": "code", "metadata": { "ExecuteTime": { "end_time": "2025-03-17T14:53:00.105702Z", "start_time": "2025-03-17T14:53:00.074690Z" } }, "source": [ "# Load the saved result from the pickle file\n", "results_ch_n = load_result_from_pickle(\"tutorial_input/results_ch_n.pickle\")" ], "outputs": [], "execution_count": 19 }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "\n", "#### Display Total Cost" ] }, { "cell_type": "code", "metadata": { "ExecuteTime": { "end_time": "2025-03-17T14:53:00.113210Z", "start_time": "2025-03-17T14:53:00.106781Z" } }, "source": [ "# Show the total cost from the loaded results\n", "results_ch_n.variables['TotalCost']" ], "outputs": [ { "data": { "text/plain": [ " TotalCost Run\n", "0 8639.711876 1\n", "0 8627.882623 2\n", "0 8839.060852 3\n", "0 9070.170968 4\n", "0 9317.948510 5\n", "0 9603.588316 6\n", "0 9898.640548 7\n", "0 10195.783194 8\n", "0 10487.994874 9\n", "0 10776.583884 10\n", "0 11066.069262 11" ], "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
TotalCostRun
08639.7118761
08627.8826232
08839.0608523
09070.1709684
09317.9485105
09603.5883166
09898.6405487
010195.7831948
010487.9948749
010776.58388410
011066.06926211
\n", "
" ] }, "execution_count": 20, "metadata": {}, "output_type": "execute_result" } ], "execution_count": 20 }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "\n", "- Accesses and displays the total cost from each run in the loaded results, verifying that the data was correctly saved and loaded.\n", "\n", "---\n", "\n", "By following these steps, you can:\n", "\n", "- **Perform multiple optimization runs** with varying parameters to analyze different scenarios.\n", "- **Visualize the results** of specific runs using Sankey diagrams, providing insight into energy flows.\n", "- **Analyze the impact** of parameter changes on key variables like investment costs through parametrization plots.\n", "- **Save and load the results** for future analysis, enhancing reproducibility and efficiency.\n", "\n", "This approach is particularly useful for conducting sensitivity analyses, exploring different energy strategies, and gaining deeper insights into the energy system's behavior under various conditions.\n", "\n", "> **Note**: Ensure that the Excel file `\"tutorial_input/param_run_es_n_infrastructure_ch_2050.xlsx\"` and the pickle file paths are correctly set in your environment. Additionally, the `plot_parametrisation` function may require specific data structures; refer to the EnergyScope documentation for more details.\n", "\n", "By leveraging these techniques, you can effectively utilize the EnergyScope model for comprehensive energy system analysis." ] } ], "metadata": { "kernelspec": { "display_name": ".es", "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.12.4" } }, "nbformat": 4, "nbformat_minor": 2 }