Source Of Summary:

Fuzzy Section 7.pdf

1. 🚀 Fuzzy Logic System: Air Conditioner Cooling Power


1.1 📚 Imports & Setup

import numpy as np                                    # Import NumPy for numerical operations
import skfuzzy as fuzz                                # Import scikit-fuzzy library
from skfuzzy import control as ctrl                   # Aliases for fuzzy control constructs
import warnings                                       # Python warnings module
warnings.filterwarnings('ignore', category=UserWarning)  # Disable UserWarning messages

1.2 📦 Defining Fuzzy Variables

# Create fuzzy input variable for room temperature from 10°C to 50°C
room_temp   = ctrl.Antecedent(np.arange(10, 51, 1), 'room_temp')

# Create fuzzy input variable for number of people from 0 to 20
num_people  = ctrl.Antecedent(np.arange(0, 21, 1), 'num_people')

# Create fuzzy output variable for cooling power from 0% to 50%
cooling_power = ctrl.Consequent(np.arange(0, 51, 1), 'cooling_power')

1.3 🐍 Membership Functions

1.3.1 🌡️ Room Temperature

# Very Cold: full membership at 10–12°C then taper until 18°C
room_temp['very_cold'] = fuzz.trapmf(room_temp.universe, [10, 10, 12, 18])

# Cold: triangular peak at 21°C, spans 16–26°C
room_temp['cold'] = fuzz.trimf(room_temp.universe, [16, 21, 26])

# Normal: triangular peak at 29°C, spans 24–34°C
room_temp['normal'] = fuzz.trimf(room_temp.universe, [24, 29, 34])

# Warm: triangular peak at 37°C, spans 32–42°C
room_temp['warm'] = fuzz.trimf(room_temp.universe, [32, 37, 42])

# Hot: plateau membership starting at 40°C rising to full at 45–50°C
room_temp['hot'] = fuzz.trapmf(room_temp.universe, [40, 45, 50, 50])

1.3.2 👥 Number of People