@sh.add_function(dsp, inputs_kwargs=True, outputs=['correct_gear'], weight=50)
def correct_gear_v2(
velocity_speed_ratios, idle_engine_speed, full_load_curve,
max_velocity_full_load_correction=float('inf')):
"""
Returns a function to correct the gear predicted according to
:func:`correct_gear_full_load`.
:param velocity_speed_ratios:
Constant velocity speed ratios of the gear box [km/(h*RPM)].
:type velocity_speed_ratios: dict[int | float]
:param idle_engine_speed:
Engine speed idle median and std [RPM].
:type idle_engine_speed: (float, float)
:param full_load_curve:
Vehicle full load curve.
:type full_load_curve: function
:param max_velocity_full_load_correction:
Maximum velocity to apply the correction due to the full load curve.
:type max_velocity_full_load_correction: float
:return:
A function to correct the predicted gear.
:rtype: callable
"""
correct_gear = CorrectGear(velocity_speed_ratios, idle_engine_speed)
correct_gear.fit_correct_gear_full_load(
full_load_curve, max_velocity_full_load_correction
)
correct_gear.fit_basic_correct_gear()
return correct_gear