@sh.add_function(
dsp, inputs=['motor_p4_front_maximum_power', 'motor_p4_front_rated_speed'],
outputs=['motor_p4_front_maximum_power_function']
)
@sh.add_function(
dsp, inputs=['motor_p4_rear_maximum_power', 'motor_p4_rear_rated_speed'],
outputs=['motor_p4_rear_maximum_power_function']
)
def define_motor_p4_maximum_power_function(
motor_p4_maximum_power, motor_p4_rated_speed):
"""
Define the maximum power function of motor P4.
:param motor_p4_maximum_power:
Maximum power of motor P4 [kW].
:type motor_p4_maximum_power: float
:param motor_p4_rated_speed:
Rated speed of motor P4 [RPM].
:type motor_p4_rated_speed: float
:return:
Maximum power function of motor P4.
:rtype: function
"""
m = 0
if motor_p4_rated_speed:
m = motor_p4_maximum_power / motor_p4_rated_speed
def _maximum_power_function(speeds):
return np.minimum(motor_p4_maximum_power, speeds * m)
return _maximum_power_function