Project - Position control of mass spring damper system
AIM;
Obtain the transfer function of a mass spring damper system and use it in the model. Add a PID controller to adjust the force on mass so that its position follows a reference signal.
given data;
Take m = 3.6; %kg k = 400; %N/m c = 100; %Ns/m
solution;
transfer function of a mass spring damper system and use it in the model. Add a PID controller to adjust the force on mass so that its position follows a reference signal. the matlab model of the pid control and transfer function pulse wavefrome generator.
This example shows a controlled mass-spring-damper. A controller adjusts the force on the mass to have its position track a command signal. The initial velocity for the mass is 10 meters per second. The controller adjusts the force applied by the Force Source to track the step changes to the input signal.
PID controller;

PID control stands for proportional–integral–derivative control. PID control is a feedback mechanism used in a control system. This type of control is also termed as three-term control, and is implemented by a PID Controller. By calculating and controlling three parameters – the proportional, integral and derivative of how much a process variable deviates from the desired set point value – we can achieve different control actions for specific work.
PID controllers are considered to be the best controller in the control system family. Nicholas Minorsky published the theoretical analysis paper on PID controller. For PID control the actuating signal consists of proportional error signal added with derivative and integral of the error signal. Therefore, the actuating signal for PID control is:

The Laplace transform of the actuating signal incorporating PID control is

There are some control actions which can be achieved by using any of the two parameters of the PID controller. Two parameters can work while keeping the third one to zero. So PID controller becomes sometimes PI (proportion-integral), PD (proportional-derivative) or even P or I. The derivative term D is responsible for noise measurement while the integral term is meant for reaching the targeted value of the system. In early days PID controller was used as a mechanical device. These were pneumatic controllers as they were compressed by air. Mechanical controllers include spring, lever or mass. Many complex electronic systems are provided with a PID control loop. In modern days PID controllers are used in PLC (programmable logic controllers) in the industry. The proportional, derivative and integral parameters can be expressed as – Kp, Kd and Ki. All these three parameters have an effect on the closed loop control system. It affects rise time, settling time and overshoot and also the steady state error.
| Control Response | Rise time | Settling time | Overshoot | Steady state error |
| Kp | decrease | small change | increase | decrease |
| Kd | small change | decrease | decrease | no change |
| Ki | decrease | increase | increase | eliminate |
PID control combines the advantages of proportional, derivative and integral control actions. Let us discuss these control actions in brief.
A PID controller has some limitations also apart from being one of the best controllers in control action system. PID control is applicable to many control actions but it does not perform well in case of optimal control. Main disadvantage is the feedback path. PID is not provided with any model of the process. Other drawbacks are that PID is linear system and derivative part is noise sensitive. Small amount of noise can cause great change in the output.

MATLAB PROGRAM OF POSITION CONTROL OF SPRING_MASS_DAMPER_SYSTEM :
m = 3.6; % kg
k = 400; % N/m
c = 100; % Ns/m
% Pole placement design
fn = 1.0;
wn = 2*pi*fn;
% A & B matrix value
A = [0 1; -k/m -c/m];
B = [0; 1/m]; % Design values
zeta = 0.5; % for an under-damped behavior
% Desied poles value
p1 = -zeta*wn+wn*sqrt(zeta^2-1);
p2 = -zeta*wn-wn*sqrt(zeta^2-1);
p= [p1;p2];
K = place(A,B,p);
Kp = K(1);
Kd = K(2);
% End
M-FILE PAGE;

- Speed is the controllable parameter, so we will set the reference speed in step block as 15,25, 35 whichever you want.
- Subtract the actual speed from the reference speed to generate the error signal e(t)
- Add Kp as K(1) and Kd as K(2) parameter determined from place command (K=place(A,B,P)). (use gain block to mention values of Kp, Kd, and Ki)
- The feedback for Kd is provided from the output current of the plant/model (figure 1). OR we can take feedback (error speed signal as input to Kd shown by figure 2)
- Add Ki manually with gain and integrator block and tune different values of Ki and check the impact of it on results.
To check the location of poles on the s-plane from MATLAB the following command (‘pzmap ’-pole zero placement or mapping) can be used in continuation to the above script. You can see two crosses in red indicate complex poles lying on the left hand of the plane which indicate it is a stable system,
block daigram;

TRANSFER FUNCTION :
The numerator coefficient can be a vector or matrix expression. The denominator coefficient must be a vector. The output width equals the number of rows in the numerator coefficient. You should specify the coefficients in descending order of powers of s.
'Parameter tunability' controls the runtime tunability level for numerator and denominator coefficients. 'Auto': Allow Simulink to choose the most appropriate tunability level. 'Optimized': Tunability is optimized for performance. 'Unconstrained': Tunability is unconstrained across the simulation targets.

Genarator parameter values,

stop time; 30.00
Transfer function difrenceat.

To Plot output Wavefrom :
To Find the final output scope value

Transfer function valure;

CONCLUSION :
To complte the project of Position control of mass spring damper system transfer function of a mass spring damper system and use it in the model. Add a PID controller to adjust the force on mass so that its position follows a reference signal to using matlab and simulink wave from plot.
transfer function of a mass spring damper system files attech the m file&slx file.