Electricity Load

Problem Description

Forecasting electricity load is critical to many companies. For instance, it is fundamental input to operations of transmission system operators (TSOs), it is also important for industrial producers to balance their decisions on electricity procurement.

Data Recommendation Template

Load can be influenced by many factors, depending on prediction horizon, level of granularity etc. Let’s say that we want to predict load on hourly basis for particular region, or even whole country, for next day.

In such case understanding past consumption, socio-economic factors, and/or weather parameters that influences human/industrial activities are valid factors to be considered. From meteo predictors temperature, irradiation and cloudiness are recommended.

TIM can derive various information from timestamp in dataset – day of week, the fact if it is weekend, month. It cannot however understand if certain day was holiday, and so it is useful to provide such information within dataset.

TIM Setup

TIM requires no setup of TIM’s mathematical internals and works well with default values.

All that is required from a user is to let TIM know forecasting routine and desired prediction horizon. It is often the case that there are some seasonal patterns in time series, usually daily, monthly or yearly. These will be detected by TIM engine automatically if the WeekRest, PeriodicComponents and TimeOffsets dictionaries are turned on (by default they are).

Demo example

Data description

Dataset used in this example has hourly sampling rate and contains data from 2012-01-01 to 2014-12-31. Dataset can be downloaded here.

Target

Target variable represents hourly electricity load.

Predictor candidates

Following predictor candidates are used: temperature, cloudiness, irradiation, public holidays (as a binary value).

Forecasting scenario

We simulate day ahead scenario – each day at 8:20 we want to forecast target one day into the future.

We assume that values of all predictors are available till the end of the next day (end of prediction horizon), this means that predictors’ vectors are a combination of actual values and forecast values.

Last value of target is from previous day.

Model building and validation

Model is built using range of 2012-01-01 00:00:00 - 2013-12-31 23:00:00.

Out of sample forecasts are made on range 2014-01-01 00:00:00 - 2014-12-31 23:00:00.


Demonstration

TIM Studio

This section covers the use of TIM Studio to solve the challenge described above. Additional information regarding TIM Studio can be found here.

Select workspace

In the Workspaces screen, select the workspace in which the dataset should be added. If there is no available workspace, create one by clicking "Add Workspace".

Upload data

In the Datasets screen click on Add New Dataset. Stay in the tab CSV-File and insert name of the dataset. In this example, the dataset is called Electricity Load. Click "Browse" and select the dataset from the computer. Click "Add Dataset" to confirm.

Model building definition

Go to the Model Building Definition screen in the panel on the left. Click "Add New Definition" and fill in the desired definition name. In step 2, define the desired forecasting scenario. In this example, the model is used each day at 08:20. Therefore, leave all Weekdays checked on. Then, set Hour ranges to 8 and minutes to 20, leave Seconds ranges at 00. Since forecasts are to be made only for next day, set "Forecast from" to Day with offset 1 and set "Forecast to" to Day with offset 1. Look into the section about the relative time notation to learn more about this.

Click "Next" to advance to the next step. It is also possible to already finalize all settings at this point, in which case everything else would be set up automatically. In this example, some more changes will be made to the data updates in the third step. The target variable, Load, is updated each day at 05:00. Click on the small arrow next to Load and change the settings of this variable. Leave all Weekdays ranges checked on. Set Hour ranges to 5 and leave Minutes ranges and Seconds ranges at 00. Then, set "Update until" to Day with offset -1, since the target variable is updated until the end of previous day.

Similar settings of data updates is needed also for predictors.

Predictors are updated at the same time as target, therefore, set the "Update when" same as for target variable. Then, set the "Update until" to Day with offset 1, they are updated until the end of forecasting horizon.

Click "Next" to advance to step 4. Here, training regions can be selected, however, as we will set the model building interval (in sample interval) in Experiments screen, choice in this screen does not matter a lot, it is important for models built for (regular) Forecasting.

In this fifth step, the mathematical settings can be changed. We can leave it in default configuration and click "Finalize" to complete the model building definition.

Experiments

