**1. Introduction**

In a flexible manufacturing environment, most processes need precise control of the output value, especially the transport durations. These values cannot always be measured in a continuous manner, basing the control of the process on a discrete event measurement [1]. Especially in the transportation of the product in the flexible manufacturing system, the measurement of the product position is made based on binary sensors at a predefined location [2]. This determines the necessity for event-based control of the process. In most cases, this event-based control is made in a non-adaptive manner [3]. The control is usually made using a rule-based controller that sets a predefined control value based on an event [4]. In some cases, the controller needs a higher degree of adaptability to cope with variations in the system [5].

In most types of controls, the output value is measured at regular intervals, so the update of the control value is made in a time-triggered manned [6]. Even if studied extensively, the time-triggered control cannot cope with most of the event-based processes, especially because of the asynchronistic behavior of the system and, in some cases, the binary measurements [7]. To compensate for the asynchronistic behavior, some proposals were made in the literature but only for measurement losses, not being suited for an evenbased control [8]. In the literature, event-based control, e.g., the arrival of a product to a certain location as an event trigger, has little coverage [6]. In most event-based control

**Citation:** Duca, O.; Minca, E.; Filipescu, A.; Cernega, D.; Solea, R.; Bidica, C. Event-Based PID Control of a Flexible Manufacturing Process. *Inventions* **2022**, *7*, 86. https:// doi.org/10.3390/inventions7040086

Academic Editor: Eugen Rusu

Received: 26 August 2022 Accepted: 21 September 2022 Published: 26 September 2022

**Publisher's Note:** MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

**Copyright:** © 2022 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https:// creativecommons.org/licenses/by/ 4.0/).

93

studies, the event-trigger is given by arriving at the error level of the output to a certain predefined value [9,10]. This type of even-based control is unsuitable for most event-based processes [11].

Based on event-triggered control, by combining it with impulsive control, further development of event-triggered impulsive control was proposed. In this type of control, the conditions and functions of the event-trigger are pre-set and some specific events determine impulsive instants [12–14].

This type of event-based control has as objective the reduction of control value updates and, as a result, the reduction of computational and power usage, especially in low-power devices [15]. However, to measure the error level, it is necessary to measure the output value at a certain predefine duration [16]. This can be done using an intelligent sensor or allocating controller computational power. This is not suitable for most event-based processes, as the output value cannot be measured at regular intervals.

The differences between the time-triggered mechanism and the event-triggered mechanism, based on the occurrence of a preset event, stirred up research, especially in the state estimation of a system [17–19]. In estimating the state and controlling the system, fuzzy or neural network control is implemented [20–22].

In the manufacturing process, the product position is known only at key locations, usually measured using binary presence sensors. Using this type of sensor, an error-based event-triggering or time-triggering controller cannot be implemented [23]. The inability to implement most types of controllers is due to the measurement of the continuous process in a discreet manner [24]. The number of discreet values measured would be defined by the key locations on the system and would determine the continuous running of most control algorithms [25]. This continuous running would be determined by the error values, but as the measurement is done in a few key points, the controller would run based on the old value [26]. This can determine unintended results due to the small number of input values.

In the literature for event-trigger control, multiple solutions are proposed, such as the event-trigger sliding mode control in [27] or the use of a Markov model in [28]. However, in terms of some advantages, a PID control can be implemented, similar to [29] or [16]. In most cases, the PID controller is adopted for simple structure and adaptability in most control cases. In this article, a control algorithm similar to the error event-based algorithm in [9,16] is proposed, as the computation of the controller will start only at the moment a certain event is happening. As the error level trigger case cannot be implemented in the case of a conveyor, a modification of the event trigger is implemented. An activation of the control algorithm is proposed based on the arrival of the product at a certain point on the conveyor and a sensor is activated. From the perspective of the number of activations, the necessary event-based controller would have fewer activations than the proposed literature controllers. The number of activations is given by the key locations where the position of the product is measured.

This paper is organized as follows: Section 2 presents the time-triggered PID control as a reference base in the event-base controller and details the error variation event-trigger controller. Section 3 presents the flexible manufacturing process in which an event-based controller is necessary. Section 4 presents the proposed event-based algorithm and the expected results of the controller in a transportation system. Section 5 presents the implementation of the controller in a flexible manufacturing system and the results obtained.

#### **2. PID Control**

As PID control is one of the most studied types of control, in controlling the eventtrigger transportation system, PID event-based control was considered. For better comprehension of the proposed event-based algorithm in this chapter, the time-based PID control and the error trigger event-based PID control found in the literature will be reviewed.

#### *2.1. Time-Based PID Control*

For the PID control, the S-domain equation that represents the base for the controller is given by:

$$dL(s) = K\_P(E(s) + \frac{1}{T\_{IS}} \cdot E(s) + T\_D \cdot s \cdot E(s)),\tag{1}$$

defining the command value in the S-domain, *U*(*s*), based on the error between the reference and actual value of the output, *E*(*s*) [9].

