Python-based fuzzy logic in automatic washer control system

We all wash our clothes on a daily basis. Traditionally, washing has been done by hand. However, today's technology has advanced greatly, and all manual labor has been replaced by machines. The washing machine is one such invention that allows consumers to conserve time, energy, and water. A fuzzy logic control system has been designed in response to human needs. A form of reasoning system known as fuzzy logic justifies YES or NO dependent on the input. These days, artificial intelligence is primarily used in automated products to mimic human thought. Many of the devices we use every day, including washing machines, air conditioners, satellites, unmanned aerial aircraft, traffic control systems, transmission systems, anti-lock brake systems, etc., utilize fuzzy logic problems. Python provides a straightforward answer to the fuzzy logic issue for the washing machine context. Until now, MATLAB was used to construct fuzzy logic problems for washing machines. However, Python logic is used in this, which mitigates the drawbacks of fuzzy logic in MATLAB. The type of clothing, level of grime, and load of clothing are the inputs for this procedure, and the wash time, RPM, dry time, and temperature are the outputs. This goal is used to cut down on the amount of time, energy, and water needed to wash clothes. The outcome of this simulation demonstrates that this washing machine offers a high-quality wash.


Introduction
The concept of fuzzy logic was introduced by Professor Lotfi A. Zadeh (1965), University of California, in the year 1965. It is a powerful design technology which is used to develop control system. Workman (1996) mentioned that it is a simple method to implement complex systems by engineers. Using this technique (Raja et al. 2019), basic necessities of an agricultural land can be satisfied and is also useful for productive farming technique. The main concentration of this idea will be based on the cultivation of three different varieties of the paddy. George J. Kilr and Bo Yuan (1995) proposed that fuzzy logic accepts input with varying degrees at multiple states within a certain time and allows engineers to develop the system in more than natural terms. Zhen and Feng (2012) propounded that gas heaters were designed based on the behavioral model of fuzzy logic controllers.
In the year 1980 (Guido 2009) Python was initially created. It is an interpreted high-level programming language. Guido Van Rossum at Centrum Wiskunde & Informatica (CWI) in the Netherlands introduced Python in the year 1991. The Python community has dubbed him ''Benevolent Dictator for Life'' (BDFL) in recognition of his ongoing development efforts and crucial role in choosing the right course (Raja et al. 2021a).
It is a robust programming language that is also quite simple to understand. It is excellent for those just starting out in the world of programming. It is capable of handling big files and sophisticated mathematical operations. It facilitates a reduction in both time complexity and memory utilization (Benjamin 2017).
& K. Raja raja.rajth@gmail.com Python was first implemented using C language; hence, it was called C Python initially. The main advantage of Python is that it does not use many symbols such as semicolon and curly braces in looping statements ( 2012). Python uses indentation to indicate a block of code, and hence, it is easy to read and understand. Python has the major features relating to object-oriented programming concepts.
Python (Kalyani Adawadkar 2017) 2.0 was first released on October 16, 2000. It has new features and major developments such as garbage collector for cycle detecting for memory management and also supports Unicode. (Tools 2015) Python 3.0 was released on December 3, 2008, after conducting several tests. But many of its feature has been back ported (Patel 2019). Python 2.7 was reported by the Python community for Sunset date that is end of life (EOL) date, but was postponed to 2020 because of many people concern that it cannot be easily forward-ported to Python 3 within the stipulated time periods.
Python is used in a variety of fields, including web development, installers, security systems deep learning, machine learning, and artificial intelligence (Srinath 2017).
In this study (Hetland 2010) we employ a fuzzy logic controller to maintain and regulate the liquid level. MATLAB was used to build earlier fuzzy logic control strategies. But in this case, fuzzy logic control was coded in Python for an easy, accurate, and condensed programed structure.
The input given for the process is type of clothes, degree of dirt, and mass of the cloth load, and the output received is wash time, RPM, dry time, temperature. The simulation results show that the system provides a good wash quality (Raja et al. 2021b). The principle (Raja et al. 2021c) of this process is to subject input to fuzzy arithmetic which in turn returns the value of the temperature of water and washing time.
The analytic and approximate solutions (Omar Abu Arqub 2017) of second-order, two-point fuzzy boundary value problems are based on the reproducing kernel theory under the assumption of strongly generalized differentiability (Alshammari and Al-Smadi 2020). The reproducing kernel Hilbert space method within the Atangana-Baleanu fractional approach and the Bagley-Torvik and Painleve equations are solved with respect to initial conditions of necessity. The solution methodology involves the use of two Hilbert spaces for both range and domain space (Omar Abu Arqub 2021). Numerical algorithm and procedure of solution are assembled compatibility with the cogent formulation of the problem. The method of solution of the utilized problems is studied under some hypotheses, which provides the theoretical structure behind the technique. The solution profiles show the performance of the numerical solutions and the effect of the Atangana-Baleanu fractional approach in the obtained results. In this approach (Arqub et al. 2021), computational simulations are introduced to delineate suitability, straightforwardness, and relevance of the calculations created.

