📄 user_manual.tex
字号:
\chapter{\hysdel{} Models}We designed a modeling language to describe DHA\index{DiscreteHybrid Automata} models, called HYbrid System DEscription Language(\hysdel{}). In this section we will detail the languagecapabilities and we will show how DHA systems can be modeledwithin \hysdel{}. As we will explain better in the next section,the \hysdel{} description is an abstract modeling step. Theassociated \hysdel{} compiler then translates the description intoseveral computational models, in particular into MLD and PWA form.\section{\hysdel{} List}A \hysdel{} list is composed by two parts \hs{INTERFACE} and\hs{IMPLEMENTATION}. The declaration of an empty system is asfollows: \index{SYSTEM}\\\verb@SYSTEM @\textsl{name} \verb@{@ \\%\verb@/* C-style comments */@\\%\verb@ INTERFACE {@\\\verb@ }@\\\verb@ IMPLEMENTATION {@\\\verb@ }@\\\verb@}@\\\hysdel{} has a syntax based on C-language, it allows C-stylecomments (\verb@/* ... */@) and uses the curly braces(``\verb@{@'' and ``\verb@}@'') delimiters. All the sections startwith the section name in capital letters followed by the contentof the section enclosed in curly braces. In the informaldescription of the grammar that follows, we use \texttt{courier}font to specify keywords and language constructs (or terminalstokens), \textsl{slanted roman} font to denote user definedcontent (or intermediate lexical tokens). We denote by thesubscript \opt{} optional parts and by \more{} a declaration thatcan be repeated one or more times. We will omit the definitions ofsome tokens, if intuitive. A formal description of the grammar isreported in~\cite{HYSDELP02} and the file hys.y of the sourcedistribution contains the bison description of the grammar.\subsection{\hs{INTERFACE} Section}The \hs{INTERFACE} section contains the declarations, divided intosubsections called \hs{STATE}, \hs{INPUT}, \hs{OUTPUT} and\hs{PARAMETER}, the order in which those sections are declared isnot relevant. The first three declarations are referred to asvariable declaration, while the last is a parameter declaration. Areal variable declaration has the general form: \verb@REAL@\textsl{name} \verb@[@\textsl{min}\verb@,@\textsl{max}\verb@]@\opt\verb@;@ where the optional declaration\verb@[@\textsl{min}\verb@,@ \textsl{max}\verb@]@ contains thebounds of the variable. The type specifier \verb@REAL@ can bereplaced with the keyword \verb@BOOL@ if the variable is Boolean,in such a case the bound declaration is forbidden and defaults to\verb@[0, 1]@. Two or more variable declarations can share thetype specifier by using a ``\verb@,@'' in the declaration:\verb@BOOL@ \textsl{name1}\verb@,@ \textsl{name2}\more\verb@;@.\begin{table}[t] \centering \begin{minipage}[b]{.45\textwidth} \begin{tabular}{ll} Operator & \hysdel{} representation \\ \hline $\cdot$ & \verb@*@ \\ $/$ & \verb@/@ \\ $+$ & \verb@+@ \\ $-$ & \verb@-@ \\ $a^b$ & \verb@a ^ b@ \\ $e^b = \exp(b)$ & \verb@exp(b)@ \\ $\sqrt{a}$ & \verb@sqrt(a)@ \\ $\log{a}$ & \verb@log(a)@ \\ $\cos(a)$ & \verb@cos(a)@ \\ $\sin(a)$ & \verb@sin(a)@ \\ \end{tabular} \caption{List of operators supported on parameter declarations}\label{tab:p_op} \end{minipage} ~~ \begin{minipage}[b]{.45\textwidth} \begin{tabular}{ll} Operator & \hysdel{} representation \\ \hline $\ANd$ & \verb@&@ or \verb@&&@ \\ $\OR$ & \verb@|@ or \verb@||@ \\ $\Rightarrow$ & \verb@->@ \\ $\Leftarrow$ & \verb@<-@ \\ $\Leftrightarrow$ & \verb@<->@ \\ $\NOT$ & \verb@~@ or \verb@!@\\& \\& \\& \\ % to preserve alignement!!!& \\ \end{tabular} \vfill \caption{List of operators supported on Boolean expressions}\label{tab:l_op} \end{minipage}\end{table}\noindent There are three kinds of parameter declarations:\begin{description}\index{parameters} \item{Booleanparameters:}\index{parameters!boolean} \verb@BOOL@ \verb@parname@\verb@=@ \verb@value@ where \verb@value;@ can be either\verb@TRUE@ or \verb@FALSE@; any further occurrence of theparameter is then replaced with the corresponding value.\item{Real numeric parameters:}\index{parameters!real!numeric}\verb@REAL@ \verb@parname@ \verb@=@ \verb@number;@, any furtheroccurrence of the parameter is then replaced with thecorresponding value. \item{Real symbolicparameters:}\index{parameters!real!symbolic} \verb@REAL@\verb@parname;@, the parameter is handled symbolicaly.\end{description} Any parameter can be defined in terms of otherparameters declared before using the operators and functions inTable~\ref{tab:p_op}, and can be used thereinafter as it was anumber. \hysdel{} predefines two real parameters\index{parameters!real!predefined} \verb@pi@ $= \pi$ and thetolerance \verb@MLD_epsilon@ $= 10^{-6}$ used for the relations(\ref{eq:ti3}). Both the parameters can be redefined to differentvalues.Currently \hysdel{} supports only scalar data types, there is nosupport for vectors and matrices.Before describing in detail the \hs{IMPLEMENTATION} section, werecall some definitions.\subsubsection{\textsl{Boolean-expr}, \textsl{affine-expr}, \textsl{linear-expr}}\index{Boolean-expr@\textsl{Boolean-expr}} A \textsl{Boolean-expr}is the combination of Boolean variables and the operators reportedin Table~\ref{tab:l_op}.\index{affine-expr@\textsl{affine-expr}}An \textsl{affine-expr} islinear affine combination of real variables\begin{equation}a_0 + a_1x_1 + a_2x_2 + \ldots + a_n x_n{\rm ,} \label{eq:affexp}\end{equation}where $a_i$ is a function of parameters, and $x_i$ are real(state, input, output, and auxiliary) variables. If $a_0 = 0$ then(\ref{eq:affexp}) is a\index{linear-expr@\textsl{linear-expr}}\textsl{linear-expr}.\subsection{\hs{IMPLEMENTATION} Section}The second part, \hs{IMPLEMENTATION}, is composed of specializedsections describing the relations among the variables. The\hs{IMPLEMENTATION} section starts with an optional \hs{AUX}section which contains the declarations of the internal signals ofthe DHA system, called also auxiliary variables. The declarationfollows the general syntax of the variable declaration.\subsubsection{\hs{OUTPUT} Section} The \hs{OUTPUT} section allowsspecifying static linear and logic relations for the output vector$y=\smallmat{y_r\\y_b}$.\noindent The general syntax is: %\bs \verb@OUTPUT@\verb@{@\textsl{output-item}\more\verb@}@\es %and each \textsl{output-item} is one of the following: %\bs \textsl{var} \verb@=@ \textsl{affine-expr} \verb@;@ \\ \textsl{var} \verb@=@ \textsl{Boolean-expr} \verb@;@ \es %\subsubsection{\hs{AD} Section}The \hysdel{} section \hs{AD} allows to define Boolean variablesfrom continuous ones, and is based exactly on the same semanticsof the event generator (EG) described earlier.\noindent The general syntax is: %\bs \verb@AD@\verb@{@\textsl{ad-item}\more\verb@}@\es %and each \textsl{ad-item} is one of the following: %\bs \textsl{var} \verb@=@ \textsl{affine-expr} \verb@<=@\textsl{real-number} \verb@;@ \\ \textsl{var} \verb@=@ \textsl{affine-expr} \verb@>=@\textsl{real-number} \verb@;@ \es %and the syntax (used by the former version of the \hysdel{}compiler) %\bs \textsl{var} \verb@=@ \textsl{affine-expr} \verb@<=@ \verb@0@\verb@[@\textsl{min}\verb@,@ \textsl{max}\verb@,@\textsl{epsilon}\verb@];@ \es %is still accepted but not recommended because of the error pronespecification of the bounds \verb@[@\textsl{min}\verb@,@\textsl{max}\verb@,@ \textsl{epsilon}\verb@]@ on\textsl{affine-expr}\footnote{The old bounds declaration\texttt{[}\textsl{max}\texttt{,} \textsl{min}\texttt{,}\textsl{epsilon}\texttt{]} is still accepted but is deprecated andwill raise a warning.}. The variable \textsl{epsilon} is thetolerance used for the translation in MLD form according to(\ref{eq:ti3}), if omitted, the value of \verb@MLD_epsilon@ isused.\hysdel{} does not provide explicit access to the time instance,however this limitation can be easily overcome by adding acontinuous state variable $t$ such that $t' = t + T_s$, where$T_s$ is the sampling time. Examples include level indicatorvariables, operational alarms, etc.\begin{example} In a water tank with inflow $Q$,the sensor $\delta$ provides the signal 1 if and only if theliquid level $h \ge 0.5 h_{\max}$.{\vinput{l0001.hys}}\end{example}\subsubsection{\hs{LOGIC} Section} The section \hs{LOGIC} allows tospecify arbitrary functions of Boolean variables: In particularthe mode selector is a Boolean function and therefore it can bemodeled in this section.\noindent The general syntax is: %\bs \verb@LOGIC@\verb@{@\textsl{logic-item}\more\verb@}@\es %and each \textsl{logic-item} is as follows: %\bs \textsl{var} \verb@=@ \textsl{Boolean-expr} \verb@;@ \es %\begin{example} The passengers of a train can pull the handle ofthe emergency stop, generating the binary signal $u_{\rmalarm}=1$. Usually, this causes an emergency stop of the train, bysetting the emergency braking signal $u_{\rm brake}=1$. However,the brake should not be activated if fire is detected while thetrain is in a tunnel. We define the indicator variables for fireas $s_{\rm fire}=1$ and tunnel transition as $s_{\rm tunnel}=1$.Then we can describe this system as:\begin{equation} u_{\rm brake} = u_{\rm alarm} \wedge \left( \lnot s_{\rm tunnel} \vee \lnot {s}_{\rm fire} \right).\end{equation} {\vinput{l0003.hys}}\end{example}\subsubsection{\hs{DA} Section} The \hysdel{} section \hs{DA} definescontinuous variables according to if-then-else conditions onBoolean variables. This section models part of the switched affinesystem (SAS), namely the variables $z_i$ definedin~(\ref{eq::z-transform-a})--(\ref{eq::z-transform-b}).\noindent The general syntax is: %\bs \verb@DA@\verb@{@\textsl{da-item}\more\verb@}@\es %
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -