# 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 adaptive behavior of the FSO receiver is driven by the interaction between the actual bit error rate (BER) and the dynamically computed Fuzzy BER Threshold (Fuzzy T-BER). To illustrate the overall control strategy visually, the adaptive process is depicted in Figure 8. Based on the logic shown in Figure 8, the full adaptive thresholding mechanism is implemented using two core functions described in Algorithms 1 and 2. These are detailed below. \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Weather Condition** & **VL** & **LD \(\leq\) 0.5 km** & **MD [0.5 km, 1 km]** & **HD [1 km, 1.5 km]** \\ \hline CA & Th8 & Th8 & Th8 & Th8 \\ \hline Light fog & Th8 & Th8 & Th8 & Th8 \\ \hline Medium fog & Th8 & Th8 & Th8 & Th5 \\ \hline Heavy fog & Th8 & Th8 & Th5 & Th1 \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Fuzzy control rules under foggy weather. Figure 7: Fuzzy inference sets of rule base. ``` Input: rainfall rate, fog density, distance Input: SSM priorities (w, L, K, \(\cdots\)) Output: Fuzzy\({}_{T-RE}\) = Fuzzy BER threshold Output: adjustments = [Dynamic Threshold Adjustment; Receiver Gain Control; Noise Filtering] Output: Request Define current\({}_{G}\), current\({}_{G}\) and current\({}_{D}\) Define Low = [\(10^{-24}\), \(10^{-9}\)], Medium = [\(10^{-9}\), \(10^{-6}\)], High = [\(10^{-6}\), \(10^{-3}\)] Define Control\({}_{2 ER}\), Fuzzy\({}_{T-RE}\), actual\({}_{BER}\), and Request\({}_{transferout}\)
1 Step 1: Define Fuzzy Membership Functions  rain = FuzzyVariable(\"gain,\"light = [\(10\), \(10\)], Moderate = [\(10\); \(20\)], Heavy = [\(20\); \(30\)]  fog = FuzzyVariable(\"Fog\", Light = [\(0\), \(5\)], medium = [\(5\); \(15\)], Heavy = [\(15\); \(30\)]  distance = FuzzyVariable(\"Distance\", VL = [\(0\); \(0\)], LD = [\(0\); \(1\)], MD = [\(1\); \(1\); \(5\)], HD = [\(1\); \(5\); \(2\)] \(2\) Step 2: Define fuzzy output variable for dynamic BER threshold (T-BER) \(T-BER\) \(\rightarrow



#### 3.5.1 Fuzzy T-BER Computation Using FLC (Algorithm 1)

The following proposed Algorithm 1 outlines the steps for implementing the dynamic BER threshold adjustment using a fuzzy logic system in FSO. It is decomposed into eight distinct steps, each carefully designed to ensure the process of control is efficient. * Step 1--Define Fuzzy Membership Functions: Establish fuzzy membership functions that represent linguistic variables related to environmental factors, signal quality, and BER. Therefore, fuzzy sets (very low, low, medium, and high) for rain, fog, distance, and BER will be defined. * Step 2--Define the fuzzy output variable T-BER, which categorizes the dynamic BER threshold into three linguistic levels: Low, Medium, and High based on the severity of environmental conditions. * Step 3--Define Fuzzy Rules for T-BER: Develop a set of fuzzy logic rules to determine the target BER (T-BER) based on input conditions, using the defined membership functions. * Step 4--Create Fuzzy System: Build a fuzzy inference system (FIS) that processes the defined rules and membership functions to calculate outputs dynamically. * Step 5--Monitor Environmental Conditions: Continuously track environmental parameters such as rain (current\({}_{R}\)), fog (current\({}_{F}\)), and distance (current\({}_{D}\)) that could affect the signal in the FSO communication system. * Step 6--Calculate Dynamic BER Threshold: Using the fuzzy system, compute a dynamic threshold for BER based on the monitored environmental conditions and the defined rules. In the FSO system in this work, the fuzzy logic controller utilizes the max-min inference method. In this approach, the fuzzy operator AND selects the minimum value from the antecedents, while for aggregation, the maximum value is used. The defuzzification process then converts the fuzzy output from the inference mechanism into a precise value for the dynamic threshold device (Fuzzy\({}_{T-BER}\)).