Challenge

Project - Position control of mass spring damper system

Solution 01.

Built a simulink model of spring-mass damper system controlled with PID controller shown below

We use pulse generator block to give the given input to the system with transfer function block for spring-mass damper system with gains for kp, ki and kd gains and other desired block as shown

NOTE :-Filename " spring_mass_damper_pid.mdl" having above simulink model file

The dynamics of the mass-spring-damper system can be described as follows:

F = m*x2_dot +c*x2+k*x1

where , m is the mass (kg),

c is the damping coefficient (Ns/m)

k is the spring constant (N/m),

x1 is the displacement of the mass from its equilibrium position (m),

x2 is the velocity of the mass (m/s)

x2_dot is the acceleration of the mass (m/s²)

F is the force applied to the mass (N).

To obtain the transfer function, we need to convert this second-order ordinary differential equation into the Laplace domain.The transfer function​ of the system is:

G(s)=1/ms2+cs+k

Use the State space method to get the matrices

To create state-space matrices A and B for the mass-spring-damper system with m=3.6,c=100, and k=400, we need to represent the system in state-space form.The state-space representation of a linear time-invariant system is given by the following set of first-order differential equations:

x_dot=Ax+Bu

For the given mass-spring-damper system, the state-space representation is:

x1_dot = x2 ​
x2​_dot=−c/m*​x2​−k/m*​x1​+1/m*​u
we get the matrices A and B and poles for zeta = 0.5.
Below in matlab script with "place" command we get gains Kp and Kd​

​

NOTE:- filename "pid_springmassdamper.m" is above matlab script file

Run the simulation for 27.5 sec. with controller connection to the system , the output shown below

Hence, we get a fine track for Ki=1500 Kp=K(1) and Kd=K(2) gain values.

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.