Keywords

1 Introduction

Under-actuated system is an important topic for research since many decades. It has many applications. The under-actuated systems are less bulky, less weight, and cost-effective, but system complexity is drastically increased because in under-actuated systems there are actuators less than degrees of freedom which make the system complex and hard to control. Under-actuated systems have a long list of applications including autobots, marine-robots, locomotives, robotics, and overhead crane.

In recent years, researchers have suggested many techniques for the control of under-actuated system. References [1,2,3,4,5,6] shows the example of control of under-actuated system. Paper [7] describes the dynamics of a class of under-actuated systems. PID controllers have been used in [8, 9] to control. Paper [10] shows how to control overhead crane using generalized predictive control (GPC). Similarly, there are many more examples which show under-actuated system is the benchmark problem on which the research is carried from a long time [11].

This paper has considered a DIPOAC system. It is a system with three DOF and one input and is highly nonlinear. There are many examples where control of pendulum on a cart (POAC), and DIPOAC are reported in [10, 12]. Paper [1,2,3] shows the control of DIPOAC with different strategies, and [13,14,15] shows the control of POAC system. The DIPOAC comprises of a double-inverted pendulum attached on a cart and stable vertically upward. This paper uses model predictive control (MPC) strategy for controlling the considered system, and the results are compared with PID controller.

MPC is a technique that predicts the future output of a plant using the plant model. It uses iteration to predict next stage of the output. These are done at subsequent control intervals. It was primarily implemented on refineries and power plants [16]. But over the years, the applications under MPC have increased and the area of applications has widened. There are many areas where MPC has been applied successfully. Survey of industrial MPC control is shown in [17]. Stability and robustness of an MPC are very important factors [18, 19]. Smoczek et al. [20] shows the trajectory tracking using MPC. References [21, 22] are some books which describe the use and application of MPC.

The outline of the paper follows here—Sect. 2 gives the modeling of DIPOAC and its linearization. Section 3 will discuss the application of MPC on the considered system and its control followed by comparative analysis with PID controller. Simulation results are obtained in Sect. 4, and in Sect. 5 conclusion is drawn.

2 Modeling

2.1 Modeling of POAC

Figure 1 shows the picture of DIPOAC system. Assumptions are—massless rod, force applied on mass M, and the pendulum’s mass as m1 and m2, respectively. The external force u(t) is applied in x-direction. Here, \( \theta_{1} \left( t \right) \) and \( \theta_{2} \left( t \right) \) are the pendulum angles, x(t) represents position.

Fig. 1
figure 1

Double-inverted pendulum on a cart (DIPOAC)

Modeling of DIPOAC uses Euler–Lagrangian model. Lagrangian is represented by.

$$ {\mathcal{L}} = T - V $$
(1)

here,

V:

potential energy (PE),

T:

kinetic energy (KE).

After calculating KE and PE, and after some mathematical manipulations, the Lagrangian will be,

$$ \begin{aligned} {\mathcal{L}} = & \frac{1}{2}\left[ {M + m_{1} + m_{2} } \right]\dot{x}^{2} + \frac{1}{2}\left[ {m_{1} + m_{2} } \right]l_{1}^{2} \dot{\theta }_{1}^{2} + \frac{1}{2}m_{2} l_{2}^{2} \dot{\theta }_{2}^{2} \\ & + \left[ {m_{1} + m_{2} } \right]\dot{x}\dot{\theta }_{1} l_{1} \cos \theta_{1} + m_{2} \dot{x}\dot{\theta }_{2} l_{2} \cos \theta_{2} \\ & + l_{1} l_{2} \dot{\theta }_{1} \dot{\theta }_{2} \cos \left[ {\theta_{1} - \theta_{2} } \right] - \left[ {m_{1} gl_{1} \cos \theta_{1} + m_{2} gl_{1} \cos \theta_{1} + m_{2} gl_{2} \cos \theta_{2} } \right] \\ \end{aligned} $$
(2)

Putting the value of Eq. (2) and the parameter values, \( M = 0.5\;{\text{kg}} \), \( m_{1} = 0.25\;{\text{kg}} \), \( m_{2} = 0.25\;{\text{kg}} \), \( l_{1} = 1\;{\text{m}} \), \( l_{2} = 1\;{\text{m}} \), \( g = 10\left( {\frac{\text{m}}{{{\text{s}}^{2} }}} \right) \) in Euler–Lagrange formulation and casting them to nonlinear state-space and further linearizing.

