0% found this document useful (0 votes)
41 views

EEET2506-Control System-Stabilizing-control-Design-Report

This document describes the assembly and testing of a control system for stabilizing an inverted pendulum. It details the mechanical assembly of the pendulum apparatus, electrical connections, firmware installation, modeling and simulation of control algorithms, and experimental evaluation of PID control parameters.

Uploaded by

yen Le
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views

EEET2506-Control System-Stabilizing-control-Design-Report

This document describes the assembly and testing of a control system for stabilizing an inverted pendulum. It details the mechanical assembly of the pendulum apparatus, electrical connections, firmware installation, modeling and simulation of control algorithms, and experimental evaluation of PID control parameters.

Uploaded by

yen Le
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 42

RMIT Classification: Trusted

EEET2506 – Control Systems


STABILIZING CONTROL DESIGN REPORT

Lecturer: Dr. Thanh Tran


Team 03 Group members:
Huang Teng – s3927105
Tran Tien Dat – s3925223
Nguyen Xuan Nghi – s3938334
Dang Thien An – s3863958
Luu Nguyen Bao Tran – s392634
13 Jan 20234

School of Science, Engineering, and Technology


RMIT Classification: Trusted

Table of Contents
1. Mechanical and Electrical Assembly (10 pts) .............................................................................. 4

1.1. Mechanical Assembly (2 pts) ............................................................................................... 4

1.2. Electrical Assembly (3 pts) .................................................................................................. 6

1.3. Final System (5 pts) ............................................................................................................. 7

2. Controller and PC Communication and Interface (15 pts) ........................................................... 9

2.1. Controller Wire Connection ................................................................................................. 9

2.2. System Communication & PC ........................................................................................... 10

3. Firmware Installment and Running (15 pts) ............................................................................... 11

3.1. Firmware Installment and PC interface ............................................................................. 11

3.2. Running Test ...................................................................................................................... 14

4. Modeling, Control Design, and Simulation (30 pts)................................................................... 16

4.1. Introduction & Theory (3 pts) ............................................................................................ 16

4.2. Modeling and Control Design (15 pts). ............................................................................. 17

4.2.1. Dual PI controller model ...................................................................................................... 19

4.2.2. PI PD controller model ......................................................................................................... 21

4.3. Simulation Result (10 pts).................................................................................................. 23

4.4. Any issue or recommendation (2 pts) ................................................................................ 24

5. System Parameter Design and Experimental Study (30pts) ....................................................... 26

5.1. PID Design with Ziegler-Nichols tuning method. (10pts) ................................................. 26

5.2. Running test (5 pts) ............................................................................................................ 27

5.3. Experimental Results (15 pts) ............................................................................................ 28

5.3.1. Single PID Result ....................................................................................................... 28

5.3.2. Dual PID Result ......................................................................................................... 29

5.3.3. Comparison Between Two Method ........................................................................... 31

5.3.4. Comparison Between Dual PID with Default Mode ................................................. 31

Page 2 of 42
RMIT Classification: Trusted

6. Conclusion and Future works ..................................................................................................... 32

References .......................................................................................................................................... 33

6.1. Detail Tuning Log for TASK5 ........................................................................................... 42

Page 3 of 42
RMIT Classification: Trusted

1. Mechanical and Electrical Assembly (10 pts)

1.1. Mechanical Assembly (2 pts)


According to the UM2717 user manual of the STEVAL-EDUKIT01 kit, this kit will contain the
following components [1] according to Figure 1:
1. Motor shaft flange and M3x8 mm machine screws
2. Nema17 stepper motor and encoder L-bracket
3. Motor cables
4. 12 V power supply
5. Rotary encoder with M3x8 mm precision screw and washer
6. M3x20 mm machine screw and 10 mm stand-offs
7. X-NUCLEO-IHM01A1 motor driver expansion board
8. NUCLEO – F401RE development board
9. Zip ties (can be used to tie the motor and encoder cable together)
10. M3x16 mm machine screws
11. Adhesive rubber cushions and paper clip
12. M3 machine nuts

Figure 1 UM2717 Assembly Manual STEVAL-EDUKIT01 evaluation kit general components

The kit also contains the following acrylic pieces and pendulum rod according to Figure 2:
1. Acrylic pendulum tower sidewall 1
2. Acrylic pendulum tower sidewall 2

Page 4 of 42
RMIT Classification: Trusted

3. Acrylic pendulum tower sidewall 3


4. Acrylic pendulum tower sidewall 4
5. Acrylic pendulum base
6. Acrylic motor mount
7. Aluminum pendulum rod

Figure 2 UM2717 Assembly Manual STEVAL-EDUKIT01 evaluation kit acrylic and pendulum rod

Aside from the kit, the user needs the following tools listed in the UM2717 user manual to assemble
the system:
1. Medium sized Phillip screwdriver
2. Electrician scissors
3. Wire cutter
4. Soldering iron with solder
5. Small flathead screwdriver
6. Thread lock compound (optional)
After gathering the tools and components needed for the assembly process, The STEVAL-
EDUKIT01 will have the following assembly steps to follow:
Starting with the first step, the four M3x8 mm screws and M3 nuts will be situated into the motor
shaft flange and the encoder L-bracket. Afterwards, the rotary encoder will be attached with its cable
on the side, onto the flange with washer, spring tensioner and M3x8 mm precision screws. Prior to
the next steps, all film layers should be peeled off from all acrylic pieces. Then, place the acrylic
motor mount onto the stepper motor with four m3x8 mm machine screws which should not be

Page 5 of 42
RMIT Classification: Trusted

overtightened. Using the Acrylic pendulum base, attach the four adhesive rubber pads into the 5mm
holes to create a firm base grip on any surface placed.

Once the base is established, the tower of the system will be assembled on top. Using 4 pieces of the
acrylic pendulum tower sidewalls, attach 4 pieces together and secure the pieces using screws and
nuts. Within the pocket holes, eight screws will be attached into the pocket hole with retaining nuts.
The motor and encoder system can be attached by connecting the motor cable to the Nema17 stepper
motor. The motor mount will be situated by four M3x16 mm screws and nuts on top of the tower
where the M3x8 mm screw is used to secure the motor shaft to the motor flange. The whole tower
assembly should then be fixed onto the base using four M3x16 mm screws and nuts in which only
the encoder and motor cable should be placed away from the side of the board.

For the development board attachments, use four M3 nuts, M3x20 mm screws and plastic standoffs
to secure the NUCLEO-F401RE development board to the base of the system. It is also important to
file the side of the head of the screw to prevent any interference to the Arduino connector. Lastly,
connect the pendulum rod to the encoder shaft using a M3x8 mm screw which should not be
overtightened. To provide counterweight, a paper clip is placed onto the pendulum rod.

1.2. Electrical Assembly (3 pts)

Figure 3: Circuit diagram for the hardware, final step is to put the black driver on top of X-NUCLEO-IHM01A1 (all pins must be
connected)

For the electrical assembly, the X-NUCLEO-IHM01A1 will be connected on top of the NUCLEO-
F401RE board. The correct connection configuration of the X-NUCLEO-IHM01A1 will be in the

Page 6 of 42
RMIT Classification: Trusted

formation that the board’s green Molex connector must face opposite side to the USB connector and
ST-LINK of the NUCLEO-F401RE. Once the boards are mounted, the wiring for the rotary encoder
cable, stepper motor cables and the power supply cables will be explained according to the wiring
diagram shown according to Figure 3.
For the rotary encoder cables, there are 4 wires to connect: power wire (red), ground wire (black),
phase 1 wire (white) and phase 2 (green). The power wire will be connected to E1, which is the 5V
pin of the X-NUCLEO-IHM01A1. The ground wire will be connected to E2 or the GND pin. Then,
the phase 1 wire will be connected to E3 or DIR3 of the board. Finally, phase 2 wire will be connected
to E4 or DIR2 of the board.
For the stepper motor cables, there are 4 wires to attach to the X-NUCLEO-IHM01A1: phase A1 wire
(red), phase A2 (blue), phase B1 (yellow), phase B2 (orange). The phase A1 wire will be attached to
M1A or D4 gate (A negative) pin. M1B or D3 gate (A positive) will have phase A2 wire connected
to it. Phase B1 will be linked to M2A or D6 gate (B negative) pin. Finally, the phase B2 wire will be
connected to M2B or D5 gate (B positive) pin.

The power supply cables will consist of a positive 12 V wire (black with white stripe) and a ground
wire (black). The positive wire will be linked to PS+ or Vin pin of the board and the ground wire will
be linked to PS- or GND pin.

1.3. Final System (5 pts)


After finishing the mechanical, electrical assembly and installing the STSW-EDUKIT01 firmware,
The STEVAL-EDUKIT01 assembly is completed. From Figure 4, the final system has been
assembled based on the mechanical and electrical assembly shown in section 1.1 and 1.2.
According to the STEVAL-EDUKIT01 rotary inverted pendulum, the main purpose of this system is
to display a particular stabilizing behavior of the free-swinging pendulum [2]. This swinging
mechanism comprises of a stepper motor with feedback to sense the position and speed of the rotating
mechanism [3].

Page 7 of 42
RMIT Classification: Trusted

Figure 4: Final system mechanical and electrical assembly

From here, the rotational displacement will be transferred into electrical signals to be processed by
the rotary encoder [4]. This can then be used to determine the system’s pendulum angle. With the
encoder data obtained, the STSW-EDUKIT01 firmware can then process the pendulum’s motion to
counter the movement received. This counter movement can be established by controlled through the
stepper motor to keep the pendulum vertically upright [4]. Additionally, to provide the rotary inverted
pendulum with a more stabilized system PID (proportional, integral, and derivative) control will be
used to balance the pendulum while preventing potential oscillations [5]. Within the kit, it is also
possible to interact with MATLAB viewer to observe how the system response in real time in its
Default or Modified mood. The rotary inverted pendulum consists of many operations: start, stop,
and stopping by displacing the pendulum. In addition, there will be a guide to identify potential
problems to solve in case the operation of the pendulum could not be activated.

Page 8 of 42
RMIT Classification: Trusted

2. Controller and PC Communication and Interface (15 pts)

2.1. Controller Wire Connection

Figure 5: The wiring system of the kit.

Initially, all electronic devices need a power supply to work. Therefore, it needs a power supply
equipped with transformer to convert the 220V and the current intensity is 12A so that the system can
operate stably according to Figure 5. X-NUCLEO-IHM01A1 which is stepper motor driver expansion
board, it is used to control the step of the motor, it also can control the current and protect the system.
The power is supplied through a wiring consisting of an anode and a cathode connected through the
PS+ and PS- ports respectively as shown in the figure above. The stepper motor includes 2 coils so
that there are 2 phases needed to connect with the board. One coil needs 2 inputs to be connected to
the circuit board as shown in the figure. As is known, 1 coil controls the rotation of the rotary encoder
motor. According to the Figure 5, E1 is symbolized for 5V output, installed connected to the rotary
encoder to provide power and the ground port (GND) on the board is connected to the negative pole
of the encoder and denoted E2. E3 and E4 represent the connection between ports DIR 2 and DIR 3,
which are logic input. It allows receiving data from the rotary encoder and feedbacking the pendulum
angle to process the step of the motor and its movement direction to balance the pendulum.

Page 9 of 42
RMIT Classification: Trusted

2.2. System Communication & PC

Figure 6: Diagram communication between PC and system

First to establish the connection between PC and system, plug the cable into PC USB port and Nucleo
board port, open command prompt, enter the beginning code to complete the connection according
to Figure 6. Now that they are connected, command the pendulum through PC by telling it what
mode/feature users want, like 1 for default and g for modify mode. After inputting all parameters, the
pendulum will start swinging and transferring data like angle or noise to the computer to display in
the command window. After a while, user can press Ctrl+A+\ to stop and temporarily cut connection
between PC and pendulum, but the pendulum will still run. The connection will start again after user
opens and runs Real Time Workbench Matlab file; the pendulum will start to transfer data back to
the PC again so the workbench can plot graphs for users to assess performance. Once the user logs
data and exits the workbench, PC and pendulum will cut signal flow and stop communicating. From
here, to plot time response of the pendulum in Matlab using the logged data, we open another
MATLAB file, import the logged data and MATLAB will plot the response, the data is taken from a
saved file, this step doesn’t depend on the system anymore.

Page 10 of 42
RMIT Classification: Trusted

3. Firmware Installment and Running (15 pts)

3.1. Firmware Installment and PC interface


i) Manual For System Operation:
To start the pendulum operation, it is essential that the activating the system, the pendulum
shaft must not be overtightened, and the counterweight should be attached to the upper
pendulum shaft [2]. The encoder wire should be extended to provide 360 degrees rotation
for the rotary encoder. The system power is then deactivated to rotate the rotor as needed
since motor rotation can be adjustable before installing the power. Afterwards, the
pendulum rod will be placed in a downward position so that the system can calibrate the
default position of the encoder in its vertical orientation offset. The rotor should be twisted
until it positions itself as the starting position. Once the 12V motor controller supply is
inserted into a power outlet, the NUCLEO-F401RE will USB cable will be attached to a
laptop USB gate. A small oscillation will be signaled in the pendulum when the pendulum
is positioned downwards. As the pendulum starts rotating to its default position, manually
move the pendulum upwards vertically so it can maintain the default position as vertical
as possible. Finally, release the pendulum for the system’s motor to control the pendulum.

