0% found this document useful (0 votes)
9 views

Mass_Spring_Damper_System_1685208385

The document presents a comprehensive analysis of a mass-spring-damper system using Lagrange's equations, detailing kinetic, potential, and damping energies. It includes the system's equations of motion, characteristic equations, and second-order system analysis, along with settling time, peak time, and rise time calculations. Additionally, it provides Python and MATLAB code for modeling and simulating the system's behavior in both time and frequency domains.

Uploaded by

Niv Perry
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Mass_Spring_Damper_System_1685208385

The document presents a comprehensive analysis of a mass-spring-damper system using Lagrange's equations, detailing kinetic, potential, and damping energies. It includes the system's equations of motion, characteristic equations, and second-order system analysis, along with settling time, peak time, and rise time calculations. Additionally, it provides Python and MATLAB code for modeling and simulating the system's behavior in both time and frequency domains.

Uploaded by

Niv Perry
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

System Model Free-Body Diagram

𝑓(𝑡) 𝑥1
𝑚1
𝑚1

𝑘 𝑐
𝑓𝑘 (𝑡) 𝑓𝑐 (𝑡)
Lagrange Formula
𝑑 𝜕𝑇 𝜕𝐷 𝜕𝑈
+ + = 𝑄 = 𝑓(𝑡)
𝑑𝑡 𝜕𝑥ሶ 𝜕𝑥ሶ 𝜕𝑥

Kinetic Energy (K) Potential Energy (U)


1 1 2
𝑇 = 𝑚𝑥ሶ 2 𝑈 = 𝑘𝑥
2 2
𝜕𝑇 1 𝜕𝑈 1
= 𝑚 2𝑥ሶ = 𝑚𝑥ሶ = 𝑘 2𝑥 = 𝑘𝑥
𝜕𝑥ሶ 2 𝜕𝑥 2
𝑑 𝜕𝑇 𝑑 𝜕𝑈
= 𝑚𝑥ሶ = 𝑚𝑥ሷ = 𝑘𝑥
𝑑𝑡 𝜕𝑥ሶ 𝑑𝑡 𝜕𝑥
Damping Energy (D)
1 2 𝜕𝐷 1 𝜕𝐷
𝐷 = 𝑐 𝑥ሶ = 𝑐 2𝑥ሶ = 𝑐 𝑥ሶ = 𝑐 𝑥ሶ
2 𝜕𝑥ሶ 2 𝜕𝑥ሶ
Lagrange Formula

𝑑 𝜕𝑇 𝜕𝐷 𝜕𝑈
+ + = 𝑄 = 𝑓(𝑡)
𝑑𝑡 𝜕𝑥ሶ 𝜕𝑥ሶ 𝜕𝑥

𝑑 𝜕𝑇 𝜕𝑈 𝜕𝐷
= 𝑚𝑥ሷ = 𝑘𝑥 = 𝑐 𝑥ሶ
𝑑𝑡 𝜕 𝑥ሶ 𝜕𝑥 𝜕𝑥ሶ

Equation of Motion Mass Spring Damper System

෍ 𝐹 = 𝑚𝑥ሷ

𝑚𝑥(𝑡)
ሷ + 𝑐 𝑥(𝑡)
ሶ + 𝑘𝑥(𝑡) = 𝑓(𝑡)

Second Order System Analysis


System Equation, 𝑚𝑥ሷ 𝑡 + 𝑏𝑥ሶ 𝑡 + 𝑘𝑥 𝑡 = 𝑓 𝑡
𝑥ሷ 𝑡 + 0.5𝑥ሶ 𝑡 + 10𝑥 𝑡 = 10 𝑚 = 1𝑘𝑔
𝑏 = 0.5 𝑁. 𝑠ൗ𝑚
The characteristic equation is, 𝑘 = 10 𝑁ൗ𝑚
𝑓 = 10𝑁
𝑥ሷ 𝑡 + 2𝜁ω𝑛 𝑥ሶ 𝑡 + ω𝑛 2 𝑥 𝑡 = 0
In that case,

