{ "cells": [ { "cell_type": "markdown", "id": "006ef34b", "metadata": {}, "source": [ "# Basic example\n", "\n", "This example contains the most commonly used objects, attributes, functions and commands for a basic SHOP model, in addition to examples of how to review and plot input data and results.\n", "\n", "It is not dependent on any other data sources such as ASCII files or spreadsheets, as all input data remain intact in the notebook (or Python code) itself, and is fully dependent on the API and pyshop for interacting with SHOP.\n", "\n", "The example watercourse consist of a simple SHOP model with two reservoirs and two plants which is optimized over the span of three days.\n", "\n", "We will show how to import all necessary packages, settings and data, create a SHOP instance and add all needed objects and populate them with data, before we run SHOP with a selection of commands and review the results in the end.\n", "\n", "While the model in this example is quite simple, it can serve as a good reference when designing your own models. It illustrates an intuitive way of designing models in pyshop by incrementally initializing new objects like reservoirs, plants, generators and markets, setting their key attributes before connecting them together into the a desired topology. The model is then optimized, before the results are retrieved and presented through plots.\n", "\n", "## Imports and settings\n", "\n", "The first thing we do is to import the needed packages. You can import whichever packages you like, however we use the following ones for this example:\n", "\n", "- Pandas for structuring our data into dataframes\n", "- pyshop in order to create a SHOP session\n", "- Plotly backend for dynamic graph plotting" ] }, { "cell_type": "code", "execution_count": 1, "id": "a3e804e5", "metadata": { "Collapsed": "false" }, "outputs": [], "source": [ "import pandas as pd\n", "from pyshop import ShopSession\n", "import plotly.graph_objs as go\n", "import plotly.express as px\n", "from plotly.subplots import make_subplots\n", "pd.options.plotting.backend = \"plotly\"" ] }, { "cell_type": "markdown", "id": "a1a5411c", "metadata": {}, "source": [ "## Instancing SHOP\n", "\n", "In order to have SHOP receive our inputs, run the model we create and give us results, we need to create an active, running SHOP session.\n", "\n", "You may create multiple SHOP sessions simultaneously if needed." ] }, { "cell_type": "code", "execution_count": 2, "id": "a22a0735", "metadata": { "Collapsed": "false" }, "outputs": [], "source": [ "# Creating a new SHOP session to the instance 'shop'\n", "shop = ShopSession()" ] }, { "cell_type": "markdown", "id": "97f71a01", "metadata": {}, "source": [ "We can also check the current versions of SHOP and its solvers." ] }, { "cell_type": "code", "execution_count": 3, "id": "608ceade", "metadata": { "Collapsed": "false" }, "outputs": [ { "data": { "text/plain": [ "'16.9.0 Cplex 20.1.0 Gurobi 7.5 OSI/CBC 2.9 2025-06-23'" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Writing out the current version of SHOP and its solvers\n", "shop.shop_api.GetVersionString()" ] }, { "cell_type": "markdown", "id": "89f84afa", "metadata": {}, "source": [ "## Setting time resolutions for the model\n", "\n", "We set the time resolution for the model ourselves, as we generate all input as we go. The start and end time are important, in addition to the resolution of the time steps." ] }, { "cell_type": "code", "execution_count": 4, "id": "d2b464e9", "metadata": { "Collapsed": "false" }, "outputs": [], "source": [ "# Setting the start time of the model\n", "starttime = pd.Timestamp('2018-01-23 00:00:00')\n", "\n", "# Setting the end time of the model\n", "endtime = pd.Timestamp('2018-01-26')\n", "\n", "# Setting the start and end time to the shop instance, and defining the time unit\n", "shop.set_time_resolution(starttime=starttime, endtime=endtime, timeunit=\"hour\", timeresolution=pd.Series(index=[starttime],data=[1]))" ] }, { "cell_type": "markdown", "id": "12a742f4", "metadata": {}, "source": [ "## Adding topology parameters\n", "\n", "In this example we define the entire topology and generate all its parameters via Python and the API. Below are simple examples on how to define the most common topology objects needed in order to run SHOP.\n", "\n", "### Reservoirs\n", "\n", "First, we start of by creating our reservoir objects. It is possible to just execute the function, or we can instance them. The latter is preferred, as the syntax for adding attributes to objects become shorter, in addition to it being handy." ] }, { "cell_type": "code", "execution_count": 5, "id": "19a4dfd6", "metadata": { "Collapsed": "false" }, "outputs": [], "source": [ "# Add reservoir objects to the model and instancing them\n", "rsv1 = shop.model.reservoir.add_object('Reservoir1')\n", "rsv2 = shop.model.reservoir.add_object('Reservoir2')\n", "# Alternatively, only the right hand side can be executed, however it is often nice to refer to instances later on" ] }, { "cell_type": "markdown", "id": "8389c192", "metadata": {}, "source": [ "We can then verify that all reservoir objects are correctly added to the model instance:" ] }, { "cell_type": "code", "execution_count": 6, "id": "af7da953", "metadata": { "Collapsed": "false" }, "outputs": [ { "data": { "text/plain": [ "['Reservoir1', 'Reservoir2']" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "shop.model.reservoir.get_object_names()" ] }, { "cell_type": "markdown", "id": "2f122838", "metadata": {}, "source": [ "Next, it is time to set the different parameters to the newly created objects, either via the instance, or directly through the function. Below are examples of both." ] }, { "cell_type": "code", "execution_count": 7, "id": "d33e4191", "metadata": { "Collapsed": "false" }, "outputs": [], "source": [ "# Setting the maximum volume in Mm3 via the instance\n", "rsv1.max_vol.set(39)\n", "rsv2.max_vol.set(97.5)\n", "\n", "# Setting the LRL (Lowest Regulated Level) of the reservoir in masl via the instance\n", "rsv1.lrl.set(860)\n", "rsv2.lrl.set(650)\n", "\n", "# Setting the HRL (Highest Regulated Level) of the reservoir in masl by command\n", "shop.model.reservoir.Reservoir1.hrl.set(905)\n", "shop.model.reservoir.Reservoir2.hrl.set(679)" ] }, { "cell_type": "markdown", "id": "51a91c46", "metadata": {}, "source": [ "We can then verify that these values have been stored correctly onto the object. We can either make a call to the instance, or execute the function directly." ] }, { "cell_type": "code", "execution_count": 8, "id": "4ed39a3d", "metadata": { "Collapsed": "false" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "HRL of Reservoir 1: 905.0\n", "HRL of Reservoir 2: 679.0\n" ] } ], "source": [ "# Using the instanced rsv1 to retrieve the HRL of the reservoir objects\n", "print(\"HRL of Reservoir 1: \",rsv1.hrl.get())\n", "print(\"HRL of Reservoir 2: \",rsv2.hrl.get())" ] }, { "cell_type": "code", "execution_count": 9, "id": "b171d793", "metadata": { "Collapsed": "false" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "LRL of Reservoir 1: 860.0\n", "LRL of Reservoir 2: 650.0\n" ] } ], "source": [ "# Using the function directly to retrieve the LRL of Reservoir1\n", "print(\"LRL of Reservoir 1: \",shop.model.reservoir.Reservoir1.lrl.get())\n", "print(\"LRL of Reservoir 2: \",shop.model.reservoir.Reservoir2.lrl.get())" ] }, { "cell_type": "markdown", "id": "af84e67e", "metadata": {}, "source": [ "We continue the process of setting all relevant attributes to the {ref}`reservoir` objects.\n", "!!!Ref. til I/O." ] }, { "cell_type": "code", "execution_count": 10, "id": "733b54c8", "metadata": { "Collapsed": "false" }, "outputs": [], "source": [ "# Setting the stage storage curve, the relation between the reservoir volume (in Mm3) and the height of the reservoir (in masl)\n", "rsv1.vol_head.set(\n", " pd.Series([860, 862, 864, 866, 870, 872, 874, 876, 878, 880, 882, 884, 886, 888, 890, 894, 896, 898, 902, 904, 905, 907],\n", " index=[0, 0.91, 1.87, 2.88, 5.07, 6.27, 7.56, 8.91, 10.34, 11.87, 13.53, 15.27, 17.11, 19.05, 21.1, 25.65, 27.96, 30.36, 35.18, 37.68, 39, 41.66], name=0))\n", "rsv2.vol_head.set(\n", " pd.Series([650, 651.28, 652.55, 653.83, 656.38, 657.66, 658.94, 660.21, 661.49, 662.77, 664.04, 665.32, 666.6, 667.87, 669.15, 671.70, 672.98, 674.26, 676.81, 678.09, 679, 680],\n", " index=[0, 2.275, 4.675, 7.2, 12.675, 15.675, 18.9, 22.275, 25.85, 29.675, 33.825, 38.175, 42.775, 47.625, 52.75, 64.125, 69.9, 75.9, 87.95, 94.2, 97.5, 104.15], name=0))" ] }, { "cell_type": "code", "execution_count": 11, "id": "1bd82aaf", "metadata": { "Collapsed": "false" }, "outputs": [], "source": [ "# Setting the overflow description, the (linear) relation between spillage (in m3/s) and masl.\n", "rsv1.flow_descr.set(pd.Series([0, 132], index=[906, 907], name=0))\n", "rsv2.flow_descr.set(pd.Series([0, 132], index=[679, 680], name=0))\n", "\n", "# Inflow to the reservoir is an example of an attribute that can be set as a time series,using indexes that relate values to points in time\n", "rsv2.inflow.set(pd.Series([60], [starttime]))" ] }, { "cell_type": "markdown", "id": "228b555c", "metadata": {}, "source": [ "In order to let the model know which initial conditions are set, i.e. the initial start reservoir levels, we need to define them." ] }, { "cell_type": "code", "execution_count": 12, "id": "c2e18d0b", "metadata": { "Collapsed": "false" }, "outputs": [], "source": [ "# Setting the initial start reservoir height in masl\n", "rsv1.start_head.set(900)\n", "rsv2.start_head.set(670)" ] }, { "cell_type": "markdown", "id": "267f5962", "metadata": {}, "source": [ "We also define the endpoint descriptions (water values) for the reservoirs. The model needs these in order to compare the value of the water remaining in the reservoirs at the end of the period compared to the value of selling the water in the market given the market price." ] }, { "cell_type": "code", "execution_count": 13, "id": "13a2ee20", "metadata": { "Collapsed": "false" }, "outputs": [], "source": [ "# Setting the endpoint description (water value) to 'rsv1' in NOK/MWh\n", "rsv1.energy_value_input.set(30)\n", "# Setting the endpoint description (water value) to 'rsv2' in NOK/MWh\n", "rsv2.energy_value_input.set(10)" ] }, { "cell_type": "markdown", "id": "7be35004", "metadata": {}, "source": [ "Now let's review some of the input graphically. Data such as time series, XY-curves and DataFrames can be plotted with a single line of code using .plot()." ] }, { "cell_type": "code", "execution_count": 14, "id": "920dd8f6", "metadata": { "Collapsed": "false" }, "outputs": [ { "data": { "text/html": [ " \n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "hovertemplate": "=0.0
Mm3=%{x}
masl=%{y}", "legendgroup": "0.0", "line": { "color": "#636efa", "dash": "solid" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "0.0", "orientation": "v", "showlegend": true, "type": "scatter", "x": [ 0.0, 0.91, 1.87, 2.88, 5.07, 6.27, 7.56, 8.91, 10.34, 11.87, 13.53, 15.27, 17.11, 19.05, 21.1, 25.65, 27.96, 30.36, 35.18, 37.68, 39.0, 41.66 ], "xaxis": "x", "y": [ 860.0, 862.0, 864.0, 866.0, 870.0, 872.0, 874.0, 876.0, 878.0, 880.0, 882.0, 884.0, 886.0, 888.0, 890.0, 894.0, 896.0, 898.0, 902.0, 904.0, 905.0, 907.0 ], "yaxis": "y" } ], "layout": { "legend": { "title": { "text": "" }, "tracegroupgap": 0 }, "showlegend": false, "template": { "data": { "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" } ], "barpolar": [ { "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "barpolar" } ], "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" } ], "choropleth": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "choropleth" } ], "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" ] ], "type": "contour" } ], "contourcarpet": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "contourcarpet" } ], "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" ] ], "type": "heatmap" } ], "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" ] ], "type": "heatmapgl" } ], "histogram": [ { "marker": { "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "histogram" } ], "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" ] ], "type": "histogram2d" } ], "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" ] ], "type": "histogram2dcontour" } ], "mesh3d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "mesh3d" } ], "parcoords": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "parcoords" } ], "pie": [ { "automargin": true, "type": "pie" } ], "scatter": [ { "fillpattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 }, "type": "scatter" } ], "scatter3d": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter3d" } ], "scattercarpet": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattercarpet" } ], "scattergeo": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergeo" } ], "scattergl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergl" } ], "scattermapbox": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattermapbox" } ], "scatterpolar": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolar" } ], "scatterpolargl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolargl" } ], "scatterternary": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterternary" } ], "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" ] ], "type": "surface" } ], "table": [ { "cells": { "fill": { "color": "#EBF0F8" }, "line": { "color": "white" } }, "header": { "fill": { "color": "#C8D4E3" }, "line": { "color": "white" } }, "type": "table" } ] }, "layout": { "annotationdefaults": { "arrowcolor": "#2a3f5f", "arrowhead": 0, "arrowwidth": 1 }, "autotypenumbers": "strict", "coloraxis": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "colorscale": { "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" ] ], "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" ] ] }, "colorway": [ "#636efa", "#EF553B", "#00cc96", "#ab63fa", "#FFA15A", "#19d3f3", "#FF6692", "#B6E880", "#FF97FF", "#FECB52" ], "font": { "color": "#2a3f5f" }, "geo": { "bgcolor": "white", "lakecolor": "white", "landcolor": "#E5ECF6", "showlakes": true, "showland": true, "subunitcolor": "white" }, "hoverlabel": { "align": "left" }, "hovermode": "closest", "mapbox": { "style": "light" }, "paper_bgcolor": "white", "plot_bgcolor": "#E5ECF6", "polar": { "angularaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "radialaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "scene": { "xaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "yaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "zaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" } }, "shapedefaults": { "line": { "color": "#2a3f5f" } }, "ternary": { "aaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "baxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "caxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "title": { "x": 0.05 }, "xaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 }, "yaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 } } }, "title": { "text": "Volume/head relation of Reservoir1" }, "xaxis": { "anchor": "y", "domain": [ 0.0, 1.0 ], "title": { "text": "Mm3" } }, "yaxis": { "anchor": "x", "domain": [ 0.0, 1.0 ], "title": { "text": "masl" } } } }, "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# Plotting the volume/head relation of Reservoir1\n", "rsv1.vol_head.get().plot(title=\"Volume/head relation of Reservoir1\", labels=dict(index=\"Mm3\", value=\"masl\", variable=\"\")).update_layout(showlegend=False)" ] }, { "cell_type": "markdown", "id": "679712e2", "metadata": {}, "source": [ "Or they can be plotted in any style and design imaginable using your favorite plotting tools and packages." ] }, { "cell_type": "code", "execution_count": 15, "id": "12935970", "metadata": { "Collapsed": "false" }, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "marker": { "color": "rgb(116,169,207)" }, "name": "Reservoir volume and height", "type": "scatter", "x": [ 0.0, 2.275, 4.675, 7.2, 12.675, 15.675, 18.9, 22.275, 25.85, 29.675, 33.825, 38.175, 42.775, 47.625, 52.75, 64.125, 69.9, 75.9, 87.95, 94.2, 97.5, 104.15 ], "y": [ 650.0, 651.28, 652.55, 653.83, 656.38, 657.66, 658.94, 660.21, 661.49, 662.77, 664.04, 665.32, 666.6, 667.87, 669.15, 671.7, 672.98, 674.26, 676.81, 678.09, 679.0, 680.0 ] }, { "marker": { "color": "rgb(5,112,176)", "line": { "color": "rgb(5,112,176)", "width": 4 }, "size": 3 }, "mode": "markers", "name": "Start point", "type": "scatter", "x": [ 56.541666666666664 ], "y": [ 670.0 ] } ], "layout": { "template": { "data": { "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" } ], "barpolar": [ { "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "barpolar" } ], "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" } ], "choropleth": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "choropleth" } ], "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" ] ], "type": "contour" } ], "contourcarpet": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "contourcarpet" } ], "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" ] ], "type": "heatmap" } ], "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" ] ], "type": "heatmapgl" } ], "histogram": [ { "marker": { "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "histogram" } ], "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" ] ], "type": "histogram2d" } ], "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" ] ], "type": "histogram2dcontour" } ], "mesh3d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "mesh3d" } ], "parcoords": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "parcoords" } ], "pie": [ { "automargin": true, "type": "pie" } ], "scatter": [ { "fillpattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 }, "type": "scatter" } ], "scatter3d": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter3d" } ], "scattercarpet": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattercarpet" } ], "scattergeo": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergeo" } ], "scattergl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergl" } ], "scattermapbox": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattermapbox" } ], "scatterpolar": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolar" } ], "scatterpolargl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolargl" } ], "scatterternary": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterternary" } ], "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" ] ], "type": "surface" } ], "table": [ { "cells": { "fill": { "color": "#EBF0F8" }, "line": { "color": "white" } }, "header": { "fill": { "color": "#C8D4E3" }, "line": { "color": "white" } }, "type": "table" } ] }, "layout": { "annotationdefaults": { "arrowcolor": "#2a3f5f", "arrowhead": 0, "arrowwidth": 1 }, "autotypenumbers": "strict", "coloraxis": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "colorscale": { "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" ] ], "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" ] ] }, "colorway": [ "#636efa", "#EF553B", "#00cc96", "#ab63fa", "#FFA15A", "#19d3f3", "#FF6692", "#B6E880", "#FF97FF", "#FECB52" ], "font": { "color": "#2a3f5f" }, "geo": { "bgcolor": "white", "lakecolor": "white", "landcolor": "#E5ECF6", "showlakes": true, "showland": true, "subunitcolor": "white" }, "hoverlabel": { "align": "left" }, "hovermode": "closest", "mapbox": { "style": "light" }, "paper_bgcolor": "white", "plot_bgcolor": "#E5ECF6", "polar": { "angularaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "radialaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "scene": { "xaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "yaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "zaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" } }, "shapedefaults": { "line": { "color": "#2a3f5f" } }, "ternary": { "aaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "baxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "caxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "title": { "x": 0.05 }, "xaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 }, "yaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 } } }, "title": { "text": "Reservoir volume and height in Reservoir2 " }, "xaxis": { "title": { "text": "Volume (Mm3)" } }, "yaxis": { "title": { "text": "Height (meter)" } } } }, "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# Plotting the volume/head relation of Reservoir2, including the initial starting point\n", "\n", "from scipy.interpolate import interp1d\n", "\n", "vol_height=shop.model.reservoir.Reservoir2.vol_head.get()\n", "start_height=shop.model.reservoir.Reservoir2.start_head.get()\n", "\n", "interplation_function = interp1d(vol_height.values, vol_height.index)\n", "start_volume=float(interplation_function(start_height))\n", "\n", "fig = go.Figure()\n", "colorscale = px.colors.sequential.PuBu_r\n", "fig.add_trace(go.Scatter(x=vol_height.index, y=vol_height.values, name=\"Reservoir volume and height\", marker_color=colorscale[4]))\n", "fig.add_trace(go.Scatter(x=[start_volume], y=[start_height], name=\"Start point\",marker_color=colorscale[2], mode='markers', marker=dict(color='rgba(0,0,0, 0.0)', size=3, line=dict(color=colorscale[2], width=4))))\n", "fig.update_layout(title=\"Reservoir volume and height in Reservoir2 \", xaxis_title=\"Volume (Mm3)\", yaxis_title=\"Height (meter)\")\n", "\n", "fig.show()" ] }, { "cell_type": "markdown", "id": "43758832", "metadata": {}, "source": [ "### Plants\n", "\n", "The next objects to add to our model are the {ref}`plant` objects. We instance them the same way as we instanced the {ref}`reservoir` objects." ] }, { "cell_type": "code", "execution_count": 16, "id": "0c124a0d", "metadata": { "Collapsed": "false" }, "outputs": [], "source": [ "# Add a plant objects to the model and instancing them\n", "plant1 = shop.model.plant.add_object('Plant1')\n", "plant2 = shop.model.plant.add_object('Plant2')\n", "# Alternatively, only the right hand side can be executed, however it is often nice to refer to instances later on" ] }, { "cell_type": "markdown", "id": "db2bb96b", "metadata": {}, "source": [ "Next we verify that our objects are correctly added to the shop instance." ] }, { "cell_type": "code", "execution_count": 17, "id": "ef5c2240", "metadata": { "Collapsed": "false" }, "outputs": [ { "data": { "text/plain": [ "['Plant1', 'Plant2']" ] }, "execution_count": 17, "metadata": {}, "output_type": "execute_result" } ], "source": [ "shop.model.plant.get_object_names()" ] }, { "cell_type": "markdown", "id": "38b192f0", "metadata": {}, "source": [ "The {ref}`plant` objects need attributes as well." ] }, { "cell_type": "code", "execution_count": 18, "id": "6f40ae1e", "metadata": { "Collapsed": "false" }, "outputs": [], "source": [ "# Setting the outlet line / tailrace height in masl\n", "plant1.outlet_line.set(672)\n", "plant2.outlet_line.set(586)\n", "\n", "# Setting the main loss in the plant\n", "plant1.main_loss.set([0])\n", "plant2.main_loss.set([0])\n", "\n", "# Setting the penstock loss in the plant. The number of penstocks are populated equal to the number of losses defined.\n", "plant1.penstock_loss.set([0.001])\n", "plant2.penstock_loss.set([0.0001,0.0002])" ] }, { "cell_type": "markdown", "id": "1d9bc010", "metadata": {}, "source": [ "### Generators\n", "\n", "A {ref}`plant` needs at least one {ref}`generator`. We add two generators to plant 1, and four generators to plant 2" ] }, { "cell_type": "code", "execution_count": 19, "id": "fdcd05cc", "metadata": { "Collapsed": "false" }, "outputs": [], "source": [ "# Add a generator object to the model\n", "p1g1 = shop.model.generator.add_object('Plant1_Generator1')\n", "p1g2 = shop.model.generator.add_object('Plant1_Generator2')\n", "\n", "p2g1 = shop.model.generator.add_object('Plant2_Generator1')\n", "p2g2 = shop.model.generator.add_object('Plant2_Generator2')\n", "p2g3 = shop.model.generator.add_object('Plant2_Generator3')\n", "p2g4 = shop.model.generator.add_object('Plant2_Generator4')" ] }, { "cell_type": "markdown", "id": "64f78f44", "metadata": {}, "source": [ "The connection between the {ref}`generator` and its {ref}`plant` must be set before defining the generator's parameters, whereas other connections in the model can be set after its objects and parameters have been set." ] }, { "cell_type": "code", "execution_count": 20, "id": "f3b447d5", "metadata": { "Collapsed": "false" }, "outputs": [], "source": [ "# Connecting the generator to the correct plant\n", "p1g1.connect_to(plant1)\n", "p1g2.connect_to(plant1)\n", "\n", "p2g1.connect_to(plant2)\n", "p2g2.connect_to(plant2)\n", "p2g3.connect_to(plant2)\n", "p2g4.connect_to(plant2)" ] }, { "cell_type": "markdown", "id": "a1bdd0e9", "metadata": {}, "source": [ "We control the {ref}`generator` objects in the model after adding and connecting them." ] }, { "cell_type": "code", "execution_count": 21, "id": "bc263138", "metadata": { "Collapsed": "false" }, "outputs": [ { "data": { "text/plain": [ "['Plant1_Generator1',\n", " 'Plant1_Generator2',\n", " 'Plant2_Generator1',\n", " 'Plant2_Generator2',\n", " 'Plant2_Generator3',\n", " 'Plant2_Generator4']" ] }, "execution_count": 21, "metadata": {}, "output_type": "execute_result" } ], "source": [ "shop.model.generator.get_object_names()" ] }, { "cell_type": "markdown", "id": "95d5f3be", "metadata": {}, "source": [ "Then we move on to the {ref}`generator` attributes. Certain generators are identical, so in order to preserve consistency, we make use of the .get()-function, so that if we change parameters on one of the duplicate generators, all of them will receive the change(s)." ] }, { "cell_type": "code", "execution_count": 22, "id": "713af0ea", "metadata": { "Collapsed": "false" }, "outputs": [], "source": [ "# Setting the number of penstocks\n", "p1g1.penstock.set(1)\n", "p1g2.penstock.set(p1g1.penstock.get())\n", "\n", "p2g1.penstock.set(1)\n", "p2g2.penstock.set(2)\n", "p2g3.penstock.set(p2g2.penstock.get())\n", "p2g4.penstock.set(p2g2.penstock.get())\n", "\n", "# Setting the minimum production in MW\n", "p1g1.p_min.set(60)\n", "p1g2.p_min.set(p1g1.p_min.get())\n", "\n", "p2g1.p_min.set(100)\n", "p2g2.p_min.set(30)\n", "p2g3.p_min.set(p2g2.p_min.get())\n", "p2g4.p_min.set(p2g2.p_min.get())\n", "\n", "# Setting the maximum production in MW\n", "p1g1.p_max.set(120)\n", "p1g2.p_max.set(p1g1.p_max.get())\n", "\n", "p2g1.p_max.set(180)\n", "p2g2.p_max.set(55)\n", "p2g3.p_max.set(p2g2.p_max.get())\n", "p2g4.p_max.set(p2g2.p_max.get())\n", "\n", "# Setting the nominal production in MW\n", "p1g1.p_nom.set(120)\n", "p1g2.p_nom.set(p1g1.p_nom.get())\n", "\n", "p2g1.p_nom.set(180)\n", "p2g2.p_nom.set(55)\n", "p2g3.p_nom.set(p2g2.p_nom.get())\n", "p2g4.p_nom.set(p2g2.p_nom.get())\n", "\n", "# Setting the start cost in a monetary unit (i.e. $ or NOK, the model only compares costs to each other, so you just need to be sure all costs are in the same unit)\n", "p1g1.startcost.set(500)\n", "p1g2.startcost.set(p1g1.startcost.get())\n", "\n", "p2g1.startcost.set(600)\n", "p2g2.startcost.set(200)\n", "p2g3.startcost.set(p2g2.startcost.get())\n", "p2g4.startcost.set(p2g2.startcost.get())\n", "\n", "# Setting generator efficiency curves, which is the releation between the efficiency factor (%) and production (MW)\n", "p1g1.gen_eff_curve.set(pd.Series([100, 100], index=[60, 120]))\n", "p1g2.gen_eff_curve.set(p1g1.gen_eff_curve.get())\n", "\n", "p2g1.gen_eff_curve.set(pd.Series([100, 100], index=[100, 180]))\n", "p2g2.gen_eff_curve.set(pd.Series([100, 100], index=[30, 60]))\n", "p2g3.gen_eff_curve.set(p2g2.gen_eff_curve.get())\n", "p2g4.gen_eff_curve.set(p2g2.gen_eff_curve.get())\n", "\n", "# Setting turbine efficiency curves, which is the relation between the efficiency factor (%) and release (m3/s) for different head levels (masl)\n", "p1g1.turb_eff_curves.set([pd.Series([85.8733, 87.0319, 88.0879, 89.0544, 89.9446, 90.7717, 91.5488, 92.2643, 92.8213, 93.1090, 93.2170, 93.0390, 92.6570, 92.1746],\n", " index=[28.12, 30.45, 32.78, 35.11, 37.45, 39.78, 42.11, 44.44, 46.77, 49.10, 51.43, 53.76, 56.10, 58.83],\n", " name=170),\n", " pd.Series([86.7321, 87.9022, 88.9688, 89.9450, 90.8441, 91.6794, 92.4643, 93.1870, 93.7495, 94.0401, 94.1492, 93.9694, 93.5836, 93.0964],\n", " index=[28.12, 30.45, 32.78, 35.11, 37.45, 39.78, 42.11, 44.44, 46.77, 49.10, 51.43, 53.76, 56.10, 58.83],\n", " name=200),\n", " pd.Series([87.5908, 88.7725, 89.8497, 90.8355, 91.7435, 92.5871, 93.3798, 94.1096, 94.6777, 94.9712, 95.0813, 94.8998, 94.5101, 94.0181],\n", " index=[28.12, 30.45, 32.78, 35.11, 37.45, 39.78, 42.11, 44.44, 46.77, 49.10, 51.43, 53.76, 56.10, 58.83],\n", " name=230)])\n", "p1g2.turb_eff_curves.set(p1g1.turb_eff_curves.get())\n", "\n", "p2g1.turb_eff_curves.set([pd.Series([92.7201, 93.2583, 93.7305, 94.1368, 94.4785, 94.7525, 94.9606, 95.1028, 95.1790, 95.1892, 95.1335, 95.0118, 94.8232, 94.5191],\n", " index=[126.54, 137.03, 147.51, 158.00, 168.53, 179.01, 189.50, 199.98, 210.47, 220.95, 231.44, 241.92, 252.45, 264.74],\n", " name=60)])\n", "\n", "p2g2.turb_eff_curves.set([pd.Series([83.8700, 85.1937, 86.3825, 87.4362, 88.3587, 89.1419, 89.7901, 90.3033, 90.6815, 90.9248, 91.0331, 91.0063, 90.8436, 90.4817],\n", " index=[40.82, 44.20, 47.58, 50.97, 54.36, 57.75, 61.13, 64.51, 67.89, 71.27, 74.66, 78.04, 81.44, 85.40],\n", " name=60)])\n", "p2g3.turb_eff_curves.set(p2g2.turb_eff_curves.get())\n", "p2g4.turb_eff_curves.set(p2g2.turb_eff_curves.get())" ] }, { "cell_type": "markdown", "id": "ef26974e", "metadata": {}, "source": [ "Now we can plot some of the {ref}`generator` data, to ensure that we have the correct data." ] }, { "cell_type": "code", "execution_count": 23, "id": "aed75266", "metadata": { "Collapsed": "false" }, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "line": { "width": 2 }, "marker": { "color": "rgb(33,102,172)" }, "mode": "lines+markers", "name": "Net Head=170.0", "type": "scatter", "x": [ 28.12, 30.45, 32.78, 35.11, 37.45, 39.78, 42.11, 44.44, 46.77, 49.1, 51.43, 53.76, 56.1, 58.83 ], "y": [ 85.8733, 87.0319, 88.0879, 89.0544, 89.9446, 90.7717, 91.5488, 92.2643, 92.8213, 93.109, 93.217, 93.039, 92.657, 92.1746 ] }, { "line": { "width": 2 }, "marker": { "color": "rgb(67,147,195)" }, "mode": "lines+markers", "name": "Net Head=200.0", "type": "scatter", "x": [ 28.12, 30.45, 32.78, 35.11, 37.45, 39.78, 42.11, 44.44, 46.77, 49.1, 51.43, 53.76, 56.1, 58.83 ], "y": [ 86.7321, 87.9022, 88.9688, 89.945, 90.8441, 91.6794, 92.4643, 93.187, 93.7495, 94.0401, 94.1492, 93.9694, 93.5836, 93.0964 ] }, { "line": { "width": 2 }, "marker": { "color": "rgb(146,197,222)" }, "mode": "lines+markers", "name": "Net Head=230.0", "type": "scatter", "x": [ 28.12, 30.45, 32.78, 35.11, 37.45, 39.78, 42.11, 44.44, 46.77, 49.1, 51.43, 53.76, 56.1, 58.83 ], "y": [ 87.5908, 88.7725, 89.8497, 90.8355, 91.7435, 92.5871, 93.3798, 94.1096, 94.6777, 94.9712, 95.0813, 94.8998, 94.5101, 94.0181 ] } ], "layout": { "template": { "data": { "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" } ], "barpolar": [ { "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "barpolar" } ], "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" } ], "choropleth": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "choropleth" } ], "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" ] ], "type": "contour" } ], "contourcarpet": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "contourcarpet" } ], "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" ] ], "type": "heatmap" } ], "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" ] ], "type": "heatmapgl" } ], "histogram": [ { "marker": { "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "histogram" } ], "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" ] ], "type": "histogram2d" } ], "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" ] ], "type": "histogram2dcontour" } ], "mesh3d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "mesh3d" } ], "parcoords": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "parcoords" } ], "pie": [ { "automargin": true, "type": "pie" } ], "scatter": [ { "fillpattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 }, "type": "scatter" } ], "scatter3d": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter3d" } ], "scattercarpet": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattercarpet" } ], "scattergeo": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergeo" } ], "scattergl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergl" } ], "scattermapbox": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattermapbox" } ], "scatterpolar": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolar" } ], "scatterpolargl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolargl" } ], "scatterternary": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterternary" } ], "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" ] ], "type": "surface" } ], "table": [ { "cells": { "fill": { "color": "#EBF0F8" }, "line": { "color": "white" } }, "header": { "fill": { "color": "#C8D4E3" }, "line": { "color": "white" } }, "type": "table" } ] }, "layout": { "annotationdefaults": { "arrowcolor": "#2a3f5f", "arrowhead": 0, "arrowwidth": 1 }, "autotypenumbers": "strict", "coloraxis": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "colorscale": { "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" ] ], "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" ] ] }, "colorway": [ "#636efa", "#EF553B", "#00cc96", "#ab63fa", "#FFA15A", "#19d3f3", "#FF6692", "#B6E880", "#FF97FF", "#FECB52" ], "font": { "color": "#2a3f5f" }, "geo": { "bgcolor": "white", "lakecolor": "white", "landcolor": "#E5ECF6", "showlakes": true, "showland": true, "subunitcolor": "white" }, "hoverlabel": { "align": "left" }, "hovermode": "closest", "mapbox": { "style": "light" }, "paper_bgcolor": "white", "plot_bgcolor": "#E5ECF6", "polar": { "angularaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "radialaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "scene": { "xaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "yaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "zaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" } }, "shapedefaults": { "line": { "color": "#2a3f5f" } }, "ternary": { "aaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "baxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "caxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "title": { "x": 0.05 }, "xaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 }, "yaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 } } }, "title": { "text": "Turbine efficiency curves of G1 in Plant1" }, "xaxis": { "title": { "text": "Discharge (m3/s)" } }, "yaxis": { "title": { "text": "Efficiency (%)" } } } }, "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# Plotting the turbine efficiency curves of G1 (G2 is the same as G1) in Plant1\n", "turb_eff_curves=shop.model.generator.Plant1_Generator1.turb_eff_curves.get()\n", "\n", "fig = go.Figure()\n", "colorscale = px.colors.sequential.RdBu_r\n", "color = 0\n", "for curve in turb_eff_curves:\n", " color+=1\n", " curve_name=\"Net Head=\"+str(curve.name)\n", " fig.add_trace(go.Scatter(x=curve.index, y=curve.values, marker_color = colorscale[color], name=curve_name, mode=\"lines+markers\", line=dict(width=2)))\n", "\n", "fig.update_layout(title=\"Turbine efficiency curves of G1 in Plant1\", xaxis_title=\"Discharge (m3/s)\", yaxis_title=\"Efficiency (%)\")\n", "\n", "fig.show()" ] }, { "cell_type": "code", "execution_count": 24, "id": "71496594", "metadata": { "Collapsed": "false" }, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "line": { "width": 2 }, "marker": { "color": "rgb(209,229,240)" }, "mode": "lines+markers", "name": "G1 Net Head=60.0", "type": "scatter", "x": [ 126.54, 137.03, 147.51, 158.0, 168.53, 179.01, 189.5, 199.98, 210.47, 220.95, 231.44, 241.92, 252.45, 264.74 ], "y": [ 92.7201, 93.2583, 93.7305, 94.1368, 94.4785, 94.7525, 94.9606, 95.1028, 95.179, 95.1892, 95.1335, 95.0118, 94.8232, 94.5191 ] }, { "line": { "width": 2 }, "marker": { "color": "rgb(247,247,247)" }, "mode": "lines+markers", "name": "G2 Net Head=60.0", "type": "scatter", "x": [ 40.82, 44.2, 47.58, 50.97, 54.36, 57.75, 61.13, 64.51, 67.89, 71.27, 74.66, 78.04, 81.44, 85.4 ], "y": [ 83.87, 85.1937, 86.3825, 87.4362, 88.3587, 89.1419, 89.7901, 90.3033, 90.6815, 90.9248, 91.0331, 91.0063, 90.8436, 90.4817 ] } ], "layout": { "template": { "data": { "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" } ], "barpolar": [ { "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "barpolar" } ], "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" } ], "choropleth": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "choropleth" } ], "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" ] ], "type": "contour" } ], "contourcarpet": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "contourcarpet" } ], "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" ] ], "type": "heatmap" } ], "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" ] ], "type": "heatmapgl" } ], "histogram": [ { "marker": { "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "histogram" } ], "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" ] ], "type": "histogram2d" } ], "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" ] ], "type": "histogram2dcontour" } ], "mesh3d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "mesh3d" } ], "parcoords": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "parcoords" } ], "pie": [ { "automargin": true, "type": "pie" } ], "scatter": [ { "fillpattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 }, "type": "scatter" } ], "scatter3d": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter3d" } ], "scattercarpet": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattercarpet" } ], "scattergeo": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergeo" } ], "scattergl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergl" } ], "scattermapbox": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattermapbox" } ], "scatterpolar": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolar" } ], "scatterpolargl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolargl" } ], "scatterternary": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterternary" } ], "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" ] ], "type": "surface" } ], "table": [ { "cells": { "fill": { "color": "#EBF0F8" }, "line": { "color": "white" } }, "header": { "fill": { "color": "#C8D4E3" }, "line": { "color": "white" } }, "type": "table" } ] }, "layout": { "annotationdefaults": { "arrowcolor": "#2a3f5f", "arrowhead": 0, "arrowwidth": 1 }, "autotypenumbers": "strict", "coloraxis": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "colorscale": { "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" ] ], "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" ] ] }, "colorway": [ "#636efa", "#EF553B", "#00cc96", "#ab63fa", "#FFA15A", "#19d3f3", "#FF6692", "#B6E880", "#FF97FF", "#FECB52" ], "font": { "color": "#2a3f5f" }, "geo": { "bgcolor": "white", "lakecolor": "white", "landcolor": "#E5ECF6", "showlakes": true, "showland": true, "subunitcolor": "white" }, "hoverlabel": { "align": "left" }, "hovermode": "closest", "mapbox": { "style": "light" }, "paper_bgcolor": "white", "plot_bgcolor": "#E5ECF6", "polar": { "angularaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "radialaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "scene": { "xaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "yaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "zaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" } }, "shapedefaults": { "line": { "color": "#2a3f5f" } }, "ternary": { "aaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "baxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "caxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "title": { "x": 0.05 }, "xaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 }, "yaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 } } }, "title": { "text": "Turbine efficiency curves of G1 and G2 in Plant2" }, "xaxis": { "title": { "text": "Discharge (m3/s)" } }, "yaxis": { "title": { "text": "Efficiency (%)" } } } }, "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# Plot the turbine efficiency curves of G1 and G2 (G3, G4 are the same as G2) in Plant2\n", "turb_eff_curves_G1=shop.model.generator.Plant2_Generator1.turb_eff_curves.get()\n", "turb_eff_curves_G2=shop.model.generator.Plant2_Generator2.turb_eff_curves.get()\n", "\n", "fig = go.Figure()\n", "\n", "for curve in turb_eff_curves_G1:\n", " color+=1\n", " curve_name=\"G1 Net Head=\"+str(curve.name)\n", " fig.add_trace(go.Scatter(x=curve.index, y=curve.values, marker_color = colorscale[color], name=curve_name, mode=\"lines+markers\", line=dict(width=2)))\n", "\n", "for curve in turb_eff_curves_G2:\n", " color+=1\n", " curve_name=\"G2 Net Head=\"+str(curve.name)\n", " fig.add_trace(go.Scatter(x=curve.index, y=curve.values, marker_color = colorscale[color], name=curve_name, mode=\"lines+markers\", line=dict(width=2)))\n", "\n", "fig.update_layout(title=\"Turbine efficiency curves of G1 and G2 in Plant2\", xaxis_title=\"Discharge (m3/s)\", yaxis_title=\"Efficiency (%)\")\n", "\n", "fig.show()" ] }, { "cell_type": "markdown", "id": "7258c9a6", "metadata": {}, "source": [ "### Gates\n", "\n", "Water routes such as spillways, bypasses and gates between objects, can be defined and applied with certain attributes as well." ] }, { "cell_type": "code", "execution_count": 25, "id": "0be2cf7a", "metadata": { "Collapsed": "false" }, "outputs": [], "source": [ "# Adding a spillway between Reservoir 1 and Reservoir 2\n", "s_rsv1_rsv2 = shop.model.gate.add_object('s_Reservoir1_Reservoir2')\n", "\n", "# Adding a bypass between Reservoir 1 and Reservoir 2\n", "b_rsv1_rsv2 = shop.model.gate.add_object('b_Reservoir1_Reservoir2')\n", "\n", "# Adding a spillway between Reservoir 1 and Reservoir 2\n", "s_rsv2_ocean = shop.model.gate.add_object('s_Reservoir2_Ocean')\n", "\n", "# Adding a bypass between Reservoir 1 and Reservoir 2\n", "b_rsv2_ocean = shop.model.gate.add_object('b_Reservoir2_Ocean')" ] }, { "cell_type": "markdown", "id": "d2ab5e79", "metadata": {}, "source": [ "And we do a quick control of the content on {ref}`gate` objects afterwards." ] }, { "cell_type": "code", "execution_count": 26, "id": "c364d443", "metadata": { "Collapsed": "false" }, "outputs": [ { "data": { "text/plain": [ "['s_Reservoir1_Reservoir2',\n", " 'b_Reservoir1_Reservoir2',\n", " 's_Reservoir2_Ocean',\n", " 'b_Reservoir2_Ocean']" ] }, "execution_count": 26, "metadata": {}, "output_type": "execute_result" } ], "source": [ "shop.model.gate.get_object_names()" ] }, { "cell_type": "markdown", "id": "0c8a5215", "metadata": {}, "source": [ "## Connecting the topology objects\n", "\n", "After adding the objects and defining parameters to them, we need to connect them together in order for the model to know which parts that can interact with each other. This means for instance that we need to connect a certain reservoir to a certain plant. In this example, _Reservoir1_ should connect to _Plant1_, Plant1 should then further be connected to _Reservoir2_, whereas Reservoir2 again connects to _Plant2_. Additionally, we need to correcrtly connect the gates, spillways and bypasses. We always connect objects from the top to the bottom, starting with the uppermost object relative to elevation. Note that it is necessary to specify the keyword argument \"connection_type\" when connecting a bypass or spill gate to the upper reservoir, but it is not needed when the bypass or spill gate is connected to the downstream reservoir." ] }, { "cell_type": "code", "execution_count": 27, "id": "2611ac9d", "metadata": { "Collapsed": "false" }, "outputs": [], "source": [ "# Connecting Reservoir 1 to Plant1\n", "rsv1.connect_to(plant1)\n", "\n", "# Connecting Reservoir 1 to the bypass between Reservoir1 and Reservoir2\n", "rsv1.connect_to(b_rsv1_rsv2,connection_type=\"bypass\")\n", "\n", "# Connecting Reservoir 1 to the spillway between Reservoir1 and Reservoir2\n", "rsv1.connect_to(s_rsv1_rsv2,connection_type=\"spill\")\n", "\n", "# Connecting Plant1 to Reservoir2\n", "plant1.connect_to(rsv2)\n", "\n", "# Connecting the bypass between Reservoir1 and Reservoir2 to Reservoir2\n", "b_rsv1_rsv2.connect_to(rsv2)\n", "\n", "# Connecting the spillway between Reservoir1 and Reservoir2 to Reservoir2\n", "s_rsv1_rsv2.connect_to(rsv2)\n", "\n", "# Connecting Reservoir2 to Plant 2\n", "rsv2.connect_to(plant2)\n", "\n", "# Connecting Reservoir2 to the bypass between Reservoir2 and Ocean\n", "rsv2.connect_to(b_rsv2_ocean,connection_type=\"bypass\")\n", "\n", "# Connecting Reservoir2 to the spillway between Reservoir2 and Ocean\n", "rsv2.connect_to(s_rsv2_ocean,connection_type=\"spill\")" ] }, { "cell_type": "markdown", "id": "84353a24", "metadata": {}, "source": [ "We can then verify if the topology is correctly set up, by graphing out the topology tree." ] }, { "cell_type": "code", "execution_count": 28, "id": "b9ec372a", "metadata": { "Collapsed": "false" }, "outputs": [ { "data": { "image/svg+xml": [ "\n", "\n", "\n", "\n", "\n", "\n", "%3\n", "\n", "\n", "\n", "reservoir_Reservoir1\n", "\n", "Reservoir1\n", "\n", "\n", "\n", "plant_Plant1\n", "\n", "Plant1\n", "\n", "\n", "\n", "reservoir_Reservoir1->plant_Plant1\n", "\n", "\n", "\n", "\n", "gate_s_Reservoir1_Reservoir2\n", "\n", "s_Reservoir1_Reservoir2\n", "\n", "\n", "\n", "reservoir_Reservoir1->gate_s_Reservoir1_Reservoir2\n", "\n", "\n", "\n", "\n", "gate_b_Reservoir1_Reservoir2\n", "\n", "b_Reservoir1_Reservoir2\n", "\n", "\n", "\n", "reservoir_Reservoir1->gate_b_Reservoir1_Reservoir2\n", "\n", "\n", "\n", "\n", "reservoir_Reservoir2\n", "\n", "Reservoir2\n", "\n", "\n", "\n", "plant_Plant2\n", "\n", "Plant2\n", "\n", "\n", "\n", "reservoir_Reservoir2->plant_Plant2\n", "\n", "\n", "\n", "\n", "gate_s_Reservoir2_Ocean\n", "\n", "s_Reservoir2_Ocean\n", "\n", "\n", "\n", "reservoir_Reservoir2->gate_s_Reservoir2_Ocean\n", "\n", "\n", "\n", "\n", "gate_b_Reservoir2_Ocean\n", "\n", "b_Reservoir2_Ocean\n", "\n", "\n", "\n", "reservoir_Reservoir2->gate_b_Reservoir2_Ocean\n", "\n", "\n", "\n", "\n", "plant_Plant1->reservoir_Reservoir2\n", "\n", "\n", "\n", "\n", "gate_s_Reservoir1_Reservoir2->reservoir_Reservoir2\n", "\n", "\n", "\n", "\n", "gate_b_Reservoir1_Reservoir2->reservoir_Reservoir2\n", "\n", "\n", "\n", "\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# Print out the topology\n", "dot = shop.model.build_connection_tree()\n", "display(dot)" ] }, { "cell_type": "markdown", "id": "343ce5bd", "metadata": {}, "source": [ "## Adding a market and a load\n", "\n", "Lastly, we need to add a {ref}`market` and/or a load for the model to optimize against, with certain parameters. This gives SHOP the solution space it needs to make its decisions on where and when to produce or not, while maximizing profit and fulfilling load requirements." ] }, { "cell_type": "code", "execution_count": 29, "id": "2659dccb", "metadata": { "Collapsed": "false" }, "outputs": [], "source": [ "# Adding a market named \"Day_ahead\"\n", "shop.model.market.add_object('Day_ahead')\n", "\n", "# Instancing the market Day_ahead to 'da'\n", "da = shop.model.market.Day_ahead\n", "\n", "# Setting a sale price to the market, which is the income value (in monetary units) per produced MW\n", "da.sale_price.set(pd.DataFrame([32.992,31.122,29.312,28.072,30.012,33.362,42.682,74.822,77.732,62.332,55.892,46.962,42.582,40.942,39.212,39.142,41.672,46.922,37.102,32.992,31.272,29.752,28.782,28.082,27.242,26.622,25.732,25.392,25.992,27.402,28.942,32.182,33.082,32.342,30.912,30.162,30.062,29.562,29.462,29.512,29.672,30.072,29.552,28.862,28.412,28.072,27.162,25.502,26.192,25.222,24.052,23.892,23.682,26.092,28.202,30.902,31.572,31.462,31.172,30.912,30.572,30.602,30.632,31.062,32.082,36.262,34.472,32.182,31.492,30.732,29.712,28.982],\n", " index=[starttime + pd.Timedelta(hours=i) for i in range(0,72)]))\n", "\n", "# Setting a buy price to the market, which is the cost to buy production in the market (in monetary units) in stead of producing it yourself per MW. This is normally used when you have a load to cover or if you have pumps\n", "da.buy_price.set(da.sale_price.get()+0.002)\n", "\n", "# Setting the amount of volume able to buy in the market in MW\n", "da.max_buy.set(pd.Series([9999], [starttime]))\n", "\n", "# Setting the amount of volume able to sell (produce) in the market in MW\n", "da.max_sale.set(pd.Series([9999], [starttime]))\n", "\n", "# Setting the load that needs to be fullfilled, either by power production or by buying from the market, depending on the above parameters\n", "da.load.set(pd.Series([0], [starttime]))" ] }, { "cell_type": "markdown", "id": "85f5308e", "metadata": {}, "source": [ "Now we can compare the {ref}`market` price to the (constant) evalutation value of the water in the reservoirs. Endpoint descriptions are usually more complex, depending on reservoir levels and/or other reservoirs." ] }, { "cell_type": "code", "execution_count": 30, "id": "fb99e6b7", "metadata": { "Collapsed": "false" }, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "marker": { "color": "rgb(33,102,172)" }, "name": "Market price", "type": "scatter", "x": [ "2018-01-23T00:00:00", "2018-01-23T01:00:00", "2018-01-23T02:00:00", "2018-01-23T03:00:00", "2018-01-23T04:00:00", "2018-01-23T05:00:00", "2018-01-23T06:00:00", "2018-01-23T07:00:00", "2018-01-23T08:00:00", "2018-01-23T09:00:00", "2018-01-23T10:00:00", "2018-01-23T11:00:00", "2018-01-23T12:00:00", "2018-01-23T13:00:00", "2018-01-23T14:00:00", "2018-01-23T15:00:00", "2018-01-23T16:00:00", "2018-01-23T17:00:00", "2018-01-23T18:00:00", "2018-01-23T19:00:00", "2018-01-23T20:00:00", "2018-01-23T21:00:00", "2018-01-23T22:00:00", "2018-01-23T23:00:00", "2018-01-24T00:00:00", "2018-01-24T01:00:00", "2018-01-24T02:00:00", "2018-01-24T03:00:00", "2018-01-24T04:00:00", "2018-01-24T05:00:00", "2018-01-24T06:00:00", "2018-01-24T07:00:00", "2018-01-24T08:00:00", "2018-01-24T09:00:00", "2018-01-24T10:00:00", "2018-01-24T11:00:00", "2018-01-24T12:00:00", "2018-01-24T13:00:00", "2018-01-24T14:00:00", "2018-01-24T15:00:00", "2018-01-24T16:00:00", "2018-01-24T17:00:00", "2018-01-24T18:00:00", "2018-01-24T19:00:00", "2018-01-24T20:00:00", "2018-01-24T21:00:00", "2018-01-24T22:00:00", "2018-01-24T23:00:00", "2018-01-25T00:00:00", "2018-01-25T01:00:00", "2018-01-25T02:00:00", "2018-01-25T03:00:00", "2018-01-25T04:00:00", "2018-01-25T05:00:00", "2018-01-25T06:00:00", "2018-01-25T07:00:00", "2018-01-25T08:00:00", "2018-01-25T09:00:00", "2018-01-25T10:00:00", "2018-01-25T11:00:00", "2018-01-25T12:00:00", "2018-01-25T13:00:00", "2018-01-25T14:00:00", "2018-01-25T15:00:00", "2018-01-25T16:00:00", "2018-01-25T17:00:00", "2018-01-25T18:00:00", "2018-01-25T19:00:00", "2018-01-25T20:00:00", "2018-01-25T21:00:00", "2018-01-25T22:00:00", "2018-01-25T23:00:00" ], "y": [ 32.992, 31.122, 29.312, 28.072, 30.012, 33.362, 42.682, 74.822, 77.732, 62.332, 55.892, 46.962, 42.582, 40.942, 39.212, 39.142, 41.672, 46.922, 37.102, 32.992, 31.272, 29.752, 28.782, 28.082, 27.242, 26.622, 25.732, 25.392, 25.992, 27.402, 28.942, 32.182, 33.082, 32.342, 30.912, 30.162, 30.062, 29.562, 29.462, 29.512, 29.672, 30.072, 29.552, 28.862, 28.412, 28.072, 27.162, 25.502, 26.192, 25.222, 24.052, 23.892, 23.682, 26.092, 28.202, 30.902, 31.572, 31.462, 31.172, 30.912, 30.572, 30.602, 30.632, 31.062, 32.082, 36.262, 34.472, 32.182, 31.492, 30.732, 29.712, 28.982 ] }, { "line": { "dash": "dot" }, "marker": { "color": "rgb(67,147,195)" }, "name": "Water value of Reservoir1", "type": "scatter", "x": [ "2018-01-23T00:00:00", "2018-01-23T01:00:00", "2018-01-23T02:00:00", "2018-01-23T03:00:00", "2018-01-23T04:00:00", "2018-01-23T05:00:00", "2018-01-23T06:00:00", "2018-01-23T07:00:00", "2018-01-23T08:00:00", "2018-01-23T09:00:00", "2018-01-23T10:00:00", "2018-01-23T11:00:00", "2018-01-23T12:00:00", "2018-01-23T13:00:00", "2018-01-23T14:00:00", "2018-01-23T15:00:00", "2018-01-23T16:00:00", "2018-01-23T17:00:00", "2018-01-23T18:00:00", "2018-01-23T19:00:00", "2018-01-23T20:00:00", "2018-01-23T21:00:00", "2018-01-23T22:00:00", "2018-01-23T23:00:00", "2018-01-24T00:00:00", "2018-01-24T01:00:00", "2018-01-24T02:00:00", "2018-01-24T03:00:00", "2018-01-24T04:00:00", "2018-01-24T05:00:00", "2018-01-24T06:00:00", "2018-01-24T07:00:00", "2018-01-24T08:00:00", "2018-01-24T09:00:00", "2018-01-24T10:00:00", "2018-01-24T11:00:00", "2018-01-24T12:00:00", "2018-01-24T13:00:00", "2018-01-24T14:00:00", "2018-01-24T15:00:00", "2018-01-24T16:00:00", "2018-01-24T17:00:00", "2018-01-24T18:00:00", "2018-01-24T19:00:00", "2018-01-24T20:00:00", "2018-01-24T21:00:00", "2018-01-24T22:00:00", "2018-01-24T23:00:00", "2018-01-25T00:00:00", "2018-01-25T01:00:00", "2018-01-25T02:00:00", "2018-01-25T03:00:00", "2018-01-25T04:00:00", "2018-01-25T05:00:00", "2018-01-25T06:00:00", "2018-01-25T07:00:00", "2018-01-25T08:00:00", "2018-01-25T09:00:00", "2018-01-25T10:00:00", "2018-01-25T11:00:00", "2018-01-25T12:00:00", "2018-01-25T13:00:00", "2018-01-25T14:00:00", "2018-01-25T15:00:00", "2018-01-25T16:00:00", "2018-01-25T17:00:00", "2018-01-25T18:00:00", "2018-01-25T19:00:00", "2018-01-25T20:00:00", "2018-01-25T21:00:00", "2018-01-25T22:00:00", "2018-01-25T23:00:00" ], "y": [ 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0 ] }, { "line": { "dash": "dot" }, "marker": { "color": "rgb(146,197,222)" }, "name": "Water value of Reservoir2", "type": "scatter", "x": [ "2018-01-23T00:00:00", "2018-01-23T01:00:00", "2018-01-23T02:00:00", "2018-01-23T03:00:00", "2018-01-23T04:00:00", "2018-01-23T05:00:00", "2018-01-23T06:00:00", "2018-01-23T07:00:00", "2018-01-23T08:00:00", "2018-01-23T09:00:00", "2018-01-23T10:00:00", "2018-01-23T11:00:00", "2018-01-23T12:00:00", "2018-01-23T13:00:00", "2018-01-23T14:00:00", "2018-01-23T15:00:00", "2018-01-23T16:00:00", "2018-01-23T17:00:00", "2018-01-23T18:00:00", "2018-01-23T19:00:00", "2018-01-23T20:00:00", "2018-01-23T21:00:00", "2018-01-23T22:00:00", "2018-01-23T23:00:00", "2018-01-24T00:00:00", "2018-01-24T01:00:00", "2018-01-24T02:00:00", "2018-01-24T03:00:00", "2018-01-24T04:00:00", "2018-01-24T05:00:00", "2018-01-24T06:00:00", "2018-01-24T07:00:00", "2018-01-24T08:00:00", "2018-01-24T09:00:00", "2018-01-24T10:00:00", "2018-01-24T11:00:00", "2018-01-24T12:00:00", "2018-01-24T13:00:00", "2018-01-24T14:00:00", "2018-01-24T15:00:00", "2018-01-24T16:00:00", "2018-01-24T17:00:00", "2018-01-24T18:00:00", "2018-01-24T19:00:00", "2018-01-24T20:00:00", "2018-01-24T21:00:00", "2018-01-24T22:00:00", "2018-01-24T23:00:00", "2018-01-25T00:00:00", "2018-01-25T01:00:00", "2018-01-25T02:00:00", "2018-01-25T03:00:00", "2018-01-25T04:00:00", "2018-01-25T05:00:00", "2018-01-25T06:00:00", "2018-01-25T07:00:00", "2018-01-25T08:00:00", "2018-01-25T09:00:00", "2018-01-25T10:00:00", "2018-01-25T11:00:00", "2018-01-25T12:00:00", "2018-01-25T13:00:00", "2018-01-25T14:00:00", "2018-01-25T15:00:00", "2018-01-25T16:00:00", "2018-01-25T17:00:00", "2018-01-25T18:00:00", "2018-01-25T19:00:00", "2018-01-25T20:00:00", "2018-01-25T21:00:00", "2018-01-25T22:00:00", "2018-01-25T23:00:00" ], "y": [ 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0 ] } ], "layout": { "template": { "data": { "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" } ], "barpolar": [ { "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "barpolar" } ], "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" } ], "choropleth": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "choropleth" } ], "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" ] ], "type": "contour" } ], "contourcarpet": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "contourcarpet" } ], "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" ] ], "type": "heatmap" } ], "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" ] ], "type": "heatmapgl" } ], "histogram": [ { "marker": { "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "histogram" } ], "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" ] ], "type": "histogram2d" } ], "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" ] ], "type": "histogram2dcontour" } ], "mesh3d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "mesh3d" } ], "parcoords": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "parcoords" } ], "pie": [ { "automargin": true, "type": "pie" } ], "scatter": [ { "fillpattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 }, "type": "scatter" } ], "scatter3d": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter3d" } ], "scattercarpet": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattercarpet" } ], "scattergeo": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergeo" } ], "scattergl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergl" } ], "scattermapbox": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattermapbox" } ], "scatterpolar": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolar" } ], "scatterpolargl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolargl" } ], "scatterternary": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterternary" } ], "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" ] ], "type": "surface" } ], "table": [ { "cells": { "fill": { "color": "#EBF0F8" }, "line": { "color": "white" } }, "header": { "fill": { "color": "#C8D4E3" }, "line": { "color": "white" } }, "type": "table" } ] }, "layout": { "annotationdefaults": { "arrowcolor": "#2a3f5f", "arrowhead": 0, "arrowwidth": 1 }, "autotypenumbers": "strict", "coloraxis": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "colorscale": { "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" ] ], "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" ] ] }, "colorway": [ "#636efa", "#EF553B", "#00cc96", "#ab63fa", "#FFA15A", "#19d3f3", "#FF6692", "#B6E880", "#FF97FF", "#FECB52" ], "font": { "color": "#2a3f5f" }, "geo": { "bgcolor": "white", "lakecolor": "white", "landcolor": "#E5ECF6", "showlakes": true, "showland": true, "subunitcolor": "white" }, "hoverlabel": { "align": "left" }, "hovermode": "closest", "mapbox": { "style": "light" }, "paper_bgcolor": "white", "plot_bgcolor": "#E5ECF6", "polar": { "angularaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "radialaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "scene": { "xaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "yaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "zaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" } }, "shapedefaults": { "line": { "color": "#2a3f5f" } }, "ternary": { "aaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "baxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "caxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "title": { "x": 0.05 }, "xaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 }, "yaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 } } }, "title": { "text": "Market price and water value of reservoirs" }, "xaxis": { "title": { "text": "Time (Hour)" } }, "yaxis": { "title": { "text": "Price (€/MWh)" } } } }, "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# Plot market price and water value of reservoirs\n", "spot_price=shop.model.market.Day_ahead.sale_price.get()\n", "\n", "fig = go.Figure()\n", "colorscale = px.colors.sequential.RdBu_r\n", "color = 1\n", "fig.add_trace(go.Scatter(x=spot_price.index, marker_color = colorscale[color], y=spot_price.values, name=\"Market price\"))\n", "\n", "for rsv in shop.model.reservoir:\n", " color+=1\n", " end_water_value=rsv.energy_value_input.get()\n", " water_value=pd.Series([end_water_value]*len(spot_price),index=spot_price.index)\n", " curve_name=\"Water value of \"+rsv.get_name()\n", " fig.add_trace(go.Scatter(x=water_value.index, y=water_value.values, marker_color = colorscale[color], name=curve_name, line=dict(dash=\"dot\")))\n", "\n", "fig.update_layout(title=\"Market price and water value of reservoirs\", xaxis_title=\"Time (Hour)\", yaxis_title=\"Price (€/MWh)\")\n", "\n", "fig.show()" ] }, { "cell_type": "markdown", "id": "8b8d476a", "metadata": {}, "source": [ "## Running SHOP\n", "\n", "Once the model is fully defined, we can prepare for a call to the optimizer. It is possible to define certain criteria depending on the solver used, if not, default values will be effective.\n", "\n", "In order to find an optimal solution, it is normal to run SHOP with multiple iterations, both full and incremental." ] }, { "cell_type": "code", "execution_count": 31, "id": "913b4042", "metadata": { "Collapsed": "false" }, "outputs": [], "source": [ "# Setting a full flag, telling SHOP the upcomming iterations should be full\n", "shop.set_code(['full'], [])\n", "\n", "# Starting SHOP and running five (full) iterations\n", "shop.start_sim([], ['5'])\n", "\n", "# Setting an incremental flag, telling SHOP the next iterations should be incremental\n", "shop.set_code(['incremental'], [])\n", "\n", "# Running three more (incremental) iterations\n", "shop.start_sim([], ['3'])" ] }, { "cell_type": "markdown", "id": "7d881524", "metadata": {}, "source": [ "## Results\n", "\n", "After the optimization has completed, we can review the result from SHOP by plotting the graphs we want." ] }, { "cell_type": "code", "execution_count": 32, "id": "e403aca5", "metadata": { "Collapsed": "false" }, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "marker": { "color": "rgb(33,102,172)" }, "name": "P1", "type": "bar", "x": [ "2018-01-23T00:00:00", "2018-01-23T01:00:00", "2018-01-23T02:00:00", "2018-01-23T03:00:00", "2018-01-23T04:00:00", "2018-01-23T05:00:00", "2018-01-23T06:00:00", "2018-01-23T07:00:00", "2018-01-23T08:00:00", "2018-01-23T09:00:00", "2018-01-23T10:00:00", "2018-01-23T11:00:00", "2018-01-23T12:00:00", "2018-01-23T13:00:00", "2018-01-23T14:00:00", "2018-01-23T15:00:00", "2018-01-23T16:00:00", "2018-01-23T17:00:00", "2018-01-23T18:00:00", "2018-01-23T19:00:00", "2018-01-23T20:00:00", "2018-01-23T21:00:00", "2018-01-23T22:00:00", "2018-01-23T23:00:00", "2018-01-24T00:00:00", "2018-01-24T01:00:00", "2018-01-24T02:00:00", "2018-01-24T03:00:00", "2018-01-24T04:00:00", "2018-01-24T05:00:00", "2018-01-24T06:00:00", "2018-01-24T07:00:00", "2018-01-24T08:00:00", "2018-01-24T09:00:00", "2018-01-24T10:00:00", "2018-01-24T11:00:00", "2018-01-24T12:00:00", "2018-01-24T13:00:00", "2018-01-24T14:00:00", "2018-01-24T15:00:00", "2018-01-24T16:00:00", "2018-01-24T17:00:00", "2018-01-24T18:00:00", "2018-01-24T19:00:00", "2018-01-24T20:00:00", "2018-01-24T21:00:00", "2018-01-24T22:00:00", "2018-01-24T23:00:00", "2018-01-25T00:00:00", "2018-01-25T01:00:00", "2018-01-25T02:00:00", "2018-01-25T03:00:00", "2018-01-25T04:00:00", "2018-01-25T05:00:00", "2018-01-25T06:00:00", "2018-01-25T07:00:00", "2018-01-25T08:00:00", "2018-01-25T09:00:00", "2018-01-25T10:00:00", "2018-01-25T11:00:00", "2018-01-25T12:00:00", "2018-01-25T13:00:00", "2018-01-25T14:00:00", "2018-01-25T15:00:00", "2018-01-25T16:00:00", "2018-01-25T17:00:00", "2018-01-25T18:00:00", "2018-01-25T19:00:00", "2018-01-25T20:00:00", "2018-01-25T21:00:00", "2018-01-25T22:00:00", "2018-01-25T23:00:00" ], "y": [ 227.52687241593975, 215.75592373174047, 207.0585091651881, 111.84188060733722, 214.6200997201291, 229.51771952722876, 229.11194148099486, 228.705489275686, 228.29819683939792, 227.8909927713849, 227.48387707164682, 227.07684974018377, 226.66991077699572, 226.25062349366846, 225.82801798341686, 225.40550786141978, 224.98309312767685, 224.56077378218842, 224.13639929457506, 209.18906998565214, 208.82561489196422, 200.4087758738179, 104.09110186865247, 104.0077760054423, 103.92445844823399, 0.0, 0.0, 0.0, 0.0, 103.84114919702745, 103.75784825182264, 207.24917059563393, 206.88612301861647, 206.52315175819874, 198.20602200784217, 197.87472990728833, 197.54350425474863, 107.18650229899073, 102.53721310221279, 102.44491426833233, 106.89236428675264, 106.79125560858543, 102.15922901885797, 102.06697208351959, 101.97472537750903, 101.88248890082644, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 101.7901496832639, 106.2023854025947, 195.10037552069656, 194.71261357638605, 105.68826681240095, 105.58157345969285, 100.99690563447122, 100.89955421427113, 100.8022142163132, 100.70124987101163, 193.12614086729238, 200.4248196867856, 199.97773111264752, 104.39453354830606, 99.85618018777974, 99.75367946092543, 0.0, 0.0 ] }, { "marker": { "color": "rgb(67,147,195)" }, "name": "P2", "type": "bar", "x": [ "2018-01-23T00:00:00", "2018-01-23T01:00:00", "2018-01-23T02:00:00", "2018-01-23T03:00:00", "2018-01-23T04:00:00", "2018-01-23T05:00:00", "2018-01-23T06:00:00", "2018-01-23T07:00:00", "2018-01-23T08:00:00", "2018-01-23T09:00:00", "2018-01-23T10:00:00", "2018-01-23T11:00:00", "2018-01-23T12:00:00", "2018-01-23T13:00:00", "2018-01-23T14:00:00", "2018-01-23T15:00:00", "2018-01-23T16:00:00", "2018-01-23T17:00:00", "2018-01-23T18:00:00", "2018-01-23T19:00:00", "2018-01-23T20:00:00", "2018-01-23T21:00:00", "2018-01-23T22:00:00", "2018-01-23T23:00:00", "2018-01-24T00:00:00", "2018-01-24T01:00:00", "2018-01-24T02:00:00", "2018-01-24T03:00:00", "2018-01-24T04:00:00", "2018-01-24T05:00:00", "2018-01-24T06:00:00", "2018-01-24T07:00:00", "2018-01-24T08:00:00", "2018-01-24T09:00:00", "2018-01-24T10:00:00", "2018-01-24T11:00:00", "2018-01-24T12:00:00", "2018-01-24T13:00:00", "2018-01-24T14:00:00", "2018-01-24T15:00:00", "2018-01-24T16:00:00", "2018-01-24T17:00:00", "2018-01-24T18:00:00", "2018-01-24T19:00:00", "2018-01-24T20:00:00", "2018-01-24T21:00:00", "2018-01-24T22:00:00", "2018-01-24T23:00:00", "2018-01-25T00:00:00", "2018-01-25T01:00:00", "2018-01-25T02:00:00", "2018-01-25T03:00:00", "2018-01-25T04:00:00", "2018-01-25T05:00:00", "2018-01-25T06:00:00", "2018-01-25T07:00:00", "2018-01-25T08:00:00", "2018-01-25T09:00:00", "2018-01-25T10:00:00", "2018-01-25T11:00:00", "2018-01-25T12:00:00", "2018-01-25T13:00:00", "2018-01-25T14:00:00", "2018-01-25T15:00:00", "2018-01-25T16:00:00", "2018-01-25T17:00:00", "2018-01-25T18:00:00", "2018-01-25T19:00:00", "2018-01-25T20:00:00", "2018-01-25T21:00:00", "2018-01-25T22:00:00", "2018-01-25T23:00:00" ], "y": [ 249.5594036568051, 177.15469129053912, 99.99986608888287, 0.0, 173.33295194265824, 268.87784338880886, 336.7118735389945, 339.9464194227658, 339.34220750695846, 338.6788316698249, 338.00085413737105, 337.3202188594007, 336.6388999390956, 332.2944958390066, 331.6222117596135, 330.9470796315148, 332.6743137189276, 333.0836338311281, 316.6470792631909, 261.42565906706403, 257.54849664356095, 236.81260528034238, 236.29325464325, 170.49186631193345, 170.29889462434426, 151.7005863361668, 0.0, 0.0, 0.0, 170.13954946588984, 234.5311319472501, 257.41494000399905, 265.25587043619055, 264.4040637101117, 251.44705432239047, 250.6291233769913, 245.8926179530469, 239.38290152619174, 229.09284251881996, 238.14615624985905, 246.0010533503221, 244.90253807716633, 239.88910846887606, 224.78947514235875, 223.95514355668823, 223.1199821272719, 222.26825093394942, 148.40967774910968, 162.88187358657223, 148.08750690692762, 0.0, 0.0, 0.0, 162.54595371526395, 219.1995206926754, 245.5021585331507, 244.01229164577006, 242.77812544551173, 241.51619102797704, 239.9145841240431, 238.31297722010945, 236.6482018807786, 234.88475606782242, 236.12064828340422, 240.89754507236833, 273.5788668544385, 270.88251843702585, 234.59907402247114, 232.44513575790822, 230.1804850789132, 221.7425010209989, 216.42850360702664 ] }, { "line": { "color": "black" }, "name": "Price", "type": "scatter", "x": [ "2018-01-23T00:00:00", "2018-01-23T01:00:00", "2018-01-23T02:00:00", "2018-01-23T03:00:00", "2018-01-23T04:00:00", "2018-01-23T05:00:00", "2018-01-23T06:00:00", "2018-01-23T07:00:00", "2018-01-23T08:00:00", "2018-01-23T09:00:00", "2018-01-23T10:00:00", "2018-01-23T11:00:00", "2018-01-23T12:00:00", "2018-01-23T13:00:00", "2018-01-23T14:00:00", "2018-01-23T15:00:00", "2018-01-23T16:00:00", "2018-01-23T17:00:00", "2018-01-23T18:00:00", "2018-01-23T19:00:00", "2018-01-23T20:00:00", "2018-01-23T21:00:00", "2018-01-23T22:00:00", "2018-01-23T23:00:00", "2018-01-24T00:00:00", "2018-01-24T01:00:00", "2018-01-24T02:00:00", "2018-01-24T03:00:00", "2018-01-24T04:00:00", "2018-01-24T05:00:00", "2018-01-24T06:00:00", "2018-01-24T07:00:00", "2018-01-24T08:00:00", "2018-01-24T09:00:00", "2018-01-24T10:00:00", "2018-01-24T11:00:00", "2018-01-24T12:00:00", "2018-01-24T13:00:00", "2018-01-24T14:00:00", "2018-01-24T15:00:00", "2018-01-24T16:00:00", "2018-01-24T17:00:00", "2018-01-24T18:00:00", "2018-01-24T19:00:00", "2018-01-24T20:00:00", "2018-01-24T21:00:00", "2018-01-24T22:00:00", "2018-01-24T23:00:00", "2018-01-25T00:00:00", "2018-01-25T01:00:00", "2018-01-25T02:00:00", "2018-01-25T03:00:00", "2018-01-25T04:00:00", "2018-01-25T05:00:00", "2018-01-25T06:00:00", "2018-01-25T07:00:00", "2018-01-25T08:00:00", "2018-01-25T09:00:00", "2018-01-25T10:00:00", "2018-01-25T11:00:00", "2018-01-25T12:00:00", "2018-01-25T13:00:00", "2018-01-25T14:00:00", "2018-01-25T15:00:00", "2018-01-25T16:00:00", "2018-01-25T17:00:00", "2018-01-25T18:00:00", "2018-01-25T19:00:00", "2018-01-25T20:00:00", "2018-01-25T21:00:00", "2018-01-25T22:00:00", "2018-01-25T23:00:00" ], "xaxis": "x", "y": [ 32.992, 31.122, 29.312, 28.072, 30.012, 33.362, 42.682, 74.822, 77.732, 62.332, 55.892, 46.962, 42.582, 40.942, 39.212, 39.142, 41.672, 46.922, 37.102, 32.992, 31.272, 29.752, 28.782, 28.082, 27.242, 26.622, 25.732, 25.392, 25.992, 27.402, 28.942, 32.182, 33.082, 32.342, 30.912, 30.162, 30.062, 29.562, 29.462, 29.512, 29.672, 30.072, 29.552, 28.862, 28.412, 28.072, 27.162, 25.502, 26.192, 25.222, 24.052, 23.892, 23.682, 26.092, 28.202, 30.902, 31.572, 31.462, 31.172, 30.912, 30.572, 30.602, 30.632, 31.062, 32.082, 36.262, 34.472, 32.182, 31.492, 30.732, 29.712, 28.982 ], "yaxis": "y2" } ], "layout": { "barmode": "stack", "template": { "data": { "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" } ], "barpolar": [ { "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "barpolar" } ], "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" } ], "choropleth": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "choropleth" } ], "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" ] ], "type": "contour" } ], "contourcarpet": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "contourcarpet" } ], "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" ] ], "type": "heatmap" } ], "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" ] ], "type": "heatmapgl" } ], "histogram": [ { "marker": { "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "histogram" } ], "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" ] ], "type": "histogram2d" } ], "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" ] ], "type": "histogram2dcontour" } ], "mesh3d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "mesh3d" } ], "parcoords": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "parcoords" } ], "pie": [ { "automargin": true, "type": "pie" } ], "scatter": [ { "fillpattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 }, "type": "scatter" } ], "scatter3d": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter3d" } ], "scattercarpet": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattercarpet" } ], "scattergeo": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergeo" } ], "scattergl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergl" } ], "scattermapbox": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattermapbox" } ], "scatterpolar": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolar" } ], "scatterpolargl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolargl" } ], "scatterternary": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterternary" } ], "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" ] ], "type": "surface" } ], "table": [ { "cells": { "fill": { "color": "#EBF0F8" }, "line": { "color": "white" } }, "header": { "fill": { "color": "#C8D4E3" }, "line": { "color": "white" } }, "type": "table" } ] }, "layout": { "annotationdefaults": { "arrowcolor": "#2a3f5f", "arrowhead": 0, "arrowwidth": 1 }, "autotypenumbers": "strict", "coloraxis": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "colorscale": { "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" ] ], "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" ] ] }, "colorway": [ "#636efa", "#EF553B", "#00cc96", "#ab63fa", "#FFA15A", "#19d3f3", "#FF6692", "#B6E880", "#FF97FF", "#FECB52" ], "font": { "color": "#2a3f5f" }, "geo": { "bgcolor": "white", "lakecolor": "white", "landcolor": "#E5ECF6", "showlakes": true, "showland": true, "subunitcolor": "white" }, "hoverlabel": { "align": "left" }, "hovermode": "closest", "mapbox": { "style": "light" }, "paper_bgcolor": "white", "plot_bgcolor": "#E5ECF6", "polar": { "angularaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "radialaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "scene": { "xaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "yaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "zaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" } }, "shapedefaults": { "line": { "color": "#2a3f5f" } }, "ternary": { "aaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "baxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "caxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "title": { "x": 0.05 }, "xaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 }, "yaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 } } }, "title": { "text": "Price vs. production" }, "xaxis": { "anchor": "y", "domain": [ 0.0, 0.94 ], "title": { "text": "Time [Hours]" } }, "yaxis": { "anchor": "x", "domain": [ 0.0, 1.0 ], "title": { "text": "Production [MWh]" } }, "yaxis2": { "anchor": "x", "overlaying": "y", "side": "right", "title": { "text": "Price [EUR/MWh]" } } } }, "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# Plotting price vs. production\n", "\n", "# Defining a plot instance\n", "fig = go.Figure()\n", "colorscale = px.colors.sequential.RdBu_r\n", "# Preparing for secondary y axis by calling make_subplots function\n", "fig = make_subplots(specs=[[{\"secondary_y\": True}]])\n", "# Adding plant production as traces of bar type\n", "fig.add_trace(go.Bar(x=shop.model.plant.Plant1.production.get().index, y=shop.model.plant.Plant1.production.get().values, name=\"P1\", marker_color=colorscale[1]))\n", "fig.add_trace(go.Bar(x=shop.model.plant.Plant2.production.get().index, y=shop.model.plant.Plant2.production.get().values, name=\"P2\", marker_color=colorscale[2]))\n", "# Stacking bars\n", "fig.update_layout(barmode='stack')\n", "# Adding price as trace of scatter type\n", "fig.add_trace(go.Scatter(x=shop.model.market.Day_ahead.sale_price.get().index, y=shop.model.market.Day_ahead.sale_price.get().values, name=\"Price\", line_color='black'),secondary_y=True)\n", "# Updating titles\n", "fig.update_layout(title_text=\"Price vs. production\")\n", "fig.update_yaxes(title_text=\"Production [MWh]\", secondary_y=False)\n", "fig.update_yaxes(title_text=\"Price [EUR/MWh]\", secondary_y=True)\n", "fig.update_xaxes(title_text=\"Time [Hours]\")\n", "# Show plot\n", "fig.show()" ] }, { "cell_type": "code", "execution_count": 33, "id": "ea84b655", "metadata": { "Collapsed": "false" }, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "marker": { "color": "rgb(33,102,172)" }, "name": "G1 Discharge", "type": "bar", "x": [ "2018-01-23T00:00:00", "2018-01-23T01:00:00", "2018-01-23T02:00:00", "2018-01-23T03:00:00", "2018-01-23T04:00:00", "2018-01-23T05:00:00", "2018-01-23T06:00:00", "2018-01-23T07:00:00", "2018-01-23T08:00:00", "2018-01-23T09:00:00", "2018-01-23T10:00:00", "2018-01-23T11:00:00", "2018-01-23T12:00:00", "2018-01-23T13:00:00", "2018-01-23T14:00:00", "2018-01-23T15:00:00", "2018-01-23T16:00:00", "2018-01-23T17:00:00", "2018-01-23T18:00:00", "2018-01-23T19:00:00", "2018-01-23T20:00:00", "2018-01-23T21:00:00", "2018-01-23T22:00:00", "2018-01-23T23:00:00", "2018-01-24T00:00:00", "2018-01-24T01:00:00", "2018-01-24T02:00:00", "2018-01-24T03:00:00", "2018-01-24T04:00:00", "2018-01-24T05:00:00", "2018-01-24T06:00:00", "2018-01-24T07:00:00", "2018-01-24T08:00:00", "2018-01-24T09:00:00", "2018-01-24T10:00:00", "2018-01-24T11:00:00", "2018-01-24T12:00:00", "2018-01-24T13:00:00", "2018-01-24T14:00:00", "2018-01-24T15:00:00", "2018-01-24T16:00:00", "2018-01-24T17:00:00", "2018-01-24T18:00:00", "2018-01-24T19:00:00", "2018-01-24T20:00:00", "2018-01-24T21:00:00", "2018-01-24T22:00:00", "2018-01-24T23:00:00", "2018-01-25T00:00:00", "2018-01-25T01:00:00", "2018-01-25T02:00:00", "2018-01-25T03:00:00", "2018-01-25T04:00:00", "2018-01-25T05:00:00", "2018-01-25T06:00:00", "2018-01-25T07:00:00", "2018-01-25T08:00:00", "2018-01-25T09:00:00", "2018-01-25T10:00:00", "2018-01-25T11:00:00", "2018-01-25T12:00:00", "2018-01-25T13:00:00", "2018-01-25T14:00:00", "2018-01-25T15:00:00", "2018-01-25T16:00:00", "2018-01-25T17:00:00", "2018-01-25T18:00:00", "2018-01-25T19:00:00", "2018-01-25T20:00:00", "2018-01-25T21:00:00", "2018-01-25T22:00:00", "2018-01-25T23:00:00" ], "xaxis": "x", "y": [ 58.83, 53.89666666666667, 51.43, 53.69756642158295, 53.71465985251446, 58.83, 58.83, 58.83, 58.83, 58.83, 58.83, 58.83, 58.83, 58.83, 58.83, 58.83, 58.83, 58.83, 58.83, 53.89666666666666, 53.89666666666666, 51.43, 51.43, 51.43, 51.43, 0.0, 0.0, 0.0, 0.0, 51.43, 51.43, 53.89666666666667, 53.89666666666666, 53.89666666666667, 51.43, 51.43, 51.43, 53.89666666666666, 51.43, 51.43, 53.89666666666666, 53.89666666666667, 51.43, 51.43, 51.43, 51.43, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 51.43, 53.89666666666666, 51.43, 51.43, 53.89666666666666, 53.89666666666667, 51.43, 51.43, 51.43, 51.43, 51.43, 53.89666666666666, 53.89666666666666, 53.89666666666667, 51.43, 51.43, 0.0, 0.0 ], "yaxis": "y" }, { "marker": { "color": "rgb(67,147,195)" }, "name": "G2 Discharge", "type": "bar", "x": [ "2018-01-23T00:00:00", "2018-01-23T01:00:00", "2018-01-23T02:00:00", "2018-01-23T03:00:00", "2018-01-23T04:00:00", "2018-01-23T05:00:00", "2018-01-23T06:00:00", "2018-01-23T07:00:00", "2018-01-23T08:00:00", "2018-01-23T09:00:00", "2018-01-23T10:00:00", "2018-01-23T11:00:00", "2018-01-23T12:00:00", "2018-01-23T13:00:00", "2018-01-23T14:00:00", "2018-01-23T15:00:00", "2018-01-23T16:00:00", "2018-01-23T17:00:00", "2018-01-23T18:00:00", "2018-01-23T19:00:00", "2018-01-23T20:00:00", "2018-01-23T21:00:00", "2018-01-23T22:00:00", "2018-01-23T23:00:00", "2018-01-24T00:00:00", "2018-01-24T01:00:00", "2018-01-24T02:00:00", "2018-01-24T03:00:00", "2018-01-24T04:00:00", "2018-01-24T05:00:00", "2018-01-24T06:00:00", "2018-01-24T07:00:00", "2018-01-24T08:00:00", "2018-01-24T09:00:00", "2018-01-24T10:00:00", "2018-01-24T11:00:00", "2018-01-24T12:00:00", "2018-01-24T13:00:00", "2018-01-24T14:00:00", "2018-01-24T15:00:00", "2018-01-24T16:00:00", "2018-01-24T17:00:00", "2018-01-24T18:00:00", "2018-01-24T19:00:00", "2018-01-24T20:00:00", "2018-01-24T21:00:00", "2018-01-24T22:00:00", "2018-01-24T23:00:00", "2018-01-25T00:00:00", "2018-01-25T01:00:00", "2018-01-25T02:00:00", "2018-01-25T03:00:00", "2018-01-25T04:00:00", "2018-01-25T05:00:00", "2018-01-25T06:00:00", "2018-01-25T07:00:00", "2018-01-25T08:00:00", "2018-01-25T09:00:00", "2018-01-25T10:00:00", "2018-01-25T11:00:00", "2018-01-25T12:00:00", "2018-01-25T13:00:00", "2018-01-25T14:00:00", "2018-01-25T15:00:00", "2018-01-25T16:00:00", "2018-01-25T17:00:00", "2018-01-25T18:00:00", "2018-01-25T19:00:00", "2018-01-25T20:00:00", "2018-01-25T21:00:00", "2018-01-25T22:00:00", "2018-01-25T23:00:00" ], "xaxis": "x", "y": [ 56.36333333333333, 53.89666666666667, 51.43, 0.0, 53.89666666666667, 58.83, 58.83, 58.83, 58.83, 58.83, 58.83, 58.83, 58.83, 58.83, 58.83, 58.83, 58.83, 58.83, 58.83, 53.89666666666666, 53.89666666666666, 51.43, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 53.89666666666667, 53.89666666666666, 53.89666666666667, 51.43, 51.43, 51.43, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 51.43, 51.43, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 51.43, 53.89666666666666, 53.89666666666666, 0.0, 0.0, 0.0, 0.0, 0.0 ], "yaxis": "y" }, { "marker": { "color": "rgb(146,197,222)" }, "name": "G1 production", "type": "scatter", "x": [ "2018-01-23T00:00:00", "2018-01-23T01:00:00", "2018-01-23T02:00:00", "2018-01-23T03:00:00", "2018-01-23T04:00:00", "2018-01-23T05:00:00", "2018-01-23T06:00:00", "2018-01-23T07:00:00", "2018-01-23T08:00:00", "2018-01-23T09:00:00", "2018-01-23T10:00:00", "2018-01-23T11:00:00", "2018-01-23T12:00:00", "2018-01-23T13:00:00", "2018-01-23T14:00:00", "2018-01-23T15:00:00", "2018-01-23T16:00:00", "2018-01-23T17:00:00", "2018-01-23T18:00:00", "2018-01-23T19:00:00", "2018-01-23T20:00:00", "2018-01-23T21:00:00", "2018-01-23T22:00:00", "2018-01-23T23:00:00", "2018-01-24T00:00:00", "2018-01-24T01:00:00", "2018-01-24T02:00:00", "2018-01-24T03:00:00", "2018-01-24T04:00:00", "2018-01-24T05:00:00", "2018-01-24T06:00:00", "2018-01-24T07:00:00", "2018-01-24T08:00:00", "2018-01-24T09:00:00", "2018-01-24T10:00:00", "2018-01-24T11:00:00", "2018-01-24T12:00:00", "2018-01-24T13:00:00", "2018-01-24T14:00:00", "2018-01-24T15:00:00", "2018-01-24T16:00:00", "2018-01-24T17:00:00", "2018-01-24T18:00:00", "2018-01-24T19:00:00", "2018-01-24T20:00:00", "2018-01-24T21:00:00", "2018-01-24T22:00:00", "2018-01-24T23:00:00", "2018-01-25T00:00:00", "2018-01-25T01:00:00", "2018-01-25T02:00:00", "2018-01-25T03:00:00", "2018-01-25T04:00:00", "2018-01-25T05:00:00", "2018-01-25T06:00:00", "2018-01-25T07:00:00", "2018-01-25T08:00:00", "2018-01-25T09:00:00", "2018-01-25T10:00:00", "2018-01-25T11:00:00", "2018-01-25T12:00:00", "2018-01-25T13:00:00", "2018-01-25T14:00:00", "2018-01-25T15:00:00", "2018-01-25T16:00:00", "2018-01-25T17:00:00", "2018-01-25T18:00:00", "2018-01-25T19:00:00", "2018-01-25T20:00:00", "2018-01-25T21:00:00", "2018-01-25T22:00:00", "2018-01-25T23:00:00" ], "xaxis": "x", "y": [ 115.93126982110108, 107.87796186587023, 103.52925458259405, 111.84188060733722, 107.14341840853157, 114.75885976361438, 114.55597074049743, 114.352744637843, 114.14909841969896, 113.94549638569245, 113.74193853582341, 113.53842487009189, 113.33495538849786, 113.12531174683423, 112.91400899170843, 112.70275393070989, 112.49154656383843, 112.28038689109421, 112.06819964728753, 104.59453499282607, 104.41280744598211, 100.20438793690894, 104.09110186865247, 104.0077760054423, 103.92445844823399, 0.0, 0.0, 0.0, 0.0, 103.84114919702745, 103.75784825182264, 103.62458529781696, 103.44306150930824, 103.26157587909937, 99.10301100392108, 98.93736495364416, 98.77175212737431, 107.18650229899073, 102.53721310221279, 102.44491426833233, 106.89236428675264, 106.79125560858543, 102.15922901885797, 102.06697208351959, 101.97472537750903, 101.88248890082644, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 101.7901496832639, 106.2023854025947, 97.55018776034828, 97.35630678819302, 105.68826681240095, 105.58157345969285, 100.99690563447122, 100.89955421427113, 100.8022142163132, 100.70124987101163, 96.56307043364619, 100.2124098433928, 99.98886555632376, 104.39453354830606, 99.85618018777974, 99.75367946092543, 0.0, 0.0 ], "yaxis": "y2" }, { "marker": { "color": "rgb(209,229,240)" }, "name": "G2 production", "type": "scatter", "x": [ "2018-01-23T00:00:00", "2018-01-23T01:00:00", "2018-01-23T02:00:00", "2018-01-23T03:00:00", "2018-01-23T04:00:00", "2018-01-23T05:00:00", "2018-01-23T06:00:00", "2018-01-23T07:00:00", "2018-01-23T08:00:00", "2018-01-23T09:00:00", "2018-01-23T10:00:00", "2018-01-23T11:00:00", "2018-01-23T12:00:00", "2018-01-23T13:00:00", "2018-01-23T14:00:00", "2018-01-23T15:00:00", "2018-01-23T16:00:00", "2018-01-23T17:00:00", "2018-01-23T18:00:00", "2018-01-23T19:00:00", "2018-01-23T20:00:00", "2018-01-23T21:00:00", "2018-01-23T22:00:00", "2018-01-23T23:00:00", "2018-01-24T00:00:00", "2018-01-24T01:00:00", "2018-01-24T02:00:00", "2018-01-24T03:00:00", "2018-01-24T04:00:00", "2018-01-24T05:00:00", "2018-01-24T06:00:00", "2018-01-24T07:00:00", "2018-01-24T08:00:00", "2018-01-24T09:00:00", "2018-01-24T10:00:00", "2018-01-24T11:00:00", "2018-01-24T12:00:00", "2018-01-24T13:00:00", "2018-01-24T14:00:00", "2018-01-24T15:00:00", "2018-01-24T16:00:00", "2018-01-24T17:00:00", "2018-01-24T18:00:00", "2018-01-24T19:00:00", "2018-01-24T20:00:00", "2018-01-24T21:00:00", "2018-01-24T22:00:00", "2018-01-24T23:00:00", "2018-01-25T00:00:00", "2018-01-25T01:00:00", "2018-01-25T02:00:00", "2018-01-25T03:00:00", "2018-01-25T04:00:00", "2018-01-25T05:00:00", "2018-01-25T06:00:00", "2018-01-25T07:00:00", "2018-01-25T08:00:00", "2018-01-25T09:00:00", "2018-01-25T10:00:00", "2018-01-25T11:00:00", "2018-01-25T12:00:00", "2018-01-25T13:00:00", "2018-01-25T14:00:00", "2018-01-25T15:00:00", "2018-01-25T16:00:00", "2018-01-25T17:00:00", "2018-01-25T18:00:00", "2018-01-25T19:00:00", "2018-01-25T20:00:00", "2018-01-25T21:00:00", "2018-01-25T22:00:00", "2018-01-25T23:00:00" ], "xaxis": "x", "y": [ 111.59560259483868, 107.87796186587023, 103.52925458259405, 0.0, 107.47668131159753, 114.75885976361438, 114.55597074049743, 114.352744637843, 114.14909841969896, 113.94549638569245, 113.74193853582341, 113.53842487009189, 113.33495538849786, 113.12531174683423, 112.91400899170843, 112.70275393070989, 112.49154656383843, 112.28038689109421, 112.06819964728753, 104.59453499282607, 104.41280744598211, 100.20438793690894, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 103.62458529781696, 103.44306150930824, 103.26157587909937, 99.10301100392108, 98.93736495364416, 98.77175212737431, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 97.55018776034828, 97.35630678819302, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 96.56307043364619, 100.2124098433928, 99.98886555632376, 0.0, 0.0, 0.0, 0.0, 0.0 ], "yaxis": "y2" } ], "layout": { "barmode": "stack", "template": { "data": { "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" } ], "barpolar": [ { "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "barpolar" } ], "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" } ], "choropleth": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "choropleth" } ], "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" ] ], "type": "contour" } ], "contourcarpet": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "contourcarpet" } ], "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" ] ], "type": "heatmap" } ], "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" ] ], "type": "heatmapgl" } ], "histogram": [ { "marker": { "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "histogram" } ], "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" ] ], "type": "histogram2d" } ], "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" ] ], "type": "histogram2dcontour" } ], "mesh3d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "mesh3d" } ], "parcoords": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "parcoords" } ], "pie": [ { "automargin": true, "type": "pie" } ], "scatter": [ { "fillpattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 }, "type": "scatter" } ], "scatter3d": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter3d" } ], "scattercarpet": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattercarpet" } ], "scattergeo": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergeo" } ], "scattergl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergl" } ], "scattermapbox": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattermapbox" } ], "scatterpolar": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolar" } ], "scatterpolargl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolargl" } ], "scatterternary": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterternary" } ], "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" ] ], "type": "surface" } ], "table": [ { "cells": { "fill": { "color": "#EBF0F8" }, "line": { "color": "white" } }, "header": { "fill": { "color": "#C8D4E3" }, "line": { "color": "white" } }, "type": "table" } ] }, "layout": { "annotationdefaults": { "arrowcolor": "#2a3f5f", "arrowhead": 0, "arrowwidth": 1 }, "autotypenumbers": "strict", "coloraxis": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "colorscale": { "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" ] ], "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" ] ] }, "colorway": [ "#636efa", "#EF553B", "#00cc96", "#ab63fa", "#FFA15A", "#19d3f3", "#FF6692", "#B6E880", "#FF97FF", "#FECB52" ], "font": { "color": "#2a3f5f" }, "geo": { "bgcolor": "white", "lakecolor": "white", "landcolor": "#E5ECF6", "showlakes": true, "showland": true, "subunitcolor": "white" }, "hoverlabel": { "align": "left" }, "hovermode": "closest", "mapbox": { "style": "light" }, "paper_bgcolor": "white", "plot_bgcolor": "#E5ECF6", "polar": { "angularaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "radialaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "scene": { "xaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "yaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "zaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" } }, "shapedefaults": { "line": { "color": "#2a3f5f" } }, "ternary": { "aaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "baxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "caxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "title": { "x": 0.05 }, "xaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 }, "yaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 } } }, "title": { "text": "Unit discharge and production in Plant1" }, "xaxis": { "anchor": "y", "domain": [ 0.0, 0.94 ], "title": { "text": "Time (Hour)" } }, "yaxis": { "anchor": "x", "domain": [ 0.0, 1.0 ], "dtick": 20, "range": [ 0, 120 ], "tick0": 20, "title": { "text": "Discharge (m3/s)" } }, "yaxis2": { "anchor": "x", "dtick": 40, "overlaying": "y", "range": [ 0, 240 ], "side": "right", "tick0": 40, "title": { "text": "Production (MW)" } } } }, "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# Plotting discharge and production results from Plant 1\n", "\n", "# Retrieving discharge results on generators\n", "G1_discharge=shop.model.generator.Plant1_Generator1.discharge.get()\n", "G2_discharge=shop.model.generator.Plant1_Generator2.discharge.get()\n", "\n", "# Retrieving production results on generators\n", "G1_production=shop.model.generator.Plant1_Generator1.production.get()\n", "G2_production=shop.model.generator.Plant1_Generator2.production.get()\n", "\n", "# Preparing for secondary y axis by calling make_subplots function\n", "coloraxis = px.colors.sequential.RdBu_r\n", "#coloraxis=[\"rgb(0, 200, 30)\",\"rgb(0, 200, 60)\",\"rgb(0, 200, 90)\",\"rgb(0, 200, 120)\",\"rgb(0, 200, 150)\",\"rgb(0, 200, 180)\",\"rgb(0, 200, 210)\",\"rgb(0, 200, 255)\"]\n", "#print(coloraxis)\n", "fig = make_subplots(specs=[[{\"secondary_y\": True}]])\n", "fig.add_trace(go.Bar(x=G1_discharge.index, y=G1_discharge.values, name=\"G1 Discharge\", marker_color=coloraxis[1]), secondary_y=False)\n", "fig.add_trace(go.Bar(x=G2_discharge.index, y=G2_discharge.values, name=\"G2 Discharge\", marker_color=coloraxis[2]), secondary_y=False)\n", "fig.add_trace(go.Scatter(x=G1_production.index, y=G1_production.values, name=\"G1 production\", marker_color=coloraxis[3]), secondary_y=True)\n", "fig.add_trace(go.Scatter(x=G2_production.index, y=G2_production.values, name=\"G2 production\", marker_color=coloraxis[4]), secondary_y=True)\n", "fig.update_layout(title_text=\"Unit discharge and production in Plant1\", barmode=\"stack\")\n", "fig.update_xaxes(title_text=\"Time (Hour)\")\n", "fig.update_yaxes(title_text=\"Discharge (m3/s)\", secondary_y=False, range=[0, 120], tick0=20, dtick=20)\n", "fig.update_yaxes(title_text=\"Production (MW)\", secondary_y=True, range=[0, 240], tick0=40, dtick=40)\n", "\n", "fig.show()" ] }, { "cell_type": "code", "execution_count": 34, "id": "ef9fc825", "metadata": { "Collapsed": "false" }, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "marker": { "color": "rgb(33,102,172)" }, "name": "G1 Discharge", "type": "bar", "x": [ "2018-01-23T00:00:00", "2018-01-23T01:00:00", "2018-01-23T02:00:00", "2018-01-23T03:00:00", "2018-01-23T04:00:00", "2018-01-23T05:00:00", "2018-01-23T06:00:00", "2018-01-23T07:00:00", "2018-01-23T08:00:00", "2018-01-23T09:00:00", "2018-01-23T10:00:00", "2018-01-23T11:00:00", "2018-01-23T12:00:00", "2018-01-23T13:00:00", "2018-01-23T14:00:00", "2018-01-23T15:00:00", "2018-01-23T16:00:00", "2018-01-23T17:00:00", "2018-01-23T18:00:00", "2018-01-23T19:00:00", "2018-01-23T20:00:00", "2018-01-23T21:00:00", "2018-01-23T22:00:00", "2018-01-23T23:00:00", "2018-01-24T00:00:00", "2018-01-24T01:00:00", "2018-01-24T02:00:00", "2018-01-24T03:00:00", "2018-01-24T04:00:00", "2018-01-24T05:00:00", "2018-01-24T06:00:00", "2018-01-24T07:00:00", "2018-01-24T08:00:00", "2018-01-24T09:00:00", "2018-01-24T10:00:00", "2018-01-24T11:00:00", "2018-01-24T12:00:00", "2018-01-24T13:00:00", "2018-01-24T14:00:00", "2018-01-24T15:00:00", "2018-01-24T16:00:00", "2018-01-24T17:00:00", "2018-01-24T18:00:00", "2018-01-24T19:00:00", "2018-01-24T20:00:00", "2018-01-24T21:00:00", "2018-01-24T22:00:00", "2018-01-24T23:00:00", "2018-01-25T00:00:00", "2018-01-25T01:00:00", "2018-01-25T02:00:00", "2018-01-25T03:00:00", "2018-01-25T04:00:00", "2018-01-25T05:00:00", "2018-01-25T06:00:00", "2018-01-25T07:00:00", "2018-01-25T08:00:00", "2018-01-25T09:00:00", "2018-01-25T10:00:00", "2018-01-25T11:00:00", "2018-01-25T12:00:00", "2018-01-25T13:00:00", "2018-01-25T14:00:00", "2018-01-25T15:00:00", "2018-01-25T16:00:00", "2018-01-25T17:00:00", "2018-01-25T18:00:00", "2018-01-25T19:00:00", "2018-01-25T20:00:00", "2018-01-25T21:00:00", "2018-01-25T22:00:00", "2018-01-25T23:00:00" ], "xaxis": "x", "y": [ 191.70464241801392, 162.59981926189496, 133.51294476231104, 0.0, 162.53720677017415, 220.95, 249.578089922588, 250.62510543615895, 251.72325602061085, 252.9549863663217, 254.2487573028826, 255.5655416265991, 256.909952417384, 258.31190591297513, 259.7248536116788, 261.1655226984775, 262.63476986813794, 264.2110752806005, 250.14333333333332, 220.95, 220.95, 194.29455950589812, 194.40750084989804, 168.1615323634947, 168.33016162682546, 142.27449067580952, 0.0, 0.0, 0.0, 168.46991965407088, 194.79506285312078, 220.95, 235.54666666666665, 235.54666666666668, 220.95, 220.95, 220.95, 211.3283190270522, 196.04159958479275, 212.43582068253636, 220.95, 220.95, 220.95, 197.0813169171659, 197.28937317340169, 197.49953569681628, 197.71623315589196, 152.0738216819235, 175.3551276090066, 153.11327591916734, 0.0, 0.0, 0.0, 175.7015961388431, 198.5127319821751, 235.54666666666665, 235.54666666666665, 235.54666666666665, 235.54666666666665, 235.54666666666668, 235.54666666666668, 235.54666666666665, 235.54666666666668, 235.54666666666665, 250.14333333333332, 264.74, 264.74, 250.14333333333332, 250.14333333333332, 250.14333333333332, 235.54666666666665, 235.54666666666665 ], "yaxis": "y" }, { "marker": { "color": "rgb(67,147,195)" }, "name": "G2 Discharge", "type": "bar", "x": [ "2018-01-23T00:00:00", "2018-01-23T01:00:00", "2018-01-23T02:00:00", "2018-01-23T03:00:00", "2018-01-23T04:00:00", "2018-01-23T05:00:00", "2018-01-23T06:00:00", "2018-01-23T07:00:00", "2018-01-23T08:00:00", "2018-01-23T09:00:00", "2018-01-23T10:00:00", "2018-01-23T11:00:00", "2018-01-23T12:00:00", "2018-01-23T13:00:00", "2018-01-23T14:00:00", "2018-01-23T15:00:00", "2018-01-23T16:00:00", "2018-01-23T17:00:00", "2018-01-23T18:00:00", "2018-01-23T19:00:00", "2018-01-23T20:00:00", "2018-01-23T21:00:00", "2018-01-23T22:00:00", "2018-01-23T23:00:00", "2018-01-24T00:00:00", "2018-01-24T01:00:00", "2018-01-24T02:00:00", "2018-01-24T03:00:00", "2018-01-24T04:00:00", "2018-01-24T05:00:00", "2018-01-24T06:00:00", "2018-01-24T07:00:00", "2018-01-24T08:00:00", "2018-01-24T09:00:00", "2018-01-24T10:00:00", "2018-01-24T11:00:00", "2018-01-24T12:00:00", "2018-01-24T13:00:00", "2018-01-24T14:00:00", "2018-01-24T15:00:00", "2018-01-24T16:00:00", "2018-01-24T17:00:00", "2018-01-24T18:00:00", "2018-01-24T19:00:00", "2018-01-24T20:00:00", "2018-01-24T21:00:00", "2018-01-24T22:00:00", "2018-01-24T23:00:00", "2018-01-25T00:00:00", "2018-01-25T01:00:00", "2018-01-25T02:00:00", "2018-01-25T03:00:00", "2018-01-25T04:00:00", "2018-01-25T05:00:00", "2018-01-25T06:00:00", "2018-01-25T07:00:00", "2018-01-25T08:00:00", "2018-01-25T09:00:00", "2018-01-25T10:00:00", "2018-01-25T11:00:00", "2018-01-25T12:00:00", "2018-01-25T13:00:00", "2018-01-25T14:00:00", "2018-01-25T15:00:00", "2018-01-25T16:00:00", "2018-01-25T17:00:00", "2018-01-25T18:00:00", "2018-01-25T19:00:00", "2018-01-25T20:00:00", "2018-01-25T21:00:00", "2018-01-25T22:00:00", "2018-01-25T23:00:00" ], "xaxis": "x", "y": [ 74.66, 74.42426430958149, 0.0, 0.0, 69.20942444511311, 74.66, 81.82000000000001, 85.4, 85.4, 85.4, 85.4, 85.4, 85.4, 81.82, 81.82, 81.82000000000001, 85.4, 85.4, 78.24, 80.23418964947354, 77.45945697513594, 74.66, 74.66, 74.66, 74.66, 74.66, 0.0, 0.0, 0.0, 74.66, 74.66, 81.43906117591462, 81.66903293200059, 81.82, 78.24000000000001, 78.24, 74.66, 74.66, 74.66, 74.66, 78.24, 78.24, 74.66, 74.66, 74.66, 74.66, 74.66, 74.66, 74.66, 74.66, 0.0, 0.0, 0.0, 74.66, 74.66, 81.82, 81.82000000000001, 81.82, 81.82, 81.82, 81.82, 81.82000000000001, 81.82000000000001, 85.4, 85.4, 81.82, 81.82, 85.4, 85.4, 85.4, 85.4, 81.82000000000001 ], "yaxis": "y" }, { "marker": { "color": "rgb(146,197,222)" }, "name": "G3 Discharge", "type": "bar", "x": [ "2018-01-23T00:00:00", "2018-01-23T01:00:00", "2018-01-23T02:00:00", "2018-01-23T03:00:00", "2018-01-23T04:00:00", "2018-01-23T05:00:00", "2018-01-23T06:00:00", "2018-01-23T07:00:00", "2018-01-23T08:00:00", "2018-01-23T09:00:00", "2018-01-23T10:00:00", "2018-01-23T11:00:00", "2018-01-23T12:00:00", "2018-01-23T13:00:00", "2018-01-23T14:00:00", "2018-01-23T15:00:00", "2018-01-23T16:00:00", "2018-01-23T17:00:00", "2018-01-23T18:00:00", "2018-01-23T19:00:00", "2018-01-23T20:00:00", "2018-01-23T21:00:00", "2018-01-23T22:00:00", "2018-01-23T23:00:00", "2018-01-24T00:00:00", "2018-01-24T01:00:00", "2018-01-24T02:00:00", "2018-01-24T03:00:00", "2018-01-24T04:00:00", "2018-01-24T05:00:00", "2018-01-24T06:00:00", "2018-01-24T07:00:00", "2018-01-24T08:00:00", "2018-01-24T09:00:00", "2018-01-24T10:00:00", "2018-01-24T11:00:00", "2018-01-24T12:00:00", "2018-01-24T13:00:00", "2018-01-24T14:00:00", "2018-01-24T15:00:00", "2018-01-24T16:00:00", "2018-01-24T17:00:00", "2018-01-24T18:00:00", "2018-01-24T19:00:00", "2018-01-24T20:00:00", "2018-01-24T21:00:00", "2018-01-24T22:00:00", "2018-01-24T23:00:00", "2018-01-25T00:00:00", "2018-01-25T01:00:00", "2018-01-25T02:00:00", "2018-01-25T03:00:00", "2018-01-25T04:00:00", "2018-01-25T05:00:00", "2018-01-25T06:00:00", "2018-01-25T07:00:00", "2018-01-25T08:00:00", "2018-01-25T09:00:00", "2018-01-25T10:00:00", "2018-01-25T11:00:00", "2018-01-25T12:00:00", "2018-01-25T13:00:00", "2018-01-25T14:00:00", "2018-01-25T15:00:00", "2018-01-25T16:00:00", "2018-01-25T17:00:00", "2018-01-25T18:00:00", "2018-01-25T19:00:00", "2018-01-25T20:00:00", "2018-01-25T21:00:00", "2018-01-25T22:00:00", "2018-01-25T23:00:00" ], "xaxis": "x", "y": [ 74.66, 0.0, 0.0, 0.0, 0.0, 74.66, 81.82000000000001, 85.4, 85.4, 85.4, 85.4, 85.4, 85.4, 81.82, 81.82, 81.82000000000001, 85.4, 85.4, 78.24, 80.33307388603649, 77.45945697513594, 74.66, 74.66, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 74.66, 81.43307575297501, 81.82, 81.82, 78.24000000000001, 78.24, 74.78929991655059, 74.66, 74.66, 74.66, 78.24, 78.24, 74.66, 74.66, 74.66, 74.66, 74.66, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 74.66, 81.82, 81.82000000000001, 81.82, 81.82, 81.82, 81.82, 81.82000000000001, 81.82000000000001, 85.4, 85.4, 81.82, 81.82, 85.4, 85.4, 85.4, 85.4, 81.82000000000001 ], "yaxis": "y" }, { "marker": { "color": "rgb(209,229,240)" }, "name": "G4 Discharge", "type": "bar", "x": [ "2018-01-23T00:00:00", "2018-01-23T01:00:00", "2018-01-23T02:00:00", "2018-01-23T03:00:00", "2018-01-23T04:00:00", "2018-01-23T05:00:00", "2018-01-23T06:00:00", "2018-01-23T07:00:00", "2018-01-23T08:00:00", "2018-01-23T09:00:00", "2018-01-23T10:00:00", "2018-01-23T11:00:00", "2018-01-23T12:00:00", "2018-01-23T13:00:00", "2018-01-23T14:00:00", "2018-01-23T15:00:00", "2018-01-23T16:00:00", "2018-01-23T17:00:00", "2018-01-23T18:00:00", "2018-01-23T19:00:00", "2018-01-23T20:00:00", "2018-01-23T21:00:00", "2018-01-23T22:00:00", "2018-01-23T23:00:00", "2018-01-24T00:00:00", "2018-01-24T01:00:00", "2018-01-24T02:00:00", "2018-01-24T03:00:00", "2018-01-24T04:00:00", "2018-01-24T05:00:00", "2018-01-24T06:00:00", "2018-01-24T07:00:00", "2018-01-24T08:00:00", "2018-01-24T09:00:00", "2018-01-24T10:00:00", "2018-01-24T11:00:00", "2018-01-24T12:00:00", "2018-01-24T13:00:00", "2018-01-24T14:00:00", "2018-01-24T15:00:00", "2018-01-24T16:00:00", "2018-01-24T17:00:00", "2018-01-24T18:00:00", "2018-01-24T19:00:00", "2018-01-24T20:00:00", "2018-01-24T21:00:00", "2018-01-24T22:00:00", "2018-01-24T23:00:00", "2018-01-25T00:00:00", "2018-01-25T01:00:00", "2018-01-25T02:00:00", "2018-01-25T03:00:00", "2018-01-25T04:00:00", "2018-01-25T05:00:00", "2018-01-25T06:00:00", "2018-01-25T07:00:00", "2018-01-25T08:00:00", "2018-01-25T09:00:00", "2018-01-25T10:00:00", "2018-01-25T11:00:00", "2018-01-25T12:00:00", "2018-01-25T13:00:00", "2018-01-25T14:00:00", "2018-01-25T15:00:00", "2018-01-25T16:00:00", "2018-01-25T17:00:00", "2018-01-25T18:00:00", "2018-01-25T19:00:00", "2018-01-25T20:00:00", "2018-01-25T21:00:00", "2018-01-25T22:00:00", "2018-01-25T23:00:00" ], "xaxis": "x", "y": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 81.82000000000001, 85.4, 85.4, 85.4, 85.4, 85.4, 85.4, 81.82, 81.82, 81.82000000000001, 81.82, 85.4, 78.24, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 81.82, 81.82, 0.0, 0.0, 0.0, 0.0, 0.0 ], "yaxis": "y" }, { "marker": { "color": "rgb(247,247,247)" }, "name": "G1 production", "type": "scatter", "x": [ "2018-01-23T00:00:00", "2018-01-23T01:00:00", "2018-01-23T02:00:00", "2018-01-23T03:00:00", "2018-01-23T04:00:00", "2018-01-23T05:00:00", "2018-01-23T06:00:00", "2018-01-23T07:00:00", "2018-01-23T08:00:00", "2018-01-23T09:00:00", "2018-01-23T10:00:00", "2018-01-23T11:00:00", "2018-01-23T12:00:00", "2018-01-23T13:00:00", "2018-01-23T14:00:00", "2018-01-23T15:00:00", "2018-01-23T16:00:00", "2018-01-23T17:00:00", "2018-01-23T18:00:00", "2018-01-23T19:00:00", "2018-01-23T20:00:00", "2018-01-23T21:00:00", "2018-01-23T22:00:00", "2018-01-23T23:00:00", "2018-01-24T00:00:00", "2018-01-24T01:00:00", "2018-01-24T02:00:00", "2018-01-24T03:00:00", "2018-01-24T04:00:00", "2018-01-24T05:00:00", "2018-01-24T06:00:00", "2018-01-24T07:00:00", "2018-01-24T08:00:00", "2018-01-24T09:00:00", "2018-01-24T10:00:00", "2018-01-24T11:00:00", "2018-01-24T12:00:00", "2018-01-24T13:00:00", "2018-01-24T14:00:00", "2018-01-24T15:00:00", "2018-01-24T16:00:00", "2018-01-24T17:00:00", "2018-01-24T18:00:00", "2018-01-24T19:00:00", "2018-01-24T20:00:00", "2018-01-24T21:00:00", "2018-01-24T22:00:00", "2018-01-24T23:00:00", "2018-01-25T00:00:00", "2018-01-25T01:00:00", "2018-01-25T02:00:00", "2018-01-25T03:00:00", "2018-01-25T04:00:00", "2018-01-25T05:00:00", "2018-01-25T06:00:00", "2018-01-25T07:00:00", "2018-01-25T08:00:00", "2018-01-25T09:00:00", "2018-01-25T10:00:00", "2018-01-25T11:00:00", "2018-01-25T12:00:00", "2018-01-25T13:00:00", "2018-01-25T14:00:00", "2018-01-25T15:00:00", "2018-01-25T16:00:00", "2018-01-25T17:00:00", "2018-01-25T18:00:00", "2018-01-25T19:00:00", "2018-01-25T20:00:00", "2018-01-25T21:00:00", "2018-01-25T22:00:00", "2018-01-25T23:00:00" ], "xaxis": "x", "y": [ 143.49350629423645, 122.15516973910663, 99.99986608888287, 0.0, 122.19811532231046, 162.97999165209654, 179.99858754811586, 179.9984935694526, 179.99838876766006, 179.998166264307, 179.99799323449892, 179.99780781974454, 179.99963117846968, 179.99960653353605, 179.99953893678045, 179.99953580912322, 179.9994855761911, 179.99939569783075, 171.89968124887204, 154.56016691710334, 154.11843530444125, 136.9199439136131, 136.6520451766831, 118.60543910254785, 118.50526718848378, 99.99987777402883, 0.0, 0.0, 0.0, 118.42255009716014, 135.74294947241165, 151.47089741488705, 159.33532209593673, 158.77795277642556, 149.94937494643742, 149.46164680309278, 148.97391865974814, 142.8420966364812, 132.93758812911676, 142.36670139852114, 146.70195172849847, 146.04691254991533, 145.37159933348326, 130.71685753567135, 130.28639223181645, 129.85545468916837, 129.41601691995632, 100.01292420896584, 114.63571571277572, 100.01297260937784, 0.0, 0.0, 0.0, 114.46037611743095, 127.83201961461258, 147.41505505763, 146.51942020508824, 145.77750005628636, 145.01888701807516, 144.0560795515929, 143.09327208511078, 142.09249085546801, 141.03239377966202, 139.97229670385624, 145.4988727588445, 150.5213637091161, 149.0953119544227, 141.68453552208308, 140.38011626491405, 139.0086498654156, 131.46457204533064, 129.9374006019421 ], "yaxis": "y2" }, { "marker": { "color": "rgb(253,219,199)" }, "name": "G2 production", "type": "scatter", "x": [ "2018-01-23T00:00:00", "2018-01-23T01:00:00", "2018-01-23T02:00:00", "2018-01-23T03:00:00", "2018-01-23T04:00:00", "2018-01-23T05:00:00", "2018-01-23T06:00:00", "2018-01-23T07:00:00", "2018-01-23T08:00:00", "2018-01-23T09:00:00", "2018-01-23T10:00:00", "2018-01-23T11:00:00", "2018-01-23T12:00:00", "2018-01-23T13:00:00", "2018-01-23T14:00:00", "2018-01-23T15:00:00", "2018-01-23T16:00:00", "2018-01-23T17:00:00", "2018-01-23T18:00:00", "2018-01-23T19:00:00", "2018-01-23T20:00:00", "2018-01-23T21:00:00", "2018-01-23T22:00:00", "2018-01-23T23:00:00", "2018-01-24T00:00:00", "2018-01-24T01:00:00", "2018-01-24T02:00:00", "2018-01-24T03:00:00", "2018-01-24T04:00:00", "2018-01-24T05:00:00", "2018-01-24T06:00:00", "2018-01-24T07:00:00", "2018-01-24T08:00:00", "2018-01-24T09:00:00", "2018-01-24T10:00:00", "2018-01-24T11:00:00", "2018-01-24T12:00:00", "2018-01-24T13:00:00", "2018-01-24T14:00:00", "2018-01-24T15:00:00", "2018-01-24T16:00:00", "2018-01-24T17:00:00", "2018-01-24T18:00:00", "2018-01-24T19:00:00", "2018-01-24T20:00:00", "2018-01-24T21:00:00", "2018-01-24T22:00:00", "2018-01-24T23:00:00", "2018-01-25T00:00:00", "2018-01-25T01:00:00", "2018-01-25T02:00:00", "2018-01-25T03:00:00", "2018-01-25T04:00:00", "2018-01-25T05:00:00", "2018-01-25T06:00:00", "2018-01-25T07:00:00", "2018-01-25T08:00:00", "2018-01-25T09:00:00", "2018-01-25T10:00:00", "2018-01-25T11:00:00", "2018-01-25T12:00:00", "2018-01-25T13:00:00", "2018-01-25T14:00:00", "2018-01-25T15:00:00", "2018-01-25T16:00:00", "2018-01-25T17:00:00", "2018-01-25T18:00:00", "2018-01-25T19:00:00", "2018-01-25T20:00:00", "2018-01-25T21:00:00", "2018-01-25T22:00:00", "2018-01-25T23:00:00" ], "xaxis": "x", "y": [ 53.03294868128433, 54.99952155143248, 0.0, 0.0, 51.13483662034778, 52.94892586835615, 52.23776199695955, 53.315975284437755, 53.114606246432785, 52.893555135172626, 52.667620300957374, 52.440803679885406, 52.2130895868753, 50.764963101823504, 50.540890940944365, 50.315847940797184, 51.552444016005886, 51.02807937776578, 48.24913267143962, 53.401230655157114, 51.71503066955986, 49.94633068336463, 49.82060473328346, 51.88642720938559, 51.79362743586046, 51.700708562137955, 0.0, 0.0, 0.0, 51.7169993687297, 49.39409123741921, 52.97388446731076, 52.91539308712321, 52.813055466843075, 50.74883968797652, 50.583738286949256, 48.41769666725978, 48.270402444855264, 48.0776271948516, 47.889727425668944, 49.64955081091181, 49.427812763625504, 47.2587545676964, 47.03630880334371, 46.83437566243588, 46.63226371905177, 46.42611700699654, 48.39675354014383, 48.24615787379651, 48.07453429754979, 0.0, 0.0, 0.0, 48.08557759783299, 45.68375053903142, 49.04355173776033, 48.746435720340926, 48.50031269461269, 48.24865200495095, 47.92925228622511, 47.60985256749934, 47.277855512655286, 46.92618114408022, 48.07417578977398, 47.69933615676191, 41.019167715107464, 40.59573549420104, 46.45726925019402, 46.032509746497084, 45.585917606748794, 45.13896448783412, 43.24555150254228 ], "yaxis": "y2" }, { "marker": { "color": "rgb(244,165,130)" }, "name": "G3 production", "type": "scatter", "x": [ "2018-01-23T00:00:00", "2018-01-23T01:00:00", "2018-01-23T02:00:00", "2018-01-23T03:00:00", "2018-01-23T04:00:00", "2018-01-23T05:00:00", "2018-01-23T06:00:00", "2018-01-23T07:00:00", "2018-01-23T08:00:00", "2018-01-23T09:00:00", "2018-01-23T10:00:00", "2018-01-23T11:00:00", "2018-01-23T12:00:00", "2018-01-23T13:00:00", "2018-01-23T14:00:00", "2018-01-23T15:00:00", "2018-01-23T16:00:00", "2018-01-23T17:00:00", "2018-01-23T18:00:00", "2018-01-23T19:00:00", "2018-01-23T20:00:00", "2018-01-23T21:00:00", "2018-01-23T22:00:00", "2018-01-23T23:00:00", "2018-01-24T00:00:00", "2018-01-24T01:00:00", "2018-01-24T02:00:00", "2018-01-24T03:00:00", "2018-01-24T04:00:00", "2018-01-24T05:00:00", "2018-01-24T06:00:00", "2018-01-24T07:00:00", "2018-01-24T08:00:00", "2018-01-24T09:00:00", "2018-01-24T10:00:00", "2018-01-24T11:00:00", "2018-01-24T12:00:00", "2018-01-24T13:00:00", "2018-01-24T14:00:00", "2018-01-24T15:00:00", "2018-01-24T16:00:00", "2018-01-24T17:00:00", "2018-01-24T18:00:00", "2018-01-24T19:00:00", "2018-01-24T20:00:00", "2018-01-24T21:00:00", "2018-01-24T22:00:00", "2018-01-24T23:00:00", "2018-01-25T00:00:00", "2018-01-25T01:00:00", "2018-01-25T02:00:00", "2018-01-25T03:00:00", "2018-01-25T04:00:00", "2018-01-25T05:00:00", "2018-01-25T06:00:00", "2018-01-25T07:00:00", "2018-01-25T08:00:00", "2018-01-25T09:00:00", "2018-01-25T10:00:00", "2018-01-25T11:00:00", "2018-01-25T12:00:00", "2018-01-25T13:00:00", "2018-01-25T14:00:00", "2018-01-25T15:00:00", "2018-01-25T16:00:00", "2018-01-25T17:00:00", "2018-01-25T18:00:00", "2018-01-25T19:00:00", "2018-01-25T20:00:00", "2018-01-25T21:00:00", "2018-01-25T22:00:00", "2018-01-25T23:00:00" ], "xaxis": "x", "y": [ 53.03294868128433, 0.0, 0.0, 0.0, 0.0, 52.94892586835615, 52.23776199695955, 53.315975284437755, 53.114606246432785, 52.893555135172626, 52.667620300957374, 52.440803679885406, 52.2130895868753, 50.764963101823504, 50.540890940944365, 50.315847940797184, 51.552444016005886, 51.02807937776578, 48.24913267143962, 53.464261494803544, 51.71503066955986, 49.94633068336463, 49.82060473328346, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 49.39409123741921, 52.97015812180125, 53.005155253130596, 52.813055466843075, 50.74883968797652, 50.583738286949256, 48.501002626038996, 48.270402444855264, 48.0776271948516, 47.889727425668944, 49.64955081091181, 49.427812763625504, 47.2587545676964, 47.03630880334371, 46.83437566243588, 46.63226371905177, 46.42611700699654, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 45.68375053903142, 49.04355173776033, 48.746435720340926, 48.50031269461269, 48.24865200495095, 47.92925228622511, 47.60985256749934, 47.277855512655286, 46.92618114408022, 48.07417578977398, 47.69933615676191, 41.019167715107464, 40.59573549420104, 46.45726925019402, 46.032509746497084, 45.585917606748794, 45.13896448783412, 43.24555150254228 ], "yaxis": "y2" }, { "marker": { "color": "rgb(214,96,77)" }, "name": "G4 production", "type": "scatter", "x": [ "2018-01-23T00:00:00", "2018-01-23T01:00:00", "2018-01-23T02:00:00", "2018-01-23T03:00:00", "2018-01-23T04:00:00", "2018-01-23T05:00:00", "2018-01-23T06:00:00", "2018-01-23T07:00:00", "2018-01-23T08:00:00", "2018-01-23T09:00:00", "2018-01-23T10:00:00", "2018-01-23T11:00:00", "2018-01-23T12:00:00", "2018-01-23T13:00:00", "2018-01-23T14:00:00", "2018-01-23T15:00:00", "2018-01-23T16:00:00", "2018-01-23T17:00:00", "2018-01-23T18:00:00", "2018-01-23T19:00:00", "2018-01-23T20:00:00", "2018-01-23T21:00:00", "2018-01-23T22:00:00", "2018-01-23T23:00:00", "2018-01-24T00:00:00", "2018-01-24T01:00:00", "2018-01-24T02:00:00", "2018-01-24T03:00:00", "2018-01-24T04:00:00", "2018-01-24T05:00:00", "2018-01-24T06:00:00", "2018-01-24T07:00:00", "2018-01-24T08:00:00", "2018-01-24T09:00:00", "2018-01-24T10:00:00", "2018-01-24T11:00:00", "2018-01-24T12:00:00", "2018-01-24T13:00:00", "2018-01-24T14:00:00", "2018-01-24T15:00:00", "2018-01-24T16:00:00", "2018-01-24T17:00:00", "2018-01-24T18:00:00", "2018-01-24T19:00:00", "2018-01-24T20:00:00", "2018-01-24T21:00:00", "2018-01-24T22:00:00", "2018-01-24T23:00:00", "2018-01-25T00:00:00", "2018-01-25T01:00:00", "2018-01-25T02:00:00", "2018-01-25T03:00:00", "2018-01-25T04:00:00", "2018-01-25T05:00:00", "2018-01-25T06:00:00", "2018-01-25T07:00:00", "2018-01-25T08:00:00", "2018-01-25T09:00:00", "2018-01-25T10:00:00", "2018-01-25T11:00:00", "2018-01-25T12:00:00", "2018-01-25T13:00:00", "2018-01-25T14:00:00", "2018-01-25T15:00:00", "2018-01-25T16:00:00", "2018-01-25T17:00:00", "2018-01-25T18:00:00", "2018-01-25T19:00:00", "2018-01-25T20:00:00", "2018-01-25T21:00:00", "2018-01-25T22:00:00", "2018-01-25T23:00:00" ], "xaxis": "x", "y": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 52.23776199695955, 53.315975284437755, 53.114606246432785, 52.893555135172626, 52.667620300957374, 52.440803679885406, 52.2130895868753, 50.764963101823504, 50.540890940944365, 50.315847940797184, 49.56994011072471, 51.02807937776578, 48.24913267143962, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 41.019167715107464, 40.59573549420104, 0.0, 0.0, 0.0, 0.0, 0.0 ], "yaxis": "y2" } ], "layout": { "barmode": "stack", "template": { "data": { "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" } ], "barpolar": [ { "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "barpolar" } ], "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" } ], "choropleth": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "choropleth" } ], "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" ] ], "type": "contour" } ], "contourcarpet": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "contourcarpet" } ], "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" ] ], "type": "heatmap" } ], "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" ] ], "type": "heatmapgl" } ], "histogram": [ { "marker": { "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "histogram" } ], "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" ] ], "type": "histogram2d" } ], "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" ] ], "type": "histogram2dcontour" } ], "mesh3d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "mesh3d" } ], "parcoords": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "parcoords" } ], "pie": [ { "automargin": true, "type": "pie" } ], "scatter": [ { "fillpattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 }, "type": "scatter" } ], "scatter3d": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter3d" } ], "scattercarpet": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattercarpet" } ], "scattergeo": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergeo" } ], "scattergl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergl" } ], "scattermapbox": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattermapbox" } ], "scatterpolar": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolar" } ], "scatterpolargl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolargl" } ], "scatterternary": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterternary" } ], "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" ] ], "type": "surface" } ], "table": [ { "cells": { "fill": { "color": "#EBF0F8" }, "line": { "color": "white" } }, "header": { "fill": { "color": "#C8D4E3" }, "line": { "color": "white" } }, "type": "table" } ] }, "layout": { "annotationdefaults": { "arrowcolor": "#2a3f5f", "arrowhead": 0, "arrowwidth": 1 }, "autotypenumbers": "strict", "coloraxis": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "colorscale": { "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" ] ], "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" ] ] }, "colorway": [ "#636efa", "#EF553B", "#00cc96", "#ab63fa", "#FFA15A", "#19d3f3", "#FF6692", "#B6E880", "#FF97FF", "#FECB52" ], "font": { "color": "#2a3f5f" }, "geo": { "bgcolor": "white", "lakecolor": "white", "landcolor": "#E5ECF6", "showlakes": true, "showland": true, "subunitcolor": "white" }, "hoverlabel": { "align": "left" }, "hovermode": "closest", "mapbox": { "style": "light" }, "paper_bgcolor": "white", "plot_bgcolor": "#E5ECF6", "polar": { "angularaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "radialaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "scene": { "xaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "yaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "zaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" } }, "shapedefaults": { "line": { "color": "#2a3f5f" } }, "ternary": { "aaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "baxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "caxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "title": { "x": 0.05 }, "xaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 }, "yaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 } } }, "title": { "text": "Unit discharge and production in Plant2" }, "xaxis": { "anchor": "y", "domain": [ 0.0, 0.94 ], "title": { "text": "Time (Hour)" } }, "yaxis": { "anchor": "x", "domain": [ 0.0, 1.0 ], "dtick": 60, "range": [ 0, 540 ], "tick0": 60, "title": { "text": "Discharge (m3/s)" } }, "yaxis2": { "anchor": "x", "dtick": 40, "overlaying": "y", "range": [ 0, 360 ], "side": "right", "tick0": 40, "title": { "text": "Production (MW)" } } } }, "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# Plotting discharge and production results from Plant 2\n", "\n", "# Retrieving discharge results on generators\n", "G1_discharge=shop.model.generator.Plant2_Generator1.discharge.get()\n", "G2_discharge=shop.model.generator.Plant2_Generator2.discharge.get()\n", "G3_discharge=shop.model.generator.Plant2_Generator3.discharge.get()\n", "G4_discharge=shop.model.generator.Plant2_Generator4.discharge.get()\n", "\n", "# Retrieving discharge results on generators\n", "G1_production=shop.model.generator.Plant2_Generator1.production.get()\n", "G2_production=shop.model.generator.Plant2_Generator2.production.get()\n", "G3_production=shop.model.generator.Plant2_Generator3.production.get()\n", "G4_production=shop.model.generator.Plant2_Generator4.production.get()\n", "\n", "fig = make_subplots(specs=[[{\"secondary_y\": True}]])\n", "colorscale = px.colors.sequential.RdBu_r\n", "fig.add_trace(go.Bar(x=G1_discharge.index, y=G1_discharge.values, name=\"G1 Discharge\", marker_color=colorscale[1]), secondary_y=False)\n", "fig.add_trace(go.Bar(x=G2_discharge.index, y=G2_discharge.values, name=\"G2 Discharge\", marker_color=colorscale[2]), secondary_y=False)\n", "fig.add_trace(go.Bar(x=G3_discharge.index, y=G3_discharge.values, name=\"G3 Discharge\", marker_color=colorscale[3]), secondary_y=False)\n", "fig.add_trace(go.Bar(x=G4_discharge.index, y=G4_discharge.values, name=\"G4 Discharge\", marker_color=colorscale[4]), secondary_y=False)\n", "fig.add_trace(go.Scatter(x=G1_production.index, y=G1_production.values, name=\"G1 production\", marker_color=colorscale[5]), secondary_y=True)\n", "fig.add_trace(go.Scatter(x=G2_production.index, y=G2_production.values, name=\"G2 production\", marker_color=colorscale[6]), secondary_y=True)\n", "fig.add_trace(go.Scatter(x=G3_production.index, y=G3_production.values, name=\"G3 production\", marker_color=colorscale[7]), secondary_y=True)\n", "fig.add_trace(go.Scatter(x=G4_production.index, y=G4_production.values, name=\"G4 production\", marker_color=colorscale[8]), secondary_y=True)\n", "fig.update_layout(title_text=\"Unit discharge and production in Plant2\", barmode=\"stack\")\n", "fig.update_xaxes(title_text=\"Time (Hour)\")\n", "fig.update_yaxes(title_text=\"Discharge (m3/s)\", secondary_y=False, range=[0, 540], tick0=60, dtick=60)\n", "fig.update_yaxes(title_text=\"Production (MW)\", secondary_y=True, range=[0, 360], tick0=40, dtick=40)\n", "fig.show()" ] }, { "cell_type": "code", "execution_count": 35, "id": "19ac1665", "metadata": { "Collapsed": "false" }, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "marker": { "color": "rgb(33,102,172)" }, "name": "Reservoir1 storage", "type": "scatter", "x": [ "2018-01-23T00:00:00", "2018-01-23T01:00:00", "2018-01-23T02:00:00", "2018-01-23T03:00:00", "2018-01-23T04:00:00", "2018-01-23T05:00:00", "2018-01-23T06:00:00", "2018-01-23T07:00:00", "2018-01-23T08:00:00", "2018-01-23T09:00:00", "2018-01-23T10:00:00", "2018-01-23T11:00:00", "2018-01-23T12:00:00", "2018-01-23T13:00:00", "2018-01-23T14:00:00", "2018-01-23T15:00:00", "2018-01-23T16:00:00", "2018-01-23T17:00:00", "2018-01-23T18:00:00", "2018-01-23T19:00:00", "2018-01-23T20:00:00", "2018-01-23T21:00:00", "2018-01-23T22:00:00", "2018-01-23T23:00:00", "2018-01-24T00:00:00", "2018-01-24T01:00:00", "2018-01-24T02:00:00", "2018-01-24T03:00:00", "2018-01-24T04:00:00", "2018-01-24T05:00:00", "2018-01-24T06:00:00", "2018-01-24T07:00:00", "2018-01-24T08:00:00", "2018-01-24T09:00:00", "2018-01-24T10:00:00", "2018-01-24T11:00:00", "2018-01-24T12:00:00", "2018-01-24T13:00:00", "2018-01-24T14:00:00", "2018-01-24T15:00:00", "2018-01-24T16:00:00", "2018-01-24T17:00:00", "2018-01-24T18:00:00", "2018-01-24T19:00:00", "2018-01-24T20:00:00", "2018-01-24T21:00:00", "2018-01-24T22:00:00", "2018-01-24T23:00:00", "2018-01-25T00:00:00", "2018-01-25T01:00:00", "2018-01-25T02:00:00", "2018-01-25T03:00:00", "2018-01-25T04:00:00", "2018-01-25T05:00:00", "2018-01-25T06:00:00", "2018-01-25T07:00:00", "2018-01-25T08:00:00", "2018-01-25T09:00:00", "2018-01-25T10:00:00", "2018-01-25T11:00:00", "2018-01-25T12:00:00", "2018-01-25T13:00:00", "2018-01-25T14:00:00", "2018-01-25T15:00:00", "2018-01-25T16:00:00", "2018-01-25T17:00:00", "2018-01-25T18:00:00", "2018-01-25T19:00:00", "2018-01-25T20:00:00", "2018-01-25T21:00:00", "2018-01-25T22:00:00", "2018-01-25T23:00:00", "2018-01-26T00:00:00" ], "y": [ 32.769999999999996, 32.355304, 31.967247999999998, 31.596951999999998, 31.4036407608823, 31.01623998541325, 30.59266398541325, 30.16908798541325, 29.74551198541325, 29.321935985413248, 28.898359985413247, 28.474783985413247, 28.051207985413246, 27.627631985413245, 27.204055985413245, 26.780479985413244, 26.356903985413243, 25.933327985413243, 25.509751985413242, 25.08617598541324, 24.698119985413243, 24.310063985413244, 23.939767985413244, 23.754619985413242, 23.56947198541324, 23.38432398541324, 23.38432398541324, 23.38432398541324, 23.38432398541324, 23.38432398541324, 23.199175985413238, 23.014027985413236, 22.625971985413237, 22.237915985413238, 21.84985998541324, 21.47956398541324, 21.10926798541324, 20.73897198541324, 20.54494398541324, 20.35979598541324, 20.174647985413237, 19.980619985413238, 19.78659198541324, 19.601443985413237, 19.416295985413235, 19.231147985413234, 19.045999985413232, 19.045999985413232, 19.045999985413232, 19.045999985413232, 19.045999985413232, 19.045999985413232, 19.045999985413232, 19.045999985413232, 19.045999985413232, 18.86085198541323, 18.66682398541323, 18.29652798541323, 17.92623198541323, 17.732203985413232, 17.538175985413233, 17.35302798541323, 17.16787998541323, 16.982731985413228, 16.797583985413226, 16.427287985413226, 16.039231985413227, 15.651175985413227, 15.457147985413227, 15.271999985413228, 15.086851985413228, 15.086851985413228, 15.086851985413228 ] }, { "marker": { "color": "rgb(67,147,195)" }, "name": "Reservoir2 storage", "type": "scatter", "x": [ "2018-01-23T00:00:00", "2018-01-23T01:00:00", "2018-01-23T02:00:00", "2018-01-23T03:00:00", "2018-01-23T04:00:00", "2018-01-23T05:00:00", "2018-01-23T06:00:00", "2018-01-23T07:00:00", "2018-01-23T08:00:00", "2018-01-23T09:00:00", "2018-01-23T10:00:00", "2018-01-23T11:00:00", "2018-01-23T12:00:00", "2018-01-23T13:00:00", "2018-01-23T14:00:00", "2018-01-23T15:00:00", "2018-01-23T16:00:00", "2018-01-23T17:00:00", "2018-01-23T18:00:00", "2018-01-23T19:00:00", "2018-01-23T20:00:00", "2018-01-23T21:00:00", "2018-01-23T22:00:00", "2018-01-23T23:00:00", "2018-01-24T00:00:00", "2018-01-24T01:00:00", "2018-01-24T02:00:00", "2018-01-24T03:00:00", "2018-01-24T04:00:00", "2018-01-24T05:00:00", "2018-01-24T06:00:00", "2018-01-24T07:00:00", "2018-01-24T08:00:00", "2018-01-24T09:00:00", "2018-01-24T10:00:00", "2018-01-24T11:00:00", "2018-01-24T12:00:00", "2018-01-24T13:00:00", "2018-01-24T14:00:00", "2018-01-24T15:00:00", "2018-01-24T16:00:00", "2018-01-24T17:00:00", "2018-01-24T18:00:00", "2018-01-24T19:00:00", "2018-01-24T20:00:00", "2018-01-24T21:00:00", "2018-01-24T22:00:00", "2018-01-24T23:00:00", "2018-01-25T00:00:00", "2018-01-25T01:00:00", "2018-01-25T02:00:00", "2018-01-25T03:00:00", "2018-01-25T04:00:00", "2018-01-25T05:00:00", "2018-01-25T06:00:00", "2018-01-25T07:00:00", "2018-01-25T08:00:00", "2018-01-25T09:00:00", "2018-01-25T10:00:00", "2018-01-25T11:00:00", "2018-01-25T12:00:00", "2018-01-25T13:00:00", "2018-01-25T14:00:00", "2018-01-25T15:00:00", "2018-01-25T16:00:00", "2018-01-25T17:00:00", "2018-01-25T18:00:00", "2018-01-25T19:00:00", "2018-01-25T20:00:00", "2018-01-25T21:00:00", "2018-01-25T22:00:00", "2018-01-25T23:00:00", "2018-01-26T00:00:00" ], "y": [ 56.541666666666664, 55.94467395396181, 55.69544325310449, 55.801092651960175, 56.210403891077874, 55.97951679417189, 55.28612079417189, 54.14355967045058, 52.95856529088041, 51.76961756920621, 50.576235618287456, 49.378196091997076, 48.175416142141316, 46.96779631343873, 45.79379345215202, 44.61470397914998, 43.43042809743546, 42.215086925910164, 40.9811830549, 39.8752510549, 39.10584490617216, 38.35677281595118, 37.706056401729946, 36.86978539867031, 36.39677588216173, 35.92315930030516, 35.35819513387224, 35.574195133872244, 35.790195133872245, 36.00619513387225, 35.53207542311759, 34.69440919684636, 33.91670550390236, 33.08423298534716, 32.251216985347156, 31.478764985347155, 30.706312985347154, 29.95917150564757, 29.070865557150185, 28.22871179864493, 27.3275388441878, 26.378818844187798, 25.430098844187796, 24.498274844187797, 23.652378103286, 22.805732359861754, 21.958330031353213, 20.924999591992, 20.324757833937078, 19.640703374544653, 19.03671958123565, 19.252719581235652, 19.468719581235653, 19.684719581235655, 18.99941783513582, 18.14836799999999, 17.12132399999999, 16.270547999999994, 15.419771999999998, 14.392727999999998, 13.365683999999998, 12.329759999999998, 11.293835999999999, 10.257912, 9.196212, 8.267112, 7.034447999999998, 5.801783999999999, 4.696415999999999, 3.582168, 2.46792, 1.221072, 0.0 ] } ], "layout": { "template": { "data": { "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" } ], "barpolar": [ { "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "barpolar" } ], "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" } ], "choropleth": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "choropleth" } ], "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" ] ], "type": "contour" } ], "contourcarpet": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "contourcarpet" } ], "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" ] ], "type": "heatmap" } ], "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" ] ], "type": "heatmapgl" } ], "histogram": [ { "marker": { "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "histogram" } ], "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" ] ], "type": "histogram2d" } ], "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" ] ], "type": "histogram2dcontour" } ], "mesh3d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "mesh3d" } ], "parcoords": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "parcoords" } ], "pie": [ { "automargin": true, "type": "pie" } ], "scatter": [ { "fillpattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 }, "type": "scatter" } ], "scatter3d": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter3d" } ], "scattercarpet": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattercarpet" } ], "scattergeo": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergeo" } ], "scattergl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergl" } ], "scattermapbox": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattermapbox" } ], "scatterpolar": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolar" } ], "scatterpolargl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolargl" } ], "scatterternary": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterternary" } ], "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" ] ], "type": "surface" } ], "table": [ { "cells": { "fill": { "color": "#EBF0F8" }, "line": { "color": "white" } }, "header": { "fill": { "color": "#C8D4E3" }, "line": { "color": "white" } }, "type": "table" } ] }, "layout": { "annotationdefaults": { "arrowcolor": "#2a3f5f", "arrowhead": 0, "arrowwidth": 1 }, "autotypenumbers": "strict", "coloraxis": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "colorscale": { "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" ] ], "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" ] ] }, "colorway": [ "#636efa", "#EF553B", "#00cc96", "#ab63fa", "#FFA15A", "#19d3f3", "#FF6692", "#B6E880", "#FF97FF", "#FECB52" ], "font": { "color": "#2a3f5f" }, "geo": { "bgcolor": "white", "lakecolor": "white", "landcolor": "#E5ECF6", "showlakes": true, "showland": true, "subunitcolor": "white" }, "hoverlabel": { "align": "left" }, "hovermode": "closest", "mapbox": { "style": "light" }, "paper_bgcolor": "white", "plot_bgcolor": "#E5ECF6", "polar": { "angularaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "radialaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "scene": { "xaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "yaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "zaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" } }, "shapedefaults": { "line": { "color": "#2a3f5f" } }, "ternary": { "aaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "baxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "caxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "title": { "x": 0.05 }, "xaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 }, "yaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 } } }, "title": { "text": "Reservoir trajectories " }, "xaxis": { "title": { "text": "Time (Hour)" } }, "yaxis": { "title": { "text": "Volume (Mm3)" } } } }, "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# Plotting reservoir trajectories\n", "water_storage_rsv1=shop.model.reservoir.Reservoir1.storage.get()\n", "water_storage_rsv2=shop.model.reservoir.Reservoir2.storage.get()\n", "fig = go.Figure()\n", "colorscale = px.colors.sequential.RdBu_r\n", "fig.add_trace(go.Scatter(x=water_storage_rsv1.index, y=water_storage_rsv1.values, name=\"Reservoir1 storage\", marker_color=colorscale[1]))\n", "fig.add_trace(go.Scatter(x=water_storage_rsv2.index, y=water_storage_rsv2.values, name=\"Reservoir2 storage\", marker_color=colorscale[2]))\n", "fig.update_layout(title=\"Reservoir trajectories \", xaxis_title=\"Time (Hour)\", yaxis_title=\"Volume (Mm3)\")\n", "fig.show()" ] }, { "cell_type": "markdown", "id": "6b9a5bcf", "metadata": {}, "source": [ "Lastly, we can inspect individual values describing our model run." ] }, { "cell_type": "code", "execution_count": 36, "id": "b0137f4a", "metadata": { "Collapsed": "false" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Income from fixed load: -0.0\n", "Sum of selling vs. buying in the market: -921909.0392075882\n", "End reservoir value: -294831.3054726373\n", "Sum of startup costs: 6400.0\n", "Sum of load penalties: 0.0\n", "Total objective value: -1210340.3446802255\n", "Grand total objective value (excluding major penalties): -1210340.3446802255\n" ] } ], "source": [ "print(\"Income from fixed load:\",shop.model.objective.scen_1.load_value.get())\n", "print(\"Sum of selling vs. buying in the market:\", shop.model.objective.scen_1.market_sale_buy.get())\n", "print(\"End reservoir value:\", shop.model.objective.scen_1.rsv_end_value.get())\n", "print(\"Sum of startup costs:\", shop.model.objective.scen_1.startup_costs.get())\n", "print(\"Sum of load penalties:\", shop.model.objective.scen_1.load_penalty.get())\n", "print(\"Total objective value:\", shop.model.objective.scen_1.total.get())\n", "print(\"Grand total objective value (excluding major penalties):\", shop.model.objective.scen_1.grand_total.get())" ] } ], "metadata": { "jupytext": { "text_representation": { "extension": ".md", "format_name": "myst", "format_version": 0.13, "jupytext_version": "1.13.8" } }, "kernelspec": { "display_name": "Python 3 (ipykernel)", "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.11" }, "source_map": [ 12, 34, 43, 51, 56, 60, 65, 71, 82, 92, 99, 103, 107, 111, 125, 129, 137, 143, 148, 160, 169, 173, 179, 183, 190, 194, 199, 203, 223, 229, 236, 240, 244, 248, 262, 268, 279, 283, 294, 298, 302, 306, 384, 388, 407, 429, 435, 449, 453, 457, 463, 492, 496, 502, 508, 532, 536, 557, 565, 579, 585, 611, 641, 675, 687, 691 ] }, "nbformat": 4, "nbformat_minor": 5 }