You are on page 1of 5

Feedback Control System Assignment

Dorin Teodorov (25.09.2022)

Introduction:
PID controllers are used for calculating the right values for a feedback control system. Those
kind of systems are used to constantly measure the error of a robot and adjust based on the
desired speed/position or other values. We are doing this by using simulations. For this
assignment we simulate a servo’s speed.

Calculation:
There are 3 ways of calculating the values. Trial and error, manual calculation(ziegler) and
auto calculation(tuning).

Using the excel sheet’s data and formulas provided, we can calculate the P, I and D for our
PID controller.

Trial and error:


Using the MatLab Simulink, the values are adjusted until a desired result is achieved. This is
tedious and takes time but it’s the simplest.

Manual calculation(Ziegler):
Average = 1.71 seconds
Actual speed average of 63/100 * A = 1.0773 seconds
Time for actual speed = 0,094 seconds
Theta = time when first motor moves = 0,042 seconds
Tau = time of actual speed – theta
Tau = 0,094 – 0,042 = 0,052
This value is used for the transfer function, which simulates the servo.
By adjusting the kP to obtain continuous and equal oscillations then we can use this to
manually calculate the P, I and D values.

Worse kP = 19.845 = kU
A full oscilation measurement = 1.373 seconds = Pu

Manual results:
P=11.907
I=17.344
D=2.043

Upon running with these simulations we can see that the manual approach is not reliable, it
doesn’t achieve desired results. (the scope graph showed the blue line doing undesired
movements)

Auto calculation(tuning):
The most reliable method is tuning method. By using the kU calculated before and pressing
on tune, Simulink will automatically calculate the best values for our desired result. These
values can also be adjusted with trial and error afterwards for an even better result.

Tuning results:
Designing and Running the simulation:
To design the simulation we use Simulink from MatLab. We can take our components from
the library, put them together, configure the transport delay by adding the theta to time
delay. We configure the transfer function by adding the Tau to denominator. The stop time
of the simulation should be 50 so we can notice the results. The diagram will look something
like this:

To run the simulation, we click on the scope graph and click run. Here we can notice the
results. The yellow line is the desired result and the blue line is the simulation of the actual
servo speed. After tuning and getting the best value and removing overshoot, the graph
looks something like this:
Implementing code:
Using the P, I, and D found values from before, we implement the code for the feedback
control system. We do this by using a loop that every 20ms checks the error. The desired
speed is given as parameter and then the function calculates the error by subtracting actual
speed from desired speed. Integral and derivative variables are calculated based on the
error.

Every 20ms the system calculates the control value from the formula:

And then the servo is controlled based on the result.

The code looks like this and can also be found in the zip file provided. It was built without
errors:
Reflection and conclusion:
I have learned to calculate and use PID controllers in order to create a working feedback
control system. I have learned to use simulations to get values and test desired results. This
knowledge will be further used to design a robot.

References:
FCS Assignment pdf from canvas:
https://git.fhict.nl/technology/t-sem3-cb/-/blob/master/es/Feedback_Control_Systems/
FCS_assignment.pdf

FCS presentation:
https://git.fhict.nl/technology/t-sem3-cb/-/blob/master/es/Feedback_Control_Systems/
closed_loop_systems.pptx

introduction to PID controllers from Fontys Git:


https://git.fhict.nl/technology/t-sem3-cb/-/blob/master/es/Feedback_Control_Systems/
introduction_to_pid_controllers_ed2.pdf

You might also like