Update design doc

This commit is contained in:
Danila Fedorin 2020-04-23 22:54:33 -07:00
parent e5e163174b
commit a93d62d18b

34
dd.tex
View File

@ -91,6 +91,9 @@ a "gateway", and individual collars to be placed onto animals.
\section{Glossary} \section{Glossary}
\begin{itemize} \begin{itemize}
\item \emph{LoRa:} A radio-based protocol for \textbf{Lo}ng\textbf{Ra}nge communication. \item \emph{LoRa:} A radio-based protocol for \textbf{Lo}ng\textbf{Ra}nge communication.
\item \emph{LoRaWAN:} A \textbf{W}ireless \textbf{A}ccess \textbf{N}etwork based on LoRa.
\item \emph{The Things Network}: A free, internet-based implementation of a LoRaWAN network
server. Handles encoding and decoding of packets for the LoRaWAN protocol.
\item \emph{HTTP:} HyperText Transfer Protocol, which is currently the most popular standard \item \emph{HTTP:} HyperText Transfer Protocol, which is currently the most popular standard
for web servers and APIs. for web servers and APIs.
\item \emph{JSON:} JavaScript Object Notation, a language for encodings structured data. \item \emph{JSON:} JavaScript Object Notation, a language for encodings structured data.
@ -206,20 +209,30 @@ The LoRa gateway will consist of the following libraries, frameworks, and subsys
\begin{itemize} \begin{itemize}
\item \emph{Raspberry Pi:} The LoRa gateway's primary subcomponent will be \item \emph{Raspberry Pi:} The LoRa gateway's primary subcomponent will be
the Raspberry Pi, a single-board Linux computer. The Raspberry Pi the Raspberry Pi, a single-board Linux computer. The Raspberry Pi
is capable of interfacing with hardware components such as the LoRa is capable of interfacing with hardware components such as the LoRaWAN
shield. It also supports the execution of arbitrary programs, such shield. It also supports the execution of arbitrary programs, such
as the API server and database management software. as the API server and database management software.
\item \emph{LoRa Interface:} The LoRa interface will be used as part of the \item \emph{LoRa Interface:} The LoRa interface will be used as part of the
LoRa gateway to allow communication between the gateway and the collars LoRa gateway to allow communication between the gateway and the collars
in the field. The LoRa interface will be invoked from the API server in the field. The LoRa interface will use the LoRaWAN protocol.
software. To facilitate the implementation of the LoRaWAN protocol, the
LoRa interface will transmit LoRa packets to the Things Network over the internet,
which will respond with decoded data to the MQTT process (described below). % TODO things network?
\item \emph{API Server Software:} The LoRa gateway will execute an API \item \emph{API Server Software:} The LoRa gateway will execute an API
server, which will be responsible for the communication between server, which will be responsible for the communication between
the smart application and the gateway itself. The API server software the smart application and the gateway itself. The API server software
will use the LoRa interface and receive and send data to deployed collars. will use use the SQL-based database on the gateway to interact
with the MQTT process.
\item \emph{Database Management Software:} The LoRa gateway will host \item \emph{Database Management Software:} The LoRa gateway will host
the SQL-based database subsystem. For details on data storage, see the SQL-based database subsystem. For details on data storage, see
the Information view. the Information view.
\item \emph{MQTT Process:} The MQTT process will run on the gateway,
sending and receiving data to the Things Network, which will handle
the the LoRaWAN implementation. This process will use the SQL-based
database to store incoming data points, as well
as to listen for commands from the API Server Software. Commands
from the API Server Software could prompt the MQTT process to
send data over the Things Network and LoRaWAN to the collars.
\end{itemize} \end{itemize}
\subsubsection{Collar} \subsubsection{Collar}
@ -248,7 +261,8 @@ system are as follows:
gateway to provide information from the collars via an HTTP API. gateway to provide information from the collars via an HTTP API.
\item \emph{LoRa Gateway:} The LoRa gateway depends on the deployed \item \emph{LoRa Gateway:} The LoRa gateway depends on the deployed
collar devices to provide data such as their location, battery level, collar devices to provide data such as their location, battery level,
and state. and state. The LoRa gateway also depends on the Things Network to
handle LoRaWAN encoding and decoding.
\item \emph{Collar System Logic:} The collar system logic will dispatch \item \emph{Collar System Logic:} The collar system logic will dispatch
commands to hardware components using the driver software. Thus, commands to hardware components using the driver software. Thus,
it depends on said driver software to interact with the external it depends on said driver software to interact with the external
@ -277,13 +291,13 @@ The following data items will be stored by the Fenceless Grazing Collar system:
\end{itemize} \end{itemize}
\subsubsection{Data Stores} \subsubsection{Data Stores}
The MariaDB database management software will be used on the LoRa gateway to store each data The SQLite database management software will be used on the LoRa gateway to store each data
item. Each type of data item will be stored in a corresponding table in an SQL database. item. Each type of data item will be stored in a corresponding table in an SQL database.
Because the data does not have a complex structure, no normalization is necessary, and Because the data does not have a complex structure, no normalization is necessary, and
the database schema corresponding to each type of data item is exactly as defined above. the database schema corresponding to each type of data item is exactly as defined above.
\subsubsection{Access Mechamisms} \subsubsection{Access Mechamisms}
In the LoRa gateway, SQL queries will be used to store and retrieve data from the MariaDB In the LoRa gateway, SQL queries will be used to store and retrieve data from the SQLite
database. To facilitate the formulation of complex queries, and to improve code clarity, database. To facilitate the formulation of complex queries, and to improve code clarity,
the SQLAclehmy Object Relational Model (ORM) will be used. This library maps data presented the SQLAclehmy Object Relational Model (ORM) will be used. This library maps data presented
in a relational model to objects, thereby allowing for an object-oriented style of interaction in a relational model to objects, thereby allowing for an object-oriented style of interaction
@ -376,8 +390,8 @@ at a time, and the user will be able to switch between tabs at any time. The tab
\end{itemize} \end{itemize}
\subsection{Structure View} \subsection{Structure View}
The LoRa gateway will be constructed using a Raspberry Pi 2b and the corresponding LoRa shield. The LoRa gateway will be constructed using a Raspberry Pi 2b and the corresponding LoRaWAN shield.
The Raspberry Pi and the LoRa shield have compatible pinouts, allowing one to be stacked on top The Raspberry Pi and the LoRaWAN shield have compatible pinouts, allowing one to be stacked on top
of the other without the using of soldering equipment or other, more invasive techniques. of the other without the using of soldering equipment or other, more invasive techniques.
This construction also allows for the simple disassembly of the entire system. This construction also allows for the simple disassembly of the entire system.
@ -405,7 +419,7 @@ in the Interface view. Each action performed by the user in the application (suc
all collar locations, listing all stimulus activiation reports, or viewing the map) corresponds all collar locations, listing all stimulus activiation reports, or viewing the map) corresponds
to an API request made by the application to the LoRa gateway over internet. to an API request made by the application to the LoRa gateway over internet.
The collars interact with the LoRa gateway using the LoRa protocol. As described in the Information view, The collars interact with the LoRa gateway using the LoRaWAN protocol. As described in the Information view,
the collars will broadcast their device state every 15 (fifteen) seconds. the collars will broadcast their device state every 15 (fifteen) seconds.
Furthermore, the collars will broadcast information in the event of a use of an auditory Furthermore, the collars will broadcast information in the event of a use of an auditory
or electical stimulus. These broadcasts will be received by the LoRa gateway, and added to or electical stimulus. These broadcasts will be received by the LoRa gateway, and added to