The pendulum operation can be stopped by switching off the power of the motor controller
supply and the USB cable charger. An alternative method can be clicking the black reset
button of the NUCLEO-F401RE board to reset the system while maintaining the power
and the pendulum system will resume after each run time interval. If the user chooses to
reset the system quickly, the user can apply a force to deviate the angle of the pendulum
from the vertical angle in which the system can detect and terminate its movement.

The operation will not start when the power is applied to the pendulum, however, the
pendulum’s motion has been encoded prior to the power installation which causes the
system to wait when the pendulum is still and in a downwards orientation. The system’s
operation will not start if the pendulum is not manually rotated after the system reset. Once
the system has been powered and operating, the following data will be provided from the
rotary inverted pendulum: time (seconds), cycle delay (milliseconds), pendulum angle
(degrees), rotor angle (degrees), current combined pendulum, rotor and auto slop

Page 11 of 42
RMIT Classification: Trusted

correction PID, rotor control output (degrees), and rotor position reference command
(degrees).

ii) Software installation guide and manual guide for Modified Parameters
After connecting the USB cable of the NUCLEO-F401RE, install the IRIP system
firmware that accompanies with the STEVAL-EDUKIT01. After the installation process,
open the firmware folder and enter the code for the usbmodem which is provided in the
system’s manual. In this case, the code entered will be 103 according to Figure 7 [6].

Figure 7: IRIP System starting instructions.

Figure 8: PID parameters IRIP system

After entering the code, the IRIP [6], the user can then enter the mode from the list’s options
such as 1 for Inverted Pendulum Control, 2 for Suspended Pendulum Control, and remaining
modes. In this case, the General Mode: Full State Feedback and PID Controller will be chosen
by entering the letter g into the serial interface according to Figure 8. Once the mode has been
chosen, the messages will appear to which the user can enter the PID parameters for either
Default Mode or Modified parameters. Since the inverted pendulum uses a dual PID system,
the number 0 will be entered into the terminal. The Figure 8 below shows the Modified
Parameters of the Dual PID in which the Pendulum’s PID Proportional Gain will be 1800.00

Page 12 of 42
RMIT Classification: Trusted

with Integral Gain of 12960.00 and Differential Gain of 62.50. These parameters will be
entered into the terminal by entering the values next to each message. The Rotor PID
Proportional Gain will be 260.00 with Integral Gain of 2.00 and Differential Gain of 22.00.
After entering all PID parameters, select 1 to disable the platform angle calibration and select
0 to enable inverted mode while the rest of the modes will be disabled by entering 0.

When the terminal finishes processing, the pendulum will start its swing up process from
initial angle 0. Before the pendulum finishes its starting procedure and in its swing up process,
exit the terminal and open the MATLAB interface file which operates on the STM32
processor. The STM32 processor allows the PC to connect with the STEVAL EDUKIT01
through the Edukit USB cable. When the STM32 processor finishes verifying the program
from the reference firmware file “STM32F401RE-Nucleo.bin”, The installation for the
MATLAB interface workbench can be downloaded from the STM32 CubeProgrammer
software. When opening the Real Time Control System Workbench Matlab and waiting until
the pendulum can balance upwards, run the Matlab code to which a real time viewer output
will show the rotor angle, pendulum angle, rotor tracking and rotor control graph according
to Figure 9, that will be generated from the physical system performance [6].

Figure 9: Matlab Live Workbench

When the system operation ends, the user can choose to view the data from the graphs
generated from MATLAB importing the data collected from the Real Time Control
System Workbench by opening the MATLAB Import Wizard according to Figure 10. This
allows data to be recorded and imported into the MATLAB workspace. Once the data has
been recorded, select Finish to save the data in a designated folder or folder created by the
user. Finally, the user can choose to open the file to which the save data has been generated
into a graph such as the pendulum angle vs Time graph according to Figure 11.

Page 13 of 42
RMIT Classification: Trusted

Figure 10: Import Wizard to generate recorded data from MATLAB Real Time Control System Workbench (Left)
Figure 11: Generated Graph from recorded data set (Right)

3.2. Running Test


a) Default mode Time response of the system default mode with estimate of settling time
and steady-state error (unit: %). Time response of the system default mode in the
presence of the disturbance and estimate of settling time and steady-state error (unit:
%).

Figure 12: General Graph of Time Response in Default Mode (Left)


Figure 13: Steady state error graph (Right)

Figure 13 is the overall recorded data. Within Figure 13, the graph shows the steady state error of
the system, which is 1.5 degree or 0.83% and in Figure 14 shows the settling time after disturbance
is given, it’s estimated to be 2.3 seconds.

Figure 14: Settling time after disturbance graph

Page 14 of 42
RMIT Classification: Trusted

b) Operation Mode with Modified Parameters with entered gains (𝑲𝒑 , 𝑲𝑰). Time response
of the system and estimation of settling time and steady-state error (unit: %).

Figure 15: General Graph with Modified Parameters

This section will be similar to section 5.3.2 in which the modified parameters had been entered with
Kp: 1800, Ki = 12960 and Kd = 62.5 for the pendulum. The Rotor parameters include: Kp = 260, Ki
= 2 and Kd = 22 which generates the graph according to Figure 15. The detailed graph for the
Modified parameters is shown in Figure 16 and Figure 17 where the steady state error is 0.56% and
settling time of 6.5 seconds.

Figure 16: Steady State error in Modified Mode Figure 17: Settling Time in Modified Mode

Page 15 of 42
RMIT Classification: Trusted

4. Modeling, Control Design, and Simulation (30 pts)

4.1. Introduction & Theory (3 pts)


In task 4, utilizing Routh Hurwitz criterion, Root Locus, and basic control theory to try to control
both the rotor and the pendulum using dual controllers, 1 for rotor and 1 for pendulum. First, assess
the performance of dual PI controller, then PD controller for rotor and PI for the pendulum. The
purpose is to find out PI PI or PD PI controller is best for the pendulum to achieve the design
specifications: 0 steady state error and settling time less than 6 seconds using simulation software,
mainly Control System Designer from Control System Toolbox of MATLAB to find and simulate
the performance of the pendulum. The range of Ki Kp Kd (gains) to make the system stable also must
be found, and a specific pair of gain to make the system pass all design requirements. In general, the
required outcome of this task are some Ki Kp parameters, simulation software and the simulation
result [7]. Before doing those, there are some theories to consider.

