# Stable Rules Definition for Fuzzy TS Speed Controller Implemented for BLDC Motor
## 1 Introduction
Thus, it is possible to describe the current state of a plant with linguistic variables (instead of specific state equations). This can be performed after the fuzzification stage in the first layer of the controller. The second layer (inference) calculates conclusions and their significance in the final control signal through several iterations of the algorithm. Then, the received values are taken to the defuzzification layer and changed from the fuzzy variable to a specific value, which allows the fuzzy model to cooperate with the rest of the control system (e.g., the torque control loop of the electric drive) [34; 35; 36; 37; 38]. Additionally, the dynamic development of cheap and powerful microprocessor units makes it easier and more reasonable to use fuzzy logic controllers in everyday applications. One of the most representative implementations, based on a fuzzy logic model, may be seen in a typical modern car, i.e., an active cruise control system [39]. Considering the fact that there are a variety of reference speed values that can be achieved by a car, the characteristics of the plant are strongly dependent on the current gear, actual motor speed value, and weight of the vehicle. There are also plenty of factors and circumstances that directly influence the above-mentioned characteristics (e.g., the number of people inside the car). Therefore, it is clear that a conventional controller (PID/PI) may be insufficient. Moreover, a fuzzy logic controller does not require specific plant parameters (during the design stage) to make the system work properly. Any control structure requires the tuning of its parameters to perform well with different objects. The efficiency and performance of the controlled drive rely on correctly selected coefficients. A variety of optimization approaches can be found in control theory, among which standard (based on a mathematical model of the structure) and numerical methods can be distinguished. One of the most interesting methods, which seems to have become very popular in recent years, is based on metaheuristic algorithms. These describe different calculations that provide general instructions to minimize the value of a given cost function. In comparison to standard optimization algorithms, metaheuristic optimizers work without difficult mathematical calculations (e.g., the gradient can be neglected) [40]. Thus, they can be applied easily to complex problems (including nonlinear objects and parameter modifications). The implementation of the tool is universal for different issues (without additional recalculations). Due to these advantages, a wide range of applications in different areas of science [41], engineering [42; 43], economics [44], and medicine [45] can be found. Their high popularity is a result of not only the ease of application but also the high efficiency of metaheuristic algorithms. Because of the iterative process, the initial results may be quickly modified, and then, in the following iterations, their precision may be improved. Metaheuristic algorithms are often based on observations of nature, especially swarm processes [46]. These methods often include elements of artificial intelligence (AI) [47]. This article describes the complete design process and implementation of a fuzzy logic speed controller for a BLDC motor. The theoretical background and mathematical model of the control system are analyzed. Then, the stability issue is considered, and a practical application of the Lyapunov theorem for rule base definition is provided. The next part presents an application of a nature-inspired metaheuristic optimizer for controller efficiency improvement (Chameleon Swarm Algorithm). The subsequent section introduces the results of simulation tests of the established fuzzy logic control structure. Considerations of different operation scenarios are discussed, and the chosen speed transients are presented. A significant part of the paper is related to the design process and construction of the microcontroller system and power electronics for a low-cost test bench.