# A New Hybrid Prime Code for OCDMA Network Multimedia Applications
## 6 BER Performance Analysis  
Each HPC sequence is characterized by the following parameters:  
1. Code length \(L\) equal to \(L=2\sum\limits_{i=1}^{n}P_{i}\), where \(P_{i}\) is the prime number and \(n\) is the number of the different prime numbers used for the code construction. \(2n\), is the number of code words in each code sequence generated.  
The total number of sequences generated \(K=2 nP_{min}(P_{min}-1)\), where \(P_{min}\) is the minimum prime number used for the code construction.  
Throughout the analysis, it is assumed that \(N\) is the maximum number of active users out of the \(K\) number of sequences available, with the remaining number of users being inactive. In addition, \(\alpha_{n}\), \(n\ \in\ \{1,\ 2,\ \ldots\ldots,\ K\}\) is given as a random variable which is defined as [48; 49]:  
\[\alpha_{n}=\left\{\begin{array}{ll}1,&\text{if user \#$n$ is active}\\ 0,&\text{if user \#$n$ is inactive}\end{array}\right. \tag{3}\]  
Thus, \(\sum\limits_{n=1}^{K}\alpha_{n}=N\).  
Furthermore, the number of active users in the first group can be represented by a random variable \(U\), and \(u\) is the variable that realizes \(U\). When user #2 is recommended, then \(U=\sum\limits_{n=1}^{K}\alpha_{n}\), and its probability function can be written as:  
\[P_{U}(u)=\frac{\left(\begin{array}{c}K\\ N-u\end{array}\right)\left(\begin{array}{c}K_{1}\\ u-1\end{array}\right)}{\left(\begin{array}{c}K-1\\ N-1\end{array}\right)}\ldots,\ u\in\{u_{min},u_{min+1},\ldots\ldots\ldots,u_{max}\} \tag{4}\]  
where \(u_{min}=max(N+P_{1}-K,1)\), and \(u_{max}=min(N,P_{1})\).  
Figure 20: The proposed OCDMA system model.  
Assume each PPM pulse having a number of photons \(Q\) that can be defined by \(Q=\frac{P_{P}}{P_{1}}\times ln\left(\frac{M}{W}\right)\). Furthermore, the random vector \(l=(l_{0},\;l_{1},\;\ldots\ldots,l_{M-1})U\) represents the amount of MAI interference, where \(l_{j}\) is a random variable representing the number of pulses interfering the time slot number \(j\). Additionally, \(w=(w_{0},w_{1},\ldots\;\ldots,w_{M-1})^{U}\) is the vector that realizes the vector \(l\) and \(U=u\).  
The probability of the random vector \(l\) can be expressed as:  
\[\begin{split} P_{\begin{subarray}{c}i:U\\ i:U\end{subarray}}(w_{0},\;w_{1},\;\ldots\ldots,w_{M-1}\vdots u)=\frac{1}{M^{N -u}}\frac{(N-u)!}{w_{0}!w_{1}!\ldots\ldots w_{M-1}!}\end{split} \tag{5}\]  
where \(\sum\limits_{j=0}^{M-1}w_{j}=N-U\).  
In case of the PPM-OCDMA scheme, the BER performance can be expressed as:  
\[P_{b}=\frac{M}{2(M-1)}\sum\limits_{u=u_{min}}^{u_{max}}P_{E}.P_{U}(u) \tag{6}\]  
According to the characteristics of HPC, Equation (5) can be modified as:  
\[\begin{split} P_{E}\geq\sum\limits_{w_{1}=L}^{N-u}\left(\begin{array} []{c}N-u\\ w_{1}\end{array}\right)\frac{1}{M^{\mathrm{T}1}}.\left(1-\frac{1}{M}\right)^{N-u -w_{1}}\cdot\sum\limits_{w_{0}=0}^{\mathrm{min}(w_{1}-2P,\;N-u-w_{1})}\left( \begin{array}{c}N-u-w_{1}\\ w_{0}\end{array}\right)\frac{1}{(M-1)^{w_{0}}}\\ \left(1-\frac{1}{M-1}\right)^{N-u-w_{0}-w_{1}}+0.5\sum\limits_{w_{1}=L-1}^{ \mathrm{T}-u}\left(\begin{array}{c}N-u\\ w_{1}\end{array}\right)\frac{1}{M^{\mathrm{T}1}}\left(1-\frac{1}{M}\right)^{N -u-w_{1}}\\ \left(\begin{array}{c}N-u-w_{1}\\ w_{1}-L+1\end{array}\right)\frac{1}{(M-1)^{w_{1}-L+1}}\times\exp\left(-Q\frac{ (L-1)^{2}}{4(L-1+w_{0}+w_{1})}\right)\end{split} \tag{7}\]