@sh.add_function(dsp, outputs=['maximum_velocity'], weight=15)
def calculate_maximum_velocity_v2(
full_load_curve, final_drive_ratios, road_loads, r_dynamic,
last_gear_box_ratio):
"""
Calculates the maximum velocity 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 last_gear_box_ratio:
Gear box ratio of the last gear [-].
:type last_gear_box_ratio: float
:return:
Maximum velocity [km/h].
:return: float
"""
d = dfl.functions.calculate_maximum_velocity_v2
velocity = np.arange(d.MAX_VEL, d.MIN_VEL, -d.DELTA_VEL)
p = full_load_curve(calculate_engine_speed_at_max_velocity(
r_dynamic, final_drive_ratios, last_gear_box_ratio, velocity
))
return velocity[p > _calculate_req_power(road_loads, velocity)][0]