{ "cells": [ { "cell_type": "markdown", "id": "8fd1ab0e", "metadata": {}, "source": [ "(battery-wind-solar)=\n", "# Battery, solar and wind\n", "This example shows how [batteries](battery) can be modelled in SHOP to smooth variations for [](solar) or [](wind) to meet a firm demand. We define the optimization horizon over 24 hours with 15 minutes time resolution:" ] }, { "cell_type": "code", "execution_count": 1, "id": "a6ad27fc", "metadata": { "Collapsed": "false" }, "outputs": [], "source": [ "from pyshop import ShopSession\n", "import pandas as pd\n", "import numpy as np\n", "import plotly.graph_objs as go\n", "\n", "shop = ShopSession()\n", "starttime = pd.Timestamp('2019-05-16T00:00:00')\n", "endtime = pd.Timestamp('2019-05-17T00:00:00')\n", "shop.set_time_resolution(starttime=starttime, endtime=endtime, timeunit=\"minute\", timeresolution=pd.Series(index=[starttime],data=[15]))" ] }, { "cell_type": "markdown", "id": "3ef34588", "metadata": {}, "source": [ "We create a battery with 90% charge and discharge efficiency. The battery size is 4 MWh with 0.5 MW as the maximum charge and discharge capacity. The initial state-of-charge is 2 MWh and end state-of-charge must be greater than or equal to the initial." ] }, { "cell_type": "code", "execution_count": 2, "id": "8709d5a6", "metadata": { "Collapsed": "false" }, "outputs": [], "source": [ "battery = shop.model.battery.add_object('Battery')\n", "battery.charge_efficiency.set(0.9)\n", "battery.discharge_efficiency.set(0.9)\n", "battery.max_charge_power.set(0.5)\n", "battery.max_discharge_power.set(0.5)\n", "battery.max_energy.set(4.0)\n", "battery.initial_energy.set(2)\n", "\n", "init_value = battery.initial_energy.get()\n", "battery.min_energy_constraint.set(pd.Series(index=[starttime, endtime - pd.Timedelta(hours=1)], data=[np.nan, init_value]))" ] }, { "cell_type": "markdown", "id": "d24c9ccb", "metadata": {}, "source": [ "We also create a solar power source with a typical profile acquired from [renewables.ninja](https://www.renewables.ninja/):" ] }, { "cell_type": "code", "execution_count": 3, "id": "a418d124", "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": [ { "name": "Solar power production", "type": "scatter", "x": [ "2019-05-16T00:00:00", "2019-05-16T01:00:00", "2019-05-16T02:00:00", "2019-05-16T03:00:00", "2019-05-16T04:00:00", "2019-05-16T05:00:00", "2019-05-16T06:00:00", "2019-05-16T07:00:00", "2019-05-16T08:00:00", "2019-05-16T09:00:00", "2019-05-16T10:00:00", "2019-05-16T11:00:00", "2019-05-16T12:00:00", "2019-05-16T13:00:00", "2019-05-16T14:00:00", "2019-05-16T15:00:00", "2019-05-16T16:00:00", "2019-05-16T17:00:00", "2019-05-16T18:00:00", "2019-05-16T19:00:00", "2019-05-16T20:00:00", "2019-05-16T21:00:00", "2019-05-16T22:00:00", "2019-05-16T23:00:00", "2019-05-17T00:00:00" ], "y": [ 0.0, 0.0, 0.0, 0.0288, 0.08800000000000001, 0.22080000000000002, 0.43200000000000005, 0.6944, 0.9168, 1.0832000000000002, 1.1664, 1.2000000000000002, 1.0976000000000001, 0.9168, 0.7616, 0.5808, 0.3792, 0.17120000000000002, 0.062400000000000004, 0.019200000000000002, 0.0, 0.0, 0.0, 0.0, 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 } } }, "xaxis": { "title": { "text": "Time" } }, "yaxis": { "title": { "text": "Power" } } } }, "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "solar_profile = pd.read_csv('solar_profile.csv', header=3).set_index('time')\n", "solar_profile.index = pd.to_datetime(solar_profile.index)\n", "solar_profile = solar_profile[starttime:endtime]['electricity'] * 1.6\n", "solar = shop.model.solar.add_object('Solar')\n", "solar.power_forecast.set(solar_profile)\n", "\n", "fig = go.Figure()\n", "fig.add_trace(go.Scatter(x=solar_profile.index, y=solar_profile.values, name=\"Solar power production\"))\n", "fig.update_layout(xaxis_title=\"Time\", yaxis_title=\"Power\")\n", "fig.show()" ] }, { "cell_type": "markdown", "id": "6d0e9eab", "metadata": {}, "source": [ "Finally, we create a [](market) where we can buy energy (but not sell) and a [](busbar) where the load is set and all components are connected:" ] }, { "cell_type": "code", "execution_count": 4, "id": "ab864f99", "metadata": { "Collapsed": "false", "tags": [ "remove-output" ] }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/tmp/ipykernel_505/3388311290.py:4: FutureWarning:\n", "\n", "'H' is deprecated and will be removed in a future version, please use 'h' instead.\n", "\n" ] } ], "source": [ "market = shop.model.market.add_object('Market')\n", "market.max_buy.set(1)\n", "market.max_sale.set(0)\n", "price = pd.Series(index=pd.date_range(starttime, endtime, freq='6H'), data=[10,20,15,5,5])\n", "market.buy_price.set(price)\n", "# market.max_sale.set(1)\n", "# market.sale_price.set(price - 0.01)\n", "\n", "busbar = shop.model.busbar.add_object('Busbar')\n", "busbar.connect_to(battery)\n", "busbar.connect_to(solar)\n", "busbar.connect_to(market)\n", "busbar.load.set(0.35)\n", "\n", "shop.start_sim([], [1])" ] }, { "cell_type": "markdown", "id": "bec8c4a3", "metadata": {}, "source": [ "Since the battery model is linear, we only need one iteration.\n", "\n", "## Results\n", "We can investigate how the battery is used to maximize the utilization of solar power, where the marginal operating cost is zero. The first figure below shows how the battery energy level evolves over the optimization horizon, while the second figure shows the power output of the three sources - solar, battery and market purchase." ] }, { "cell_type": "code", "execution_count": 5, "id": "9ea9a184", "metadata": { "Collapsed": "false" }, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "name": "Battery energy", "type": "scatter", "x": [ "2019-05-16T00:00:00", "2019-05-16T00:15:00", "2019-05-16T00:30:00", "2019-05-16T00:45:00", "2019-05-16T01:00:00", "2019-05-16T01:15:00", "2019-05-16T01:30:00", "2019-05-16T01:45:00", "2019-05-16T02:00:00", "2019-05-16T02:15:00", "2019-05-16T02:30:00", "2019-05-16T02:45:00", "2019-05-16T03:00:00", "2019-05-16T03:15:00", "2019-05-16T03:30:00", "2019-05-16T03:45:00", "2019-05-16T04:00:00", "2019-05-16T04:15:00", "2019-05-16T04:30:00", "2019-05-16T04:45:00", "2019-05-16T05:00:00", "2019-05-16T05:15:00", "2019-05-16T05:30:00", "2019-05-16T05:45:00", "2019-05-16T06:00:00", "2019-05-16T06:15:00", "2019-05-16T06:30:00", "2019-05-16T06:45:00", "2019-05-16T07:00:00", "2019-05-16T07:15:00", "2019-05-16T07:30:00", "2019-05-16T07:45:00", "2019-05-16T08:00:00", "2019-05-16T08:15:00", "2019-05-16T08:30:00", "2019-05-16T08:45:00", "2019-05-16T09:00:00", "2019-05-16T09:15:00", "2019-05-16T09:30:00", "2019-05-16T09:45:00", "2019-05-16T10:00:00", "2019-05-16T10:15:00", "2019-05-16T10:30:00", "2019-05-16T10:45:00", "2019-05-16T11:00:00", "2019-05-16T11:15:00", "2019-05-16T11:30:00", "2019-05-16T11:45:00", "2019-05-16T12:00:00", "2019-05-16T12:15:00", "2019-05-16T12:30:00", "2019-05-16T12:45:00", "2019-05-16T13:00:00", "2019-05-16T13:15:00", "2019-05-16T13:30:00", "2019-05-16T13:45:00", "2019-05-16T14:00:00", "2019-05-16T14:15:00", "2019-05-16T14:30:00", "2019-05-16T14:45:00", "2019-05-16T15:00:00", "2019-05-16T15:15:00", "2019-05-16T15:30:00", "2019-05-16T15:45:00", "2019-05-16T16:00:00", "2019-05-16T16:15:00", "2019-05-16T16:30:00", "2019-05-16T16:45:00", "2019-05-16T17:00:00", "2019-05-16T17:15:00", "2019-05-16T17:30:00", "2019-05-16T17:45:00", "2019-05-16T18:00:00", "2019-05-16T18:15:00", "2019-05-16T18:30:00", "2019-05-16T18:45:00", "2019-05-16T19:00:00", "2019-05-16T19:15:00", "2019-05-16T19:30:00", "2019-05-16T19:45:00", "2019-05-16T20:00:00", "2019-05-16T20:15:00", "2019-05-16T20:30:00", "2019-05-16T20:45:00", "2019-05-16T21:00:00", "2019-05-16T21:15:00", "2019-05-16T21:30:00", "2019-05-16T21:45:00", "2019-05-16T22:00:00", "2019-05-16T22:15:00", "2019-05-16T22:30:00", "2019-05-16T22:45:00", "2019-05-16T23:00:00", "2019-05-16T23:15:00", "2019-05-16T23:30:00", "2019-05-16T23:45:00", "2019-05-17T00:00:00" ], "y": [ 2.0, 1.9027777777777777, 1.8055555555555554, 1.708333333333333, 1.6111111111111107, 1.5138888888888884, 1.416666666666666, 1.3194444444444438, 1.2222222222222214, 1.1249999999999991, 1.0277777777777768, 0.9305555555555546, 0.8333333333333324, 0.7441111111111102, 0.654888888888888, 0.5656666666666658, 0.47644444444444356, 0.4036666666666658, 0.330888888888888, 0.25811111111111024, 0.18533333333333246, 0.14944444444444357, 0.11355555555555469, 0.0776666666666658, 0.04177777777777692, 0.060227777777776936, 0.07867777777777696, 0.09712777777777698, 0.115577777777777, 0.193067777777777, 0.270557777777777, 0.348047777777777, 0.425537777777777, 0.5380377777777771, 0.6505377777777771, 0.7630377777777771, 0.8755377777777772, 0.9880377777777772, 1.1005377777777772, 1.2130377777777772, 1.3255377777777773, 1.4380377777777773, 1.5505377777777773, 1.6630377777777774, 1.7755377777777774, 1.8880377777777775, 2.0005377777777773, 2.113037777777777, 2.225537777777777, 2.3380377777777768, 2.4505377777777766, 2.5630377777777764, 2.6755377777777762, 2.788037777777776, 2.900537777777776, 3.0130377777777757, 3.1255377777777755, 3.2181477777777756, 3.3107577777777757, 3.4033677777777758, 3.495977777777776, 3.547907777777776, 3.599837777777776, 3.651767777777776, 3.703697777777776, 3.710267777777776, 3.716837777777776, 3.723407777777776, 3.729977777777776, 3.6803111111111093, 3.630644444444443, 3.5809777777777763, 3.5313111111111097, 3.451422222222221, 3.442333333333334, 3.442333333333334, 3.442333333333334, 3.3504444444444452, 3.3504444444444452, 3.2585555555555565, 3.166666666666668, 3.166666666666668, 3.166666666666668, 3.0694444444444455, 2.972222222222223, 2.875000000000001, 2.7777777777777786, 2.6805555555555562, 2.583333333333334, 2.4861111111111116, 2.3888888888888893, 2.291666666666667, 2.1944444444444446, 2.0972222222222223, 2.0972222222222223, 2.0972222222222223, 2.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": "Battery energy balance" }, "xaxis": { "title": { "text": "Time" } }, "yaxis": { "title": { "text": "Energy" } } } }, "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "battery_energy = battery.energy.get()\n", "fig = go.Figure()\n", "fig.add_trace(go.Scatter(x=battery_energy.index, y=battery_energy.values, name=\"Battery energy\"))\n", "fig.update_layout(xaxis_title=\"Time\", yaxis_title=\"Energy\", title=\"Battery energy balance\")\n", "fig.show()" ] }, { "cell_type": "code", "execution_count": 6, "id": "3f7f36d5", "metadata": { "Collapsed": "false" }, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "name": "Market purchase", "type": "scatter", "x": [ "2019-05-16T00:00:00", "2019-05-16T00:15:00", "2019-05-16T00:30:00", "2019-05-16T00:45:00", "2019-05-16T01:00:00", "2019-05-16T01:15:00", "2019-05-16T01:30:00", "2019-05-16T01:45:00", "2019-05-16T02:00:00", "2019-05-16T02:15:00", "2019-05-16T02:30:00", "2019-05-16T02:45:00", "2019-05-16T03:00:00", "2019-05-16T03:15:00", "2019-05-16T03:30:00", "2019-05-16T03:45:00", "2019-05-16T04:00:00", "2019-05-16T04:15:00", "2019-05-16T04:30:00", "2019-05-16T04:45:00", "2019-05-16T05:00:00", "2019-05-16T05:15:00", "2019-05-16T05:30:00", "2019-05-16T05:45:00", "2019-05-16T06:00:00", "2019-05-16T06:15:00", "2019-05-16T06:30:00", "2019-05-16T06:45:00", "2019-05-16T07:00:00", "2019-05-16T07:15:00", "2019-05-16T07:30:00", "2019-05-16T07:45:00", "2019-05-16T08:00:00", "2019-05-16T08:15:00", "2019-05-16T08:30:00", "2019-05-16T08:45:00", "2019-05-16T09:00:00", "2019-05-16T09:15:00", "2019-05-16T09:30:00", "2019-05-16T09:45:00", "2019-05-16T10:00:00", "2019-05-16T10:15:00", "2019-05-16T10:30:00", "2019-05-16T10:45:00", "2019-05-16T11:00:00", "2019-05-16T11:15:00", "2019-05-16T11:30:00", "2019-05-16T11:45:00", "2019-05-16T12:00:00", "2019-05-16T12:15:00", "2019-05-16T12:30:00", "2019-05-16T12:45:00", "2019-05-16T13:00:00", "2019-05-16T13:15:00", "2019-05-16T13:30:00", "2019-05-16T13:45:00", "2019-05-16T14:00:00", "2019-05-16T14:15:00", "2019-05-16T14:30:00", "2019-05-16T14:45:00", "2019-05-16T15:00:00", "2019-05-16T15:15:00", "2019-05-16T15:30:00", "2019-05-16T15:45:00", "2019-05-16T16:00:00", "2019-05-16T16:15:00", "2019-05-16T16:30:00", "2019-05-16T16:45:00", "2019-05-16T17:00:00", "2019-05-16T17:15:00", "2019-05-16T17:30:00", "2019-05-16T17:45:00", "2019-05-16T18:00:00", "2019-05-16T18:15:00", "2019-05-16T18:30:00", "2019-05-16T18:45:00", "2019-05-16T19:00:00", "2019-05-16T19:15:00", "2019-05-16T19:30:00", "2019-05-16T19:45:00", "2019-05-16T20:00:00", "2019-05-16T20:15:00", "2019-05-16T20:30:00", "2019-05-16T20:45:00", "2019-05-16T21:00:00", "2019-05-16T21:15:00", "2019-05-16T21:30:00", "2019-05-16T21:45:00", "2019-05-16T22:00:00", "2019-05-16T22:15:00", "2019-05-16T22:30:00", "2019-05-16T22:45:00", "2019-05-16T23:00:00", "2019-05-16T23:15:00", "2019-05-16T23:30:00", "2019-05-16T23:45:00" ], "y": [ 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, 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.2548800000000059, 0.28759999999999997, 0.28759999999999997, 0.0, 0.3308, 0.0, 0.0, 0.35, 0.35, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.35, 0.35, 0.0 ] }, { "name": "Battery discharge", "type": "scatter", "x": [ "2019-05-16T00:00:00", "2019-05-16T00:15:00", "2019-05-16T00:30:00", "2019-05-16T00:45:00", "2019-05-16T01:00:00", "2019-05-16T01:15:00", "2019-05-16T01:30:00", "2019-05-16T01:45:00", "2019-05-16T02:00:00", "2019-05-16T02:15:00", "2019-05-16T02:30:00", "2019-05-16T02:45:00", "2019-05-16T03:00:00", "2019-05-16T03:15:00", "2019-05-16T03:30:00", "2019-05-16T03:45:00", "2019-05-16T04:00:00", "2019-05-16T04:15:00", "2019-05-16T04:30:00", "2019-05-16T04:45:00", "2019-05-16T05:00:00", "2019-05-16T05:15:00", "2019-05-16T05:30:00", "2019-05-16T05:45:00", "2019-05-16T06:00:00", "2019-05-16T06:15:00", "2019-05-16T06:30:00", "2019-05-16T06:45:00", "2019-05-16T07:00:00", "2019-05-16T07:15:00", "2019-05-16T07:30:00", "2019-05-16T07:45:00", "2019-05-16T08:00:00", "2019-05-16T08:15:00", "2019-05-16T08:30:00", "2019-05-16T08:45:00", "2019-05-16T09:00:00", "2019-05-16T09:15:00", "2019-05-16T09:30:00", "2019-05-16T09:45:00", "2019-05-16T10:00:00", "2019-05-16T10:15:00", "2019-05-16T10:30:00", "2019-05-16T10:45:00", "2019-05-16T11:00:00", "2019-05-16T11:15:00", "2019-05-16T11:30:00", "2019-05-16T11:45:00", "2019-05-16T12:00:00", "2019-05-16T12:15:00", "2019-05-16T12:30:00", "2019-05-16T12:45:00", "2019-05-16T13:00:00", "2019-05-16T13:15:00", "2019-05-16T13:30:00", "2019-05-16T13:45:00", "2019-05-16T14:00:00", "2019-05-16T14:15:00", "2019-05-16T14:30:00", "2019-05-16T14:45:00", "2019-05-16T15:00:00", "2019-05-16T15:15:00", "2019-05-16T15:30:00", "2019-05-16T15:45:00", "2019-05-16T16:00:00", "2019-05-16T16:15:00", "2019-05-16T16:30:00", "2019-05-16T16:45:00", "2019-05-16T17:00:00", "2019-05-16T17:15:00", "2019-05-16T17:30:00", "2019-05-16T17:45:00", "2019-05-16T18:00:00", "2019-05-16T18:15:00", "2019-05-16T18:30:00", "2019-05-16T18:45:00", "2019-05-16T19:00:00", "2019-05-16T19:15:00", "2019-05-16T19:30:00", "2019-05-16T19:45:00", "2019-05-16T20:00:00", "2019-05-16T20:15:00", "2019-05-16T20:30:00", "2019-05-16T20:45:00", "2019-05-16T21:00:00", "2019-05-16T21:15:00", "2019-05-16T21:30:00", "2019-05-16T21:45:00", "2019-05-16T22:00:00", "2019-05-16T22:15:00", "2019-05-16T22:30:00", "2019-05-16T22:45:00", "2019-05-16T23:00:00", "2019-05-16T23:15:00", "2019-05-16T23:30:00", "2019-05-16T23:45:00" ], "y": [ 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.3212, 0.3212, 0.3212, 0.3212, 0.26199999999999996, 0.26199999999999996, 0.26199999999999996, 0.26199999999999996, 0.12919999999999995, 0.12919999999999995, 0.12919999999999995, 0.12919999999999995, -0.08200000000000007, -0.08200000000000007, -0.08200000000000007, -0.08200000000000007, -0.34440000000000004, -0.34440000000000004, -0.34440000000000004, -0.34440000000000004, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.4116000000000001, -0.4116000000000001, -0.4116000000000001, -0.4116000000000001, -0.2308, -0.2308, -0.2308, -0.2308, -0.029200000000000004, -0.029200000000000004, -0.029200000000000004, -0.029200000000000004, 0.17879999999999996, 0.17879999999999996, 0.17879999999999996, 0.17879999999999996, 0.28759999999999997, 0.03271999999999409, 0.0, 0.0, 0.3308, 0.0, 0.3308, 0.3308, 0.0, 0.0, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.0, 0.0, 0.35 ] }, { "name": "Solar power", "type": "scatter", "x": [ "2019-05-16T00:00:00", "2019-05-16T01:00:00", "2019-05-16T02:00:00", "2019-05-16T03:00:00", "2019-05-16T04:00:00", "2019-05-16T05:00:00", "2019-05-16T06:00:00", "2019-05-16T07:00:00", "2019-05-16T08:00:00", "2019-05-16T09:00:00", "2019-05-16T10:00:00", "2019-05-16T11:00:00", "2019-05-16T12:00:00", "2019-05-16T13:00:00", "2019-05-16T14:00:00", "2019-05-16T15:00:00", "2019-05-16T16:00:00", "2019-05-16T17:00:00", "2019-05-16T18:00:00", "2019-05-16T19:00:00", "2019-05-16T20:00:00", "2019-05-16T21:00:00", "2019-05-16T22:00:00", "2019-05-16T23:00:00", "2019-05-17T00:00:00" ], "y": [ 0.0, 0.0, 0.0, 0.0288, 0.08800000000000001, 0.22080000000000002, 0.43200000000000005, 0.6944, 0.9168, 1.0832000000000002, 1.1664, 1.2000000000000002, 1.0976000000000001, 0.9168, 0.7616, 0.5808, 0.3792, 0.17120000000000002, 0.062400000000000004, 0.019200000000000002, 0.0, 0.0, 0.0, 0.0, 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": "Power delivered" }, "xaxis": { "title": { "text": "Time" } }, "yaxis": { "title": { "text": "Power" } } } }, "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "net_discharge = battery.net_power_discharge.get()\n", "buy = market.buy.get()\n", "fig = go.Figure()\n", "fig.add_trace(go.Scatter(x=buy.index, y=buy.values, name=\"Market purchase\"))\n", "fig.add_trace(go.Scatter(x=net_discharge.index, y=net_discharge.values, name=\"Battery discharge\"))\n", "fig.add_trace(go.Scatter(x=solar_profile.index, y=solar_profile.values, name=\"Solar power\"))\n", "fig.update_layout(xaxis_title=\"Time\", yaxis_title=\"Power\", title=\"Power delivered\")\n", "fig.show()" ] }, { "cell_type": "markdown", "id": "9a953dad", "metadata": {}, "source": [ "The battery trajectory shows how stored energy is used initially to minimize power purchase during the night, while the battery is charged during the day. Some purchase is required in the evening to reach the initial level.\n", "\n", "We can also study the dual values to investigate the locational marginal price and the value of stored energy in this system." ] }, { "cell_type": "code", "execution_count": 7, "id": "29914fa2", "metadata": { "Collapsed": "false" }, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "name": "Storage energy value", "type": "scatter", "x": [ "2019-05-16T00:00:00", "2019-05-16T00:15:00", "2019-05-16T00:30:00", "2019-05-16T00:45:00", "2019-05-16T01:00:00", "2019-05-16T01:15:00", "2019-05-16T01:30:00", "2019-05-16T01:45:00", "2019-05-16T02:00:00", "2019-05-16T02:15:00", "2019-05-16T02:30:00", "2019-05-16T02:45:00", "2019-05-16T03:00:00", "2019-05-16T03:15:00", "2019-05-16T03:30:00", "2019-05-16T03:45:00", "2019-05-16T04:00:00", "2019-05-16T04:15:00", "2019-05-16T04:30:00", "2019-05-16T04:45:00", "2019-05-16T05:00:00", "2019-05-16T05:15:00", "2019-05-16T05:30:00", "2019-05-16T05:45:00", "2019-05-16T06:00:00", "2019-05-16T06:15:00", "2019-05-16T06:30:00", "2019-05-16T06:45:00", "2019-05-16T07:00:00", "2019-05-16T07:15:00", "2019-05-16T07:30:00", "2019-05-16T07:45:00", "2019-05-16T08:00:00", "2019-05-16T08:15:00", "2019-05-16T08:30:00", "2019-05-16T08:45:00", "2019-05-16T09:00:00", "2019-05-16T09:15:00", "2019-05-16T09:30:00", "2019-05-16T09:45:00", "2019-05-16T10:00:00", "2019-05-16T10:15:00", "2019-05-16T10:30:00", "2019-05-16T10:45:00", "2019-05-16T11:00:00", "2019-05-16T11:15:00", "2019-05-16T11:30:00", "2019-05-16T11:45:00", "2019-05-16T12:00:00", "2019-05-16T12:15:00", "2019-05-16T12:30:00", "2019-05-16T12:45:00", "2019-05-16T13:00:00", "2019-05-16T13:15:00", "2019-05-16T13:30:00", "2019-05-16T13:45:00", "2019-05-16T14:00:00", "2019-05-16T14:15:00", "2019-05-16T14:30:00", "2019-05-16T14:45:00", "2019-05-16T15:00:00", "2019-05-16T15:15:00", "2019-05-16T15:30:00", "2019-05-16T15:45:00", "2019-05-16T16:00:00", "2019-05-16T16:15:00", "2019-05-16T16:30:00", "2019-05-16T16:45:00", "2019-05-16T17:00:00", "2019-05-16T17:15:00", "2019-05-16T17:30:00", "2019-05-16T17:45:00", "2019-05-16T18:00:00", "2019-05-16T18:15:00", "2019-05-16T18:30:00", "2019-05-16T18:45:00", "2019-05-16T19:00:00", "2019-05-16T19:15:00", "2019-05-16T19:30:00", "2019-05-16T19:45:00", "2019-05-16T20:00:00", "2019-05-16T20:15:00", "2019-05-16T20:30:00", "2019-05-16T20:45:00", "2019-05-16T21:00:00", "2019-05-16T21:15:00", "2019-05-16T21:30:00", "2019-05-16T21:45:00", "2019-05-16T22:00:00", "2019-05-16T22:15:00", "2019-05-16T22:30:00", "2019-05-16T22:45:00", "2019-05-16T23:00:00", "2019-05-16T23:15:00", "2019-05-16T23:30:00", "2019-05-16T23:45:00" ], "y": [ 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5 ] }, { "name": "Busbar energy price", "type": "scatter", "x": [ "2019-05-16T00:00:00", "2019-05-16T00:15:00", "2019-05-16T00:30:00", "2019-05-16T00:45:00", "2019-05-16T01:00:00", "2019-05-16T01:15:00", "2019-05-16T01:30:00", "2019-05-16T01:45:00", "2019-05-16T02:00:00", "2019-05-16T02:15:00", "2019-05-16T02:30:00", "2019-05-16T02:45:00", "2019-05-16T03:00:00", "2019-05-16T03:15:00", "2019-05-16T03:30:00", "2019-05-16T03:45:00", "2019-05-16T04:00:00", "2019-05-16T04:15:00", "2019-05-16T04:30:00", "2019-05-16T04:45:00", "2019-05-16T05:00:00", "2019-05-16T05:15:00", "2019-05-16T05:30:00", "2019-05-16T05:45:00", "2019-05-16T06:00:00", "2019-05-16T06:15:00", "2019-05-16T06:30:00", "2019-05-16T06:45:00", "2019-05-16T07:00:00", "2019-05-16T07:15:00", "2019-05-16T07:30:00", "2019-05-16T07:45:00", "2019-05-16T08:00:00", "2019-05-16T08:15:00", "2019-05-16T08:30:00", "2019-05-16T08:45:00", "2019-05-16T09:00:00", "2019-05-16T09:15:00", "2019-05-16T09:30:00", "2019-05-16T09:45:00", "2019-05-16T10:00:00", "2019-05-16T10:15:00", "2019-05-16T10:30:00", "2019-05-16T10:45:00", "2019-05-16T11:00:00", "2019-05-16T11:15:00", "2019-05-16T11:30:00", "2019-05-16T11:45:00", "2019-05-16T12:00:00", "2019-05-16T12:15:00", "2019-05-16T12:30:00", "2019-05-16T12:45:00", "2019-05-16T13:00:00", "2019-05-16T13:15:00", "2019-05-16T13:30:00", "2019-05-16T13:45:00", "2019-05-16T14:00:00", "2019-05-16T14:15:00", "2019-05-16T14:30:00", "2019-05-16T14:45:00", "2019-05-16T15:00:00", "2019-05-16T15:15:00", "2019-05-16T15:30:00", "2019-05-16T15:45:00", "2019-05-16T16:00:00", "2019-05-16T16:15:00", "2019-05-16T16:30:00", "2019-05-16T16:45:00", "2019-05-16T17:00:00", "2019-05-16T17:15:00", "2019-05-16T17:30:00", "2019-05-16T17:45:00", "2019-05-16T18:00:00", "2019-05-16T18:15:00", "2019-05-16T18:30:00", "2019-05-16T18:45:00", "2019-05-16T19:00:00", "2019-05-16T19:15:00", "2019-05-16T19:30:00", "2019-05-16T19:45:00", "2019-05-16T20:00:00", "2019-05-16T20:15:00", "2019-05-16T20:30:00", "2019-05-16T20:45:00", "2019-05-16T21:00:00", "2019-05-16T21:15:00", "2019-05-16T21:30:00", "2019-05-16T21:45:00", "2019-05-16T22:00:00", "2019-05-16T22:15:00", "2019-05-16T22:30:00", "2019-05-16T22:45:00", "2019-05-16T23:00:00", "2019-05-16T23:15:00", "2019-05-16T23:30:00", "2019-05-16T23:45:00" ], "y": [ 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 4.05, 4.05, 4.05, 4.05, 4.05, 4.05, 4.05, 4.05, 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, 4.05, 4.05, 4.05, 4.05, 4.05, 4.05, 4.05, 4.05, 4.05, 4.05, 4.05, 4.05, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0 ] }, { "name": "Market energy price", "type": "scatter", "x": [ "2019-05-16T00:00:00", "2019-05-16T00:15:00", "2019-05-16T00:30:00", "2019-05-16T00:45:00", "2019-05-16T01:00:00", "2019-05-16T01:15:00", "2019-05-16T01:30:00", "2019-05-16T01:45:00", "2019-05-16T02:00:00", "2019-05-16T02:15:00", "2019-05-16T02:30:00", "2019-05-16T02:45:00", "2019-05-16T03:00:00", "2019-05-16T03:15:00", "2019-05-16T03:30:00", "2019-05-16T03:45:00", "2019-05-16T04:00:00", "2019-05-16T04:15:00", "2019-05-16T04:30:00", "2019-05-16T04:45:00", "2019-05-16T05:00:00", "2019-05-16T05:15:00", "2019-05-16T05:30:00", "2019-05-16T05:45:00", "2019-05-16T06:00:00", "2019-05-16T06:15:00", "2019-05-16T06:30:00", "2019-05-16T06:45:00", "2019-05-16T07:00:00", "2019-05-16T07:15:00", "2019-05-16T07:30:00", "2019-05-16T07:45:00", "2019-05-16T08:00:00", "2019-05-16T08:15:00", "2019-05-16T08:30:00", "2019-05-16T08:45:00", "2019-05-16T09:00:00", "2019-05-16T09:15:00", "2019-05-16T09:30:00", "2019-05-16T09:45:00", "2019-05-16T10:00:00", "2019-05-16T10:15:00", "2019-05-16T10:30:00", "2019-05-16T10:45:00", "2019-05-16T11:00:00", "2019-05-16T11:15:00", "2019-05-16T11:30:00", "2019-05-16T11:45:00", "2019-05-16T12:00:00", "2019-05-16T12:15:00", "2019-05-16T12:30:00", "2019-05-16T12:45:00", "2019-05-16T13:00:00", "2019-05-16T13:15:00", "2019-05-16T13:30:00", "2019-05-16T13:45:00", "2019-05-16T14:00:00", "2019-05-16T14:15:00", "2019-05-16T14:30:00", "2019-05-16T14:45:00", "2019-05-16T15:00:00", "2019-05-16T15:15:00", "2019-05-16T15:30:00", "2019-05-16T15:45:00", "2019-05-16T16:00:00", "2019-05-16T16:15:00", "2019-05-16T16:30:00", "2019-05-16T16:45:00", "2019-05-16T17:00:00", "2019-05-16T17:15:00", "2019-05-16T17:30:00", "2019-05-16T17:45:00", "2019-05-16T18:00:00", "2019-05-16T18:15:00", "2019-05-16T18:30:00", "2019-05-16T18:45:00", "2019-05-16T19:00:00", "2019-05-16T19:15:00", "2019-05-16T19:30:00", "2019-05-16T19:45:00", "2019-05-16T20:00:00", "2019-05-16T20:15:00", "2019-05-16T20:30:00", "2019-05-16T20:45:00", "2019-05-16T21:00:00", "2019-05-16T21:15:00", "2019-05-16T21:30:00", "2019-05-16T21:45:00", "2019-05-16T22:00:00", "2019-05-16T22:15:00", "2019-05-16T22:30:00", "2019-05-16T22:45:00", "2019-05-16T23:00:00", "2019-05-16T23:15:00", "2019-05-16T23:30:00", "2019-05-16T23:45: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, 20.0, 20.0, 20.0, 20.0, 20.0, 20.0, 20.0, 20.0, 20.0, 20.0, 20.0, 20.0, 20.0, 20.0, 20.0, 20.0, 20.0, 20.0, 20.0, 20.0, 20.0, 20.0, 20.0, 20.0, 15.0, 15.0, 15.0, 15.0, 15.0, 15.0, 15.0, 15.0, 15.0, 15.0, 15.0, 15.0, 15.0, 15.0, 15.0, 15.0, 15.0, 15.0, 15.0, 15.0, 15.0, 15.0, 15.0, 15.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.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": "Dual values" }, "xaxis": { "title": { "text": "Time" } }, "yaxis": { "title": { "text": "Power" } } } }, "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "energy_value = battery.energy_value.get()\n", "energy_price = busbar.energy_price.get()\n", "market_price = market.buy_price.get()\n", "fig = go.Figure()\n", "fig.add_trace(go.Scatter(x=energy_value.index, y=energy_value.values, name=\"Storage energy value\"))\n", "fig.add_trace(go.Scatter(x=energy_price.index, y=energy_price.values, name=\"Busbar energy price\"))\n", "fig.add_trace(go.Scatter(x=market_price.index, y=market_price.values, name=\"Market energy price\"))\n", "fig.update_layout(xaxis_title=\"Time\", yaxis_title=\"Power\", title=\"Dual values\")\n", "fig.show()" ] }, { "cell_type": "markdown", "id": "4d4301d7", "metadata": {}, "source": [ "The storage marginal value (SMV) of the battery is always 4.5, which is the purchase price in the last hours multiplied with efficiency. The battery is the marginal unit in all periods except mid-day. When the battery is discharging, the busbar price becomes 5, which is the SMV multiplied with the discharge efficiency. When it is charging, the busbar price becomes 4.05, which is the SMV divided by the charge efficiency. In the middle of the day, the solar power is the marginal unit driving the price to zero. The battery is able to charge all the necessary energy in the evening resulting in the SMV of 4.5.\n", "\n", "Try to enable market sale to see how that influences the prices in the system." ] } ], "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.9" }, "source_map": [ 12, 18, 30, 34, 47, 51, 64, 68, 87, 94, 104, 115, 121, 133 ] }, "nbformat": 4, "nbformat_minor": 5 }