@@ -41,35 +41,34 @@ BP = 129.03 / 1000
4141DE = 310.31 / 1000
4242t5 = 19.84 |> deg2rad
4343
44- @component function QuarterCarSuspension(; name, spring = true, jc = [0.5, 0.5, 0.5, 0.7], mirror = false)
44+ @component function QuarterCarSuspension(; name, spring = true, jc = [0.5, 0.5, 0.5, 0.7], mirror = false,
45+ cs = 4000, ks = 44000, rod_radius = 0.02, jr = 0.03)
4546 dir = mirror ? -1 : 1
4647 rRod1_ia = AB*normalize([0, -0.1, 0.2dir])
4748 rRod2_ib = BC*normalize([0, 0.2, 0dir])
4849
4950 pars = @parameters begin
50- cs = 4000 , [description = "Damping constant [Ns/m]"]
51- ks = 44000 , [description = "Spring constant [N/m]"]
52- rod_radius = 0.02
53- jr = 0.03 , [description = "Radius of revolute joint"]
51+ cs = cs , [description = "Damping constant [Ns/m]"]
52+ ks = ks , [description = "Spring constant [N/m]"]
53+ rod_radius = rod_radius
54+ jr = jr , [description = "Radius of revolute joint"]
5455 end
55-
5656 systems = @named begin
5757 r123 = JointRRR(n_a = n*dir, n_b = n*dir, rRod1_ia, rRod2_ib, rod_radius=0.018, rod_color=jc)
5858 r2 = Revolute(; n=n*dir, radius=jr, color=jc)
5959 b1 = FixedTranslation(radius = rod_radius, r = CD*normalize([0, -0.1, 0.3dir])) # CD
6060 chassis = FixedTranslation(r = DA*normalize([0, 0.2, 0.2*sin(t5)*dir]), render=false)
6161 chassis_frame = Frame()
6262
63+ end
6364 if spring
64- springdamper = SpringDamperParallel(c = ks, d = cs, s_unstretched = 1.3*BC, radius=rod_radius, num_windings=10)
65- end
66- if spring
67- spring_mount_F = FixedTranslation(r = 0.7*CD*normalize([0, -0.1, 0.3dir]), render=false)
68- end
69- if spring
70- spring_mount_E = FixedTranslation(r = 1.3DA*normalize([0, 0.2, 0.2*sin(t5)*dir]), render=true)
65+ more_systems = @named begin
66+ springdamper = SpringDamperParallel(c = ks, d = cs, s_unstretched = 1.3*BC, radius=rod_radius, num_windings=10)
67+ spring_mount_F = FixedTranslation(r = 0.7*CD*normalize([0, -0.1, 0.3dir]), render=false)
68+ spring_mount_E = FixedTranslation(r = 1.3DA*normalize([0, 0.2, 0.2*sin(t5)*dir]), render=true)
69+ end
70+ systems = [systems; more_systems]
7171 end
72- end
7372
7473 A = chassis.frame_b
7574 D = chassis.frame_a
@@ -98,9 +97,9 @@ t5 = 19.84 |> deg2rad
9897 return System(equations, t; name, systems)
9998end
10099
101- @component function ExcitedWheelAssembly(; name)
100+ @component function ExcitedWheelAssembly(; name, rod_radius = 0.02 )
102101 pars = @parameters begin
103- rod_radius = 0.02
102+ rod_radius = rod_radius
104103 end
105104
106105 systems = @named begin
@@ -131,10 +130,10 @@ end
131130end
132131
133132
134- @component function SuspensionWithExcitationAndMass(; name)
133+ @component function SuspensionWithExcitationAndMass(; name, rod_radius = 0.02, ms=1500/4 )
135134 pars = @parameters begin
136- ms = 1500/4 , [description = "Mass of the car [kg]"]
137- rod_radius = 0.02
135+ ms = ms , [description = "Mass of the car [kg]"]
136+ rod_radius = rod_radius
138137 end
139138
140139 systems = @named begin
@@ -155,14 +154,13 @@ end
155154end
156155
157156@named model = SuspensionWithExcitationAndMass()
158- model = complete(model)
159157ssys = multibody(model)
160158display([unknowns(ssys) diag(ssys.mass_matrix)])
161159
162160defs = [
163- model .excited_suspension.suspension.ks => 30*44000
164- model .excited_suspension.suspension.cs => 30*4000
165- model .excited_suspension.suspension.r2.phi => -0.6031*(1)
161+ ssys .excited_suspension.suspension.ks => 30*44000
162+ ssys .excited_suspension.suspension.cs => 30*4000
163+ ssys .excited_suspension.suspension.r2.phi => -0.6031*(1)
166164]
167165prob = ODEProblem(ssys, defs, (0, 2π))
168166sol = solve(prob, Rodas5P(autodiff=false), initializealg = BrownFullBasicInit())
0 commit comments