Digital Controller For Inverted Pendulum

This example shows a Discrete Controller For Inverted Pendulum using

QFIRE CTR-101

as controller.

Introduction

The model from Continuous and Discrete Inverted Pendulum can be used for a control system example using

QFIRE CTR-101

as controller.

Due to the controller be a digital computer, it is necessary to use the discrete system to design the controller for the continuous system. This process can be described by the following steps:

  1. Define the poles in the continuous plane.
  2. Discretize the poles to the discrete plane
  3. Calculate controller gains.
Simulation
Defining poles

Following the first step, the poles in the continuous plane were defined aiming to control the inverted pendulum as a second order transfer function. Figure 1 shows the second order function chosen.

Figure 1 - Second order transfer function

The poles of this transfer function are:

poles1,2=1±1j3poles_{1,2} = -1\pm1j\sqrt{3}

The calculation of the controller gain uses the function place. This function requires the number of poles to be equal to the number of system states. Because of this, two new poles were included in the poles vector. These poles are

poles3=5poles_3=-5
and
poles4=5.1poles_4=-5.1
.

Discretizing poles

The next step is to discretize the poles using the equation

Z=eSTZ= e^{ST}
by Python as showed below:

This code returns:

Poles=[0.8913+0.1559j0.89130.15594j0.6065+0.j0.6005+0.j]Poles = \begin{bmatrix}0.8913+0.1559j &0.8913-0.15594j &0.6065+0.j& 0.6005+0.j \end{bmatrix}
Calculation of the gains

The final step of the design is to use the function place using these poles and the matrices

Φ\Phi
and
Γ\Gamma
from Continuous and Discrete Inverted Pendulum.

The gains returned are:

gains=[98.8712648811.870737475.469638535.22967684]gains = \begin{bmatrix}-98.87126488& -11.87073747 & -5.46963853 & -5.22967684\end{bmatrix}

These gains can be used for a disturbance controller. The diagram of this system is shown in Figure 2 and 3.

Figure 2 - Close loop control system with disturbance

Figure 3 - Discrete controller

Figure 4 - Gains in the discrete controller from Figure 3

The diagram of the disturbance in Figure 2 is shown in Figure 5.

Figure 5 - Disturbance diagram

Where the transfer function is:

TF=1s+1TF = \frac{1}{s+1}

Figure 6 shows the behavior of the system for this disturbance.

Figure 6 - States of the system

About MWF

MWF is a traditional Brazilian company that provides a wide range of electronic and mechatronic products for industry sectors such as automotive, agricultural machinery and aerospace.

Contact Us

Rua Doutor Siqueira, 139 / Sala 804 Campos dos Goytacazes - RJ, Brasil

contact@mwf-technologies.com

© 2018-2026 MWF. All rights reserved.