## 1 Introduction
Consequently, means of helping the operator to detect this stall and take the proper action motivated this research. All data available during the coiled tubing milling job is measured on surface and there is no direct measurement of the rotation of PDM to directly diagnose a stall. The interpretation of the surface parameters in conjunction is required from the operator at every second to properly assess what is happening with the tool downhole. Considering that the operator is human and prone to errors, this paper aims to use a computer algorithm to supervise the data on surface, recognize any abnormal situation and inform it to the user. [PERSON] (2021) [10] exemplified that many problem in drilling could be addressed by using Machine Learning (ML). Nevertheless, the case being studied has two major limitations for the use of ML: first, the dataset available for development is relatively small, containing data from 4 milling operations in different wells, however with the same PDM model and fluid; second, according to [PERSON] [11], despite the petroleum industry relying on a large number of sensors, it also relies on human interaction with the equipment, which is not recorded in the data and just applying a machine learning technique, which would consider only this sensor data, would lead to incorrect correlations between inputs and outputs. Since the operation with PDM is heavily dependent on human interaction, a ML algorithm was deemed unfit for this purpose and other AI techniques as Fuzzy logic had to be considered. Fuzzy logic uses linguistic variables with degrees of pertinence, making it closer to the human way of thinking and reasoning, instead of using pure numerical values and functions. [PERSON] [12] first described the Fuzzy set in 1965, which were later mathematic modeled by [PERSON] and [PERSON] [13] in 1985. Despite all data being available during the milling job being numeric (such as pressure, weight, and flow rate), the operator judgement is still subjective on whether a stall is happening at a given moment and if he/she has to stop pumping fluid through the PDM or not. In such non-Boolean decision-making processes, the Fuzzy approach to this problem seems to be promising, as it accounts for the uncertainty of human decision imprecision on defining precise criteria for decision making [12]. In the following sections, a Fuzzy Logic Inference System (FIS) with 3 inputs and 2 outputs which will monitor the surface parameters of a coiled tubing operation and detect the PDM stall in its initial seconds, giving enough time for pumping to be halted before the any damage occurs, is proposed. The system is required to detect the motor stalling as fast as possible, using only the data available from the coiled tubing unit surface sensors and other relevant pre-configured data. The setup of the inputs, outputs, knowledge database (fuzzy rules) and calculation is done with the support of an expert in coiled tubing and milling operations. The following sections of this paper are structured as follows. The method section describes the FIS architecture, including inputs, outputs, rule-set, and pre-calculations of the system. The results and discussion section presents the outputs generated by the FIS using the acquisition dataset available for testing. All the abnormalities detected by the FIS are discussed and explained, and an overall discussion about the system is undertaken. Finally, the conclusion section ends this paper.