]> rtime.felk.cvut.cz Git - jenkicar/rpp-simulink.git/commitdiff
Add external mode section to documentation
authorJakub <nejedjak@fel.cvut.cz>
Sun, 15 Sep 2019 22:53:48 +0000 (00:53 +0200)
committerMichal Sojka <michal.sojka@cvut.cz>
Wed, 16 Oct 2019 08:20:07 +0000 (10:20 +0200)
Basic documentation of external mode and limitations
of actual implementation.

doc/images/exmod_parameters.png [new file with mode: 0644]
doc/images/extmod_code_generator.png [new file with mode: 0644]
doc/images/extmod_interface.png [new file with mode: 0644]
doc/images/extmod_scheme.png [new file with mode: 0644]
doc/images/extmod_solver.png [new file with mode: 0644]
doc/rpp_simulink.tex

diff --git a/doc/images/exmod_parameters.png b/doc/images/exmod_parameters.png
new file mode 100644 (file)
index 0000000..c324c94
Binary files /dev/null and b/doc/images/exmod_parameters.png differ
diff --git a/doc/images/extmod_code_generator.png b/doc/images/extmod_code_generator.png
new file mode 100644 (file)
index 0000000..a1a5687
Binary files /dev/null and b/doc/images/extmod_code_generator.png differ
diff --git a/doc/images/extmod_interface.png b/doc/images/extmod_interface.png
new file mode 100644 (file)
index 0000000..883842c
Binary files /dev/null and b/doc/images/extmod_interface.png differ
diff --git a/doc/images/extmod_scheme.png b/doc/images/extmod_scheme.png
new file mode 100644 (file)
index 0000000..9d78ca8
Binary files /dev/null and b/doc/images/extmod_scheme.png differ
diff --git a/doc/images/extmod_solver.png b/doc/images/extmod_solver.png
new file mode 100644 (file)
index 0000000..af7bd52
Binary files /dev/null and b/doc/images/extmod_solver.png differ
index d9c0c013799d5d92e7a3ef2354d230a11c2929a5..4344235d2d451944aaf368065d4cdf169559c686 100644 (file)
@@ -1360,6 +1360,116 @@ the USB.
  % See Section \ref{sec-hardware-description} for reference about
 % the position of the serial interface connector on the RPP board.
 