Conditions of Routh Hurwitz: Routh Hurwitz can only and only be applied if our characteristic
equation satisfies 2 conditions: No coefficient is missing, and every coefficient must be the same sign.
If it’s a fourth order equation, there must be 5 coefficients in that equation, corresponding to x 4, x3,
x2, x1, x0. Those 5 coefficients must have the same sign, either plus or minus, absolutely cannot be
mixed even with only 1 plus or minus. If one of these conditions are violated, Routh Hurwitz is invalid
as it is already known that system will have at least 1 open right hand side pole, which means unstable,
and the system needs changes. If all things go well, solving Routh Hurwitz will give us a whole range
of possible gains to ensure stability of the system, it is possible to choose any to experiment with, but
Routh Hurwitz is only for testing stability. For system requirements, Root Locus must be combined
as stable gains from Routh Hurwitz might not pass the requirements like overshoot, settling time, rise
time, etc. Pole zero cancellation, Root Locus: When plotting the Root Locus and do some
calculations, settling time, overshoot,.... will show up, then circle and narrow the region of gains that
give us the design specifications, then find the overlapped gains from both Routh Hurwitz and Root
Locus. Now stability and design requirements are satisfied. Plotting Root Locus, there are 10 total
rules, start by calculating the poles and zeros, put them all on an s-plane. If there are at least 1 pole
on the open right-hand side of the plane (not accounting the imaginary axis), our plant/system is
unstable, if there are 2 poles, all equal 0, which means double poles on the origin, then it is unstable.
If a pole overlaps a zero, it’s zero pole cancellation, and consider those 2 don’t exist anymore in the

Page 16 of 42
RMIT Classification: Trusted

Root Locus, in theory, this is handy as it can cancel unstable poles, making the system looks stable
on papers. In practice, zero pole cancellation does not work, your system will still be unstable unless
you change your system.

The basic concepts of control theory: Any system can be represented by transfer functions (G),
derived from Newton-Euler formulas (SISO) or Lagrange (MIMO), block diagrams and the PID
controller can be represented by the following formula. In most cases use the Laplace transform
𝐾𝑖
version of all the functions, this includes PID: 𝐾𝑝 + 𝑠
+ 𝐾𝑑 𝑠 .

Figure 18: Effects of gains on the system [8]

4.2. Modeling and Control Design (15 pts).


In the process of deriving transfer functions of the pendulum, ignore the air resistance, assume that
the angle changes when inverted is small enough to apply small angle limit, which means
cos(angle+∆ angle) =1 and sin(angle+ ∆ angle) =angle, assume the materials and components are
homogeneous and all accurate in term of dimensions. The rotor function was derived from
experimenting, and experimenting means there are many errors like random, blunder, systematic.
When extracting functions for the rotor and the pendulum, do not consider the effects of them on each
other, just extract each transfer function by making other inputs 0 and add them up [9]. The following
free body diagrams will help to understand how the pendulum and rotor acts:

Page 17 of 42
RMIT Classification: Trusted

Figure 19: Free body diagram of rotor looks from top down (left) and pendulum looks directly in front of us (right )

From above, distance from L/2 of inverted position to L/2 of other positions is the opposite of distance
from rotor in rotation to rotor when pendulum is inverted, this means consider 2 distances on the same
plane, then take small angle limit, then apply F=ma:

From the right free body diagram, only vertical component of mg, gravitational force is active, with
simple trigonometry the gravitational force acting on the pendulum is mgsin(theta). Use small angle
deviation and simplify to mg*theta. Here the friction force is due to motor motion of the system,
gamma multiply angular velocity. Now apply second law of Newton for rotational motion, since all
our distance, velocity and forces being considered are at L/2, and perpendicular to the pendulum,
multiply all forces to L/2 and add them all to get total tau needed for the system. According to the
second law, total torque also equals moment of inertia*angular acceleration of theta. The target,
pendulum, is why acceleration here is from theta. Also, friction is opposite to motion, so that will be
minus friction:

Irotor and Ipend are given, after rearranging and do Laplace transform, the transfer function of the
pendulum:

𝜔𝑟2 = 0.803 , 𝜔𝑔2 = 55.85 , 𝜔𝑔 / Q = 0.3735

The best dynamic equation of the rotor after experimenting is 1/s2. This is had by applying PID and
𝑎
system identification to the known second order transfer function: 𝑠2 +𝑏𝑠+𝑐 with a = 𝜔𝑛2 , b = 2𝜁𝜔𝑛 , c
= 𝜔𝑛2 . However, this model will be changed to get the best transfer function for rotor, based on
experimentation. Stated in the document “Introduction_to_Integrated_Rotary_Inverted
_Pendulum_v3.pdf” referenced in this report, they concluded that the best rotor transfer function
Grotor is just 1/s2. Both Gpend and Grotor are unstable as they either contain right hand side poles
or double poles at the origin. Since dual PI controller or PI and PD controller will be tested, the
block diagrams for both cases are quite the same:

Page 18 of 42
RMIT Classification: Trusted

Figure 20: Full block diagram of the system

Simplify the block diagram further by making the inner loop of rotor a whole function:

Figure 21: Simplified block diagram of the system

𝑠𝐾𝑝𝑝𝑒𝑛𝑑 + 𝐾𝑖𝑝𝑒𝑛𝑑 𝑠𝐾𝑝𝑟𝑜𝑡𝑜𝑟 + 𝐾𝑖𝑟𝑜𝑡𝑜𝑟


The formula for PI controller for pendulum: 𝑠
and rotor: 𝑠

The formula for PD controller of the rotor: 𝐾𝑝𝑟𝑜𝑡𝑜𝑟 + 𝑠𝐾𝑑𝑟𝑜𝑡𝑜𝑟

4.2.1. Dual PI controller model


Start with PI controller for rotor. Getting the final close loop transfer function is a simple task, then
𝑂𝑢𝑡𝑝𝑢𝑡 𝑝ℎ𝑖 𝐺𝑟𝑜𝑡𝑜𝑟 1 𝑠3 + 𝑠𝐾𝑝𝑟𝑜𝑡𝑜𝑟 +𝐾𝑖𝑟𝑜𝑡𝑜𝑟
have Trotor for PI controller = = 1+𝐺𝑟𝑜𝑡𝑜𝑟 . 𝐾𝑟𝑜𝑡𝑜𝑟=𝑠2 ÷ =
𝑊𝑎𝑛𝑡𝑒𝑑 𝑝ℎ𝑖 𝑠3
𝑠
𝑠3 + 𝑠𝐾𝑝𝑟𝑜𝑡𝑜𝑟 +𝐾𝑖𝑟𝑜𝑡𝑜𝑟
.

The characteristic equation is in direct violation of Routh Hurwitz criterion, this means after adding
controller our rotor is unstable no matter what gains Kp Ki. Now multiply Trotor with Gpend to check
for stability of the plant before applying controller, obtain characteristic equation a(s):

𝑠 5 + 0.3735𝑠 4 + 𝑠 3 (𝐾𝑝𝑟𝑜𝑡𝑜𝑟 − 55.85) + 𝑠 2 (0.3735𝐾𝑝𝑟𝑜𝑡𝑜𝑟 + 𝐾𝑖𝑟𝑜𝑡𝑜𝑟)


