def prediction_gears_gsm(
correct_gear, gear_filter, gsm, times, velocities, accelerations,
motive_powers, cycle_type=None, velocity_speed_ratios=None,
engine_coolant_temperatures=None):
"""
Predicts gears with a gear shifting model (cmv or gspv or dtgs or mgs) [-].
:param correct_gear:
A function to correct the gear predicted.
:type correct_gear: callable
:param gear_filter:
Gear filter function.
:type gear_filter: callable
:param cycle_type:
Cycle type (WLTP or NEDC).
:type cycle_type: str
:param velocity_speed_ratios:
Constant velocity speed ratios of the gear box [km/(h*RPM)].
:type velocity_speed_ratios: dict[int | float]
:param gsm:
A gear shifting model (cmv or gspv or dtgs).
:type gsm: GSPV | CMV | DTGS
:param velocities:
Vehicle velocity [km/h].
:type velocities: numpy.array
:param accelerations:
Vehicle acceleration [m/s2].
:type accelerations: numpy.array
:param times:
Time vector [s].
:type times: numpy.array, optional
:param motive_powers:
Motive power [kW].
:type motive_powers: numpy.array
:param engine_coolant_temperatures:
Engine coolant temperature vector [°C].
:type engine_coolant_temperatures: numpy.array
:return:
Predicted gears.
:rtype: numpy.array
"""
if velocity_speed_ratios is not None and cycle_type is not None:
from . import _upgrade_gsm
gsm = _upgrade_gsm(gsm, velocity_speed_ratios, cycle_type)
# noinspection PyArgumentList
gears = gsm.predict(
times, velocities, accelerations, motive_powers,
engine_coolant_temperatures,
correct_gear=correct_gear, gear_filter=gear_filter
)
return gears