Project - Position control of mass spring damper system
Q-1) 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.
Take m = 3.6; %kg k = 400; %N/m c = 100; %Ns/m
The reference signal is shown in the following figure.
AIM :-
To design the project of position control of mass spring damper system using matlab simulink model of 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.
OBJECTIVE :-
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
In this project, PID controller has been designed by using Simulink in order to control a mass spring damper system which can move any direction. A transfer function for dc motor was added on the diagram. Response curve of the PID controller were fixed by tuning. The computer interface, different control algorithms can be performed on the system easily; control parameters can be set up online, filter algorithms in various structures can be tried and the reaction of these changeable values to the system can be observed. The effects of controller Proportional Integral Derivative (PID) for developing


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.
With the following points of consideration, the modelling is done.
- Point masses are present only
- is resultant of all forces
- is absolute acceleration
- Linear force in direction is acting.
The following free body diagram (FBD) in a positive deflected state is presented.

The sum of all forces acting in a different direction is given as follows,

This is the equation of motion (EoM) and it is in the form of 2nd order ordinary differential equation (ODE), linear in nature, with constant coefficients and inhomogeneous.
The above equation was in the differential form we can convert it into the s domain or frequency domain which is represented as follows,

Finally, we can rearrange the equation to get the transfer function G(s) of this system. The definition of the transfer function of a control system is its outputs divided by its inputs. In this case, X(s) is the output, F(s) is the input, so we can get G(s) as follows:

The above-derived ODE can be converted to a single order equation by using a state-space representation of the mass-spring damper system. The Laplace transformation ignores the initial condition of the system.
PID controller
A proportional–integral–derivative controller (PID controller or three-term controller) is a control loop mechanism employing feedback that is widely used in industrial control systems and a variety of other applications requiring continuously modulated control. A PID controller continuously calculates an error value
as the difference between a desired setpoint (SP) and a measured process variable (PV) and applies a correction based on proportional, integral, and derivative terms (denoted P, I, and D respectively), hence the name.
In practical terms, PID automatically applies an accurate and responsive correction to a control function. An everyday example is the cruise control on a car, where ascending a hill would lower speed if constant engine power were applied. The controller's PID algorithm restores the measured speed to the desired speed with minimal delay and overshoot by increasing the power output of the engine in a controlled manner.

The overall control function,

all non-negative, denote the coefficients for the proportional, integral, and derivative terms respectively (sometimes denoted P, I, and D).
Implementation of Spring mass system using PID controllers
The Simulink model of Spring mass damper system along with PID controller is shown below

Intial conditions are defined below









Conclusion
With the help of PID controllers we have successfully positioned the spring mass damper system.