#### Abstract

This paper proposes a MIMO Explicit Generalized Predictive Control (EGPC) for minimizing payload oscillation of a Gantry Crane System subject to input and output constraints. In order to control the crane system efficiently, the traditional GPC formulation, based on online Quadratic Programming (QP), is rewritten as a multiparametric quadratic programming problem (mp-QP). An explicit Piecewise Affine (PWA) control law is obtained and holds the same performance as online QP. To test effectiveness, the proposed method is compared with two GPC formulations: one that handle constraints (CGPC) and another that does not handle constraints (UGPC). Results show that both EGPC and CGPC have better performance, reducing the payload swing when compared to UGPC. Also both EGPC and CGPC are able to control the system without constraint violation. When comparing EGPC to CGPC, the first is able to calculate (during time step) the control action faster than the second. The simulations prove that the overall performance of EGPC is superior to the other used formulations.

#### 1. Introduction

For decades cranes have been playing an essential role as a transportation tool for objects in various areas [1]. Industry and academia have studied its application in construction, steelworks, shipyards, and offshore container crane [2], due to its operational flexibility and high payload capacity [3]. However, the crane trolley rapid movement causes an excessive payload oscillation, which is an obstacle that limits safe and fast transportation. This swing happens during or even at the end of trolley movement due to crane dynamics and external disturbances [4]. Hence, the main issue involving crane system rests in the ability to quickly move the trolley, in order to perform load-carrying tasks in a short period; at the same time undesirable fluctuations of the payload are decreased, using an efficient control system [5–7]. This is a challenge task, since crane control systems usually are underactuated [8].

Among crane applications, Gantry Crane Systems (GCS) are highlighted as the most preferred application in industries [9, 10]. This type of crane is mobile and is supported by a pair of rigid steel legs, being frequently used in factories, shipyards, and warehouses [11]. In GCS, the trolley mass, payload mass, and cable length directly influence payload swing and trolley displacement [12].

To control the GCS and other crane types, several strategies may be applied. Reference [11] brings a very deep and complete review about these techniques over the last two decades. They are categorized into Open Loop, Closed Loop, and Hybrid (combines Open and Closed Loop) strategies, as depicted through Figure 1. About open loop schemes, they are easy to implement and less costly, since there is no need for sway angle or cart position sensors. Among them, the input shaping was widely used by researchers, being present in several works [13–15]. Despite being an efficient feed-forward control, it has as main drawback the sensitive to external disturbance. Because of this, it may be combined with Closed Loop ones, as seen in [16, 17].

The other types of schemes used into crane operations are the feedback ones. This type of technique uses the desired output response to adjust their performance; hence they are less sensitive to disturbances. However, they are also slow, due to the input delay in the feedback loop.

Many control loop strategies were used to improve a GCS performance. Some examples are the state feedback controller (SFB) using the Ackerman formula, the PID controller [18], sliding mode control (SMC), adaptive controllers [19], Fuzzy Control System [20], and Linear Quadratic Regulator (LQR) [21]. However, the aforementioned controllers are not fully suitable, since most of them do not consider system constraints, and they do not have their parameters obtained from an optimization problem. In this context, the MPC is a reasonable choice, because the constraints are included into its formulation. Moreover, the gantry crane can be considered a Multiple Input Multiple Output (MIMO) process [10], which is easily dealt by MPC controllers. It should also be mentioned that high-performance controllers, based on solutions of an online optimization problem, like MPCs, are often computationally costly, mainly when applied to MIMO processes.

Therefore, this work proposes to obtain an explicit formulation for the Multivariable Generalized Predictive Control (GPC) based into a multiparametric programming and applying it to a Gantry Crane System (GCS) subject to input and output constraints. The used crane system model is based on [9, 22]. The proposed controller is compared with two conventional GPC control strategies: one that does not handle constraints but uses an analytical solution from cost function; and another one that uses Quadratic Programming (QP) to calculate the control action under constraints.

This paper proposal differs from other MPC crane applications because it is able to calculate the control actions (at runtime), more quickly than when obtained from online optimization. Also, a multiparametric GPC formulation is an under-explored topic in literature, with few examples [23, 24].

