\documentclass[12pt,a4paper,faculty=ea,language=en,doctype=article]{ugent-doc}

% Optional: margins and spacing
%-------------------------------
% Uncomment and adjust to change the default values set by the template
% Note: the defaults are suggested values by Ghent University
%\geometry{bottom=2.5cm,top=2.5cm,left=3cm,right=2cm} 
%\renewcommand{\baselinestretch}{1.15} % line spacing

% Font
%------
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc} % allows non-ascii input characters
% Comment or remove the two lines below to use the default Computer Modern font
\usepackage{libertine}
\usepackage{libertinust1math}
\usepackage{enumitem}
% NOTE: because the UGent font Panno is proprietary, it is not possible to use it
% in Overleaf. But UGent does not suggest to use Panno for documents (or maybe only for
% the titlepage). For the body, the UGent suggestion is to use a good serif font (for
% LaTeX this could be libertine or Computer Modern).

% Proper word splitting
%-----------------------
\usepackage[english]{babel} 

% Mathematics
%-------------
\usepackage{amsmath}

% Figures
%---------
\usepackage{graphicx} % optional: the package is already loaded by the template
\graphicspath{{./figures/}}

% Bibliography settings
%-----------------------
\usepackage[backend=biber, style=apa, sorting=nyt, hyperref=true]{biblatex}
\addbibresource{./references.bib}
\usepackage{csquotes} % Suggested when using babel+biblatex

% Hyperreferences
%-----------------
\usepackage[colorlinks=true, allcolors=ugentblue]{hyperref}

% Whitespace between paragraphs and no indentation
%--------------------------------------------------
\usepackage[parfill]{parskip} 

% Input for title page
%----------------------

% The title
\thesubtitle{February Intermediate Report}

%% Note: a stricter UGent style could be achieved with, e.g.:
\usepackage{ulem} % for colored underline
\renewcommand{\ULthickness}{2pt} % adjust thickness of underline
\thetitle{Forecasting and generative modeling of the Belgian electricity market}
% Note: do not forget to reset the \ULthickness to 1pt after invoking \maketitle
% (otherwise all underlines in the rest of your document will be too thick):
%\renewcommand{\ULthickness}{1pt}

% The first (top) infobox at bottom of titlepage
\infoboxa{\bfseries\large Master Thesis}

% The second infobox at bottom of titlepage
\infoboxb{Name: 
\begin{tabular}[t]{l}
    Victor Mylle
\end{tabular}
}

% The third infobox at bottom of titlepage
\infoboxc{
    Promotors:
    \begin{tabular}[t]{l}
        prof. dr. ir. Chris Develder \\
        prof. Bert Claessens
    \end{tabular}
    \\\\
    Supervisor: 
    \begin{tabular}[t]{l}
        Jonas Van Gompel
    \end{tabular}
}

% The last (bottom) infobox at bottom of titlepage
\infoboxd{Academic year: 2023--2024} % note dash, not hyphen


\begin{document}

% =====================================================================
% Cover
% =====================================================================

% ------------ TITLE PAGE ---------
\maketitle
\renewcommand{\ULthickness}{1pt}

% =====================================================================
% Front matter
% =====================================================================

% ------------ TABLE OF CONTENTS ---------
% {\hypersetup{hidelinks}\tableofcontents} % hide link color in toc
% \newpage
% \begin{titlepage}

%     \centering % Centers everything on the page
    
%     % Logo or Image (Optional)
%     % \includegraphics[width=0.5\textwidth]{path_to_logo.jpg} 

%     \vspace*{2cm} % Add vertical space

%     {\large Title: Forecasting and generative modeling of the Belgian electricity market\par}
    
%     \vspace{2cm}
%     {\Large Victor Mylle\par}
    
%     \vspace{1cm}
%     {\large Period of Internship: 3 July 2023 - 31 August 2023\par}
    
%     \vspace{1cm}
%     {\large Mentor: dr. ir. Femke De Backere\par}
%     {\large TechWolf supervisor: ir. Jens-Joris Decorte}
    
% \end{titlepage}

\newpage

