\subsection{Switching Uncertainty}

\label{sec:switching}

% Many dynamical systems exhibit an affine structure in terms of the disturbance $d \in \Delta$:

% Polytopic uncertainty is an instance of time-varying uncertainty where all $d_i(t) \geq 0$ and $\sum_i d_i(t) = 1$. 

An approach for analyzing switched systems with occupation measures is presented in \cite{henrion2012measures}.
Let $\{X^k\}_{k=1}^{ N_s}$ be a closed cover of $X$ with $N_s$ switching modes. The sets  $X^k$ are not necessarily disjoint, and together satisfy $\cup_k X^k = X$ (definition of closed cover).
% The sets $X^k\subseteq X$ are   of not necessarily disjoint closed subsets $X^k  such that $\cup_k X^k = X$. 
% Further, let $\dot{x} = f_k(t,x)$ be dynamics that evolve on $X_k$. 
Each region $X^k$ has dynamics $\dot{x} = f_k(t,x)$ for some locally Lipschitz vector field $f_k$.
The closed cover formalism generalizes partitions of $X$  (deterministic dynamics) and arbitrary switching where $X^k = X \ \forall k$ (polytopic uncertainty). Polytopic uncertainty is a model with dynamics $f(t, x, k) = \sum_k w_k f_k(t, x)$ where the disturbance $w_k \in \R_+^{N_s}$ satisfies $\sum_k w_k = 1$. Trajectories from a switching system are equipped with a function $S: [0, T] \rightarrow 1 \ldots, N_s$ yielding the resident subsystem at time $t^-$. Such a trajectory under switching may be written as $x(t \mid x_0, S(t))$.
% The number of switching subsystems is $N_s$, an
The switched measure program introduces an occupation measure $\mu_k \in \Mp{[0, T] \times X^k}$ for each subsystem $f_k$, 
% Just like in section \ref{sec:polytopic}, the switched total occupation measure and adjoint Lie derivative of constraint \eqref{eq:peak_meas_flow} is:
\begin{equation}
    \mu = \textstyle\sum_k \mu_k \qquad \Lie^\dagger \mu = \textstyle\sum_k \Lie^\dagger_k \mu_k.
\end{equation}
A valid auxiliary function $v(t,x)$ from \eqref{eq:peak_cont_f} must decrease along all subsystems \cite{parrilo2008approximation, vlassis2014polytopic}.
Problem \eqref{eq:peak_cont} may be modified for switching by enlarging Constraint \eqref{eq:peak_cont_f} to,
\begin{equation}
    \Lie_{f_k} v(t,x) \leq 0 \quad \forall (t,x) \in [0, T] \times X_k, \ k = 1 \ldots N_s.\end{equation}

% \begin{rmk}
% The closed cover switching formalism may be expanded into a system with general time-dependent uncertainty if desired. The switching basic semialgebraic sets may be described as $X^k = \{x \mid g_{ki}(x)\geq 0 \ i = 1, \ldots, N_c^k\}$ for $N_c^k$ polynomial constraints each. 
% A linear expression of time-dependent uncertain dynamics is $\dot{x}(t) = \sum_{k=1}^{N_s} w_k(t) f_k(t, x (t))$ for processes $w(t) \in \R^{N_s}_+$ satisfying $\sum_k w_k(t) = 1$ for all $t \in [0, T]$. Additional constraints must be imposed to enforce that the process $w_k(t)$ is zero whenever $x(t) \not\in X^k$. These constraints may be realized as $\{w_k g_{k i}(x) \geq 0, \ \forall i=1, \ldots, N_c^k, \ \forall k = 1, \ldots N_s\}$.

% % Let $w \in \R^{N_s}_+$  be signals satisfying $w $
% \end{rmk}



% Section 4.1 of \cite{henrion2012measures} introduces a 1DOF attitude controller with linearized dynamics corresponding to a double-integrator $I \ddot{\theta} = u$ and states $x = [\theta, \dot{\theta}]$. The input $u = \textrm{sat}_L(Kx)$ is a state feedback controller $Kx$ that saturates at levels $\pm L$. The subsystems are  linear operation $\abs{Kx} \leq L$, positive saturation $Kx \geq L$, and negative saturation $Kx \leq -L$.
% These valid regions $X^k$ are separated in Fig. \ref{fig:space_all} by thin dotted diagonal lines. Maximizing $p(x) = \abs{\theta}$ where all parameters have values in Sec. 4.1.1 of \cite{henrion2012measures} is shown in Fig. \ref{fig:space}. With $\abs{\theta_0} \leq 15^\circ$ and $\abs{\dot{\theta}_0} \leq 3^\circ/\textrm{sec}$, a $d=5$ approximation finds an upper bound of $\abs{\theta_*} = 20.69^\circ$. 

% The nominal moment of inertia in Fig. \ref{fig:space} is $I = 27,500 \ kg \;m^2$. Multiplicative relative uncertainty in $I$ may be introduced by replacing $I$ with $I/(1+w)$, where $w \in [-0.5, 0.5] = W$. The peak angle is raised to $\abs{\theta_*} = 51.86^\circ$ at $d=5$ at $I' = 2 I$ with this new uncertainty.


% \begin{figure}[ht]
%      \centering
%      \begin{subfigure}[b]{0.48\linewidth}
%          \centering
%          \includegraphics[width=\linewidth]{img/space_const_sat.pdf}
%          \caption{Certainty in $I$}
%          \label{fig:space}
%      \end{subfigure}
%      \;
%      \begin{subfigure}[b]{0.48\linewidth}
%          \centering
%          \includegraphics[width=\linewidth]{img/space_w_sat.pdf}
%          \caption{50\% uncertainty in $I$}
%          \label{fig:space_w}
%      \end{subfigure}
%       \caption{\label{fig:space_all} Maximum angle for 1DOF attitude controller}
% \end{figure}