The remainder of this paper is organized as follows: in Section 2, a GCS concept is deepened, where we explain the used crane model and its linearized form. After that, we address the traditional GPC controller, with and without constraints, in Sections 3 and 4. In order to design the explicit controller, in Section 5, the algorithm to obtain the Piecewise Affine control law parameters is described. In sequence, a numerical example of a crane is used to highlight the proposed controller behavior and compare it to the other GPC strategies (Section 6). Finally, the conclusions of the paper are presented.

#### 2. Gantry Crane Dynamics

Crane dynamic model has been an important research area over the years for controller design [4, 13, 22, 25]. Because the crane controller needs to quickly move the trolley at the same time it decreases undesirable fluctuations of the payload, a model that describes crane dynamics is very important to understand how the relationship between the trolley movement and the payload swing works.

Among crane systems, the Gantry Crane System (GCS) is one of the most preferred in industries [9, 10]. In this application, the trolley mass, payload mass, and cable length influence payload swing and trolley displacement [12] as shown in Figure 2.

Figure 2 shows, along one axis, a GCS scheme where is the trolley horizontal displacement with mass and is the payload oscillation angle. The payload with mass (subject to gravity action ) is connected to the cart with a cable of length . While the cart is in motion, the trolley is subject to damping friction . Note that, in this system, the number of inputs is lower than the number of outputs which means this is an underactuated system.

The GCS can be represented by a nonlinear model as shown in (1) and (2):

The driving force that moves the trolley is provided by a DC motor, where the input voltage is limited. In this paper, the system used by [22] will be taken into consideration, where the DC motor is limited by volts and the crane horizontal track length for trolley movement is about m.

The gantry crane motion equation, considering the DC motor dynamic, is given bywhere , , , , , and are the input voltage, resistance, torque constant, electric constant, gear ratio, and pulley radius, respectively.

Equation (3) can be rewritten as follows:where

As depicted, the deflection angle can be considered sufficiently small during the crane system control. This allows the model linearization since near zero imply , and . Therefore, (2) and (4) become

These ODEs represent crane dynamic while the model is linearized at . Thus, a single input two outputs system can be obtained from (6) and (7), with the following transfer functions:

In order to apply a predictive controller to the Gantry Crane System, some assumptions shall be considered, as follows:(1)the payload is considered a point mass and works like a pendulum;(2)the mass and stiffness of the hoisting rope are neglected;(3)the effects of wind disturbances are not considered.

The information shown into Table 1 summarize all the parameter values used for the system based on [9, 22].

Since proposed GPC and the other used techniques are formulated in discrete-time, the system model also is discretized. In this case, the sample time is chosen as seconds. Note that MPC controllers may need a high computational time. Therefore a conservative choice of sample time, that do not compromise the performance, is made.

#### 3. Multivariable GPC Formulation

In this section, the Generalized Predictive Control (GPC) formulation is discussed. This controller is one of the most famous Model Predictive Control (MPC) methods. Its fundamental idea is to calculate a control sequence in a control horizon () in order to minimize a cost function defined over a prediction horizon (). Some MPC are also able to handle input, output, and states constraints. Despite being similar to other predictive controllers as seen in [26, 27], the GPC calculates an analytical solution for a minimization problem without constraints. Additionally, this controller is capable of dealing with MIMO systems, as well as controlling both unstable and nonminimum phase system [28].

Recently, MPC has still been relevant in different crane control approaches as [29–33]. Concerning GPC, [34, 35] used this strategy to control an overhead crane system, while [36] applied a GPC to control an offshore crane operation. Hence, in this section, the GPC described in [28] is adapted and rewritten to control crane systems.

Consider the CARIMA model for a multivariable process with inputs and outputs described as follows:where and are monic polynomial matrices and is a polynomial matrix. The backward shift operator, , is used to define . The variables , , and are the output vector, input vector, and noise vector signals, at time instant , respectively.

The following GPC algorithm consists of applying a control sequence capable of minimizing the following cost function:where is the j-th system optimal output prediction; is the prediction horizon while is the control horizon; is the future system set point; is the control action increment; finally, and are weighting matrices (positive definite) for tracking error and control increments, respectively.

Considering the white noise case, where is equal to identity matrices of order (), the optimal prediction for output vector can be generated as follows.

The Diophantine Equation is given aswhere , and are polynomial matrices whose orders are and (degree of ), respectively.

From this point, the argument will be omitted for readability when its use is implicit.

If (10) is multiplied by , then we have