+𝑠(0.3735𝐾𝑖𝑟𝑜𝑡𝑜𝑟 − 55.85𝐾𝑝𝑟𝑜𝑡𝑜𝑟) − 55.85𝐾𝑖𝑟𝑜𝑡𝑜𝑟

Since Trotor is unstable with all gains value, it’s necessary to rely on the hardware and firmware not
allowing negative gains, so it is certain that Kirotor and Kprotor are all larger than 0. This is
conflicting with the characteristic equation of the plant above, coefficient of s0 is
–55.85Kirotor. This means to Routh Hurwitz this equation, Kirotor must be negative so the coefficient
can be positive and be eligible to check with Routh Hurwitz, this is a violation of Routh Hurwitz
already, and there will be positive poles from this uncontrolled plant no matter what. In other words,
there is no Kprotor and Kirotor to make the plant stable, unless overlapping the poles and zeros, which

Page 19 of 42
RMIT Classification: Trusted

will be talked later. To further test this, pick Kprotor and Kirotor, all larger than 0 to check for positive
poles. After testing, the pattern is quite clear, the plant poles have at least 2 positive poles, which
means unstable. Adding a PI controller to control this plant might be the solution, now with every
block considered, obtainthe close loop equation:

𝑊𝑎𝑛𝑡𝑒𝑑 𝜃 𝐾𝑝𝑒𝑛𝑑 . 𝑇𝑟𝑜𝑡𝑜𝑟 . 𝐺𝑝𝑒𝑛𝑑 (𝑠𝐾𝑝𝑝𝑒𝑛𝑑+𝐾𝑖𝑝𝑒𝑛𝑑) . 0.803𝑠2


= =
𝑂𝑢𝑡𝑝𝑢𝑡 𝜃 1+ 𝐾𝑝𝑒𝑛𝑑 . 𝑇𝑟𝑜𝑡𝑜𝑟 . 𝐺𝑝𝑒𝑛𝑑 𝑏(𝑠)

Where b(s) = 𝑠 5 + 0.3735𝑠 4 + 𝑠 3 (𝐾𝑝𝑟𝑜𝑡𝑜𝑟 − 55.85 + 0.803𝐾𝑝𝑝𝑒𝑛𝑑)


+𝑠 2 (0.374𝐾𝑝𝑟𝑜𝑡𝑜𝑟 + 𝐾𝑖𝑟𝑜𝑡𝑜𝑟 + 0.803𝐾𝑖𝑝𝑒𝑛𝑑) + 𝑠(0.374𝐾𝑖𝑟𝑜𝑡𝑜𝑟 − 55.85𝐾𝑝𝑟𝑜𝑡𝑜𝑟) − 55.85𝐾𝑖𝑟𝑜𝑡𝑜𝑟
The above function for theta and the entire system is for demonstration of how complex keeping gains
as variable is, it is also clear that whatever gains put for the rotor and pendulum, system is unstable
because the term –55.85Kirotor is still there and violate Routh hurwitz and the requirement gains
must be larger than 0 by the pendulum kit. Regardless, computer power is needd to check for stability
of the dual PI controller, for this, use the plant equation, which is Gpend * Trotor, then put this into
Control System Designer (MATLAB) to tune Kppend and Kipend. Then choose values of Kirotor
and Kprotor above 0, in this case, run the simulation with different gains for rotor. In reality, it’s free
to choose any rotor and pendulum gains as it will always be unstable. Substituting these values into
a(s), and input that into Control System Designer, then set and create the controller Kpend to PI in
the software, obtained the following results for Kirotor = Kprotor =50 with PI controller Kpend:

Figure 22: Root locus with Kirotor = Kprotor =50, Kipend = Kppend = 1

It is clear that the poles will not go into the left region by any means, the trajectory of the 2 complex
positive poles are upwards to infinity, they don’t lead into the left-hand region at all. There is also a
positive real pole, pulling this pole to the origin to get zero pole cancellation to see where the other
2 positive poles will go is necessary. The gain to do this is always very high but the step response is
still unstable. Since gain is high, the oscillation and overshoot are also high. If gains are above 1e12,

Page 20 of 42
RMIT Classification: Trusted

the design is not good as the pendulum only allows input that high, not higher. Changing Kirotor and
Kprotor to different values like Kirotor=100, Kprotor=50 and vice-versa, the pattern is clear, and are
all very similar to Kirotor = Kprotor = 50 case, the positive complex poles do not move into the
negative region at all, their trajectories are all travelling on the right hand side, one real positive pole
on the right of the zero at the origin, still requiring large gains to achieve zero pole cancellation. After
a while of tuning Ki Kp for dual PI controller design, the unstable pattern and Root Locus pattern
repeat themselves, it can be concluded that PI PI controller has poor performance, always lead to
unstable response and gains get unrealistic very fast. In the following section, PD controller for rotor
will be used, keeping PI for pendulum and assess the performance. Since PI PI has already failed the
stability test regardless of what gains input, there is no need to check for performance specification.
One thing to note is after experimenting, increasing gains to billions pulls the positive real pole to the
origin, but there are still 2 positive complex poles that will only stay outside of the right side no matter
what gains, which is unstable (figure 23). Adding a lead lag compensator then gains to the billions or
even trillions to cancel the real positive pole actually stabilized the system. These will be listed in the
appendix.

Figure 23: Root locus with Kirotor = Kprotor =50, Kipend = Kppend = 9.44e27, no lead or lag compensator

4.2.2. PI PD controller model


In this case, the PD controller will be applied for the rotor to find the range of Kp and Kp so that
they are stable, let’s call characteristic equation of this d(s).

Figure 24: Block diagram of rotor only (left) and simplified (right)

Page 21 of 42
RMIT Classification: Trusted

1 𝐺𝑟𝑜𝑡𝑜𝑟
𝐾𝑟𝑜𝑡𝑜𝑟 = 𝐾𝑝 + 𝑠𝐾𝑑 (PD controller) and 𝐺𝑟𝑜𝑡𝑜𝑟 = 𝑠2 ⇔ 𝐺𝑐𝑙 𝑟𝑜𝑡𝑜𝑟 = 1+𝐺𝑟𝑜𝑡𝑜𝑟 ⋅ 𝐾𝑟𝑜𝑡𝑜𝑟
1
𝑠2 1
= 𝑇𝑟𝑜𝑡𝑜𝑟 = 1 = 𝑠2 +𝐾 𝑠 +𝐾𝑝
=> d(s) = 𝑠 2 + 𝐾𝑑 𝑠 + 𝐾𝑝
1+ 2⋅(𝐾𝑝 +𝑠𝐾𝑑 ) 𝑑
𝑠

So now, applying Routh Hurwitz’s array to find the range of Kp Kd:


Table 1: Routh Hurwitz’s array table

