This fuzzy control system is an AI prototype for an automated train, i.e. a train which runs by its own on the basis of two input parameters: distance from the signal (in km) and color of the signal (red, green or yellow). On the basis of the given input parameters, this system dynamically changes the speed of the train which is the output (in kmph).
If the signal color is red, then the train stops just before it. If it is yellow, then it stops at the upcoming station. It turns green, it surpasses the upcoming station.
Introduction:
So , basically this fuzzy control system is just an AI prototype for an automated train i e a train which runs by its own on the basis of 2 input parameters
- Distance from the signal (in km)
- Color of the signal (red , green or yellow )
On the basis of given input parameters , this system dynamically changes the speed of train which is the output (in kmph)
Basically If the signal color is red , then train stops just before it , If it is yellow then it stops at the upcoming station and last case when it turns green it surpasses the upcoming station
Principle:
- 1. Fuzzification of the input variables
- 2. Application of fuzzy operator(AND) on the antecedent parts of the rules
- 3. Evaluation of the fuzzy rules
- 4. Aggregation of fuzzy sets across the rules
- 5. Defuzzification of the resultant fuzzy set ( i e speed)
Working:
Abbildung in dieser Leseprobe nicht enthalten
Well , color of signals lie under nominal category , but I don't know to assign membership value to nominal value since I am new to this module (scikit fuzzy) , so i decided to declare range for each of them Here median membership value for Red signal is 0.4,1.3 for yellow light and 2.2 for green light Note:
Any changes like intersection were made based on analysis of output
Speed:
Abbildung in dieser Leseprobe nicht enthalten
Here we have speed of train ranging upto 120kmph which is segmented into 5 non-uniformly distributed membership function.
Unlike other parameter which have uniform triangular membership function.
This mixed membership function is has mixed geometry of triangular and trapezoidal shape
Rules of Inference:
Rule 1 :
If the distance from signal lies in the range d3 and color of signal is red then the speed of train should lie in the range of si
Rule 2 :
If the distance from signal lies in the range d2 and color of signal is red then the speed of train should lie in the range of s0
Rule 3 :
If the distance from signal lies in the range di and color of signal is red then the speed of train should lie in the range of s0
Rule 4 :
If the distance from signal lies in the range d0 and color of signal is red then the speed of train should lie in the range of s0
Rule 5 :
If the distance from signal lies in the range d3 and color of signal is yellow then the speed of train should lie in the range of s2
Rule 6 :
If the distance from signal lies in the range d2 and color of signal is yellow then the speed of train should lie in the range of s2
Rule 7 :
If the distance from signal lies in the range di and color of signal is yellow then the speed of train should lie in the range of si
Rule 8 :
If the distance from signal lies in the range d3 and color of signal is green then the speed of train should lie in the range of s4
Rule 9 :
If the distance from signal lies in the range d2 and color of signal is green then the speed of train should lie in the range of s4
Rule 10 :
If the distance from signal lies in the range di and color of signal is green then the speed of train should lie in the range of s3
Final Defuzzified Result :
We have tested it for some single tuple of input ( mostly boundaries ):
- When distance is less than 1 km and signal display red color
Abbildung in dieser Leseprobe nicht enthalten
- When distance is less than 2 km and signal display yellow color
Abbildung in dieser Leseprobe nicht enthalten
- When distance is less than 3 km and signal display green color
Abbildung in dieser Leseprobe nicht enthalten
On the basis of these boundary condition , we prepared a dataframe consisting of distance from signal , color of signal and speed of train of about 30 observation which depict a motion Of train when it first encounters red signal then yellow and then green.
And plotted distance against speed in from of scatterplot with hue of colour
Abbildung in dieser Leseprobe nicht enthalten
This depict that on approaching red signal it's speed tends to zero , on the other hand when it approaches yellow or green signal its speed increases.
[...]