Using (12), we obtainBecause degree is , all the noise terms are in future. Considering , the expected value of isConsidering the prediction of can be written as

Note that the last two right-hand side terms depend only on past values, which correspond to process free response if the control action is maintained constant. Additionally, the first term depends only on the future values and is known as the forced response.

Finally, (16) can be generalized as wherewith and and for .

The predictions can be expressed in a simplified form as

Therefore, (11) can be rewritten aswhere and are diagonal matrices with and as entries of main diagonal, respectively.

Equation (11) can assume a quadratic form, as follows: more precisely aswhere

If there are no constraints, the optimal solution is given by

#### 4. Constrained GPC Formulation

So far, given formulations do not consider any limit to the process. This approach is not so realistic since in practice all processes are susceptible to some constraint. In this sense, the crane system described in Section 2 shows boundaries in both DC motor voltage and cart path size (see Table 1). Hence, to keep the machine safe, physical limitations must be respected. To solve this problem, the GPC controller can use optimization algorithms in order to calculate control action that respect imposed constraints.

The control action increment calculated from (24) is an optimal solution for the optimization problem shown in (22). However, if this solution violates some constraints, the control effort would be directly saturated either by the control algorithm or by the actuator itself. Thus, this is not the best control action, since it does not guarantee the optimum solution for the cost function. This situation can be solved when constraints are taken into account.

According to [28], process constraints usually impose amplitude limits in the control actions (in crane case this will be the voltage applied to DC motor and its variation) and in the outputs (maximum crane trolley track length and payload oscillation). This can be described by

Considering a process with inputs and outputs, subject to a prediction horizon and a control horizon , (25) can be expressed by where is a matrix of dimension formed by identity matrices; is a matrix formed by identity matrices. Finally, is a lower triangular block matrix whose nonnull block entries are identity matrices. These constraints can be expressed in a simplified form as where

Therefore, the minimization of objective function can be formulated as a QP problem in the following form:There are several optimization techniques to solve this problem. In this case, the QP must be solved at each iteration of control algorithm. In other words, at each time step, the control action is calculated and sent to the process. When applied to a MIMO process, the amount of memory and CPU time required to solve the optimization problem may grow, according to chosen prediction and control horizons. To reduce this, the simplified form presented by (28) can be expressed considering a Constraint Horizon [37] for input constraints () and another for output constraints ().where the terms , , , and are truncated forms of , , , and , respectively.

The objective function is then rewritten as

By solving this programming problem, it is possible to keep the system under constraints ensuring optimal performance.

#### 5. Explicit GPC

In Sections 3 and 4, the GPC strategies with and without constraints were introduced. The main problem with the Unconstrained GPC (UGPC) is that it does not calculate the optimum control action taking constraints into account, which can lead to loss of performance or limits violation. On the other hand, the Constrained GPC (CGPC), despite regarding constraints, computes the optimal solution at each iteration of online control. This means that at each time step a large number of calculations must be performed, which imply in high computational cost.

One solution to reduce the online QP computational cost is to calculate an explicit control law using multiparametric programming (mp). Controller designs have been developed with mp, focusing on linear systems control subject to constraints [38]. The explicit/multiparametric MPC [39] is one of them, and it has been applied in several practical applications [40, 41], including crane systems [30]. Many of these are industrial applications where the available hardware and control software are limited to Advanced Process Control (APC) [42].

The multiparametric programming is capable of subdividing the parameter space into characteristic regions (CR), where the optimal value and the optimizer are expressed as explicit functions of the parameters [43]. This offline controller design approach produces an optimal solution, which is defined as a Piecewise Affine (PWA) control law over polyhedral regions. Therefore, this strategy can find an explicit control law for the Constrained GPC, similar to the Unconstrained GPC control law, as follows(1)The convex polyhedral set is partitioned into polyhedral regions: (2)The optimal solution is an PWA function in the form

The QP problem shown in (11) can be rewritten as a multiparametric quadratic programming problem (mp-QP). Thus, consider the following mp-QP formulation available in the MPT toolbox for MATLAB® [44]:The mp-QP parameters expressed in (34) are defined based on GPC formulation presented in Sections 3 and 4, as follows: withand and as the same of(23) and (30), respectively.

Once the programming problem is settled, it is necessary to design the Explicit GPC control and use it to control the crane system. To better exemplify the controller design step see Algorithm 1.