𝑠2 1 𝐾𝑝
𝑠1 𝐾𝑑 0
𝑠0 0
𝐾𝑝 . 𝐾𝑑
𝑏1 = = 𝐾𝑝
𝐾𝑑
The system will be stable if it is satisfied the condition: 𝐾𝑑 > 0 𝑎𝑛𝑑 𝐾𝑝 > 0

Figure 25: Plotting from Simulink to prove the range above, with Kd = Kp = 1; Settling time = 9.5s; steady- state error ess = -0.0375%

Nevertheless, Routh Hurwitz method is impossible to look for the range for Kp Ki controller of
pendulum. If the value of Kp and Kd of rotor are kept as variables, or replaced with values >0, the
Kp and Ki of pendulum will be complicated equations to solve the gain of pendulum controller as
multivariable 4th order equations or higher are obtained. Therefore, in this case, the control system
designer tool is used to tool Kp and Ki of pendulum to find the range and even the specific value of
both gain to control the system stably.
After the range of Kp and Kd for rotor is found, now randomly pick the both value of Kp and Kd
equal 50. Tuning, trial and errors for all other values of Kp Kd >0 will always return 1 positive real
pole in the plant’s characteristic equation, so just pick 50. This also means instability:

Page 22 of 42
RMIT Classification: Trusted

Figure 26: Block Diagram with Trotor and Gpend

Substitute Kp and Kd of rotor =50 to the expression:

Solve the 4th order equation in the denominator to get the poles, there is 1 positive value equal 7.288.
Therefore, this close loop is unstable, it’s mean that this system needs a controller, in our case PI.

4.3. Simulation Result (10 pts)


Control system designer was used to set up PI controller like in PI PI model in 4.2.1.

Figure 27: System tuned to stability after adding PI controller for pendulum, moving positive poles to a far zero requires large gains

Now, the system is simulated in the control system designer tool which is added the PI controller to
find the desire of range for Ki Kp of pendulum control using Kp = Kd = 50 (rotor). To tune it to stable
response, that positive pole should be dragged to the zero = 0 at the origin. After that, all poles will
locate at open right half plane as the positive pole now overlaps on the zero, which means zero pole
cancellation. After the step response shows stability, the gains of pendulum control system are found
to be exceedingly big (Kp = Ki = 7.0124e09). Therefore, the gains were tuned continuously until the
minimum gains were found: The minimum gains for Ki and Kp are equal each other and equal 1.7e09

Page 23 of 42
RMIT Classification: Trusted

(with Kp Kd of rotor equal 50) and the range is from 1.7e09 and above to maintain stability and pass
design requirements. If the values of Kp Kd are changed then the range and values for stability of PI
for pendulum must also change, but with Kp = Kd the gains of PI will be lower than other cases.
Zooming into the step response, the overshoot is nearly 100%, the specific value is 99.997%. The
steady state error is around 0.002% and settling time is only 0.25 seconds, the full time from initial
value 0 to steady state value 1.0002 is a total of 0.4 seconds. This means stability is achieved and
passed the 2 design requirements: Settling time less than 6 seconds and 0 steady state error. Other
simulations involving lead and lag compensator were also carried out and using lead lag controller
brings better results in PI PI model than PD PI models. In general, using lead lag for PD PI model is
not good, in some cases bring even worse results than using P and I controller alone while some cases
the results are the same, there is no improvement. It is best, for PD PI model, just use PI PD controller
without compensators. These tests are listed in the appendix of this report.

4.4. Any issue or recommendation (2 pts)


Applying PI control system for both rotor and pendulum does not work, the whole system is unstable.
PI is applied for pendulum and PD for rotor works but results are unrealistic. Even though the result
of the design has passed the requirement, it is still theory, gains, overshoot are too high while settling
time is too low. High gains and overshoot issues can be solved by reducing gains: It might work if a
zero is added in the open left half plane instead of zero at 0, dragging the positive poles to it until it
reaches smaller gains. Another way to reduce gains with positive poles is just make those positive
poles smaller, dragging it to 0 will require less gain, or close to 0 enough to achieve zero pole
cancellation. However, that doesn’t work in real life and the real test run with the simulation gains
will be mentioned in this part later. Additionally, there are other methods which can be considered to
replace them with both PID for rotor and pendulum or both PD controllers for them. The dual PD
controller model has been tested and carried out with the gains of rotor which are Kp = Kd = 50. Then
the gains Kp and Kd of pendulum are recorded which is 3000 and the system meet the requirement,
achieved the stability, but again it is zero pole cancellation, and it is unstable in reality. PD PD model
result has 0 overshoot, oscillation but a very unrealistic fast settling time.

Page 24 of 42
RMIT Classification: Trusted

Figure 28: PD PD model result

Retrace to PD PI controller of pendulum case, when the gains are put in the pendulum, the real results
are completely different from simulation. The overshoot is much less than simulated, but settling time
was around 8 seconds and there seems to be no steady state error, visually. However, the system is
completely unstable. When the gains were input, the pendulum rose slowly, taking 9 seconds in total
from suspended to inverted position. It stayed inverted perfectly for only 4 or 5 seconds before
shaking violently, reflecting the massive gains that were made, then stopped working. This is an issue
requiring a different controller to fix or change gains, or considering other disturbance parameters
like noise or natural physical factors is needed.

Page 25 of 42
RMIT Classification: Trusted

5. System Parameter Design and Experimental Study (30pts)

5.1. PID Design with Ziegler-Nichols tuning method. (10pts)


Ziegler-Nichols tuning method.

The Ziegler-Nichols PID tuning technique involves two approaches. When the plant's response to a
unit-step input yields an S-shaped curve without any overshoot, the first method is applied. The
second technique looks for instances in which, for the given Kp, the output will oscillate
continuously. The recommended approach is to start with Ki and Kd set to zero and then gradually
increase Kp until the output response produces a continuous sine wave that is neither amplified nor
damped. The output sine wave will be damped at values below Kp critical and amplified at values
above Kp critical. Kp will be regarded as the critical value. Once Kp critical has been determined, the
oscillation period must be measured, and it is defined as the critical period (Tc). The PID gains for
the system will be obtained by applying the critical gain (Kcr) and critical period (Tc) into Table 2
[10], to find out the gain values with respect to the desired control type.

Table 2: Look-up table for PID-controller with the Ziegler-Nichols method.

PID controller gains for Inverted-Pendulum using the Ziegler-Nichols tuning method:

Step 1: Operating procedure will be included in section 5.2. We work on real system response to find
out the gains for the PID.

Step 2: Activating the inverted pendulum PID controller gains, keeping the rotor PID gains as default
mode. Entering the gain for the pendulum following Ziegler-Nichols tuning procedure.

Step 3: Finding out the critical value by setting the Ki and Kd to be zero and adjusting the critical
value (Kcr) until we can get the oscillation function for the pendulum response graph. After some
adjustment, we come up with the critical value Kcr= 300000 with critical value Tc = 0.27777s.

