{ "cells": [ { "cell_type": "markdown", "id": "b4907042", "metadata": {}, "source": [ "(changing-time-res-example)=\n", "# Changing time resolution\n", "It is usually not possible to change the time resolution (start time, end time, time unit, and time step length) of the optimization after it has been specified in SHOP. However, this is now possible with the online SHOP functionality. This example will show how the time resolution can be changed between iterations in SHOP, and how SHOP handles the resampling of time series data.\n", "\n", "The `SHOP_ONLINE_OPTIMIZATION` license in the \"Online Optimization Capabilities\" license group is required to change the time resolution after it has been set the first time in SHOP. The following [YAML](yaml-standard) model will be used as a base for the rest of the example:\n", "\n", "- [](model.yaml)" ] }, { "cell_type": "code", "execution_count": 1, "id": "1ee615ee", "metadata": {}, "outputs": [], "source": [ "from pyshop import ShopSession\n", "import pandas as pd\n", "import plotly.graph_objects as go\n", "pd.options.plotting.backend = \"plotly\"" ] }, { "cell_type": "markdown", "id": "8dbcddec", "metadata": {}, "source": [ "The original time resolution has a horizon of three days with hourly time resolution:" ] }, { "cell_type": "code", "execution_count": 2, "id": "79eb14bf", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Start time: 2018-01-23 00:00:00\n", "End time: 2018-01-26 00:00:00\n", "Time unit: hour\n", "Step sizes: [1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1.\n", " 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1.\n", " 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1.\n", " 1.]\n" ] } ], "source": [ "shop = ShopSession()\n", "shop.load_yaml(\"model.yaml\")\n", "time_res_orig = shop.get_time_resolution()\n", "\n", "start_orig = time_res_orig[\"starttime\"]\n", "end_orig = time_res_orig[\"endtime\"]\n", "unit_orig = time_res_orig[\"timeunit\"]\n", "step_size_orig = time_res_orig[\"timeresolution\"]\n", "\n", "print(f\"Start time: {start_orig}\")\n", "print(f\"End time: {end_orig}\")\n", "print(f\"Time unit: {unit_orig}\")\n", "print(f\"Step sizes: {step_size_orig.values}\")" ] }, { "cell_type": "markdown", "id": "bffa2853", "metadata": {}, "source": [ "First, a single iteration with this hourly time resolution is performed, and the [reservoir volume](reservoir:storage) for Reservoir2 is retrieved:" ] }, { "cell_type": "code", "execution_count": 3, "id": "bd61cbb4", "metadata": {}, "outputs": [], "source": [ "shop.start_sim([],3)\n", "\n", "rsv = shop.model.reservoir[\"Reservoir2\"]\n", "storage_orig = rsv.storage.get()" ] }, { "cell_type": "markdown", "id": "0ad39ac2", "metadata": {}, "source": [ "Now, the start and end times of the optimization are shifted 24 hours forward in time, and the step size is changed to be 15 minutes. Note that it is required to set the command [activate online_optimization /on](activate_online_optimization) before changing the time resolution in an existing model:" ] }, { "cell_type": "code", "execution_count": 4, "id": "cb80b6cd", "metadata": {}, "outputs": [], "source": [ "start_new = start_orig + pd.Timedelta(hours = 24)\n", "end_new = end_orig + pd.Timedelta(hours = 24)\n", "\n", "shop.activate_online_optimization(\"on\", [])\n", "shop.set_time_resolution(start_new, end_new, \"minute\", pd.Series([15], index=[start_new]))\n", "\n", "storage_resampled = rsv.storage.get()" ] }, { "cell_type": "markdown", "id": "c0779acf", "metadata": {}, "source": [ "After resetting the time resolution, all existing time series have automatically been resampled. The original and resampled reservoir trajectories are plotted in the figure below:" ] }, { "cell_type": "code", "execution_count": 5, "id": "dac0e8c6", "metadata": {}, "outputs": [ { "data": { "text/html": [ " \n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "line": { "dash": "dash" }, "name": "new start time", "type": "scatter", "x": [ "2018-01-24T00:00:00", "2018-01-24T00:00:00" ], "y": [ 0.0, 73.96551724137932 ] }, { "line": { "dash": "dash" }, "name": "original end time", "type": "scatter", "x": [ "2018-01-26T00:00:00", "2018-01-26T00:00:00" ], "y": [ 0.0, 73.96551724137932 ] }, { "name": "Original volume", "type": "scatter", "x": [ "2018-01-23T00:00:00", "2018-01-23T01:00:00", "2018-01-23T02:00:00", "2018-01-23T03:00:00", "2018-01-23T04:00:00", "2018-01-23T05:00:00", "2018-01-23T06:00:00", "2018-01-23T07:00:00", "2018-01-23T08:00:00", "2018-01-23T09:00:00", "2018-01-23T10:00:00", "2018-01-23T11:00:00", "2018-01-23T12:00:00", "2018-01-23T13:00:00", "2018-01-23T14:00:00", "2018-01-23T15:00:00", "2018-01-23T16:00:00", "2018-01-23T17:00:00", "2018-01-23T18:00:00", "2018-01-23T19:00:00", "2018-01-23T20:00:00", "2018-01-23T21:00:00", "2018-01-23T22:00:00", "2018-01-23T23:00:00", "2018-01-24T00:00:00", "2018-01-24T01:00:00", "2018-01-24T02:00:00", "2018-01-24T03:00:00", "2018-01-24T04:00:00", "2018-01-24T05:00:00", "2018-01-24T06:00:00", "2018-01-24T07:00:00", "2018-01-24T08:00:00", "2018-01-24T09:00:00", "2018-01-24T10:00:00", "2018-01-24T11:00:00", "2018-01-24T12:00:00", "2018-01-24T13:00:00", "2018-01-24T14:00:00", "2018-01-24T15:00:00", "2018-01-24T16:00:00", "2018-01-24T17:00:00", "2018-01-24T18:00:00", "2018-01-24T19:00:00", "2018-01-24T20:00:00", "2018-01-24T21:00:00", "2018-01-24T22:00:00", "2018-01-24T23:00:00", "2018-01-25T00:00:00", "2018-01-25T01:00:00", "2018-01-25T02:00:00", "2018-01-25T03:00:00", "2018-01-25T04:00:00", "2018-01-25T05:00:00", "2018-01-25T06:00:00", "2018-01-25T07:00:00", "2018-01-25T08:00:00", "2018-01-25T09:00:00", "2018-01-25T10:00:00", "2018-01-25T11:00:00", "2018-01-25T12:00:00", "2018-01-25T13:00:00", "2018-01-25T14:00:00", "2018-01-25T15:00:00", "2018-01-25T16:00:00", "2018-01-25T17:00:00", "2018-01-25T18:00:00", "2018-01-25T19:00:00", "2018-01-25T20:00:00", "2018-01-25T21:00:00", "2018-01-25T22:00:00", "2018-01-25T23:00:00", "2018-01-26T00:00:00" ], "y": [ 67.24137931034483, 66.51700664278869, 66.17178391334205, 65.91743262445749, 65.67751712410038, 65.32251313529339, 64.59668240335948, 63.506261422770365, 62.404803627858044, 61.29460453450323, 60.172016988382474, 59.03956835657436, 57.89681257200535, 56.74286657208925, 55.585396982700466, 54.42967931061666, 53.26479731796209, 52.06765331796209, 50.85378967228867, 49.69347230412184, 48.86953490438761, 48.04272294678612, 47.27067277927254, 46.303837557635454, 45.3766236170041, 44.79245587965866, 44.02318232678097, 43.35985696380659, 42.69573002493699, 41.93145149573032, 41.3414943235781, 40.373917566687275, 39.49244418498461, 38.602872184984626, 37.71330018498463, 36.871404184984634, 35.84436018498463, 34.817316184984634, 33.78139218498463, 32.74546818498463, 31.709544184984633, 30.673620184984635, 29.646576184984635, 28.610652184984634, 27.640164184984634, 26.669676184984638, 25.699188184984642, 24.543552184984645, 23.76029893111115, 22.96359375772779, 22.179197244617534, 21.49881664476881, 20.815736639487422, 20.139712467166593, 19.340229392833105, 18.18459339283311, 17.092113392833106, 15.999633392833106, 14.907153392833107, 13.814673392833107, 12.713313392833108, 11.611953392833106, 10.510593392833105, 9.409233392833102, 8.307873392833102, 7.387653392833102, 6.4415253928331015, 5.486517392833101, 4.563816, 3.4495679999999997, 2.33532, 1.23396, 0.0 ] }, { "line": { "dash": "dash" }, "name": "Resampled volume", "type": "scatter", "x": [ "2018-01-23T00:00:00", "2018-01-23T01:00:00", "2018-01-23T02:00:00", "2018-01-23T03:00:00", "2018-01-23T04:00:00", "2018-01-23T05:00:00", "2018-01-23T06:00:00", "2018-01-23T07:00:00", "2018-01-23T08:00:00", "2018-01-23T09:00:00", "2018-01-23T10:00:00", "2018-01-23T11:00:00", "2018-01-23T12:00:00", "2018-01-23T13:00:00", "2018-01-23T14:00:00", "2018-01-23T15:00:00", "2018-01-23T16:00:00", "2018-01-23T17:00:00", "2018-01-23T18:00:00", "2018-01-23T19:00:00", "2018-01-23T20:00:00", "2018-01-23T21:00:00", "2018-01-23T22:00:00", "2018-01-23T23:00:00", "2018-01-24T00:00:00", "2018-01-24T00:15:00", "2018-01-24T00:30:00", "2018-01-24T00:45:00", "2018-01-24T01:00:00", "2018-01-24T01:15:00", "2018-01-24T01:30:00", "2018-01-24T01:45:00", "2018-01-24T02:00:00", "2018-01-24T02:15:00", "2018-01-24T02:30:00", "2018-01-24T02:45:00", "2018-01-24T03:00:00", "2018-01-24T03:15:00", "2018-01-24T03:30:00", "2018-01-24T03:45:00", "2018-01-24T04:00:00", "2018-01-24T04:15:00", "2018-01-24T04:30:00", "2018-01-24T04:45:00", "2018-01-24T05:00:00", "2018-01-24T05:15:00", "2018-01-24T05:30:00", "2018-01-24T05:45:00", "2018-01-24T06:00:00", "2018-01-24T06:15:00", "2018-01-24T06:30:00", "2018-01-24T06:45:00", "2018-01-24T07:00:00", "2018-01-24T07:15:00", "2018-01-24T07:30:00", "2018-01-24T07:45:00", "2018-01-24T08:00:00", "2018-01-24T08:15:00", "2018-01-24T08:30:00", "2018-01-24T08:45:00", "2018-01-24T09:00:00", "2018-01-24T09:15:00", "2018-01-24T09:30:00", "2018-01-24T09:45:00", "2018-01-24T10:00:00", "2018-01-24T10:15:00", "2018-01-24T10:30:00", "2018-01-24T10:45:00", "2018-01-24T11:00:00", "2018-01-24T11:15:00", "2018-01-24T11:30:00", "2018-01-24T11:45:00", "2018-01-24T12:00:00", "2018-01-24T12:15:00", "2018-01-24T12:30:00", "2018-01-24T12:45:00", "2018-01-24T13:00:00", "2018-01-24T13:15:00", "2018-01-24T13:30:00", "2018-01-24T13:45:00", "2018-01-24T14:00:00", "2018-01-24T14:15:00", "2018-01-24T14:30:00", "2018-01-24T14:45:00", "2018-01-24T15:00:00", "2018-01-24T15:15:00", "2018-01-24T15:30:00", "2018-01-24T15:45:00", "2018-01-24T16:00:00", "2018-01-24T16:15:00", "2018-01-24T16:30:00", "2018-01-24T16:45:00", "2018-01-24T17:00:00", "2018-01-24T17:15:00", "2018-01-24T17:30:00", "2018-01-24T17:45:00", "2018-01-24T18:00:00", "2018-01-24T18:15:00", "2018-01-24T18:30:00", "2018-01-24T18:45:00", "2018-01-24T19:00:00", "2018-01-24T19:15:00", "2018-01-24T19:30:00", "2018-01-24T19:45:00", "2018-01-24T20:00:00", "2018-01-24T20:15:00", "2018-01-24T20:30:00", "2018-01-24T20:45:00", "2018-01-24T21:00:00", "2018-01-24T21:15:00", "2018-01-24T21:30:00", "2018-01-24T21:45:00", "2018-01-24T22:00:00", "2018-01-24T22:15:00", "2018-01-24T22:30:00", "2018-01-24T22:45:00", "2018-01-24T23:00:00", "2018-01-24T23:15:00", "2018-01-24T23:30:00", "2018-01-24T23:45:00", "2018-01-25T00:00:00", "2018-01-25T00:15:00", "2018-01-25T00:30:00", "2018-01-25T00:45:00", "2018-01-25T01:00:00", "2018-01-25T01:15:00", "2018-01-25T01:30:00", "2018-01-25T01:45:00", "2018-01-25T02:00:00", "2018-01-25T02:15:00", "2018-01-25T02:30:00", "2018-01-25T02:45:00", "2018-01-25T03:00:00", "2018-01-25T03:15:00", "2018-01-25T03:30:00", "2018-01-25T03:45:00", "2018-01-25T04:00:00", "2018-01-25T04:15:00", "2018-01-25T04:30:00", "2018-01-25T04:45:00", "2018-01-25T05:00:00", "2018-01-25T05:15:00", "2018-01-25T05:30:00", "2018-01-25T05:45:00", "2018-01-25T06:00:00", "2018-01-25T06:15:00", "2018-01-25T06:30:00", "2018-01-25T06:45:00", "2018-01-25T07:00:00", "2018-01-25T07:15:00", "2018-01-25T07:30:00", "2018-01-25T07:45:00", "2018-01-25T08:00:00", "2018-01-25T08:15:00", "2018-01-25T08:30:00", "2018-01-25T08:45:00", "2018-01-25T09:00:00", "2018-01-25T09:15:00", "2018-01-25T09:30:00", "2018-01-25T09:45:00", "2018-01-25T10:00:00", "2018-01-25T10:15:00", "2018-01-25T10:30:00", "2018-01-25T10:45:00", "2018-01-25T11:00:00", "2018-01-25T11:15:00", "2018-01-25T11:30:00", "2018-01-25T11:45:00", "2018-01-25T12:00:00", "2018-01-25T12:15:00", "2018-01-25T12:30:00", "2018-01-25T12:45:00", "2018-01-25T13:00:00", "2018-01-25T13:15:00", "2018-01-25T13:30:00", "2018-01-25T13:45:00", "2018-01-25T14:00:00", "2018-01-25T14:15:00", "2018-01-25T14:30:00", "2018-01-25T14:45:00", "2018-01-25T15:00:00", "2018-01-25T15:15:00", "2018-01-25T15:30:00", "2018-01-25T15:45:00", "2018-01-25T16:00:00", "2018-01-25T16:15:00", "2018-01-25T16:30:00", "2018-01-25T16:45:00", "2018-01-25T17:00:00", "2018-01-25T17:15:00", "2018-01-25T17:30:00", "2018-01-25T17:45:00", "2018-01-25T18:00:00", "2018-01-25T18:15:00", "2018-01-25T18:30:00", "2018-01-25T18:45:00", "2018-01-25T19:00:00", "2018-01-25T19:15:00", "2018-01-25T19:30:00", "2018-01-25T19:45:00", "2018-01-25T20:00:00", "2018-01-25T20:15:00", "2018-01-25T20:30:00", "2018-01-25T20:45:00", "2018-01-25T21:00:00", "2018-01-25T21:15:00", "2018-01-25T21:30:00", "2018-01-25T21:45:00", "2018-01-25T22:00:00", "2018-01-25T22:15:00", "2018-01-25T22:30:00", "2018-01-25T22:45:00", "2018-01-25T23:00:00", "2018-01-25T23:15:00", "2018-01-25T23:30:00", "2018-01-25T23:45:00", "2018-01-26T00:00:00", "2018-01-26T00:15:00", "2018-01-26T00:30:00", "2018-01-26T00:45:00", "2018-01-26T01:00:00", "2018-01-26T01:15:00", "2018-01-26T01:30:00", "2018-01-26T01:45:00", "2018-01-26T02:00:00", "2018-01-26T02:15:00", "2018-01-26T02:30:00", "2018-01-26T02:45:00", "2018-01-26T03:00:00", "2018-01-26T03:15:00", "2018-01-26T03:30:00", "2018-01-26T03:45:00", "2018-01-26T04:00:00", "2018-01-26T04:15:00", "2018-01-26T04:30:00", "2018-01-26T04:45:00", "2018-01-26T05:00:00", "2018-01-26T05:15:00", "2018-01-26T05:30:00", "2018-01-26T05:45:00", "2018-01-26T06:00:00", "2018-01-26T06:15:00", "2018-01-26T06:30:00", "2018-01-26T06:45:00", "2018-01-26T07:00:00", "2018-01-26T07:15:00", "2018-01-26T07:30:00", "2018-01-26T07:45:00", "2018-01-26T08:00:00", "2018-01-26T08:15:00", "2018-01-26T08:30:00", "2018-01-26T08:45:00", "2018-01-26T09:00:00", "2018-01-26T09:15:00", "2018-01-26T09:30:00", "2018-01-26T09:45:00", "2018-01-26T10:00:00", "2018-01-26T10:15:00", "2018-01-26T10:30:00", "2018-01-26T10:45:00", "2018-01-26T11:00:00", "2018-01-26T11:15:00", "2018-01-26T11:30:00", "2018-01-26T11:45:00", "2018-01-26T12:00:00", "2018-01-26T12:15:00", "2018-01-26T12:30:00", "2018-01-26T12:45:00", "2018-01-26T13:00:00", "2018-01-26T13:15:00", "2018-01-26T13:30:00", "2018-01-26T13:45:00", "2018-01-26T14:00:00", "2018-01-26T14:15:00", "2018-01-26T14:30:00", "2018-01-26T14:45:00", "2018-01-26T15:00:00", "2018-01-26T15:15:00", "2018-01-26T15:30:00", "2018-01-26T15:45:00", "2018-01-26T16:00:00", "2018-01-26T16:15:00", "2018-01-26T16:30:00", "2018-01-26T16:45:00", "2018-01-26T17:00:00", "2018-01-26T17:15:00", "2018-01-26T17:30:00", "2018-01-26T17:45:00", "2018-01-26T18:00:00", "2018-01-26T18:15:00", "2018-01-26T18:30:00", "2018-01-26T18:45:00", "2018-01-26T19:00:00", "2018-01-26T19:15:00", "2018-01-26T19:30:00", "2018-01-26T19:45:00", "2018-01-26T20:00:00", "2018-01-26T20:15:00", "2018-01-26T20:30:00", "2018-01-26T20:45:00", "2018-01-26T21:00:00", "2018-01-26T21:15:00", "2018-01-26T21:30:00", "2018-01-26T21:45:00", "2018-01-26T22:00:00", "2018-01-26T22:15:00", "2018-01-26T22:30:00", "2018-01-26T22:45:00", "2018-01-26T23:00:00", "2018-01-26T23:15:00", "2018-01-26T23:30:00", "2018-01-26T23:45:00", "2018-01-27T00:00:00" ], "y": [ 67.24137931034483, 66.51700664278869, 66.17178391334205, 65.91743262445749, 65.67751712410038, 65.32251313529339, 64.59668240335948, 63.506261422770365, 62.404803627858044, 61.29460453450323, 60.172016988382474, 59.03956835657436, 57.89681257200535, 56.74286657208925, 55.585396982700466, 54.42967931061666, 53.26479731796209, 52.06765331796209, 50.85378967228867, 49.69347230412184, 48.86953490438761, 48.04272294678612, 47.27067277927254, 46.303837557635454, 45.3766236170041, 45.3766236170041, 45.3766236170041, 45.3766236170041, 44.79245587965866, 44.79245587965866, 44.79245587965866, 44.79245587965866, 44.02318232678097, 44.02318232678097, 44.02318232678097, 44.02318232678097, 43.35985696380659, 43.35985696380659, 43.35985696380659, 43.35985696380659, 42.69573002493699, 42.69573002493699, 42.69573002493699, 42.69573002493699, 41.93145149573032, 41.93145149573032, 41.93145149573032, 41.93145149573032, 41.3414943235781, 41.3414943235781, 41.3414943235781, 41.3414943235781, 40.373917566687275, 40.373917566687275, 40.373917566687275, 40.373917566687275, 39.49244418498461, 39.49244418498461, 39.49244418498461, 39.49244418498461, 38.602872184984626, 38.602872184984626, 38.602872184984626, 38.602872184984626, 37.71330018498463, 37.71330018498463, 37.71330018498463, 37.71330018498463, 36.871404184984634, 36.871404184984634, 36.871404184984634, 36.871404184984634, 35.84436018498463, 35.84436018498463, 35.84436018498463, 35.84436018498463, 34.817316184984634, 34.817316184984634, 34.817316184984634, 34.817316184984634, 33.78139218498463, 33.78139218498463, 33.78139218498463, 33.78139218498463, 32.74546818498463, 32.74546818498463, 32.74546818498463, 32.74546818498463, 31.709544184984633, 31.709544184984633, 31.709544184984633, 31.709544184984633, 30.673620184984635, 30.673620184984635, 30.673620184984635, 30.673620184984635, 29.646576184984635, 29.646576184984635, 29.646576184984635, 29.646576184984635, 28.610652184984634, 28.610652184984634, 28.610652184984634, 28.610652184984634, 27.640164184984634, 27.640164184984634, 27.640164184984634, 27.640164184984634, 26.669676184984638, 26.669676184984638, 26.669676184984638, 26.669676184984638, 25.699188184984642, 25.699188184984642, 25.699188184984642, 25.699188184984642, 24.543552184984645, 24.543552184984645, 24.543552184984645, 24.543552184984645, 23.76029893111115, 23.76029893111115, 23.76029893111115, 23.76029893111115, 22.96359375772779, 22.96359375772779, 22.96359375772779, 22.96359375772779, 22.179197244617534, 22.179197244617534, 22.179197244617534, 22.179197244617534, 21.49881664476881, 21.49881664476881, 21.49881664476881, 21.49881664476881, 20.815736639487422, 20.815736639487422, 20.815736639487422, 20.815736639487422, 20.139712467166593, 20.139712467166593, 20.139712467166593, 20.139712467166593, 19.340229392833105, 19.340229392833105, 19.340229392833105, 19.340229392833105, 18.18459339283311, 18.18459339283311, 18.18459339283311, 18.18459339283311, 17.092113392833106, 17.092113392833106, 17.092113392833106, 17.092113392833106, 15.999633392833106, 15.999633392833106, 15.999633392833106, 15.999633392833106, 14.907153392833107, 14.907153392833107, 14.907153392833107, 14.907153392833107, 13.814673392833107, 13.814673392833107, 13.814673392833107, 13.814673392833107, 12.713313392833108, 12.713313392833108, 12.713313392833108, 12.713313392833108, 11.611953392833106, 11.611953392833106, 11.611953392833106, 11.611953392833106, 10.510593392833105, 10.510593392833105, 10.510593392833105, 10.510593392833105, 9.409233392833102, 9.409233392833102, 9.409233392833102, 9.409233392833102, 8.307873392833102, 8.307873392833102, 8.307873392833102, 8.307873392833102, 7.387653392833102, 7.387653392833102, 7.387653392833102, 7.387653392833102, 6.4415253928331015, 6.4415253928331015, 6.4415253928331015, 6.4415253928331015, 5.486517392833101, 5.486517392833101, 5.486517392833101, 5.486517392833101, 4.563816, 4.563816, 4.563816, 4.563816, 3.4495679999999997, 3.4495679999999997, 3.4495679999999997, 3.4495679999999997, 2.33532, 2.33532, 2.33532, 2.33532, 1.23396, 1.23396, 1.23396, 1.23396, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 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": "Reservoir volume before and after changing time resolution" }, "xaxis": { "title": { "text": "Time" } }, "yaxis": { "title": { "text": "Volume [Mm3]" } } } }, "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "fig = go.Figure()\n", "fig.add_trace(go.Scatter(x=[start_new, start_new], y=[min(storage_orig)*0.9, max(storage_orig)*1.1], name=\"new start time\", line=dict(dash='dash')))\n", "fig.add_trace(go.Scatter(x=[end_orig, end_orig], y=[min(storage_orig)*0.9, max(storage_orig)*1.1], name=\"original end time\", line=dict(dash='dash')))\n", "\n", "fig.add_trace(go.Scatter(x=storage_orig.index, y=storage_orig.values, name=\"Original volume\"))\n", "fig.add_trace(go.Scatter(x=storage_resampled.index, y=storage_resampled.values, name=\"Resampled volume\", line=dict(dash='dash')))\n", "\n", "fig.update_layout(xaxis_title=\"Time\", yaxis_title=\"Volume [Mm3]\",title=\"Reservoir volume before and after changing time resolution\")\n", "fig.show()" ] }, { "cell_type": "markdown", "id": "0dc071b2", "metadata": {}, "source": [ "Note that SHOP keeps the data before the new start time of the optimization as historical values for the time series. These values are not resampled to 15 minute intervals like the other values inside the new optimization horizon. Since SHOP does not know what the reservoir volume (or any other time series) are supposed to be in the interval between the original and new end times, the last value of the time series is forward filled into the unknown time steps. It is important that the user sets all input time series again to have proper data for the whole period, otherwise the price, inflow, etc. will be constant. Similarly, the time series will be constant for all new time steps inside the old hourly time steps, and so input data with a 15 minute resolution (such as the spot price) should also be set again. \n", "\n", "To simplify this example, we will reset the time resolution again so that the new and original end times are identical:" ] }, { "cell_type": "code", "execution_count": 6, "id": "8d4f5ad4", "metadata": {}, "outputs": [], "source": [ "end_new = end_orig\n", "shop.set_time_resolution(start_new, end_new, \"minute\", pd.Series([15], index=[start_new]))" ] }, { "cell_type": "markdown", "id": "83319851", "metadata": {}, "source": [ "Now we run a new iteration with the updated time resolution. We also switch to incremental iterations to lock in the hourly unit commitment status calculated with the faster hourly model. This means that the units are on or off for whole clock hours instead of potentially switching on or off every 15 minutes. This also helps with calculation time since running the full iterations with hourly time resolution is faster than the more granular 15 minute time resolution:" ] }, { "cell_type": "code", "execution_count": 7, "id": "0501087d", "metadata": {}, "outputs": [], "source": [ "shop.set_code(\"incremental\", [])\n", "shop.start_sim([],1)" ] }, { "cell_type": "markdown", "id": "ada1249c", "metadata": {}, "source": [ "The reservoir storage results compared to the original hourly run is shown below:" ] }, { "cell_type": "code", "execution_count": 8, "id": "4047b1f5", "metadata": {}, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "line": { "dash": "dash" }, "name": "New start time", "type": "scatter", "x": [ "2018-01-24T00:00:00", "2018-01-24T00:00:00" ], "y": [ 0.0, 73.96551724137932 ] }, { "name": "Hourly run", "type": "scatter", "x": [ "2018-01-23T00:00:00", "2018-01-23T01:00:00", "2018-01-23T02:00:00", "2018-01-23T03:00:00", "2018-01-23T04:00:00", "2018-01-23T05:00:00", "2018-01-23T06:00:00", "2018-01-23T07:00:00", "2018-01-23T08:00:00", "2018-01-23T09:00:00", "2018-01-23T10:00:00", "2018-01-23T11:00:00", "2018-01-23T12:00:00", "2018-01-23T13:00:00", "2018-01-23T14:00:00", "2018-01-23T15:00:00", "2018-01-23T16:00:00", "2018-01-23T17:00:00", "2018-01-23T18:00:00", "2018-01-23T19:00:00", "2018-01-23T20:00:00", "2018-01-23T21:00:00", "2018-01-23T22:00:00", "2018-01-23T23:00:00", "2018-01-24T00:00:00", "2018-01-24T01:00:00", "2018-01-24T02:00:00", "2018-01-24T03:00:00", "2018-01-24T04:00:00", "2018-01-24T05:00:00", "2018-01-24T06:00:00", "2018-01-24T07:00:00", "2018-01-24T08:00:00", "2018-01-24T09:00:00", "2018-01-24T10:00:00", "2018-01-24T11:00:00", "2018-01-24T12:00:00", "2018-01-24T13:00:00", "2018-01-24T14:00:00", "2018-01-24T15:00:00", "2018-01-24T16:00:00", "2018-01-24T17:00:00", "2018-01-24T18:00:00", "2018-01-24T19:00:00", "2018-01-24T20:00:00", "2018-01-24T21:00:00", "2018-01-24T22:00:00", "2018-01-24T23:00:00", "2018-01-25T00:00:00", "2018-01-25T01:00:00", "2018-01-25T02:00:00", "2018-01-25T03:00:00", "2018-01-25T04:00:00", "2018-01-25T05:00:00", "2018-01-25T06:00:00", "2018-01-25T07:00:00", "2018-01-25T08:00:00", "2018-01-25T09:00:00", "2018-01-25T10:00:00", "2018-01-25T11:00:00", "2018-01-25T12:00:00", "2018-01-25T13:00:00", "2018-01-25T14:00:00", "2018-01-25T15:00:00", "2018-01-25T16:00:00", "2018-01-25T17:00:00", "2018-01-25T18:00:00", "2018-01-25T19:00:00", "2018-01-25T20:00:00", "2018-01-25T21:00:00", "2018-01-25T22:00:00", "2018-01-25T23:00:00", "2018-01-26T00:00:00" ], "y": [ 67.24137931034483, 66.51700664278869, 66.17178391334205, 65.91743262445749, 65.67751712410038, 65.32251313529339, 64.59668240335948, 63.506261422770365, 62.404803627858044, 61.29460453450323, 60.172016988382474, 59.03956835657436, 57.89681257200535, 56.74286657208925, 55.585396982700466, 54.42967931061666, 53.26479731796209, 52.06765331796209, 50.85378967228867, 49.69347230412184, 48.86953490438761, 48.04272294678612, 47.27067277927254, 46.303837557635454, 45.3766236170041, 44.79245587965866, 44.02318232678097, 43.35985696380659, 42.69573002493699, 41.93145149573032, 41.3414943235781, 40.373917566687275, 39.49244418498461, 38.602872184984626, 37.71330018498463, 36.871404184984634, 35.84436018498463, 34.817316184984634, 33.78139218498463, 32.74546818498463, 31.709544184984633, 30.673620184984635, 29.646576184984635, 28.610652184984634, 27.640164184984634, 26.669676184984638, 25.699188184984642, 24.543552184984645, 23.76029893111115, 22.96359375772779, 22.179197244617534, 21.49881664476881, 20.815736639487422, 20.139712467166593, 19.340229392833105, 18.18459339283311, 17.092113392833106, 15.999633392833106, 14.907153392833107, 13.814673392833107, 12.713313392833108, 11.611953392833106, 10.510593392833105, 9.409233392833102, 8.307873392833102, 7.387653392833102, 6.4415253928331015, 5.486517392833101, 4.563816, 3.4495679999999997, 2.33532, 1.23396, 0.0 ] }, { "line": { "dash": "dash" }, "name": "15 min run", "type": "scatter", "x": [ "2018-01-23T00:00:00", "2018-01-23T01:00:00", "2018-01-23T02:00:00", "2018-01-23T03:00:00", "2018-01-23T04:00:00", "2018-01-23T05:00:00", "2018-01-23T06:00:00", "2018-01-23T07:00:00", "2018-01-23T08:00:00", "2018-01-23T09:00:00", "2018-01-23T10:00:00", "2018-01-23T11:00:00", "2018-01-23T12:00:00", "2018-01-23T13:00:00", "2018-01-23T14:00:00", "2018-01-23T15:00:00", "2018-01-23T16:00:00", "2018-01-23T17:00:00", "2018-01-23T18:00:00", "2018-01-23T19:00:00", "2018-01-23T20:00:00", "2018-01-23T21:00:00", "2018-01-23T22:00:00", "2018-01-23T23:00:00", "2018-01-24T00:00:00", "2018-01-24T00:15:00", "2018-01-24T00:30:00", "2018-01-24T00:45:00", "2018-01-24T01:00:00", "2018-01-24T01:15:00", "2018-01-24T01:30:00", "2018-01-24T01:45:00", "2018-01-24T02:00:00", "2018-01-24T02:15:00", "2018-01-24T02:30:00", "2018-01-24T02:45:00", "2018-01-24T03:00:00", "2018-01-24T03:15:00", "2018-01-24T03:30:00", "2018-01-24T03:45:00", "2018-01-24T04:00:00", "2018-01-24T04:15:00", "2018-01-24T04:30:00", "2018-01-24T04:45:00", "2018-01-24T05:00:00", "2018-01-24T05:15:00", "2018-01-24T05:30:00", "2018-01-24T05:45:00", "2018-01-24T06:00:00", "2018-01-24T06:15:00", "2018-01-24T06:30:00", "2018-01-24T06:45:00", "2018-01-24T07:00:00", "2018-01-24T07:15:00", "2018-01-24T07:30:00", "2018-01-24T07:45:00", "2018-01-24T08:00:00", "2018-01-24T08:15:00", "2018-01-24T08:30:00", "2018-01-24T08:45:00", "2018-01-24T09:00:00", "2018-01-24T09:15:00", "2018-01-24T09:30:00", "2018-01-24T09:45:00", "2018-01-24T10:00:00", "2018-01-24T10:15:00", "2018-01-24T10:30:00", "2018-01-24T10:45:00", "2018-01-24T11:00:00", "2018-01-24T11:15:00", "2018-01-24T11:30:00", "2018-01-24T11:45:00", "2018-01-24T12:00:00", "2018-01-24T12:15:00", "2018-01-24T12:30:00", "2018-01-24T12:45:00", "2018-01-24T13:00:00", "2018-01-24T13:15:00", "2018-01-24T13:30:00", "2018-01-24T13:45:00", "2018-01-24T14:00:00", "2018-01-24T14:15:00", "2018-01-24T14:30:00", "2018-01-24T14:45:00", "2018-01-24T15:00:00", "2018-01-24T15:15:00", "2018-01-24T15:30:00", "2018-01-24T15:45:00", "2018-01-24T16:00:00", "2018-01-24T16:15:00", "2018-01-24T16:30:00", "2018-01-24T16:45:00", "2018-01-24T17:00:00", "2018-01-24T17:15:00", "2018-01-24T17:30:00", "2018-01-24T17:45:00", "2018-01-24T18:00:00", "2018-01-24T18:15:00", "2018-01-24T18:30:00", "2018-01-24T18:45:00", "2018-01-24T19:00:00", "2018-01-24T19:15:00", "2018-01-24T19:30:00", "2018-01-24T19:45:00", "2018-01-24T20:00:00", "2018-01-24T20:15:00", "2018-01-24T20:30:00", "2018-01-24T20:45:00", "2018-01-24T21:00:00", "2018-01-24T21:15:00", "2018-01-24T21:30:00", "2018-01-24T21:45:00", "2018-01-24T22:00:00", "2018-01-24T22:15:00", "2018-01-24T22:30:00", "2018-01-24T22:45:00", "2018-01-24T23:00:00", "2018-01-24T23:15:00", "2018-01-24T23:30:00", "2018-01-24T23:45:00", "2018-01-25T00:00:00", "2018-01-25T00:15:00", "2018-01-25T00:30:00", "2018-01-25T00:45:00", "2018-01-25T01:00:00", "2018-01-25T01:15:00", "2018-01-25T01:30:00", "2018-01-25T01:45:00", "2018-01-25T02:00:00", "2018-01-25T02:15:00", "2018-01-25T02:30:00", "2018-01-25T02:45:00", "2018-01-25T03:00:00", "2018-01-25T03:15:00", "2018-01-25T03:30:00", "2018-01-25T03:45:00", "2018-01-25T04:00:00", "2018-01-25T04:15:00", "2018-01-25T04:30:00", "2018-01-25T04:45:00", "2018-01-25T05:00:00", "2018-01-25T05:15:00", "2018-01-25T05:30:00", "2018-01-25T05:45:00", "2018-01-25T06:00:00", "2018-01-25T06:15:00", "2018-01-25T06:30:00", "2018-01-25T06:45:00", "2018-01-25T07:00:00", "2018-01-25T07:15:00", "2018-01-25T07:30:00", "2018-01-25T07:45:00", "2018-01-25T08:00:00", "2018-01-25T08:15:00", "2018-01-25T08:30:00", "2018-01-25T08:45:00", "2018-01-25T09:00:00", "2018-01-25T09:15:00", "2018-01-25T09:30:00", "2018-01-25T09:45:00", "2018-01-25T10:00:00", "2018-01-25T10:15:00", "2018-01-25T10:30:00", "2018-01-25T10:45:00", "2018-01-25T11:00:00", "2018-01-25T11:15:00", "2018-01-25T11:30:00", "2018-01-25T11:45:00", "2018-01-25T12:00:00", "2018-01-25T12:15:00", "2018-01-25T12:30:00", "2018-01-25T12:45:00", "2018-01-25T13:00:00", "2018-01-25T13:15:00", "2018-01-25T13:30:00", "2018-01-25T13:45:00", "2018-01-25T14:00:00", "2018-01-25T14:15:00", "2018-01-25T14:30:00", "2018-01-25T14:45:00", "2018-01-25T15:00:00", "2018-01-25T15:15:00", "2018-01-25T15:30:00", "2018-01-25T15:45:00", "2018-01-25T16:00:00", "2018-01-25T16:15:00", "2018-01-25T16:30:00", "2018-01-25T16:45:00", "2018-01-25T17:00:00", "2018-01-25T17:15:00", "2018-01-25T17:30:00", "2018-01-25T17:45:00", "2018-01-25T18:00:00", "2018-01-25T18:15:00", "2018-01-25T18:30:00", "2018-01-25T18:45:00", "2018-01-25T19:00:00", "2018-01-25T19:15:00", "2018-01-25T19:30:00", "2018-01-25T19:45:00", "2018-01-25T20:00:00", "2018-01-25T20:15:00", "2018-01-25T20:30:00", "2018-01-25T20:45:00", "2018-01-25T21:00:00", "2018-01-25T21:15:00", "2018-01-25T21:30:00", "2018-01-25T21:45:00", "2018-01-25T22:00:00", "2018-01-25T22:15:00", "2018-01-25T22:30:00", "2018-01-25T22:45:00", "2018-01-25T23:00:00", "2018-01-25T23:15:00", "2018-01-25T23:30:00", "2018-01-25T23:45:00", "2018-01-26T00:00:00" ], "y": [ 67.24137931034483, 66.51700664278869, 66.17178391334205, 65.91743262445749, 65.67751712410038, 65.32251313529339, 64.59668240335948, 63.506261422770365, 62.404803627858044, 61.29460453450323, 60.172016988382474, 59.03956835657436, 57.89681257200535, 56.74286657208925, 55.585396982700466, 54.42967931061666, 53.26479731796209, 52.06765331796209, 50.85378967228867, 49.69347230412184, 48.86953490438761, 48.04272294678612, 47.27067277927254, 46.303837557635454, 45.3766236170041, 45.200717799126295, 45.02288986937169, 44.84506193961708, 44.667234009862476, 44.452015366432526, 44.23679672300258, 44.02157807957263, 43.80635943614268, 43.59104444513087, 43.37572945411906, 43.16041446310725, 42.94509947209544, 42.72969823195057, 42.5142969918057, 42.29889575166083, 42.08349451151596, 41.868006117524594, 41.65251772353323, 41.437029329541865, 41.2215409355505, 41.04327276731602, 40.86500459908154, 40.686736430847056, 40.508468262612574, 40.25676428636041, 40.00506031010824, 39.753356333856075, 39.50165235760391, 39.29163112358963, 39.081609889575354, 38.87158865556108, 38.6615674215468, 38.45169463946187, 38.24182185737694, 38.03194907529201, 37.82207629320708, 37.61235444120797, 37.40263258920886, 37.19291073720974, 36.98318888521063, 36.7735304879563, 36.56387209070197, 36.35421369344764, 36.14455529619331, 35.888756010024395, 35.63295672385548, 35.37715743768656, 35.12135815151765, 34.86573878190621, 34.61011941229477, 34.354500042683334, 34.098880673071896, 33.84344308567989, 33.58800549828788, 33.33256791089587, 33.07713032350386, 32.821878009628215, 32.56662569575257, 32.311373381876926, 32.05612106800128, 31.80105598597194, 31.545990903942595, 31.290925821913252, 31.03586073988391, 30.780984879257883, 30.526109018631857, 30.27123315800583, 30.016357297379805, 29.76167267960893, 29.506988061838058, 29.252303444067184, 28.99761882629631, 28.743125839639347, 28.488632852982384, 28.23413986632542, 27.979646879668458, 27.719638059493676, 27.459629239318893, 27.19962041914411, 26.93961159896933, 26.6850143415155, 26.430417084061673, 26.17466317439044, 25.914848498904224, 25.66047412914081, 25.406099759377394, 25.15172538961398, 24.897351019850564, 24.60584503565285, 24.31433905145514, 24.022833067257427, 23.731327083059714, 23.51655631574545, 23.301785548431187, 23.087014781116924, 22.87224401380266, 22.6576529738919, 22.443061933981138, 22.228470894070377, 22.013879854159615, 21.79947270354092, 21.585065552922227, 21.370658402303533, 21.15625125168484, 20.942026575458815, 20.72780189923279, 20.513577223006767, 20.299352546780742, 20.08528743867386, 19.871222330566976, 19.657157222460093, 19.44309211435321, 19.229188429733295, 19.01528474511338, 18.801381060493465, 18.58747737587355, 18.37373466824519, 18.159991960616832, 17.946249252988473, 17.732506545360113, 17.44249515082002, 17.152483756279924, 16.86247236173983, 16.572460967199735, 16.320265786123258, 16.06807060504678, 15.815875423970308, 15.563680242893835, 15.311718234936704, 15.059756226979573, 14.807794219022442, 14.555832211065312, 14.304106219207378, 14.052380227349445, 13.800654235491512, 13.54892824363358, 13.297441163192024, 13.04595408275047, 12.794467002308915, 12.54297992186736, 12.291734701789839, 12.040489481712317, 11.789244261634796, 11.537999041557274, 11.28700068854552, 11.036002335533766, 10.785003982522012, 10.534005629510258, 10.283257254239274, 10.03250887896829, 9.781760503697306, 9.531012128426323, 9.280516900766317, 9.030021673106312, 8.779526445446306, 8.5290312177863, 8.278792368314907, 8.028553518843513, 7.778314669372119, 7.528075819900725, 7.3137985233348655, 7.0995212267690055, 6.885243930203146, 6.670966633637286, 6.463652794647606, 6.2563389556579265, 6.049025116668247, 5.841711277678567, 5.634602283853062, 5.427493290027557, 5.2203842962020515, 5.013275302376546, 4.799811917133449, 4.5824101856108275, 4.365008454088206, 4.147606722565584, 3.898550001911042, 3.6494932812565, 3.4004365606019578, 3.1513798399474156, 2.902601474764291, 2.653823109581167, 2.4050447443980425, 2.156266379214918, 1.9022707943691015, 1.648275209523285, 1.3942796246774687, 1.140284039831652, 0.855213029873739, 0.570142019915826, 0.285071009957913, 0.0 ] } ], "layout": { "template": { "data": { "bar": [ { "error_x": { "color": "#2a3f5f" }, "error_y": { "color": "#2a3f5f" }, "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "bar" } ], "barpolar": [ { "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "barpolar" } ], "carpet": [ { "aaxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "baxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "type": "carpet" } ], "choropleth": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "choropleth" } ], "contour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0.0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1.0, "#f0f921" ] ], "type": "contour" } ], "contourcarpet": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "contourcarpet" } ], "heatmap": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0.0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1.0, "#f0f921" ] ], "type": "heatmap" } ], "heatmapgl": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0.0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1.0, "#f0f921" ] ], "type": "heatmapgl" } ], "histogram": [ { "marker": { "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "histogram" } ], "histogram2d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0.0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1.0, "#f0f921" ] ], "type": "histogram2d" } ], "histogram2dcontour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0.0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1.0, "#f0f921" ] ], "type": "histogram2dcontour" } ], "mesh3d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "mesh3d" } ], "parcoords": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "parcoords" } ], "pie": [ { "automargin": true, "type": "pie" } ], "scatter": [ { "fillpattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 }, "type": "scatter" } ], "scatter3d": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter3d" } ], "scattercarpet": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattercarpet" } ], "scattergeo": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergeo" } ], "scattergl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergl" } ], "scattermapbox": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattermapbox" } ], "scatterpolar": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolar" } ], "scatterpolargl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolargl" } ], "scatterternary": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterternary" } ], "surface": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0.0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1.0, "#f0f921" ] ], "type": "surface" } ], "table": [ { "cells": { "fill": { "color": "#EBF0F8" }, "line": { "color": "white" } }, "header": { "fill": { "color": "#C8D4E3" }, "line": { "color": "white" } }, "type": "table" } ] }, "layout": { "annotationdefaults": { "arrowcolor": "#2a3f5f", "arrowhead": 0, "arrowwidth": 1 }, "autotypenumbers": "strict", "coloraxis": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "colorscale": { "diverging": [ [ 0, "#8e0152" ], [ 0.1, "#c51b7d" ], [ 0.2, "#de77ae" ], [ 0.3, "#f1b6da" ], [ 0.4, "#fde0ef" ], [ 0.5, "#f7f7f7" ], [ 0.6, "#e6f5d0" ], [ 0.7, "#b8e186" ], [ 0.8, "#7fbc41" ], [ 0.9, "#4d9221" ], [ 1, "#276419" ] ], "sequential": [ [ 0.0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1.0, "#f0f921" ] ], "sequentialminus": [ [ 0.0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1.0, "#f0f921" ] ] }, "colorway": [ "#636efa", "#EF553B", "#00cc96", "#ab63fa", "#FFA15A", "#19d3f3", "#FF6692", "#B6E880", "#FF97FF", "#FECB52" ], "font": { "color": "#2a3f5f" }, "geo": { "bgcolor": "white", "lakecolor": "white", "landcolor": "#E5ECF6", "showlakes": true, "showland": true, "subunitcolor": "white" }, "hoverlabel": { "align": "left" }, "hovermode": "closest", "mapbox": { "style": "light" }, "paper_bgcolor": "white", "plot_bgcolor": "#E5ECF6", "polar": { "angularaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "radialaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "scene": { "xaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "yaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "zaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" } }, "shapedefaults": { "line": { "color": "#2a3f5f" } }, "ternary": { "aaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "baxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "caxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "title": { "x": 0.05 }, "xaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 }, "yaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 } } }, "title": { "text": "Reservoir volume in the hourly and 15 min model" }, "xaxis": { "title": { "text": "Time" } }, "yaxis": { "title": { "text": "Volume [Mm3]" } } } }, "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "storage_final = rsv.storage.get()\n", "fig = go.Figure()\n", "fig.add_trace(go.Scatter(x=[start_new, start_new], y=[min(storage_orig)*0.9, max(storage_orig)*1.1], name=\"New start time\", line=dict(dash='dash')))\n", "\n", "fig.add_trace(go.Scatter(x=storage_orig.index, y=storage_orig.values, name=\"Hourly run\"))\n", "fig.add_trace(go.Scatter(x=storage_final.index, y=storage_final.values, name=\"15 min run\", line=dict(dash='dash')))\n", "\n", "fig.update_layout(xaxis_title=\"Time\", yaxis_title=\"Volume [Mm3]\",title=\"Reservoir volume in the hourly and 15 min model\")\n", "fig.show()" ] }, { "cell_type": "markdown", "id": "a40044a6", "metadata": {}, "source": [ "We also see that the unit commitment status of the generator Plant1_G1 is constant for every clock hour since the commitment was decided based on the hourly model. Also note the hourly historical time series that is returned between the old and new start times:" ] }, { "cell_type": "code", "execution_count": 9, "id": "f6be0368", "metadata": {}, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "line": { "dash": "dash" }, "name": "New start time", "type": "scatter", "x": [ "2018-01-24T00:00:00", "2018-01-24T00:00:00" ], "y": [ -0.1, 1.1 ] }, { "mode": "lines+markers", "name": "Committed status", "type": "scatter", "x": [ "2018-01-23T00:00:00", "2018-01-23T01:00:00", "2018-01-23T02:00:00", "2018-01-23T03:00:00", "2018-01-23T04:00:00", "2018-01-23T05:00:00", "2018-01-23T06:00:00", "2018-01-23T07:00:00", "2018-01-23T08:00:00", "2018-01-23T09:00:00", "2018-01-23T10:00:00", "2018-01-23T11:00:00", "2018-01-23T12:00:00", "2018-01-23T13:00:00", "2018-01-23T14:00:00", "2018-01-23T15:00:00", "2018-01-23T16:00:00", "2018-01-23T17:00:00", "2018-01-23T18:00:00", "2018-01-23T19:00:00", "2018-01-23T20:00:00", "2018-01-23T21:00:00", "2018-01-23T22:00:00", "2018-01-23T23:00:00", "2018-01-24T00:00:00", "2018-01-24T00:15:00", "2018-01-24T00:30:00", "2018-01-24T00:45:00", "2018-01-24T01:00:00", "2018-01-24T01:15:00", "2018-01-24T01:30:00", "2018-01-24T01:45:00", "2018-01-24T02:00:00", "2018-01-24T02:15:00", "2018-01-24T02:30:00", "2018-01-24T02:45:00", "2018-01-24T03:00:00", "2018-01-24T03:15:00", "2018-01-24T03:30:00", "2018-01-24T03:45:00", "2018-01-24T04:00:00", "2018-01-24T04:15:00", "2018-01-24T04:30:00", "2018-01-24T04:45:00", "2018-01-24T05:00:00", "2018-01-24T05:15:00", "2018-01-24T05:30:00", "2018-01-24T05:45:00", "2018-01-24T06:00:00", "2018-01-24T06:15:00", "2018-01-24T06:30:00", "2018-01-24T06:45:00", "2018-01-24T07:00:00", "2018-01-24T07:15:00", "2018-01-24T07:30:00", "2018-01-24T07:45:00", "2018-01-24T08:00:00", "2018-01-24T08:15:00", "2018-01-24T08:30:00", "2018-01-24T08:45:00", "2018-01-24T09:00:00", "2018-01-24T09:15:00", "2018-01-24T09:30:00", "2018-01-24T09:45:00", "2018-01-24T10:00:00", "2018-01-24T10:15:00", "2018-01-24T10:30:00", "2018-01-24T10:45:00", "2018-01-24T11:00:00", "2018-01-24T11:15:00", "2018-01-24T11:30:00", "2018-01-24T11:45:00", "2018-01-24T12:00:00", "2018-01-24T12:15:00", "2018-01-24T12:30:00", "2018-01-24T12:45:00", "2018-01-24T13:00:00", "2018-01-24T13:15:00", "2018-01-24T13:30:00", "2018-01-24T13:45:00", "2018-01-24T14:00:00", "2018-01-24T14:15:00", "2018-01-24T14:30:00", "2018-01-24T14:45:00", "2018-01-24T15:00:00", "2018-01-24T15:15:00", "2018-01-24T15:30:00", "2018-01-24T15:45:00", "2018-01-24T16:00:00", "2018-01-24T16:15:00", "2018-01-24T16:30:00", "2018-01-24T16:45:00", "2018-01-24T17:00:00", "2018-01-24T17:15:00", "2018-01-24T17:30:00", "2018-01-24T17:45:00", "2018-01-24T18:00:00", "2018-01-24T18:15:00", "2018-01-24T18:30:00", "2018-01-24T18:45:00", "2018-01-24T19:00:00", "2018-01-24T19:15:00", "2018-01-24T19:30:00", "2018-01-24T19:45:00", "2018-01-24T20:00:00", "2018-01-24T20:15:00", "2018-01-24T20:30:00", "2018-01-24T20:45:00", "2018-01-24T21:00:00", "2018-01-24T21:15:00", "2018-01-24T21:30:00", "2018-01-24T21:45:00", "2018-01-24T22:00:00", "2018-01-24T22:15:00", "2018-01-24T22:30:00", "2018-01-24T22:45:00", "2018-01-24T23:00:00", "2018-01-24T23:15:00", "2018-01-24T23:30:00", "2018-01-24T23:45:00", "2018-01-25T00:00:00", "2018-01-25T00:15:00", "2018-01-25T00:30:00", "2018-01-25T00:45:00", "2018-01-25T01:00:00", "2018-01-25T01:15:00", "2018-01-25T01:30:00", "2018-01-25T01:45:00", "2018-01-25T02:00:00", "2018-01-25T02:15:00", "2018-01-25T02:30:00", "2018-01-25T02:45:00", "2018-01-25T03:00:00", "2018-01-25T03:15:00", "2018-01-25T03:30:00", "2018-01-25T03:45:00", "2018-01-25T04:00:00", "2018-01-25T04:15:00", "2018-01-25T04:30:00", "2018-01-25T04:45:00", "2018-01-25T05:00:00", "2018-01-25T05:15:00", "2018-01-25T05:30:00", "2018-01-25T05:45:00", "2018-01-25T06:00:00", "2018-01-25T06:15:00", "2018-01-25T06:30:00", "2018-01-25T06:45:00", "2018-01-25T07:00:00", "2018-01-25T07:15:00", "2018-01-25T07:30:00", "2018-01-25T07:45:00", "2018-01-25T08:00:00", "2018-01-25T08:15:00", "2018-01-25T08:30:00", "2018-01-25T08:45:00", "2018-01-25T09:00:00", "2018-01-25T09:15:00", "2018-01-25T09:30:00", "2018-01-25T09:45:00", "2018-01-25T10:00:00", "2018-01-25T10:15:00", "2018-01-25T10:30:00", "2018-01-25T10:45:00", "2018-01-25T11:00:00", "2018-01-25T11:15:00", "2018-01-25T11:30:00", "2018-01-25T11:45:00", "2018-01-25T12:00:00", "2018-01-25T12:15:00", "2018-01-25T12:30:00", "2018-01-25T12:45:00", "2018-01-25T13:00:00", "2018-01-25T13:15:00", "2018-01-25T13:30:00", "2018-01-25T13:45:00", "2018-01-25T14:00:00", "2018-01-25T14:15:00", "2018-01-25T14:30:00", "2018-01-25T14:45:00", "2018-01-25T15:00:00", "2018-01-25T15:15:00", "2018-01-25T15:30:00", "2018-01-25T15:45:00", "2018-01-25T16:00:00", "2018-01-25T16:15:00", "2018-01-25T16:30:00", "2018-01-25T16:45:00", "2018-01-25T17:00:00", "2018-01-25T17:15:00", "2018-01-25T17:30:00", "2018-01-25T17:45:00", "2018-01-25T18:00:00", "2018-01-25T18:15:00", "2018-01-25T18:30:00", "2018-01-25T18:45:00", "2018-01-25T19:00:00", "2018-01-25T19:15:00", "2018-01-25T19:30:00", "2018-01-25T19:45:00", "2018-01-25T20:00:00", "2018-01-25T20:15:00", "2018-01-25T20:30:00", "2018-01-25T20:45:00", "2018-01-25T21:00:00", "2018-01-25T21:15:00", "2018-01-25T21:30:00", "2018-01-25T21:45:00", "2018-01-25T22:00:00", "2018-01-25T22:15:00", "2018-01-25T22:30:00", "2018-01-25T22:45:00", "2018-01-25T23:00:00", "2018-01-25T23:15:00", "2018-01-25T23:30:00", "2018-01-25T23:45:00" ], "y": [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.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": "Commitment status of generator Plant1_G1" }, "xaxis": { "title": { "text": "Time" } }, "yaxis": { "title": { "text": "On/off status" } } } }, "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "gen = shop.model.generator[\"Plant1_G1\"]\n", "committed = gen.committed_out.get()\n", "\n", "fig = go.Figure()\n", "fig.add_trace(go.Scatter(x=[start_new, start_new], y=[-0.1, 1.1], name=\"New start time\", line=dict(dash='dash')))\n", "fig.add_trace(go.Scatter(x=committed.index, y=committed.values, name=\"Committed status\", mode=\"lines+markers\"))\n", "fig.update_layout(xaxis_title=\"Time\", yaxis_title=\"On/off status\",title=f\"Commitment status of generator {gen.get_name()}\")\n", "fig.show()" ] }, { "cell_type": "markdown", "id": "7eb2133b", "metadata": {}, "source": [ "SHOP does not save the entire raw input time series that was set by the user, so changing the step size of the time resolution back and forth will result in a loss of precision. This is due to resampling an already resampled time series, but is mostly a problem when changing to a coarser time step size. The resampling also does not consider whether the data should be averaged, linearly interpolated, etc., the value at the start of the new time step is simply the value of the old time series at that point in time." ] } ], "metadata": { "jupytext": { "text_representation": { "extension": ".md", "format_name": "myst", "format_version": 0.13, "jupytext_version": "1.17.2" } }, "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.13.13" }, "source_map": [ 12, 22, 27, 31, 45, 49, 54, 58, 66, 70, 80, 86, 89, 93, 96, 100, 110, 114, 123 ] }, "nbformat": 4, "nbformat_minor": 5 }