Module: DrivingPhysics::ScalarForce
- Defined in:
- lib/driving_physics/scalar_force.rb
Class Method Summary collapse
-
.air_resistance(speed, frontal_area: FRONTAL_AREA, drag_cof: DRAG_COF, air_density: AIR_DENSITY) ⇒ Object
Resistance Forces.
- .all_resistance(speed, frontal_area: FRONTAL_AREA, drag_cof: DRAG_COF, air_density: AIR_DENSITY, rot_cof: ROT_COF, nf_mag:, roll_cof: ROLL_COF) ⇒ Object
-
.rolling_resistance(normal_force, roll_cof: ROLL_COF) ⇒ Object
normal force is not always mass * G, e.g.
- .rotational_resistance(speed, rot_cof: ROT_COF) ⇒ Object
-
.speed_resistance(speed, frontal_area: FRONTAL_AREA, drag_cof: DRAG_COF, air_density: AIR_DENSITY, rot_cof: ROT_COF) ⇒ Object
convenience methods.
Class Method Details
.air_resistance(speed, frontal_area: FRONTAL_AREA, drag_cof: DRAG_COF, air_density: AIR_DENSITY) ⇒ Object
Resistance Forces
-
air resistance aka drag aka turbulent drag depends on v^2
-
“rotatational” resistance, e.g. bearings / axles / lubricating fluids aka viscous drag; linear with v
-
rolling resistance, e.g. tire and surface deformation constant with v, depends on normal force and tire/surface properties
-
braking resistance, supplied by operator, constant with v depends purely on operator choice and physical limits as such, it is not modeled here
Note: here we only consider speed; we’re in a 1D world for now
21 22 23 24 25 26 |
# File 'lib/driving_physics/scalar_force.rb', line 21 def self.air_resistance(speed, frontal_area: FRONTAL_AREA, drag_cof: DRAG_COF, air_density: AIR_DENSITY) 0.5 * frontal_area * drag_cof * air_density * speed ** 2 end |
.all_resistance(speed, frontal_area: FRONTAL_AREA, drag_cof: DRAG_COF, air_density: AIR_DENSITY, rot_cof: ROT_COF, nf_mag:, roll_cof: ROLL_COF) ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/driving_physics/scalar_force.rb', line 53 def self.all_resistance(speed, frontal_area: FRONTAL_AREA, drag_cof: DRAG_COF, air_density: AIR_DENSITY, rot_cof: ROT_COF, nf_mag:, roll_cof: ROLL_COF) speed_resistance(speed, frontal_area: frontal_area, drag_cof: drag_cof, air_density: air_density, rot_cof: rot_cof) + rolling_resistance(nf_mag, roll_cof: roll_cof) end |
.rolling_resistance(normal_force, roll_cof: ROLL_COF) ⇒ Object
normal force is not always mass * G, e.g. aero downforce
33 34 35 |
# File 'lib/driving_physics/scalar_force.rb', line 33 def self.rolling_resistance(normal_force, roll_cof: ROLL_COF) normal_force * roll_cof end |
.rotational_resistance(speed, rot_cof: ROT_COF) ⇒ Object
28 29 30 |
# File 'lib/driving_physics/scalar_force.rb', line 28 def self.rotational_resistance(speed, rot_cof: ROT_COF) speed * rot_cof end |
.speed_resistance(speed, frontal_area: FRONTAL_AREA, drag_cof: DRAG_COF, air_density: AIR_DENSITY, rot_cof: ROT_COF) ⇒ Object
convenience methods
41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/driving_physics/scalar_force.rb', line 41 def self.speed_resistance(speed, frontal_area: FRONTAL_AREA, drag_cof: DRAG_COF, air_density: AIR_DENSITY, rot_cof: ROT_COF) air_resistance(speed, frontal_area: frontal_area, drag_cof: drag_cof, air_density: air_density) + rotational_resistance(speed, rot_cof: rot_cof) end |