@sh.add_function(dsp, outputs=['serial_motor_maximum_power_function'])
def define_serial_motor_maximum_power_function(
motor_p2_planetary_maximum_power_function, planetary_ratio,
motor_p1_maximum_power_function, motor_p0_maximum_power_function,
motor_p2_planetary_speed_ratio, motor_p1_speed_ratio,
motor_p0_speed_ratio):
"""
Define serial motor maximum power function.
:param motor_p2_planetary_maximum_power_function:
Maximum power function of planetary motor P2.
:type motor_p2_planetary_maximum_power_function: function
:param planetary_ratio:
Fundamental planetary speed ratio [-].
:type planetary_ratio: float
:param motor_p2_planetary_speed_ratio:
Ratio between planetary motor P2 speed and planetary speed [-].
:type motor_p2_planetary_speed_ratio: float
:param motor_p1_maximum_power_function:
Maximum power function of motor P1.
:type motor_p1_maximum_power_function: function
:param motor_p1_speed_ratio:
Ratio between motor P1 speed and engine speed [-].
:type motor_p1_speed_ratio: float
:param motor_p0_maximum_power_function:
Maximum power function of motor P0.
:type motor_p0_maximum_power_function: function
:param motor_p0_speed_ratio:
Ratio between motor P0 speed and engine speed [-].
:type motor_p0_speed_ratio: float
:return:
Serial motor maximum power function.
:rtype: function
"""
planet_f = motor_p2_planetary_maximum_power_function
from ..electrics.motors.planet import calculate_planetary_speeds_in as func
# noinspection PyMissingOrEmptyDocstring
def calculate_serial_motor_maximum_power(engine_speed, final_drive_speed):
es = np.atleast_1d(engine_speed)
ps = func(engine_speed, final_drive_speed, planetary_ratio)
# noinspection PyArgumentEqualDefault
return np.pad(
np.column_stack((
planet_f(ps * motor_p2_planetary_speed_ratio),
motor_p1_maximum_power_function(es * motor_p1_speed_ratio),
motor_p0_maximum_power_function(es * motor_p0_speed_ratio)
)), ((0, 0), (5, 0)), 'constant'
)
return calculate_serial_motor_maximum_power