emulator_configuration.tex 8.35 KB
Newer Older
Jean Meurice's avatar
Jean Meurice committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220

\usepackage{graphicx}
%\usepackage{ngerman}
\usepackage[utf8x]{inputenc}
\usepackage{fancyvrb}
\usepackage{courier}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{helvet}
\usepackage{pbox}
\usepackage{xcolor}
\usepackage{pdfpages}
\usepackage[strict]{changepage}
\usepackage{calc}  
\usepackage{enumitem}
\usepackage{array}
\usepackage{tabularx}
\usepackage{tabu}
\usepackage{multirow}
\usepackage{tikz}
\usetikzlibrary{tikzmark}
\usetikzlibrary{calc}
\usetikzlibrary{decorations.pathreplacing}
\usetikzlibrary{datavisualization}
\usepackage[htt]{hyphenat}
\usepackage{float}
\newfloat{example}{tbh}{exa}[chapter]
\floatname{example}{Example}
\usepackage{siunitx}
\usepackage{pgfplots}
%\usepackage{hyperref}
%\usepackage{url}

\pgfplotsset{compat=newest} % Allows to place the legend below plot
\usepgfplotslibrary{units} % Allows to enter the units nicely

%\the\textwidth = 426.79pt
%\the\arrayrulewidth  = 0.4pt

\pdfoptionpdfminorversion=6

% \definecolor{se_dark_blue}{RGB}{0,103,166} % powerpoint
\definecolor{se_dark_blue}{RGB}{0,96,178} % website
% \definecolor{se_light_blue}{RGB}{119,158,201} % powerpoint
\definecolor{se_light_blue}{RGB}{129,160,225} % website


\graphicspath{{src/pic/}}

