1 Fuzzy Logic Workshop Design of Fuzzy Controller for Temperature Chamber www.aimagin.com
2 Syllabus What is the system in control ? System IdentificationMathematical model and Choice of sampling period. FiO Boards and RapidSTM32 Blockset for Applied on Temperature Control (HIL Test) Matlab Fuzzy Logic Toolbox Finite State Machine Stand-Alone System Implementation ทฤษฎีระบบควบคุม เป็นสาขาหนึ่งของคณิตศาสตร์และวิศวกรรมศาสตร์ ในที่นี้ การควบคุมหมายถึง การควบคุมระบบพลศาสตร์ ให้มีค่าเอาต์พุตที่ต้องการ โดยการป้อนค่าอินพุตที่เหมาะสมให้กับระบบ
3 What is a control system ?Control Signal (input) Output SISO Heater (input) Temperature (Output) In most systems there will be an input and an output. This block diagram represents that. (Control system designers and engineers use block diagrams to represent systems. Get used to them.) Signals flow from the input, through the system and produce an output. Heater FAN (2 input) Temperature (Output) MISO
4 Controller Sensor Temperature (Output) Set Point Error Heater dErrorFAN Sensor
5 How to Identify the SystemAnalyze the input-output data pairs to fit the parameters in the used model (structure) Unknown System X Y ? ? ? Experimental determination of system model. There are two methods of system identification: Parametric Identification: The input-output model coefficients are estimated to “fit” the input-output data. Frequency-Domain (non-parametric): The Bode diagram [G(jw) vs. w in log-log scale] is estimated directly form the input-output data. The input can either be a sweeping sinusoidal or random signal. Unknown
6 Equivalent DC motor
7 How to Identify the SystemUnknown System X Y two methods 1.Parametric identification 2.Non-parametric identification. Experimental determination of system model. There are two methods of system identification: Parametric Identification: The input-output model coefficients are estimated to “fit” the input-output data. Frequency-Domain (non-parametric): The Bode diagram [G(jw) vs. w in log-log scale] is estimated directly form the input-output data. The input can either be a sweeping sinusoidal or random signal.
8 System identification processPrior knowledge Experiment Design In building a model, the designer has control over three parts of the process Generating the data set ZN Selecting a (set of) model structure (1st or 2nd order) Selecting the criteria (least squares for instance), used to specify the optimal parameter estimates There are many other factors that influence the final model, however, this course will focus on these three factors and the method for (recursive) parameter estimation Data Choose Model Set Choose Criterion of Fit Calculate Model Validate Model
9 Unknown System X Y Output Input
10 Model validation ^ u(t) y(t) Model q ^ u(t) u(t) Plant q y(t) d(t)
11 Prepare plant for system identification
12 Temperature Control Module
13 Initial preparations Connect CN9(GND) to GND Fio BoardConnect Temperature sensor from CN2 to Analog input Select PWM Output pins (B6, B7, B8, etc.) form Fio to CN3,CN4 and CN6 Connect 12 VDC to connector J1
14 FiO Board Std Temp. Board
15 FiO Board Lite Temp. Board
16 ADC Configuration
17 PWM Output pins
18 Temperature sensor modulerefer on P.8 Temperature sensor module
19 refer on P.65 Then
20 refer on P.66
21 Heater and Fan control modules
22 refer on P.66
23 10msec = 100Hz FAN2 FAN1 10% Duty Cycle HALOGEN BULB 40% Duty Cycle
24 refer on P.10 Design of Display
25 refer on P.11
26 Let’s try Send the command for control heater and fan on Target from HOST
27 refer on P.16 Design of Display
28 Let’s try Send the temperature from Target to HOST and display on the Matlab Scope
29 Filter Design
30 Filter design First order Low pass filter
31
32 Continuous C2D Discrete Define cutoff frequency Define sample period
33 ‘ jω’ is substituted for ‘s’
34 Now, since we know that the cutoff frequency, ω , occurs at Magnitude=0.707, this can be substituted into above to get Solve for wc
35 we define cutoff frequency at 20 Hz, then
36 we define cutoff frequency at 5 Hz, then
37 Fast Fourier Transform (FFT)
38
39 System identificationIntroduction
40 SYSTEM IDENTIFICATIONThe System Identification Problem is to estimate a model of a system based on input-output data. System disturbance (not observed) v(t) y(t) u(t) output (observed) input (observed) continuous
41 Typical to be used as input for identificationStep PRBS Sinusoidal
42 Parametric ID of step responseFirst order process with dead time Most common industrial process model Response to a control step applied
43 refer on P.17 Unknown System X Y
44 refer on P.19
45 Import data to system identification toolbox
46 Matlab Command for open system identification toolbox
47 refer on P.17
48 Unknown System X Y Y X
49 temp = simout(:,2) ตัดข้อมูล 2000 ถึง 6000 duty = simout(2000:1:6000,1) tem = temp(2000:1:6000)
50
51 Choice of sampling period
52
53 Applied in many appliances.Researchers have developed a theory for the same concept as the FUZZY set stand out. Applied in many appliances. Air conditioning Washing machine Rice cooker. And more… Neuro Fuzzy Rice Cooker Fuzzy Washing Machine
54 Fuzzy Set Theory 38.7°C 38°C 40.1°C 41.4°C 42°C 39.3°C 38.7°C 38°CConventional (Boolean) Set Theory: 38.7°C 38°C “Strong Fever” 40.1°C 41.4°C Fuzzy Set Theory: 42°C 39.3°C 38.7°C 38°C 37.2°C 40.1°C 41.4°C 42°C 39.3°C “Strong Fever” “More-or-Less” Rather Than “Either-Or” ! 37.2°C
55 Fuzzy Set Definition Discrete Definition:µSF(35°C) = 0 µSF(38°C) = 0.1 µSF(41°C) = 0.9 µSF(36°C) = 0 µSF(39°C) = 0.35 µSF(42°C) = 1 µSF(37°C) = 0 µSF(40°C) = 0.65 µSF(43°C) = 1 Continuous Definition:
56 Linguistic Variable A Linguistic Variable Defines a Concept of Our Everyday Language! 76 77 78 79 80 81 82 83 84 Low temp Normal High temperature Rise temperature 1 0.7 0.2
57 Fuzzy control provides a formal methodology for representing, manipulating, and implementing a human’s heuristic knowledge about how to control a system. Plant Fuzzification Defuzzification Inference Mechanism Knowledge Base Reference input Output Command variable
58 Basic Elements of a Fuzzy Logic SystemCommand Variable (Linguistic Value) Measured Variable (Linguistic Value) 2. Fuzzy-Inference Linguistic Value Numerical Value 1.Fuzzufication 3.Defuzzification Measured Variable (Numerical Value) Plant Command Variable (Numerical Value)
59
60 Choice of Sampling IntervalAnother important aspect in sampled data control systems is the choice of sampling intervals.
61 Plant testing on Target
62 Plant testing on Host
63 2 1
64 1
65
66
67
68
69
70
71 Process Value Set Point
72 dError 0 Error + Error 0 dError - dError + Error - dError 0
73 CASE: 1 Error 0 dError 0
74 CASE: 2 dError - Error 0
75 CASE: 3 dError + Error 0
76 CASE: 4 Error - dError 0
77 CASE: 5 dError - Error -
78 CASE: 6 dError + Error -
79 CASE: 7 Error + dError -
80 CASE: 8 dError 0 Error +
81 CASE: 9 Error + dError +
82 Fuzzy Control Rules Z Z Z Z Z PS PS PM PL Zero Positive Small Z PSPositive Medium Positive Large PM PL
83 Fuzzy Control Rules Zero Positive Small Z PS Positive MediumPositive Large PM PL
84
85
86
87
88
89
90