## 3 Emergency-Aware Fuzzy Logic-Based Dynamic Weighting for MPC  
### Fuzzy-Based Adaptive Weight Adjustment  
To enhance the adaptability of MPC across varying traffic conditions, we introduce a fuzzy logic-based module that dynamically adjusts the cost function weights. Following practices in adaptive cruise control design, the fuzzy controller takes two input variables: spacing error \(\Delta d\) and relative velocity error \(\Delta v\), both of which are widely used in fuzzy-MPC frameworks due to their direct relevance to car-following safety and stability.  
The universe of discourse for \(\Delta d\) is set to \([-40\) m, \(80\) m], encompassing scenarios from dangerously short gaps to extended highway headways. For \(\Delta v\), the range \([-20\) m/s, \(20\) m/s] covers conditions from emergency braking to high-speed acceleration. These intervals align with real-world car-following behavior and ensure consistent fuzzy inference across traffic environments. The fuzzy rule structure follows a typical five-by-five grid based on these inputs, as demonstrated in [38].  
Figure 2 illustrates the complete fuzzy inference structure and its components:  
* Top-left and top-right: Membership functions for \(\Delta d\) and \(\Delta v\). Triangular functions are used for intermediate terms, while trapezoidal functions define extreme values. For instance,
* \(\mu_{VC}(\Delta d)=\text{trimf}(\Delta d,\,[-40,-30,-10])\);
* \(\mu_{NVL}(\Delta v)=\text{trapmf}(\Delta v,\,[-20,-20,-15,-10])\).
* Bottom-left: The fuzzy rule table is composed of 25 inference rules by combining all possible input term pairs. Each rule outputs a qualitative urgency level: emergency (E), high (H), medium (M), or low (L).
* Center-right: A 3D surface plot shows the defuzzified emergency coefficient \(E\) as a function of \(\Delta d\) and \(\Delta v\). This visualization reflects how the system evaluates urgency in different traffic scenarios.
* Bottom: The output membership functions for the emergency level \(E\in[0,1]\), divided into three fuzzy sets (L, M, and H) to support smooth weight transitions.  
The fuzzy rule outputs are defuzzified using the centroid method to obtain a quantitative emergency coefficient \(E\in[0,1]\). This value serves as the real-time indicator of traffic urgency.  
This coefficient is then mapped to the velocity-tracking weight \(\alpha_{1}\) in the MPC cost function through an exponential mapping:  
\[\alpha_{1}(E)=\alpha_{1,\min}+(\alpha_{1,\max}-\alpha_{1,\min})\cdot\bigg{(} \frac{10^{E}-1}{9}\bigg{)}. \tag{21}\]  
This mapping function ensures that in critical situations (higher \(E\)), the weight \(\alpha_{1}\) increases sharply, thereby enhancing tracking aggressiveness. Under normal or safe conditions, \(\alpha_{1}\) remains relatively stable, reducing unnecessary actuation and ensuring smooth control.  
Overall, this structure enables interpretable, real-time, and context-sensitive adjustment of control priorities within the MPC framework. It combines the robustness of rule-based reasoning with the flexibility of continuous tuning.  
Each input is fuzzified into five linguistic terms:  
* Very close, close, medium, far, and very far (for \(\Delta d\));
* Negative very large, negative large, medium, positive large, and positive very large (for \(\Delta\
u\)).