Project - Position control of mass spring damper system
Transfer Function:
The transfer function defines the relation between the output and the input of a dynamic system,
written in complex form (s variable). For a dynamic system with an input u(t) and an output y(t), the
transfer function H(s) is the ratio between the complex representation (s variable) of the
output Y(s) and input U(s).

Formula:
The simplest representation of a system is through Ordinary Differential Equation (ODE) When dealing
with ordinary differential equations, the dependent variables are function of a positive real
variable t (often time). By applying Laplace’s transform we switch from a function of time to a function
of a complex variable s (frequency) and the differential equation becomes an algebraic
equation.

Transfer function for a mass spring damper system:

Image: Translational mass with spring and damper
The ordinary differential equation describing the dynamics of the system is:
...........(1)
where:
m [kg] – mass
k [N/m] – spring constant (stiffness)
c [Ns/m] – damping coefficient
F [N] – external force acting on the body (input)
x [m] – displacement of the body (output)
The input of the system is the external force F(t) and the output is the displacement x(t). First we’ll
apply the Laplace transform to each of the terms of the equation (1):



The initial conditions of the mass position and speed are:
x(0) = 0
dx(0) / dt = 0
Replacing the Laplace transforms and initial conditions in the equation (1) gives:
F(s) = ms^2X(s) + csX(s) + kX(s)
F(s) = X(s)(ms^2 + cs + k)
X(s) / F(s) = 1 / ms^2 + cs + k
We have now found the transfer function of the translational mass system with spring and
damper:

Given data for a system:
m = 3.6; %kg
k = 400; %N/m
c = 100; %Ns/m
Script:
% design parameters
Jm=0.01;
Bm=0.1;
Km=0.01;
Kt=0.01;
Ra=1;
La=0.5;
%PD design
%A = [-B/J kt/J; -km/La -Ra/La]
%B = [0; 1/La]
A = [-Bm/Jm Kt/Jm ; -Km/La -Ra/La];
B = [0; 1/La];
% pole placement
fn=1;
wn=2*pi*fn;
zeta=0.5;
p1=-zeta*wn+wn*(zeta^2-1);
p2=-zeta*wn-wn*(zeta^2-1);
P=[p1;p2];
K = place(A,B,P);

Simulink Model:

DC motor model :-

In this simulink model we have provided the pulse generator as a reference signal as per the
question criterion.
Blocks used:
1. Pulse Generator block
2. To workspace block
3. Gain block
4. Sum block
5. Scope block
6. Inport
7. outport
8. Clock
9. Integrator block
10. Transfer function block
On running the simulation for 27.5 sec.
we get,

1] K(1) = Kp = 12.4056, K(2) = Kd= -2.8584 and Ki = 1 (value of Ki taken manually).

2] K(1) = Kp = 12.4056, K(2) = Kd= -2.8584 and Ki = 10

3] K(1) = Kp = 12.4056, K(2) = Kd= -2.8584 and Ki = 100

4] K(1) = Kp = 12.4056, K(2) = Kd= -2.8584 and Ki = 500

4] K(1) = Kp = 20 K(2) = Kd= -2.8584 and Ki = 100

5] K(1) = Kp = 40 K(2) = Kd= -2.8584 and Ki = 100

From above all the results we can observe that if we keep on increasing the Ki values with increasing
Ki we get response of more overshoot and undershoot. also if we change the Kd gain then system
suffers more condition of undershoot and overshoot. Respone we are getting is not bounded at all.
Lets observe the behaviour with different reference speed signal.

1] K(1) = Kp = 12.4056, K(2) = Kd= -2.8584 and Ki = 100

2] K(1) = Kp = 12.4056, K(2) = Kd= -2.8584 and Ki = 10

3] K(1) = Kp = 12.4056, K(2) = Kd= -2.8584 and Ki = 1

We are getting same response when we are changing the reference signal.
PID Controller:
PID controllers are found in a wide range of applications for industrial process control.
Approximately 95% of the closed-loop operations of the industrial automation sector
use PID controllers. PID stands for Proportional-Integral-Derivative. These three
controllers are combined in such a way that it produces a control signal. As a feedback
controller, it delivers the control output at desired levels. Before microprocessors were
invented, PID control was implemented by the analog electronic components. But today
all PID controllers are processed by the microprocessors. Programmable logic controllers
also have the inbuilt PID controller instructions. Due to the flexibility and reliability of the
PID controllers, these are traditionally used in process control applications.
Simulink model without PID Block:

1] For a resference of 230:

2] For a reference of 100

3] For a reference of 50

4] For a reference of 350

we have used the same script .
For plotting the command we have used

using pid controller block

Tunned response we are getting is shown below,

When reference signal is 230

when reference signal is 100

This is how we are maintaining stability of a dynamic system using pid controller.
Parameters:
