Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

EE-360L Control Systems Lab

Report on Mass-Spring-Damper System with PID Controller

Open Ended LAB

Submitted by :
Muneeb Ahmad F2021019011

Resource Person:

Maryam Shakeel

UNIVERSITY OF MANAGEMENT AND TECHNOLOGY

SCHOOL OF ENGINEERING
ELECTRICAL ENGINEERING DEPARTMENT
Introduction
In this report, we analyze and design a PID controller for a mass-spring-damper system. The
objective is to tune the PID gains to achieve the desired performance specifications:

1. Settling time less than 2 seconds.


2. Overshoot less than 5%.
3. Steady-state error less than 1%.

System Model
The mass-spring-damper system is a classic mechanical system described by the following
differential equation:

mx’’(t)+bx’(t)+ kx(t) = F(t)

Where:

• m is the mass (kg).


• b is the damping coefficient (N·s/m).
• k is the spring constant (N/m).
• x(t) is the displacement (m).
• F(t) is the external force applied (N).

The transfer function for the mass-spring-damper system can be derived as:

P(s)=X(s)/F(s)= 1/(ms^2+bs+k)

For this report, the parameters are chosen as:

• m=1
• b=10
• k=20

MATLAB Script Code:


The initial PID gains are chosen based on trial and error to meet the design requirements.

m = 1;
b = 10
k = 20;
s = tf('s');
P_system = 1 / (m*s^2 + b*s + k);
Kp = 350;
Ki = 300;
Kd = 50;
C = pid(Kp, Ki, Kd);
sys_cl = feedback(C*P_system, 1);
step(sys_cl, 0:0.01:4);
grid on;
title('Step Response with PID Controller');
xlabel('Time (seconds)');
ylabel('Amplitude');
stepinfo(sys_cl)

Results and Analysis

Running the MATLAB script gives us the step response of the closed loop system. MATLAB
has an inbuilt function called ‘stepinfo ‘which gives the various characteristics of the step
response like rise time, settling time, overshoot, steady state error etc.

Initial PID Gains

• Kp=350
• Ki=300
• Kd=50

The initial step response shows:

• Settling Time: Approximately 1.5 seconds, which is less than 2 seconds.


• Overshoot: Approximately 4%, which is less than 5%.
• Steady-State Error: Close to 0%, which is less than 1%.

The initial gains meet the design requirements.


Output :
Conclusion:

A properly functioning PID controller for the mass-spring-damper system. Through MATLAB
simulations the step response characteristics are analyzed and proved that the controller is able to
satisfy time requirement (settling time < 2 seconds, overshoot < 5%) along with its ability to
keep the steady state error less than 1%.

Further research can be pursued with implementation of advanced control strategies and
robustness analysis to further improve system response under changing environments and
disturbances.

You might also like