Class: DrivingPhysics::Tire
Overview
a Tire is a Disk with lighter density and meaningful surface friction
Constant Summary collapse
- DENSITY =
Note, this is not the density of solid rubber. This density yields a sensible mass for a wheel / tire combo at common radius and width, assuming a uniform density e.g. 25kg at 350mm R x 200mm W
0.325
Instance Attribute Summary collapse
-
#base_friction ⇒ Object
Returns the value of attribute base_friction.
-
#mu_k ⇒ Object
Returns the value of attribute mu_k.
-
#mu_s ⇒ Object
Returns the value of attribute mu_s.
-
#omega_friction ⇒ Object
Returns the value of attribute omega_friction.
-
#roll_cof ⇒ Object
Returns the value of attribute roll_cof.
Attributes inherited from Disk
#density, #env, #radius, #width
Class Method Summary collapse
-
.traction(normal_force, cof) ⇒ Object
-
the traction force opposes the axle torque / drive force thus, driving the car forward * if the drive force exceeds the traction force, slippage occurs * slippage reduces the available traction force further * if the drive force is not reduced, the slippage increases until resistance forces equal the drive force.
-
Instance Method Summary collapse
- #heat!(amount_deg_c) ⇒ Object
-
#inertial_loss(axle_torque, driven_mass:) ⇒ Object
inertial loss in terms of axle torque when used as a drive wheel.
-
#initialize(env) {|_self| ... } ⇒ Tire
constructor
A new instance of Tire.
- #net_torque(axle_torque, mass:, omega:, normal_force:) ⇒ Object
- #net_tractable_torque(axle_torque, mass:, omega:, normal_force:, static: true) ⇒ Object
-
#rolling_friction(omega, normal_force:) ⇒ Object
rolling loss in terms of axle torque.
-
#rotating_friction(omega, normal_force:) ⇒ Object
require a normal_force to be be passed in.
- #to_s ⇒ Object
-
#tractable_torque(nf, static: true) ⇒ Object
this doesn’t take inertial losses or internal frictional losses into account.
- #traction(nf, static: true) ⇒ Object
- #wear!(amount) ⇒ Object
Methods inherited from Disk
alpha, #alpha, density, #force, force, force_vector, #implied_torque, #mass, mass, #mass=, moment_of_inertia, #normal_force, rotational, rotational_inertia, #rotational_inertia, #tangential, tangential, torque_vector, volume, #volume, volume_l, #volume_l
Constructor Details
#initialize(env) {|_self| ... } ⇒ Tire
Returns a new instance of Tire.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/driving_physics/tire.rb', line 27 def initialize(env) @env = env @radius = 350/1000r # m @width = 200/1000r # m @density = DENSITY @temp = @env.air_temp @mu_s = 11/10r # static friction @mu_k = 7/10r # kinetic friction @base_friction = 5/10_000r @omega_friction = 5/100_000r # scales with speed @roll_cof = DrivingPhysics::ROLL_COF yield self if block_given? end |
Instance Attribute Details
#base_friction ⇒ Object
Returns the value of attribute base_friction.
25 26 27 |
# File 'lib/driving_physics/tire.rb', line 25 def base_friction @base_friction end |
#mu_k ⇒ Object
Returns the value of attribute mu_k.
25 26 27 |
# File 'lib/driving_physics/tire.rb', line 25 def mu_k @mu_k end |
#mu_s ⇒ Object
Returns the value of attribute mu_s.
25 26 27 |
# File 'lib/driving_physics/tire.rb', line 25 def mu_s @mu_s end |
#omega_friction ⇒ Object
Returns the value of attribute omega_friction.
25 26 27 |
# File 'lib/driving_physics/tire.rb', line 25 def omega_friction @omega_friction end |
#roll_cof ⇒ Object
Returns the value of attribute roll_cof.
25 26 27 |
# File 'lib/driving_physics/tire.rb', line 25 def roll_cof @roll_cof end |
Class Method Details
.traction(normal_force, cof) ⇒ Object
-
the traction force opposes the axle torque / drive force thus, driving the car forward
-
if the drive force exceeds the traction force, slippage occurs
-
slippage reduces the available traction force further
-
if the drive force is not reduced, the slippage increases until resistance forces equal the drive force
21 22 23 |
# File 'lib/driving_physics/tire.rb', line 21 def self.traction(normal_force, cof) normal_force * cof end |
Instance Method Details
#heat!(amount_deg_c) ⇒ Object
54 55 56 |
# File 'lib/driving_physics/tire.rb', line 54 def heat!(amount_deg_c) @temp += amount_deg_c end |
#inertial_loss(axle_torque, driven_mass:) ⇒ Object
inertial loss in terms of axle torque when used as a drive wheel
76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/driving_physics/tire.rb', line 76 def inertial_loss(axle_torque, driven_mass:) drive_force = self.force(axle_torque) force_loss = 0 # The force loss depends on the acceleration, but the acceleration # depends on the force loss. Converge the value via 5 round trips. # This is a rough way to compute an integral and should be accurate # to 8+ digits. 5.times { acc = DrivingPhysics.acc(drive_force - force_loss, driven_mass) alpha = acc / @radius force_loss = self.implied_torque(alpha) / @radius } force_loss * @radius end |
#net_torque(axle_torque, mass:, omega:, normal_force:) ⇒ Object
91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/driving_physics/tire.rb', line 91 def net_torque(axle_torque, mass:, omega:, normal_force:) # friction forces oppose omega net = axle_torque + self.rolling_friction(omega, normal_force: normal_force) + self.rotating_friction(omega, normal_force: normal_force) # inertial loss has interdependencies; calculate last # it opposes net torque, not omega sign = net / net.abs net - sign * self.inertial_loss(net, driven_mass: mass) end |
#net_tractable_torque(axle_torque, mass:, omega:, normal_force:, static: true) ⇒ Object
103 104 105 106 107 108 109 110 111 |
# File 'lib/driving_physics/tire.rb', line 103 def net_tractable_torque(axle_torque, mass:, omega:, normal_force:, static: true) net = self.net_torque(axle_torque, mass: mass, omega: omega, normal_force: normal_force) tt = self.tractable_torque(normal_force, static: static) net > tt ? tt : net end |
#rolling_friction(omega, normal_force:) ⇒ Object
rolling loss in terms of axle torque
68 69 70 71 72 73 |
# File 'lib/driving_physics/tire.rb', line 68 def rolling_friction(omega, normal_force:) return omega if omega.zero? mag = omega.abs sign = omega / mag -1 * sign * (normal_force * @roll_cof) * @radius end |
#rotating_friction(omega, normal_force:) ⇒ Object
require a normal_force to be be passed in
63 64 65 |
# File 'lib/driving_physics/tire.rb', line 63 def rotating_friction(omega, normal_force:) super(omega, normal_force: normal_force) end |
#to_s ⇒ Object
42 43 44 45 46 47 48 |
# File 'lib/driving_physics/tire.rb', line 42 def to_s [[format("%d mm x %d mm (RxW)", @radius * 1000, @width * 1000), format("%.1f kg %.1f C", self.mass, @temp), format("cF: %.1f / %.1f", @mu_s, @mu_k), ].join(" | "), ].join("\n") end |
#tractable_torque(nf, static: true) ⇒ Object
this doesn’t take inertial losses or internal frictional losses into account. input torque required to saturate traction will be higher than what this method returns
116 117 118 |
# File 'lib/driving_physics/tire.rb', line 116 def tractable_torque(nf, static: true) traction(nf, static: static) * @radius end |
#traction(nf, static: true) ⇒ Object
58 59 60 |
# File 'lib/driving_physics/tire.rb', line 58 def traction(nf, static: true) self.class.traction(nf, static ? @mu_s : @mu_k) end |
#wear!(amount) ⇒ Object
50 51 52 |
# File 'lib/driving_physics/tire.rb', line 50 def wear!(amount) @radius -= amount end |