Upload
shrikantbagal
View
43
Download
11
Embed Size (px)
DESCRIPTION
Half Car Model Analysis of Suspensions
Citation preview
���������� ��������������������������������������������������������������
� �
���������������������������������������������������������������������� �!��� ��� �!��� ��� �!��� ��� �!��� ���������" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&������
Table of contents Introduction………………………………………………….….2 Model of the system…………………………………………..3 Model of the bump……………………………………………..4 Differential Equation of Motion (2DOF)…………………….6 Natural Frequency and Mode Shapes……………………...8 General Solution……………………………………………...19 D.E of Motion using Lagrange Equation…………………20 Differential Equation of Motion (4DOF)…………………..22 Nonlinear Differential Equation of Motion……………….24 Solution with Laplace Method……………………………..25 Numerical Solution…………………………………………..26 Sample of Excel worksheet………………………………...31 VBA code for numerical solutions………………………..32
���������� ��������������������������������������������������������������
� �
���������������������������������������������������������������������� �!��� ��� �!��� ��� �!��� ��� �!��� ���������" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&������
Introduction
In this project, I’m trying to model a car which could be a Sedan
car, a truck, or an SUV, when passing through a Bump. This bump
is acting like a base excitation for our system.
First of all we will assume a 2DOF linear system; however, I will
derive the differential equation for 4DOF and Non linear system.
The different parts of this project are:
1. Modeling of the system
2. Modeling of the bump
3. Differential Equation of Motion 2DOF (linear)
4. Calculation of Natural Frequency and Mode shapes
5. Differential Equation of Motion Using Lagrange Eq.
6. Differential Equation of Motion 4DOF (linear)
7. Differential Equation of Motion 2DOF(Non linear)
8. Calculating X(t),θ(t) with Laplace Method
9. Calculating X(t),θ(t) with Numerical method Runge Kutta(4)
10. State variables for 2DOF (linear)
11. State variables for 2DOF (non linear)
12. VBA codes of 4-th order Runge Kutta for this problem
13. Graphs of X(t),θ(t) with some inputs (with Excel)
���������� ����������������������������������������������������������'���
� �
���������������������������������������������������������������������� �!��� ��� �!��� ��� �!��� ��� �!��� ���������" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&������
Modeling of the System
Model of a car:
• First assumption: The effects of the tires are negligible.
• Second assumption: The left side and the right side of the car are symmetric.
Dynamic model:
���������� ����������������������������������������������������������(���
� �
���������������������������������������������������������������������� �!��� ��� �!��� ��� �!��� ��� �!��� ���������" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&������
Modeling of the Bump
• First assumption: We assume that the bump is like a half sine wave.
So; the effect of bump is like base excitation on the system: z1, z2.
• Second assumption: We assume that the car’s speed is constant (acceleration is
zero) at this period.
SpeedCarVV
Dt
D
dhz p
tVd :
.sin.
1
.
01 = →��
���
�= =π
��
�
��
���
�
=
,0
.sin.0
1 D
dh
z
π
1
1
tptif
tptif
≥→
<→
���
��
��
���
�=
0
..sin.
0
02D
tVhz
π
2
2
tptif
tpttif
ttif
l
l
>→
<<→
<→
Note: V
DLtp
V
Ltl
+=→= 2
Top graph: Front wheel
h: height of the bump
d: horizontal coordinate
D: length of the bump
L: distance between the front and back tires
Bottom graph: rear wheel
���������� ��������������������������������������������������������������
� �
���������������������������������������������������������������������� �!��� ��� �!��� ��� �!��� ��� �!��� ���������" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&������
Other form of z1, z2 function:
Introduce �
=1
0)(tU c
Ct
Ct
>
≤
( )
[ ]���
��
��
���
�−=
��
���
�−=
�
D
tVhtUtUz
D
tVhtUz
tptl
tp
..sin..)()(
..sin..)(1
0
02
0
01
2
1
π
π
Check,
0..
sin.).11(
..sin.
..sin.).01(
0..
sin.).00(
..sin.).01(
0
022
0
0
0
022
002
0
011
=��
���
�−=→>
��
���
�=�
�
���
�−→≤≤
=��
���
�−=→<
��
���
�−=→<
D
tVhztpt
D
tVh
D
tVhztptt
D
tVhztt
D
tVhztpt
L
L
π
ππ
π
π
���������� ��������������������������������������������������������������
� �
���������������������������������������������������������������������� �!��� ��� �!��� ��� �!��� ��� �!��� ���������" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&������
Differential Equation of Motion 2DOF (linear)
Assume: θ
θ
21
22
lxz
lxz
+<
−<
� =..
. xmFx
..
1122 xmFsFcFcFs =−−−−
)(
)(
2111
2122
zlxkFs
zlxkFs
−−=
−−=
θ
θ
)(
)(
2
..
1
.
11
2
..
2
.
22
zlxcFc
zlxcFc
−−=
−−=
θ
θ
..
1
..
1
..
11
.
1111112
.
2
.
22
.
222222 xmzclcxczklkxkzclcxczklkxk =+−−+−−++−++−� θθθθ
22112
.
21
.
1221121
.
2211
.
21
..
)()()()( zkzkzczclklkxkklclcxccxm +++=−+++−+++� θθ
���������� ����������������������������������������������������������)���
� �
���������������������������������������������������������������������� �!��� ��� �!��� ��� �!��� ��� �!��� ���������" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&������
� =..
θIMcG
..
11112222 .. θIlFslFclFclFs =−−+
..
11111
..
1
.
112
..
2
.
222222 )()()()( θθθθθ Izlxlkzlxlczlxlczlxlk =−+−−+−−−+−−
zlkzlkzlczlcxlklklklkxlclclclcI 221112
.
221
.
112211
2
11
2
22
.
2211
.2
11
2
22
..
)()()()( −+−=−+++−+++� θθθ
If we put 1, 2 in matrix format;
�
���
� �
���
�
+−
−++
�
�
��
�
� �
���
�
+−
−+
�
�
��
�
� �
���
�
θθθ
x
lklklklk
lklkkkx
lclclclc
lclccx
I
m...
0
02
11
2
222211
221121.
.
2
11
2
222211
22111..
..
�
�
��
�
�
−+−
+++=
2221112
.
221
.
11
22112
.
21
.
1
zlkzlkzlczlc
zkzkzczc
���������� ����������������������������������������������������������*���
� �
���������������������������������������������������������������������� �!��� ��� �!��� ��� �!��� ��� �!��� ���������" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&������
Calculation of Natural Frequency and Mode shapes
Assuming Reasonable values for all parameter, we have:
2.rmI = r : Radius gyration of the car
Reasonable approximate values for a Sedan car;
22 6.0 mr = kgm 1000= msNcc .50021 ==
mNkk 500021 == ml 8.01 = ml 2.12 =
Reasonable approximate values for a SUV;
22 65.0 mr = kgm 3000= msNcc .150021 ==
mNkk 150021 == ml 11 = ml 5.12 =
Solved for a bump with mh 1.0= , mD 5.1=
Eigen Value Problem and Mode Shapes
For our model we assume c1 = c2 = c and k1 = k2 = k
�
���
�=
�
���
� �
���
�
+−
−+
�
�
��
�
� �
���
�
+−
−+
�
�
��
�
� �
���
�→
)(
)(.
)()(
)(2.
)()(
)(2.
0
0
2
1
2
1
2
121
21.
.
2
1
2
121
21..
..
3.
tg
tgx
llkllk
llkkx
llcllc
llccx
I
meq
θθθ
Where:
[ ] [ ][ ] [ ] )cos.,sin..()()(.)cos.,sin..()(1.)(
)cos.,sin..()()()cos.,sin..()(1)(
21
21
20102
001
tctktutulhtctktulhtg
tctktutuhtctktuhtg
ffftptLffftp
ffftptLffftp
ωωωωωω
ωωωωωω
+−++−=
+−++−=
Note: D
Vf
.πω =
���������� ����������������������������������������������������������+���
� �
���������������������������������������������������������������������� �!��� ��� �!��� ��� �!��� ��� �!��� ���������" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&������
Eigen Value Problem:
[ ] [ ]( ) 0.2 =− mk ω
0.)()(
)(2det
22
2
2
121
21
2
= �
���
�
+−
−−�
Illkllk
llkk
ω
ω
0.
)(.)(
22
21
222
2
2
1
4 =+
+ �
���
�++−�
IM
llkll
I
k
m
kωω
Im
llkll
I
k
m
kll
I
k
m
k
.
)(4)(
2)(
22
21
22
2
2
2
1
2
2
2
1
2 +− �
���
�++±++=�ω
For a sedan car we have:
kgm 1000= , 2.rmI = and 22 6006.0 NmIr =�=
8.01 =l 2.12 =l , mNkk 500021 == msNcc .50021 ==
If we plug in eq.(5)
06001000
)2.18.0.()5000()2.18.0(
600
5000
1000
10000 222224 =
⋅
++ �
���
�++− ωϖ
0677.166334.27 24 =+−� ϖω \
182.92
1 =�ω 151.182
2 =ω
)sec(03.31 rad=�ω )sec(26.42 rad=ω
Back sub �1 in (4)
���������� ���������������������������������������������������������������
� �
���������������������������������������������������������������������� �!��� ��� �!��� ��� �!��� ��� �!��� ���������" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&������
).(409.0
1
8.48902000
2000818
)600).(182.9()2.18.0.(5000)2.18.0.(5000
)2.18.0.(5000)1000).(182.9(10000
.)()(
)(2
1
222
1
2
2
2
121
21
2
1
ModeFirst
Illkllk
llkmk
→ �
���
�=�
�
���
�
−
−=
�
���
�
−+−
−−=
�
���
�
−+−
−−�
ϕ
ω
ω
Sub �2 in (4)
).(075.4
1
6.4902000
20008151
)600).(151.18()2.18.0.(5000)2.18.0.(5000
)2.18.0.(5000)1000).(151.18(10000
2
22
ModeSecond→ �
���
�
−�
�
���
�
−−
−−=
�
���
�
−+−
−−
ϕ
∴ Approximate Mode Shapes and Natural Frequencies
For Sedan Cars are,
�
���
�
−=�=
�
���
�=�=
075.4
1sec26.4
409.0
1sec03.3
22
11
ϕω
ϕω
rad
rad
���������� ���������������������������������������������������������������
� �
���������������������������������������������������������������������� �!��� ��� �!��� ��� �!��� ��� �!��� ���������" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&������
For an SUV we have
kgm 3000= 2/ rmI = and 2/192064.0 mNIr =→=
mNkk 1500021 == 11 =l 5.12 =l
mNcc 150021 ==
Plug the numbers in (5),
0)1920).(3000(
)5.11.()15000(.5.11(
1920
15000
3000
30000 222224 =
++ �
���
�++− ωω
014.24439.35 24 =+−� ωω
39.92
1 =→ ω , 262
2 =ω
sec064.31 rad=�ω , sec1.52 rad=ω
Back sub ω 1 in (4),
�
���
�
−
−=
�
���
�
−+−
−−
2.307217500
75001830
)1920).(39.9()5.11.(15000)5.11.(15000
)5.11.(15000)3000).(39.9(300002
�
���
�=→
244.0
11ϕ
Back sub �2 in (4),
���������� ���������������������������������������������������������������
� �
���������������������������������������������������������������������� �!��� ��� �!��� ��� �!��� ��� �!��� ���������" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&������
�
���
�
−−
−−=
�
���
�
−+−
−−
11707500
750048000
)1920).(26()5.11.(15000)5.11.(15000
)5.11.(15000)3000).(26(300002
�
���
�
−=→
4.6
12ϕ
∴ Approximate Mode Shapes and Natural Frequencies
For an SUV is:
�
���
�
−=�=
�
���
�=�=
4.6
1sec1.5
244.0
1sec06.3
22
11
ϕω
ϕω
rad
rad
Conclude:
If we vibrate a sedan and a SUV at their second Natural Frequency, the SUV is more
capable of rotating than a sedan. However, at their first Natural Frequency, the situation
is vice versa.
Important Note:
[ ] �
���
�
+−
−=
�
���
�
+−
−=
2
1
2
121
21
2
1
2
121
21 2
).().(
).(.2
llll
llk
llkllk
llkkk
���������� �����������������������������������������������������������'���
� �
���������������������������������������������������������������������� �!��� ��� �!��� ��� �!��� ��� �!��� ���������" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&������
[ ] �
���
�
+−
−=
�
���
�
+−
−=
2
1
2
121
21
2
1
2
121
21 2.
).().(
).(.2
llll
llC
llCllC
llCCC
As we can see above, the [C] matrix is a factor of [k]; so we will be able to calculate
modal C.
Modal Mass: (for sedan car)
�
���
�
−=
075.4409.0
11ϕ ,
�
���
�=
6000
01000M
[ ] [ ][ ] �
���
�==
�
���
�
109630
01100..
0
0
2
1 ϕϕ mm
m T
kgm 11001 =� , kgm 109632 =
Modal Damping: (sedan)
[ ] [ ][ ] [ ] �
���
�
−
−==
�
���
�
1090200
2001000,..
0
0
2
1CC
C
C Tϕϕ
�
���
�=
�
���
��
199000
01010
0
0
2
1
C
C
msNC .10101 =� , msNC .199002 =
Modal Stiffness: (sedan)
[ ] [ ][ ] [ ] �
���
�
−
−==
�
���
�
104002000
200010000,..
0
0
2
1km
k
k Tϕϕ
�
���
�=
�
���
��
1990000
010100
0
0
2
1
k
k
mNk .101001 = mNk .1990002 =
∴ Our uncoupled System is,
[ ] �
���
�=
�
���
�
2
1.
η
ηϕ
θ
x
���������� �����������������������������������������������������������(���
� �
���������������������������������������������������������������������� �!��� ��� �!��� ��� �!��� ��� �!��� ���������" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&������
��
�
=++
=++
)_(mod..
)_(mod..
2222
.
22
..
2
111
.
11
..
11
forcealFkCm
forcealFkCm
ηηη
ηηη
m1, c1, k1, m2, k2, c2, are already calculated. We should find only F1 and F2 which are
model forces.
Modal Damping: (For SUV Car)
[ ] �
���
�
−
−=
�
���
�
+−
−=
4875750
7503000
).().(
).(.2'
2
1
2
121
21
llCllC
llCCC
[ ] [ ][ ] �
���
�==
�
���
�
212800
02920'.'.'
0
0'
2
'
1 ϕϕ CC
C T
msNC .2920'
1 = , msNC .212280'
2 =
Modal Stiffness: (For SUV Car)
[ ] �
���
�
−
−=
�
���
�
+−
−=
487507500
750030000
).().(
).(.2'
2
1
2
121
21
llkllk
llkkk
�
���
�=
�
���
�
2128000
029200
0
0'
2
'
1
k
k
mNk .29200'
1 =� , mNk .2122800'
2 =
∴ Our uncoupled system is:
[ ] �
���
�=
�
���
�
2
1.
η
ηϕ
ϕ
x
��
�
=++
=++
)_(mod..
)_(mod..
'
2
'
2
.'
2
..'
2
'
1
'
1
.'
1
..'
1
forcealFkCm
forcealFkCm
ηηη
ηηη
���������� ���������������������������������������������������������������
� �
���������������������������������������������������������������������� �!��� ��� �!��� ��� �!��� ��� �!��� ���������" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&������
Calculation of Modal forces:
[ ] (6) (t)g
(t)g�
F
F
2
1T
2
1
�
���
�= �
���
�
Finding g1 and g2
f
tPtLtPtL
tPtA
D
v
D
vttUtU
D
vz
D
vttUtUz
D
vttU
D
vz
D
vttUz
zkzkzczctg
tgtg
ωπ
πππ
πππ
=
��
���
�−=→�
�
���
�−=
��
���
�−=→�
�
���
�−=
+++=
cosh )]()([ sinh )]()([
cosh )](1[ sinh )](1[
)(
)( and )( Calculate
o2o2
o1o1
221122111
21
22
1
�
�
��
V
DL
V
L
V
D
xBy
twwctwtUtUltwwctwktUltg
zlkzlczlkzlctgThe
twwctwtUtUtwwctwktUtg
twtUtUtwtUktwtUtUwctwtUwctg
ffftPtLffftP
ffftPtLffftP
ftPtLftPiftPtLfftPf
+===
+−−+−=
−−+=
+−++−=
−+−+−+−=
21
21
21
2121
PLP
222o111o2
2222221111112
22o11o1
o2oo2o11
t, t, t: codesin that Note
, , for x, solution numerical a have will weMethod, Kutta Rungein CodesVBA using
)cossink)](()([h)cossin)]((1[h)(
)(for method same
)cossink)](()([h)cossin)]((1[h)(
sinsin)]()([hksin)](1[hcos)]()([hcos )](1[h)(
θθ ��
��
���������� ���������������������������������������������������������������
� �
���������������������������������������������������������������������� �!��� ��� �!��� ��� �!��� ��� �!��� ���������" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&������
500c 5000,K , m 22.18.0L L and
bumb) theoflength and(height 1.5D m 1.0h with ) (6in put them and )( and )( calculate should weSo
21
o21
===+=+=
==
L
tgtg
sec 0.52 t sec 522.0t
sec 3.0 t sec 298.07.6
2t
sec 22.0t sec 224.07.6
5.1t
rad/sec 03.145.1
7.6 m/sec 6.7mph 15V 1)
22
11
PP
LL
PP
f
=≈=+
=
=≈===
=≈===
=×
==→==
v
DL
L
v
v
D
D
v ππω
z1, z2 vs. time
-0.02
0
0.02
0.04
0.06
0.08
0.1
0.12
0 0.1 0.2 0.3 0.4 0.5 0.6
time
z1, z2 (heig
ht, m
ete
rs)
z1
z2
���������� �����������������������������������������������������������)���
� �
���������������������������������������������������������������������� �!��� ��� �!��� ��� �!��� ��� �!��� ���������" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&������
sec 0.29 t sec 292.012
5.3t
sec 17.0 t sec 167.012
2t
sec 12.0t sec 125.012
5.1t
rad/sec 13.255.1
12 w m/sec 12 mph 27 v)2
)]03.14cos(8.841)03.14sin(600)][()([)]03.14cos(2.562)03.14sin(400)][(1[)(
)]03.14cos(5.701)03.14sin(500)][()([)]03.14cos(5.701)03.14sin(500)][(1[ )(
formula, into numbers eInsert th
22
11
PP
LL
PP
f
52.03.022.02
52.03.022.01
=≈==+
=
=≈===
=≈===
=×
==→==
+−++−=
+−++−=
v
DL
L
v
v
D
D
v
tttUtUtttUtg
tttUtUtttUtg
ππ
With this velocity the graphs for )(&)( 21 tgtg are:
g1, g2 vs. time
-2000
-1500
-1000
-500
0
500
1000
1500
0 0.1 0.2 0.3 0.4 0.5 0.6
time
g1, g2
g1
g2
���������� �����������������������������������������������������������*���
� �
���������������������������������������������������������������������� �!��� ��� �!��� ��� �!��� ��� �!��� ���������" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&������
sec 0.29 t sec 292.012
5.3t
sec 17.0 t sec 167.012
2t
sec 12.0t sec 125.012
5.1t
rad/sec 13.255.1
12 w m/sec 12 mph 27 v)2
22
11
PP
LL
PP
f
=≈==+
=
=≈===
=≈===
=×
==→==
v
DL
L
v
v
D
D
v ππ
)]44cos(2640)44sin(600)][()([)]44cos(1760)44sin(400)][(1[)(
)]44cos(2200)44sin(500)][()([)]44cos(2200)44sin(500)][(1[ )(
sec 0.16 tsec, 09.0 tsec, 07.0t
rad/sec44 wm/sec 21 mph 47 v)3
)]15.25cos(8.1507)13.25sin(600)][()([)]13.25cos(2.1005)13.25sin(400)][(1[)(
)]13.25cos(5.1256)13.25sin(500)][()([)]13.25cos(5.1256)13.25sin(500)][(1[ )(
formula, intonumber heInsert t
16.009.007.02
16.009.007.01
PLP
f
29.017.012.02
29.017.012.01
21
tttUtUtttUtg
tttUtUtttUtg
D
v
tttUtUtttUtg
tttUtUtttUtg
+−++−=
+−++−=
===
==→==
+−++−=
+−++−=
π
)(075.4)( 199000 19900 10963
)(409.0)(1010010101100
Equation" Uncoupled" have we, cases allFor
(8) )(075.4)( and )(409.0)(
)(
)(
4.075- 1
0.409 1
21222
21111
212211
2
1
2
1
tgtg
tgtg
tgtgFtgtgF
tg
tg
F
F
−=++
+=++
−=+=
�
���
� �
���
�=
�
�
���
�
′
ηηη
ηηη
���
���
���������� �����������������������������������������������������������+���
� �
���������������������������������������������������������������������� �!��� ��� �!��� ��� �!��� ��� �!��� ���������" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&������
General solution
[ ]
213.02
,10963m ,26.4
151.02
,1100m ,03.3
2.1
)(sin)(1
0BA have wezero, is condition initial that assuming
][
B ,
][
A
1 w
(7) )(sin)(1
]sin)(cos[
22
2222
11
1111
0
kk
0
0
k
0
0
k
2
dk
0
≈===
≈===
=
−′×
=�
==
×
�
�
���
�××Φ
=
�
���
�××Φ
=
−=
−′+++=
�
�−
wm
cw
wm
cw
k
dtweFmw
By
mw
xm
m
xm
wWhere
dtweFwm
ww
AwBtwAe
dk
t
Aw
k
kdk
k
kdk
T
k
k
T
kk
dk
t
Aw
k
dkk
dk
dk
kwkkdkk
tw
k
kwk
kwkkk
ξ
ξ
τττη
ϑϑ
ξ
τττξ
η
ξ
ξξ
�
�
rad/sec 16.4-1
rad/sec 99.2-1
2
222
2
111
==
==
ξ
ξ
ww
wwand
d
d
[ ]
21
21
2
1
2
1
21
0
9.0
22
0
46.0
11
4.075409.0
4.075- 0.409
1 1
advised are solutions
numerical theso evluated, be todcomplecate so isit MATLABin even but integral thosecalculatedcan we
(t)F (t),F different if caused which speed different with (9)in (8) from
)(16.4sin)(45606
1
(9) )(99.2sin)(328
1
ηηθ
ηη
η
η
η
η
θ
η
η
−=
+=�
�
���
� �
���
�=
�
���
�Φ=
�
���
�
−=
−=
�
�
−
−
x
x
Substitude
dzztezF
dzztezF
t
z
t
z
���������� ���������������������������������������������������������������
� �
���������������������������������������������������������������������� �!��� ��� �!��� ��� �!��� ��� �!��� ���������" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&������
Differential Equation of Motion Using Lagrange Eq
22112211221121221121
111221122
222211111
22211122211122221111
1122
1122
2
1
21
2
11
2
22
2
11
2
22
2
0
)()()()(
)()()()(
)()(
)()(
)()( 0
t : .
t )2
t )1
)(2
1)(
2
1
)(2
1)(
2
1
2
1T
zkzkzczclklkxkklclcxccxm
Qlxklxklxclxcxm
zkzczkzcQ
zlkzlkzlczlcxzkzczkzcw
lxklxkx
V
lxclxcx
R
x
T
xmx
Txm
x
Tequationx
QVRTT
Qx
V
x
R
x
T
x
T
QxQw
lxclxcR
lxklxkV
Ixm
+++=−+++−+++
=++−+++−+
+++=�
−+−+∂+++=∂
++−=∂
∂
++−=∂
∂=
∂
∂
=��
���
�
∂
∂
∂
∂→=
∂
∂
=∂
∂+
∂
∂+
∂
∂−��
���
�
∂
∂
∂
∂
=∂
∂+
∂
∂+
∂
∂−��
���
�
∂
∂
∂
∂
∂+∂=∂
++−=
++−=
+=
������
������
��
����
�����
���
��
��
��
����
��
θθ
θθθθ
θθ
θθ
θθθθ
θ
θθ
θθ
θ
���������� ���������������������������������������������������������������
� �
���������������������������������������������������������������������� �!��� ��� �!��� ��� �!��� ��� �!��� ���������" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&������
222111222111
2
22
2
112211
2
11
2
222211
2221112221111
111222
111222
22112211221121221121
111221122
))()()(
)()(
)( )( - 0
t : .
)()()()(
)()()()(
zlkzlkzlczlclklckxlklklclcxlclcI
zlkzlkzlczlcQand
lxlklxlkV
lxlclxlcRT
IT
IT
equation
zkzkzczclklkxkklclcxccxm
Qlxklxklxclxcxm
−+−=++−+++−++�
−+−=
++−−=∂
∂
++−=∂
∂=
∂
∂
=��
���
�
∂
∂
∂
∂→=
∂
∂
+++=−+++−+++
=++−+++−+
������
��
�����
���
���
������
������
θθθ
θθθ
θθθθ
θθ
θθ
θ
θθ
θθθθ
Put them in matrix format:
�
���
� �
���
�
+−
−++
�
�
��
�
� �
���
�
+−
−+
�
�
��
�
� �
���
�
θθθ
x
lklklklk
lklkkkx
lclclclc
lclccx
I
m...
0
02
11
2
222211
221121.
.
2
11
2
222211
22111..
..
�
�
��
�
�
−+−
+++=
2221112
.
221
.
11
22112
.
21
.
1
zlkzlkzlczlc
zkzkzczc
���������� ���������������������������������������������������������������
� �
���������������������������������������������������������������������� �!��� ��� �!��� ��� �!��� ��� �!��� ���������" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&������
Differential Equation of Motion 4DOF (linear)
2
2111
2
3212
2
124
2
233
2
2111
2
3212
2
22
2
33
2
0
2
1
)(2
1)(
2
1
)(2
1)(
2
1)(
2
1)(
2
1
2
1
2
1
2
1T
xlxcxlxcR
zxkzxkxlxkxlxkV
xmxmIxm
������
����
−++−−=
−+−+−++−−=
+++=
θθ
θθ
θ
0t
)4
0t
)3
0t
)2
0t
)1
,any havet don' weso energy, potential in the , bring wecase this
3333
2222
1111
2121
=∂
∂+
∂
∂+
∂
∂−���
����
�
∂
∂
∂
∂
=∂
∂+
∂
∂+
∂
∂−���
����
�
∂
∂
∂
∂
=∂
∂+
∂
∂+
∂
∂−��
���
�
∂
∂
∂
∂
=∂
∂+
∂
∂+
∂
∂−���
����
�
∂
∂
∂
∂
x
V
x
R
x
T
x
T
x
V
x
R
x
T
x
T
VRTT
x
V
x
R
x
T
x
T
QQzzIn
��
��
��
��
θθθθ
���������� �����������������������������������������������������������'���
� �
���������������������������������������������������������������������� �!��� ��� �!��� ��� �!��� ��� �!��� ���������" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&������
0)(
0)())(())(( )4
0)(
0)())(())(( )3
0)()()()(
0)())(()())(( )2
0)()()()(
0)()()()( )1
23221233222123233
2333212321233
14111124111112122
1242111211222
32221112211
2
22
2
1132221112211
2
11
2
22
21111321222111132122
322122111213221221112111
211132122111321211
=−+−+++−+
=−+−−−+−−−+
=−−−++−−+
=−+−+−+−+−+
=+−−++++−−+++
=−++−−−+−++−−−+
=−−−+++−−−+++
=−++−−+−++−−+
zklkxkxkklcxcxcxm
zxkxlxkxlxcxm
zklkxkxkklcxcxcxm
zxkxlxkxlxcxm
xlkxlkxlklklklkxlcxlcxlclclclcI
xlxlkxlxlkxlxlcxlxlcI
xkxklklkxkkxcxclclcxccxm
xlxkxlxkxlxcxlxcxm
θθ
θθ
θθ
θθ
θθθ
θθθθθ
θθ
θθθθ
�����
�����
�����
�����
������
��������
������
��������
Put them in matrix format:
s. variablestateeight have wecase In this :
0
0 x
k 0 k-
0 - k-
-
c 0 c-
0 c -
-
m 0 0 0
0 m 0 0
0 0 I 0
0 0 0
23
14
3
2
1
222 2
111 1
2211
2
22
2
112211
21221121
3
2
1
2222
1111
2211
2
22
2
112211
21221121
3
2
1
3
2
1
Note
zk
zk
x
x
lk
klk
lklklklklklk
kklklkkk
x
x
x
lc
lcc
lclclclclclc
cclclccc
x
x
xm
�
�
����
�
�
=
�
�
�����
�
�
�
�
�����
�
�
+−
−−−+
+
�
�
�����
�
�
�
�
�����
�
�
−
+−
−−−+
+
�
�
�����
�
�
�
�
�����
�
�
θ
θθ
�
�
�
�
��
��
��
��
���������� �����������������������������������������������������������(���
� �
���������������������������������������������������������������������� �!��� ��� �!��� ��� �!��� ��� �!��� ���������" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&������
Differential Equation of Motion 2DOF (Non linear)
2
11
2
22
2
11
2
22
2
0
) .cos(2
1) .cos(
2
1
)sin(2
1)sin(
2
1
2
1T
θθθθ
θθ
θ
����
��
lxclxcR
lxklxkV
Ixm
++−=
++−=
+=
2
1
t )2
t )1
QVRTT
Qx
V
x
R
x
T
x
T
=∂
∂+
∂
∂+
∂
∂−��
���
�
∂
∂
∂
∂
=∂
∂+
∂
∂+
∂
∂−��
���
�
∂
∂
∂
∂
θθθθ ��
��
θθθ
θθθθθθθθθ
θθθθ
θθθθθθθθθθ
θθθθ
θθθθθθ
cos)()coscos(
sin)coscos()coscos()coscos(
cos cos cos cos
)sin(cos)sin(cos )cos(cos) .cos(cos )2
sin)()()coscos()(
)sin()sin() .cos() .cos( )1
2221112221112211
2
22
2
112211
22
11
22
22
2221112221112
2111222111222
22112211221121221121
2211221111221122
zlkzlkzlczlcxlklk
lklkxlclclclcI
zlkzlkzlczlcQwhere
QlxlklxlklxlclxlcI
zkzkzczclklkxkklclcxccxm
zkzkzczclxklxklxclxcxm
−+−=−+
++−+++�
−+−=
=++−−++−−
+++=−+++−+++�
+++=++−+++−+
��
����
��
������
������
��������
Note: The damping constant is also Non-linear, but we assume that it is linear
���������� ���������������������������������������������������������������
� �
���������������������������������������������������������������������� �!��� ��� �!��� ��� �!��� ��� �!��� ���������" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&������
Calculating X(t), θ( θ( θ( θ(t) with Laplace Method
�
���
�=
�
���
�
�
�
���
�
+−
−++
�
���
�
�
�
���
�
+−
−++
�
���
� �
���
�
)(
)(gx
I 0
0
2
1
2
22
2
112211
2211211
2
22
2
112211
22112111
tg
t
lklklklk
lklkkkx
lclclclc
lclcccxm
θθθ �
�
��
��
��
���
��
�
=+++++Χ−+−
=−+−+Χ++++�
====
)]([ )]()s(Is [ ])([
)]([g ])[( )]()([
0)0()0( ,0)0()0( :
2
2
22
2
11
2
22
2
11
2
22112211
1221122112121
2
tgLlklklclclklkslclc
tLlklkslclckksccms
xxassume
θ
θ
θθ��
�
�
���
�
++++−+−
−+−++++
�
���
�
++++
−+−
=Χ�
)()s(Is )()(
)()( )()(
)()s(Is )]([
)()( )]([g
2
22
2
11
2
22
2
11
2
22112211
221122112121
2
2
22
2
11
2
22
2
11
2
2
221122111
lklklclclklkslclc
lklkslclckksccmsDet
lklklclctgL
lklkslclctLDet
�
�
���
�
++++−+−
−+−++++
�
���
�
−+−
++++
=
)()s(Is )()(
)()( )()(
)]([ )()(
)]([g )()(
2
22
2
11
2
22
2
11
2
22112211
221122112121
2
222112211
12121
2
lklklclclklkslclc
lklkslclckksccmsDet
tgLlklkslclc
tLkksccms
θ
Note: It is obvious that for solution we must have ay least one of the “Non-
zero initial condition Or Force (displacement) excitation
By taking an inverse, we will find the solution; however this method usually
is not easy.
���������� ���������������������������������������������������������������
� �
���������������������������������������������������������������������� �!��� ��� �!��� ��� �!��� ��� �!��� ���������" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&������
Calculating X(t), θ( θ( θ( θ(t) with Numerical method
Runge Kutta (4)
The general format of Runge Kutta method is based on state variables;
however the formulation of this method is provided:
),...,,( 2111
myyytft
y=
∂
∂
),..,,( 2112
myyytft
y=
∂
∂
),...,,( 212 mm yyytft
y=
∂
∂
6
22 )(,4)(,3)(,2)(,1
)(,)1(,
mmmm
imim
kkkkyy
++++=+
“m” represent the number of state variables
For example:
2var:
2var:
2var:
2var:
42,4
32,3
22,2
12,1
iablestatekk
iablestatekk
iablestatekk
iablestatekk
→
→
→
→
),,(*
),2
,2
(*
2,
2,
2(*
),,(*
2,3)(21,3)(,111,4
2,3)(2
1,3
)(,111,3
2,1
)(2
1,1
)(111,2
)(2)(111,1
kykyhtfhk
kyk
yh
tfhk
ky
ky
htfhk
yytfhk
iii
iii
iii
iii
+++=
+++=
+++=
=
Note: The main point is to finding the State variables
1var:
1var:
1var:
1var:
41,4
31,3
21,2
11,1
iablestatekk
iablestatekk
iablestatekk
iablestatekk
→
→
→
→
���������� �����������������������������������������������������������)���
� �
���������������������������������������������������������������������� �!��� ��� �!��� ��� �!��� ��� �!��� ���������" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&������
State variables for 2DOF (linear)
4321
33
2
22
2
11122114
2
11
2
22222114
122211121422112212
4321
2222111222111
122112211
222111222111
2
22
2
112211
2
11
2
222211
22112211221121221121
y y , y
)(y)()(y)(y)(y
)(y )()(y)(y)(y
y y y
)(
)( :
))()()(
)()()()(
==
=++−+++−+
=−+++−+++
====
=−+−
=+++
−+−=++−+++−+
+++=−+++−+++
��
�
�
��
��
��
������
������
y
tglklkylklklclclclcI
tglklkykklclcccm
xxy
tgzlkzlkzlczlc
tgzkzkzczcAssume
zlkzlkzlczlclklckxlklklclcxlclcI
zkzkzczclklkxkklclcxccxm
θθ
θθθ
θθ
In this case we have four state variables
AMatrix
)(
0
)(
0
y
y
y
- )(
- )(
- )(
-
1 0 0 0
)(
- )(
- )(
- )(
-
0 0 1 0
y
y
y
2
1
4
3
2
1
2
22
2
11
2
22
2
1122112211
221122112121
4
3
2
1
�
�
������
�
�
+
�
�
�����
�
�
�
�
�������
�
�
++−−
−−++
=
�
�
�����
�
�
Itg
mtg
y
I
lclc
I
lklk
I
lclc
I
lklk
m
lclc
m
lklk
m
cc
m
kky
�
�
�
�
Each line gives us one gradient function
���������� �����������������������������������������������������������*���
� �
���������������������������������������������������������������������� �!��� ��� �!��� ��� �!��� ��� �!��� ���������" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&������
With previous state variable and using runge kutta method the solution is:
(Note: the related code is available in appendix)
linear silution v=6.7 m/sec runge kutta method
-0.15
-0.1
-0.05
0
0.05
0.1
0.15
0 0.1 0.2 0.3 0.4 0.5 0.6
time
x
Series1
linear solution with runge kutta v=6.7 m/sec
-0.15
-0.1
-0.05
0
0.05
0.1
0.15
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7
time
Teth
a
Series1
���������� �����������������������������������������������������������+���
� �
���������������������������������������������������������������������� �!��� ��� �!��� ��� �!��� ��� �!��� ���������" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&������
State variables for 2DOF (non linear)
θθθ
θθθθθθθθθ
θθθθ
cos)()coscos(
sin)coscos()coscos()coscos( )2
sin)()()coscos()( )1
2221112221112211
2
22
2
112211
22
11
22
22
22112211221121221121
zlkzlkzlczlcxlklk
lklkxlclclclcI
zkzkzczclklkxkklclcxccxm
−+−=−+
++−+++
+++=−+++−+++
��
����
������
We have four state variables in this case.
32221112221113
33
2
223
2
11232231143
22
223
22
11
4
221122111
1322111214322311221
2
13221112143223112212
4
3
432
211
ycos)()(g :
ysin)ycosycos()ycosycos()ycosycos(
)( :
)(ycos)(y)()ycosycos()(y
)(ycos)(y)()ycosycos()(ym )2
y 3) y
y 1) y
Variables
zlkzlkzlczlctwhere
I
lklkylclcylclcy
zkzkzczctgwhere
m
tglklkkkylclcycc
tglklkkkylclcycc
y
y
yx
yx
State
−+−=
++−++−=
+++=
+−−+−−−+−=�
=−+++−+++
=
=
==
==
��
�
��
�
�
�
�
�
θ
θ
The graphs are in the next page
���������� ����������������������������������������������������������'����
� �
���������������������������������������������������������������������� �!��� ��� �!��� ��� �!��� ��� �!��� ���������" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&������
nonlinear v=6.7 runge kutta
-0.15
-0.1
-0.05
0
0.05
0.1
0.15
0 0.1 0.2 0.3 0.4 0.5 0.6
time
X
Series1
nonlinear
-0.15
-0.1
-0.05
0
0.05
0.1
0.15
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7
time
teth
a
Series1
���������� ����������������������������������������������������������'����
� �
���������������������������������������������������������������������� �!��� ��� �!��� ��� �!��� ��� �!��� ���������" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&������
Sample of Excel worksheet:
����������� ������ ��� ���������� � �
��� ����� ���������� ���������� � �
��� ����� ���������� ������ �� � �
��� ����� ��������� ���������� � �
��� ���� � ��������� ������ �� � �
�� ���� ��������������� � �
�� ���� ���������� � �
�� �� ������ ������� � �
�� �� � �����������!���� � �
�� ��"� ������������������� � �
�� ��� ��������� �������� � �
���� �� #�� � �
���� �� #$���������� ������ � �
���� �� ���� �� � �
���� �� ���� $���������� ������ � �
�� ����� % ��� � �
��� ���� & ��!������� ����� � �
�� � '���������!������� � �
��� �� ����� ������� � �
��� ��� � ���������� � �
� � � � �
� �� �!"��������� ���
�����#�$� %� %!���� ������ �����!����
�� �� �� �� ��
��� � �� �()�)"�*� $*�*��*�+$��� �� �( *�(�� ���**�*+$���
����� �� **�*��"*� ������**"�"� �� � *������ �� �(�("*���
���*� �� *�("*)""� ���* ��(� �� ���)��(��)�� �� ��(�))""�
���(� �� ����"�� � ���**( ��((� ���)(��"��� ���)�*" (���
����� �� ��**�)�� ���*�(�*""�� ���"�)))*) � ���)��"��(��
����� �� �*)) ���� ����"("� ()� �������(���� ���")�()��"�
����� ���"�� ("*"� ������(���"� ����*�"�)((� ����"��("��
���"� ����**((� (� ���� )(**�*� ���(� ��( � ����*)������
���)� ���*"*)((� ��� �����(�� ����� ("� �� ���(�"�� (��
�� � ��� ���"**� ��� �)���( � �����)�""�"� ������*(�( �
���������� ����������������������������������������������������������'����
� �
���������������������������������������������������������������������� �!��� ��� �!��� ��� �!��� ��� �!��� ���������" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&������
VBA codes:
Option Base 1 Function u_tp1(t_in, t_p1)
If t_in >= t_p1 Then
u_tp1 = 1
ElseIf t_in < t_p1 Then
u_tp1 = 0
End If
End Function
Function u_tp2(t_in, t_p2)
If t_in >= t_p2 Then
u_tp2 = 1
ElseIf t_in < t_p2 Then
u_tp2 = 0
End If
End Function
Function u_tL(t_in, t_L)
If t_in > t_L Then
u_tL = 1
ElseIf t_in <= t_L Then
u_tL = 0
End If
End Function
Function u_tp(t_in, t_p1)
If t_in > t_p1 Then
u_tp = 1
ElseIf t_in <= t_p1 Then
u_tp = 0
End If
End Function
Function g_1(array_in, xin, t, dt)
Dim c_1 As Double, c_2 As Double ' damping coefficients
Dim k_1 As Double, k_2 As Double ' spring constants for suspension
k_1 = array_in(1, 1) ' spring constants for suspension
k_2 = array_in(2, 1)
c_1 = array_in(3, 1) ' damping coefficients
c_2 = array_in(4, 1)
g_1 = c_1 * z_dot1(array_in, xin, t, dt) + c_2 * z_dot2(array_in, xin, t, dt) + _
k_1 * z_1(array_in, xin, t, dt) + k_2 * z_2(array_in, xin, t, dt)
���������� ����������������������������������������������������������''���
� �
���������������������������������������������������������������������� �!��� ��� �!��� ��� �!��� ��� �!��� ���������" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&������
End Function
Function g_2(array_in, xin, t, dt)
Dim c_1 As Double, c_2 As Double ' damping coefficients
Dim k_1 As Double, k_2 As Double ' spring constants for suspension
Dim l_1 As Double, l_2 As Double
k_1 = array_in(1, 1)
k_2 = array_in(2, 1)
c_1 = array_in(3, 1)
c_2 = array_in(4, 1)
l_1 = array_in(11, 1)
l_2 = array_in(12, 1)
g_2 = c_1 * l_1 * z_dot1(array_in, xin, t, dt) - (c_2 * l_2 * z_dot2(array_in, xin, t, dt)) + _
k_1 * l_1 * z_1(array_in, xin, t, dt) - (l_2 * k_2 * z_2(array_in, xin, t, dt))
End Function
Function z_1(array_source, xin, t, dt)
Dim velocity As Double
Dim time As Double
Dim wheelbase As Double, bump_length As Double
Dim h_0 As Double
Dim tp_1 As Double
velocity = array_source(7, 1)
time = t
wheelbase = array_source(9, 1)
h_0 = array_source(10, 1)
tp_1 = tp1(array_source) 'call fucntion to calculate tp1
bump_length = array_source(19, 1)
z_1 = (1 - (u_tp1(time, tp_1))) * h_0 * _
Sin((WorksheetFunction.Pi * velocity * time) / bump_length)
End Function
Function z_2(array_source, xin, t, dt)
Dim velocity As Double
Dim time As Double
Dim wheelbase As Double, bump_length As Double
Dim h_0 As Double
Dim tL As Double, t_p2 As Double
bump_length = array_source(19, 1)
velocity = array_source(7, 1)
time = t
wheelbase = array_source(9, 1)
h_0 = array_source(10, 1)
tL = t_L(array_source)
t_p2 = tp2(array_source)
z_2 = ((u_tL(time, tL)) - (u_tp2(time, t_p2))) * _
h_0 * Sin((WorksheetFunction.Pi * velocity * time) / bump_length)
End Function
Function z_dot1(array_source, xin, t, dt)
Dim t_in As Double, t_p1 As Double 'time constants
Dim velocity As Double
Dim time As Double
���������� ����������������������������������������������������������'(���
� �
���������������������������������������������������������������������� �!��� ��� �!��� ��� �!��� ��� �!��� ���������" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&������
Dim wheelbase As Double
Dim h_0 As Double
Dim X As Variant
Dim bump_length As Double
X = xin
bump_length = array_source(19, 1)
t_in = array_source(5, 1)
t_p1 = tp1(array_source)
velocity = array_source(7, 1)
time = t
wheelbase = array_source(9, 1)
h_0 = array_source(10, 1)
z_dot1 = ((WorksheetFunction.Pi * velocity) / bump_length) * (1 - (u_tp1(time, t_p1))) _
* h_0 * Cos((WorksheetFunction.Pi * velocity * time) / bump_length)
End Function
Function z_dot2(array_source, xin, t, dt)
Dim t_in As Double, t_p1 As Double 'time constants
Dim velocity As Double
Dim time As Double
Dim wheelbase As Double
Dim h_0 As Double, bump_length As Double
Dim t_p2 As Double, tL As Double
t_in = array_source(5, 1)
t_p1 = array_source(6, 1)
velocity = array_source(7, 1)
time = t
wheelbase = array_source(9, 1)
h_0 = array_source(10, 1)
bump_length = array_source(19, 1)
t_p2 = tp2(array_source)
tL = t_L(array_source)
z_dot2 = ((WorksheetFunction.Pi * velocity) / bump_length) _
* ((u_tL(time, tL)) - (u_tp2(time, t_p2))) * h_0 * _
Cos((WorksheetFunction.Pi * velocity * time) / bump_length)
End Function
Function f_1prime(array_in, xin, t, dt)
Dim X As Variant
X = xin
f_1prime = X(1, 2)
End Function
Function f_3prime(array_in, xin, t, dt)
Dim X As Variant
X = xin
f_3prime = X(1, 4)
End Function
Function f_2prime(array_in, xin, t, dt)
Dim c_1 As Double, c_2 As Double ' damping coefficients
Dim k_1 As Double, k_2 As Double ' spring constants for suspension
Dim l_1 As Double, l_2 As Double ' lengths
���������� ����������������������������������������������������������'����
� �
���������������������������������������������������������������������� �!��� ��� �!��� ��� �!��� ��� �!��� ���������" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&������
Dim y_1 As Double, y_2 As Double
Dim y_3 As Double, y_4 As Double
Dim mass As Double
Dim X As Variant
X = xin
y_2 = X(1, 2)
k_1 = array_in(1, 1)
k_2 = array_in(2, 1)
c_1 = array_in(3, 1)
c_2 = array_in(4, 1)
l_1 = array_in(11, 1)
l_2 = array_in(12, 1)
y_1 = X(1, 1)
y_3 = X(1, 3)
y_4 = X(1, 4)
mass = array_in(17, 1)
f_2prime = -((k_1 + k_2) * y_1) / mass + (-((c_1 + c_2) * y_2) / mass) _
+ (-(k_1 * l_1 - k_2 * l_2) * y_3) / mass + (-(c_1 * l_1 - c_2 * l_2) * y_4 / mass) _
+ g_1(array_in, xin, t, dt) / mass
End Function
Function f_4prime(array_in, xin, t, dt)
Dim c_1 As Double, c_2 As Double ' damping coefficients
Dim k_1 As Double, k_2 As Double ' spring constants for suspension
Dim l_1 As Double, l_2 As Double ' lengths
Dim y_1 As Double, y_2 As Double
Dim y_3 As Double, y_4 As Double
Dim mass As Double, radius As Double
Dim inertia As Double
Dim p1 As Double, p2 As Double
Dim p3 As Double, p4 As Double, p5 As Double
Dim X As Variant
X = xin
y_2 = X(1, 2)
y_4 = X(1, 4)
k_1 = array_in(1, 1)
k_2 = array_in(2, 1)
c_1 = array_in(3, 1)
c_2 = array_in(4, 1)
l_1 = array_in(11, 1)
l_2 = array_in(12, 1)
y_1 = X(1, 1)
y_3 = X(1, 3)
mass = array_in(17, 1)
radius = array_in(18, 1)
inertia = Inertia_moment(mass, radius)
p1 = -(((k_1 * l_1) - (k_2 * l_2)) * y_1) / inertia
p2 = -(((c_1 * l_1) - (c_2 * l_2)) * y_2) / inertia
p3 = -(((k_1 * (l_1) ^ 2) - (k_2 * (l_2) ^ 2)) * y_3) / inertia
p4 = -(((c_1 * (l_1) ^ 2) - (c_2 * (l_2) ^ 2)) * y_4) / inertia
p5 = g_2(array_in, xin, t, dt) / inertia
f_4prime = p1 + p2 + p3 + p4 + p5
End Function
Function tp1(array_in)
���������� ����������������������������������������������������������'����
� �
���������������������������������������������������������������������� �!��� ��� �!��� ��� �!��� ��� �!��� ���������" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&������
Dim D As Double, v As Double
D = array_in(19, 1) 'length of bump
v = array_in(7, 1)
tp1 = D / v
End Function
Function t_L(array_in)
Dim L As Double
Dim v As Double
L = array_in(9, 1) 'wheelbase
v = array_in(7, 1) 'velocity
t_L = L / v
End Function
Function tp2(array_in)
Dim L As Double
Dim v As Double
Dim D As Double
D = array_in(19, 1) 'length of bump
L = array_in(9, 1) 'wheelbase
v = array_in(7, 1) 'velocity
tp2 = (L + D) / v
End Function
Function rk_4V2(p, xin, t, dt)
Dim X As Variant, n As Double
X = xin 'row array
n = UBound(X, 2) 'number of state variables
K = K_RK4(p, xin, t, dt) 'array function
For i = 1 To n 'state variables
X(1, i) = X(1, i) + (K(1, i) + 2 * K(2, i) + 2 * K(3, i) + K(4, i)) / 6
Next i
rk_4V2 = X
End Function
Function rk_4V3(p, xin, t, dt)
Dim X As Variant, n As Double
Dim x_2 As Variant
Dim B As Variant 'matrix for forcing functions
Dim A_in As Variant 'matrix of input coefficients
Dim Resultant As Variant 'matrix holder for resultant of x-dot minus B
Dim x_out As Variant
ReDim x_out(1, 4)
X = xin 'row array; holds x-dot (gradient function) output matrix
x_2 = p
n = UBound(X, 2) 'number of state variables
K = K_RK4(p, xin, t, dt) 'array function
For i = 1 To n 'state variables
X(1, i) = X(1, i) + (K(1, i) + 2 * K(2, i) + 2 * K(3, i) + K(4, i)) / 6
Next i
���������� ����������������������������������������������������������')���
� �
���������������������������������������������������������������������� �!��� ��� �!��� ��� �!��� ��� �!��� ���������" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&������
Dim k_1 As Double, k_2 As Double
Dim c_1 As Double, c_2 As Double
Dim velocity As Double
Dim wheelbase As Double, height As Double
Dim mass As Double, radius As Double
Dim l_1 As Double, l_2 As Double
Dim bump_length As Double
Dim inertia As Double
k_1 = x_2(1, 1)
k_2 = x_2(2, 1)
c_1 = x_2(3, 1)
c_2 = x_2(4, 1)
l_1 = x_2(11, 1)
l_2 = x_2(12, 1)
mass = x_2(17, 1)
radius = x_2(18, 1)
inertia = Inertia_moment(mass, radius)
'k1 5000 spring constant, front (1, 1)
'k2 5000 spring constant, rear (1, 2)
'c1 500 damping constant, front (1, 3)
'c2 500 damping constant, rear (1, 4)
't_in 0 ?? (1, 5)
't_p1 15 ?? (1, 6)
'v 6.7 velocity (m/sec) (1, 7)
't 0.5 time (sec) (1, 8)
'L 2 wheelbase (m) (1, 9)
'h 0.1 height (of bump) (1, 10)
'l1 0.8 length (front to cg) (1, 11)
'l2 1.2 length (rear to cg) (1, 12)
'y_1 0 x0 (1, 13)
'y_2 0 x-dot (derivative) (1, 14)
'y_3 0 theta0 (1, 15)
'y_4 0 theta-dot (derivative) (1, 16)
'm 2000 mass (1, 17)
'r0 0.6 radius (1, 18)
'D 1 Length of bump (m) (1, 19)
ReDim B(1 To 1, 1 To 4)
ReDim A_in(1 To 4, 1 To 4)
ReDim Resultant(1 To 4, 1 To 1)
Dim g_one As Double
Dim g_two As Double
g_one = g_1(p, xin, t, dt)
g_two = g_2(p, xin, t, dt)
B(1, 1) = 0
B(1, 2) = g_one / mass
B(1, 3) = 0
B(1, 4) = g_two / inertia
A_in(1, 1) = 0
A_in(1, 2) = 1
A_in(1, 3) = 0
A_in(1, 4) = 1
A_in(2, 1) = -(k_1 + k_2) / mass
A_in(2, 2) = -(c_1 + c_2) / mass
A_in(2, 3) = -(k_1 * l_1 - k_2 * l_2) / mass
A_in(2, 4) = -(c_1 * l_1 - c_2 * l_2) / mass
A_in(3, 1) = 0
A_in(3, 2) = 0
A_in(3, 3) = 0
A_in(3, 4) = 1
A_in(4, 1) = -(k_1 * l_1 - k_2 * l_2) / inertia
A_in(4, 2) = -(c_1 * l_1 - c_2 * l_2) / inertia
A_in(4, 3) = -(k_1 * l_1 ^ 2 + k_2 * l_2 ^ 2) / inertia
���������� ����������������������������������������������������������'*���
� �
���������������������������������������������������������������������� �!��� ��� �!��� ��� �!��� ��� �!��� ���������" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&������
A_in(4, 4) = -(c_1 * l_1 ^ 2 + c_2 * l_2 ^ 2) / inertia
Dim step As Integer
'evaluate x-dot minus b:
For step = 1 To 4
Resultant(step, 1) = X(1, step) - B(1, step)
Next step
X = WorksheetFunction.MMult(WorksheetFunction.MInverse(A_in), Resultant)
Dim step2 As Integer
For step2 = 1 To 4
x_out(1, step2) = X(step2, 1)
Next step2
rk_4V3 = x_out
End Function
Function Inertia_moment(mass, radius)
Inertia_moment = mass * radius ^ 2
End Function
Function K_RK4(p, Xi, t, dt)
Dim X, Xt As Variant
Dim ns As Integer, i As Integer
X = Xi
Xt = Xi 'twicked x
ns = UBound(X, 2) 'number of state variable
Dim K(): ReDim K(1 To 4, 1 To ns)
Dim F(): ReDim F(1 To 1, 1 To ns)
Dim FT(): ReDim FT(1 To 1, 1 To ns)
F = Fbar(p, X, t, dt)
For i = 1 To ns 'Calculate all K1 values
K(1, i) = F(1, i) * dt 'basically same as Euler
Next i
'-------------------------------------------
For i = 1 To ns
Xt(1, i) = X(1, i) + K(1, i) / 2
Next i
FT = Fbar(p, Xt, t + dt / 2, dt)
For i = 1 To ns 'Calculate all K2 values
K(2, i) = FT(1, i) * dt 'basically same as Euler
Next i
'--------------------------
For i = 1 To ns
Xt(1, i) = X(1, i) + K(2, i) / 2
Next i
FT = Fbar(p, Xt, t + dt / 2, dt)
For i = 1 To ns 'Calculate all K3 values
K(3, i) = FT(1, i) * dt 'basically same as Euler
Next i
'---------------------------------------------
For i = 1 To ns
Xt(1, i) = X(1, i) + K(3, i)
Next i
FT = Fbar(p, Xt, t + dt, dt)
For i = 1 To ns 'Calculate all K4 values
K(4, i) = FT(1, i) * dt 'basically same as Euler
Next i
���������� ����������������������������������������������������������'+���
� �
���������������������������������������������������������������������� �!��� ��� �!��� ��� �!��� ��� �!��� ���������" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&������
'-------------------------------------
K_RK4 = K
End Function
Function Fbar(p, Xi, t, dt)
Dim X As Variant
Dim ns As Integer
X = Xi
ns = UBound(X, 2) 'number of state variables
Dim F(): ReDim F(1 To 1, 1 To ns)
F(1, 1) = f_1prime(p, X, t, dt)
F(1, 2) = f_2prime(p, X, t, dt)
F(1, 3) = f_3prime(p, X, t, dt)
F(1, 4) = f_4prime(p, X, t, dt)
Fbar = F
End Function
Function Euler(p, Xi, t, dt)
Dim ns As Integer, i As Integer
Dim x_2 As Variant
Dim X As Variant 'state vector
Dim F As Variant 'state gradient vector-column topology
Dim x_out As Variant
Dim D_Identity As Variant
ReDim D_Identity(1 To 4, 1 To 4)
ReDim x_out(1, 4)
X = Xi 'Initial State - assume row topology
ns = UBound(X, 2) 'number of state variables
x_2 = p
F = Fbar(p, X, t, dt)
For i = 1 To ns 'state variables
X(1, i) = X(1, i) + F(1, i) * dt 'Eulers Eqn
Next i
'X(1, 1) = f_1prime(p, Xi, t, dt)
'X(1, 2) = f_2prime(p, Xi, t, dt)
'X(1, 3) = f_3prime(p, Xi, t, dt)
'X(1, 4) = f_4prime(p, Xi, t, dt)
Dim k_1 As Double, k_2 As Double
Dim c_1 As Double, c_2 As Double
Dim velocity As Double
Dim wheelbase As Double, height As Double
Dim mass As Double, radius As Double
Dim l_1 As Double, l_2 As Double
Dim bump_length As Double
Dim inertia As Double
k_1 = x_2(1, 1)
k_2 = x_2(2, 1)
c_1 = x_2(3, 1)
c_2 = x_2(4, 1)
l_1 = x_2(11, 1)
l_2 = x_2(12, 1)
mass = x_2(17, 1)
radius = x_2(18, 1)
inertia = Inertia_moment(mass, radius)
���������� ����������������������������������������������������������(����
� �
���������������������������������������������������������������������� �!��� ��� �!��� ��� �!��� ��� �!��� ���������" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&��" # �� ��$��%���������&������
ReDim B(1 To 1, 1 To 4)
ReDim A_in(1 To 4, 1 To 4)
ReDim Resultant(1 To 4, 1 To 1)
Dim g_one As Double
Dim g_two As Double
g_one = g_1(p, xin, t, dt)
g_two = g_2(p, xin, t, dt)
B(1, 1) = 0
B(1, 2) = g_one / mass
B(1, 3) = 0
B(1, 4) = g_two / inertia
A_in(1, 1) = 0
A_in(1, 2) = 1
A_in(1, 3) = 0
A_in(1, 4) = 1
A_in(2, 1) = -(k_1 + k_2) / mass
A_in(2, 2) = -(c_1 + c_2) / mass
A_in(2, 3) = -(k_1 * l_1 - k_2 * l_2) / mass
A_in(2, 4) = -(c_1 * l_1 - c_2 * l_2) / mass
A_in(3, 1) = 0
A_in(3, 2) = 0
A_in(3, 3) = 0
A_in(3, 4) = 1
A_in(4, 1) = -(k_1 * l_1 - k_2 * l_2) / inertia
A_in(4, 2) = -(c_1 * l_1 - c_2 * l_2) / inertia
A_in(4, 3) = -(k_1 * l_1 ^ 2 + k_2 * l_2 ^ 2) / inertia
A_in(4, 4) = -(c_1 * l_1 ^ 2 + c_2 * l_2 ^ 2) / inertia
D_Identity(1, 1) = 1
D_Identity(1, 2) = 0
D_Identity(1, 3) = 0
D_Identity(1, 4) = 0
D_Identity(2, 1) = 0
D_Identity(2, 2) = 1
D_Identity(2, 3) = 0
D_Identity(2, 4) = 0
D_Identity(3, 1) = 0
D_Identity(3, 2) = 0
D_Identity(3, 3) = 1
D_Identity(3, 4) = 0
D_Identity(4, 1) = 0
D_Identity(4, 2) = 0
D_Identity(4, 3) = 0
D_Identity(4, 4) = 1
Dim step As Integer
'evaluate x-dot minus b:
For step = 1 To 4
Resultant(step, 1) = X(1, step) - B(1, step)
Next step
X = WorksheetFunction.MMult(WorksheetFunction.MInverse(A_in), Resultant)
Dim step2 As Integer
For step2 = 1 To 4
x_out(1, step2) = X(step2, 1)
Next step2
Euler = x_out
End Function