The control equation is composed of three parts: proportional, integral and derivative, represented by *UP*, *UI*, *UD*, defined by the integral gain *KP*, the integral time *TI*, and derivative time *TD*. The parameters of these three parts are modified regarding the controller specifications to obtain the desired performance. In some cases, the weighting of the setpoint can be applied for a more flexible structure. The structure of the three components of the PID controller can be represented as follows:

$$\begin{cases} \mathcal{U}\_P(s) = \mathcal{K}\_P \cdot E(s) \\ \mathcal{U}\_I(s) = \frac{\mathcal{K}\_I}{s} \cdot E(s) \\ \mathcal{U}\_D(s) = \mathcal{K}\_D \cdot s \cdot E(s) \end{cases} \tag{2}$$

with *KI* defining the integral component gain, and *KD* the derivative component gain [15].

To compensate for the possibility of high-frequency noise from the measurements to the derivative part, a low-pass filter can be added, resulting in:

$$\mathcal{U}l\_D(\mathbf{s}) = \frac{\mathcal{N} \cdot \mathcal{K}\_D \cdot \mathbf{s}}{\mathcal{K}\_D \cdot \mathbf{s} + \mathcal{N}} \cdot E(\mathbf{s}) \tag{3}$$

with *N* as the filter gain [15].

In the case of a real process, the value of the command can increase or decrease until a certain point, as more controlled elements have minimal and maximal values. To corelate the controller with the physical capabilities of the system, a set of command saturation rules needs to be implemented, resulting in the following:

$$\begin{cases} \mathcal{U}\_{\text{Command}}(\mathbf{s}) = \mathcal{U}\_{\text{Inferior}} \cup \mathcal{U}(\mathbf{s}) < \mathcal{U}\_{\text{Inferior}}\\ \mathcal{U}\_{\text{Command}}(\mathbf{s}) = \mathcal{U}(\mathbf{s}), \mathcal{U}\_{\text{Inferior}} \le \mathcal{U}(\mathbf{s}) \le \mathcal{U}\_{\text{Supplier}}\\ \mathcal{U}\_{\text{Command}}(\mathbf{s}) = \mathcal{U}\_{\text{Supplier}}, \mathcal{U}(\mathbf{s}) > \mathcal{U}\_{\text{Supplier}} \end{cases} \tag{4}$$

with *Ucommand*(*s*) representing the command value sent to the executing element, is defined by a minimal value, *UIn f erior*, and a maximal value, *USuperior*.

If the command value falls outside the desired interval, in addition to the saturation rules, an anti-windup method must be implemented. This eliminated the delays introduced by the integrator factor. The most commonly used method is the clamping method. This method disengages the integrator factor for the duration in which the command falls outside the desired limits.

Considering the mapping of the PID controller from the S-domain to the discrete-time domain, the following is obtained:

$$
\mu(t\_k) = \mu\_P(t\_k) + \mu\_I(t\_k) + \mu\_D(t\_k) \tag{5}
$$

with the control value in the time domain *u*(*tk*), and it's components *uP*(*tk*), *uI*(*tk*), *uD*(*tk*), for the proportional, integral and derivative parts, where *tk* = *k* · *h* represents the instant moment of the sampling, having *h* the constant sampling period [15]. Similar to the continuous time controller relation to the S-domain, the relation is similar in the Z-domain with discrete time. The proportional part results in:

$$
\mathcal{U}I\_P(z) = \mathcal{K}\_P \cdot E(z) \tag{6}
$$

with the discrete time form as [15]:

$$
\mu\_P(t\_k) = K\_P \cdot \varepsilon(t\_k) \tag{7}
$$

In the case of the integrator and derivative parts of the PID controller, several solutions can be applied. One of the solutions, backward difference approximation, is a method based on first-order Taylor series expansion. In this expansion *s* = <sup>1</sup>−*z*−<sup>1</sup> *<sup>h</sup>* resulting in

$$\begin{cases} \mathcal{U}\_I(z) = \frac{K\_I \cdot \overline{\mathcal{U}}}{1 - z^{-1}} E(z) \\ \mathcal{U}\_D(z) = \frac{N \cdot K\_D (1 - z^{-1})}{(N \cdot \overline{\mathcal{u}} + K\_D) - K\_D \cdot z^{-1}} \end{cases} \tag{8}$$

relating to the time domain as [15]:

$$\begin{cases} \boldsymbol{u}\_{I}(t\_{k}) = \boldsymbol{u}\_{I}(t\_{k}-1) + \boldsymbol{K}\_{I} \cdot \overline{\boldsymbol{h}} \cdot \boldsymbol{c}(t\_{k})\\ \boldsymbol{u}\_{D}(t\_{k}) = \frac{\boldsymbol{K}\_{D}}{\boldsymbol{K}\_{D} + N \cdot \overline{\boldsymbol{h}}} \cdot \boldsymbol{u}\_{D}(t\_{k-1}) + \frac{N \boldsymbol{K}\_{D}}{\boldsymbol{K}\_{D} + N \cdot \overline{\boldsymbol{h}}} \cdot \left(\boldsymbol{c}(t\_{k}) - \boldsymbol{c}(t\_{k-1})\right) \end{cases} \tag{9}$$

The approximations in the case of the discrete-time controller are more accurate as the sampling duration, *h*, is smaller.

