Challenge

Project - Position control of mass spring damper system

q: 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

Aim : To btain the transfer function of a mass spring damper system and Add a PID controller to adjust the force on mass so that its position follows a reference signal

model: the transfer function for the mass spring damper system is

T/F=x(s)/F(s)=1/(m*s^2+c*s+k)

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

=k/(s^2+2*zeta*wn*s+wn^2)

where c/m=2*zeta*wn

k=1/m

k/m=wn^2

model

command for parameter pid

clc
clear all
% parameter that given in question
m=3.6; % mass in kg
k=400; % stiffness or spring constant in N/m
c=100; %dashpot or damper in Ns/m
% A&B matrices
A=[0 1 ; 111.11 27.79];
B=[0;0.27];
% defining wn
fn=1.0; % 1 hz natural frequency
wn=2*pi*fn; % natural frequency rds/sec
% design parameter
zeta=0.5; % damped co-efficient
%Desired poles
p1=-zeta*wn+wn*sqrt(zeta^2-1);
p2=-zeta*wn-wn*sqrt(zeta^2-1);
p=[p1;p2];
%pole placement desgin
k=place(A,B,p);
%Difining kp,kd &ki from k
kp=k(1)
kd=k(2)
ki=1000

command for the transfer function for the mass spring damper system

% transfer function for spring mass damper
m=3.6 % mass in kg
k=400; % stiffness or spring constant in N/m
c=100; %dashpot or damper in Ns/m
% defining wn
fn=1.0; % 1 hz natural frequency
wn=2*pi*fn; % natural frequency rds/sec
% design parameter
zeta =0.5; % damped co-efficient
% transfer function
s=tf('s');
s=1/m/(s^2+2*zeta*wn*s+wn^2)
% transfer function for spring mass damper

Ans :

kp =

557.7349


kd =

126.1970


ki =

1000


m =

3.6000


s =

0.2778
---------------------
s^2 + 6.283 s + 39.48

Continuous-time transfer function.

output for xref

output for pid controller

output for spring mass damper

conclusion for this project

the input of squre wave is fed to pid by controlling by the ki value and output is squre is pid controller

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.