Research Article

A Low-Cost Online Data Acquisition and Processing System for Industrial Pollutants’ Monitoring

Algorithm 3

Send data to RMC.
\documentclass[11pt]{article}
\usepackage{CJK}
\usepackage[top=2cm, bottom=2cm, left=2cm, right=2cm]{geometry}
\usepackage{algorithm}
\usepackage{algorithmicx}
\usepackage{algpseudocode}
\usepackage{amsmath}
\usepackage{indentfirst}
\floatname{algorithm}{Algorithm}
\renewcommand{\algorithmicrequire}{\textbf{Input:}}
\renewcommand{\algorithmicensure}{\textbf{Output:}}
\begin{document}
\begin{CJK∗}{UTF8}{gkai}
 \renewcommand{\thealgorithm}{3}
 \begin{algorithm}
  \caption{Send Data to RMC}
  \begin{algorithmic}[1] %每行显示行号
   \Require $client:$asynchronous socket client, $cp: $command parameter, a string contains the data to be passed,$reply:$need reply, $saphores:$global variables, dictionary structure used to store semaphores
   \State $data \gets$ packs the cp to data package
   \State send data to RMC using client
   \If {$reply \neq True $}
   \State $return$
   \EndIf
   \State $saphore \gets $ new AutoResetEvent
   \State add saphore to saphores
   \State waiting for saphore reset
   \While{not reset}
    \If {not exceeded number of retransmission}
     \State retransmission
    \EndIf
   \EndWhile
  \end{algorithmic}
 \end{algorithm}
 \end{CJK∗}
\end{document}