Data structures

The PAHS Control toolbox uses a few basic datastructures. The data structures describe:

  • Affine system on a polytope/simplex

  • Hybrid game automata (non-deterministic PAHS)

  • Discrete Equivalents of affine systems

  • Discrete game abstractions of HGA

  • Requirements and specifications for PAHS and discrete games

  • Control catalogue implementing a winning strategy

Polytope with affine system
% s is the polytope
s.dim=N % The dimension of the statespace

s.vertices={v_1,ldots,v_{l}} % Lists the l vertices of the polytope
%v_i are mathbb{R}^N vectors denominating the vertices of the state space polytope

s.facet{j}.vertices={j_1,ldots,j_p} % Specifying the facets as a function of the vertices
%j=1ldots p denotes a facet and j_i are indices into the list of vertices,
% indicating the vertices  of facet j

s.facet{j}.opposit=j_{o} %A vertex opposit the facet
% #$j_{o}$ is a vertex opposit facet $j$ i.e. any vertex of s not in
% s.facet{j}.

s.input % A substructure describing the polytopic input space for s
s.input.dim=m % The dimension of the input space

s.input.vertices={u_1,ldots u_p} % The vertices of the input space
%  u_i are mathbb{R}^m vectors denoting the vertices of the input space

s.input.facet{j}.vertices={j_1,ldots ,j_N}; % A facet of the input space
s.input.facet{j}.opposit=j_{N+1} % A vertex not in facet j

s.dynamics % Sub structure describing the dynamics acting on s
% Dynamics are on the form dot{x}=Ax+Bu+C

s.dynamics.A=Ain mathbb{R}^{Ntimes N} % The autonomous dynamics
s.dynamics.B=Bin mathbb{R}^{Ntimes m} % The input dynamics
s.dynamics.C=Cin mathbb{R}^{N} % The affine dynamics
Piecewise-Affine Hybrid System
%PAHS is a Piecewise-Affine Hybrid System

%A PAHS consists of a number of modes
pahs.mode{i}=m_i % The i'th mode of the PAHS

% Each mode has a number of substructures
mode.dynamics=dyn %Mode wide dynamics (not mandatory)
% Common dynamics shared between all polytopes of the mode

mode.input=input    %Mode wide input    (not mandatory)
% Common input shared between all polytopes of the mode

%Cell Array of locations
mode.loc{j}=q_{i,j} % is the j'th location of the i'th mode

%each location, $q_{i,j}$ (loc) is described as:
loc{j}.s  % an affine system on a polytope
loc{j}.bord=[k_1,ldots,k_p]
% is an array of indices, one for each facet of loc.s,
% denoting neigboring locations to that facet.
% If empty there is no defined neighbor to the facet.

mode.trans{t} % Cell array of transitions starting from this mode
% Each transitions is described by its destination and controllability
trans{t}.dest=t_dst  %Destination mode i of the transition
trans{t}.ctrb=t_c   % Boolean describing the controllability of the transition, if true the transition is controllable.

pahs.samepart  %Boolean hint set to true if identical partitions is used in all modes
The discrete equivalent data structure
% de is the discrete equivalent
de.blockset=B in mathbb{N}^k % The blockable set
% B is a vector of k facet indices

de.exits=E in mathbb{N}^k % Possible exit facet vector
% E is a vector of k facet indices

de.exit{j}.testVec=tv in R^N % The test vector used for facet j

de.block.testVec=tv in R^N % Test vector used for the case of all facets blocked
The discrete abstraction data structure
% dgabs is a discrete game abstraction

dgabs.maxfacet=mf % this is the maximum number of facets of in any of the modes

mode.trans{t} % Cell array of transitions starting from this mode
% Each transitions is described by its destination and controllability
trans{t}.dest=t_dst  %Destination mode i of the transition
trans{t}.ctrb=t_c   % Boolean describing the controllability of the transition, if true the transition is controllable.

dgabs.mode{i}=dg_i %is the abstraction of mode i

mode.da{j}=d_{i,j} % is the abstraction of location j in mode i.
da{j}.des{k}=de % is a cell array of discrete equivalents of the location
da{j}.numfacets=f % is the number of facets of the location
da{j}.bord=[k_1,ldots,k_p] %bordering locations identical to the pahs definition
% is an array of indices, one for each facet of loc.s,
% denoting neigboring locations to that facet.
% If empty there is no defined neighbor to the facet.

da{j}.trans{t}=[l_1,ldots,l_e] % is a cell array of arrays (one for each t)
% The array contains indices $l_k$ specifying which locations in the destination mode of t
% can be reached by t from the discrete abstraction of q_{i,j}.

Specifications can be generated from requirements using req2spec.m, but it is possible both to describe requirements as polytopes on the PAHS and directly on the discrete abstraction using the spec structure.

Requirements and Specifications
%req is a requirement specification and P_l l=1ldots k are polytopes.

%initial set
req.init{i} % Cell array of initial set polytopes. Each cell contains a polytope
 init{i}.poly=p_1 % Polytope describing an initial set
 init{i}.modes=[m_1ldots m_j] % An array of modes the polytope is valid in

%goal set
req.goal{i} % Cell array of goal set polytopes. Each cell contains a polytope
 goal{i}.poly=p_2 % Polytope describing a goal set
 goal{i}.modes=[m_1ldots m_j] % An array of modes the polytope is valid in

%avoid set
req.avoid{i} % Cell array of avoid set polytopes. Each cell contains a polytope
 avoid{i}.poly=p_1 % Polytope describing an avoid set
 avoid{i}.modes=[m_1ldots m_j] % An array of modes the polytope is valid in

%The specification on the dgabs is very similar to the requirements
%Here only the initial set specification is shown.

%Initial set
req.init{i} % Cell array of inital sets
 init{i}.loc=l_1 % An initial location
 init{i}.modes=[m_1ldots m_j] % An array of modes for the initial location
 %NB: Having more than one mode in the array mostly makes sense for problems where the
 %modes share a partition.