This report aims to analyze the prices of Energy Exchange of Turkey via using R programming language. Dplyr and ggplot2 packages were used for this aim.To get more information about these packages you can visit the tidyverse.org. You can reach the data from here.
library(tidyverse)
library(lubridate)
library(readxl)
ptf_smf_data<-read_excel("ptf-smf.xls")
data<- ptf_smf_data%>%
mutate(Date=as_datetime(dmy_hm(Date)),MCP=as.numeric(MCP),SMP=as.numeric(SMP),`Positive Imbalance Price (TL/MWh)`=as.numeric(`Positive Imbalance Price (TL/MWh)`),`Negative Imbalance Price (TL/MWh)`=as.numeric(`Negative Imbalance Price (TL/MWh)`))
glimpse(data)
## Rows: 744
## Columns: 6
## $ Date <dttm> 2020-07-01 00:00:00, 2020-07-01 …
## $ MCP <dbl> 323.85, 326.95, 324.31, 322.11, 3…
## $ SMP <dbl> 211.00, 201.00, 211.00, 211.00, 2…
## $ `Positive Imbalance Price (TL/MWh)` <dbl> 204.67, 194.97, 204.67, 204.67, 1…
## $ `Negative Imbalance Price (TL/MWh)` <dbl> 333.57, 336.76, 334.04, 331.77, 3…
## $ `SMP Direction` <chr> "↓Energy Surplus", "↓Energy Surpl…
summary(data)
## Date MCP SMP
## Min. :2020-07-01 00:00:00 Min. :140.0 Min. : 10.0
## 1st Qu.:2020-07-08 17:45:00 1st Qu.:300.0 1st Qu.:250.0
## Median :2020-07-16 11:30:00 Median :306.6 Median :320.0
## Mean :2020-07-16 11:30:00 Mean :296.4 Mean :299.3
## 3rd Qu.:2020-07-24 05:15:00 3rd Qu.:317.0 3rd Qu.:345.0
## Max. :2020-07-31 23:00:00 Max. :350.0 Max. :460.0
## Positive Imbalance Price (TL/MWh) Negative Imbalance Price (TL/MWh)
## Min. : 9.7 Min. :144.2
## 1st Qu.:228.2 1st Qu.:312.9
## Median :293.4 Median :331.9
## Mean :268.6 Mean :328.3
## 3rd Qu.:304.1 3rd Qu.:355.4
## Max. :339.5 Max. :473.8
## SMP Direction
## Length:744
## Class :character
## Mode :character
##
##
##
1. SMP Direction Pie Chart
deficit_or_surplus<-data%>%
count(`SMP Direction`)
deficit_or_surplus
## # A tibble: 3 x 2
## `SMP Direction` n
## <chr> <int>
## 1 ↑ Energy Deficit 528
## 2 ↓Energy Surplus 195
## 3 ↔ In Balance 21
ggplot(deficit_or_surplus,aes(x="",y=n,fill=`SMP Direction`))+geom_bar(stat = "identity")+coord_polar("y",start=0)+theme(axis.title.x = element_blank(),axis.title.y = element_blank())+ggtitle("SMP Directions")
SMP Directions show that there is an energy deficit around 70% of time intervals. That means energy consumption is higher generally than the forecast.
2. Line Plots for Average Prices
by_day<- data%>%
group_by(day=day(Date)) %>%
summarise(average_MCP=mean(MCP),average_SMP=mean(SMP),average_PIP=mean(`Positive Imbalance Price (TL/MWh)`),average_NIP=mean(`Negative Imbalance Price (TL/MWh)`))
## `summarise()` ungrouping output (override with `.groups` argument)
ggplot(by_day,aes(x=day,y=average_MCP))+geom_line()+ggtitle("Average Daily Market Clearing Price")
ggplot(by_day,aes(x=day,y=average_SMP))+geom_line()+ggtitle("Average Daily System Marginal Price")
ggplot(by_day,aes(x=day,y=average_PIP))+geom_line()+ggtitle("Average Daily Positive Imbalance Price")
ggplot(by_day,aes(x=day,y=average_NIP))+geom_line()+ggtitle("Average Daily Negative Imbalance Price")
Average price plots show that the prices fluctuate over time. However, at the end of the month, prices were lower than the beginning prices.
ggplot(by_day)+geom_line(aes(x=day,y=average_MCP,color="average_MCP"))+geom_line(aes(x=day,y=average_SMP,color="average_SMP"))+labs(x="Day",y="Average MCP and SMP")+ ggtitle("Average Daily MCP vs Average Daily SMP")
“Average Daily MCP vs Average Daily MCP” graph shows taht Market Clearing Prices(MCP) are more stable than the System Marginal Prices(SMP). Since MCP values are determined one day before, they are more stable. However SMP values are determined during the day and it fluactes due to energy defecits or energy surplus. SMP is higher than MCP when there is an energy defecit and lower when there is an energy surplus.
ggplot(by_day)+geom_line(aes(x=day,y=average_PIP,color="average_PIP"))+geom_line(aes(x=day,y=average_NIP,color="average_NIP"))+labs(x="Day",y="Average PIP and NIP")+ ggtitle("Average Daily PIP vs Average Daily NIP")
“Average Daily PIP vs Average Daily NIP” graph shows that Negative Imbalance Prices(NIP) are always higher than the Positive Imbalance Prices(PIP). This means energy deficit is penalized more severly than the energy surplus.