diff --git a/.gitignore b/.gitignore index c795b054e5ade51b7031abab1581a5b7e2d2f5ba..41648573d6a9a01f81300401c7440bf473421b8f 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,7 @@ -build \ No newline at end of file +build +doc/opc/Smart Grid Modell OPC Server.aux +doc/opc/Smart Grid Modell OPC Server.fdb_latexmk +doc/opc/Smart Grid Modell OPC Server.fls +doc/opc/Smart Grid Modell OPC Server.log +doc/opc/Smart Grid Modell OPC Server.out +doc/opc/Smart Grid Modell OPC Server.synctex.gz diff --git a/doc/opc/Smart Grid Modell OPC Server.pdf b/doc/opc/Smart Grid Modell OPC Server.pdf new file mode 100644 index 0000000000000000000000000000000000000000..721b3e5cd23f399984229d881a920ba7b6f2960e Binary files /dev/null and b/doc/opc/Smart Grid Modell OPC Server.pdf differ diff --git a/doc/opc/Smart Grid Modell OPC Server.tex b/doc/opc/Smart Grid Modell OPC Server.tex new file mode 100644 index 0000000000000000000000000000000000000000..18f7a78dc992cb8531fc9940e022e3e122565d0d --- /dev/null +++ b/doc/opc/Smart Grid Modell OPC Server.tex @@ -0,0 +1,87 @@ +% docker-container.tex - Small introduction into docker +% Copyright (C) 2020 Armin Co +% +% This document is free software: you can redistribute it and/or +% modify it either under the terms of the Creative Commons +% Attribution-ShareAlike 3.0 License, or under the terms of the +% GNU General Public License as published by the Free Software +% Foundation, either version 3 of the License, or (at your option) +% any later version. +% +% This document is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this document. If not, see <http://www.gnu.org/licenses/>. +% +% You should have received a copy of the Creative Commons +% Attribution-ShareAlike 3.0 Unported License along with this +% document. If not, see <http://creativecommons.org/licenses/>. + +\documentclass[12pt, a4paper]{article} + +\usepackage{pgscript} +\setcounter{secnumdepth}{0} + +\newcommand{\mylicense}{CC-by-sa (Verision 3.0) oder GNU GPL (Version 3 oder höher)} +\newenvironment{bibcomment}{% found at: https://tex.stackexchange.com/questions/133475/how-to-add-running-text-between-bibliography-items + \item[]\begingroup\par\parshape0\em +}{% + \par\endgroup +} + +\begin{document} + + \makebox(0,0.005)[tl]{\includegraphics[scale=0.72]{logo-hochschule-bochum-cvh-text-v2.pdf}}\hfill + \makebox(0,0)[tr]{ \includegraphics[scale=0.5]{logo-hochschule-bochum.pdf}} + + \par\bigskip\bigskip + \begin{center} + \Large + IT-Systeme in Produktion und Automatisierungstechnik + \par\smallskip + \Huge\textbf{OPC UA Server} + \par\medskip + \Large + für das Smart Grid Modell + \end{center} + + + + + \newpage + + \begin{thebibliography}{} + \begin{bibcomment} + Die Online Quellen beziehen sich auf den Stand im Mai 2020. + + \end{bibcomment} + + Weitere Quellen + \begin{itemize} + \item Introduction into docker images \\ + \url{https://jfrog.com/knowledge-base/a-beginners-guide-to-understanding-and-building-docker-images/} + + \end{itemize} + + \vfill + + \begingroup + + \small + + \setlength{\leftskip}{3cm} + + + Copyright \copyright\ 2020\quad Armin Co\\ + Lizenz: \mylicense + + Sie können diesen Text einschließlich \LaTeX-Quelltext + herunterladen unter:\\ + \url{https://gitlab.cvh-server.de/aco/smart-grid-modell} + + \endgroup + +\end{document}} \ No newline at end of file diff --git a/doc/opc/logo-hochschule-bochum-cvh-text-v2.pdf b/doc/opc/logo-hochschule-bochum-cvh-text-v2.pdf new file mode 100644 index 0000000000000000000000000000000000000000..3725a72c764b4d9ab200553474e4262161f7a5b5 Binary files /dev/null and b/doc/opc/logo-hochschule-bochum-cvh-text-v2.pdf differ diff --git a/doc/opc/logo-hochschule-bochum.pdf b/doc/opc/logo-hochschule-bochum.pdf new file mode 100644 index 0000000000000000000000000000000000000000..8cad73dbb48a2b550bf29355b5a6ec895ce091f8 Binary files /dev/null and b/doc/opc/logo-hochschule-bochum.pdf differ diff --git a/doc/opc/pgscript.sty b/doc/opc/pgscript.sty new file mode 100644 index 0000000000000000000000000000000000000000..87f429681f077af606f16dec5fbf439a6b5bb93c --- /dev/null +++ b/doc/opc/pgscript.sty @@ -0,0 +1,139 @@ +% pgscript.sty - LaTeX Settings for Lecture Notes +% Copyright (C) 2012, 2015, 2017, 2018 Peter Gerwinski +% +% This document is free software: you can redistribute it and/or +% modify it either under the terms of the Creative Commons +% Attribution-ShareAlike 3.0 License, or under the terms of the +% GNU General Public License as published by the Free Software +% Foundation, either version 3 of the License, or (at your option) +% any later version. +% +% This document is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this document. If not, see <http://www.gnu.org/licenses/>. +% +% You should have received a copy of the Creative Commons +% Attribution-ShareAlike 3.0 Unported License along with this +% document. If not, see <http://creativecommons.org/licenses/>. + +\usepackage{amsfonts} +\usepackage[colorlinks,allcolors=blue]{hyperref} +\usepackage[british,german]{babel} % Yes, really "german" and not "ngerman". +\usepackage[utf8]{luainputenc} % Without this, umlauts are broken. Weird. +\usepackage{microtype} +\usepackage[T1]{fontenc} +\usepackage{times} +\usepackage{helvet} +\renewcommand*\familydefault{\sfdefault} +\usepackage{graphicx} +\usepackage{ifluatex} +\usepackage{xcolor} +\usepackage{enumerate} +\usepackage{ifthen} + +%% Repair kerning: Automatically insert "\kern{-0.15em}" between "//" % (in URLs). +%% PG20151206: This seems unnecessary here. Maybe due to \sf? +%\ifluatex +%\directlua{ +% local glyph = node.id ("glyph") +% local function my_kerning (head) +% for t in node.traverse (head) do +% if t.id == glyph and t.char == 47 then +% if t.next +% and t.next.next +% and t.next.next.id == glyph +% and t.next.next.char == 47 then +% local k = node.new ("kern") +% k.kern = tex.sp ("-0.15em") +% k.next = t.next +% k.prev = t +% t.next.prev = k +% t.next = k +% end +% end +% end +% node.kerning (head) +% end +% luatexbase.add_to_callback ("kerning", my_kerning, "URL kerning") +%} +%\fi + +\definecolor{blendedblue}{rgb}{0.2,0.2,0.7} +\definecolor{darkgreen}{rgb}{0.0,0.3,0.0} +\definecolor{darkred}{rgb}{0.7,0.0,0.0} +\definecolor{darkgrey}{rgb}{0.4,0.4,0.4} + +\newcommand{\breath}{\bigskip\goodbreak} +\newcommand{\subsubsubsection}[1]{\breath\par\textbf{#1}\nopagebreak\par} +\newenvironment{experts}{\color{darkgrey}}{} +\newenvironment{whiteout}{\definecolor{darkgreen}{rgb}{1.0,1.0,1.0}% + \definecolor{darkred}{rgb}{1.0,1.0,1.0}% + \color{white}}{} +\newenvironment{hint}{% + \begin{quote} + \addtolength{\leftskip}{0.6cm}% +% \includegraphics[width=1cm]{Zeichen_101_-_Gefahrstelle,_StVO_1970.pdf} + \makebox(0,0)[r]{\includegraphics[width=1cm]{Zeichen_101_-_Gefahrstelle,_StVO_1970.pdf}\hspace*{0.5em}}% +% \hangindent 1.2cm +% \hangafter 2 + \bfseries +% Foobar Foobar Foobar Foobar Foobar Foobar Foobar Foobar +% Foobar Foobar Foobar Foobar Foobar Foobar Foobar Foobar +% Foobar Foobar Foobar Foobar Foobar Foobar Foobar Foobar +% Foobar Foobar Foobar Foobar Foobar Foobar Foobar Foobar + \ignorespaces +}{% + \end{quote} +} +\urlstyle{sf} +\newcommand{\file}[1]{{\color{blendedblue}#1}} +\newcommand{\textarrow}{{\boldmath $\longrightarrow$}} +\newcommand{\arrowitem}{\item[\textarrow]} +\newcommand{\strong}[1]{\textbf{#1}} +\newcommand{\newterm}[1]{\strong{\emph{\color{darkgreen}#1}}} +\newcommand{\term}[1]{\emph{\color{darkgreen}#1}} + +\newcounter{exercise} +\newcommand{\exercise}[1]{\addtocounter{exercise}{1}\subsection*{Aufgabe \arabic{exercise}: #1}} +\newcommand{\solution}{\subsubsection*{Lösung}} + +\newcounter{points} +\newcommand{\points}[1]{\ifthenelse{#1=1}{(1 Punkt)}{(#1 Punkte)}\addtocounter{points}{#1}} + +\newcommand{\gitfile}[3]{\href{https://gitlab.cvh-server.de/pgerwinski/#1/raw/master/#2/#3}{\file{#3}}} + +\usepackage{listings} +\lstset{basicstyle=\color{blendedblue}, + language=C, + captionpos=b, + gobble=4, + xleftmargin=1em, + columns=fullflexible, + moredelim=**[is][\color{red}]{¡}{¿}} +\lstdefinestyle{numbered}{xleftmargin=2em, + numbers=left, + numberstyle=\footnotesize\color{gray}} +\lstdefinestyle{terminal}{basicstyle=\ttfamily\color{darkgreen}, + language={}, + columns=fixed, + moredelim=**[is][\color{darkred}]{¡}{¿}, + moredelim=**[is][\color{blendedblue}]{°}{¿}, + moredelim=**[is][\sffamily\it\lstset{columns=fullflexible}]{²}{¿}} +\lstdefinestyle{cmd}{basicstyle=\ttfamily\color{darkred}, + language={}, + columns=fixed, + moredelim=**[is][\color{darkgreen}]{¡}{¿}, + moredelim=**[is][\color{blendedblue}]{°}{¿}, + moredelim=**[is][\sffamily\it\lstset{columns=fullflexible}]{²}{¿}} + +\setlength{\textwidth}{16.5cm} +\setlength{\textheight}{26.0cm} +\setlength{\hoffset}{-1.5cm} +\setlength{\voffset}{-3.0cm} +\setlength{\parindent}{0pt} +\setlength{\parskip}{\medskipamount} +\setlength{\unitlength}{1cm} diff --git a/src/apps/smart_grid/smg_server.cpp b/src/apps/smart_grid/smg_server.cpp index 60749c5090d77089c7f2118f41e6af813f36b36a..67f865575c8cec75eb68fb1b2c7d4350cec05471 100644 --- a/src/apps/smart_grid/smg_server.cpp +++ b/src/apps/smart_grid/smg_server.cpp @@ -25,7 +25,6 @@ int main(int argc, char **argv) { exit(1); } - std::cout << "Starting OPC server.." << std::endl; HardwareControl hardware{i2c_channel}; SmartGridModel model{hardware}; @@ -33,6 +32,7 @@ int main(int argc, char **argv) SmartOpcServer server{stateMachine}; + std::cout << "OPC Server is running.." << std::endl; server.run_server(); // spdlog::info("End"); diff --git a/start_server.sh b/start_server.sh index 32cd50f21ecf1c4bdf9f93e0edf0857a6553b969..a4536567d8240a5a9775bcac93e066cbcce4eaf4 100755 --- a/start_server.sh +++ b/start_server.sh @@ -3,19 +3,19 @@ # Start server ./build/smart_grid.exe & SMART_GRID_PID=$! +echo Smart Grid PID: $SMART_GRID_PID # Wait for exit echo "Press 'q' to exit" -count=0 while : ; do -read -n 1 k <&1 -if [[ $k = q ]] ; then -printf "\nQuitting from the program\n" -kill $SMART_GRID_PID -./all_off.sh -break -else -echo "" -echo "Press 'q' to exit" -fi + read -n 1 key <&1 + + if [[ $key = q ]] ; then + printf "\nQuitting from the program\n" + kill $SMART_GRID_PID + ./all_off.sh + break + else + echo "\nPress 'q' to exit" + fi done \ No newline at end of file