Development of a Single-Variable Fuzzy Controller in Python without Libraries


Authors

Ricardo Francisco Martínez-González, Tecnológico Nacional de Mexico – IT Veracruz, México

Abstract

This paper describes the development of a single-variable fuzzy controller implemented entirely in Python, without relying on external libraries. The coding process was structured into four distinct stages, utilizing an object-oriented programming paradigm for defining membership functions. We developed custom membership functions for both input and output variables, along with methods to evaluate their respective degrees of membership. Inference rules were manually applied to determine the controller's output. Testing involved evaluating these membership functions for both input and output. A key result derived from this process is the cumulative value, which facilitates the calculation of the centroid of the minima of the output variable's functions, ultimately yielding the controller's output. The successful implementation of this fuzzy controller from scratch highlights its potential for future development into more complex controllers and encourages further exploration in this field.

Keywords

Fuzzy Controller, Object-Oriented Programming, Python, Virus, Control System