#### *2.2. Error Trigger Event-Based PID Controll*

The first proposed event-based PID controller consisted of two main parts: an event detector and an PID controller activated based on the detected event. The event detector, with time-based sampling, ensures that the error value is maintained in a certain range and that the duration since the last controller activation is not over a certain limit. Similar to the time-sampling PID, the event detector samples the controlled value at an *h* sampling period. Based on the setpoint and the measured value, the event detector sends a signal to the PID part of the controller when the error level falls outside a certain predefined limit, considered an event. As presented in the literature cases, the event-trigger is considered to be the absolute error value, *e*(*tk*), crossing a predefined *e* level. As a result, the event condition is [9,15]:

$$|e(t\_k)| \ge \overline{\varepsilon},\tag{10}$$

with *tk* = <sup>∑</sup>*<sup>k</sup> hk*, with a variable activation period *hk* = *tk* − *tk*−<sup>1</sup> determined in the moment a new event is taking place.

After an event is detected, the PID event-based controller updates the control signal based on the measurements received from the event detector and the previous controller values. In between the event-triggers, the control signal is constant for the *hk* duration. Applying the backward difference method approximation in the case of the integrative and derivative parts results in [16]:

$$\begin{cases} \boldsymbol{u}\_{I}(t\_{k}) = \boldsymbol{u}\_{I}(t\_{k-1}) + \boldsymbol{K}\_{I} \cdot \boldsymbol{h}\_{k} \cdot \boldsymbol{\varepsilon}(t\_{k})\\ \boldsymbol{u}\_{D}(t\_{k}) = \frac{\boldsymbol{K}\_{D}}{\boldsymbol{K}\_{D} + \boldsymbol{N} \cdot \boldsymbol{h}\_{k}} \cdot \boldsymbol{u}\_{D}(t\_{k-1}) + \frac{\boldsymbol{N} \cdot \boldsymbol{K}\_{D}}{\overline{\boldsymbol{K}\_{D} + \boldsymbol{N} \cdot \boldsymbol{h}\_{k}}} \cdot (\boldsymbol{\varepsilon}(t\_{k}) - \boldsymbol{\varepsilon}(t\_{k-1})) \end{cases} \tag{11}$$

having *hk* replacing the constant period *h* in Equation (9).

Considering the event-triggering condition from (10), as an event is recorded only when the error value is larger than a certain level, the activation interval can become very long, as the variation of the output can be very small. Some compensations are applied predominantly to the integrator and derivative parts. A diminishing factor for the activation interval is introduced, resulting in the reduction of *hk* after a long duration of steady output, reducing its effects on the control values. This approach is very similar to the anti-windup method, compensating for errors in the case of saturation of the control value.

For the integral term, an exponential function determines the decrease in the impact of the activation interval as the steady-state duration increases [15,16]:

$$h\_{\text{exp}}^I(h\_k) = h\_k e^{a\_I(h\_{\text{old}} - h\_k)} \tag{12}$$

with *aI* used to directly influence the importance of the activation interval. This determines the value to get closer to *hk* when the activation duration is small and to get very small when the activation duration gets longer.

In the case of the derivate part, similarly, results in:

$$h\_{\rm exp}^{D}(h\_k) = h\_{\rm old} + (h\_k - h\_{\rm old}) \cdot e^{a\_D(h\_{\rm old} - h\_k)} \tag{13}$$

with *aD* used to increase or decrease the influence of the exponential factor. The results show that the *h<sup>D</sup>* exp(*hk*) value will be closer to *hk* when the activation value is small and closer to the last activation period *hold* when the activation duration gets bigger.

Using these improvements, a PID with a forgetting factor is obtained, resulting in the integrator and derivative parts as [15,16]:

$$\begin{cases} \boldsymbol{u}\_{I}(t\_{k}) = \boldsymbol{u}\_{I}(t\_{k}-1) + \boldsymbol{K}\_{I} \cdot \boldsymbol{h}\_{\exp}^{I}(\boldsymbol{h}\_{k}) \cdot \boldsymbol{e}(t\_{k})\\ \boldsymbol{u}\_{D}(t\_{k}) = \frac{\boldsymbol{K}\_{D}}{\boldsymbol{K}\_{D} + N \cdot \boldsymbol{h}\_{\exp}^{D}(\boldsymbol{h}\_{k})} \cdot \boldsymbol{u}\_{D}(t\_{k-1}) + \frac{N \cdot \boldsymbol{K}\_{D}}{\boldsymbol{K}\_{D} + N \cdot \boldsymbol{h}\_{\exp}^{D}(\boldsymbol{h}\_{k})} \cdot \left(\boldsymbol{e}(t\_{k}) - \boldsymbol{e}(t\_{k-1})\right) \end{cases} \tag{14}$$

#### **3. Flexible Manufacturing System**

Considering the literature in the event-based control area, the research is centered on the reduction of computation power through the reduction of controller activation and control values. This control is based on the sampled measurement of the output value. This is not always possible in a manufacturing system, for example, as the position of a product is measured only in key positions. In this chapter, the hardware and process structure of the flexible manufacturing system considered in the application of event-based control will be presented.
