I will analyze electricity price of EPIAS 01 july 2020 to 31 july 2020 in this report.The data can be downloaded from here
library(tidyverse)
library(lubridate)
library(readr)
library(dplyr)
library(ggplot2)
library(knitr)
I imported data to here to analyze.I called it as electricity_data1 and I use glimpse() function to observe data.
electricity_data1 = read.csv("electricity.csv")
electricity_data1 %>% glimpse()
## Rows: 744
## Columns: 6
## $ Tarih <chr> "01.07.20 00:00", "01.07.20 01:...
## $ PTF <chr> "323,85", "326,95", "324,31", "...
## $ SMF <chr> "211,00", "201,00", "211,00", "...
## $ Pozitif.Dengesizlik.Fiyatı..TL.MWh. <chr> "204,67", "194,97", "204,67", "...
## $ Negatif.Dengesizlik.Fiyatı..TL.MWh. <chr> "333,57", "336,76", "334,04", "...
## $ SMF.Yön <chr> "?Enerji Fazlası", "?Enerji Faz...
I saw that column’s names are not proper and data type is string after glimpse() function. Therefore, I found new name for unproper columns and changed their name.I also added 3 new column to analyze data in terms of date.
electricity_data1$PTF = as.numeric(gsub(",", ".", electricity_data1$PTF))
electricity_data1$SMF = as.numeric(gsub(",", ".", electricity_data1$SMF))
electricity_data1$Pozitif.Dengesizlik.Fiyatı..TL.MWh. = as.numeric(gsub(",", ".", electricity_data1$Pozitif.Dengesizlik.Fiyatı..TL.MWh. ))
electricity_data1$Negatif.Dengesizlik.Fiyatı..TL.MWh. = as.numeric(gsub(",", ".", electricity_data1$Negatif.Dengesizlik.Fiyatı..TL.MWh.))
electricity_data2 <- electricity_data1 %>%
rename("MCP" = PTF,
"SMP" = SMF,
"Positive Imbalance Price" = Pozitif.Dengesizlik.Fiyatı..TL.MWh.,
"Negative Imbalance Price" = Negatif.Dengesizlik.Fiyatı..TL.MWh.,
"SMP Direction" = SMF.Yön,
"Date" = Tarih) %>%
mutate(DateTime = as.POSIXct(Date, format = "%d.%m.%y %H:%M")) %>%
mutate(Day = wday(DateTime, label = T, week_start = 1), Hour = hour(DateTime))
electricity_data2 %>% glimpse()
## Rows: 744
## Columns: 9
## $ Date <chr> "01.07.20 00:00", "01.07.20 01:00", "01....
## $ MCP <dbl> 323.85, 326.95, 324.31, 322.11, 320.00, ...
## $ SMP <dbl> 211.00, 201.00, 211.00, 211.00, 201.00, ...
## $ `Positive Imbalance Price` <dbl> 204.67, 194.97, 204.67, 204.67, 194.97, ...
## $ `Negative Imbalance Price` <dbl> 333.57, 336.76, 334.04, 331.77, 329.60, ...
## $ `SMP Direction` <chr> "?Enerji Fazlası", "?Enerji Fazlası", "?...
## $ DateTime <dttm> 2020-07-01 00:00:00, 2020-07-01 01:00:0...
## $ Day <ord> Çar, Çar, Çar, Çar, Çar, Çar, Çar, Çar, ...
## $ Hour <int> 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12...
After changes on dataset, I wanted to observe distribution of MCP and SMP on table and compare them properly.This scatterplot show that SMP are placed on more intensivly than MCP at high level(300-400).We can say that difference between Day Ahead Market and Balancing Power Market is natural result of this deficit or surplus.
ggplot(electricity_data2, aes(x = SMP, y = MCP, color = DateTime)) +
geom_point() +
labs(title = "Distribution of MCP anmcd SMP", subtitle = "July 2020", x = "System Marginal Price", y = "Market Clearing Price")
# Market Cleaning Price I determined daily and hourly avarage Mcp to make observation on graph and compare days and hours in terms of price.I can say that price is fallen on weekend,because many people work on these days and increase usage of electricity. Also we can see that people use the most amount of electricity before sleeping (20-21) and the least amount of electricity before work(6-7).
daily_mcp = electricity_data2 %>%
group_by(Day) %>%
summarise(avg_mcp = mean(MCP), .groups = 'drop')
daily_mcp %>% kable()
Day | avg_mcp |
---|---|
Pzt | 302.0398 |
Sal | 298.8338 |
Çar | 306.9160 |
Per | 297.0389 |
Cum | 299.2423 |
Cmt | 291.8207 |
Paz | 275.0998 |
ggplot(daily_mcp, aes(x=Day, y= avg_mcp)) +
geom_col()+
labs(x = "Week Days",
y = "Average MCP",
title = "Average MCP for Days")
hourly_mcp = electricity_data2 %>%
group_by(Hour) %>%
summarise(avg_mcp=mean(MCP), .groups = 'drop')
kable(hourly_mcp)
Hour | avg_mcp |
---|---|
0 | 297.3552 |
1 | 305.8410 |
2 | 298.1139 |
3 | 284.3048 |
4 | 284.8490 |
5 | 246.7165 |
6 | 213.3771 |
7 | 268.8835 |
8 | 294.5987 |
9 | 288.2713 |
10 | 300.7368 |
11 | 305.1348 |
12 | 297.5416 |
13 | 304.1765 |
14 | 311.8487 |
15 | 312.6694 |
16 | 312.4710 |
17 | 310.6632 |
18 | 308.5587 |
19 | 310.3419 |
20 | 316.6100 |
21 | 316.9803 |
22 | 314.4574 |
23 | 308.1403 |
ggplot(hourly_mcp,aes(x= Hour,y=avg_mcp)) +
geom_line(size=1.1) +
expand_limits(y = 0) +
labs(x="hours",
y="avarage MCP",
title="Avarage MCP for hours")
We can say that providers can predict usage od electricit more accurately after two days of weekdays.Therefore Wednesday is the least price of week.Also I decide that price decreased at night especially at 6 and 7.
daily_smp = electricity_data2 %>%
group_by(Day) %>%
summarise(avg_smp = mean(SMP), .groups = 'drop')
daily_smp %>% kable()
Day | avg_smp |
---|---|
Pzt | 316.7281 |
Sal | 314.4270 |
Çar | 275.7717 |
Per | 300.8255 |
Cum | 294.4326 |
Cmt | 310.8506 |
Paz | 289.1030 |
ggplot(daily_smp, aes(x=Day, y= avg_smp)) +
geom_col()+
labs(x = "Week Days",
y = "Average SMP",
title = "Average SMP for Days")
hourly_smp = electricity_data2 %>%
group_by(Hour) %>%
summarize(avg_smp = mean(SMP), .groups = 'drop')
kable(hourly_smp)
Hour | avg_smp |
---|---|
0 | 294.3274 |
1 | 307.5423 |
2 | 297.3471 |
3 | 282.9535 |
4 | 280.0355 |
5 | 248.3558 |
6 | 213.1577 |
7 | 259.9181 |
8 | 277.5932 |
9 | 290.9119 |
10 | 290.9277 |
11 | 307.3297 |
12 | 298.2952 |
13 | 308.3671 |
14 | 328.8610 |
15 | 329.8229 |
16 | 330.9177 |
17 | 328.4894 |
18 | 325.7868 |
19 | 324.4110 |
20 | 312.6990 |
21 | 326.6026 |
22 | 316.3365 |
23 | 303.2048 |
ggplot(hourly_smp,aes(x= Hour,y=avg_smp)) +
geom_line(size=1.1) +
expand_limits(y = 0) +
labs(x="hours",
y="avarage SMP",
title="Avarage SMP for hours")