- •24.3 HYDRAULICS
- •24.4 OTHER SYSTEMS
- •24.5 SUMMARY
- •24.6 PRACTICE PROBLEMS
- •24.7 PRACTICE PROBLEM SOLUTIONS
- •24.8 ASSIGNMENT PROBLEMS
- •25. CONTINUOUS CONTROL
- •25.1 INTRODUCTION
- •25.2 CONTROL OF LOGICAL ACTUATOR SYSTEMS
- •25.3 CONTROL OF CONTINUOUS ACTUATOR SYSTEMS
- •25.3.1 Block Diagrams
- •25.3.2 Feedback Control Systems
- •25.3.3 Proportional Controllers
- •25.3.4 PID Control Systems
- •25.4 DESIGN CASES
- •25.4.1 Oven Temperature Control
- •25.4.2 Water Tank Level Control
- •25.5 SUMMARY
- •25.6 PRACTICE PROBLEMS
- •25.7 PRACTICE PROBLEM SOLUTIONS
- •25.8 ASSIGNMENT PROBLEMS
- •26. FUZZY LOGIC
- •26.1 INTRODUCTION
- •26.2 COMMERCIAL CONTROLLERS
- •26.3 REFERENCES
- •26.4 SUMMARY
- •26.5 PRACTICE PROBLEMS
- •26.6 PRACTICE PROBLEM SOLUTIONS
- •26.7 ASSIGNMENT PROBLEMS
- •27. SERIAL COMMUNICATION
- •27.1 INTRODUCTION
- •27.2 SERIAL COMMUNICATIONS
- •27.2.1.1 - ASCII Functions
- •27.3 PARALLEL COMMUNICATIONS
- •27.4 DESIGN CASES
- •27.4.1 PLC Interface To a Robot
- •27.5 SUMMARY
- •27.6 PRACTICE PROBLEMS
- •27.7 PRACTICE PROBLEM SOLUTIONS
- •27.8 ASSIGNMENT PROBLEMS
- •28. NETWORKING
- •28.1 INTRODUCTION
- •28.1.1 Topology
- •28.1.2 OSI Network Model
- •28.1.3 Networking Hardware
- •28.1.4 Control Network Issues
- •28.2 NETWORK STANDARDS
- •28.2.1 Devicenet
- •28.2.2 CANbus
- •28.2.3 Controlnet
- •28.2.4 Ethernet
- •28.2.5 Profibus
- •28.2.6 Sercos
- •28.3 PROPRIETARY NETWORKS
- •28.3.1 Data Highway
- •28.4 NETWORK COMPARISONS
- •28.5 DESIGN CASES
- •28.5.1 Devicenet
- •28.6 SUMMARY
- •28.7 PRACTICE PROBLEMS
- •28.8 PRACTICE PROBLEM SOLUTIONS
- •28.9 ASSIGNMENT PROBLEMS
- •29. INTERNET
- •29.1 INTRODUCTION
- •29.1.1 Computer Addresses
- •29.1.2 Phone Lines
- •29.1.3 Mail Transfer Protocols
- •29.1.4 FTP - File Transfer Protocol
- •29.1.5 HTTP - Hypertext Transfer Protocol
- •29.1.6 Novell
- •29.1.7 Security
- •29.1.7.1 - Firewall
- •29.1.7.2 - IP Masquerading
- •29.1.8 HTML - Hyper Text Markup Language
- •29.1.9 URLs
- •29.1.10 Encryption
- •29.1.11 Compression
- •29.1.12 Clients and Servers
- •29.1.13 Java
- •29.1.14 Javascript
- •29.1.16 ActiveX
- •29.1.17 Graphics
- •29.2 DESIGN CASES
- •29.2.1 Remote Monitoring System
- •29.3 SUMMARY
- •29.4 PRACTICE PROBLEMS
- •29.5 PRACTICE PROBLEM SOLUTIONS
- •29.6 ASSIGNMENT PROBLEMS
- •30. HUMAN MACHINE INTERFACES (HMI)
- •30.1 INTRODUCTION
- •30.2 HMI/MMI DESIGN
- •30.3 DESIGN CASES
- •30.4 SUMMARY
- •30.5 PRACTICE PROBLEMS
- •30.6 PRACTICE PROBLEM SOLUTIONS
- •30.7 ASSIGNMENT PROBLEMS
- •31. ELECTRICAL DESIGN AND CONSTRUCTION
- •31.1 INTRODUCTION
- •31.2 ELECTRICAL WIRING DIAGRAMS
- •31.2.1 Selecting Voltages
- •31.2.2 Grounding
- •31.2.3 Wiring
- •31.2.4 Suppressors
- •31.2.5 PLC Enclosures
- •31.2.6 Wire and Cable Grouping
- •31.3 FAIL-SAFE DESIGN
- •31.4 SAFETY RULES SUMMARY
- •31.5 REFERENCES
- •31.6 SUMMARY
- •31.7 PRACTICE PROBLEMS
- •31.8 PRACTICE PROBLEM SOLUTIONS
- •31.9 ASSIGNMENT PROBLEMS
- •32. SOFTWARE ENGINEERING
- •32.1 INTRODUCTION
- •32.1.1 Fail Safe Design
- •32.2 DEBUGGING
- •32.2.1 Troubleshooting
- •32.2.2 Forcing
- •32.3 PROCESS MODELLING
- •32.4 PROGRAMMING FOR LARGE SYSTEMS
- •32.4.1 Developing a Program Structure
- •32.4.2 Program Verification and Simulation
- •32.5 DOCUMENTATION
- •32.6 COMMISIONING
- •32.7 REFERENCES
- •32.8 SUMMARY
- •32.9 PRACTICE PROBLEMS
- •32.10 PRACTICE PROBLEM SOLUTIONS
- •32.11 ASSIGNMENT PROBLEMS
- •33. SELECTING A PLC
- •33.1 INTRODUCTION
- •33.2 SPECIAL I/O MODULES
- •33.3 SUMMARY
- •33.4 PRACTICE PROBLEMS
- •33.5 PRACTICE PROBLEM SOLUTIONS
- •33.6 ASSIGNMENT PROBLEMS
- •34. FUNCTION REFERENCE
- •34.1 FUNCTION DESCRIPTIONS
- •34.1.1 General Functions
- •34.1.2 Program Control
- •34.1.3 Timers and Counters
- •34.1.4 Compare
- •34.1.5 Calculation and Conversion
- •34.1.6 Logical
- •34.1.7 Move
- •34.1.8 File
- •34.1.10 Program Control
- •34.1.11 Advanced Input/Output
- •34.1.12 String
- •34.2 DATA TYPES
plc fuzzy - 26.1
26. FUZZY LOGIC
<TODO - Find an implementation platform and add section>
Topics:
• Fuzzy logic theory; sets, rules and solving
•
Objectives:
•To understand fuzzy logic control.
•Be able to implement a fuzzy logic controller.
26.1INTRODUCTION
Fuzzy logic is well suited to implementing control rules that can only be expressed verbally, or systems that cannot be modelled with linear differential equations. Rules and membership sets are used to make a decision. A simple verbal rule set is shown in Figure 26.1. These rules concern how fast to fill a bucket, based upon how full it is.
1.If (bucket is full) then (stop filling)
2.If (bucket is half full) then (fill slowly)
3.If (bucket is empty) then (fill quickly)
Figure 26.1 A Fuzzy Logic Rule Set
The outstanding question is "What does it mean when the bucket is empty, half full, or full?" And, what is meant by filling the bucket slowly or quickly. We can define sets that indicate when something is true (1), false (0), or a bit of both (0-1), as shown in Figure 26.2. Consider the bucket is full set. When the height is 0, the set membership is 0, so nobody would think the bucket is full. As the height increases more people think the bucket is full until they all think it is full. There is no definite line stating that the bucket is full. The other bucket states have similar functions. Notice that the angle function relates the valve angle to the fill rate. The sets are shifted to the right. In reality this would probably mean that the valve would have to be turned a large angle before flow begins, but after that it increases quickly.
plc fuzzy - 26.2
1 |
bucket is full |
0 |
1 |
bucket is half full |
0 |
1 |
bucket is empty |
0 |
height |
1 |
stop filling |
0 |
1 |
fill slowly |
0 |
1 |
fill quickly |
0 |
angle |
Figure 26.2 Fuzzy Sets
Now, if we are given a height we can examine the rules, and find output values, as shown in Figure 26.3. This begins be comparing the bucket height to find the membership for bucket is full at 0.75, bucket is half full at 1.0 and bucket is empty at 0. Rule 3 is ignored because the membership was 0. The result for rule 1 is 0.75, so the 0.75 membership value is found on the stop filling and a value of a1 is found for the valve angle. For rule 2 the result was 1.0, so the fill slowly set is examined to find a value. In this case there is a range where fill slowly is 1.0, so the center point is chosen to get angle a2. These two results can then be combined with a weighted average to get
0.75( a1) + 1.0( a2) angle = --------------------------------------------- .
0.75 + 1.0
plc fuzzy - 26.3
1. If (bucket is full) then (stop filling)
1 |
bucket is full |
0 |
height |
2. If (bucket is half full) then (fill slowly)
1 |
bucket is half full |
0 |
height |
3. If (bucket is empty) then (fill quickly)
1
bucket is empty 0
height
1
stop filling
0
angle
a1
1
fill slowly 0
a2 angle
1 |
fill quickly |
0 |
angle |
Figure 26.3 Fuzzy Rule Solving
An example of a fuzzy logic controller for controlling a servomotor is shown in Figure 26.4 [Lee and Lau, 1988]. This controller rules examines the system error, and the rate of error change to select a motor voltage. In this example the set memberships are defined with straight lines, but this will have a minimal effect on the controller performance.
plc fuzzy - 26.4
vdesired |
verror |
Fuzzy |
Vmotor |
Motor |
Imotor |
vactual |
|
+ |
Logic |
|
Power |
|
Servo |
|
|
|
Motor |
|||
|
Controller |
|
Amplifier |
|
||
|
- |
|
|
|||
|
|
|
|
The rules for the fuzzy logic controller are;
1.If verror is LP and d/dtverror is any then Vmotor is LP.
2.If verror is SP and d/dtverror is SP or ZE then Vmotor is SP.
3.If verror is ZE and d/dtverror is SP then Vmotor is ZE.
4.If verror is ZE and d/dtverror is SN then Vmotor is SN.
5.If verror is SN and d/dtverror is SN then Vmotor is SN.
6.If verror is LN and d/dtverror is any then Vmotor is LN.
The sets for v |
|
, d/ |
dt |
v |
|
, and V |
are; |
|
|
|
|
|
|
|
|
|
||||||
|
|
|
error |
|
|
error |
motor |
|
|
|
|
|
|
|
|
|
|
|
|
|||
|
v |
error |
|
|
|
|
|
|
d/ |
dt |
v |
error |
|
|
|
V |
motor |
|
|
|||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|||||||
|
1 |
|
|
|
|
|
|
|
|
1 |
|
|
|
|
|
|
1 |
|
|
|
|
|
LN |
0 |
|
|
|
50 |
100 |
rps |
0 |
-3 |
|
0 |
3 |
rps/s |
0 |
0 |
6 |
12 |
18 |
V |
|||
|
-100 -50 0 |
|
-6 |
|
6 |
|
24 |
|||||||||||||||
|
1 |
|
|
|
|
|
|
|
|
1 |
|
|
|
|
|
|
1 |
|
|
|
|
|
SN |
0 |
|
|
|
50 |
100 |
rps |
0 |
-3 |
|
0 |
3 |
rps/s |
0 |
0 |
6 |
12 |
18 |
V |
|||
|
-100 -50 0 |
|
-6 |
|
6 |
|
24 |
|||||||||||||||
|
1 |
|
|
|
|
|
|
|
|
1 |
|
|
|
|
|
|
1 |
|
|
|
|
|
ZE |
0 |
|
|
|
|
|
|
|
rps |
0 |
|
|
|
|
|
rps/s |
0 |
|
|
|
|
V |
|
-100 -50 0 |
50 |
100 |
-6 |
-3 |
|
0 |
3 |
|
0 |
6 |
12 |
18 |
|||||||||
|
|
|
6 |
|
24 |
|||||||||||||||||
|
1 |
|
|
|
|
|
|
|
|
1 |
|
|
|
|
|
|
1 |
|
|
|
|
|
SP |
0 |
|
|
|
|
|
|
|
rps |
0 |
|
|
|
|
|
rps/s |
0 |
|
|
|
|
V |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|||
|
-100 -50 0 |
50 |
100 |
|
-6 |
-3 |
|
0 |
3 |
6 |
|
0 |
6 |
12 |
18 |
24 |
||||||
LP |
1 |
|
|
|
|
|
|
|
|
1 |
|
|
|
|
|
|
1 |
|
|
|
|
|
0 |
|
|
|
|
|
|
|
|
0 |
|
|
|
|
|
|
0 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rps |
|
|
|
|
|
rps/s |
|
|
|
|
V |
|||
|
-100 -50 |
0 |
50 |
100 |
-6 |
-3 |
|
0 |
3 |
|
0 |
6 |
12 |
18 |
||||||||
|
|
|
6 |
|
24 |
Figure 26.4 A Fuzzy Logic Servo Motor Controller
Consider the case where verror = 30 rps and d/dt verror = 1 rps/s. Rule 1to 6 are calculated in Figure 26.5.
plc fuzzy - 26.5
1. If v |
error |
is LP and d/ |
v |
|
|
is any then V |
|
|
is LP. |
|
|
|
|
|
|
|
|
|
|
|
|
||||||||||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
dt error |
|
|
|
|
|
motor |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|||||||
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
|
|
|
|
|
|
|
|
|
|
|
|
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
0 |
|
|
|
|
|
|
|
|
|
|
|
|
|
rps |
0 |
|
|
|
|
|
|
|
|
|
|
|
rps/s |
0 |
|
|
|
|
|
|
|
|
|
|
V |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||||||
|
|
|
-100 -50 0 |
50 100 |
|
|
|
|
-6 -3 0 3 |
6 |
|
|
|
|
0 6 12 |
18 24 |
|||||||||||||||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||||||||||||||||||||||||||
|
|
|
|
|
|
|
|
|
|||||||||||||||||||||||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ANY VALUE |
|
|
|
|
|
|
|
|
|
|
17V |
||||||||
|
|
|
|
|
|
|
|
30rps |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|||||||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(so ignore) |
|
|
|
|
|
|
|
|
|
|
|
|
|||||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(could also |
This has about 0.6 (out of 1) membership |
have chosen |
|
|
|
some value |
|
above 17V) |
2. If verror is SP and d/dtverror is SP or ZE then Vmotor is SP.
the OR means take the highest of the two memberships
the AND means take the lowest of the two memberships
1 |
|
|
1 |
1 |
|
|
|
1 |
|
|
|
0 |
|
rps |
0 |
rps/s |
|
|
|
0 |
|
V |
|
|
|
0 |
|
|
rps/s |
|
|
||||
-100 -50 |
0 |
50 100 |
-6 -3 0 3 6 |
-6 |
-3 0 3 |
6 |
0 |
6 |
12 18 24 |
||
|
|||||||||||
|
|
30rps |
1rps/s |
|
1rps/s |
|
|
|
14V |
||
|
|
|
|
|
|
|
|||||
|
|
This has about 0.4 (out of 1) membership |
|
|
|
|
|
3. If verror is ZE and d/dtverror is SP then Vmotor is ZE.
1 |
|
|
|
|
1 |
|
|
|
|
1 |
|
|
|
|
0 |
|
|
|
|
0 |
|
|
|
|
rps/s |
|
|
|
|
|
|
|
rps |
|
|
|
|
0 |
|
|
V |
|||
-100 -50 |
0 |
50 |
100 |
-6 |
-3 |
0 |
3 |
6 |
0 |
6 |
12 18 |
|||
|
24 |
30rps |
1rps/s |
the lowest results in 0 set |
membership |
This has about 0.0 (out of 1) membership
plc fuzzy - 26.6
4. If verror is ZE and d/dtverror is SN then Vmotor is SN. |
|
|
|
|
||||||||
1 |
|
|
|
1 |
|
|
|
1 |
|
|
|
|
0 |
|
|
rps |
0 |
|
|
rps/s |
0 |
|
|
V |
|
-100 -50 |
0 |
50 |
-6 |
-3 |
0 3 |
0 |
6 |
12 18 |
||||
100 |
6 |
24 |
30rps |
1rps/s |
the lowest results in 0 set |
|
membership
This has about 0.0 (out of 1) membership
5. If verror is SN and d/dtverror is SN then Vmotor is SN.
1 |
|
|
|
|
|
|
|
|
|
1 |
|
|
|
|
|
|
|
|
|
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||||
0 |
|
|
|
|
|
|
|
|
rps |
0 |
|
|
|
|
|
|
|
|
rps/s |
0 |
|
|
|
|
|
|
|
|
|
V |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||||||
|
|
-100 -50 0 50 100 |
|
|
-6 -3 0 3 6 |
|
|
|
|
|
0 |
6 |
|
12 18 24 |
|
|||||||||||||||
|
|
|
|
|
1rps
30rps
This has about 0.0 (out of 1) membership
6. If verror is LN and d/dtverror is any then Vmotor is LN.
1 |
|
|
|
|
|
|
|
|
|
|
1 |
|
|
|
|
|
|
|
|
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|||
0 |
|
|
|
|
|
|
|
|
|
rps |
0 |
|
|
|
|
|
|
|
rps/s |
0 |
|
|
|
|
|
|
|
|
|
V |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||||||
|
|
-100 -50 0 50 100 |
|
|
-6 -3 0 3 6 |
|
|
|
|
0 |
6 |
|
12 18 24 |
|||||||||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|||||||||||||||||||
|
|
|
|
|
|
|
|
ANY VALUE
30rps
This has about 0 (out of 1) membership
Figure 26.5 Rule Calculation
The results from the individual rules can be combined using the calculation in Figure 26.6. In this case only two of the rules matched, so only two terms are used, to give a