Sie sind auf Seite 1von 19

Title: Closed Loop Angular Position Control System using PID Controller

Introduction

Proportional-integral derivative(PID) have been used in industrial control process because of


their simple structure and robust performance in a wide range of operating condition. The
design of such controller requires specification of three parameters which are proportional gain,
integral time constant and derivative time constant. So, for the tuning method, Ziegler-Nichols
tuning formula is used. However, this tuning formula may not be effective as it is because of it
is completely fail to tune the processes.

The parameters included in the PID controller, Kp, Ki and Kd can be manipulated to
produce response curves from a given value as will see later through out the experiment.

PID Controller Theory

Proportional Response

The proportional component depends only on the difference between the set point and the
process variable. This difference is referred to as the Error term. The proportional gain (Kc)
determines the ratio of output response to the error signal. For instance, if the error term has a
magnitude of 10, a proportional gain of 5 would produce a proportional response of 50. In
general, increasing the proportional gain will increase the speed of the control system response.
However, if the proportional gain is too large, the process variable will begin to oscillate. If Kc
is increased further, the oscillations will become larger and the system will become unstable
and may even oscillate out of control.
Figure 4: Block diagram of a basic PID control algorithm.

Integral Response

The integral component sums the error term over time. The result is that even a small error
term will cause the integral component to increase slowly. The integral response will
continually increase over time unless the error is zero, so the effect is to drive the Steady-State
error to zero. Steady-State error is the final difference between the process variable and set
point. A phenomenon called integral windup results when integral action saturates a controller
without the controller driving the error signal toward zero.

Derivative Response

The derivative component causes the output to decrease if the process variable is increasing
rapidly. The derivative response is proportional to the rate of change of the process variable.
Increasing the derivative time (Td) parameter will cause the control system to react more
strongly to changes in the error term and will increase the speed of the overall control system
response. Most practical control systems use very small derivative time (Td), because the
Derivative Response is highly sensitive to noise in the process variable signal. If the sensor
feedback signal is noisy or if the control loop rate is too slow, the derivative response can make
the control system unstable

Encoder

The encoder is basically the device used to track the position of the motor, this is important
because the pid tuning track the encoder data and feed the data back into the loop to the
controller system to adjust the error and produce the desired output. there are four types of
encoder which are

Type of encoder
1. Linear encoder
2. Rotary encoder
3. Position encoder
4. Optical encoder
1. linear encoder
are essentially transducers that measure the distance between two points, sometimes employing
a cable (longer distances) or a small rod (shorter distances). In these cases, a cable is run
between the encoder transducer and the moving object. As the object moves, the transducer
gathers data from the cable and produces an output signal that is a linear proportion of the
item’s movement. Once the distance has been determined, the linear encoder uses this
information to determine the ultimate position of the item. Linear encoders can either be
absolute or incremental.
2. Rotary encoder
Rotary Encoders provides feedback about the movement of a rotating device, typically its
angular position. A rotary encoder can be absolute or incremental.

3. Position encoder
Position Encoders produce electronic signals to indicate an absolute mechanical
position of an object, or an incremental change in the relationship between the encoder
and an object.

4. Optical Encoder
Optimcal encoders use pulses of light to represent data. These light waves are then analyzed
to reveal such variables as position, direction or velocity. In rotary applications, the optical
encoder responds to the rotating shaft, and receives movement related data. In liner
applications, the optical encoder is used to determine an object’s exact position in relation to
the encoder.

Objectives

1. To apply fundamental knowledge and principles of control system for the Angular
Position Control System under statically balance condition
2. To analyse the performance of the PID controller of the system
3. To understand and compare which closed loop response will affect the rise time(sec),
Maximum overshoot(%), settling time and steady state error
4. To choose the best possible PID controller parameters Kp, Ki, Kd on a closed loop
system
Methodology

The method that we have applied for tuning the PID system is by using one value at a
time(OVAT). This technique mostly uses the implementation of try and error in order to get
the best value. We use constant and variable value for kp, ki and kd to observe each constant
effect or characteristics on the result produce based on the graph plotted.

Procedures:

Before starting the experiment, the experiment required a connection to Arduino


board(controller) to program the board and setting up the motor. The code(refer to appendices)
are then uploaded to the board using the Arduino program on computer.

1. The block diagram of the position control using DC servomotor and schematic diagram
of system’s connection is verified and understood.
2. Then, the input and output of the closed loop control system is identified
3. The same approach was done by verifying the hardware configuration and interface of
the control system
4. The PID controller to the system is implemented and the performance of the PID
controller system is improved by manipulating the value of Ki, Kp and Kd by achieving
the best possible performance system based on:
a) Disturbance rejection
b) Steady state error
c) Peak time
d) Settling time
e) Percentage overshoot

Method

In order for us to have a more accurate results, we refered to the table below which shows the
characteristic or the effect of increasing the value of kp, ki and kd and the changes it made on
the graph such as the rise time, overshoot, settling time and steady state error. This helped us
in determining the value needed to change in order to have the best PID tuning.
Results, Analysis and Discussion

RESULT
The data collected were used to plot graph to show the effect of pid values on the position of
rotation vs the time.
Result 01:

Kp value: 0.1
Ki value: 0.1
Kd value: 0.1

Result 02:

Kp value: 0.9
Ki value: 0.1
Kd value: 0.2
Result 03:

Kp value: 0.15
Ki value: 0.15
Kd value: 0.15

Result 04:

Kp value: 0.3
Ki value: 0.02
Kd value: 0.3
ANALYSIS
There are a few things to consider when examining the data plotted on the graph. This is to
ensure that the best result is achieved and plotted.

