<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">


%=================================================================
\subsection{Logic Test Sequences}
\label{sec_pme_cond}

The primary configuration structure is a {\em logic test sequence},
comprised of one or more {\em logic tests}. The sequence of tests
may be ordered by time, but may also be time invariant. The overall
test evaluation is completed when either (a) all logic tests in the
sequence have been evaluated and passed, or (b) when any one of the
logic tests in the sequence has failed.

\vspace{0.1in}
\noindent
A logic single test is comprised of:

\begin{packed_itemize}
\item lead conditions
\item pass conditions
\item fail conditions
\end{packed_itemize}

\noindent
One or more lead conditions may be provided. As soon as all lead
conditions have been satisfied, the pass/fail conditions are
evaluated. If one or more pass conditions have been provided, then
{\em all} must satisfied or else the test fails. If one or more fail
conditions are provided, then if {\em any} fail condition is satisfied,
the test fails.

\vspace{0.1in}
\noindent
A test sequence is comprised one or more tests. Each test has its own
conditions. In this case {\em the order of lines in the configuration
  file is important} as it determines the grouping. For example, in
the Alpha End Flag mission, the sole test is whether the end flag has
been set after the fifth waypoint has been hit. This does not test
for the possible error case where the endflag is posted after the third
or fourth waypoint has been hit. The single logic test could be replace
with the following test sequence:

\vspace{0.1in}
\begin{fileverb}
  lead_condition = WC_FLAG = 3
  pass_condition = EFLAG = 0

  lead_condition = WC_FLAG = 4
  pass_condition = EFLAG = 0

  lead_condition = WC_FLAG = 5
  pass_condition = EFLAG = 1

  result_flag = MISSION_EVALUATED = true
  pass_flag   = MISSION_RESULT = pass
  fail_flag   = MISSION_RESULT = fail
\end{fileverb}
\vspace{0.1in}

\noindent
Note in this case there are three tests, all tests need to pass if the
\pvar{pass\_flag} is to be posted. Note also that the test \mvar{EFLAG=0}
will not pass unless it is explicitly published with this value. And
the condition \mvar{EFLAG!=1} will also not pass unless \mvar{EFLAG} has
been published. In this example, in the Alpha End Flag mission, the helm
initializes the \mvar{EFLAG} variable to 0 upon helm launch.

\vspace{0.1in}
\noindent
The order of the tasks in the configuration does matter. The app at
any given moment will address the next element in the sequence. Only
when the last element has been addressed will the result, pass, and fail
flags be published. Consider what would happen if the first two of the
above tests were reversed? In this case the mission would never finish
evaluation. Why?


%=================================================================
\subsection{Logic Conditions}

Logic conditions are employed in \app{pMissionEval} to delay mission
evaluation to precisely the moment when aspects of the mission should
be evaluated. The logic condition construct (and code) is exactly the
same as used in \app{pHelmIvP}, \app{uTimerScript} and several other
applications. They are described in more detail at:

\vspace{0.1in}

\urlx{https://oceanai.mit.edu/ivpman/logic}

\vspace{0.1in}
\noindent
\app{pMissionEval} maintains a local buffer representing a snapshot of
the MOOSDB for variables involved in the logic expressions. The key
relationships and steps are shown in Figure \ref{fig_logic}:

\vspace{0.1in}
\begin{figure}[ht]
  \centering 
  \includegraphics[width=0.71\linewidth]{figures/logic_conditions.png}
  \caption{{\bf Logic conditions}: Step 1: \app{pMissionEval}
    registers to the MOOSDB for any MOOS variables
    involved in the logic expressions. Step 2: The app
    reads incoming mail from the MOOSDB. Step 3: Any new mail results
    in an update to the information buffer. Step 4: Within the
    application's Iterate() method, the logic expressions are evaluated
    based on the contents of the information buffer.}
\label{fig_logic}
\end{figure}

\noindent
In the Alpha End Flag example, the \pvar{lead\_condition} is met when
the MOOS variable \mvar{WC\_FLAG} is set to $5$. The evaluation passes
if the MOOSV variable \mvar{EFLAG} is set to $1$.


%=================================================================
\subsection{Flag Postings}

The \app{pMissionEval} app can be configured to post any number of flags
upon certain events. A flag is a MOOS variable-value pair, similar to
flag postings in the helm or other MOOS apps. There are three events
where flags will be posted.

%-----------------------------------------------------------------
\subsubsection{Result Flags}
\label{sec_pme_result_flags}

A {\em result flag} is posted when the mission has been evaluated with
either a failure or passing grade. This flag is posted regardless of the
grade. The configuration parameter is \pvar{result\_flag}. For example:

\vspace{0.1in}

\pvar{result\_flag = MISSION\_EVALUTED=true}

\vspace{0.1in}
\noindent
Although the above flag can be set using any MOOS variable, and multiple
configurations are accepted, the variable \mvar{MISSION\_EVALUATED} is
the default variable when this app is used in conjunction with \app{uMayFinish}.
The latter app is configured with an criteria indicating the completion
of a mission, typically followed by the shut down of a simulation. 

%-----------------------------------------------------------------
\subsubsection{Pass and Fail Flags}
\label{sec_pme_pass_flags}

One or more pass flags are posted when the mission has been
evaluated with a passing grade. An example configuration:

\vspace{0.1in}
\noindent
\pvar{pass\_flag = MISSION\_SUCCESS=true}

\vspace{0.1in}
\noindent
One or more fail flags are posted when the mission has been evaluated
with a failing grade. An example configuration:

\vspace{0.1in}
\noindent
\pvar{fail\_flag = MISSION\_SUCCESS=false}

\vspace{0.1in}
\noindent
The righthand side of these flags will be scanned for macros when
they are posted with the macros filled in with the current prevailing
value at the time of posting.


%-----------------------------------------------------------------
\subsubsection{Flag and Report Column Macros}
  
</pre></body></html>