Step 4: Applying the critical value into Table 2 to get the gains for PID control type. Which Kp
=0.6Kcr =180000, Ki = 2Kp/Tc= 1296000, Kd= Kp*Tc/8= 6249.8.

Page 26 of 42
RMIT Classification: Trusted

Step 5: After simulations, based on the system’s responses, after some try and error. We finally
obtained the two set of PID gains including pendulum angle controller and pendulum, rotor angle
control.

Pendulum controller: basically, the gain of the rotor will be kept being as the default mode, so only
the pendulum angle to be zero under disturbance. After adjustments to meet the requirements for task,
the dual PID controllers will be selected as:

Rotor gain: Kp_rotor= 12, Ki_rotor= 0, Kd_rotor= 7.5.

Pendulum gain: Kp_pend= 1800, Ki_pend= 12960, Kd_pend=62.5.

Pendulum and Rotor Controllers: To keep both the pendulum and the rotor angle controller at zero
position in case of disturbance, modifications will be performed to both. So, the rotor and the
pendulum remain in the zero position after that dual PID alteration.

Rotor gain: Kp_rotor= 260, Ki_rotor= 2.0, Kd_rotor= 22.0.

Pendulum gain: Kp_pend= 1800, Ki_pend= 12960, Kd_pend= 62.5.

5.2. Running test (5 pts)


Final pendulum gain: kp = 1800, ki = 12960, kd = 62.5
Final rotor gain: kp = 260, ki = 2, kd = 22
Follow the steps introduced in section 3.2, the terminal in MacOS system can be opened. Reset the
system and enter “g” for dual PID input, then enter the above gain when prompted. When being
prompted about Platform Angle Calibration, it is crucial to disable it so the gain will be input and
used. After disabling all the additional settings and enable swing up, the system will automatically
start. Once the pendulum is balanced, terminal can be closed, and Matlab workbench can be opened
to collect real time data.

Page 27 of 42
RMIT Classification: Trusted

5.3. Experimental Results (15 pts)

5.3.1. Single PID Result

Figure 29: Graphs of the time response with Kp critical

With the exact same gain attained by using Zeigler Nichol’s method, the pendulum responds
aggressively, and the rotor angle control gains are too small to compensate the responds of the
pendulum controllers, which cause the system to fall quickly due to reaching max rotor angle. The
above picture shows the time respond of the system. Pendulum angle can balance and oscillate
between -2.5 and 2.5 degrees; however, the system is unable to maintain in the upright position so
data can’t be recorded in Matlab interface. Also, rotor control is noticeably higher than when the
system was still running in default mode (first 5 seconds). Therefore, the PID gains are scaled down
by 100.

Figure 30: Steady State time response in workbench Figure 31: General time response

After scaling down the gains, the oscillation greatly reduces, and the system can balance for a long
time because the rotor gain can provide more control over the pendulum gain so the rotor angle
doesn’t exceed the max value. Plotting the data in Matlab, the system is shown to have a maximum

Page 28 of 42
RMIT Classification: Trusted

0.5 degree or 0.33% steady state error. When disturbance is given, the settling time is approximately
25 seconds. However, the rotor angle damping is still not enough to compensate higher disturbance.

5.3.2. Dual PID Result

Figure 32: General Graph with Modified Parameters

With detailed tuning process listed in appendix, the gain is fined tuned to:
Pendulum:
Kp=1800, Ki=12960, Kd=62.5
Rotor:
Kp=260, Ki=2, Kd=22

Figure 33: Steady State of the final gain Figure 34: System’s response with disturbance

Page 29 of 42
RMIT Classification: Trusted

As shown in the above figure, the steady state error is oscillating between 1 and -1 which is
approximately 0.56%. When disturbance is given at time = 77sec, the system settles at time = 83.5
seconds, so the settling time is calculated to be around 6.5 seconds.

Figure 35: General response when rotor kd is 20

Based on the real system, there is a noticeable oscillation due to high rotor kd, to reduce or eliminate
this oscillation, kd can be reduced from 22 to 20, however settling time will be the tradeoff.

Figure 32: Steady State when kd is 20 Figure 33: Time response of the system to disturbance

The above is the effect of changing the rotor kd gain to 20. The steady state error oscillates between
-0.5 to 0.5, or 0.27%, which is half of the steady state error when rotor kd is 22. However, the settling
time increased. When disturbance is given at time = 66 sec, the pendulum settles at time = 87, which
is 21 seconds in total. The team decided to finalize with rotor kd = 22, although the steady state error
is a bit higher, the settling time is much shorter.

Page 30 of 42
RMIT Classification: Trusted

5.3.3. Comparison Between Two Method


Both single PID and dual PID can keep the pendulum in the upright position and balance it when
disturbance occur. However, pendulum disturbance is not the only factor that affect the balance of
the system. When rotor reach its max angle defined by the software, it will stop the pendulum and
end the program. Therefore, to prevent that issue, the rotor PID is required so it won’t drift when
trying to balance the pendulum.
With a tuned rotor PID gain, the rotor can try to make the system stabilized at the initial location
while trying to balance the pendulum. Not only it helps the system to run longer without the rotor
rotating, but it also helps reduce the settling time from 25 seconds to 6.5 seconds with the tradeoff of
0.2%.

5.3.4. Comparison Between Dual PID with Default Mode


There are noticeable differences between the gains that our team finalized and the default mode, and
both has its own pros and cons.

The default mode has a steady state error of 1.5 degrees or 0.83%, and a settling time of about 2.3
seconds when disturbance is given. At the same time, our gain has 1 degree, or 0.56% steady state
error with the settling time of 6.5 seconds. Based on the two data, default mode has much better
performance in terms of handling the disturbances, although our gain can also handle serval
disturbances, the settling time is still longer than the default mode.

Looking directly at the physical system, the default gain doesn’t have any noticeable oscillation
compared to the designed gain because the default rotor gain is much lower. With that lower rotor
gain, the default system’s rotor is drifting a lot while balancing the pendulum, so every disturbance
can cause the rotor to drift. If rotor settling time is a design constraint, our design gain will be superior,
however, if the design specification mostly focuses on settling time, the default gain will be a better
option.

Page 31 of 42
RMIT Classification: Trusted

6. Conclusion and Future works


For task 4, dual PI PI models did not bring satisfying simulation results for all gains or impossible
big gains to put in the pendulum, PD PI brought better results, achieved stability with smaller gains
than PD PI but still very big gains. It was stabilized by zero-cancellation on simulation, so when input
into real system the pendulum didn’t work. Lead-lag controller works better for PI PI than PD PI, and
lead lag compensator is not recommended for PD PI controller in this case. The results are for rotor:
Kp and Kd > 0 and for pendulum: Kp = Ki > 1.7e09. To truly make the system works in both
simulation and real life, it is recommended to use different controllers to eliminate the positive poles
not through zero pole cancellation or add more parameters and external factors to account.

