Challenge

Project - Position control of mass spring damper system

OBJECTIVE: 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.

% Initial condition Position control for spring mass Damper system
m = 3.6; % Value in kg
k = 400; % Value in N/m
c = 100; % Value in Ns/m
% Design Values
zeta = 0.9; % Under-Damped case
wn = sqrt(k/m); % Value in rad/s
f = wn/(2*pi); % value in Hz
% A and B matrices
A = [0 1; -k/m -c/m];
B = [0; 1/m];
% Desired poles
p1 = -zeta*wn + wn*sqrt(zeta^2-1);
p2 = -zeta*wn - wn*sqrt(zeta^2-1);
P = [p1;p2];
% Place command
K = place(A,B,P);
kp = K(1);
kd = K(2);

Pulse Generator:

Amplitude: 1

Period: 10

Pulse Width: 50%

>> A

A =

0 1.0000
-111.1111 -27.7778

>> B

B =

0
0.2778

>> P

P =

-3.1416 + 5.4414i
-3.1416 - 5.4414i

>> K

K =

-257.8777 -77.3805

>> k

k =

400

>> c

c =

100

>> m

m =

3.6000

>> f

f =

1

>> wn

wn =

6.2832

>> kd

kd =

-77.3805

>> kp

kp =

-257.8777

>> p1

p1 =

-3.1416 + 5.4414i

>> p2

p2 =

-3.1416 - 5.4414i

Model Settings:

Start time = 0

Stop time = 30

Fixed type with step time = 0.01

Ki is manually selected and given the value of 470

Transfer Funtion = 1/(m*s^2+c*s+k)

m = 3.6; % Value in kg
k = 400; % Value in N/m
c = 100; % Value in Ns/m

CONCLUSION: Overshoot is under 10% and settling time is also in range. Adjusted force, on mass so that its position follows a reference signal. Ki is 470 for the value of zeta = 0.9. Graph is for two cycle times 10sec and 30 sec respectively.

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.