LECTURE 03 | المحاضرة 03

Fuzzy Logic

المنطق الضبابي
Membership Functions, Fuzzy Rules, Inference, and Control
دوال العضوية والقواعد الضبابية والاستدلال والتحكم

🎯 Learning Objectives

  • Understand the difference between crisp and fuzzy sets.
  • Define and interpret membership functions.
  • Understand triangular and trapezoidal membership functions.
  • Perform fuzzy AND and OR operations.
  • Understand IF–THEN fuzzy rules.
  • Explain fuzzification, inference, aggregation, and defuzzification.
  • Apply fuzzy logic to voltage-control problems.

🎯 أهداف التعلم

  • فهم الفرق بين المجموعات التقليدية والمجموعات الضبابية.
  • تعريف دوال العضوية وتفسيرها.
  • فهم دوال العضوية المثلثية وشبه المنحرفة.
  • تنفيذ عمليتي AND وOR الضبابيتين.
  • فهم قواعد IF–THEN الضبابية.
  • فهم التضييب والاستدلال والتجميع وإزالة الضبابية.
  • تطبيق المنطق الضبابي على مسائل التحكم بالجهد.

1. Why Fuzzy Logic?

Classical logic works with only two truth values: true or false, 1 or 0.

μA(x) ∈ {0,1}

Fuzzy logic allows partial membership:

μA(x) ∈ [0,1]
An element does not have to be completely inside or completely outside a set. It can belong to the set with a certain degree.

1. لماذا نستخدم المنطق الضبابي؟

يعتمد المنطق التقليدي على قيمتين فقط: صحيح أو خطأ، أي 1 أو 0.

μA(x) ∈ {0,1}

أما في المنطق الضبابي فيمكن أن تكون درجة الانتماء أي قيمة بين صفر وواحد:

μA(x) ∈ [0,1]
لا يشترط أن يكون العنصر داخل المجموعة بالكامل أو خارجها بالكامل، بل يمكن أن ينتمي إليها بدرجة معينة.

2. Crisp Set vs Fuzzy Set

Crisp Set

A voltage may be classified only as acceptable or unacceptable.

Fuzzy Set

A voltage can be described as low, normal, or high with different membership degrees.

2. المجموعة التقليدية مقابل المجموعة الضبابية

المجموعة التقليدية

يمكن تصنيف الجهد فقط على أنه مقبول أو غير مقبول.

المجموعة الضبابية

يمكن وصف الجهد بأنه منخفض أو طبيعي أو مرتفع بدرجات انتماء مختلفة.

3. Membership Function

The membership function assigns each input x a membership degree:

μA : X → [0,1]

For example:

μNormal(0.98 pu) = 0.8

This means that the voltage 0.98 pu belongs to the fuzzy set “Normal Voltage” with membership degree 0.8.

3. دالة العضوية

تقوم دالة العضوية بإسناد درجة انتماء لكل قيمة دخل x:

μA : X → [0,1]

على سبيل المثال:

μNormal(0.98 pu) = 0.8

أي أن الجهد 0.98 pu ينتمي إلى المجموعة الضبابية "الجهد الطبيعي" بدرجة انتماء 0.8.

4. Triangular Membership Function

A triangular membership function is defined by three parameters:

A = (a,b,c)

Its mathematical definition is:

μA(x)= 0, x≤a
(x-a)/(b-a), a<x≤b
(c-x)/(c-b), b<x<c
0, x≥c

The value b is the point of full membership:

μA(b)=1
a b c 1 0 Triangular Membership Function

4. دالة العضوية المثلثية

يتم تعريف دالة العضوية المثلثية باستخدام ثلاث نقاط:

A = (a,b,c)

تبدأ درجة الانتماء من الصفر عند a، ثم تزداد خطيًا حتى تصل إلى 1 عند b، ثم تنخفض حتى تصبح صفرًا مرة أخرى عند c.

النقطة b تمثل القيمة الأكثر انتماءً للمجموعة الضبابية.

5. Simple Derivation of the Rising Side

Between a and b, the membership curve is a straight line.

The slope is:

m = (1 - 0)/(b - a)
m = 1/(b-a)

Using the equation of a straight line:

μ(x) - 0 = m(x-a)

Therefore:

μ(x) = (x-a)/(b-a)
So the triangular membership equation is not arbitrary; it comes directly from the equation of a straight line.

5. اشتقاق مبسط للجزء الصاعد

بين النقطتين a وb تكون دالة العضوية خطًا مستقيمًا.

ميل الخط هو:

m = (1 - 0)/(b-a)
m = 1/(b-a)

وباستخدام معادلة الخط المستقيم:

μ(x)-0 = m(x-a)

نحصل على:

μ(x) = (x-a)/(b-a)
إذن معادلة دالة العضوية المثلثية ناتجة ببساطة من معادلة الخط المستقيم.

