13
Applications of fuzzy logic Prof. Dr. Ir. Hans Hellendoorn Page 2 Sept-09 Delft Center for Systems and Control Hans Hellendoorn Loan advisory system Income Monthly costs Advice Rule base Page 3 Sept-09 Delft Center for Systems and Control Hans Hellendoorn Monthly income 350 500 1250 1600 2350 2500 5200 5900 Income no small middle large very large Page 4 Sept-09 Delft Center for Systems and Control Hans Hellendoorn Three rules of the rule base RULE 1 IF Income = very large AND Monthly costs = small THEN Advice = Give Credit RULE 2 IF Income = small AND Monthly costs = middle THEN Advice = Boundary case RULE 3 IF Income = middle OR Monthly costs = small THEN Advice = Probably give credit

Applications of fuzzy logicsc4081/2018/Materials/170313...Applications of fuzzy logic Prof. Dr. Ir. Hans Hellendoorn Page 2 Sept-09 Hans Hellendoorn Delft Center for Systems and Control

  • Upload
    others

  • View
    6

  • Download
    0

Embed Size (px)

Citation preview

  • Applications of fuzzy logic

    Prof. Dr. Ir. Hans Hellendoorn

    Page 2 Sept-09 Delft Center for Systems and ControlHans Hellendoorn

    Loan advisory system

    Income

    Monthly costs

    AdviceRulebase

    Page 3 Sept-09 Delft Center for Systems and ControlHans Hellendoorn

    Monthly income

    350 500 1250 1600 2350 2500 5200 5900 Income

    no small middle large very large

    Page 4 Sept-09 Delft Center for Systems and ControlHans Hellendoorn

    Three rules of the rule base

    RULE 1IF Income = very large AND Monthly costs = smallTHEN Advice = Give Credit

    RULE 2IF Income = small AND Monthly costs = middleTHEN Advice = Boundary case

    RULE 3IF Income = middle OR Monthly costs = smallTHEN Advice = Probably give credit

  • Page 5 Sept-09 Delft Center for Systems and ControlHans Hellendoorn

    Fuzzy System

    Only rules 2 en 3 can be applied.

    FuzzySystem

    Income = EUR 1400

    Monthly costs = EUR 350

    Non-fuzzy inputs

    Non-fuzzyoutput

    Page 6 Sept-09 Delft Center for Systems and ControlHans Hellendoorn

    1

    350 1400 Income

    1400 Income2500

    1

    1

    Monthly costs350

    1

    Monthly costs350

    1

    Advice

    1

    Advice

    Rules 2 + 3 :

    Activating the rules

    Page 7 Sept-09 Delft Center for Systems and ControlHans Hellendoorn

    Defuzzification

    1

    0 0,10,45

    0,7 1

    Center of Gravity

    0,45 = “Boundary case"

    Page 8 Sept-09 Delft Center for Systems and ControlHans Hellendoorn

    Fuzzy logic

    In formula

    ( )( )( )∑

    ∑=

    =++−

    =l

    l

    K

    i lli

    lililiK

    i llil

    x

    kukyxky

    1

    1)()1(

    )(β

    θηζβ

  • Page 9 Sept-09 Delft Center for Systems and ControlHans Hellendoorn

    Program control

    Motor control

    9001100

    Eco-nomy

    High-water

    FUZZY

    Fuzzy washing machine with fuzzy control

    Page 10 Sept-09 Delft Center for Systems and ControlHans Hellendoorn

    Fuzzy1Spin-dry

    Energy(stop)

    Breakingtime

    Load

    Fuzzy2Spin-dry

    Rotationvariation

    Wool?

    Spin-drycurve

    rot/min

    time

    fuzzy

    The spin-dry process

    Page 11 Sept-09 Delft Center for Systems and ControlHans Hellendoorn

    Hardware aspects

    Non-linearity (AC motor, characteristics of the phase change)

    Disturbances (mains voltage, belt tension, water level)

    Thomson ST62

    Code format: 1kB incl. μFPL-environment and rules

    Clocktime less than 20ms was feasible

    Readability of the code was good

    Page 12 Sept-09 Delft Center for Systems and ControlHans Hellendoorn

    Fuzzy board

    Stand alone fuzzy development board

    Application system

    Target μC

    Fuzzy Coprocessor

    Knowledge Base Memory

    PC1 with μC-development

    software

    HW-filter FIFO

    Control System

    Standard μC board

    Fuzzy Development System

    PC2 with Fuzzy development

    software

    ROM + RAM

    Debug μC

  • Page 13 Sept-09 Delft Center for Systems and ControlHans Hellendoorn

    Block diagram of the fuzzy coprocessor

    Fuzzy Coprocessor Chip

    Microcontroller Interface

    Knowledge Base Memory

    Interface

    On-chip Knowledge

    Base Memory

    Control

    Clock generator

    Host bus

    KBM bus

    16

    16

    16

    FC bus

    Fuzzifier

    Inference with on-chip RAM

    Defuzzifier

    16

    IMF-data

    12Alpha

    16Rule data

    12Beta

    12Gamma

    16OMF data

    16Output

    12

    12

    Page 14 Sept-09 Delft Center for Systems and ControlHans Hellendoorn

    Extended Automization for a Vacuum Cleaner

    - Realization of the control with Fuzzy

    - Good performance

    Realized Modules

    - Pressure control

    - Control by dust sensor

    - Filter change and blockage diagnosis

    Fuzzy vacuum cleaner

    Page 15 Sept-09 Delft Center for Systems and ControlHans Hellendoorn

    Dustbag

    Blower

    Pressure sensors (digital)

    MicrofilterPressure sensor

    Temp. sensor

    Control:Motor voltage

    Dust sensor

    Dustsensor

    Pressuresensor

    Controller Triac Motor Blower

    Temp.-sensorpmax

    psoll

    pise y U n p

    Fuzzy vacuum cleaner with pressure control and control by dust sensor

    Page 16 Sept-09 Delft Center for Systems and ControlHans Hellendoorn

    Development of a logical system for an Automatic Transmission System with respect to

    • different drivers- Sportily, …, defensive

    • Driving situations- Overtaking- Curves- Mountains- City, Land, Highway

    • Working conditions- Motor temperature- Load of the vehicle

    Automatic transmission system

  • Page 17 Sept-09 Delft Center for Systems and ControlHans Hellendoorn

    Shift patterns

    shift pattern

    1-2 2-3 3-42-1 3-2 4-3dki [ ]

    n [1000 RPM]ab20406080

    1 2 3 4 5 6

    0

    Page 18 Sept-09 Delft Center for Systems and ControlHans Hellendoorn

    Simple modeling of the vehicle and resistances

    MWü = f(gear) 1

    m sers1s

    X X.

    vehicle model

    Fb

    load resistance

    -

    roll resistance

    - v air

    climbing resistance

    α m gsin α

    Veh

    Page 19 Sept-09 Delft Center for Systems and ControlHans Hellendoorn

    Throttle opening

    Changethrottle opening

    Rotational speed

    Changerotational speed

    Brake

    Actual gear

    Fuzzyrulebase

    Vehicle load

    Driver type

    Shift control

    dki

    Δdki

    nab

    Δnab

    br

    gear

    shift pattern

    1-2 2-3 3-42-1 3-2 4-3dki [ ]

    n [1000 RPM]ab20406080

    1 2 3 4 5 6

    0

    SP 1 EconomicSP 2 SportilySP 3 ConventionalSP 4 WinterSP 5 …

    SP L LightSP M ModerateSP H HeavySP V Very HeavySP X …

    Shift forbiddenShift up forbiddenShift down forbiddenShift allowed

    Automatic transmission system - fuzzy system

    Net forceΔF

    Page 20 Sept-09 Delft Center for Systems and ControlHans Hellendoorn

    Membership functions for Wheelrotation [RPM] and Gas pedal [degree]

    1.00

    0.80

    0.60

    0.40

    0.20

    0.000 2000 4000 6000 RPM

    1.00

    0.80

    0.60

    0.40

    0.20

    0.000 20 40 60 80 Degree

  • Page 21 Sept-09 Delft Center for Systems and ControlHans Hellendoorn

    Rule1: IF D F IS negative THEN load = downhill

    Rule2: IF D F IS negative AND brake IS pressed THEN load = downhill

    Rule3: IF D F IS positive AND brake IS unpressed AND throttle IS openTHEN load=uphill

    Rule4: IF throttle IS wide_open AND D n IS NOT positive AND n IS NOT high THEN load=downhill

    Rule5: IF gear IS gear1 THEN shift=shiftdown_forbidden

    Rule6: IF D F IS negative AND brake IS pressed THEN shift=shiftup_forbidden

    Some rules

    Page 22 Sept-09 Delft Center for Systems and ControlHans Hellendoorn

    road profile

    time [sec]

    -1500-1000-500

    0500

    10001500

    0 50 100 150 200 250

    throttle opening

    time [sec]

    05

    10152025

    0 50 100 150 200 250

    Road profile: Driver model:

    Model of the Driver and the Environment

    Page 23 Sept-09 Delft Center for Systems and ControlHans Hellendoorn

    drive shaft revolution

    time [sec]

    0

    1500

    3000

    0 50 100 150 200 250

    Vehicle velocity: Conventional shift behaviour:

    Vehicle velocity and conventional shift pattern

    shift behaviour

    time [sec]

    1

    2

    3

    4

    0 50 100 150 200 250

    RPM Gear

    Disadvantages: - late shifting back- no shifting back at downhill

    Page 24 Sept-09 Delft Center for Systems and ControlHans Hellendoorn

    drive shaft revolution

    time [sec]

    0

    1500

    3000

    0 50 100 150 200 250

    Advantages: - Delayed shifting up- Early shifting back (mountain)- Shifting back by down-hill

    shift behaviour

    time [sec]

    1

    2

    3

    4

    0 50 100 150 200 250

    Vehicle velocity: Fuzzy shift behaviour:

    Vehicle velocity and fuzzy shift pattern

    RPM Gear

  • Page 25 Sept-09 Delft Center for Systems and ControlHans Hellendoorn

    Hardware aspects

    ECO51 8bits processor

    8 inputs, 3 outputs, 3-7 membership functions per variable, ca. 25 rules

    Clocktime less than 20ms

    Important role of fuzzy development tools

    Page 26 Sept-09 Delft Center for Systems and ControlHans Hellendoorn

    Idle speed fuzzy controller

    +

    +

    ADV0

    ADV

    VAE0

    VAE

    Fuzzy controller

    Ignition Advance Angle

    Air Valve opening position

    Calculation of the reference speed

    Engine

    Calculation of the nominal idle speed

    valve position

    Throttle angleCoolant temp

    Engine speed

    RPM0

    RPM

    ++

    + -

    RPMerr

    ΔRPMerr

    Page 27 Sept-09 Delft Center for Systems and ControlHans Hellendoorn

    Cruise control

    Vehicle

    Calculation of the average value

    Actuator

    EAV

    ΔEAV verrmax

    UAV

    Calculation of the average and the maximum value

    Fuzzy Supervisor

    -

    +Reference speed

    Vehicle speed

    verr

    Δverr

    Δ2verr

    verrFuzzy Controller

    Throttle opening

    Page 28 Sept-09 Delft Center for Systems and ControlHans Hellendoorn

    Anti knock control

    e

    ė

    K2

    K1

    Inte

    nsive

    no

    ise

    Weak

    noise R

    ising

    knoc

    k

    Inten

    sive k

    nock

  • Page 29 Sept-09 Delft Center for Systems and ControlHans Hellendoorn

    Anti knock control

    Engine AccelerometricsensorSignal

    processing

    Quantization of Ri

    Quantization of Rm

    +

    +Nominal advance ignition angle cartography

    Advance correction

    Calculation of Ri & Rm

    Lookup table

    Ra

    Page 30 Sept-09 Delft Center for Systems and ControlHans Hellendoorn

    Shock Absorbers andLevel Control

    Electric Power Steering

    Hybrid Motor

    Automatic Transmission

    4-Wheel SteeringOptional 4-Wheel Drive

    Car electronics

    Actuators

    AdaptiveSystemsControl

    DrivingSituation

    Identification

    Sensors

    Page 31 Sept-09 Delft Center for Systems and ControlHans Hellendoorn

    CurrentDriving

    SituationClass

    SensorData

    PreprocessingSensor Fusion

    Integrated Neuro-Fuzzy System (INFS)

    FS8 4 5

    Signal Buffer

    0.10.20.30.40.50.6

    0.70.80.9

    0

    1

    IF-THEN

    Reference DataVideo Information5

    5

    NN

    xy

    z

    t

    +e

    Driving Situation Identification

    -

    Page 32 Sept-09 Delft Center for Systems and ControlHans Hellendoorn

    Class 1: Very high speed, continuous driving situation, straight section, low lateral acceleration, no steep climbs nor descents (freeway)

    Class 2: High speed, continuous driving situation, straight section, low lateral accelerations, no steep climbs nor descents (highway, localroad)

    Class 3: High/medium speed, continuous or discontinuous driving situation, possible high lateral accelerations and/or steep climbs or descents (curvy, hilly roads, transitions between class 1 and 2, etc.)

    Class 4: Low speed, often discontinuous driving situation, high trafficdensity, medium/no lateral accelerations, medium/low climbs or descents (downtown, Stop & Go, outer city area)

    Class 5: Very low speed or stop (Traffic Light, Intersection, Parking, etc.)

    Driving Situation Classes

  • Page 33 Sept-09 Delft Center for Systems and ControlHans Hellendoorn

    Fuzzification Inference Defuzzification

    x1

    xn

    y1

    ym

    IF-THENRule 1

    0.1

    0.2

    0.3

    0.4

    0.5

    0.6

    0.7

    0.8

    0.9

    0

    1

    x1

    S M B

    0.1

    0.2

    0.3

    0.4

    0.5

    0.6

    0.7

    0.8

    0.9

    0

    1

    xn

    S M B

    0.1

    0.2

    0.3

    0.4

    0.5

    0.6

    0.7

    0.8

    0.9

    0

    1

    y1

    S M B

    0.1

    0.2

    0.3

    0.4

    0.5

    0.6

    0.7

    0.8

    0.9

    0

    1

    ym

    S M B

    IF-THENRule 2

    IF-THENRule r-1

    IF-THENRule r

    Fuzzy System Components

    Page 34 Sept-09 Delft Center for Systems and ControlHans Hellendoorn

    Gaussian Membership Functions

    N Z Pμ( )x

    xm mmN Z P

    σN σPσZ

    ( )⎥⎥⎦

    ⎢⎢⎣

    ⎡⎟⎠⎞

    ⎜⎝⎛ −−=

    2

    exp σ

    μ mxx iCenter of Input-MBFWidth of Input-MBF

    x

    bias

    μ ( )xP

    μ ( )xZ

    μ ( )xN

    -mσ

    σK :

    mK :

    Fuzzification Layer

    Page 35 Sept-09 Delft Center for Systems and ControlHans Hellendoorn

    α... exΣ

    ln

    ln

    ln

    -mσ

    μ( )x1

    α...

    ( )⎥⎥⎦

    ⎢⎢⎣

    ⎡⎟⎟⎠

    ⎞⎜⎜⎝

    ⎛−=

    ⎥⎥⎦

    ⎢⎢⎣

    ⎡⎟⎟⎠

    ⎞⎜⎜⎝

    ⎛ −−== ∑∏∏

    ===

    2

    11

    2

    1

    exp exp mbfmbfmbf n

    k k

    k

    k

    n

    k k

    kn

    kk

    mxmxxσσσ

    μα

    bias

    αexΣ

    x2Σ

    μ( )x2

    μ( )x3

    μ( )x1

    μ( )x2

    μ( )x3

    x1

    x2Σ

    x2

    μ( )x1

    μ( )x2

    Evaluation of Premises

    Evaluation of Premises

    Page 36 Sept-09 Delft Center for Systems and ControlHans Hellendoorn

    Inference and Defuzzification

    ( )

    ( )y

    M w

    A w

    ww

    kk

    n

    kj jj

    n

    kk

    n

    kj jj

    n

    kj

    kj

    ombf r

    ombf r

    where

    if partial conclusion exists

    otherwise=

    ⋅ ⋅

    ⋅ ⋅

    =

    =⎧⎨⎩

    = =

    = =

    ∑ ∑

    ∑ ∑1 1

    1 1

    1

    0

    α

    α

    α1α2

    α3

    Max-Dot Inference"Center of Sums" Defuzzification

    y y

  • Page 37 Sept-09 Delft Center for Systems and ControlHans Hellendoorn

    P

    N

    Z

    N

    P

    Z

    N

    BIAS

    BIAS

    Y

    Σ M

    Z

    Σ AX2

    X1

    Fuzzification Inference Defuzzification

    IM 1

    IM 6

    R1OM1

    R9

    OM3

    P

    Network

    Page 38 Sept-09 Delft Center for Systems and ControlHans Hellendoorn

    Fuzzification Inference Defuzzification

    b

    b

    VS

    S

    BVB

    VS

    S

    BVB

    −1

    R11

    IX

    IY

    α

    b

    b

    Y

    N

    Y

    N

    O1

    O2

    α∑ M∑

    A∑

    R1

    x x2 ex x x ln x ex x

    Neuro-Fuzzy topology

    Page 39 Sept-09 Delft Center for Systems and ControlHans Hellendoorn

    FuzzyDevelopment Tool

    SENN++Simulation Environment for

    Neural Networks

    FPL* File

    * FPL: Fuzzy Programming Language

    F2N Coder

    Opt. WeightMatrices

    OptimizedFPL* File

    N2F Decoder

    WeightMatrices

    TopologyFileReference Data

    Expert / Tools

    Integrated Neuro-Fuzzy system

    Page 40 Sept-09 Delft Center for Systems and ControlHans Hellendoorn

    Fuzzy tool

  • Page 41 Sept-09 Delft Center for Systems and ControlHans Hellendoorn

    LLLL

    L L HHH

    HL

    L

    LL LL

    LLLL

    L L LHH

    HL

    L

    LL LL

    LLLL

    L L LHH

    HL

    L

    LL LL

    LLLL

    L L LHH

    HL

    L

    LL LL

    xyxzxwyzywzw

    VL L H VHVLLH

    VH

    LLLL

    L L LH H

    LL

    LL LL

    x

    z

    • 4 Input Variables: x, y, z, w• Membership Functions: VL, L, H, VH

    Inputs

    • 5 Output Variables: Driving Situation Classes 1 - 5• 2 Membership Functions L, H• Defuzzification -> Belief for Each Class (0 ...1)

    Outputs

    • Design of Initial Rulebase• 6 x 4 x 4 = 96 Rules

    Rulebase

    L H

    0 1

    μ(Kl. 3)

    Kl. 3

    1

    μ(y)

    y

    VL L H VH1

    m1 m2 m3 m4

    σ4 H

    wR = 180 %Class 5

    • In-Mbf: Centers mi• In-Mbf: Widths σi• Rule Weights wR• Conclusions

    Optimization Parameters

    Fuzzy System Structure

    Page 42 Sept-09 Delft Center for Systems and ControlHans Hellendoorn

    Test drive

    Freeway

    Page 43 Sept-09 Delft Center for Systems and ControlHans Hellendoorn

    Test drive

    Freeway

    Page 44 Sept-09 Delft Center for Systems and ControlHans Hellendoorn

    Parking Garage Plein FULL

    Parking Garage Voorstraat FREE

    Fuzzy Parking Control

    Car park

  • Page 45 Sept-09 Delft Center for Systems and ControlHans Hellendoorn

    Number of cars driving in and out of the parking garagemost important for short-time prognoses

    Traffic density

    Timetime of the day (early afternoon, midnight)day of the weekseason (Christmas, Summer, sales)

    Weather conditionscold, rainy weather: people tend to go to the large shopping centersvery hot, sunny weather: many people go out of town

    Special traffic situationse.g., roadworks, holidays, etc.

    Special eventspop concerts, parades, processions, . . .

    Traffic parameters

    Page 46 Sept-09 Delft Center for Systems and ControlHans Hellendoorn

    Kind of parking garage

    Situated downtown, near the shopping center, mainly used by people that go shopping

    Short time parking during the day, low percentage of long-term parkers

    Cannot be filled within one hour, due to the structure of the garage

    Data from ten parking garages in Düsseldorf, Germany.Weather data from the weather institute in Offenbach

    Page 47 Sept-09 Delft Center for Systems and ControlHans Hellendoorn

    Car park Karlsplatz, Thursday

    Page 48 Sept-09 Delft Center for Systems and ControlHans Hellendoorn

    WeatherRule base

    Temperature

    Rainfall

    Sunshine

    Weather

    TemporalNeed

    Rule base

    Day of Week

    Time of Day

    Season

    Holiday

    Traffic Density

    Temporal Need

    # cars driving in

    # cars driving out

    Capacity

    Special Situations

    MainRule base

    Forecast

    The inputs and outputs

  • Page 49 Sept-09 Delft Center for Systems and ControlHans Hellendoorn

    RULE SUB_Rule_I_good weather_1IF (Temperature IS high)AND (Rainfall IS dry)AND (Sunshine IS sunny)THEN (Weather IS small_traffic)

    When it is nice weather (hot, not raining, sunny) it will be relatively quiet downtown in comparison to other weather conditions.

    On a normal day (Thursday evening shops are opened, not a holiday, not during the weekend) it is relatively quiet during the evening. This is independent from the weather situation.

    This rule expresses the prognosis for the time after one hour. So, if the parking garage is almost full and it is to be expected that many vehicles are driving towards the parking garage then the prognosis is that it will be full within one hour.

    RULE SUB_Rule_II_Day_of_week_5IF (Holiday IS false)AND (Time_of_day IS evening)AND (Day_of_Week IS NOT weekend)AND (Day_of_Week IS NOT Thursday)THEN (Temporal_need IS low)

    RULE Rule_II__8IF (Capacity IS critical)AND ((Temporal_need IS high)OR (Temporal_need IS very_high))THEN (Forecast IS parking_garage_full)

    Examples of some rules

    Page 50 Sept-09 Delft Center for Systems and ControlHans Hellendoorn

    The neural network directly generates input for the fuzzy system

    Clustering with NN

    Page 51 Sept-09 Delft Center for Systems and ControlHans Hellendoorn

    PG1 J 0.9548 PG1 A 0.9239PG2 J 0.9147 PG2 A 0.9086PG3 J 0.9298 PG3 A 0.9272PG4 J 0.9415 PG4 A 0.9051PG5 J 0.9147 PG5 A 0.8849PG6 J 0.9415 PG6 A 0.9374

    Initial prediction quality: 78%

    After tuning by hand:(one system for all garages)

    Average: 0.9237

    After using the described method: 86% - 88%

    After using the described method for eachparking garage separately: 93%

    Results after learning with NN