\chapter*{An Advanced Approach Proposal: Conditional Integral Sliding Mode Controller}
\refstepcounter{chapter}
\label{chpt: Final Controller}
\addcontentsline{toc}{chapter}{Conditional Integral Sliding Mode Controller}

\textit{To overcome the conflicting limitations related to the baseline controllers of Chapter \ref{chpt: comparative design of baseline}, this section proposes a Conditional Integral Sliding Mode Control (CISMC) framework. The core philosophy of the CISMC approach lies in the continuous modulation of the robust switching term based on the instantaneous state trajectory distance from the sliding surface, while simultaneously an integral control term is conditionally activated to asymptotically eliminate residual steady-state tracking errors without risking integrator wind-up during large transient maneuvers. \\
This multi-layered approach ensures robust slip tracking while entirely mitigating the actuator chattering typically associated with traditional sliding mode implementations. \\
The controller design will be carried out by initially designing a sliding surface defining the desired closed-loop
behavior of the system. A stabilizing control law will then be derived assuming no parametric uncertainties.}

\newpage

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Control Architecture}
The deployment of this advanced nonlinear controller does not necessitate any modification to the external supervisory or physical plant layers. Specifically, the fundamental vehicle architecture, the geometric and mass parameters of the RWD electric platform, and the physical problem statement regarding optimal longitudinal tire-road friction utilization remain identical to those detailed for the baseline PI and TSMC implementations in the Sections \ref{sec: veh_architecture&parameters}, \ref{sec: problem_statement} and \ref{sec: general architecture}.

Furthermore, the general control architecture, including the feedback loops, the vehicle state observation layer, the reference slip estimation module, and the torque coordination logic for braking, is preserved in its entirety. This architectural consistency ensures a scientifically rigorous basis for comparison, isolating the evaluation of the powertrain response from external systemic variations. Consequently, the structural modification introduced in this section is confined exclusively to the internal control logic of the controller block itself, specifically reshaping how the tracking error is processed and how the motor torque command is mapped to reconcile robustness with actuator smoothness.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Sliding Surface Definition}
The sliding surface is formulated, according to integral sliding mode control theory, as a weighted sum of the state error ($\sigma_j - \sigma_{opt,j}$) and the integrated state error:
\begin{equation}\label{eq: slidingsurface_CISMC}
    s_j = e_j + K_1 \cdot \int_0^t e_j(\tau) d\tau - e_j(0)
\end{equation}
This  formulation offers two main advantages. First, it ensures that once the state trajectory is constrained to the $s_j = 0$, the tracking error is mathematically guaranteed to converge exponentially toward zero. Second, through the explicit structural inclusion of the initial condition $e_j(0)$, the controller completely eliminates the traditional reaching phase. This forces the sliding condition to be identically satisfied from the exact onset of the regulation window ($t = 0$), thereby guaranteeing absolute exponential error convergence from the very beginning of the control action, even in cases where the initial tracking error is non-zero ($e_j(0)\ne 0$) \cite{Slotine1991AppliedNC}.

In Eq. \eqref{eq: slidingsurface_CISMC}, $\tau$ is a dummy variable used for integration, while  $K_1$ is a constant positive gain determining the \textit{convergence rate} \cite{phillips2000feedback}:
\begin{align}
    e_j(t) &= e_j(0) \cdot e^{-K_1t} \label{eq: convergence rate} \\
    &\Rightarrow
    \begin{cases}
        \displaystyle \lim_{t \to \infty} e_j(t) = 0
        \\
        \displaystyle \int_0^t e_j(\tau) d\tau = e_j(0) \cdot \frac{1}{K_1} \ (1-e^{-K_1t})
    \end{cases}
\end{align}

The dynamics of the closed-loop slip control system therefore acts as a first order low pass filter with time constant equal to $1/K_1$.

%%%%%%%%%%%%%%%%%%%%
\section{Control Law}\label{sec: CISMC_ControlLaw}
The control law considered assumes no parameter uncertainty, and it's expressed as function of two unknown functions ($f$ and $g$) modeling the inverse dynamics of the plant \cite{wiben2012design}:
\begin{align}
    f \equiv f(\sigma_j, \omega_{driven, j})
    \\
    g \equiv g(\sigma_j, \omega_{driven, j})
\end{align}
The dynamics of the system is described as follow:
\begin{align}
    \displaystyle &\dot \sigma_j = f + g \cdot u_{Rj}
    \\
    \displaystyle &\dot s_j = \dot e_j + K_1\cdot e_j = \dot \sigma_j -\dot \sigma_{opt_j} + K_1 \cdot e_j 
\end{align}
This leads to the following expression of $\dot s$ as function of the control input $u$:
\begin{equation}
    \dot s_j = f + g\cdot u_{Rj} + K_1 \cdot e_j - \dot \sigma_{opt_j}
\end{equation}
Finally, the control input $u$:
\begin{equation}\label{eq: control_input_CISMC}
    u_{Rj} = -\frac{1}{g}\left(f+K_1\cdot e_j - \dot \sigma_{opt_j} - \dot s_j\right)
\end{equation}
where term $K_1\cdot e$ enforces the condition $s=0$ and $\dot s$ encompasses the discontinuous law forcing the system trajectories onto the sliding surface.

The output of the control logic, $u$, corresponds to a driving torque request at the wheel axle:
\begin{equation}
    T_{drive, Rj} = u_{Rj}
\end{equation}

The definition of slip dynamics ($\dot s$) for the CISM controller will be discussed in the next section (Section \ref{subsec: chattering solution}), where an alternative formulation of Eq. \ref{eq: dot_s_TSMC} will be proposed as a solution for the chattering problem.

\subsection{Chattering Solution}\label{subsec: chattering solution}
In practical applications, because the inverse dynamics embedded within the nominal control law represents only an approximation of the true physical plant behavior, and because the vehicle is continuously subjected to exogenous disturbances and parametric uncertainties, state trajectories are constrained to the surface $s=0$ solely by virtue of the high-gain control discontinuity. However, when dealing with a discrete-time digital processor, the ideal infinite-frequency switching can no longer be physically sustained. This limitation forces the state trajectories to oscillate aggressively across $s = 0$, giving rise to the \textbf{chattering} phenomenon. The  are strongly coupled to the hardware sampling time, the magnitude of the discontinuous switching gain, and the internal unmodeled dynamics of both the vehicle system and the electromagnetic actuators.

To mitigate the resulting high control effort, the severe high-frequency oscillations in the system response and general  control degradation, a virtual \textbf{boundary layer} of thickness $\varphi$\nomenclature{$\varphi$}{Boundary layer thickness. \nomunit{[-]}}  is mapped symmetrically around the sliding surface, establishing a localized envelope within which the aggressive discontinuous gain is systematically smoothed. This continuous boundary layer approximation serves to smooth the switching command inside the tracking zone, thereby eliminating the high-frequency chattering. Nevertheless, this attenuation introduces an inherent trade-off, as it compromises absolute tracking precision and robustness against disturbances once the state vector resides inside the boundary layer. Consequently, the boundary layer thickness must be meticulously calibrated, selecting the minimum possible value that satisfies the physical chattering suppression requirements of the powertrain without excessively sacrificing steady-state regulation performance.
\begin{figure}[h]
    \centering
    \includegraphics[width=0.5\textwidth]{images/slidingsurface_scheme.png}
    \caption{Sliding surface illustration \cite{wiben2012design}.}
    \label{fig: sliding_surface_illustration}
\end{figure}

Given fixed width $\varphi$, the discontinuous switching term is made proportional to $s$ employing a proper saturation function, to substitute to $sign(s)$ in Eq: \eqref{eq: dot_s_TSMC}:
\begin{align}
    \dot s_j &= -K_2\cdot sat\left(\frac{s_j}{\varphi}\right) \label{eq: s_dot_CISMC}
    \\
    &sat\left(\frac{s_j}{\varphi}\right) = 
    \begin{cases}
        \displaystyle \frac{s_j}{\varphi}, &s_j\gg \varphi
        \\
        \displaystyle sign\left(\frac{s_j}{\varphi}\right), &s_j\le \varphi
    \end{cases}
\end{align}

The relationship between boundary layer thickness and tracking error is given as \cite{wiben2012design}:
\begin{equation}
    \forall t\ge 0, \quad |e_j(t)|\le 2\cdot K_2 \varepsilon \quad \text{\textit{for all trajectories starting inside the boundary layer}}
\end{equation}
where $\varepsilon$ is the boundary layer thickness lying on the horizontal axis illustrated in Fig. \ref{fig: sliding_surface_illustration}, defined as:
\begin{equation}
    \varepsilon = \frac{\varphi}{K_2}
\end{equation}
It is therefore guaranteed that:
\begin{equation}
    \forall t\ge 0, \quad |e_j(t)|\le 2\cdot \varphi 
\end{equation}

Values of $\varphi$ and $K_2$ are tuned in simulations reported in Chapter \ref{chpt: simulations&results}.

\subsection{Anti Wind-up Strategy}
Because the sliding surface defined in Eq. \eqref{eq: slidingsurface_CISMC} incorporates a continuous time-integral component of the tracking error, its real-time implementation is vulnerable to \textbf{integrator wind-up}. This risk is highly pronounced in traction control loops since the actual available electromagnetic motor torque is constrained by the electric motor structural limits. When a large transient maneuver forces the tracking error to remain large over a sustained interval of time, a conventional integrator continues to accumulate, causing the virtual torque request to far exceed the physical capacity of the actuator, resulting in severe overshoots and extended settling times once the system attempts to recover from saturation.

