# Fuzzy Logic-Based Performance Enhancement of FSO Systems Under Adverse Weather Conditions
## 3 Fuzzy Modeling for Enhancing Receiver Performance in FSO System
### Adaptive BER Threshold Adjustment Mechanism for FSO-FLC-OCDMA Receivers
The Center of Gravity (COG) method is employed for defuzzification, as it delivers an accurate result by calculating the Weighted Average of multiple output membership functions [26]. \[T-BER=GOC=\frac{\int_{x\beta}Z(x)xdx}{\int_{x\beta}Z(x)dx},(\text{if x is continuous})\] (10)

Figure 8: Decision flow of the fuzzy logic controller (FLC) integrated in the FSO receiver. \[T-BER=GOC=\frac{\sum_{x\beta}Z(x)xdx}{\sum_{x\beta}Z(x)dx},(\text{if x is discrete}) \tag{11}\]
* Step 7--Monitor Actual BER: Regularly measure the actual BER of the FSO transceiver to detect fluctuations or changes in signal quality. The actual\({}_{BER}\) is measured in real-time based on the current values of rain, fog, and distance (current\({}_{R}\), current\({}_{F}\), and current\({}_{D}\)). * Step 8--Decision Based on BER: If the measured BER (actual\({}_{BER}\)) exceeds the dynamic threshold (Fuzzy\({}_{T-BER}\)) set by the fuzzy logic system, the system will trigger adjustments to improve communication quality (adjustments= AdjustReceiverSettings(0)). These actions can include three mechanisms: Dynamic Threshold Adjustment, Receiver Gain Control, or Noise Filtering. When the BER is below the dynamic threshold, the system maintains the current settings or optimizes resources (Request = MaintainSettings(0)). #### 3.5.2 Adaptive Receiver Control (Algorithm 2)

In this work, the adaptive control mechanism focuses on the receiver side of the SSM SAC-OCDMA system. The functions AdjustReceiverSettings(0) and MaintainSettings(0) are defined to dynamically optimize receiver performance based on real-time environmental conditions and BER monitoring. * AdjustReceiverSettings(0) function: The AdjustReceiverSettings(0) function is designed to dynamically optimize the performance of the SSM SAC-OCDMA receiver when the actual BER exceeds the dynamic threshold (Fuzzy\({}_{T-BER}\)) set by the FLC system, indicating degraded communication quality due to adverse environmental conditions. The function includes three key mechanisms: Dynamic Threshold Adjustment, Receiver Gain Control, and Advanced Filtering. The Dynamic Threshold Adjustment mechanism, as defined in step 1 in Algorithm 2, modifies the BER detection threshold in real time based on environmental conditions such as rainfall rate, fog density, and propagation distance. By increasing the threshold value in severe conditions and lowering its value during favorable conditions, the system maintains an optimal balance between sensitivity and reliability, ensuring accurate data detection. The second mechanism, Receiver Gain Control, as defined in step 2 in Algorithm 2, optimizes the amplification of the received signal. In conditions like heavy rain or dense fog, the system dynamically increases the receiver's gain to enhance the SNR and to improve the clarity of the received signal. Similarly, in the stable conditions, the gain is maintained or slightly reduced to prevent noise amplification. To achieve this, Receiver Gain Control leverages Automatic Gain Control (AGC) and linear amplification techniques. AGC automatically adjusts the gain based on the signal strength, while maintaining linearity ensures that the signal shape remains intact, and it also preserves data integrity even under fluctuating conditions. Additionally, linear amplifiers ensure that the signal is amplified without introducing distortion, preserving the original signal shape, and maintaining data integrity even in fluctuating transmission environments. The final mechanism, Advanced Filtering, as defined in Step 3 in Algorithm 2, plays a critical role in mitigating noise and interference, particularly under harsh environmental conditions. This mechanism dynamically applies filtering techniques based on real-time assessments of environmental factors such as rainfall rate, fog density, and propagation distance. In severe conditions, such as heavy rain or dense fog, the system utilizes adaptive filters to effectively suppress noise and enhance signal quality.