Discrete-Time Fractional, Variable-Order PID Controller for a Plant with Delay

In this paper, we discuss the implementation and tuning algorithms of a variable-, fractional-order Proportional–Integral–Derivative (PID) controller based on Grünwald–Letnikov difference definition. All simulations are executed for the third-order plant with a delay. The results of a unit step response for all described implementations are presented in a graphical and tabular form. As the qualitative criteria, we use three different error values, which are the following: a summation of squared error (SSE), a summation of squared time weighted error (SSTE) and a summation of squared time-squared weighted error (SST2E). Besides three types of error values, obtained results are additionally evaluated on the basis of an overshoot and a rise time of the output signals achieved by systems with the designed controllers.


Introduction
Proportional-Integral-Derivative (PID) controllers are undoubtedly used in most automatic process control applications in the industry today. They are renowned for example as an excellent tool to regulate flow, temperature, pressure, and many other industrial process variables. Historically, the first PID controllers were built in 1939 by the Taylor and Foxboro instrument companies. Despite the various tuning methods most of present-day controllers are based on those original proportional, integral, and derivative modes. One of the first methods of PID tuning was Ziegler-Nichols, described in [1], which was widely extended along last decades. One of the directions of making PID controllers more robust is the use of fractional-order operators for both cases: continuous-, and discrete-time models. The review of fractional controllers is presented in [2]. The fractional PID controller was introduced by I. Podlubny in [3]. After this work, various authors designed fractional PID controllers using different tuning methods. It was shown in many papers, see for example [4][5][6][7][8][9], that the use of fractional PID controllers could make the entire control system perform better. The reason is that FOPID (fractional-order PID) controllers, in addition to standard K p , K i , K d , introduce two more tuning parameters-integral and derivative order values, which provide wider flexibility during the control process. Although most of the controllers are devoted for analog systems, nowadays, the control of a system performance is mainly carried out with the aid of microcontrollers and microprocessors, see [10]. Many processes described by an analog system can be controlled by a digital system. The switching between analog and digital signals is obtained by the sampling of signals and zero-order hold part. The generalised transfer function of analog fractional PID controller depends on three gains: K p , K i , K d ; and two fractional values: λ and µ. The transfer function of such controller is described by the following formula: G PID (s) = K p + K i s λ + K d s µ , where λ is the order of integration, and µ is the order of differentiator. All the classical PID controllers are particular cases of

Materials and Methods
The most important part in our investigations plays the definition of fractional, variable-order h-difference of Grünwald-Letnikov type. In some papers, e.g., [14,18,19], this operator is referred as the type A. In the definition, there is a sequence a ν l k of coefficients used depending on a given variable-order function. It is important to notice that the sequence tends quite fast to zero and the smallest parts of it, for the considered step, are multiplied by the oldest trials. Then, in a certain sense, the sequence tries to forget older values but it does not vanish them completely. One can find this in some past papers, where based on this matter, authors truncate the whole sequence after a fixed amount of steps. Due to the property of forgetting the sequence of coefficients, it is also called the oblivion function, see [11,20]. Definition 1. For k, l ∈ Z and (ν l ) l∈Z the oblivion function is defined as a ν l k = 0 for all k < 0 and l ∈ Z, a ν l 0 = 1 and a for k > 0.

Definition 2. (FVOGLD)
Let h > 0 and x : hZ → R be a bounded function. The fractional-, variable-order Grünwald-Letnikov h-difference operator of a function x with step h > 0 and an order function ν : Z → R is defined as a finite sum where x k := x(kh).
Definition 2 as a fractional-, variable-order summation that can be treated as discrete-time version of fractional-, variable-order integration (if the sample step h goes to zero). Observe that Definition 2 agrees with definition of type A, presented for example in [18,19], only if an order function has non-negative values and can be treated as an extension of difference operators. For constant-order function ν ≡ α, the operator given in Definition 2 agrees with the Grünwald-Letnikov fractional-order backward difference if α ≥ 0, or becomes fractional summation for α < 0. For constant-order functions, we refer the reader to [21,22].

