@sh.add_function(dsp, outputs=['last_gear_box_ratio'], weight=5)
def calculate_last_gear_box_ratio_v1(
full_load_curve, final_drive_ratios, road_loads, r_dynamic,
maximum_velocity):
"""
Calculates the gear box ratio of the last gear from full load curve.
:param full_load_curve:
Vehicle full load curve.
:type full_load_curve: function
:param final_drive_ratios:
Final drive ratios [-].
:type final_drive_ratios: dict[int, float | int]
:param road_loads:
Cycle road loads [N, N/(km/h), N/(km/h)^2].
:type road_loads: list, tuple
:param r_dynamic:
Dynamic radius of the wheels [m].
:type r_dynamic: float
:param maximum_velocity:
Maximum velocity [km/h].
:type maximum_velocity: float
:return:
Gear box ratio of the last gear [-].
:return: float
"""
d = dfl.functions.calculate_last_gear_box_ratio_v1
ratio = np.arange(d.MAX_RATIO, d.MIN_RATIO, -d.DELTA_RATIO)
p = full_load_curve(calculate_engine_speed_at_max_velocity(
r_dynamic, final_drive_ratios, ratio, maximum_velocity
))
return ratio[p > _calculate_req_power(road_loads, maximum_velocity)][0]