From the examples derive the mathematical models:
\documentclass{article}
\usepackage{graphicx} % Required for inserting images
\usepackage{amsmath}
\usepackage{siunitx} % For proper unit formatting

\title{Round Trip Time (RTT) Analysis in Mobile-Cloud-Collar Communication}
\author{Pedro Soares}
\date{October 2024}

\begin{document}

\maketitle

\section{Mathematical Simulation Analysis}

\subsection{Parameters}
\begin{itemize}
    \item Mobile Send Rate (\(R_m\)): The interval at which the mobile device sends a message.
    \item Tolerance (\(T\)): The time buffer to handle processing delays and variability.
    \item Processing Delay (\(D_p\)): The combined delay between message generation and evaluation, both on the cloud and collar side.
    \item Future Timestamp (\(t_{\text{future}}\)): Indicates the future time when the RTT will expire unless refreshed by another message.
\end{itemize}


\subsection{Example 1: Mobile send rate 5 seconds}
Given:
\begin{itemize}
    \item Mobile Send Rate (\(R_m\)): \SI{5}{\second}
    \item Tolerance (\(T\)): \SI{15}{\second}
    \item Processing Delay (\(D_p\)): \SI{5}{\second}
    \item Future Timestamp (\(t_{\text{future}}\)): \SI{60}{\second} from the current time
\end{itemize}

\subsubsection{Worst-case Scenario Analysis}
Consider the following sequence of events:

\begin{enumerate}
    \item User triggers an action that will send a message from mobile when RTT timestamp will expire in \SI{18}{\second}.
    \item Cloud evaluates sending the message when RTT timestamp will expire in \SI{15.5}{\second} (after \SI{2.5}{\second} of processing).
    \item Since \SI{15.5}{\second} \geq \(T\) (\SI{15}{\second}), the message is not sent, and the mobile timer resets to \SI{5}{\second}.
    \item After \SI{5}{\second}, cloud receives a new message when RTT timestamp will expire in \SI{13}{\second}.
    \item Cloud evaluates this message when RTT timestamp will expire in \SI{10.5}{\second} (after \SI{2.5}{\second} of processing).
    \item Since \SI{10.5}{\second} \leq \(T\) (\SI{15}{\second}), a message is sent to the collar.
    \item Message reaches the collar when RTT timestamp will expire in \SI{8}{\second}, refreshing the RTT timestamp.
\end{enumerate}

In this case, the maximum interval at which the collar will receive messages is \SI{40}{\second} (\(t_{\text{future}} - T = 60 - 15 - 5 = 40\)).

\subsection{Example 2: Mobile send rate 45 seconds}
Given:
\begin{itemize}
    \item Mobile Send Rate (\(R_m\)): \SI{45}{\second}
    \item Tolerance (\(T\)): \SI{55}{\second}
    \item Processing Delay (\(D_p\)): \SI{5}{\second}
    \item Future Timestamp (\(t_{\text{future}}\)): \SI{100}{\second} from the current time
\end{itemize}

\subsubsection{Worst-case Scenario Analysis}
Consider the following sequence of events:

\begin{enumerate}
    \item User triggers an action that will send a message from mobile when RTT timestamp will expire in \SI{58}{\second}.
    \item Cloud evaluates sending the message when RTT timestamp will expire in \SI{55.5}{\second} (after \SI{2.5}{\second} of processing).
    \item Since \SI{55.5}{\second} \geq \(T\) (\SI{55}{\second}), the message is not sent, and the mobile timer resets to \SI{45}{\second}.
    \item After \SI{45}{\second}, cloud receives a new message when RTT timestamp will expire in \SI{13}{\second}.
    \item Cloud evaluates this message when RTT timestamp will expire in \SI{10.5}{\second} (after \SI{2.5}{\second} of processing).
    \item Since \SI{10.5}{\second} \leq \(T\) (\SI{55}{\second}), a message is sent to the collar.
    \item Message reaches the collar when RTT timestamp will expire in \SI{8}{\second}, refreshing the RTT timestamp.
\end{enumerate}

In this case, the maximum interval at which the collar will receive messages is \SI{52}{\second} (\(t_{\text{future}} - T = 100 - 55 - 5 = 40\)).


\subsection{Example 3: Mobile send rate 45 seconds but collar receives at max 1 message every 60 seconds}
Given:
\begin{itemize}
    \item Mobile Send Rate (\(R_m\)): \SI{45}{\second}
    \item Tolerance (\(T\)): \SI{55}{\second}
    \item Processing Delay (\(D_p\)): \SI{5}{\second}
    \item Future Timestamp (\(t_{\text{future}}\)): \SI{120}{\second} from the current time
\end{itemize}

\subsubsection{Worst-case Scenario Analysis}
Consider the following sequence of events:

\begin{enumerate}
    \item User triggers an action that will send a message from mobile when RTT timestamp will expire in \SI{58}{\second}.
    \item Cloud evaluates sending the message when RTT timestamp will expire in \SI{55.5}{\second} (after \SI{2.5}{\second} of processing).
    \item Since \SI{55.5}{\second} \geq \(T\) (\SI{55}{\second}), the message is not sent, and the mobile timer resets to \SI{45}{\second}.
    \item After \SI{45}{\second}, cloud receives a new message when RTT timestamp will expire in \SI{13}{\second}.
    \item Cloud evaluates this message when RTT timestamp will expire in \SI{10.5}{\second} (after \SI{2.5}{\second} of processing).
    \item Since \SI{10.5}{\second} \leq \(T\) (\SI{55}{\second}), a message is sent to the collar.
    \item Message reaches the collar when RTT timestamp will expire in \SI{8}{\second}, refreshing the RTT timestamp.
\end{enumerate}

In this case, the maximum interval at which the collar will receive messages is \SI{60}{\second} (\(t_{\text{future}} - T = 120 - 55 - 5 = 60\)).

\end{document}