library(tidyverse)
library(lubridate)
library(readxl)
library(dplyr)
library(ggplot2)

Preparation and Understanding of The Dataset

In this work, The Data of “Istanbul’s Electricity Market” which is produced by EPIAS for the period of September 20’ is analyzed. You can download it from here

The details of work can be seen at the code chunk which is written below. During the analyze there are four steps which is tried to be succeed.

1- Understanding and preparing of the data for being analyzed

2- Deciding of which graphs are best suitable for data

3-What is the main idea of data?

4-Explaining the output of analyze

data_epias<- read_xls("C:/Users/bsivas/Desktop/BDA/Big_Data_Analysis/Electricity_Prices/ptf-smf (2).xls",
                      n_max = 721)
dt<- data_epias %>% select(Date,MCP,SMP,SMP.Direction = "SMP Direction")
dt$Date<-as.POSIXct(dt$Date,format="%d.%m.%y %H:%M")
dt$MCP<- as.double(sub(",","", dt$MCP))
dt$SMP<- as.double(sub(",","",dt$SMP))
dt
## # A tibble: 720 x 4
##    Date                  MCP   SMP SMP.Direction   
##    <dttm>              <dbl> <dbl> <chr>           
##  1 2020-09-01 00:00:00  302.  332. ^ Energy Deficit
##  2 2020-09-01 01:00:00  300.  325. ^ Energy Deficit
##  3 2020-09-01 02:00:00  293.  318. ^ Energy Deficit
##  4 2020-09-01 03:00:00  290   320  ^ Energy Deficit
##  5 2020-09-01 04:00:00  290   330  ^ Energy Deficit
##  6 2020-09-01 05:00:00  290   339  ^ Energy Deficit
##  7 2020-09-01 06:00:00  292.  342. ^ Energy Deficit
##  8 2020-09-01 07:00:00  295.  345  ^ Energy Deficit
##  9 2020-09-01 08:00:00  307.  339. ^ Energy Deficit
## 10 2020-09-01 09:00:00  315.  346. ^ Energy Deficit
## # ... with 710 more rows
glimpse(dt)
## Rows: 720
## Columns: 4
## $ Date          <dttm> 2020-09-01 00:00:00, 2020-09-01 01:00:00, 2020-09-01...
## $ MCP           <dbl> 302.39, 300.25, 292.64, 290.00, 290.00, 290.00, 292.0...
## $ SMP           <dbl> 332.39, 325.25, 317.64, 320.00, 330.00, 339.00, 342.0...
## $ SMP.Direction <chr> "^ Energy Deficit", "^ Energy Deficit", "^ Energy Def...

What are the definitions of “MCP & SMP”?

“MCP” is abbrev for Market Clearing Price and also “SMP” is abbrev for System Marginal Price. MCP is defined on everday according to the orders of consumers and all orders should be given until to the midnight. On the other hand SMP is defined as a single price per hour is reported as a result of balancing.

As you can see from the boxplot which is given at below, SMP has a wider range than MCP because of the changeable last minute sales.

summary(dt)
##       Date                          MCP             SMP        
##  Min.   :2020-09-01 00:00:00   Min.   :198.4   Min.   : 129.0  
##  1st Qu.:2020-09-08 11:45:00   1st Qu.:292.7   1st Qu.: 275.0  
##  Median :2020-09-15 23:30:00   Median :305.1   Median : 320.0  
##  Mean   :2020-09-15 23:30:00   Mean   :308.2   Mean   : 323.4  
##  3rd Qu.:2020-09-23 11:15:00   3rd Qu.:314.9   3rd Qu.: 351.3  
##  Max.   :2020-09-30 23:00:00   Max.   :982.0   Max.   :2000.0  
##  SMP.Direction     
##  Length:720        
##  Class :character  
##  Mode  :character  
##                    
##                    
## 
dt %>% 
  pivot_longer(cols = c(MCP, SMP), names_to = "PriceTag")%>%
  ggplot(aes(x=PriceTag, y=value, fill=PriceTag)) +
  geom_boxplot() +
  theme_test() +
  labs(title = "MCP & SMP in Boxplot", y = "Price")+
  scale_y_continuous(breaks=seq(0, 1300, 300))

Definition of The Balancing Power Market

Electricity markets are designed with “balance” in mind. Balance means electricity production should be equal to electricity consumption as much as possible at all times.

If there is a system-wide need for extra electricity production (i.e. actual demand > predicted demand), then it is called an Enerji Deficit (Enerji Açığı). If the situation is the opposite (i.e. actual demand < predicted demand), then it is called an Energy Surplus (Enerji Fazlası).

According to the geom_point graph it can be declared that Energy surplus is more common between 9.00 am to 15.00 pm in a weekday probably due to the production time table.

ggplot(dt, aes(x = hour(Date), y = day(Date), color = SMP.Direction)) +
  geom_point(position = "identity") +
  scale_color_manual(values=c("blue", "red", "green")) +
  labs(title = "Graph of The Balancing Power Market Distribution in September")+
  scale_y_continuous(breaks=seq(0,32,7))

Comparison of The Hourly Price Tags

When we look at the numbers of average prices in a day along with the hours, almost all day SMP prices is higher that the MCP prices as we expect. The numbers start at around 7.00 am then it keeps rising until 16.00 pm which is also peak number of the day.

dt %>% 
  group_by(HourofDay = hour(Date)) %>% 
  summarise("MCP average" = mean(MCP), "SMP average" = mean(SMP)) %>% 
  pivot_longer(cols=c("MCP average", "SMP average"), names_to="PriceTag")%>%
  ggplot(aes(x=HourofDay, y=value, color=PriceTag)) + 
  geom_line(size=1.1) + 
  theme_test() + 
  labs(x="Hour of Day", y="Price", title = "Comparison of Hourly Price Tags") + 
  theme(legend.position="right")+
  scale_x_continuous(breaks=seq(0,23,1))+
  scale_y_continuous(breaks=seq(0,500,50))

Conclusion

To sum up, nearly more than %50 percent of time there is a Energy surplus. Besides, on the weekends the percentage of energy deficit is getting higher. Commonly the average of the MCP is less than the average of the SMP prices(especially between 8.00 am- rest of day).

Living quarters start to use lightening after the evening. However, the result of this report shows that electricity usage in industry is more dominant than living spaces.