The first result shows little or no overshoot happening in the system,however, the system took
a while to achieve the position at 384 due to low values of the three constants which are 0.1.
the graph also shows that there are steady state error presence in the graph at 5695 milliseconds
where it burst from position 377 to 384 at 5720 milliseconds.

The second result somehow shows the effect of increasing the value of kp significantly where
the graph shows overshoot error of 10% from the end value of 384 but towards the end, the
system shows a smoothor constant graph.

The third graph started to show minimal or no overshoot error in the system, there are also no
steady state error in the graph, the graph however shows a longer time to reach the settling
position of 384 due to no overshoot present in the system.

The fourth graph basically shows the best data with no overshoot, the rise time of the graph
also is shorter compared to the other graph. There are no steady state error and the settling time
starts at 130 milliseconds at position 2% of the intended position.
DISCUSSION

Result01

The three value of constant were first made into a constant value, 0.1 to observe the effect of
each changes on the graph later on. The graph shows that there are no overshoot occurs in the
process, this might be due to the low value of kp which causes little or no overshoot on the
graph. There is a steady state error occurring at the end of the graph when the graph shows a
significant rise from constant value of 377. The settling time of the system is recorded at 5706
miliseconds

Result 02

The second graph was the result of setting the constant at kp=0.9. ki=0.1 and kd=0.2 to
demonstrate the effect of increase value of kp on the overall system. The graph shows that there
are significant decrease in rise time of the system (shorter) due to the increased number of k p
value. The graph also shows the present of overshoot by 110% reach the peak of 422. The
settling time was recorded at 216 milliseconds which is due to the increase value of kd.

Result 03

To get a more smoothen results(graph), we decided to increase the value from the first results
to a constant value of 0.15, the graph shows some significant promises without the steady state
error present in the system. This is related to the increase in kp and ki which will decrease and
eliminate the steady state error in the system. Compared to the second result, the graph is
smoother and no overshoot is present due to massive decrease in kp value and the increase in ki
value would not effect much since the drop of kp value is much greater to show effect on
system. The settling time of the process took an overall time of 273 milliseconds.

Result 04

The last experiment used the values of 0.3, 0.02 and 0.3 for kp, ki and kd constant. The graph
shows a more stable and flat result the curvier result in result three, this is due to the increase
in value of kp and although the value of ki was also reduced to ensure that overshoot that
happens at 147 milliseconds are small or negligible because reducing ki will decrease overshoot
in the graph. The settling time of the graph is also reduced to 124 milliseconds than the previous
results.
CONCLUSION

Based on the result and data produced after the experiment, we can concludes that the
experiment is a success based on the steady state error, peak time, settling time and percentage
of overshoot. The final graph shows little of those parameters which means the experiment is
a success.
APPENDICES

Arduino code:

#define encoder0PinA 2
#define encoder0PinB 3
int E1 = 10; //M1 Speed Control
int M1 = 11; //M1 Direction Control

volatile long encoder0Pos = 0;


long newposition;
long oldposition = 0;
unsigned long newtime;
unsigned long oldtime = 0;
long vel;
long pos;
long U;
long speedX;
long setpoint = 384;
//PID parameter
const float Kp = 0.68;
const float Ki = 0.01;
const float Kd = 0.05;
float pTerm, iTerm, dTerm, integrated_error, last_error, error;
const float K = 1.9 * 1.12;
#define GUARD_GAIN 10.0
#define runEvery(t) for (static typeof(t)_lasttime;(typeof(t))((typeof(t))millis()

void setup()
{
pinMode(E1, OUTPUT);
pinMode(M1, OUTPUT);
pinMode(encoder0PinA, INPUT);
digitalWrite(encoder0PinA, HIGH); //turn on pullup resistor
pinMode(encoder0PinB, INPUT);
digitalWrite(encoder0PinB, HIGH); //turn on pullup resistor
attachInterrupt(0, doEncoder, RISING); //encoDER ON PIN 2
Serial.begin(9600);
}

void loop()
{
newposition = encoder0Pos;
newtime = millis();
pos = (newposition);
oldposition = newposition;
oldtime = newtime;
delay(0);
//PID equation
error = setpoint - pos;
pTerm = Kp * error;
integrated_error += error;
iTerm = Ki * constrain(integrated_error, -GUARD_GAIN, GUARD_GAIN);
dTerm = Kd * (error - last_error);
last_error = error;
U = K * (pTerm + iTerm + dTerm);
speedX = constrain(U, -100, 100);

if (error == 0)
{
STOP();
}
else
{
Motors();
}
Serial.print("\t position=");
Serial.print(pos);
Serial.print("\t error=");
Serial.print(error);
// Serial.print("\t PID=");
// Serial.print(U);
Serial.print("\t Time=");
Serial.println(newtime);
//Serial.print("t Speed=");
//Serial.println(speedX);
}
void doEncoder()
{
if (digitalRead(encoder0PinA) == digitalRead(encoder0PinB))
{
encoder0Pos++;
}
else
{
encoder0Pos--;
}
}
void STOP()
{
digitalWrite(E1, 0);
analogWrite(M1, 0);
}
void Motors()
{
if (speedX > 0)
{
//forward
digitalWrite(E1, 0);
analogWrite(M1, speedX);
}
else
{
//backward
speedX = map(speedX, 0, -100, 0, 100);
digitalWrite(E1, 1);
analogWrite(M1, speedX);
}
}
Raw data
Result 1:
Result 2:

Result 3:
Result 4:

Das könnte Ihnen auch gefallen