+\section{Configuring network interface}
+\label{sec-configuration-network-interface}
+To configure the network, it is currently necessary to set the parameters in the eth.h file. The current implementation does not allow automatic IP address retrieval through the DHCP server. The target has a configurable MAC address. It is not usually necessary to change the settings for a network connection. Only if the address could collide with other devices on the network. To configure the third-layer parameters, it is necessary to set a static IP address, network mask, and default gateway. The parameters must correspond to the network to which the device is connected.
+\begin{lstlisting}[language=c]
+#define RPP_MAC_ADDR             { 0x12 /* Unicast, Locally administered */, 0x34, 0x56, 0x78, 0x9A, 0xBC }
+#define RPP_IP_ADDR               0x0A235F19 
+#define RPP_NETMASK               0xFFFFFF00 
+#define RPP_GW                    0x0A235F01 
+\end{lstlisting}
+
+\section{External mode}
+\label{sec-external-mode}
+The external mode allows communication with the simulation running on the target device. It is possible to monitor the internal signals of the simulation and change the parameters of the amplifiers in the wiring. Communication is performed using the network connection of the target device. For correct operation of the external mode, it is necessary to configure the static IP address, mask, and basic gateway correctly.\\
+\\
+\textbf{External Mode Communication Channel Setup.} External mode is a very
+useful environment for rapid prototyping. Procedure to set external mode up is consisting of four parts,
+each of which depends on completion of the preceding ones, in order. The four
+parts correspond to the steps that you follow in simulating, building, running,
+and tuning an actual real-time application.
+\begin{enumerate}
+\item Set up the model.
+\item Build the target executable.
+\item Run the External mode target program.
+\item Tune parameters and watch signals.
+\end{enumerate}
+
+\subsection{Set up the model}
+When creating a model, before compiling it is necessary to add scope elements to the signals, that the user will need to follow while debugging the simulation.
+An example of an external mode simulation is shown below.
+
+\begin{figure}[!h]\begin{center}
+\noindent
+\includegraphics[scale=.45]{images/extmod_scheme.png}
+\caption{The example scheme for external mode}
+\end{center}\end{figure}
+
+
+It is necessary to set the following parameters for the simulation. The description of the path to the individual parameters is based on their position in version 2018a.
+
+\begin{enumerate}
+\item Open the Configuration Parameters dialog box by selecting Simulation -$>$ Model Configuration Parameters.
+\item Select the Solver pane.
+\item In the Solver options subpane:
+  \begin{enumerate}
+  \item In the Type field, select Fixed-step .
+  \item In the Solver field, select discrete (no continuous states) .
+  \item In the Fixed-step size field, specify 0.1 . (Otherwise, when you generate
+  code, the Simulink Coder build process posts a warning and supplies a
+  value.)
+  \end{enumerate}
+
+  \begin{figure}[!h]\begin{center}
+  \noindent
+  \includegraphics[scale=.45]{images/extmod_solver.png}
+  \caption{Solver setup}
+  \end{center}\end{figure}
+
+\item Select the Hardware Implementation
+  \begin{enumerate}
+  \item In the Device vendor field, select proper vendor (example Texas Instruments)
+  \item In the Device type field, select proper target (example TSM570).
+  \end{enumerate}
+\item Select the Code Generation pane. And control that rpp target is selected.
+\item Select the Code Generation -$>$ Optimalization. Set field Default parameter behavior to Tunable. 
+\begin{figure}[!h]\begin{center}
+  \noindent
+  \includegraphics[scale=.45]{images/exmod_parameters.png}
+  \caption{Set parameters tuneble for external mode}
+\end{center}\end{figure}
+
+\item Select the Code Generation -$>$ Interface pane.
+  \begin{enumerate}
+  \item In section Software environment, subsection Support. Set positive floating-point numbers, absolute and continuous time.
+  \item In section Data exchange interface, set C api generation for parameters and signals. Also set External mode on and configure subsection External mode configuration. There select transport layer to tcpip and MEX-file argument to this format. The Ip address is static IP of target. This address is set in file eth.h. Default value of port si 17725. To change port number is nessesary tu redefine parameter in tcpip interface. 
+    \begin{lstlisting}[language=Matlab]
+"ip address" 1 port
+    \end{lstlisting}
+example:
+    \begin{lstlisting}[language=Matlab]
+"10.35.95.25" 1 17725
+    \end{lstlisting}
+  \end{enumerate}
+
+  \begin{figure}[!h]\begin{center}
+    \noindent
+    \includegraphics[scale=.45]{images/extmod_interface.png}
+    \caption{External mode interface setup}
+  \end{center}\end{figure}
+
+  \item In the RPP, increase C system heap size to 65536. External mode uses this heap to allocate outgoing buffer. And control if is set Download compiled binary to RPP to positive.
+  \item Open Code -$>$ External mode control panel. And click on Signals \& trigging. 
+    \begin{enumerate}
+    \item In main part of panel select scopes using external modes.
+    \item In subsection, Trigger options set the Duration to 500. This option describes the length of the outgoing buffer on the target platform. As the frequency of the model increases, the buffer becomes full between data sending to the external modem. This leads to periodic data outages. These failures can be partially reduced by increasing the Duration value to a sufficiently high value. Due to limited memory, it may be necessary to increase the C system heap size on the RPP panel to increase the Duration value further. This value must not be greater than the remaining free space on the target.
+    \end{enumerate}
+\end{enumerate}
+
+\subsection{Build the target executable}
+For correct model compilation, it is necessary to switch the running mode from normal to external. It is also advisable to select the simulation time, for example, to value inf.
+After making the previous settings, the model can be compiled and uploaded to the device using the Build model button in the Simulink header.
+
+\subsection{Run the External mode target program}
+Once the model has been successfully uploaded to the target, communication must be initiated.\\
+This is possible using the Connect to target button or the Connect button in the External mode control panel.
+The simulation program on the target device starts the calculation as soon as the binary file is uploaded. \\
+Waiting simulation on user connection is not currently implemented.
+
+\subsection{Tune parameters and watch signals}
+After a successful connection to the device, it is possible to configure the amplifier parameters and view the scopes in the standard way as during local machine simulation.
+
 \section{Bug reporting}
 \label{sec-bug-reporting}
 
@@ -1739,7 +1849,7 @@ board.
 \item Multi-rate models can be executed in a single or multiple OS
   tasks. Multi-tasking mode allows high-rate tasks to preempt low-rate
   tasks. See Section \ref{sec-singlet-multit-modes} for more details.
-\item No External mode support yet. We work on it.
+\item Support of external mode included over TCPIP with some limitations. See Section \ref{sec-external-mode} for more details.
 \item Custom compiler options, available via OPTS variable in
   \emph{Make command} at \emph{Code Generation} tab (see Figure
   \ref{fig-code-gen-settings}). For example \texttt{make\_rtw