Motor#

class physics.models.motor.BasicMotor(vehicle_mass, road_friction, tire_radius, **kwargs)#

Bases: BaseMotor

calculate_energy_in(required_speed_kmh, gradients, drag_force, down_force, tick, **kwargs)#
Create a function which takes in array of elevation, array of wind speed, required

speed, returns the consumed energy.

Parameters:
  • required_speed_kmh (np.ndarray) – (float[N]) required speed array in km/h

  • gradients (np.ndarray) – (float[N]) gradient at parts of the road

  • drag_force (np.ndarray) – (float[N]) drag force (wind + forward velocity)

  • down_force (np.ndarray) – (float[N]) down force (negative of lift)

  • tick (float) – length of 1 update cycle in seconds

Returns:

(float[N]) energy expended by the motor at every tick

Return type:

np.ndarray

static calculate_motor_controller_efficiency(motor_angular_speed, motor_output_energy, tick)#

Calculates a NumPy array of motor controller efficiency from NumPy array of operating angular speeds and NumPy array of output power. Based on data obtained from the WaveSculptor Motor Controller Datasheet efficiency curve for a 90 V DC Bus and modelling done in MATLAB.

r squared value: 0.7431

Parameters:
  • motor_angular_speed (np.ndarray) – (float[N]) angular speed motor operates in rad/s

  • motor_output_energy (np.ndarray) – (float[N]) energy motor outputs to the wheel in J

  • tick (float) – length of 1 update cycle in seconds

:returns e_mc (float[N]) efficiency of the motor controller :rtype: np.ndarray

static calculate_motor_efficiency(motor_angular_speed, motor_output_energy, tick, *args, **kwargs)#
Calculates a NumPy array of motor efficiency from NumPy array of operating angular speeds and NumPy array

of output power. Based on data obtained from NGM SC-M150 Datasheet and modelling done in MATLAB

r squared value: 0.873

Parameters:
  • motor_angular_speed (np.ndarray) – (float[N]) angular speed motor operates in rad/s

  • motor_output_energy (np.ndarray) – (float[N]) energy motor outputs to the wheel in J

  • tick (float) – length of 1 update cycle in seconds

Returns e_m:

(float[N]) efficiency of the motor

Return type:

np.ndarray

calculate_net_force(required_speed_kmh: ndarray[Any, dtype[_ScalarType_co]], gradients: ndarray[Any, dtype[_ScalarType_co]], drag_force: ndarray[Any, dtype[_ScalarType_co]], down_force: ndarray[Any, dtype[_ScalarType_co]]) tuple[ndarray[Any, dtype[_ScalarType_co]], ndarray[Any, dtype[_ScalarType_co]]]#

Calculate the net force on the car, and the required wheel angular velocity. Currently, considers:

  1. Rolling resistance of the wheels on the road

  2. Drag force (wind + forward velocity)

  3. Acceleration force (a = F / m)

  4. Gravitational force (force to go uphill)

  5. Down force (negative of lift)

note - drag and down forces are computed outside this method and passed as parameters

Returns:

net force in N, wheel angular velocity in rad/s

class physics.models.motor.BaseMotor(**kwargs)#

Bases: ABC