A Digital Fractional-, Variable-Order PID Controller
A digital fractional-, variable-order PID controller can be defined in a similar way as a first-order PID. The implemented FVOPID controller of type A is given by the Equation (4) In Equation (4), coefficients K p , K i , K d are proportional, summation, and difference gains respectively; µ k and ν k are values of order functions of summation and difference actions; k is the number of a sample; h > 0 is a sampling time; e k is an input; and y k is an output of the controller. It is worth mentioning that if both order functions µ k and ν k are non-negative at the same time, then the controller acts like it has two differences with gains K i and K d and no summation. Similarly, if both order functions are simultaneously nonpositive, then the controller would work like it has two summations with gains K i and K d and no difference. One of the assumptions, which was taken during the controller implementation, was that there are five possible order values, v i1 , . . . , v i5 for summation; and five possible order values, v d1 , . . . , v d5 for difference operator. Selected number of order values is a compromise between control flexibility provided by variable-order controller (higher number of different order values could possibly give more control options) and computational time required by optimisation algorithms to find the order values (the time that optimisation algorithms require to find the optimal solution depends on the number of parameters). An additional assumption is that the order values depend on a ratio of an error value e k and a set-point value u k , defined as Based on the current value of ratio ρ k , the controller has summation and difference orders set according to the following rules: , v d2 for the ratio ρ k ∈ (0.6, 0.8 ; The main idea of designed variable-order controller is, in this case, to make the order values (which induces control characteristic) dependent on the current stage of the control process which is represented by the ratio (5). In order to find parameters of FVOPID controller, two versions of the tuning algorithm were developed. The first version of the algorithm (which will be referred as FOPID based) can be described by the following steps: 1.
Finding parameters K p , K i , and K d of the first-order PID controller using some selected method (e.g., Ziegler-Nichols or any other tuning approach). 2.
Using Nelder-Mead optimisation to find new parameters K p , K i , and K d of first-order PID controller (as the starting point of the optimisation, K p , K i , and K d values calculated in step 1 should be used).

3.
Using Nelder-Mead optimisation to find fractional order PID (FOPID) controller parameters (as the starting point of the optimisation, K p , K i , and K d values calculated in step 2 should be used). In this case, besides K p , K i , K d parameters, the optimisation algorithm additionally searches for optimal constant order values v i (summation) and v d (difference).

4.
Using Nelder-Mead optimisation to find new parameters K p , K i , and K d and order values of variable, fractional-order PID controller (as the starting point of the optimisation, K p , The second version of the algorithm (which will be referred to as PID-based) is similar to the FOPID-based algorithm. The difference is that FVOPID parameters are searched starting from the parameters of optimal PID controller instead of FOPID controller. Note that by optimal PID controller we mean the PID controller designed with the Nelder-Mead optimisation to minimise given error criteria. Additionally, it was assumed that v i5 and v d5 order values should be set to 1 in this case. The reason of setting the order values to 1 (which means first order integral/derivative) for small values of error is to eliminate steady-state error which is characteristic for fractional order controllers. The PID-based algorithm can be described by the following steps:

1.
Finding parameters K p , K i , and K d of the first-order PID controller using some selected method (e.g., Ziegler-Nichols or any other tuning approach).

2.
Using Nelder-Mead optimisation to find new parameters K p , K i , and K d of first-order PID controller (as the starting point of the optimisation, K p , K i , and K d values calculated in step 1 should be used).

3.
Using Nelder-Mead optimisation to find new parameters K p , K i , and K d and order values v i1 − v i4 , v d1 − v d4 of variable, fractional-order PID controller (as the starting point of the optimisation, K p , K i , K d values calculated in step 2 should be used).
Parameter searching procedures are based on minimisation of three types of summation errors which are as follows: sum squared error (SSE), sum squared time weighted error (SSTE) and sum squared time-squared weighted error (SST2E). Mentioned errors are calculated based on the Equations (6)- (8).

Results
The simulations were performed for the plant described by the following transfer function: The plant model was taken from [23], where the authors presented a design method for PID controllers based on constrained optimisation. The simulations were performed in Matlab Simulink with the sampling time set to h = 0.02s. The simulation time used for controllers parameters search was set to 60 s. The initial parameters of PID controller (which corresponds to step 1 of the described algorithms) were set to K p = 0.555, K i = 0.1729, K d = 0.9657 according to [23]. The simulations were executed for both unconstrained and constrained control signal values. A rise time and an overshoot presented in the result tables were calculated with Matlab stepin f o function. A rise time in this case is considered as a time needed for the output signal to rise from 10% to 90% of the steady-state response [24].

Simulation Results for Controllers with Unconstrained Control Signal Values
During the first phase of the research, the simulations were performed with the assumption that there are no constraints set to the values of control signals generated by the controllers. As the starting point for the experiment, we chose a controller referred as Initial PID. By Initial PID, we understand PID controller with parameters set to K p = 0.555, K i = 0.1729, K d = 0.9657 (step 1 of previously described algorithms). The error values, rise time, overshoot, and minimum/maximum control values for the Initial PID controller setup are presented in Table 1. The step responses and the values of control signals generated by the controllers designed with SSE, SSTE, and SST2E error minimisation are presented in Figures 1-9. To make figures more transparent/readable, presented simulation time was limited to 50 s (the parameters were searched for 60 s simulation). Additionally, control values presented in Figure 3 were limited to a range of −15 to 15 and in Figures 6 and 9 to a range of −2 to 5. This is because at the beginning of the control process, the signals generated by the controllers reach very high values which would make analysis of the signals in later phase of the control difficult. The maximum/minimum controllers output signal values (which usually occur at the beginning of the simulation) can be found in the last two rows of Tables 2-4. Optimal PID is a first-order controller, for which parameters were found by Nelder-Mead optimisation (steps 1 and 2 of described algorithms). FOPID controller is a fractional order PID for which parameters were found according to steps 1-3 of FOPID based algorithm. The values of implemented controllers parameters, rise time, overshoot, and minimised error of Optimal PID, FOPID, and FVOPIDs controllers are presented in Tables 2-4. Column 'Optimal PID' contains results for Optimal PID controller, 'FOPID' column represents results for Fractional order PID, while 'FVOPID-FO' and 'FVOPID' columns contain data respectively for FVOPID controller tuned with FOPID-based algorithm and FVOPID tuned with PID-based algorithm.    (Table 2). Table 2. SSE minimisation results-unconstrained control signal (Figures 1-3).   (Table 3).

Figure 5.
Comparison of the results for SSTE error minimisation-fractional-order controllers, unconstrained control signal value (Table 3).

Figure 9.
Control signal generated by controllers which minimise SST2E error-unconstrained control signal value (Table 4).

Simulation Results for Controllers with Constrained Control Signal Values
During the second phase of the research, the simulations were performed with the assumption that the absolute value of the control signal generated by the controllers should not exceed the maximum value returned by Initial PID (PID tuned with step 1). In this case, the controllers output signals are limited to the range of −48.8435 to 48.8435 (because the maximum value returned by the Initial PID controller is 48.8435). It is worth noticing that the limitation of the signal generated by the controllers is not achieved by adding saturation block to the controllers output, but by modifying the tuning algorithm so it searches for parameters for which the constraint criteria are met. This additional condition is simply achieved by checking the minimum and maximum controller output values in every optimisation step (for every set of parameters produced by Nelder-Mead optimisation) and if the values exceed the defined limit, then the maximum possible value is assigned to the minimised error (which forces the optimisation algorithm to search for another set of parameters). The obtained results for constrained controllers output values are presented in Figures 10-18 and in Tables 5-7.    (Table 5).  13. Comparison of the results for SSTE error minimisation-constant-order controllers, constrained control signal value (Table 6).

Figure 14.
Comparison of the results for SSTE error minimisation-fractional-order controllers, constrained control signal value (Table 6).

Figure 17.
Comparison of the results for SST2E error minimisation-fractional-order controllers, constrained control signal value (Table 7).

Figure 18.
Control signal generated by controllers which minimise SST2E error-constrained control signal value (Table 7).

Computational Effort
One of the drawbacks of fractional-, variable-order PID controller is high computational cost, which increases with the duration of the simulation. This is because the calculation of the current value of fractional-, variable-order Grünwald-Letnikov h-difference operator, which is used by both difference and summation controller actions, requires all the previous values returned by the controller as shown in Definition 2. It means that FVOPID controller needs an additional buffer, big enough to store mentioned values. Of course, in real-life implementation, the buffer would have to be periodically cleaned. The strategy for efficiently cleaning said buffer of FVOPID controller without significantly disturbing the control is an open topic that requires additional research. When it comes to the number of operations required to calculate the output of FVOPID controller, we will first focus on Definition 1, which describes the oblivion function. In the worst-case scenario, when the order function value is changed in every step and when the given order value did not occur in the past, the controller would have to recalculate all the values of oblivion vector. It means that if we assume that the current step of the simulation is k, then k calculations of Equation (2) would have to be executed in this particular step. At the same time, if the order function does not change very often (or does not change at all, like for constant order FOPID controller) the generation of oblivion function vector could be simplified by using previous calculation results (new value can be calculated by single invocation of Equation (2)). As we can see, in this case, computational cost of FOPID controllers is significantly lower than the one required by FVOPID. With the calculated vector of oblivion function values, backward difference can be evaluated according to Definition 2. For the k − th step of the simulation we would have in this case k + 1 multiplication and k + 1 summation operations. Additionally, we have to calculate the elements of oblivion function vector to power of the current value of the order function and divide the final result by h v k . Additionally, in this step, FOPID controller computational cost could be significantly lower (in comparison to FVOPID) by reusing previously calculated values of oblivion function.
When it comes to the time required by Nelder-Mead optimisation algorithm to find optimal parameters of the controllers, it (as could be assumed) highly depends on the number of searched parameters. Table 8 shows the number of iterations and function evaluations required to find optimal parameters of each designed controller (Nelder-Mead algorithm requires the evaluation of the function at different points in each iteration [25]).

Discussion
In the first stage of the research, the simulations were carried out with the assumption that the value of control signal produced by the controller is unconstrained. In this case, most of designed FVOPID controllers achieved lower values of minimised errors than constant-order (first and fractional) controllers. Only in one case, when SSTE error was minimised, using FVOPID in which parameters search was based on PID controller parameters, resulted in higher value of error than then one returned by FOPID. In all the cases, fractional-order controllers outperformed Optimal PID which shows how beneficial in this case was the introduction of additional tuning parameters. When it comes to FVOPID controllers, the ones that were tuned with 'FOPID-based' algorithm returned lower values of errors than the controllers tuned with 'PID-based' algorithm. FVOPID controllers additionally achieved the lowest values of the rise time with the smallest value of the overshoot at the same time. On the other hand, the characteristics returned by PID controllers tend to be smoother (have less oscillations) than corresponding FOPID and FVOPIDs characteristics. It is worth noticing that the selection of minimised error had a great impact on the received results. SSE error minimisation results show short values of rise time and high values of overshoot. At the same time, SST2E error-minimising controllers returned high values of rise time with a very small overshoot.
In the second stage of the research, the controller output values were limited to the values returned by the Initial PID controller (it was assumed that designed controllers' absolute value of the output signal cannot exceed the absolute maximum value returned by the Initial PID). As we can see, also in this case, the best results when it comes to errors minimisation were achieved by variable order PID. Due to the addition of control signal constraints, FVOPID controller tuned by 'PID-based' algorithm gave a little better results than the one tuned with 'FOPID-based' algorithm for SSE and SST2E error minimisation. When it comes to the rise time, both FVOPID controllers outperformed the other constant-order (first and fractional) controllers. For overshoot, FVOPID controllers were also able to achieve the lowest values of this criterion, but with the exception of SST2E error minimisation, where FVOPID controller tuned with 'FOPID-based' gave slightly worse results than both FOPID and even Optimal PID. In most of the cases, setting restrictions to the controller output signal (as could be predicted) increased obtained error values. On the other hand, characteristics obtained by constrained FVOPID tend to be smoother (smaller oscillations) than the ones which were achieved by the controllers for which output values were not limited. What is also interesting is that in some cases, the order values of FVOPID controllers were negative. It means that given controllers during some phase of the control have two derivative blocks or two integral blocks instead of one derivative and one integral (negative order means that integral action changes to derivative and vice versa).
When it comes to the control signals generated by FVOPID, we can observe a high rate of signal changes in the initial phase of the control, when output value of the process starts to increase and reaches the setpoint. This is the result of changing order values, which are adjusted based on the ratio between the current error and the setpoint. What is worth noticing is that the control signal in some cases reaches negative values, which has to be considered during control process design (not all systems allow negative values of control). Additionally, FVOPID control technique could be implemented in the systems that allow such dynamic control value changes. The potential application could in this case be, e.g., drone engine controllers, where both speed and direction of the propellers rotation could be dynamically changed.

Conclusions
In the paper, the simulation results of PID; fractional order PID; and fractional-, variable-order PID controllers were presented. Obtained results for the third-order plant with delay shows that for this family of objects/processes usage of FVOPID controller may give better results than the usage of PID/FOPID controllers tuned in a similar way (with Nelder-Mead optimisation). FVOPID control in this case seems to provide additional flexibility and may help to create new control strategies in the future. The main drawbacks of FVOPID controllers are high computational cost and the need to have an additional buffer to store previously returned control values which are used to calculate new controller response. The mentioned disadvantages could be the subject of further research in the future.

Conflicts of Interest:
The authors declare no conflict of interest.