ω𝑛 2 = 10 Underdamped
2𝜁ω𝑛 = 0.5
System
ω𝑛 = 3.2 𝑟𝑎𝑑ൗ𝑠 𝜁 = 0.08
0 < 0.25 < 1
Second Order Systems Analysis
Settling Time, 𝑻𝒔
Peek Time, 𝑻𝒑
4
𝑇𝑠 =
𝜁ω𝑛 π
𝑇𝑝 =
4 ω𝑛 1 − 𝜁 2
𝑇𝑠 =
(0.08)(3.2)
3.14
𝑇𝑝 =
4 3.2 1 − (0.08)2
𝑇𝑠 =
0.256 𝑇𝑝 = 3.19 𝑠𝑒𝑐𝑜𝑛𝑑
𝑇𝑠 = 15.6 𝑠𝑒𝑐𝑜𝑛𝑑

Rise Time, 𝑻𝒓
2π − ф
𝑇𝑟 =
2π − ф ω𝑛 1 − 𝜁 2
𝑇𝑟 =
ω𝑛 1 − 𝜁 2

1 − 𝜁2 2(3.14) − 3.45
ф= 𝑡𝑎𝑛−1 +π 𝑇𝑟 =
𝜁 3.2 1 − (0.08)2

1 − (0.08)2
ф = 𝑡𝑎𝑛−1 + 3.14 𝑇𝑟 = 0.89 𝑠𝑒𝑐𝑜𝑛𝑑
3.2
ф = 3.45 𝑟𝑎𝑑
The Laplace Transform
Formula
∞ ∞
L 𝑓 𝑡 = න 𝑒 −𝑠𝑡 𝑑𝑡 𝑓 𝑡 = න 𝑓(𝑡)𝑒 −𝑠𝑡 𝑑𝑡 = 𝐹(𝑠)
0 0

𝑓 𝑡 : 𝐼𝑡 𝑖𝑠 𝑎 𝑓𝑢𝑛𝑐𝑡𝑖𝑜𝑛 𝑜𝑓 𝑡𝑖𝑚𝑒 𝑎𝑛𝑑 𝑎𝑛𝑑 𝑡 < 0 𝑓𝑜𝑟 𝑓 𝑡 = 0


𝑠: 𝐼𝑡′𝑠 𝑎 𝑐𝑜𝑚𝑝𝑙𝑒𝑥 𝑣𝑎𝑟𝑖𝑎𝑏𝑙𝑒.
L ∶ 𝐿𝑎𝑝𝑙𝑎𝑐𝑒 𝑇𝑟𝑎𝑛𝑠𝑓𝑜𝑟𝑚 𝑠𝑦𝑚𝑏𝑜𝑙.

න 𝑒 −𝑠𝑡 𝑑𝑡 : 𝐿𝑎𝑝𝑙𝑎𝑐𝑒 𝑖𝑛𝑡𝑒𝑔𝑟𝑎𝑙.
0

𝑆𝑦𝑠𝑡𝑒𝑚 𝑒𝑞𝑢𝑎𝑖𝑡𝑜𝑛 𝑜𝑓 𝑚𝑜𝑡𝑖𝑜𝑛 𝑚𝑥(𝑡)


ሷ + 𝑏𝑥(𝑡)
ሶ + 𝑘𝑥(𝑡) = 𝑓(𝑡) Laplace
transform;
𝑚L 𝑥ሷ 𝑡 + 𝑏L [𝑥(t)]+
ሶ kL 𝑥 𝑡 =𝑓
𝑚 𝑠 2 𝑥 𝑠 − 𝑥ሶ 0 − 𝑥 0 𝑠 + 𝑏 𝑠𝑥 𝑠 − 𝑥 (0) + 𝑘𝑥 𝑠 = 𝑓(𝑠)
𝑚𝑠 2 𝑥 𝑠 + 𝑏𝑠𝑥 𝑠 + 𝑘𝑥 𝑠 = 𝑓(𝑠)
𝑚𝑠 2 + 𝑏𝑠 + 𝑘 𝑥 𝑠 = 𝑓(𝑠)
❖ 𝐼𝑓 𝑤𝑒 𝑠𝑢𝑏𝑠𝑡𝑖𝑡𝑢𝑡𝑒 𝑡ℎ𝑒 𝑔𝑖𝑣𝑒𝑛 𝑣𝑎𝑙𝑢𝑒𝑠;
𝑠 2 + 0.5𝑠 + 10 𝑥 𝑠 = 𝑓(𝑠)