6. Trapezoidal Membership Function

A trapezoidal membership function uses four points:

A = (a,b,c,d)

Between b and c the membership value equals 1.

a b c d 1 0

6. دالة العضوية شبه المنحرفة

يتم تعريف دالة العضوية شبه المنحرفة بأربع نقاط:

A = (a,b,c,d)

تكون درجة الانتماء مساوية للواحد بين b وc.

7. Multiple Fuzzy Sets

A single input variable can belong to several fuzzy sets simultaneously.

Low Normal High Voltage
Fuzzy sets overlap. This overlap is what allows smooth decisions instead of abrupt switching.

7. مجموعات ضبابية متعددة

يمكن لقيمة دخل واحدة أن تنتمي إلى عدة مجموعات ضبابية في الوقت نفسه.

تداخل دوال العضوية يسمح باتخاذ قرارات سلسة بدل الانتقال المفاجئ بين الحالات.

8. Fuzzy AND and OR

In Mamdani-type fuzzy logic, two common operations are:

AND

μA∩B(x) = min( μA(x), μB(x) )

OR

μA∪B(x) = max( μA(x), μB(x) )

Example:

μA = 0.4 , μB = 0.7
AND = min(0.4,0.7)=0.4
OR = max(0.4,0.7)=0.7

8. عمليتا AND وOR الضبابيتان

في نظام Mamdani يمكن استخدام:

AND = min
OR = max

فإذا كانت درجتا الانتماء 0.4 و0.7 فإن:

AND = 0.4
OR = 0.7

9. Fuzzy IF–THEN Rules

A fuzzy controller uses linguistic rules.

IF Voltage is Low
THEN Reactive Power is Increase

Another rule may be:

IF Voltage is High
THEN Reactive Power is Decrease

9. قواعد IF–THEN الضبابية

يعتمد المتحكم الضبابي على قواعد لغوية.

إذا كان الجهد منخفضًا
فإن القدرة الردية يجب أن تزداد
إذا كان الجهد مرتفعًا
فإن القدرة الردية يجب أن تنخفض

10. Fuzzy Inference System

Crisp Input
Fuzzification
Rule Base
Inference
Defuzzification
Crisp Output

10. نظام الاستدلال الضبابي

دخل عددي
التضييب
قاعدة القواعد
الاستدلال
إزالة الضبابية
خرج عددي

11. Fuzzification

Fuzzification converts a numerical input into membership degrees.

Suppose:

V = 0.97 pu

We may obtain:

μLow = 0.3
μNormal = 0.7
μHigh = 0

Therefore, the same voltage participates in more than one rule.

11. التضييب Fuzzification

تقوم عملية التضييب بتحويل الدخل العددي إلى درجات انتماء.

مثلًا إذا كان:

V = 0.97 pu

فقد تكون درجات العضوية:

μLow = 0.3
μNormal = 0.7
μHigh = 0

12. Rule Activation

If a rule is:

IF Voltage is Low THEN Reactive Power is High

and:

μLow(V)=0.3

then the rule activation level is:

α = 0.3

The output fuzzy set is clipped at this level.

12. تفعيل القاعدة

إذا كانت القاعدة:

إذا كان الجهد منخفضًا فإن القدرة الردية تكون مرتفعة

وكانت درجة انتماء الجهد إلى المجموعة "منخفض":

μLow(V)=0.3

فإن مستوى تفعيل القاعدة يساوي:

α = 0.3

13. Aggregation

Several fuzzy rules may produce several output fuzzy sets. These outputs must be combined.

μout(z) = max( μ1(z), μ2(z), ..., μr(z) )

13. التجميع Aggregation

يمكن أن تنتج عدة قواعد ضبابية عدة مجموعات خرج. لذلك يجب دمج هذه النتائج في مجموعة خرج واحدة.

μout(z) = max( μ1(z), μ2(z), ..., μr(z) )

14. Defuzzification

After fuzzy inference, the result is still a fuzzy set. A physical controller needs one numerical value.

A common method is the center of gravity:

z* = [ ∫ z μ(z) dz ] / [ ∫ μ(z) dz ]
The numerator represents the first moment of the fuzzy area, while the denominator represents its total area.

14. إزالة الضبابية Defuzzification

بعد الاستدلال نحصل على مجموعة ضبابية، لكن المتحكم الحقيقي يحتاج إلى قيمة عددية واحدة.

إحدى أشهر الطرق هي طريقة مركز الثقل:

z* = [ ∫ z μ(z) dz ] / [ ∫ μ(z) dz ]
البسط يمثل العزم الأول للمساحة الضبابية، بينما يمثل المقام المساحة الكلية.

15. Discrete Center-of-Gravity Form

In digital implementations, the integral is often approximated using discrete points:

z* = Σ zi μ(zi) / Σ μ(zi)

Example:

zi μ(zi) zi μ(zi)
1 0.2 0.2
2 0.6 1.2
3 0.4 1.2
z* = (0.2+1.2+1.2)/(0.2+0.6+0.4)
z* = 2.17

15. الصيغة المتقطعة لمركز الثقل

في التطبيق الرقمي يمكن تقريب التكامل باستخدام مجموع القيم:

z* = Σ zi μ(zi) / Σ μ(zi)

في المثال السابق تكون النتيجة:

z* = 2.17

16. Power-System Application: Voltage Control

Consider a distribution-network bus with measured voltage V.

Define the voltage error:

e = Vref - V

The fuzzy controller receives the error and produces a reactive-power command:

e → Fuzzy Controller → ΔQ

Example rules:

Voltage Error Reactive-Power Action
Negative Large Decrease Q
Zero No Change
Positive Large Increase Q

16. تطبيق في نظم الطاقة: التحكم بالجهد

لنفترض وجود عقدة في شبكة توزيع كهربائية يتم قياس جهدها V.

نعرّف خطأ الجهد:

e = Vref - V

ثم يستخدم المتحكم الضبابي هذا الخطأ لإنتاج أمر قدرة ردية:

e → Fuzzy Controller → ΔQ

إذا كان الجهد منخفضًا، يمكن للمتحكم زيادة القدرة الردية للمساعدة في رفع الجهد. وإذا كان مرتفعًا يمكن تقليل القدرة الردية.

17. Why Fuzzy Control is Attractive

  • No exact mathematical model may be required.
  • Engineering knowledge can be written as linguistic rules.
  • Nonlinear behavior can be handled naturally.
  • Control actions change smoothly.
  • The controller is relatively easy to interpret.

17. لماذا يعد التحكم الضبابي جذابًا؟

  • قد لا يحتاج إلى نموذج رياضي دقيق للنظام.
  • يمكن تحويل الخبرة الهندسية إلى قواعد لغوية.
  • يمكن التعامل مع السلوك غير الخطي بسهولة نسبية.
  • تتغير أوامر التحكم بسلاسة.
  • من السهل نسبيًا تفسير منطق المتحكم.

18. Complete Fuzzy-Control Chain

Measurement
Error
Fuzzification
Rules
Inference
Defuzzification
Control Action

18. السلسلة الكاملة للتحكم الضبابي

القياس ← الخطأ ← التضييب ← القواعد ← الاستدلال ← إزالة الضبابية ← أمر التحكم

19. Summary

  • Fuzzy sets allow partial membership between 0 and 1.
  • Membership functions convert numerical values into linguistic concepts.
  • Triangular functions are based on simple straight-line equations.
  • AND can be implemented using minimum and OR using maximum.
  • Fuzzy rules connect linguistic inputs to linguistic outputs.
  • Defuzzification converts the fuzzy output into a numerical command.
  • Fuzzy control is useful for nonlinear and uncertain power-system problems.

19. الخلاصة

  • تسمح المجموعات الضبابية بدرجات انتماء بين الصفر والواحد.
  • تحول دوال العضوية القيم العددية إلى مفاهيم لغوية.
  • تعتمد دوال العضوية المثلثية على معادلات خطوط مستقيمة بسيطة.
  • يمكن تنفيذ AND باستخدام القيمة الصغرى وOR باستخدام القيمة الكبرى.
  • تربط القواعد الضبابية بين المدخلات والمخرجات اللغوية.
  • تحول إزالة الضبابية الخرج الضبابي إلى قيمة عددية.
  • يعد التحكم الضبابي مفيدًا في مسائل نظم الطاقة غير الخطية وغير المؤكدة.

📝 Review Questions

  1. What is the difference between a crisp set and a fuzzy set?
  2. What does μA(x)=0.7 mean?
  3. How is a triangular membership function defined?
  4. Where does the equation (x-a)/(b-a) come from?
  5. How are fuzzy AND and OR commonly calculated?
  6. What is fuzzification?
  7. What is defuzzification?
  8. Explain the center-of-gravity method.
  9. How can fuzzy logic be applied to voltage control?

📝 أسئلة المراجعة

  1. ما الفرق بين المجموعة التقليدية والمجموعة الضبابية؟
  2. ماذا تعني μA(x)=0.7؟
  3. كيف يتم تعريف دالة العضوية المثلثية؟
  4. من أين تأتي العلاقة (x-a)/(b-a)؟
  5. كيف يتم حساب AND وOR في المنطق الضبابي؟
  6. ما المقصود بالتضييب؟
  7. ما المقصود بإزالة الضبابية؟
  8. اشرح طريقة مركز الثقل.
  9. كيف يمكن تطبيق المنطق الضبابي للتحكم بالجهد؟