You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The example below further extends the example from above by adding wheels to the suspension system. The excitation is not modeled as a time-varying surface profile, provided through the `surface` argument to the [`SlippingWheel`](@ref) component.
274
-
The connection between the wheels and the ground form two kinematic loops together with the `body_upright` joint, we thus set both wheels to be cut joints using `iscut=true`.
272
+
The connection between the wheels and the ground form two kinematic loops together with the `body_upright` joint, we thus set all wheels to be cut joints using `iscut=true`. We start by adding a wheel to the quarter-car setup and then to the half-car setup.
273
+
274
+
### Quarter car
275
275
```@example suspension
276
276
@mtkmodel ExcitedWheelAssembly begin
277
277
@structural_parameters begin
278
278
mirror = false
279
+
iscut = true
279
280
end
280
281
@parameters begin
281
282
rod_radius = 0.02
282
-
amplitude = 0.1, [description = "Amplitude of wheel displacement"]
283
+
amplitude = 0.02, [description = "Amplitude of wheel displacement"]
283
284
freq = 2, [description = "Frequency of wheel displacement"]
284
285
end
285
286
begin
@@ -297,7 +298,7 @@ The connection between the wheels and the ground form two kinematic loops togeth
297
298
x0 = 0.0,
298
299
z0 = 0.0,
299
300
der_angles = [0, 0, 0],
300
-
iscut = true,
301
+
iscut = iscut,
301
302
# Note the ParentScope qualifier, without this, the parameters are treated as belonging to the wheel.wheel_joint component instead of the ExcitedWheelAssembly
302
303
surface = (x,z)->ParentScope(ParentScope(amplitude))*(sin(2pi*ParentScope(ParentScope(freq))*t)), # Excitation from a time-varying surface profile
303
304
)
@@ -307,9 +308,51 @@ The connection between the wheels and the ground form two kinematic loops togeth
307
308
connect(wheel.frame_a, suspension.r123.frame_ib)
308
309
connect(chassis_frame, suspension.chassis_frame)
309
310
end
311
+
end
312
+
313
+
314
+
@mtkmodel SuspensionWithExcitationAndMass begin
315
+
@parameters begin
316
+
ms = 1500/4, [description = "Mass of the car [kg]"]
317
+
rod_radius = 0.02
318
+
end
319
+
@components begin
320
+
world = W()
321
+
mass = Body(m=ms, r_cm = 0.5DA*normalize([0, 0.2, 0.2*sin(t5)]))
sol = solve(prob, Rodas5P(autodiff=false), initializealg = BrownFullBasicInit()) # FBDF is inefficient for models including the `SlippingWheel` component due to the discontinuous second-order derivative of the slip model
Copy file name to clipboardExpand all lines: ext/Render.jl
+5-2Lines changed: 5 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -82,7 +82,10 @@ mutable struct CacheSol
82
82
last_t::Float64
83
83
functionCacheSol(model, sol)
84
84
vars =get_all_vars(model) |> unique
85
-
Main.vars = vars
85
+
# Main.vars = vars
86
+
# @show length(vars)
87
+
# filter!(v->ModelingToolkit.SymbolicIndexingInterface.is_variable(sol, v), vars) # To work around https://github.com/SciML/ModelingToolkit.jl/issues/3065
88
+
# @show length(vars)
86
89
values =sol(0.0, idxs=vars)
87
90
new(model, sol, Dict(vars .=> values), vars, 0)
88
91
end
@@ -768,7 +771,7 @@ function render!(scene, ::Union{typeof(Spring), typeof(SpringDamperParallel)}, s
Copy file name to clipboardExpand all lines: src/PlanarMechanics/components.jl
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -499,7 +499,7 @@ end
499
499
500
500
Returns a point-symmetric Triple S-Function
501
501
502
-
A point symmetric interpolation between points `(0, 0), (x_max, y_max) and (x_sat, y_sat)`, provided `x_max < x_sat`. The approximation is done in such a way that the 1st function's derivative is zero at points `(x_max, y_max)` and `(x_sat, y_sat)`. Thus, the 1st function's derivative is continuous for all `x`. The higher derivatives are discontinuous at these points.
502
+
A point symmetric interpolation between points `(0, 0), (x_max, y_max) and (x_sat, y_sat)`, provided `x_max < x_sat`. The approximation is done in such a way that the function's 1st derivative is zero at points `(x_max, y_max)` and `(x_sat, y_sat)`. Thus, the function's 1st derivative is continuous for all `x`. The higher derivatives are discontinuous at these points.
503
503
504
504
```
505
505
x_max = 0.2
@@ -546,7 +546,7 @@ end
546
546
547
547
Returns a S-shaped transition
548
548
549
-
A smooth transition between points `(x_min, y_min)` and `(x_max, y_max)`. The transition is done in such a way that the 1st function's derivative is continuous for all `x`. The higher derivatives are discontinuous at input points.
549
+
A smooth transition between points `(x_min, y_min)` and `(x_max, y_max)`. The transition is done in such a way that the function's 1st derivative is continuous for all `x`. The higher derivatives are discontinuous at input points.
Copy file name to clipboardExpand all lines: src/wheels.jl
+11Lines changed: 11 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -269,6 +269,9 @@ end
269
269
270
270
Joint for a wheel with slip rolling on a surface.
271
271
272
+
!!! tip "Integrator choice"
273
+
The slip model contains a discontinuity in the second derivative at the transitions between adhesion and sliding. This can cause problems for integrators, in particular BDF-type integrators.
274
+
272
275
# Parameters
273
276
- `radius`: Radius of the wheel
274
277
- `vAdhesion_min`: Minimum adhesion velocity
@@ -277,6 +280,7 @@ Joint for a wheel with slip rolling on a surface.
277
280
- `sSlide`: Sliding slippage
278
281
- `mu_A`: Friction coefficient at adhesion
279
282
- `mu_S`: Friction coefficient at sliding
283
+
- `surface`: By default, the wheel is rolling on a flat xz plane. A function `surface = (x, z)->y` may be provided to define a road surface. The function should return the height of the road at `(x, z)`. Note: if a function that depends on parameters is provided, make sure the parameters are scoped appropriately using, e.g., `ParentScope`.
0 commit comments