# A Methodology to Model the Rain and Fog Effect on the Performance of Automotive LiDAR Sensors
## 4 Modeling of the Rain and Fog Effect in the Virtual LiDAR Sensor
### Mie Scattering Theory  
Scattering is the process where a particle changes the direction of the incident wave, while absorption is the process where heat energy is produced. Both scattering and absorption extract energy from the incident wave and are called extinction [31]. Mathematically, it can be written as:  
\[Q_{ext}=Q_{sca}+Q_{abs}, \tag{5}\]  
where \(Q_{ext}\) is the extinction efficiency, \(Q_{sca}\) denotes the scattering efficiency, and \(Q_{abs}\) shows the absorption efficiency [31]. In addition, the raindrops backscattered the incident LiDAR ray, and this phenomenon is known as backscattered efficiency \(Q_{back}\)[31].  
The Mie scattering theory can be used to calculate the extinction efficiency \(Q_{ext}\), the scattering efficiency \(Q_{sca}\), and the backscattered efficiency \(Q_{back}\) for LiDAR sensors. They can be calculated as:  
\[Q_{ext}=\frac{2}{x^{2}}\sum_{n=1}^{N_{max}}(2n+1)\cdot\Re(a_{n}+b_{n}), \tag{6}\]  
\[Q_{sca}=\frac{2}{x^{2}}\sum_{n=1}^{N_{max}}(2n+1)\cdot\Big{(}|a_{n}|^{2}+|b_{n }|^{2}\Big{)}, \tag{7}\]  
\[Q_{back}=\frac{1}{x^{2}}\Bigg{|}\sum_{n=1}^{N_{max}}(2n+1)(-1)^{n}\cdot(a_{n}- b_{n})\Bigg{|}^{2}, \tag{8}\]  
where \(x\) is the size parameter, \(\Re\) denotes the real part, \(N_{max}=x+4x^{\frac{1}{3}}+10\), and \(a_{n}\) and \(b_{n}\) are the complex Mie coefficients [31]. The Mie coefficients can be calculated using the spherical Bessel functions [32] and the method introduced by [PERSON] [33]. The [PERSON] method is computationally less expensive, so we have used it in this work. According to this algorithm, the Mie coefficients can be written as:  
\[a_{n}=\frac{[r_{n}(mx)/m+n(1-1/m^{2})/x]\Psi_{n}(x)-\Psi_{n-1}(x)}{[r_{n}(mx) /m+n(1-1/m^{2})/x]\xi_{n}(x)-\xi_{n-1}(x)}, \tag{9}\]  
and:  
\[b_{n}=\frac{r_{n}(mx)m\Psi_{n}(x)-\Psi_{n-1}(x)}{r_{n}(mx)m\xi_{n}(x)-\xi_{n- 1}(x)}, \tag{10}\]  
where \(m\) is the complex refractive index of water, the size parameter is denoted by \(x\), \(r_{n}(mx)=\frac{\Psi_{n-1}(mx)}{\Psi_{n}(mx)}\) presents the complex ratio of the Riccati-Bessel functions, and \(\Psi_{n}(x)\) and \(\zeta_{n}(x)\) are Riccati-Bessel functions. The complex ratio \(r_{n}(mx)\) can be calculated using the upward and downward recurrences, and it can be written as:  
\[r_{n+1}(mx)=\bigg{[}\frac{2n+1}{mx}-r_{n}(mx)\bigg{]}^{-1}. \tag{11}\]  
The downwards recurrence of \(r_{n}(mx)\) is initialized by:  
\[r_{N^{*}}(mx)=(2N^{*}+1)/(mx), \tag{12}\]and the values are iteratively calculated until \(n=1\). \(N^{*}\) controls the precision of the Mie scattering coefficients, and it should be greater than \(N^{*}>\) 11,010 if six significant digits or higher precision are required [33]; in this work, we have used \(N^{*}>\) 30,000 to obtain seven significant digits precision. The Riccati-Bessel functions \(\Psi_{n}(x)\) and \(\zeta_{n}(x)\) of Equation (9) can also be calculated by using the upward and downward recurrences and can be written as:  
\[\Psi_{n+1}(x)=(2n+1)\Psi_{n}(x)/x-\Psi_{n-1}(x). \tag{13}\]  
The complex function \(\zeta_{n}(x)\) can be defined as:  
\[\zeta_{n}(x)=\Psi_{n}(x)+i\chi_{n}(x). \tag{14}\]  
The same Formula (13) applies to \(\chi_{n}(x)\). The upward recurrence of \(\Psi_{n}(x)\) is initialized with \(\Psi_{-1}(x)=\cos(x)\) and \(\Psi_{0}(x)=\sin(x)\), and vice versa for the downward recurrence, while the upward recurrence of \(\chi_{n}(x)\) starts with \(\chi_{-1}(x)=\sin(x)\) and \(\chi_{0}(x)=\cos(x)\), and vice versa for the downward recurrence [33].