restructure
[phd-thesis.git] / top / top.tex
1 \documentclass[../thesis.tex]{subfiles}
2
3 \input{subfilepreamble}
4
5 \begin{document}
6 \input{subfileprefix}
7
8 %\chapter{\texorpdfstring{\Glsxtrshort{TOP} for the \glsxtrshort{IOT}}{TOP for the IoT}}%
9 \subfile{4iot}
10
11 %\chapter{The \texorpdfstring{\gls{MTASK}}{mTask} \texorpdfstring{\glsxtrshort{DSL}}{DSL}}%
12 \subfile{lang}
13
14 \chapter{Integration with \texorpdfstring{\gls{ITASK}}{iTask}}%
15 \label{chp:integration_with_itask}
16 \begin{chapterabstract}
17 This chapter shows the integration of \gls{MTASK} with \gls{ITASK} by showing:
18 \begin{itemize}
19 \item an architectural overview of \gls{MTASK};
20 \item on the interface for connecting devices;
21 \item the interface for lifting \gls{MTASK} tasks to \gls{ITASK} tasks;
22 \item and interface for lifting \gls{ITASK} \glspl{SDS} to \gls{MTASK} \glspl{SDS}.
23 \end{itemize}
24 \end{chapterabstract}
25
26 The \gls{MTASK} language is a multi-view \gls{DSL}, i.e.\ there are multiple interpretations possible for a single \gls{MTASK} term.
27 Using the byte code compiler (\cleaninline{BCInterpret}) \gls{DSL} interpretation, \gls{MTASK} tasks can be fully integrated in \gls{ITASK}.
28 They are executed as if they are regular \gls{ITASK} tasks and they communicate may access \glspl{SDS} from \gls{ITASK} as well.
29 \Gls{MTASK} devices contain a domain-specific \gls{OS} (\gls{RTS}) and are little \gls{TOP} engines in their own respect, being able to execute tasks.
30 \Cref{fig:mtask_integration} shows the architectural layout of a typical \gls{IOT} system created with \gls{ITASK} and \gls{MTASK}.
31 The entire system is written as a single \gls{CLEAN} specification where multiple tasks are executed at the same time.
32 Tasks can access \glspl{SDS} according to many-to-many communication and multiple clients can work on the same task.
33 Devices are integrated into the system using the \cleaninline{withDevice} function (see \cref{sec:withdevice}).
34 Using \cleaninline{liftmTask}, \gls{MTASK} tasks are lifted to a device (see \cref{sec:liftmtask}).
35 \Gls{ITASK} \glspl{SDS} are lifted to the \gls{MTASK} device using \cleaninline{liftsds} (see \cref{sec:liftmtask}).
36
37 \begin{figure}[ht]
38 \centering
39 \includestandalone{mtask_integration}
40 \caption{\Gls{MTASK}'s integration with \gls{ITASK}.}%
41 \label{fig:mtask_integration}
42 \end{figure}
43
44 \section{Devices}\label{sec:withdevice}
45 When interpreted by the byte code compiler view, an \gls{MTASK} task produces a compiler.
46 This compiler is exceuted at run time so that the resulting byte code can be sent to an edge device.
47 All communication with this device happens through a so-called \emph{channels} \gls{SDS}.
48 The channels contain three fields, a queue of messages that are received, a queue of messages to send and a stop flag.
49 Every communication method that implements the \cleaninline{channelSync} class can provide the communication with an \gls{MTASK} device.
50 As of now, serial port communication, direct \gls{TCP} communication and \gls{MQTT} over \gls{TCP} are supported as communication providers.
51 The \cleaninline{withDevice} function transforms a communication provider and a task that does something with this device to an \gls{ITASK} task.
52 This task sets up the communication, exchanges specifications, handles errors and cleans up after closing.
53 \Cref{lst:mtask_device} shows the types and interface to connecting devices.
54
55 \begin{lstClean}[label={lst:mtask_device},caption={Device communication interface in \gls{MTASK}.}]
56 :: MTDevice //abstract
57 :: Channels :== ([MTMessageFro], [MTMessageTo], Bool)
58
59 class channelSync a :: a (Shared sds Channels) -> Task () | RWShared sds
60
61 withDevice :: (a (MTDevice -> Task b) -> Task b) | iTask b & channelSync, iTask a
62 \end{lstClean}
63
64 \section{Lifting tasks}\label{sec:liftmtask}
65 Once the connection with the device is established, \ldots
66 \begin{lstClean}
67 liftmTask :: (Main (BCInterpret (TaskValue u))) MTDevice -> Task u | iTask u
68 \end{lstClean}
69
70 \section{Lifting \texorpdfstring{\glsxtrlongpl{SDS}}{shared data sources}}\label{sec:liftsds}
71 \begin{lstClean}[label={lst:mtask_itasksds},caption={Lifted \gls{ITASK} \glspl{SDS} in \gls{MTASK}.}]
72 class liftsds v where
73 liftsds :: ((v (Sds t)) -> In (Shared sds t) (Main (MTask v u)))
74 -> Main (MTask v u) | RWShared sds
75 \end{lstClean}
76
77 \chapter{Implementation}%
78 \label{chp:implementation}
79 \begin{chapterabstract}
80 This chapter shows the implementation of the \gls{MTASK} system.
81 It is threefold: first it shows the implementation of the byte code compiler for \gls{MTASK}'s \gls{TOP} language, then is details of the implementation of \gls{MTASK}'s \gls{TOP} engine that executes the \gls{MTASK} tasks on the microcontroller, and finally it shows how the integration of \gls{MTASK} tasks and \glspl{SDS} is implemented both on the server and on the device.
82 \end{chapterabstract}
83 IFL19 paper, bytecode instructieset~\cref{chp:bytecode_instruction_set}
84
85 \section{Integration with \texorpdfstring{\gls{ITASK}}{iTask}}
86 IFL18 paper stukken
87
88 % Green computing
89 \subfile{green}
90
91 \input{subfilepostamble}
92 \end{document}