## 2 Materials and Methods  
### Analytical Power Allocation System Design  
In this paper, power allocation is typically performed on a subcarrier basis in OFDM systems. This approach allows for more efficient use of the frequency spectrum, as the power assigned to each subcarrier can be adjusted according to varying channel conditions, such as different levels of interference or fading. Specifically, subcarriers that experience significant fading and exhibit lower bit error rates receive less power, while those less affected by fading or interference can be allocated more power. This paper also includes additional explanations regarding the analytical equations involved in this method. The BER using OFDM modulation is directly related to the optical channel's subcarrier SNR, modulation order scheme, and fading conditions in free-space optical systems. In M-QAM modulation, the BER can be calculated using standard equations. The effects of fading due to atmospheric turbulence are modeled using a Gamma-Gamma distribution for the SNR. The bit error rate regarding the signal-to-noise ratio can be extracted using OFDM and M-order QAM in a free-space optical communication system. The process for calculating the bit error rate is outlined in the following equations. In the initial stage, the  
Figure 1: Power allocation in OFDM optical wireless communication using embedded systems and analytical methods. path loss is defined by Equation (1). In this equation, d represents the distance between the transmitter and receiver, \(\lambda\) denotes the wavelength of the optical signal, and \(\rm G_{T}\) and \(\rm G_{R}\) are the optical gains of the transmitter and receiver, respectively. \[\rm L=\left(\frac{4\pi d}{\lambda}\right)^{2}\times\frac{1}{G_{T}\times G_{R}} \tag{1}\]  
Next, the receiver's power is calculated considering path losses and transmitter power. Equation (2) describes how the receiver power is calculated by dividing the transmitter power by the path loss. \[\rm P_{r}=\frac{P_{t}}{L} \tag{2}\]  
After determining the receiver's power, the next step is calculating the subcarrier SNR. The signal-to-noise ratio is calculated using Equation (3), where \(\rm P_{r}\) denotes the receiver power and \(\rm N_{0}\) denotes the noise power. \[\rm SNR=\frac{P_{r}}{N_{0}} \tag{3}\]  
The BER is determined based on the subcarrier SNR. Equation (4) [30,31] illustrates the bit error rate as a function of the subcarrier signal-to-noise ratio for QAM modulation, where M represents the modulation order. In Equation (5), Q(x) is the Q-function, which represents the tail probability of the standard normal distribution. \[\rm BER_{M-QAM}=\frac{4}{\log_{2}M}\times\left(1-\frac{1}{\sqrt{M}}\right) \times Q\left(\sqrt{\frac{3\log_{2}M\times SNR}{M-1}}\right) \tag{4}\]  
\[\rm Q(x)=\frac{1}{\sqrt{2\pi}}{\int_{x}^{\infty}e^{-\frac{x^{2}}{2}}dt} \tag{5}\]  
The channel gain must be determined to calculate the bit error rate in an optical channel affected by fog. Equation (6) [30,31] defines the channel gain under the influence of fog. In this equation, c is the speed of light, \(\alpha\) is the fog attenuation coefficient, and d is the channel length. Additionally, Equation (7) illustrates the bit error rate associated with the subcarrier signal-to-noise ratio for a channel affected by fog. In this equation, M represents the modulation order. \[\rm G=\left(\frac{c}{4\pi d}\right)^{2}\times e^{-\alpha d} \tag{6}\]  
\[\rm BER_{Foggy\ channel}=\frac{4}{\log_{2}M}\times\left(1-\frac{1}{\sqrt{M}} \right)\times Q\left(\sqrt{\frac{3\log_{2}M\times SNR}{G\times(M-1)}}\right) \tag{7}\]  
First, the probability distribution function of a channel with the Gamma-Gamma distribution model must be defined to calculate the BER. Equation (8) obtains the probability distribution function in the Gamma-Gamma model. In this function, h is a random variable with a probability distribution defined by parameters \(\alpha\) and \(\beta\).