Source Of Summary:
Fuzzy Section 7.pdf
1. 🚀 Fuzzy Logic System: Air Conditioner Cooling Power
1.1 📚 Imports & Setup
- Bold Key Terms:
numpy
, skfuzzy
, warnings
, Core libraries for computations, fuzzy logic, and warning control. ⚙️
- Insights: Suppressing user warnings avoids clutter. 💡
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
- Bold Key Terms:
Antecedent
, Consequent
, universe
, Inputs, outputs, and their value ranges. 🎯
- Key Takeaway: Establish numeric universes before membership definitions. 🎯
# 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
- Bold Key Terms:
trapmf
, **trimf**
,Fuzzy membership shapes (trapezoid, triangle). 🔺
# 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
- Emphasis: Classify occupancy levels with fuzzy sets. 🏠