\section{Intermediate Results}

\subsection{Net Regulation Volume Moddeling}
Using a generative model, we try to predict the NRV for the next day. The model is trained on historical data and uses multiple input features to model the NRV. The data for the input features can all be downloaded from \href{https://www.elia.be/en/grid-data/open-data}{Elia Open Data}.

\subsubsection{Input Features}
The generative model uses multiple input features to predict the NRV.

\begin{itemize}[noitemsep]
    \item NRV History (NRV of yesterday)
    \item Load Forecast (Forecasted load of tomorrow)
    \item Load History (Load of yesterday)
    \item Wind Forecast (Forecasted wind of tomorrow)
    \item Wind History (Wind of yesterday)
    \item Implicit net position  (Nominal net position of tomorrow)
    \item Time features (Day of the week + quarter of the day)
    \item Photovoltaic Forecast\textsuperscript{*}
    \item Photovoltaic History\textsuperscript{*}
\end{itemize}
\textsuperscript{*} These features are not used currently, the data was not available. These features can easily be added without changing any code. 

\subsubsection{Models}
In the intermediate report of November, baselines were discussed. Now, other more advanced models are used. Samples must be generated using the model, this means the model can't just output one value but a distribution is needed. Quantile Regression can be used for this task. The model then outputs the values of multiple quantiles. For example, the model outputs the value for which 10\% of the data is lower, the value for which 50\% of the data is lower, etc. This way, the model outputs a distribution which can be used to sample from. The NRV predicitons are done in a quarter-hourly resolution. To predict the NRV for the next day, 96 values need to be sampled. This can be done in an autoregressive manner. The model outputs the quantiles for the first quarter-hour, a sample is drawn from this distribution and this sample is used as input for the next quarter-hour. This process is repeated 96 times.

\begin{table}[h]
    \centering
    \begin{tabular}{lcc}
    \hline
    \textbf{Model} & \textbf{test\_L1Loss} & \textbf{test\_CRPSLoss} \\
    \hline
    Linear Model & 101.639 & 68.485 \\
    Non Linear Model & 102.031 & 68.968 \\
    LSTM/GRU Model & 104.261 & 66.052 \\
    \hline
    \end{tabular}
    \caption{Performance of Autoregressive Models}
    \label{tab:general_models}
\end{table}

At the moment, I am experimenting with a diffusion model to generatively model the NRV but more research and expermimenting needs to be done.

\subsubsection{Charging Policy}
Using the predicted NRV, a policy can be implemented to charge and discharge a battery. The goal of the policy is to maximize the profit made by selling the stored electricity. A simple policy is implemented to charge and discharge the battery based on 2 thresholds determined by the predicted NRV. The policy is evaluated on historical data and the profit is calculated. To determine the charge and discharge threshold, 1000 full NRV predictions are done for the next day and for each of these predicitions, the thresholds are determined. Next, the mean of these thresholds is used as the final threshold.

\begin{table}[h]
    \centering
    \begin{tabular}{lccc}
    \hline
    \textbf{Policy} & \textbf{Total Profit (€)} & \textbf{Charge Cycles} \\
    \hline
    Baseline (charge: 150, discharge: 175) & 251,202.59 & 725 \\
    Baseline (yesterday imbalance price) & 342,980.09 & 903 \\
    GRU Predicted NRV (mean thresholds) & 339,846.91 & 842 \\
    Diffusion Predicted NRV (mean thresholds) & 338,168.03 & 886 \\
    \hline
    \end{tabular}
    \caption{Comparison of Energy Storage Policies Using Predicted NRV. Battery of 2MWh with 1MW charge/discharge power. Evaluated on data from 01-01-2023 until 08-10-2023.}
    \label{table:energy_storage_policies}
\end{table}

The recommended charge cycles for a battery are <400 cycles per year. The policy also needs to make the charge cycles are below 400. A penalty parameter can be introduced and determined so that the policy is penalized for every charge cycle above 400. The policy can then be optimized using this penalty parameter. I am currenlty experimenting with this.

\newpage
\section{Schedule next months}

\end{document}