𝑥 𝑠 1
=𝐺 𝑠 = 2
𝑓(𝑠) 𝑠 + 0.5𝑠 + 10

Transfer Function of the system.


System Modeling and Simulation
PYTHON

1. Import of necessary libraries 2. Defining variables


import numpy as np mass = 1.0 # Mass
import matplotlib.pyplot as plt stiffness = 10.0 # Stiffness
from scipy.integrate import odeint damping = 0.5 # Damping
from scipy import signal F = 10.0 # Force

3. Differential equation function


def mass_spring_damper(state, t):
x, x_dot = state[0], state[1]
x_dot_dot = (-damping * x_dot - stiffness * x + F) / mass
return [x_dot, x_dot_dot]

4. Time interval and number of steps


t_start = 0.0
t_end = 10.0
num_points = 1000
t = np.linspace(t_start, t_end, num_points)

5. Initial conditions
x0 = 1.0 # Initial position
v0 = 0.0 # Initial velocity
initial_state = [x0, v0]

6. Solving differential equation


sol = odeint(mass_spring_damper, initial_state, t)
x = sol[:, 0] # Position data
7. Visualising system behaviour in the time domain
plt.plot(t, x)
plt.xlabel('Time')
plt.ylabel('Displacement')
plt.title('Mass Spring Damper System - Time Domain')
plt.grid(True)
plt.show()

8. FRF Calculation
input_frequency = 2.0 # Frequency of the input signal
input_amplitude = 1.0 # Amplitude of the input signal
input_signal = input_amplitude * np.sin(2 * np.pi * input_frequency * t)
9. FRF Calculation
num = [1]
den = [mass, damping, stiffness]
transfer_function = signal.TransferFunction(num, den)
t_output, x_output, _ = signal.lsim(transfer_function, input_signal, t)

10. Visualising system behaviour in the FRF


frequencies, frf = signal.freqresp(transfer_function, 200)
plt.plot(frequencies, np.abs(frf))
plt.xlabel('Frequency')
plt.ylabel('FRF (Absolute Value)')
plt.title('Mass Spring Damper System - FRF')
plt.grid(True)
plt.show()
System Modeling and Simulation
MATLAB

1. Defining variables
mass = 1.0 # Mass
stiffness = 10.0 # Stiffness
damping = 0.5 # Damping
F = 10.0 # Force

3. Differential equation function


mass_spring_damper = @(t, x) [x(2); (-damping * x(2) - stiffness * x(1) + F) /
mass];

4. Time interval and number of steps


t_start = 0.0;
t_end = 10.0;
num_points = 1000;
t = linspace(t_start, t_end, num_points);

5. Initial conditions
x0 = 0.0; % Initial position
v0 = 0.0; % Initial velocity
initial_state = [x0, v0];

6. Solving differential equation


sol = ode113(mass_spring_damper, t, initial_state);
x = sol.y(1, :); % Position data
7. Visualising system behaviour in the time domain
figure;
plot(sol.x, sol.y(1, :));
xlabel('Zaman');
ylabel('Konum');
title('Mass Spring Damper Sistemi - Zaman Alanı');
grid on;

8. FRF Calculation
input_frequency = 2.0; % Frequency of the input signal
input_amplitude = 1.0; % Amplitude of the input signal
input_signal = input_amplitude * sin(2 * pi * input_frequency * t);
9. FRF Calculation
utput_signal = lsim(tf([1], [mass, damping, stiffness]), input_signal, t);
x_output = output_signal(:, 1);

10. Visualising system behaviour in the FRF


figure;
frequencies = linspace(0, input_frequency * 10, 200);
frf = abs(freqresp(tf([1], [mass, damping, stiffness]), frequencies));
frf = squeeze(frf);
plot(frequencies, frf);
xlabel('Frekans');
ylabel('FRF (Mutlak Değer)');
title('Mass Spring Damper Sistemi - FRF');
grid on;
Display of results again.

You might also like