{ "cells": [ { "cell_type": "markdown", "id": "a3726e07", "metadata": {}, "source": [ "(min_uptime_downtime)=\n", "# Minimum up- and downtime\n", "\n", "## Introduction\n", "This documentation demonstrates how to apply the constraints for minimum up- and downtime under the **MIN_UPTIME_DOWNTIME_FUNCTIONALITY** license for generators, pumps and plants. \n", "\n", "The model setup for this example is available in the following format:\n", "\n", "- pyshop\n", " - [](min_uptime_downtime_model_generator.py)\n", " - [](min_uptime_downtime_model_plant.py)\n", "\n", "Note that currently this feature is only available with constant time resolution for the whole optimization period. The time resolution should be given in hours or minutes. The minimum up- and downtime attributes are given as constants in minutes. \n", "\n", "## Minimum up- and downtime on generators\n", "\n", "Minimum up- and downtime constraints can be set for [generators](generator) using the attributes [min_uptime](generator:min_uptime) and [min_downtime](generator:min_downtime). The constraints can be turned on or off for parts of the optimization period using the flag variables [min_uptime_flag](generator:min_uptime_flag) and [min_downtime_flag](generator:min_downtime_flag). \n", "\n", "If the generator attribute [historical_production](generator:historical_production) is set, SHOP will automatically find the state of the generator at the beginning of the optimization period as well as for how long the generator has been in that state. This will impose constraints on the generator state from the very first time step of the optimization period. \n", "\n", "Equivalent variables are also available for [pumps](pump): [min_uptime](pump:min_uptime), [min_downtime](pump:min_downtime), [min_uptime_flag](pump:min_uptime_flag) and [min_downtime_flag](pump:min_downtime_flag). Historical pump consumption data can be provided through the [historical_consumption](pump:historical_consumption) attribute." ] }, { "cell_type": "markdown", "id": "59df492c", "metadata": {}, "source": [ "### Imports" ] }, { "cell_type": "code", "execution_count": 1, "id": "e26a2f3b", "metadata": {}, "outputs": [], "source": [ "#Necessary imports used in all examples\n", "import pandas as pd\n", "import plotly.graph_objs as go\n", "import plotly.express as px\n", "\n", "from pyshop import ShopSession\n", "\n", "#Functions used in this example for building a basic SHOP model and running it\n", "from min_uptime_downtime_model_generator import build_model, run_model\n", "from min_uptime_downtime_model_plant import build_model_plant, run_model_plant" ] }, { "cell_type": "markdown", "id": "fa529b86", "metadata": {}, "source": [ "### Create a SHOP session and import basic model \n", "Our example model consists of two reservoirs and two plants with one generator each." ] }, { "cell_type": "code", "execution_count": 2, "id": "f97fcdeb", "metadata": {}, "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", "reservoir_Reservoir2\n", "\n", "Reservoir2\n", "\n", "\n", "\n", "plant_Plant1->reservoir_Reservoir2\n", "\n", "\n", "\n", "\n", "plant_Plant2\n", "\n", "Plant2\n", "\n", "\n", "\n", "reservoir_Reservoir2->plant_Plant2\n", "\n", "\n", "\n", "\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "#Create a standard ShopSession\n", "shop=ShopSession()\n", "#Build a basic SHOP model\n", "build_model(shop)\n", "#Display topology to the screen\n", "display(shop.model.build_connection_tree())" ] }, { "cell_type": "markdown", "id": "eba6bf0e", "metadata": {}, "source": [ "### Add market\n", "\n", "We add a market with varying spot price so that the generators will turn on and off several times when no minimum up- or downtime constraints are present." ] }, { "cell_type": "code", "execution_count": 3, "id": "05765057", "metadata": {}, "outputs": [ { "data": { "text/html": [ " \n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "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-02-27T00:00:00", "2018-02-27T01:00:00", "2018-02-27T02:00:00", "2018-02-27T03:00:00", "2018-02-27T04:00:00", "2018-02-27T05:00:00", "2018-02-27T06:00:00", "2018-02-27T07:00:00", "2018-02-27T08:00:00", "2018-02-27T09:00:00", "2018-02-27T10:00:00", "2018-02-27T11:00:00", "2018-02-27T12:00:00", "2018-02-27T13:00:00", "2018-02-27T14:00:00", "2018-02-27T15:00:00", "2018-02-27T16:00:00", "2018-02-27T17:00:00", "2018-02-27T18:00:00", "2018-02-27T19:00:00", "2018-02-27T20:00:00", "2018-02-27T21:00:00", "2018-02-27T22:00:00", "2018-02-27T23:00:00" ], "y": [ 5.0, 41.0, 50.0, 35.0, 15.0, 14.0, 7.0, 8.0, 36.0, 60.0, 20.0, 43.0, 21.0, 17.0, 45.0, 16.0, 38.0, 50.0, 15.0, 63.0, 14.0, 13.0, 56.0, 12.0 ] }, { "line": { "dash": "dot" }, "marker": { "color": "rgb(67,147,195)" }, "name": "Water value of Reservoir1", "type": "scatter", "x": [ "2018-02-27T00:00:00", "2018-02-27T01:00:00", "2018-02-27T02:00:00", "2018-02-27T03:00:00", "2018-02-27T04:00:00", "2018-02-27T05:00:00", "2018-02-27T06:00:00", "2018-02-27T07:00:00", "2018-02-27T08:00:00", "2018-02-27T09:00:00", "2018-02-27T10:00:00", "2018-02-27T11:00:00", "2018-02-27T12:00:00", "2018-02-27T13:00:00", "2018-02-27T14:00:00", "2018-02-27T15:00:00", "2018-02-27T16:00:00", "2018-02-27T17:00:00", "2018-02-27T18:00:00", "2018-02-27T19:00:00", "2018-02-27T20:00:00", "2018-02-27T21:00:00", "2018-02-27T22:00:00", "2018-02-27T23: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 ] }, { "line": { "dash": "dot" }, "marker": { "color": "rgb(146,197,222)" }, "name": "Water value of Reservoir2", "type": "scatter", "x": [ "2018-02-27T00:00:00", "2018-02-27T01:00:00", "2018-02-27T02:00:00", "2018-02-27T03:00:00", "2018-02-27T04:00:00", "2018-02-27T05:00:00", "2018-02-27T06:00:00", "2018-02-27T07:00:00", "2018-02-27T08:00:00", "2018-02-27T09:00:00", "2018-02-27T10:00:00", "2018-02-27T11:00:00", "2018-02-27T12:00:00", "2018-02-27T13:00:00", "2018-02-27T14:00:00", "2018-02-27T15:00:00", "2018-02-27T16:00:00", "2018-02-27T17:00:00", "2018-02-27T18:00:00", "2018-02-27T19:00:00", "2018-02-27T20:00:00", "2018-02-27T21:00:00", "2018-02-27T22:00:00", "2018-02-27T23: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 ] } ], "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": "f0c19570", "metadata": {}, "source": [ "### Run SHOP\n", "We run SHOP without any minimum up-or downtime constraints for later comparison." ] }, { "cell_type": "code", "execution_count": 4, "id": "f2044951", "metadata": {}, "outputs": [], "source": [ "run_model(shop)" ] }, { "cell_type": "markdown", "id": "00fabb86", "metadata": {}, "source": [ "### Generator production\n", "\n", "The plot below shows the generator production without any constraints on the minimum up- or downtime of the generators. Due to the varying market price, the generators are turned on and off frequently." ] }, { "cell_type": "code", "execution_count": 5, "id": "7a9d2b20", "metadata": {}, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "marker": { "color": "rgb(243, 203, 211)" }, "name": "Plant1_G1", "type": "bar", "x": [ "2018-02-27T00:00:00", "2018-02-27T01:00:00", "2018-02-27T02:00:00", "2018-02-27T03:00:00", "2018-02-27T04:00:00", "2018-02-27T05:00:00", "2018-02-27T06:00:00", "2018-02-27T07:00:00", "2018-02-27T08:00:00", "2018-02-27T09:00:00", "2018-02-27T10:00:00", "2018-02-27T11:00:00", "2018-02-27T12:00:00", "2018-02-27T13:00:00", "2018-02-27T14:00:00", "2018-02-27T15:00:00", "2018-02-27T16:00:00", "2018-02-27T17:00:00", "2018-02-27T18:00:00", "2018-02-27T19:00:00", "2018-02-27T20:00:00", "2018-02-27T21:00:00", "2018-02-27T22:00:00", "2018-02-27T23:00:00" ], "y": [ 0.0, 38.61114656998041, 38.485291006967984, 29.35963226778352, 0.0, 0.0, 0.0, 0.0, 38.85362587867811, 39.34248231617179, 0.0, 38.771978917171765, 0.0, 0.0, 38.91894644265806, 0.0, 38.94344234048981, 38.845460995358344, 0.0, 39.986158706078214, 0.0, 0.0, 39.59214064213572, 0.0 ] }, { "marker": { "color": "rgb(234, 169, 189)" }, "name": "Plant2_G1", "type": "bar", "x": [ "2018-02-27T00:00:00", "2018-02-27T01:00:00", "2018-02-27T02:00:00", "2018-02-27T03:00:00", "2018-02-27T04:00:00", "2018-02-27T05:00:00", "2018-02-27T06:00:00", "2018-02-27T07:00:00", "2018-02-27T08:00:00", "2018-02-27T09:00:00", "2018-02-27T10:00:00", "2018-02-27T11:00:00", "2018-02-27T12:00:00", "2018-02-27T13:00:00", "2018-02-27T14:00:00", "2018-02-27T15:00:00", "2018-02-27T16:00:00", "2018-02-27T17:00:00", "2018-02-27T18:00:00", "2018-02-27T19:00:00", "2018-02-27T20:00:00", "2018-02-27T21:00:00", "2018-02-27T22:00:00", "2018-02-27T23:00:00" ], "y": [ 0.0, 28.47069505946023, 30.249883158049258, 24.99958051182294, 0.0, 0.0, 0.0, 0.0, 30.22213227219286, 30.64542092801773, 0.0, 30.22213227219286, 0.0, 0.0, 30.22213227219286, 0.0, 30.22213227219286, 30.22213227219286, 0.0, 31.018310858562987, 0.0, 0.0, 30.64542092801773, 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": "Generator production" }, "xaxis": { "title": { "text": "Time (Hour)" } }, "yaxis": { "title": { "text": "Production (MW)" } } } }, "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "### Generator production with no uptime- or downtime constraints\n", "fig = go.Figure()\n", "fig.update_layout(title = f\"Generator production\", xaxis_title=\"Time (Hour)\", yaxis_title=\"Production (MW)\")\n", "colorscale = px.colors.sequential.Magenta\n", "for i, gen in enumerate(shop.model.generator):\n", " data=gen.production.get()\n", " fig.add_trace(go.Bar(x=data.index, y=data.values, name=gen.get_name(), marker_color=colorscale[i]))\n", "fig.show()" ] }, { "cell_type": "markdown", "id": "3f54d1e2", "metadata": {}, "source": [ "### Add minimum uptime and downtime constraints\n", "\n", "We set the minimum up- and down-times for the generators, which must be given in minutes. The minimum up- and downtimes should be divisible by the time resolution, otherwise they will be rounded up. \n", "\n", "For the second generator we set the up- and downtime flags so that the constraints are only applied after 12 hours." ] }, { "cell_type": "code", "execution_count": 6, "id": "e976cdcd", "metadata": {}, "outputs": [], "source": [ "shop2=ShopSession()\n", "build_model(shop2)\n", "starttime=shop2.get_time_resolution()[\"starttime\"]\n", "\n", "shop2.model.generator.Plant1_G1.min_downtime.set(120)\n", "shop2.model.generator.Plant1_G1.min_uptime.set(180)\n", "\n", "shop2.model.generator.Plant2_G1.min_uptime.set(240)\n", "shop2.model.generator.Plant2_G1.min_downtime.set(240)\n", "shop2.model.generator.Plant2_G1.min_downtime_flag.set(pd.Series([0,1],index=[starttime, starttime + pd.Timedelta(hours=12)]))\n", "shop2.model.generator.Plant2_G1.min_uptime_flag.set(pd.Series([0,1],index=[starttime, starttime + pd.Timedelta(hours=12)]))\n" ] }, { "cell_type": "markdown", "id": "d27de13c", "metadata": {}, "source": [ "### Add historical production data\n", "\n", "Historical production data can be given as input for each generator, so that SHOP can automatically find the state of the generator right before the start of the optimization period, and for how long the generator has been in that state. In this example, our generators have previously been turned on for two hours. Note that if the time spent in the initial state before the start of the optimization period is not divisible by the time resolution, it will be rounded up." ] }, { "cell_type": "code", "execution_count": 7, "id": "f529e6ab", "metadata": {}, "outputs": [], "source": [ "historical_production= pd.Series([0,30], index=[starttime - pd.Timedelta(hours=6), starttime - pd.Timedelta(hours=2)])\n", "for gen in shop2.model.generator:\n", " gen.historical_production.set(historical_production)" ] }, { "cell_type": "markdown", "id": "4ae32403", "metadata": {}, "source": [ "### Run SHOP\n", "We run SHOP with our applied constraints" ] }, { "cell_type": "code", "execution_count": 8, "id": "44fee580", "metadata": {}, "outputs": [], "source": [ "run_model(shop2)" ] }, { "cell_type": "markdown", "id": "86eec5ea", "metadata": {}, "source": [ "### Plots and results\n", "\n", "The plot below shows the generator production with our applied constraints on the up- and downtimes. Notice how the historical production data is taken into account, forcing the first generator to remain turned on for the first time step, even though the market price is very low. The second generator, however, is turned off here as no constraints are applied to it for the first twelve hours." ] }, { "cell_type": "code", "execution_count": 9, "id": "f8d2cc6b", "metadata": {}, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "marker": { "color": "rgb(243, 203, 211)" }, "name": "Plant1_G1", "type": "bar", "x": [ "2018-02-27T00:00:00", "2018-02-27T01:00:00", "2018-02-27T02:00:00", "2018-02-27T03:00:00", "2018-02-27T04:00:00", "2018-02-27T05:00:00", "2018-02-27T06:00:00", "2018-02-27T07:00:00", "2018-02-27T08:00:00", "2018-02-27T09:00:00", "2018-02-27T10:00:00", "2018-02-27T11:00:00", "2018-02-27T12:00:00", "2018-02-27T13:00:00", "2018-02-27T14:00:00", "2018-02-27T15:00:00", "2018-02-27T16:00:00", "2018-02-27T17:00:00", "2018-02-27T18:00:00", "2018-02-27T19:00:00", "2018-02-27T20:00:00", "2018-02-27T21:00:00", "2018-02-27T22:00:00", "2018-02-27T23:00:00" ], "y": [ 14.9999640438011, 29.8159729751073, 38.31201744822099, 19.7322887394588, 0.0, 0.0, 0.0, 0.0, 38.85362587867811, 39.85283208231514, 27.454598935213866, 38.600699518451975, 0.0, 0.0, 38.74765133786424, 14.999962603574197, 37.9178935039881, 37.81997484090409, 14.999959620606521, 37.98652647151769, 14.999963678218755, 14.999962892339516, 38.42257691264699, 0.0 ] }, { "marker": { "color": "rgb(234, 169, 189)" }, "name": "Plant2_G1", "type": "bar", "x": [ "2018-02-27T00:00:00", "2018-02-27T01:00:00", "2018-02-27T02:00:00", "2018-02-27T03:00:00", "2018-02-27T04:00:00", "2018-02-27T05:00:00", "2018-02-27T06:00:00", "2018-02-27T07:00:00", "2018-02-27T08:00:00", "2018-02-27T09:00:00", "2018-02-27T10:00:00", "2018-02-27T11:00:00", "2018-02-27T12:00:00", "2018-02-27T13:00:00", "2018-02-27T14:00:00", "2018-02-27T15:00:00", "2018-02-27T16:00:00", "2018-02-27T17:00:00", "2018-02-27T18:00:00", "2018-02-27T19:00:00", "2018-02-27T20:00:00", "2018-02-27T21:00:00", "2018-02-27T22:00:00", "2018-02-27T23:00:00" ], "y": [ 0.0, 28.78249454763289, 30.371118211209033, 24.999597682767302, 0.0, 0.0, 0.0, 0.0, 29.327174881252915, 30.236307085574236, 24.999584232851188, 30.22213227219286, 0.0, 0.0, 0.0, 0.0, 30.977035184296476, 31.7005563082937, 25.000313423985148, 31.886117210461425, 24.99962978420213, 24.999607739442357, 31.058730659921384, 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": "Generator production" }, "xaxis": { "title": { "text": "Time (Hour)" } }, "yaxis": { "title": { "text": "Production (MW)" } } } }, "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "fig = go.Figure()\n", "fig.update_layout(title = f\"Generator production\", xaxis_title=\"Time (Hour)\", yaxis_title=\"Production (MW)\")\n", "colorscale = px.colors.sequential.Magenta\n", "for i, gen in enumerate(shop2.model.generator):\n", " data=gen.production.get()\n", " fig.add_trace(go.Bar(x=data.index, y=data.values, name=gen.get_name(), marker_color=colorscale[i]))\n", "fig.show()" ] }, { "cell_type": "markdown", "id": "701532c1", "metadata": {}, "source": [ "## Minimum up- and downtime on plants\n", "Minimum up- and downtime constraints can also be set on [plant](plant) level with the plant attributes [min_uptime](plant:min_uptime) and [min_downtime](plant:min_downtime). The constraints can be turned on or off for parts of the optimization period using the plant flag variables [min_uptime_flag](plant:min_uptime_flag) and [min_downtime_flag](plant:min_downtime_flag). \n", "\n", "The plant is on if one or more of its pumps and/or generators is on, and the plant is off if all of its pumps and generators are off. Historical data for determining the plant's initial state can be provided through the [historical_production](plant:historical_production) and [historical_consumption](plant:historical_consumption) attributes on plant level. If these are not provided, the corresponding attributes for the plant's generators ([historical_production](generator:historical_production)) and pumps ([historical_consumption](pump:historical_consumption)) will be used. If no historical data is provided, no constraints are applied to the first time step of the optimization.\n", "\n", "We will use a similar model as we did for the generator example, but now with two generators on Plant1 and a pump added to Plant2. Plant1 has minimum up- and downtimes of 3 hours, while Plant2 has minimum up- and downtimes of 2 hours. We apply the minimum up- and downtime constraints for both plants and run the model." ] }, { "cell_type": "code", "execution_count": 10, "id": "fc72ffc6", "metadata": {}, "outputs": [], "source": [ "shop3=ShopSession()\n", "build_model_plant(shop3)\n", "\n", "shop3.model.plant.Plant1.min_downtime.set(3*60)\n", "shop3.model.plant.Plant1.min_uptime.set(3*60)\n", "\n", "shop3.model.plant.Plant2.min_uptime.set(2*60)\n", "shop3.model.plant.Plant2.min_downtime.set(2*60)\n", "\n", "run_model_plant(shop3)\n" ] }, { "cell_type": "markdown", "id": "e68e3174", "metadata": {}, "source": [ "As can be seen, the plants are restricted by their minimum up- and downtimes. The generators and pumps do not have any individual constraints, but together they fulfill the plant restrictions." ] }, { "cell_type": "code", "execution_count": 11, "id": "7d8ede9f", "metadata": {}, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "marker": { "color": "rgb(66,146,198)" }, "name": "Plant1", "type": "bar", "x": [ "2018-02-27T00:00:00", "2018-02-27T01:00:00", "2018-02-27T02:00:00", "2018-02-27T03:00:00", "2018-02-27T04:00:00", "2018-02-27T05:00:00", "2018-02-27T06:00:00", "2018-02-27T07:00:00", "2018-02-27T08:00:00", "2018-02-27T09:00:00", "2018-02-27T10:00:00", "2018-02-27T11:00:00", "2018-02-27T12:00:00", "2018-02-27T13:00:00", "2018-02-27T14:00:00", "2018-02-27T15:00:00", "2018-02-27T16:00:00", "2018-02-27T17:00:00", "2018-02-27T18:00:00", "2018-02-27T19:00:00", "2018-02-27T20:00:00", "2018-02-27T21:00:00", "2018-02-27T22:00:00", "2018-02-27T23:00:00" ], "y": [ 0.0, 37.78249182563703, 38.278150698230185, 29.999850392301084, 9.999963578529615, 37.93569469669039, 57.33023766514161, 50.36531962200912, 39.13145543437294, 39.60704400635857, 38.87995252575884, 38.53235076599199, 38.695543481142764, 38.00719025284401, 37.44309941010676, 9.999952893419467, 37.0617878293157, 37.516342462661, 9.999961605843264, 39.275202339523254, 29.999843269610658, 9.999963003858175, 39.38704210309854, 0.0 ] }, { "marker": { "color": "rgb(202, 105, 157)" }, "name": "Plant2", "type": "bar", "x": [ "2018-02-27T00:00:00", "2018-02-27T01:00:00", "2018-02-27T02:00:00", "2018-02-27T03:00:00", "2018-02-27T04:00:00", "2018-02-27T05:00:00", "2018-02-27T06:00:00", "2018-02-27T07:00:00", "2018-02-27T08:00:00", "2018-02-27T09:00:00", "2018-02-27T10:00:00", "2018-02-27T11:00:00", "2018-02-27T12:00:00", "2018-02-27T13:00:00", "2018-02-27T14:00:00", "2018-02-27T15:00:00", "2018-02-27T16:00:00", "2018-02-27T17:00:00", "2018-02-27T18:00:00", "2018-02-27T19:00:00", "2018-02-27T20:00:00", "2018-02-27T21:00:00", "2018-02-27T22:00:00", "2018-02-27T23:00:00" ], "y": [ 0.0, 14.99976817552876, 30.755995577738513, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 50.067204369775695, 14.999770498368445, 40.1194044589849, 0.0, 0.0, 0.0, 0.0, 32.06343701709753, 50.671754703771704, 9.999986536327556, 50.59116613450338, 0.0, 0.0, 50.335630647878745, 9.99998368920506 ] } ], "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": "Sum of plant production and consumption" }, "xaxis": { "title": { "text": "Time (Hour)" } }, "yaxis": { "title": { "text": "Production/Consumption (MW)" } } } }, "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "marker": { "color": "rgb(107,174,214)" }, "name": "Consumption Plant1_P1", "type": "bar", "x": [ "2018-02-27T00:00:00", "2018-02-27T01:00:00", "2018-02-27T02:00:00", "2018-02-27T03:00:00", "2018-02-27T04:00:00", "2018-02-27T05:00:00", "2018-02-27T06:00:00", "2018-02-27T07:00:00", "2018-02-27T08:00:00", "2018-02-27T09:00:00", "2018-02-27T10:00:00", "2018-02-27T11:00:00", "2018-02-27T12:00:00", "2018-02-27T13:00:00", "2018-02-27T14:00:00", "2018-02-27T15:00:00", "2018-02-27T16:00:00", "2018-02-27T17:00:00", "2018-02-27T18:00:00", "2018-02-27T19:00:00", "2018-02-27T20:00:00", "2018-02-27T21:00:00", "2018-02-27T22:00:00", "2018-02-27T23:00:00" ], "y": [ 0.0, 0.0, 0.0, 0.0, 9.999963578529615, 0.0, 57.33023766514161, 50.36531962200912, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 9.999952893419467, 0.0, 0.0, 9.999961605843264, 0.0, 0.0, 9.999963003858175, 0.0, 0.0 ] }, { "marker": { "color": "rgb(158,202,225)" }, "name": "Production Plant1_G1", "type": "bar", "x": [ "2018-02-27T00:00:00", "2018-02-27T01:00:00", "2018-02-27T02:00:00", "2018-02-27T03:00:00", "2018-02-27T04:00:00", "2018-02-27T05:00:00", "2018-02-27T06:00:00", "2018-02-27T07:00:00", "2018-02-27T08:00:00", "2018-02-27T09:00:00", "2018-02-27T10:00:00", "2018-02-27T11:00:00", "2018-02-27T12:00:00", "2018-02-27T13:00:00", "2018-02-27T14:00:00", "2018-02-27T15:00:00", "2018-02-27T16:00:00", "2018-02-27T17:00:00", "2018-02-27T18:00:00", "2018-02-27T19:00:00", "2018-02-27T20:00:00", "2018-02-27T21:00:00", "2018-02-27T22:00:00", "2018-02-27T23:00:00" ], "y": [ 0.0, 37.78249182563703, 38.278150698230185, 29.999850392301084, 0.0, 37.93569469669039, 0.0, 0.0, 39.13145543437294, 39.60704400635857, 38.87995252575884, 38.53235076599199, 38.695543481142764, 38.00719025284401, 37.44309941010676, 0.0, 37.0617878293157, 37.516342462661, 0.0, 39.275202339523254, 29.999843269610658, 0.0, 39.38704210309854, 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": "Generator production and pump consumption for Plant1" }, "xaxis": { "title": { "text": "Time (Hour)" } }, "yaxis": { "title": { "text": "Production/Consumption (MW)" } } } }, "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "marker": { "color": "rgb(221, 136, 172)" }, "name": "Production Plant2_G1", "type": "bar", "x": [ "2018-02-27T00:00:00", "2018-02-27T01:00:00", "2018-02-27T02:00:00", "2018-02-27T03:00:00", "2018-02-27T04:00:00", "2018-02-27T05:00:00", "2018-02-27T06:00:00", "2018-02-27T07:00:00", "2018-02-27T08:00:00", "2018-02-27T09:00:00", "2018-02-27T10:00:00", "2018-02-27T11:00:00", "2018-02-27T12:00:00", "2018-02-27T13:00:00", "2018-02-27T14:00:00", "2018-02-27T15:00:00", "2018-02-27T16:00:00", "2018-02-27T17:00:00", "2018-02-27T18:00:00", "2018-02-27T19:00:00", "2018-02-27T20:00:00", "2018-02-27T21:00:00", "2018-02-27T22:00:00", "2018-02-27T23:00:00" ], "y": [ 0.0, 14.99976817552876, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 25.033602184887847, 14.999770498368445, 14.999778419516264, 0.0, 0.0, 0.0, 0.0, 32.06343701709753, 26.694108379081634, 0.0, 25.29558306725169, 0.0, 0.0, 25.167815323939372, 0.0 ] }, { "marker": { "color": "rgb(243, 203, 211)" }, "name": "Production Plant2_G2", "type": "bar", "x": [ "2018-02-27T00:00:00", "2018-02-27T01:00:00", "2018-02-27T02:00:00", "2018-02-27T03:00:00", "2018-02-27T04:00:00", "2018-02-27T05:00:00", "2018-02-27T06:00:00", "2018-02-27T07:00:00", "2018-02-27T08:00:00", "2018-02-27T09:00:00", "2018-02-27T10:00:00", "2018-02-27T11:00:00", "2018-02-27T12:00:00", "2018-02-27T13:00:00", "2018-02-27T14:00:00", "2018-02-27T15:00:00", "2018-02-27T16:00:00", "2018-02-27T17:00:00", "2018-02-27T18:00:00", "2018-02-27T19:00:00", "2018-02-27T20:00:00", "2018-02-27T21:00:00", "2018-02-27T22:00:00", "2018-02-27T23:00:00" ], "y": [ 0.0, 0.0, 30.755995577738513, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 25.033602184887847, 0.0, 25.119626039468642, 0.0, 0.0, 0.0, 0.0, 0.0, 23.97764632469007, 9.999986536327556, 25.29558306725169, 0.0, 0.0, 25.167815323939372, 9.99998368920506 ] } ], "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": "Generator production for Plant2" }, "xaxis": { "title": { "text": "Time (Hour)" } }, "yaxis": { "title": { "text": "Production/Consumption (MW)" } } } }, "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "color_arr=[px.colors.sequential.Blues, px.colors.sequential.Magenta]\n", "mi = 5\n", "\n", "fig = go.Figure()\n", "fig.update_layout(title = f\"Sum of plant production and consumption\", xaxis_title=\"Time (Hour)\", yaxis_title=\"Production/Consumption (MW)\")\n", "for i, plant in enumerate(shop3.model.plant):\n", " data=plant.production.get() + plant.consumption.get()\n", " fig.add_trace(go.Bar(x=data.index, y=data.values, name=plant.get_name(), marker_color=color_arr[i][mi-2*i]))\n", "fig.show()\n", "\n", "fig = go.Figure()\n", "plant = shop3.model.plant.Plant1\n", "fig.update_layout(title = f\"Generator production and pump consumption for {plant.get_name()}\", xaxis_title=\"Time (Hour)\", yaxis_title=\"Production/Consumption (MW)\")\n", "pump = shop3.model.pump.Plant1_P1\n", "cons = pump.consumption.get()\n", "fig.add_trace(go.Bar(x=cons.index, y=cons.values, name=\"Consumption \"+pump.get_name(), marker_color=color_arr[0][mi-1]))\n", "gen = shop3.model.generator.Plant1_G1\n", "prod = gen.production.get()\n", "fig.add_trace(go.Bar(x=prod.index, y=prod.values, name=\"Production \"+gen.get_name(), marker_color=color_arr[0][mi-2]))\n", "fig.show()\n", "\n", "fig = go.Figure()\n", "plant = shop3.model.plant.Plant2\n", "fig.update_layout(title = f\"Generator production for {plant.get_name()}\", xaxis_title=\"Time (Hour)\", yaxis_title=\"Production/Consumption (MW)\")\n", "for i, gen in enumerate(shop3.model.plant.Plant2.generators):\n", " prod=gen.production.get()\n", " fig.add_trace(go.Bar(x=prod.index, y=prod.values, name=\"Production \"+gen.get_name(), marker_color=color_arr[1][mi-3-2*i]))\n", "fig.show()\n" ] } ], "metadata": { "jupytext": { "text_representation": { "extension": ".md", "format_name": "myst", "format_version": 0.13, "jupytext_version": "1.15.2" } }, "kernelspec": { "display_name": "Python 3", "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.9" }, "source_map": [ 12, 34, 38, 49, 54, 61, 67, 86, 91, 94, 100, 109, 117, 130, 136, 141, 146, 149, 155, 163, 172, 184, 187 ] }, "nbformat": 4, "nbformat_minor": 5 }