\documentclass[12pt]{article} %\documentclass[12pt,a4paper]{book} \usepackage{setspace} \usepackage{mathptmx} \usepackage{graphicx} \usepackage[a4paper, total={6in, 8in}]{geometry} \renewcommand{\baselinestretch}{1.5} \usepackage{booktabs} \usepackage{xcolor} \usepackage{hyperref} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Below codes prepare the coding parts of the document. \usepackage{listings} % Python has been chosen as the coding language \lstnewenvironment{code}{% \lstset{% language=Python, % Set the programming language basicstyle=\ttfamily\small, % Set the font style and size showstringspaces=false, % Don't show spaces in strings numbers=left, % Show line numbers on the left numberstyle=\tiny\color{gray}, % Set the style for line numbers commentstyle=\color{gray}, % Set the style for comments keywordstyle=\color{blue}, % Set the style for keywords stringstyle=\color{purple}, % Set the style for strings breaklines=true, % Allow lines to break if they are too long frame=tb % Add a frame around the code }% }{} % Define a style for displaying file names %% I haven't used the \lstinline[style=filename]|filename.txt| for showing file names but I put it here as an example. \lstdefinestyle{filename}{ basicstyle=\ttfamily\small, frame=none, backgroundcolor=\color{gray!10}, rulecolor=\color{black}, aboveskip=1ex, belowskip=1ex, showstringspaces=false, keywordstyle=\color{black}, commentstyle=\color{black}, stringstyle=\color{black}, breaklines=true, breakatwhitespace=true, captionpos=b, keepspaces=true, numbers=none } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \usepackage{caption} \usepackage{longtable} \usepackage{siunitx} \usepackage{float} \author{Alireza Adli} \usepackage{hyperref} \newenvironment{riz}{\fontfamily{riz}\fontsize{0.3cm}{0.3cm}\selectfont}{\par} \hypersetup{ colorlinks, citecolor=black, filecolor=black, linkcolor=black, urlcolor=black } \begin{document} \begin{titlepage} % Insert university logo in top-left corner \begin{picture}(0,0) \put(-70, 35){\includegraphics[width=8cm]{images/concordia.png}} \end{picture} \vspace{2cm} \begin{picture}(0,0) \put(30, -1){\fontsize{12}{18}\selectfont Urban Simulation Platform Projects} \end{picture} % % Title \begin{center} \textbf{\fontsize{22}{18}\selectfont MICROBIAL SYSTEMS} \\ \vspace{0.5cm} \end{center} \vspace{2cm} \begin{picture}(0,0) \put(30, -2){\fontsize{12}{18}\selectfont Written by:\hspace{0.6cm} Alireza Adli} \end{picture} \vspace{4cm} \fontsize{12}{18}\selectfont Project Reseacher: \hspace{0.01cm} Narges Rahimi \begin{picture}(0,0) \put(-1, -2){\fontsize{12}{18}\selectfont Supervisor: \hspace{1.25cm} Professor Ursula Eicker} \end{picture} \begin{picture}(0,0) \put(-1, -2){\fontsize{12}{18}\selectfont Project Integrator: \hspace{0.04cm} Alireza Adli} \end{picture} %\begin{picture}(0,0) %\put(-1, -2){\fontsize{12}{18}\selectfont Supervisors: Professor Ursula Eicker} %\end{picture} \vfill \begin{picture}(0,0) \put(-20,-2){\fontsize{12}{18}\selectfont Next-Generation Cities Institute (NGCI)} \put(330,-2){\fontsize{12}{18}\selectfont September 2022} \end{picture} \end{titlepage} \newpage \newpage This project is a part of The NGCI's Urban Simulation Platform project. The platform has integrated the application of NGCI's research projects in Python programming language. These projects are developed by graduate students and researchers of the institute towards urban sustainable development in six main areas: energy systems, building, transportation, vegetation, waste and recycling, liveability. \\ The integration of a project refers to further development of a research project in Object Oriented Programming (OOP) paradigm following the coding style of the platform. This is done in order to employ multiple projects in a single workflow. \vspace{15\baselineskip} \begin{riz}\noindent For more information about this piece of software and documentation, contact Alireza Adli (\href{mailto:alireza.adli@concordia.ca}{\textcolor{blue}{alireza.adli@concordia.ca}}) For detailed technical information of the project read Narges Rahimi Master's thesis report on the same subject (Link). \end{riz} \newpage \tableofcontents \newpage \section{Model Description} \hspace{0.9cm} A microbial system for wastewater treatment and energy recovery produces hydrogen and power from wastewater.\\ In this project, three microbial systems have been studied and implemented in Python programming: Single Chamber Microbial Electrolysis Cell (SCMEC), Dual Chamber Microbial Electrolysis Cell (DCMEC) and Microbial Fuel Cell (MFC). The project considers the treatment of one litre wastewater. But given the number of inhabitants and water consumption, the system can output results based on the corresponding amount of water.\\ In the first step, the wastewater should be collected from urban areas such as residential buildings. Then, collected wastewater will be injected into the bio-electrochemical systems, including SCMEC, DCMEC, and MFC to treat wastewater and generate hydrogen and electricity. In the first scenario power output of MFC can be used in two different applications such as providing energy for electric vehicle charging stations or urban areas electricity demand. In the second scenario, as the main product of SCMEC and DCMEC, hydrogen can be considered as a type of energy or to feed MFCs to generate power. It should be noted that to run the MECs, the applied voltage can be covered by renewable sources of green electricity such as solar panels and wind turbines. \section{The Project Structure} This project consists of five classes: four classes for modelling different microbial systems and one work-flow class to carry out different simulations. \subsection{MicrobialSystem} This class has been developed in microbial\_systems\_abc.py module. This is an abstract base class (ABC) which has been defined as a template for developing any microbial system models. ABCs cannot be instantiated but they are being developed as the parent of other classes. This is being done when modelling different types of the same system. In this way, the parent class will be used as a template with attributes that are common in different types and main functionalities. These main functionalities are being defined as abstract methods. Any other sub system (different types) should define (override) all the abstract methods of the parent class otherwise, that subclass cannot be instantiated. ABCs raise the control of the main developer over the project. For example, in this project all new child classes should include a mass\_balance(t, values) method with the mentioned parameters. Otherwise, they cannot be instantiated. This is the interface (abstract method) of this Abstract Base Class. This rule is not applied to DualChamberElectrolysisCell class because it inherits from the SingleChamberElectrolysisCell class. \subsection{SingleChamberElectrolysisCell} This class has been developed in single\_chamber\_electrolysis\_cell.py module. SingleChamberElectrolysisCell simulates the system by inheriting constants and abstract methods (interfaces) of the MicrobialSystem class of microbial\_system\_abc module. So the former should be imported for this module to work. To instantiate this class, it is only needed to assign the class to a variable. Example: single = SingleChamberElectrolysisCell() \subsection{DualChamberElectrolysisCell} \begin{sloppypar} This class has been developed in dual\_chamber\_electrolysis\_cell.py module. A dual chamber electrolysis cell is very similar to a single chamber one, so in this project, the DualChamberElectrolysisCell inherits from the SingleChamberElectrolysisCell class for constants and some functionalities. So the SingleChamberElectrolysisCell class of single\_chamber\_electrolysis\_cell.py module should be imported in dual\_chamber\_electrolysis\_cell.py. To instantiate this class, it is only needed to assign the class to a variable. Example: dual = DualChamberElectrolysisCell() \end{sloppypar} \subsection{FuelCell} This class has been developed in microbial\_fuel\_cell.py module. FuelCell simulates this microbial system by inheriting constants and abstract methods (interfaces) of the MicrobialSystem class of microbial\_system\_abc. So the former should be imported for this module to work. To instantiate this class, it is only needed to assign the class to a variable. Example: microbial\_fuel\_cell = FuelCell() \subsection{MicrobialSystemWorkflow} This class has been developed in microbial\_system\_workflow.py module. The module is accessible through below Gitlab link: \\ \href{https://rs-loy-gitlab.concordia.ca/alireza.adli/microbial-system-workflow}{https://rs-loy-gitlab.concordia.ca/alireza.adli/microbial-system-workflow} This class simulate desirable microbial system (currently three systems are available which have been mentioned in previous subsections). There are two parameters needed to instantiate this class: Name of the microbial system (its class should be instantiated either directly or by assigning it to a variable beforehand.) and the time-step. Example: workflow\_1 = MicrobialSystemWorkflow(SingleChamberElectrolysisCell(), (0, 152)) In above example, a single chamber microbial system with time-steps in range zero and 152 has been simulated. There are different outputs available: CSV file or a Pandas dataframe. It is only needed to call the method. Example: workflow\_1.system\_output\_csv() The above example put out a CSV file including the resulted dataset. The plotting() method can be called and used in different ways. The program will ask the user about the desirable plot. The plot can be saved if True has been assigned to the save\_plot keyword argument. The default value is False. Example: workflow\_1.plotting(save\_plot=True) \section{3rd Party Software} \hspace{0.9cm} Following Python packages have been used to develop the project, and are needed to run the project's program: \begin{itemize} \item \textbf{pandas} \item \textbf{numpy} \item \textbf{scipy} \item \textbf{matplotlib} \end{itemize} Python packages are free and accessible from \href{https://pypi.org/}{www.pypi.org}. They can be also installed directly from pycharm, pip or Anaconda prompt. \section{Input Data} \hspace{0.9cm} All the three systems have been designed based on one litre of wastewater as input, by default. But they can be also run with any other amount of wastewater. In this case number of inhabitants and water consumption should be input when instantiating a system. \\ Influent flow is computed by multiplying number of inhabitants by the amount of water consumption. This has been developed as a method of the project's workflow (workflow will be explained in the XXX section). Below table shows project's parameters and their corresponding names in the Python program. \begin{longtable}{p{.45\textwidth} p{.25\textwidth}} \caption{Input parameters and their corresponding data members and/or method in the Python program.}\\ \toprule Parameter (unit) &Python\\ \midrule \midrule Number of inhabitants&number\_of\_inhabitants\\ Water consumption (litre)&water\_consumption\\ Influent flow (litre)&influent\_flow\\ \bottomrule \label{tab:input} \end{longtable} %% fixed tables: %\begingroup %\setlength{\tabcolsep}{30pt} %\begin{table}[ht] %\centering %\caption{Input parameters and their corresponding data members and/or method in the Python program.} %\begin{tabular}[t]{lcc} %\toprule %Parameter (unit) &Python\\ %\midrule %\midrule %Number of inhabitants&number\_of\_inhabitants\\ %Water consumption (litre)&water\_consumption\\ %Influent flow (litre)&influent\_flow\\ %\bottomrule %\end{tabular} %\label{tab:input} %\end{table}% %\endgroup \section{Constants} \hspace{0.9cm} The systems are working at their best performance with a number of constants (based on the conducted research project). These constants are represented in four following tables: constants which are common among the three systems with same values (table \ref{tab:consts_1}), constants which are common among the systems but with different values (table \ref{tab:consts_2}), constants which are specific to microbial electrolysis systems (table \ref{tab:consts_3}), and constants which are specific to the microbial fuel cell (table \ref{tab:consts_4}). \begin{longtable}{p{.5\textwidth} p{.4\textwidth}} \caption{Common constants between the three microbial systems (which have the same values), along with their corresponding data members in the Python program.}\\ \toprule Constant (unit) &Python\\ \midrule \midrule $F$ $(C/mole)$&faraday\\ $R_{1}$ $(J/mole.K)$&ideal\_gas\\ $m$ $(mole\; e^-/mole\; H_{2})$&electrons\_per\_mole\\ $K_{MEC}$ $(mg\; M/L)$&mediator\_half\\ $K_{d,a}$ $(1/d)$&andophilic\_decay\\ $K_{s,a}$ $(mg\; S/L)$&andophilic\_half\\ $K_{s,m}$ $(mg\; S/L)$&methanogenic\_half\\ $X_{max,1}$ $(mg\; S/L)$&andophilic\_limitation\\ $\mu_{max,a}$ $(1/d)$&andophilic\_max\_growth\\ $\gamma$ $(mg\; M/mole\; M^{-1})$&mediator\_molar\_mass\\ $\alpha_{1}$ &andophilic\_biofilm\_retention\\ $\alpha_{2}$ &methanogenic\_biofilm\_retention \\ $S_{A}$ $(m^2)$&anode\_surface\_area \\ \bottomrule \label{tab:consts_1} \end{longtable} \begin{longtable}{p{.5\textwidth} p{.4\textwidth}} \caption{Common constants between the three microbial systems (which have different values), along with their corresponding data members in the Python program.}\\ \toprule Constant (unit) &Python\\ \midrule \midrule $M_{T}$ $(mg\; M /mg\; X^{-1})$&mediator\_fraction\\ $K_{d,m}$ $(1/d)$&methanogenic\_decay\\ $K_{R}$ $(L/ mg\; X)$&curve\_slope\\ $q_{max,a}$ $(mg\; S/mg\; X\; d)$&andophilic\_reaction\_max\\ $q_{max,m}$ $(mg\; S/mg\; X\; d)$&methanogenic\_reaction\_max\\ $R_{min}$ (\SI{}{\ohm})&resistance\_min\\ $R_{max}$ (\SI{}{\ohm})&resistance\_max\\ $V_{r}$ $(L)$&reactor\_volume\\ $Y_{h}$ $(ml\; H_{2}/mg \; X)$&hydrogen\_yield\\ $Y_{M}$ $(mg\; M/mole\; A^{-1})$&mediator\_yield\\ $\mu_{max,m}$ $(1/d)$ &methanogenic\_max\_growth\\ $M_{Ox_0}$ &oxidized\_mediator\_initial \\ $X_{a0}$ $(mg/L)$&andophilic\_population\_initial \\ $X_{m0}$ $(mg/L)$&methanogenic\_population\_initial \\ $I_{MEC} \& I_{MFC}$ $(A)$&initial\_current\_density \\ $F_{inlet}$ &influent\_flow\_initial \\ \bottomrule \label{tab:consts_2} \end{longtable} \begin{longtable}{p{.5\textwidth} p{.4\textwidth}} \caption{Microbial Electrolysis Cell systems' constants and their corresponding data members in the Python program.}\\ \toprule Constant (unit) &Python\\ \midrule \midrule $F_{1}$ $(A.d/mole)$&faraday\_ec\\ $R_{1}$ $(J/mole.K)$&ideal\_gas\_ec\\ $H_{2}$ $(mg\; A /L)$&hydrogen\_2\_saturation \\ $E_{app}$ $(V)$&applied\_potential\\ $E_{CEF}$ $(V)$&counter\_electromotive\_force\\ $[H_{2}]$ $(mg/L)$ &hydrogen\_2\_dissolved\\ $K_{h}$ $(mg/L)$ &hydrogenotrophic\_half\\ $K_{d,h}$ $(1/d)$&hydrogenotrophic\_decay\\ $X_{max,2}$ $(mg\; X /L)$&max\_biomass\\ $Y_{h}$ $(ml\; H2/ mg\; X)$&hydrogen\_yield\_methanogenic\\ $Y_{H_{2}}$ &hydrogen\_yield\\ $\beta$&oxidation\_coefficient\\ $S_{0}$ $(mg/L)$&acetate\_initial\\ $X_{h0}$ $mg/L$&hydrogenotrophic\_population\_initial\\ \bottomrule \label{tab:consts_3} \end{longtable} \begin{longtable}{p{.5\textwidth} p{.4\textwidth}} \caption{Constants and their corresponding data members in the Python program Python program Python program.}\\ \toprule Constant (unit) &Python\\ \midrule \midrule $E_{min}$ $(V)$&e\_ocv\_min\\ $E_{max}$ $(V)$&e\_ocv\_max\\ $K_{X}$ $(L/mg\; X)$&steepness \\ $X_{max,m}$ $(mg\; X/L)$&biofilm\_space\_limitation\\ $E_{CEF}$ $(V)$&counter\_electromotive\_force\\ $[H_{2}]$ $(mg/L)$ &hydrogen\_2\_dissolved\\ $K_{h}$ $(mg/L)$ &hydrogenotrophic\_half\\ $K_{d,h}$ $(1/d)$&hydrogenotrophic\_decay\\ $X_{max,2}$ $(mg\; X /L)$&max\_biomass\\ $Y_{h}$ $(ml\; H2/ mg\; X)$&hydrogen\_yield\_methanogenic\\ $Y_{H_{2}}$ &hydrogen\_yield\\ $\beta$&oxidation\_coefficient\\ $S_{0}$ $(mg/L)$&acetate\_initial\\ $X_{h0}$ $mg/L$&hydrogenotrophic\_population\_initial\\ \bottomrule \label{tab:consts_4} \end{longtable} \section{Output Data} %\begin{itemize} %\item A list and description of all the types of data that are output by the model. %\item Information on the format of each type of output data. %\item Links to any use-case or test output data that you have. %\end{itemize} The output of each system can be reached either through a pandas dataframe or a Comma Separated Value (CSV). After instantiating MicrobialSystemWorkflow class, below methods return the corresponding system's output pandas dataframe: \begin{itemize} \item single\_chamber\_dataframe() \item dual\_chamber\_dataframe() \item fuel\_cell\_dataframe() \end{itemize} system\_output\_csv() return output CSV file, based on the system model that has been chosen in instantiation. Table \ref{tab:output} shows output data names as in the pandas dataframe and CSV files with their corresponding data members in Python and parameter names in the project report. It should be mentioned that, for all the three systems, acetate has been considered as the main substrate. This has been referred in the report's formulas with 'S'. Time is also a timestep from the whole number of iterations. \begingroup \setlength{\tabcolsep}{17pt} \begin{table}[ht] \centering \caption{Output data of a single chamber microbial electrolysis system} \begin{tabular}[t]{lcc} \toprule Parameter (unit) &Python &CSV\\ \midrule \midrule t &time &Time\\ $(S)$ $(mg_{s}/L)$ &acetate &Acetate (mg\_s/L)\\ $(X_{a})$ $(mg_{x}/L)$ &andophilic\_population &Andophilic Population (mg\_x/L)\\ $S$ $(mg/L)$ &methanogenic\_popoulation &Methanogenic Popoulation (1/d)\\ $S$ $(mg/L)$ &acetate &Acetate (mg\_s/L)\\ \bottomrule \end{tabular} \label{tab:output} \end{table}% \endgroup \section{Limitations} Limitations have not been defined for the project. \section{Technical Performance} The output will be achieved almost less than five seconds. The performance can be slightly different based on different inputs for time intervals. \end{document}