Fuzzy logic system
The idea of fuzzy logic control enables computers to make decisions that resemble those of humans. It relies on conditional statements to function. Most people are unaware of how long it takes to wash clothes to get dirt off. Fuzzy logic controller (FLC)-based washing machines that offer higher performance and low cost must be developed in order to address these problems.
The fuzzy logic controller for liquid-level monitoring in washing machine was designed using the fuzzy logic concept in Python.
Washing machine developed based on fuzzy logic rules will be helpful in washing procedures by sensing the amount of dirt, type of dirt, etc. The fuzzy logic system used in washing time will not only reduce the energy consumption (including electricity and water) but also help the users to save finances in commercial boundary. The application of fuzzy logic controllers has more dynamic range when compared to the conventional PID controller.
The conditions inside the machine are monitored by sensors. The fuzzy logic also has a feature of 'one touch control.' The fuzzy logic also checks the amount of dirt and grease present, the direction of spinning of cloth, the detergent and water to be added and so on. The reloading takes place to correct the direction of spin. Neurofuzzy logic system has inbuilt optical sensors which detect the type of fabric used by the user.
The washing machines incorporate optical sensors to find light permeability of water in washer tank, a device that converts light rays to electrical signal. The optical sensors detect change in light beams. A point at which there is no change of color in the water is known as saturation point. There is no logic or formula to determine the relationship between volumes of clothes and dirt and also the time needed to wash. The structure of washing machine controller has not let itself to ancient methods as the input and output are not clear.
The light passes through a sample of water in the sensor's basic design, and the amount of light that passes through is proportional to the amount of soil. The turbidity sensor measures the decrease in light transmission caused by an increase in soil levels to determine the turbidity sensor. Based on turbidity data, the dishwasher controller decides how long to wash in each cycle. These choices are made based on a comparison of the turbidity of clean water and wash water. Using this method of decision making, we may save energy by washing lightly soiled loads for as long as necessary.

Proposed design
The primary function of a washing machine is to thoroughly and damage-free clean filthy clothing and other fibers. In order to produce an output, such as heavy wash or delicate wash, period of washing, etc., we provide a specific input based on the characteristics of the fabric. In light of that, this fuzzy logic control system is designed using Python and is based on 27 principles for washing duration and 27 principles for water temperature.
This washing machine employs a fuzzy logic system with some of the three main input parameters listed below to efficiently achieve these benefits: 1. Weight of fabrics 2. Stains category 3. Type of fabric The FLC processes the input information and produces five outputs which are: 1. Wash duration 2. Temperature 3. RPM 4. Dry time 5. Wash quality 5 Python code for our fuzzy logic system Fuzzy rules have been involved in the modeling of washing machines. The whole system which we have made is developed by using Python. The code for our FLC system is as follows: 6 Resultant values of our washing machine's FLC Python code The decision of the fuzzy logic controller is made using previously stored data in the database. The principle which we use in this paper is derived from the logical thinking, data taken from daily usage, and experimentation of the system in a controlled environment. The set of principles used here to derive the output based on the fuzzy logic system using Python code are given below: Python-based fuzzy logic in automatic washer control system 6171 In Table 1, three types of clothes are taken into consideration. They are silk, woolen, and cotton. They have the mass of 10 kg to more than 15 kg with dirtiness of lightly soiled to heavily soiled. Using these three parameters, the output temperature ranges from 30 to 60 degree celsius, and RPM ranges from 400 to 1200 r/min, washing time differing from quick to long and washing quality ranging from medium to best.
These outputs produced from inputs are calculated on the basis of fuzzy logic controller system which is programmed on Python for use of greater number of criteria and also to reduce the power consumption. Thus, the best fit of output is produced by the FLC system for the given input and to reduce the water consumption and power consumption (Fig. 1).

Simulation and results
Consider any type of material or cloth to be used for washing. The mass of the cloth and the degree of dirtiness also come into consideration. When these things are given as an input to the system, that is the washing machine, the fuzzy logic system working in it measures how much temperature it should be maintained while washing, what is the RPM which it has to run, the time of washing and the quality of wash using sensors are calculated and produced as the output. These can be visualized using graph simulation as given in the Figs. 2,3,4,5,6,7,8,9,10,11,12,13,14,15,16.

Conclusion
From the above work on fuzzy logic control system of washing machine using Python, we obtained the following results: (i) By using fuzzy logic, we have designed an automatic washing machine controller to access the quality of wash based on parameters, namely dry/rinse time and drum rotation speed/RPM. (ii) The wash quality index is a performance measure to accurately determine the working efficiency of a washing machine at given load.
(iii) The use of fuzzy logic controller using Python automatically detects the necessary RPM for given input load and accordingly presumes the average rinse time of the load, thereby calculating the wash quality index. (iv) This system manages the time and saves water consumption and electricity consumption. This automatic control system depicts the advantages of fuzzy logic controller over traditional washing machine. (v) Thus, fuzzy logic control systems in Python provide great advantages and provide more solutions for problems that cannot be solved by MATLAB environment by reducing the disadvantages such as time management, processing speed, and restricted number of input values, etc. So, Python would be the best solution to solve these problems.