%%\newcommand{\tc}[1]{\Large{\fontfamily{ph v}\selectfont{#1}}}
\newcommand{\tc}[1]{\normalsize{#1}}
\newcommand{\tm}[1]{\scriptsize{#1}}
\newcommand{\ttt}[1]{\scriptsize{\texttt{#1}}}
\newcommand{\tsf}[1]{\scriptsize{\textsf{#1}}}
\newcommand{\tit}[1]{\scriptsize{\textit{#1}}}

%% setup listings
\usepackage{listings}
\lstset{
  language=C++,
  frame=none,
  basicstyle=\small\ttfamily,
}
\lstset{
  language=Java,
  frame=none,
  basicstyle=\small\ttfamily,
}
\lstdefinestyle{MontiArcStyle}{
    numbers=left,
    numberstyle=\tiny,
    numbersep=5pt,
    xleftmargin=11pt,
    xrightmargin=4pt,
    frame=single,
    aboveskip=0pt,
    belowskip=-6pt,
    sensitive=true,
    float=!t,
    breaklines=false,
    captionpos=b,
    tabsize=2,
    showstringspaces=false,
    basicstyle=\small\ttfamily,
    morecomment=[l]{//},
    morecomment=[s][\itshape]{/**}{*/}
}



%% defines the listings laguage named 'MontiArc' derived from the language 'Java' 
%% adding the below listed keywords. See 
%% ftp://ftp.tex.ac.uk/tex-archive/macros/latex/contrib/listings/listings.pdf
%% for listings documentation
\lstdefinelanguage{MontiArc}[]{Java}{
  morekeywords={component, port, in, out, inv, package, import, connect, autoconnect}
}

% Seite einrichten
\setlength{\voffset}{-1in}
\setlength{\hoffset}{-1in}

\setlength{\topmargin}{2.5cm}		   
\setlength{\headheight}{0cm}		   
\setlength{\headsep}{0cm}		   
\setlength{\oddsidemargin}{3,3cm}  % innen ein wenig mehr Rand für die Klebebindung
\setlength{\evensidemargin}{2,7cm} % dafür außen ein wenig weniger
\setlength{\textwidth}{15cm}		   
\setlength{\textheight}{23,5cm}		   
\setlength{\parindent}{0cm}

\newcommand{\emptyLine}{{\LARGE ~\\}}

\begin{document}
\setcounter{page}{1}
\pagenumbering{arabic}


\section{Configuration}
\label{emuconfig}

The HardwareEmulator and the EmulatorManager support a simple fail-safe way of configuring them and making queries to them. A message is made of a String where each line (separated by a newline character) is a name followed by optional parameters.

The syntax is whitespace insensitive and as follows:
\begin{verbatim}
    name = param1, param2, param...
    or
    name
\end{verbatim}
Whitespace is optional, and the only separating characters are the equal sign ($=$), the comma (,) and the newline character (\texttt{\textbackslash n}).

\subsection{Configuration}

The current settings supported when allocating an emulator are shown in Table~\ref{tab:emuconfig}.
\begin{table}[!htb]
    \begin{tabularx}{\textwidth}{ | X |}
        \hline
        \texttt{autopilot=name} \\
        Name of the autopilot program file, without extension.\\ \hline
        \texttt{os=name} \\
        Name of the operating system used. Currently \texttt{linux} or \texttt{windows}. This implies the extension of the autopilot file searched. If the os command is not given, the Emulator will search for any autopilot with the given name in the search folder. \\ \hline
        \texttt{debug=flag1,flag2,\dots} \\
        Enable the debugging outputs for the specified flags, where the flags are any of \texttt{mem}, \texttt{regs}, \texttt{reg\_update}, \texttt{syscalls}, \texttt{unsupported\_syscalls}, \texttt{code} or \texttt{call}. \\\hline
        \texttt{cpu\_frequency=value} \\
        The CPU frequency in Hertz used to evaluate the computation time. \\\hline
        \texttt{memory\_frequency=value} \\
        The RAM frequency in Hertz used to evaluate the computation time. \\\hline
        \texttt{cache\_name=size,read\_ticks,write\_ticks} \\
        Where \texttt{name} is \texttt{IL1}, \texttt{DL1}, \texttt{L2} or \texttt{L3}.
        This setting enables and sets the parameters of the named cache layer. Set \texttt{size} to 0 to disable this cache level. The ticks refer to the CPU ticks.\\\hline
        \texttt{no\_time} \\
        Disables the delaying of the autopilot in the simulation. \\\hline
        \texttt{test\_real} \\
        If the RMIModelServer and the autopilot are of the same operating system type, this flag makes the emulator load the autopilot directly as a library (not emulated) and uses its outputs to validate those of the emulated instance. \\
        \texttt{export} \\
        Enables the \texttt{HardwareEmulator} to export the deviation from the planned trajectory and the evaluated execution time of the autopilot. Data is currently exported for the first 60 seconds of the simulation. The output files are \texttt{autopilot\_dist.txt} and \texttt{autopilot\_time.txt}.
        \\\hline
    \end{tabularx}
    \caption{HardwareEmulator Configuration}
    \label{tab:emuconfig}
\end{table}

The \texttt{EmulatorManager} itself also supports a config string on initialization. Table~\ref{tab:managerconfig} shows the supported config.
\begin{table}[!htb]
    \begin{tabularx}{\textwidth}{ | X |}
        \hline
        \texttt{autopilots\_folder=folder} \\
        Sets the folder in which to look for autopilot programs.\\ \hline
    \end{tabularx}
    \caption{EmulatorManager Configuration}
    \label{tab:managerconfig}
\end{table}

\subsection{Queries}

The query system uses the same presented syntax, but also sends a response for every query, using the same syntax.

Queries supported by the \texttt{EmulatorManager} are shown in Table~\ref{tab:managerqueries}.

\begin{table}[!htb]
    \begin{tabularx}{\textwidth}{ >{\em}l | X |}
        \cline{2-2}
        Query       & \texttt{get\_error\_msg} \\ 
        Response    & \texttt{error\_msg=msg}  \\
                    & Returns the last error message that occurred while allocating an autopilot emulator. \\ \cline{2-2}
        Query       & \texttt{get\_available\_autopilots} \\ 
        Response    & \texttt{available\_autopilots=autopilot1, autopilot2, \dots}  \\
                    & Returns the list of autopilot files available in the autopilot folder. \\ \cline{2-2}
        Query       & \texttt{get\_available\_threads} \\ 
        Response    & \texttt{available\_threads=thread\_count}  \\
                    & Returns the number of concurrent threads the machine running the RMIModelServer supports.\\ \cline{2-2}
        Query       & \texttt{get\_autopilots\_folder} \\ 
        Response    & \texttt{autopilots\_folder=folder}  \\
                    & Returns the current autopilots folder.\\ \cline{2-2}
    \end{tabularx}
    \caption{EmulatorManager queries.}
    \label{tab:managerqueries}
\end{table}

Queries supported by querying a specific emulator are shown in Table~\ref{tab:emuqueries}.

\begin{table}[!htb]
    \begin{tabularx}{\textwidth}{ >{\em}l | X |}
        \cline{2-2}
        Query       & \texttt{get\_avg\_runtime} \\ 
        Response    & \texttt{avg\_runtime=time} \\
                    & Returns the mean average time of autopilot execution.\\ \cline{2-2}
        Query       & \texttt{is\_computing} \\ 
        Response    & \texttt{computing=1 or 0} \\
                    & Returns 1 if the computer is considered to be computing in simulation time.\\ \cline{2-2}
        Query       & \texttt{get\_computer\_time} \\ 
        Response    & \texttt{computer\_time=time} \\
                    & Returns the time counter of the computer, in microseconds.\\ \cline{2-2}
    \end{tabularx}
    \caption{HardwareEmulator queries.}
    \label{tab:emuqueries}
\end{table}


\end{document}