To mitigate this operational vulnerability, a specialized conditional anti-windup framework is implemented. This scheme works by dynamically switching between distinct sliding surface definitions based on the saturation state of the actuator. The operational logic is formalized through two distinct execution windows:
\begin{equation}\label{eq: slidingsurface_antiwindup}
    s_j = \begin{cases}
    \displaystyle e_j + K_1 \cdot \int_{t_0}^t e_j(\tau) d\tau - e_j(t_0), &\quad |u_{Rj}|\le T_{drive,Rj}^{max}
    \\
    \displaystyle e_j, &\quad |u_{Rj}|>T_{drive,Rj}^{max}
    \end{cases}
\end{equation}

As long as the calculated reference control command resides safely within the physical torque limits of the electric motor ($|u|\le T_{drive}^{max}$), the primary integral sliding surface is employed. \\
The moment the torque request triggers actuator saturation ($|u|>T_{drive}^{max}$), the accumulation of the integral slip error is immediately halted. 

To prevent a discontinuous step change in the sliding surface, which could riskly lead to chattering amplification, the mathematical boundaries of the integral term are dynamically shifted such that the initial slip error $e_j(0)$ is overwritten by the error at the instant of exit from saturation window ($e_j(t_0)$), and the integration lower bound ($t_{in}$) is re-indexed from $t_{in} = 0$ to $t_{in} = t_0$ (see Eq. \eqref{eq: slidingsurface_antiwindup}). \\ This ensures that the sliding surface is shifted so that
the trajectories at ($t_0$) are located at $s = 0$ and exponential convergence is obtained immediately.

The reference physical limit for maximum driving torque is retrieved as function of electric motor limits:
\begin{equation}\label{eq: TrqDriveMAX_CISMC}
    T_{drive}^{max} = T_{EM}^{max}\cdot i_{g} \cdot \eta_{EM}
\end{equation}

In Fig. \ref{fig:CISMC_controller_scheme} a schematic representation of the control law implementation inside the control loop.
\begin{figure}[H]
    \centering
    \includegraphics[width=1\textwidth]{images/CISM_control_scheme.png}
    \caption{CISM control scheme.}
    \label{fig:CISMC_controller_scheme}   
\end{figure}

\newpage
\subsection{Proof of Stability}
Coherently with the apporach adopted for the TSMC case study (Sec. \ref{subsec: lyapunov_TSMC}), a formal stability analysis is conducted for the CISM controller according to Lyapunov theory.

The positive-definite scalar Lyapunov candidate function considered is:
\begin{equation}
\begin{cases}
    V(s_j) = \frac{1}{2}s_j^2 >0,\quad \forall s_j \ne 0 
    \\
    V(0) = 0
\end{cases}
\end{equation}
The derivative with respect to time is:
\begin{equation} \label{eq: v_dot_CISMC}
    \dot V(s_j) = \dot s_j s_j = \left(f + g\cdot u_{Rj} + K_1 \cdot e_j - \dot \sigma_{opt_j}\right) \ s_j
\end{equation}
Both definitions satisfy the conditions discussed in Sec. \ref{subsec: lyapunov_TSMC}, hence $V(s_j\rightarrow \infty)\rightarrow \infty$ and $\dot V(s_j) <0$, given the following relationships:
\begin{align}
    &u_{Rj} = -\frac{1}{g}\left(f+K_1\cdot e_j - \dot \sigma_{opt_j} - \dot s_j\right)
    \label{eq: control_input_CISMC}
    \\
    &\dot s_j = -K_2 \cdot \begin{cases}
        \frac{s_j}{\varphi}
        \\
        sign\left(\frac{s_j}{\varphi}\right)
    \end{cases}
\end{align}
Being $\varphi$ a positive constant by definition, it can be stated that:
\begin{equation}
    sign(s_j) = sign\left(\frac{s_j}{\varphi}\right)
\end{equation}
Hence to discuss about the negativity of $\dot V(s_j)$, the simplification $\dot s_j = -K_2 \cdot sign(s_j)$ and Eq. \eqref{eq: control_input_CISMC} can be susbtituted in Eq. \eqref{eq: v_dot_CISMC}:
\begin{equation}
    \dot V(s_j) = -K_2 \cdot sign(s_j)\cdot s_j = -K_2 \cdot |s_j| \le0
\end{equation}
Finally, choosing a constant positive gain ($K_2>0$) for the switching term ensures $\dot V(s_j)<0, \ \forall s_j \ne 0$, hence asymptotic stability for the system.
