@sh.add_function(dsp, outputs=['last_gear_box_ratio'])
def calculate_last_gear_box_ratio(
r_dynamic, final_drive_ratios, engine_speed_at_max_velocity,
maximum_velocity):
"""
Calculates the gear box ratio of the last gear.
:param r_dynamic:
Dynamic radius of the wheels [m].
:type r_dynamic: float
:param final_drive_ratios:
Final drive ratios [-].
:type final_drive_ratios: dict[int, float | int]
:param engine_speed_at_max_velocity:
Engine speed at maximum velocity [RPM].
:type engine_speed_at_max_velocity: float
:param maximum_velocity:
Maximum velocity [km/h].
:type maximum_velocity: float
:return:
Gear box ratio of the last gear [-].
:return: float
"""
ratio = 3.6 * 2 * np.pi * r_dynamic * engine_speed_at_max_velocity
# noinspection PyUnresolvedReferences
ratio /= 60 * max(final_drive_ratios.items())[1] * maximum_velocity
return ratio