# ECC: Passenger Counting in the Elevator Using Commodity WiFi
## 2 Theoretical Analysis  
### The Variation of CSI with the Passenger Number  
The CSI of one sub-carrier can be expressed as [26; 27]:  
\[H=\sum_{i=1}^{p}|A_{i}|\cdot e^{-i\phi_{i}} \tag{1}\]  
where, \(p\) is the number of propagation paths. \(|A_{i}|\) and \(\phi_{i}\) denote the amplitude and phase values, respectively. Since the center frequency of each sub-carrier is different, for \(m\) sub-carriers, the channel CSI matrix is denoted as \(H_{r}=[H_{1},H_{2},\ldots,H_{m}]\). People affect the link in two major ways: Line of Sight (LoS) path and multi-path. Each person may reflect or block the signal and cause the receive vector to be strengthened or weakened. The receive matrix of one antenna is denoted as \(Y_{i}\). Thus, if there have \(p\) propagation paths from a transmit antenna (Tx) to one receive antenna (Rx), the receive matrix can be expressed as:  
\[Y=Y_{1}+Y_{2}+Y_{3}+\cdots+Y_{\rm P}=\sum_{i=1}^{p}Y_{i} \tag{2}\]  
hence, the orthogonal frequency division multiplexing (OFDM) system in the frequency domain is modeled as \(Y=H_{r}X+N_{v}\). \(X\) and \(N_{v}\) are the transmit vectors and the noise vectors, respectively. Hence, the estimated value of \(H_{r}\) can be expressed as:  
\[\hat{H}_{r}=\frac{Y}{X}=\frac{1}{X}\sum_{i=1}^{p}Y_{i} \tag{3}\]  
In radio communications, the OFDM systems are widely used to divide the wireless network spectrum into orthogonal sub-carriers. However, the emitted WiFi signals often do not reach the receive antenna directly due to obstacle blocking and multi-path effects of signal propagation [23]. A portion of the signals passes through the medium, while other signals are reflected or absorbed by the medium. Hence, the signal has different degrees of attenuation during transmission and different reflection coefficients on the various mediums, which are calculated as follows [28]:  
\[\Gamma\ =\ \left|\frac{E^{\prime}}{E}\right|^{2}\ \approx\ \frac{\left(1-\sqrt{\frac{2w \varepsilon_{0}}{\sigma}}\right)^{2}+1}{\left(1+\sqrt{\frac{2w\varepsilon_{0} }{\sigma}}\right)^{2}+1}\ \approx\ 1-2\sqrt{\frac{2w\varepsilon_{0}}{\sigma}} \tag{4}\]  
where \(E^{\prime}\) and \(E\) are the energy of the reflected signal and the incident signal. \(w\), \(\varepsilon_{0}\), and \(\sigma\) are the frequency constant, dielectric constant, and the conductivity of the medium, respectively. As \(\Gamma\) is close to \(1\), as \(\sigma\rightarrow\infty\), the signal strength reflected by the medium is becoming stronger. The reflection coefficient of walls and furniture is about 65-78% which is close to 70% of people. Hence, many approaches require people to keep moving to reflect the variation of signals for separating people from objects. If people are in a static state, the performance of these methods will become weakened. Unlike indoors, the elevator is mainly composed of metal materials with no occlusion inside. Hence, the reflection coefficient inside the elevator can reach more than 90%. The intensity of signal propagation is stronger than the indoor environment, and different crowd numbers will produce a drastic variation of signal. The relationship between the variation of CSI and the passenger number can be revealed. The probability of signal reflection inside the elevator can be calculated as follows:  
\[S_{f}(n)\approx 0.7\cdot S_{b}(n)+0.9\cdot(1-S_{b}(n))=1-0.2\cdot S_{b}(n) \tag{5}\]  
where \(n\) is the passenger number, \(S_{b}(n)\) is the probability of signal occlusion, and \(S_{b}(n)\) satisfies \(\frac{S_{b}(n+1)-S_{b}(n)}{S_{b}(n)}>n\), which illustrates that the probability of signal occlusion will increase as the passenger number grows [29]. Hence, the following inequality can be inferred:  
\[S_{f}(n+1)-S_{f}(n)<n\cdot\left(S_{f}(n)-1\right)<0 \tag{6}\]  
Equation (6) shows that the probability of signal reflection reduces as the passenger number increase, which also proves the signal propagation path number reduces.