Project - Position control of mass spring damper system
Our Model needs to have a transfer function and PID controller to adjust the force on mass so that its position follows a reference signal.
Things to do
for transfer function,as per formula, we need m,k,c values which are already defined in the problem
For PID controller, We need Kp,Kd,Ki which we need to determine using pole placement design and can validate it through pzmap. so lets proceed with MATLAB code to determine the needed paramters.
MATLAB code in MATLAB file
>> who
Your variables are:
A G Kd P fn m p1 s z
B K Kp c k p p2 wn zeta
>> 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
>> Kp
Kp =
-257.8777
>> Kd
Kd =
-77.3805
>> m
m =
3.6000
>> k
k =
400
>> c
c =
100
>> zeta
zeta =
0.5000
>> wn
wn =
6.2832
Model
1)As usual we will start with clock for time
2) input can be given through multiple input signal types such as constant,step,ramp but here we choose pulse generator for signal wave input. its paramters used for model(in order to match the given reference signal vs time) are
amplitude =1;
period = 10 secs;
pulse width = 50%
3)a Sum block needed to add the error signal which we will input from the transfer function later in this model.
4) all thre gain blocks (Kp,Ki,Kd) are added where Kd,Kp will take values from the MATLAB code and Ki will be an manual input. Also, Ki,the intergral gain needs an integral block before it.
But for Kd, the derivative gain, we can input it in two ways. one way is to derivate the input signal value or to use the output of the model and latter would be suggested and used here.
5)The output of the PID controller design is sent to the Transfer function block which has m,k,c as paramters (rest all are default paramters).
6)Scope is used to plot the input signal and output of the model.and another scope is added in order to analyse the behaviour of the PID values based on the manual input of Ki values.
Plots inference from attached snips
1. Final solution snip is taken when the Ki value was initialized as 2500 and we got our needed output with respect to our input signal.
Note: Multiple inputs were tested for Ki and for every positive value above 100,the needed output started to show and after optimizing the value at 2500, we got the optimzed result.
2. another snip taken at Ki=0, to see other gains(Kp,Kd) and their plot.
Conclusion
Position control of mass spring damper system is modelled and output is verfied