Explicit GPC Control Applied to an Approximated Linearized Crane System

This paper proposes aMIMOExplicit Generalized Predictive Control (EGPC) forminimizing payload oscillation of aGantryCrane 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 bothEGPCandCGPChave better performance, reducing the payload swingwhen 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.


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][6][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][14][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.

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  2 and  is the payload oscillation angle.The payload with mass  1 (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 ±5 volts and the crane horizontal track length for trolley movement is about 0.8m.
where , ,   ,   , , and   are the input voltage, resistance, torque constant, electric constant, gear ratio, and pulley radius, respectively.Equation (3) can be rewritten as follows: where and As depicted, the deflection angle can be considered sufficiently small during the crane system control.This allows the model linearization since  near zero imply sin  ≈ , cos  ≈ 1 and θ = 0. Therefore, (2) and (4) become θ + ẍ +  = 0 These ODEs represent crane dynamic while the model is linearized at  = 0. 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 0.1 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.

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][30][31][32][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 A( −1 ) and C( −1 ) are  ×  monic polynomial matrices and B( −1 ) is a  ×  polynomial matrix.The backward shift operator,  −1 , is used to define Δ = 1 −  −1 .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 ( −1 ) is equal to identity matrices of order  ×  (( −1 ) = I), the optimal prediction for output vector can be generated as follows.
If (10) is multiplied by ΔE    , then we have Using (12), we obtain Because E  degree is  − 1, all the noise terms are in future.
Considering E[()] = 0, the expected value of ( + ) is Considering E  B = G  +  − G  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.

Δ𝑢 (𝑘 + 𝑁
with The predictions can be expressed in a simplified form as Therefore, (11) can be rewritten as where  and  are diagonal matrices with  and  as entries of main diagonal, respectively.Equation ( 11) can assume a quadratic form, as follows: more precisely as where If there are no constraints, the optimal solution is given by

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 1  is a matrix of dimension (  × ) formed by   ( × ) identity matrices; 1  is a (  × ) matrix formed by   ( × ) identity matrices.Finally, T  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 1  ,   , 1  , 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.

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  * (()) :  → R  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 MATLAB5 [44]: The mp-QP parameters expressed in (34) are defined based on GPC formulation presented in Sections 3 and 4, as follows: with and H and R N c c 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 f   and w − f.Note that at first iteration (−1) = 0.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.

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 ±0.0029rad for payload swing and the track length of 0.8m.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 0.77m.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  1 ,  2 , and  3 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  1 = 0.2,  2 = 0.3, and  3 = 0.5.
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.
. .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 5.89%.However, the UGPC is not able to keep the cart inside the track limits, since the position is higher than 0.8m.The same happens regarding payload  swing.The ±0.0029rad tolerance is violated, with swing reaching a maximum value of 0.0046rad 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.
. .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 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 2.3360.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.
. .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 34 minutes, generating a total of 57 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 1.0274s.This is around 2.3594 times faster than CGPC and 34.0241 times slower than UGPC.
The main drawback observed for EGPC was the design runtime (time spent during the resolution of the mp-QP problem).That took about 36min 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 ±5 Volts, it is difficult to obtain a faster control.As shown in Table 3, the CGPC and EGPC controllers took a bit more than 14s to reach steady state, while UGPC was slower than the others, taking 18s.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 1.47 times the oscillation when compared to the unconstrained case.

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.
), 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 0.0025rad 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 3.8961%.When one considers the control effort, Figures 7(a) and 7(b) show that CGPC keeps the input signal and input increment inside boundaries.

Figure 7 :
Figure 7: Control action behaviour for Constrained GPC.

Figure 10 :
Figure 10: Control action behaviour for Explicit GPC.

Table 4 :
Design time and overall time simulation.