@sh.add_function(dsp, outputs=['wheel_torques'])
def calculate_wheel_torques(wheel_powers, wheel_speeds, coef=30000 / math.pi):
"""
Calculates torque at the wheels [N*m].
:param wheel_powers:
Power at the wheels [kW].
:type wheel_powers: numpy.array | float
:param wheel_speeds:
Rotating speed of the wheel [RPM].
:type wheel_speeds: numpy.array | float
:return:
Torque at the wheels [N*m].
:rtype: numpy.array | float
"""
import numpy as np
with np.errstate(divide='ignore', invalid='ignore'):
torques = np.divide(wheel_powers, wheel_speeds) * coef
return np.where(wheel_speeds, torques, 0)