The presented algorithm summarizes the steps required to obtain an explicit law. This law is obtained by including the necessary variables and solving the problem. As output, it returns both the explicit law parameters ( and ) and as space parameter divided into characteristic regions .

After designing the Explicit GPC, the next part is to control the constrained system with the generated explicit law. Algorithm 2 details the required sequence to perform the online control.

As seen, the loop is described in three main steps. At first, it is necessary to calculate the parameters and . Note that at first iteration . These parameters determine the vector . In sequence, the obtained values of are used to find the associated polyhedral region. Finally, (33) is used to calculate the control action for the current time instant. The loop continues until the maximum number of iterations is reached or the execution of the algorithm is forced to finish.

#### 6. Numerical Example

In this section, the linearized model presented in Section 2 is controlled, assuming input and output constraints to illustrate the proposed approach discussed in previous sections. Three situations are explored. In the first one, the crane system is controlled by an Unconstrained GPC (UGPC), in the second, the system is controlled by a Constrained GPC (CGPC), using QP subject to constraints, and, in the third, the system is controlled by the Explicit GPC (EGPC). For comparison purposes, the same parameters are used in all situations.

The first step to control the crane system is to obtain the discretized model and, then, rewrite it in CARIMA form. By using the parameters shown in Table 1, it is possible to obtain

After system discretization, GPC is designed to obtain (23) and (24). In sequence, tuning parameters must be found in order to maximize the performance of the controller when applied to the GCS. In this case, the parameters of the Table 2 were chosen for all three study cases previously listed. It should be mentioned that the MPC parameters were empirically adjusted in the numerical simulations. It was also considered a maximum tolerance of rad for payload swing and the track length of m.

In all cases, the main objective is to achieve zero payload swing while putting the trolley at the desired position. During the simulation, the set point for the trolley position is m. The cable length, cart mass, and payload mass are those shown in Table 1.

The performance of the controllers is analyzed based on minimization of payload oscillation and transient and residual swing angle when the cart is in movement. The Mean Square Error (MSE) can be used as a performance index to both payload oscillation and trolley position, where a lower value of MSE represents a higher swing suppression and correct positioning for the cart (according to its set point), respectively.

Together with payload oscillation, maximum transient swing (MT) and residual swing (RS) are also analyzed in which it is desirable to minimize both MT and RS. It is important to define RS as a payload sway that remains after the trolley has reached the steady-state value.

Additionally, besides MSE, the control of cart position it is also evaluated considering step responses characteristics, as overshoot and settling time. Furthermore, in order to obtain information about the energy consumption during crane operation, the control effort and its variability are used to calculate the Goodhart index [45], which is determined as follows:where with being the number of samples. The parameters , , and will weight what is more relevant to the control performance: spent control energy, variability imposed to actuator, and tracking error, respectively. The chosen value for this parameters were , , and .

In order to summarize the comparison between controllers Table 3 shows the performances according to error measures, maximum transient swing, residual swing, Goodhart index, settling time, and overshoot.

##### 6.1. Unconstrained GPC Control

The first examined case is the application of the Unconstrained GPC to the Gantry Crane System expressed by (8). Figures 3 and 4 illustrate the payload swing and the trolley position.

As observed in Figure 4, the trolley position is controlled showing an overshoot of %. However, the UGPC is not able to keep the cart inside the track limits, since the position is higher than m. The same happens regarding payload swing. The rad tolerance is violated, with swing reaching a maximum value of rad during transient state. The residual swing is nearly zero. The control action and its increment are presented in Figures 5(a) and 5(b), respectively. The input constraints were only respected due to a saturation added in control routine.

**(a) Control effort**

**(b) Control increment**

##### 6.2. Constrained GPC Control

The Constrained GPC used the same parameters presented in Table 2. This type of control, at each iteration, solves an optimization problem and returns the optimal control action. The advantage of this technique is that even though the system changes, the control action calculation can be correctly performed, unless the problem is infeasible. The CGPC results are shown in Figures 6(a), 6(b), 7(a), and 7(b). As seen from Figures 6(a) and 6(b), the controller is able to keep both payload swing and trolley position inside their respective limits. The maximum swing happens during the transient reaching a value of rad and nearly no RS was left. Comparing with the previous case, the CGPC has a better performance, mainly during transient state. About the trolley position, the controller has a lower overshoot reaching . When one considers the control effort, Figures 7(a) and 7(b) show that CGPC keeps the input signal and input increment inside boundaries.