Click "Experiments" in the panel on the left to move on to back-testing. Then, click "Make experiment" next to the correct model building definition (Load_MBD).

Click "Build Model" and select the appropriate training range, i.e. 2012-01-01 00:00:00 - 2013-12-31 23:00:00.

The in-sample prediction as well as the Model Tree Map become visible.

Click "Validate model" and select the correct Out-of-sample period for back-testing, i.e. 2014-01-01 01:00:00 - 2014-12-31 23:00:00.

This generates the aggregated forecasts for D+1.

TIM Connector

This section covers the use of TIM Connector to solve the challenge described above. Additional information regarding TIM Connector can be found in the respective section.

1. Download TIM Connector

You can find download links in TIM Connector's section.

2. Create folder with dataset

Create a folder (e.g. Load) with the dataset-file [data.csv] and the configuration file [conf.yaml].

The conf.yaml-file defines the forecasting scenario, in this case the one described above. An exemplary configuration YAML-file is shown below; under this example the different aspects of the file are explained in more detail.

Configuration: The model is used repeatedly each day at 8:20. Forecasts are made for each hour of the next day.

Forecasting: Out-of-sample forecasts are made on the range from 2014-01-01 00:00:00 to 2014-12-31 23:00:00.

Model building: Model building in this example considers the range from 2012-01-01 00:00:00 to 2013-12-31 23:00:00.

The target is named Load and is updated at 05:20 with values until last hour of previous day (23:00).

Predictor’s values are available until end of prediction horizon, which is default expectation of TIM engine, hence it is not required to explicitly define this in YAML file. Our forecasting routine is quite simple, once per day forecast next day values, just a few hours after data update, and values are available for all timestamps of prediction horizon, so potentially we could skip definition of updateTime per each predictor and rely on default expectation of TIM engine (expectation that data is updated at the time of forecasting request), nevertheless for complex routines, TIM requires you to set it up properly in order to make multi-situational layer generate sub models the right way.

The content of the exemplary YAML configuration file is shown below:

version: "1.0"
type: Forecasting

modelBuilding:
  data:
    rows:
    - from: 2012-01-01 00:00:00
      to:   2013-12-31 23:00:00
    updates:
    - uniqueName: Load
      updateUntil:
        baseUnit: Day
        offset: -1
      updateTime:
      - type: Day
        value: "*"
      - type: Hour
        value: "5"
      - type: Minute
        value: "0"
    - uniqueName: Temperature
      updateTime:
      - type: Day
        value: "*"
      - type: Hour
        value: "5"
      - type: Minute
        value: "0"
- uniqueName: Irradiation
      updateTime:
      - type: Day
        value: "*"
      - type: Hour
        value: "5"
      - type: Minute
        value: "0"
- uniqueName: Cloudiness
      updateTime:
      - type: Day
        value: "*"
      - type: Hour
        value: "5"
      - type: Minute
        value: "0"
- uniqueName: PublicHolidays
      updateTime:
      - type: Day
        value: "*"
      - type: Hour
        value: "5"
      - type: Minute
        value: "0"
  configuration:
    usage:
      usageType: Repeating
      usageTime:
      - type: Day
        value: "*"
      - type: Hour
        value: "8"
      - type: Minute
        value: "20"
      predictionFrom:
        baseUnit: Day
        offset: 1
      predictionTo:
        baseUnit: Day
        offset: 1
forecasting:
  configuration:
    predictionScope:
      type: Ranges
      ranges:
      - from: 2014-01-01 00:00:00
        to:   2014-12-31 23:00:00
3. Call connector from the command line

Using a terminal, change the current directory to TIM Connector's builddir with the command: > cd pathToConnector\builddir. Then, call the connector with the following command: > pathToConnector\timconnect.exe path\to\Load\conf.yaml.

4. Fill in user credentials

Following the previous command, the user will be prompted to fill in their user credentials. Fill in the correct information and click "OK" to continue.

Output in folder: Predictions: Report/timeStamp/conf/prediction.csv

Errors: Report/timeStamp/conf/accuracy.txt