X-Git-Url: https://git.martlubbers.net/?a=blobdiff_plain;f=top%2Fint.tex;h=20df4f8f9856d9c65ab9e77c6697679cd1c5e51d;hb=a5b8d7509c5846d51e2f9e75d4787c7d9b90b408;hp=c4911e0d1ffa3ea77148a9b6e16bf5a4061b2e2d;hpb=9723644ea8013d16911ee761245256f6967c90f3;p=phd-thesis.git diff --git a/top/int.tex b/top/int.tex index c4911e0..20df4f8 100644 --- a/top/int.tex +++ b/top/int.tex @@ -224,7 +224,7 @@ To lower the bandwidth, tasks can also be preloaded. Furthermore, the \gls{MTASK} tasks interact with \gls{ITASK} \glspl{SDS} using the \cleaninline{lowerSds} construct. All of this together allows programming all layers of an \gls{IOT} system from a single source and in a single paradigm. All details regarding interoperation are automatically taken care of. -The following section contains an elaborate example using all integration functions that has deliberately been placed after the conclusion. +The following section contains an elaborate example using all integration functions that has deliberately been placed after the conclusion for formatting reasons. \newpage \vspace*{\fill} @@ -236,14 +236,16 @@ The following section contains an elaborate example using all integration functi \newpage \section{Home automation} -This section presents an interactive home automation program (\cref{lst:example_home_automation}) to illustrate the integration of the \gls{MTASK} language and the \gls{ITASK} system.\todo{Meer uitleg over de applicatie? lijst ipv strings voor keuze?} -It consists of a web interface for the user to control which tasks are executed on either one of two connected devices: an \gls{ARDUINO} UNO, connected via a serial port; and an ESP8266 based prototyping board called NodeMCU, connected via \gls{TCP}\slash{}\gls{WIFI}. +This section presents an interactive home automation program (\cref{lst:example_home_automation}) to illustrate the dynamic integration of the \gls{MTASK} language and the \gls{ITASK} system. +All layers of \gls{IOT} systems are used in this application. +The presentation layer consists of an automatically generated web interface for the user to control which tasks sent to a device for execution. +The application layer is the \gls{ITASK} server, the coordinator of the tasks in the system that also stores the data. +The perception layer is populated by two devices: an \gls{ARDUINO} UNO, and an ESP8266 based prototyping board called {NodeMCU}. \Crefrange{lst:example:spec1}{lst:example:spec2} show the specification for the devices. The UNO is connected via serial using the UNIX filepath \path{/dev/ttyACM0} and the default serial port settings. -The NodeMCU is connected via \gls{WIFI} and hence the \cleaninline{TCPSettings} record is used. -%Both types have \cleaninline{channelSync} instances. +The NodeMCU is connected via \gls{TCP} over \gls{WIFI} and hence the \cleaninline{TCPSettings} record is used. -The code consists of an \gls{ITASK} part and several \gls{MTASK} parts. +The code is split up into an \gls{ITASK} part and several \gls{MTASK} parts. \Crefrange{lst:example:task1}{lst:example:task2} contains the \gls{ITASK} task that coordinates the \gls{IOT} application. First the devices are connected (\crefrange{lst:example:conn1}{lst:example:conn2}) followed by launching a \cleaninline{parallel} task, visualised as a tabbed window, and a shutdown button to terminate the program (\crefrange{lst:example:par1}{lst:example:par2}). This parallel task is the controller of the tasks that run on the edge devices. @@ -254,27 +256,30 @@ The interface that is generated for this is seen in \cref{fig:example_screenshot After selecting the task, a device is selected (see \cref{fig:example_screenshots2,lst:example:selectdev}). When both a task and a device are selected, an \gls{ITASK} task is added to the process list using \cleaninline{appendTask}. Using the helper function \cleaninline{mkTask}, the actual task is selected from the \cleaninline{tasks} list and executed by providing it the device argument. -For example, when selecting the \cleaninline{temperature} task, the current temperature is shown to the user (\cref{fig:example_screenshots3}). + +The \cleaninline{tasks} list contains named \gls{MTASK} tasks that can be sent to the device. +When selecting the \cleaninline{temperature} task, the current temperature is shown to the user (\cref{fig:example_screenshots3}). This task just sends a simple temperature monitoring task to the device using \cleaninline{liftmTask} and provides a view on its task value using the \cleaninline{>\&>} \gls{ITASK} combinator. This combinator allows the observation of the left-hand side task's value through \pgls{SDS}. The light switch task at \crefrange{lst:example:ls1}{lst:example:ls2} is a task that has bidirectional interaction using the definition of \cleaninline{lightswitch} shown in \cref{lst:mtask_liftsds_ex}. -Using \cleaninline{lowerSds}, the status of the light switch is synchronised with the user. -Finally, a task that calculates the factorial of a user-provided number is shown in the list. +Using \cleaninline{lowerSds}, the server-side status of the light switch is synchronised with the actual light attached to the \gls{GPIO} pin. +Finally, some tasks contain significant \gls{ITASK} portions as well. +The remote computation task first queries the user for a number and then constructs a tailor-made task to send to the device to perform a computation, i.e.\ it calculates the factorial for the given number. -\begin{figure}[!ht] +\begin{figure}[p] \centering - \begin{subfigure}[b]{.3\linewidth} - \includegraphics[width=\linewidth]{home_auto1} + \begin{subfigure}{.33\linewidth} + \includegraphics[width=.9\linewidth]{home_auto1} \caption{Select task.}% \label{fig:example_screenshots1} - \end{subfigure} - \begin{subfigure}[b]{.3\linewidth} - \includegraphics[width=\linewidth]{home_auto2} + \end{subfigure}% + \begin{subfigure}{.33\linewidth} + \includegraphics[width=.9\linewidth]{home_auto2} \caption{Select device.}% \label{fig:example_screenshots2} - \end{subfigure} - \begin{subfigure}[b]{.3\linewidth} - \includegraphics[width=\linewidth]{home_auto3} + \end{subfigure}% + \begin{subfigure}{.33\linewidth} + \includegraphics[width=.9\linewidth]{home_auto3} \caption{View result.}% \label{fig:example_screenshots3} \end{subfigure} @@ -283,11 +288,9 @@ Finally, a task that calculates the factorial of a user-provided number is shown \end{figure} \begin{figure}[p] - \begin{fullpage} - \cleaninputlisting[firstline=12,lastline=50,numbers=left,belowskip=0pt]{lst/example.icl} - \begin{lstClean}[numbers=left,firstnumber=40,aboveskip=0pt,caption={An example of a home automation program.},label={lst:example_home_automation}] + \cleaninputlisting[firstline=12,lastline=49,numbers=left,belowskip=0pt,basicstyle=\tt\footnotesize]{lst/example.icl} + \begin{lstClean}[numbers=left,firstnumber=39,aboveskip=0pt,basicstyle=\tt\footnotesize,caption={An example of a home automation program.},label={lst:example_home_automation}] , ...][+\label{lst:example:tasks2}+]\end{lstClean} - \end{fullpage} \end{figure} \input{subfilepostamble}