Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

Nature Inspired Computing COMP815 (Second choice of assignment task for Assignment 1)

Assignment 1: Fuzzy Logic Control (25%)

You have a choice of topic for your fuzzy logic controller assignment task, if you decide to do this task: a washing machine time controller (A), or             driverless car speed controller (B). Attempt only one. Do not attempt this    assignment until you have completed the workshop on Matlab’s fuzzy          control toolbox and watched the video tutorial for the workshop.

A: Washing machine time controller (Option A)

1. Your task is to implement a simple washing machine time controller based on the amount of dirt and type of dirt on clothes. There are two input variables and one output variable. You should use   Matlab’s fuzzy logic toolbox for this assignment.

2. The amount of dirt is specified by the following membership functions for ‘small’,

‘average/medium’ and large’ . Enter these membership functions using the graph in Figure 1 as a   guideline. You don’t have to be entirely accurate with respect to the figure below. You will need to pay attention to the type of membership function and the range. You can interpret the range as a  percentage:

 

Figure 1: Membership functions for amount of dirt

3. The type of dirt is specified by the following membership functions for ‘not greasy’, ‘medium greasy’ and greasy’ (Figure 2). You can interpret the range as a percentage:

 

Figure 2: Membership functions for type of dirt

4. The wash time (output variable) has five membership functions (‘very short’, ‘short’, ‘medium’,      ‘long’ and ‘very long’ . You can interpret the range as minutes. You can specify your own output           membership function ranges if you are not happy with these below (Figure 3), but make clear in your report what you have done.

 

Figure 3: Membership functions for wash time

5. The full set of rules for deriving output is:

1. If dirtiness_of_clothes is Large and type_of_dirt is Greasy then wash_time is VeryLong;

2. If dirtiness_of_clothes is Medium and type_of_dirt is Greasy then wash_time is Long;

3. If dirtiness_of_clothes is Small and type_of_dirt is Greasy then wash_time is Long;

4. If dirtiness_of_clothes is Large and type_of_dirt is Medium then wash_time is Long;

5. If dirtiness_of_clothes is Medium and type_of_dirt is Medium then wash_time is Medium;

6. If dirtiness_of_clothes is Small and type_of_dirt is Medium then wash_time is Medium;

7. If dirtiness_of_clothes is Large and type_of_dirt is NotGreasy then wash_time is Medium;

8. If dirtiness_of_clothes is Medium and type_of_dirt is NotGreasy then wash_time is Short;

9. If dirtiness_of_clothes is Small and type_of_dirt is NotGreasy then wash_time is VeryShort

6. Once you have implemented this fuzzy logic controller, answer the following questions:

Question set A:

(a) What is the rule surface for the system? Do you see any discontinuities? Are you happy with the surface?

(b) What is the wash time, in minutes, for the following loads?

(i) Dirtiness=70; Type=50.

(ii) Dirtiness=0; Type=50.

(iii) Dirtiness=100; Type=100.

(iv) You have clothes that are 100% greasy. What is the minimum length of wash irrespective of amount of dirt?

(v) You have clothes that are 100% dirty. What is the minimum length of wash irrespective of type of dirt?

7. You will now add Temperature of water as a third input variable to your controller. The general  principle is: the colder the water, the longer the wash. So, the hotter the temperature, the less time the wash. You can assume that water temperature has a range from 20 degrees C to 60 degrees C.   Add the following:

•    A third input variable called ‘Temperature’;

•   Three membership functions for Temperature’: cold; warm; hot. You can specify these three membership functions any way you wish (as triangular, trapezoidal, Gaussian…).

•    Add at least one And’ rule involving all three antecedents Dirtiness, Type and Temperature, with one rule consequent for Wash Time.

•    Add at least one ‘Or’ rule involving all three antecedents Dirtiness, Type and Temperature, with one rule consequent for Wash Time

•    Add at least one rule using the ‘not’ option in the Rule Editor. You can use as many antecedents as you wish (minimum one).

After you have implemented the third input variable Temperature as specified above, answer the following questions:

Question set B:

(c) How plausible or intuitively correct are your added rules?

(d) What is the shape of your new rule surface and how does it compare with your previous rule surface?

(e) What is the wash time for the following loads?

(v) Maximum amount of dirt, maximum greasiness, hottest water. (vi) Maximum amount of dirt, maximum greasiness, coldest water.

8. Write a report using the IEEE format available in the assignment folder consisting of 6 pages maximum. The report  should include the following, presented in any way you wish:

•    Membership function descriptions for each of your two input and one output variable; answers to Question Set A.

•    Membership function description for your third input variable (water temperature); answers to Question Set B;

•    Your conclusion and lessons learnt (if you could start the assignment again, would you do anything differently? If you had more time, what else would you do?)

An example report will be made available to you to help you construct your own report. The marksheet for this assignment is on the next page.

(Note: this assignment is based on material taken from

http://softcomputing.tripod.com/sample_termpaper.pdf)

This concludes the first option for a fuzzy logic controller. Look at the next page for the second option for a fuzzy logic controller.

 

B: Driverless car speed controller (Option B)

1.   This assignment is based on the material in the fuzzy logic and control lecture, and involves  implementing the functions for determining car speed based on two input variables. So, you will need to implement (or apply your own versions, with full descriptions):

Input variables: #1Temperature, #2 Cloud Cover

•  Temp: {Freezing, Cool, Warm, Hot}

1

0

•  Cover:

10              30              50              70              90             1 10

Temp. (F°)

{Sunny, Partly, Overcast}

1

0

0               20              40              60              80             100

Cloud Cover (%)

1

 

2. There are two rules, as follows:

(i) If its freezing and overcast, drive slow. (ii) If it’s hot and sunny, drive fast.

Now ensure that the following are answered in your assignment report.

Question (a): How fast should the car go if it is 40 degrees and 75% cloud cover?

3.The temperature goes up to 50 degrees but there is still 75% cloud cover. We also have a new rule:

(iii) If it is cool and overcast, drive moderately.

The membership function for Moderately is as follows:

MPH

Moderately

10

0.0

20

0.0

30

0.2

40

0.6

50

1.0

60

0.6

70

0.2

80

0.0

90

0.0

100

0.0

Add this function to the Output Variable Speed.

Question (b): How fast should the car go if it is 40 degrees and 75% cloud cover, with and without the new, third rule implemented? How does the third rule affect the rule surface?

4. Now, your next assignment task is to introduce a third input variable representing the sensor ‘distance to the car in front . The general principles are

(i)          the closer to the car in front, the more the car slows down;    (ii)         the further to the car in front, the more the car can go faster.

Your final task is to implement this third input sensor and add the two principles above to the rule set. You may find it useful to think of at least two membership functions: close to the car in front, and far to the car in front. You will need to decide whether you need more membership functions and what type they should be.

Then answer the following questions in your assignment report.

Question set (c)-(e):

(c) How did you implement the new, third sensor variable for distance to car in front in terms range and type of membership functions? Why those particular choices?

(d) What is the shape of your new rule surface with the third input sensor and how does it

compare with your previous rule surface consisting of two sensors?

(e) What is the speed for the following conditions?

(i) Minimum temperature, minimum cover, minimum distance?

(ii) Maximum temperature, maximum cover, maximum distance?

(iii)Moderate temperature, moderate cover, moderate distance?

5. Write a report using the IEEE format available in the assignment folder consisting of 6 pages maximum. The report is to contain the following:

•    Membership function descriptions for each of your two input and one output variable, including new rule; answers to Questions (a) and (b).

•    Membership function description and new rules for your new third input variable (distance to car in front); answers to Questions (c), (d) and (e);

•    Your conclusion and lessons learnt (if you could start the assignment again, would you do anything differently? What would you do next if you had more time?)

This concludes the second option for the assignment in fuzzy logic control.

Example reports will be made available to you to help you construct your     own report. The marksheet for this part of the assignment is available in the Assignments folder.