Project - Speed Control of a Direct Current (DC) motor
Aim: To use the Proportional, Integral, and Derivative (PID) control to design, develop and test a controller to maintain a desired speed for the motor
DC motors parameters of the system:

Design parameters:
This has been varied to tune the Kp, Kd & Ki values to obtain the desired characterstics of settling time<2s, Overshoot< 1.05, Steady state value>= 0.9901(based on steady state error less than 1%)

Simulink model of DC motor without controller
The simulink model of DC motor is as attached below. The armature current is obtained from supply voltage via the TF 1/(sLa+Ra). The armature current when multipled with Kt produces torque. The speed is obtained from torque via the TF /(sJ+B). The feedback of this speed is sent back via back emf constant Kb. The response of different parameters is as attached.

The response of different parameters of DC motor without controller:

Simulink model of DC motor with controller:
The Simulink model of DC motor with controller is attached below. The Kp(Proportional), Kd(Derivative) & Ki(Integral) controller are as shown in the attachment. Kp & Kd are tuned by changing the fn(frequency of the system) & zeta( damping coeffient) of the system. Pole placement technique further helps in obtaining the exact Kp & Kd values. Hit & trial is being used for getting Ki values. As in the attached responses, the controller parameters are changed to obtain the desired conditions. The data points on actual speed response is also shown.

With Ki = 30 Kp & Kd as per zeta = 0.5 & fn = 1Hz
Overshoot = 1.17, ts = 4.32s for steady steady value of >=0.99
Kp = 38.3092, Kd = -2.86, Ki = 30

With Ki = 30, Kp & Kd as per zeta = 0.7 & fn = 1Hz
Overshoot = 0.993, ts = 3.17s for steady steady value of >=0.99
Kp = 66.115, Kd = 0.2832, Ki = 40

With Ki = 50, Kp & Kd as per zeta = 0.65 & fn = 1Hz
Overshoot = 1.11, ts = 1.96s for steady steady value of >=0.99
Kp = 28.8892, Kd = -1.918, Ki = 50

With Ki = 50, Kp & Kd as per zeta = 0.5 & fn = 2Hz
Overshoot = 1.08, ts = 3.24s for steady steady value of >=0.99
Kp = 66.115, Kd = 0.2832, Ki = 50

With Ki = 50, Kp & Kd as per zeta = 0.7 & fn = 2Hz
Overshoot = None, ts = 0.83 s for steady steady value of >=0.99 (All the desired conditions have been met with respective Kp, Kd & Ki values)
Kp = 40.9822, Kd = 2.7965, Ki = 50
Reference speed = 1

Reference speed = 5

Conclusion: The speed of DC motor can be controlled along with fulfilling the desired parameters.
Note: First run the PID_DCmotor.m file with respective fn & zeta value, then mdl file & then the linearized_plots.m file for obtaining the responses
Run the following commands for obtaining DC motor without controller responses.
figure(1);
subplot(411);
plot(out.time,out.w1);grid;title("speed w1");xlabel("time");ylabel("speed");
subplot(412);
plot(out.time,out.Ia1);grid;title("Armature current Ia1");xlabel("time");ylabel("Curent");
subplot(413);
plot(out.time,out.T1);grid;title("Torque T1");xlabel("time");ylabel("Torque");
subplot(414);
plot(out.time,out.Vs1);grid;title("Reference voltage Vs1");xlabel("time");ylabel("Ref voltage");