Challenge

Project - Position control of mass spring damper system

To obtain the transfer function of the mass-spring-damper system, we'll start by writing down the equations of motion:

��¨+��˙+��=�mx¨+cx˙+kx=F

Where:

  • �m is the mass (3.6 kg)
  • �c is the damping coefficient (100 Ns/m)
  • �k is the spring constant (400 N/m)
  • �x is the displacement of the mass from its equilibrium position
  • �F is the force applied to the mass

Taking the Laplace transform, assuming zero initial conditions, we get:

��2�(�)+���(�)+��(�)=�(�)ms2X(s)+csX(s)+kX(s)=F(s)

Rearranging and solving for �(�)/�(�)X(s)/F(s), we obtain the transfer function:

�(�)�(�)=1��2+��+�F(s)X(s)​=ms2+cs+k1​

Substituting the given values �=3.6m=3.6, �=100c=100, and �=400k=400, we get:

�(�)�(�)=13.6�2+100�+400F(s)X(s)​=3.6s2+100s+4001​

Next, let's design a PID controller to adjust the force on the mass. The general form of a PID controller is:

�(�)=��+���+���C(s)=KP​+sKI​​+KD​s

Where:

  • ��KP​ is the proportional gain
  • ��KI​ is the integral gain
  • ��KD​ is the derivative gain

The overall transfer function with the PID controller becomes:

�(�)�(�)=�(�)1+�(�)�(�)R(s)X(s)​=1+C(s)G(s)C(s)​

Substituting �(�)=13.6�2+100�+400G(s)=3.6s2+100s+4001​ and �(�)=��+���+���C(s)=KP​+sKI​​+KD​s, we get:

�(�)�(�)=���2+���+��3.6�3+(100+��)�2+(400+��)�+��R(s)X(s)​=3.6s3+(100+KD​)s2+(400+KP​)s+KI​KP​s2+KI​s+KD​​

This is the transfer function of the closed-loop system with the PID controller.

 

Matlab program

% initial condition position control of mass spring damper system
m=3.6; %kg
k=400; % N/m
c=100; % Ns/m
 
% pole placement design
fn=1.0; %1Hz natural freequency
wn=2*pi*fn; % natural freequency in rad/s

 
% A & B matrix value
A=[0 1; -k/m -c/m];
B=[0; 1/m];

 
�sign values
zeta=0.5; %for an under damped behaviour

 
�sired poles value
p1=-zeta*wn+wn*sqrt(zeta^2-1);
p2=-zeta*wn-wn*sqrt(zeta^2-1);
p=[p1;p2];

 
%place comment is the kp and kd value
k=place(A,B,p); %kp = k(1), k(2)

 
%end
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.