For task 5, This task is a chance for our team to illustrate and gain deeper understanding about the
effects of the PID gains on the system response. With single PID control (pendulum control) obtained
from the Ziegler-Nichols tuning method. The pendulum will only be inverted for a short amount of
time, then it starts to shake and suspend. We have tried with multiple pendulum’s gain sets, but the
results seem to be the same. With dual PID control (pendulum and rotor control), after some
adjustment, we obtained the two sets of PID as shown above. The system operates better and satisfy
the requirement for the task. Comparing to the default mode, our steady state error is larger, but the
settling time is shorter. The application will perform even better with rotor gains modification
included, then we can control both pendulum and rotor angle. With that specification, we can utilize
it in further applications that requires the exact positions of pendulum as well as rotor. It is
recommended to develop a better control program so that the swing up and operation time can be
improved.

Page 32 of 42
RMIT Classification: Trusted

References
[1] STMicroelectronics. “Motor Control and Control Systems.” (accessed January 13, 2024).
[Online] ST life augmented. Available:
https://www.st.com/content/st_com/en/campaigns/educationalplatforms/motorcontrol-edu.html

[2] STMicroelectronics. “Firmware for STEVAL-EDUKIT01 evaluation kit for education on motor
control and control systems.” (accessed January 13, 2024). [Online] ST life augmented. Available:
https://www.st.com/en/embedded-software/stsw-edukit01.html?rt=db&id=DB4164

[3] MPS. “Stepper Motors Basics: Types, Uses, and Working Principles.” (accessed January 13,
2024). [Online] MPS. Available: https://www.monolithicpower.com/en/stepper-motors-basics-
types-
uses#:~:text=Due%20to%20their%20internal%20structure,motor%20control%20is%20pretty%20si
mple.

[4] Encoder Products Company. “What is an encoder?” (accessed January 13, 2024). [Online]
Encoder Products Company. Available: https://www.encoder.com/article-what-is-an-
encoder#:~:text=Encoders%20convert%20motion%20to%20an,count%2C%20speed%2C%20or%2
0direction.

[5] University of Michigan. “Inverted Pendulum: PID Controller Design.” (accessed January 13,
2024). [Online] Control Tutorials for MATLAB & SIMULINK. Available:
https://ctms.engin.umich.edu/CTMS/index.php?example=InvertedPendulum&section=ControlPID

[6] STMicroelectronics. “The Integrated Rotary Inverted Pendulum.” (accessed January 13, 2024).
[Online] ST life augmented. Available:
https://www.st.com/content/dam/AME/2019/Educational%20Curriculums/motor-
control/Introduction_to_Integrated_Rotary_Inverted_Pendulum_v2.pdf

[7] RMIT University. “Mini-Project: Stabilizing Control Design”. (accessed January 13, 2024).
[Online] rmit.instructure.com. Available:
https://rmit.instructure.com/courses/132214/assignments/885731

Page 33 of 42
RMIT Classification: Trusted

[8] University of Michigan. “Introduction: PID Controller Design”. (accessed January 13, 2024).
[Online] Control Tutorials for MATLAB & SIMULINK. Available:
https://ctms.engin.umich.edu/CTMS/index.php?example=Introduction&section=ControlPID

[9] RMIT University. “Introduction_to_Integrated_Rotary_Inverted_Pendulum_v3.pdf”. (accessed


January 13, 2024). [Online] rmit.instructure.com. Available:
https://rmit.instructure.com/courses/132214/files/35202391?wrap=1

[10] ResearchGate. “In: Glow Discharges and and Tokamaks ISBN: 978-1-61668-352-8 Editor:
Sean A. Murphy.” (accessed January 13, 2024). [Online] ResearchGate. Available:
https://www.researchgate.net/publication/259962135_In_Glow_Discharges_and_Tokamaks_ISBN_
978-1-61668-352-8_Editor_Sean_A_Murphy

Page 34 of 42
RMIT Classification: Trusted

Appendix:

Figure 34: PI PI controller with lag compensator, unstable

Page 35 of 42
RMIT Classification: Trusted

Figure 35: PI PI controller with lead-lag compensator, the pole of lead must be increased to 100 to be stable, below it will be marginally stable

Page 36 of 42
RMIT Classification: Trusted

Figure 36: PI PI controller with lead compensator, the higher the real pole of lead, the faster the response

Figure 37: PI for rotor, and a single lead compensator for pendulum

Page 37 of 42
RMIT Classification: Trusted

Figure 38: PI for rotor, and a single lag compensator for pendulum

Figure 39: PI for rotor, lead-lag compensator for pendulum, the settling time is above 30 seconds

Page 38 of 42
RMIT Classification: Trusted

Figure 40: PD for rotor, single lead compensator for pendulum, can only be marginally stable and unstable

Figure 41: PD for rotor, lag compensator for pendulum, can only be marginally stable and unstable, behaves almost exactly like the case of
PD rotor and single lead compensator above

Page 39 of 42
RMIT Classification: Trusted

Figure 42: PD for rotor, lead-lag compensator as controller, has a very poor performance like single lead or single lag controller, can only be
marginally stable or unstable

Figure 43: PD for rotor, PI and lead-lag compensator as pendulum controller, performance is like without lead-lag compensator, but the gains
P I for pendulum are even bigger to achieve stability

Page 40 of 42
RMIT Classification: Trusted

Figure 44: PD for rotor, PI and lead compensator as pendulum controller, performance isn’t an improvement from any above

Figure 45: PD for rotor, PI and lag compensator as pendulum controller, performance is similar to PI and lead-lag controller, nothing new

Page 41 of 42
RMIT Classification: Trusted

6.1. Detail Tuning Log for TASK 5


Below are the tuning for rotor, while the PID for pendulum is unchanged:

P 100 , I 0, D 10 - the settling time is long so we will increase kd


P 100, I 0, D 20 - the settling time decrease, better damping, but the steady state error is high so we
will add ki
P 100, I 2, D 20 - steady state error still exists so we will add some kp to see the effect
P 150, I 2, D 20 - 2.5-degree steady state error, so we increase kp again
P 200, I 2, D 20 - improve steady state error by about 1, so we will increase ki

P 200, I 10, D 20 - improve a bit but not noticeable so we try to increase kp again
P 260, I 10, D 20 - the steady state error is difficult to remove if we want the settling time to be
short, so we will compensate the steady state error for short settling time by increase kd while
changing ki back to 2.
P 260, I 2, D 20 - the settling time improve a bit but still not acceptable so kd will be increase
P260, I 2, D 25 - it is shaking more aggressively at steady state so we will decrease it to 22
P260, I 2, D 22 - it is shaking less, but the settling time increase, we will keep this one because the
shaking seems less aggressive.

Page 42 of 42

You might also like