**(a) Payload oscillation**

**(b) Trolley displacement**

**(a) Control effort**

**(b) Control increment**

One limitation found in online optimization is the time spent to calculate the control action. The overall runtime simulation was higher than the other controllers, reaching approximately . If the computation takes longer than the sampling time, this may lead the system to instability. For this numerical examples, this is the case when is higher and .

The overall runtime spent during the simulations for all controllers is shown on Table 4.

##### 6.3. Explicit GPC Control

In this last numerical simulation, the results obtained by the proposed controller are presented. It is important to note that the UGPC showed problems to handle process constraints while the CGPC may have issues regarding the time spent at online execution. The EGPC was able to deal with both situations. Moreover, the tuning parameters of Table 2 are also used from this approach. With this tuning configuration, the mp-QP was solved after minutes, generating a total of polyhedral regions. The greater , , , and are, the greater will be the number of regions and, consequently, the memory storage and CPU time needed to solve mp-QP.

The results of proposed EGPC are shown in Figures 8, 9, 10(a), and 10(b). Table 3 shows that EGPC has the same performance as CGPC, respecting all imposed constraints. Additionally, note that the overall runtime spent during simulation to compute all control actions was s. This is around times faster than CGPC and times slower than UGPC.

**(a) Control effort**

**(b) Control increment**

The main drawback observed for EGPC was the design runtime (time spent during the resolution of the mp-QP problem). That took about min to finish. However, this procedure is an offline operation and it is one time only execution, whenever the parameters change. After the mp-QP solution is found, the time spent is lower than online solutions.

The three studied cases were also evaluated by other index as settling time MSE, Goodhart. The settling time is directly related to the DC motor applied voltage. Its amplitude regulates how fast the trolley can move to reach the set point. Since the maximum input voltage is limited to Volts, it is difficult to obtain a faster control. As shown in Table 3, the CGPC and EGPC controllers took a bit more than s to reach steady state, while UGPC was slower than the others, taking s. On the other hand, the UGPC achieve a lower value for position MSE. The main reason for this is his fast rising time, which reduces error quickly during transient state but provokes a higher overshoot, and, in this case, a constraint violation. The UGPC had also lower values for both Goodhart indexes. The control increment variability explains this behaviour, since UGPC has a lesser oscillatory signal. Regarding payload’s swing error, the CGPC and EGPC had the better performance, reducing almost times the oscillation when compared to the unconstrained case.

#### 7. Conclusion

In this work, a GPC based on transfer function model was adapted to calculate an explicit PWA controller that guarantees the same performance as the constrained controller but with low computational cost.

Results showed that the proposed controller was able to control the presented Gantry Crane System reducing payload swing, while positioning the trolley at desired position. When compared with the Unconstrained GPC, the EGPC was able to respect both input and output constraints which derive in better overall performance. When EGPC is compared to CGPC, Table 3 evaluation indexes show same results; however online EGPC calculation needs lower computational effort during simulation.

In comparison with Quadratic Programming, multiparametric Quadratic Programming storage need is higher. Also, online programming is more flexible to parameter changes. In other words, when using an identification algorithm the control action calculation that uses Quadratic Programming may be less expensive than the calculation by multiparametric programming, since the design step has higher computational cost.

Future work shall do a further investigation onto multiparametric formulation so the parameter becomes independent of the prediction and control horizon size. In the proposed formulation, whenever this tuning parameters increase, the vector also grows, enlarging the amount of necessary memory and time to solve the mp-QP. Moreover, future works also shall address the control law adaptation with a recursive multiparametric programming algorithm, which would improve the algorithm performance. Finally, the proposed GPC controller needs to be better investigated and applied in different scenarios and problems.

#### Data Availability

The data used to support the findings of this study are available from the corresponding author upon request.

#### Conflicts of Interest

The authors declare that they have no conflicts of interest.

#### Acknowledgments

The authors would like to mention the institutions that contributed to the development of this project: UFRN (Federal University of Rio Grande do Norte), DCA (Department of Computation and Automation), UnP (Potiguar University), IFRN (Federal Institute of Education, Science and Technology of Rio Grande do Norte), Capes (National Council for the Improvement of Higher Education), and LAUT (Laboratory of Automation in Petroleum).