We get,

$$ \frac{\text{d}}{{\text{d}t}}\left( {\delta \underline{z} } \right) = \left( {\begin{array}{*{20}c} 0 & 1 & 0 & 0 & 0 & 0 \\ 0 & 0 & { - 0.073} & 0 & {0.120} & 0 \\ 0 & 0 & 0 & 1 & 0 & 0 \\ 0 & 0 & { - 1.420} & 0 & { - 2.87} & 0 \\ 0 & 0 & 0 & 0 & 0 & 1 \\ 0 & 0 & {5.75} & 0 & {1.382} & 0 \\ \end{array} } \right)\delta \underline{z} + \left( {\begin{array}{*{20}c} 0 \\ {0.102} \\ 0 \\ { - 0.015} \\ 0 \\ { - 0.015} \\ \end{array} } \right) $$
(3)

And output state-space matrix as,

$$ y = \left( {\begin{array}{*{20}c} 1 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 1 & 0 \\ \end{array} } \right)\left( {\begin{array}{*{20}c} x \\ {\dot{x}} \\ {\theta_{1} } \\ {\dot{\theta }_{1} } \\ {\theta_{2} } \\ {\dot{\theta }_{2} } \\ \end{array} } \right) $$
(4)

3 MPC Design and Comparison with IOPID

Figure 2 shows the block diagram of traditional PID controller for DIPOAC and is expressed as

Fig. 2
figure 2

Block diagram of DIPOAC system

$$ k_{pid} = k_{p} + \frac{{k_{i} }}{s} + k_{d} s $$
(5)

The obtained values of PID parameters using PID tuner as follows:

Tables 1, 2, and 3 show the optimum values of PID controller response for position and both the angles. Figure 3 shows the basic MPC structure overview and is designed in model predictive control toolbox [23]. From the structure overview of MPC toolbox for DIPOAC, there are three outputs and one input. Outputs are in the form of cart position, pendulum angle \( \theta_{1} \), and angle \( \theta_{2} \).

Table 1 To control pendulum’s angle \( \uptheta_{1} \)
Table 2 To control pendulum’s angle \( \uptheta_{2} \)
Table 3 To control cart’s position
Fig. 3
figure 3

MPC structure overview

MPC has three parameters which are to be manipulated to get an optimum value of output, i.e., control interval, control horizon, and prediction horizon. This paper is taking control interval as 0.1 s, prediction horizon to be 50, and control horizon to be 3 to obtain better output. The state-space equations are used further to design MPC.

4 Simulations and Results

The simulation results corresponding to Eqs. 3 and 4 are obtained using MATLAB to stable the angle and the position of the DIPOAC system at desired position and angles in minimum time with little overshoot.

We can conclude from simulation result shown in Fig. 4 that the cart position is settled at 2 m and both the angles are settled at 0°.

Fig. 4
figure 4

MPC response with at cart position at 2 m and both the angle \( \theta_{1} \) and the angle \( \theta_{2} \) at 0°

Figure 5 shows the output response of a PID controller for DIPOAC system; from this, we can conclude that the cart position is nearly settled at 2 m with some steady-state error, and angles are settled at 0° with oscillations (Table 4).

Fig. 5
figure 5

PID response with at cart position at 2 m and both the angle \( \theta_{1} \) and the angle \( \theta_{2} \) at 0°

Table 4 Comparison table

As we compare the performance of PID and MPC of DIPOAC system, from Figs. 4 and 5, we see that the performance of MPC is much better than that of PID. There is a steady-state error in case of a PID controller, whereas in MPC no such error exists. The oscillations are more in PID as compared to MPC. PID controller takes almost 60 s to stabilize the system, whereas MPC does the work in around 15 s. From simulation results, we observe that MPC performs good if we compare it to classical PID. From the above table, as compared to PID, MPC performs well when it comes to oscillations, settling time, and overshoot.

5 Conclusion

This paper shows that MPC controller can also be used for the stabilization of DIPOAC system. If we compare with traditional PID controllers, the MPC has better response. MPC for under-actuated system settles fast with little oscillations, whereas the settling time for PID controllers of DIPOAC is large and is with oscillations and steady-state error.