suboptimumg.vehicle.powertrain.powertrain#

class suboptimumg.vehicle.powertrain.powertrain.Motor(vehicle_model)[source]#

Bases: object

Parameters:

vehicle_model (VehicleModel)

calculate_max_ground_force_and_motor_power(v, ratio)[source]#

Calculates force and power output by the motor.

Parameters:
  • v (float) – Velocity of the vehicle (m/s)

  • ratio (float) – Gear ratio

Returns:

  • ground_force (float) – Force at the ground (N)

  • motor_power (float) – Motor power output (W)

eval_efficiency_map(rpm, torque)[source]#

Evaluate efficiency map with edge clamping and distance penalty for OOB.

fit_efficiency_data(points, degv, degt)[source]#

Fit a 2D polynomial z = f(x, y) to data points [[x, y, z], …] Returns coefficient matrix C[i,j] for x^i y^j

get_torque_at_rpm(motor_rpm)[source]#

Get motor torque at a given RPM using piecewise function.

The torque curve has three regions: 1. Flat region (0 to fw_rpm): constant max torque 2. Linear decay (fw_rpm to max_rpm): torque decreases linearly 3. Zero region (above max_rpm): no torque

Parameters:

motor_rpm (float) – Motor RPM

Returns:

Motor torque at the given RPM (Nm)

Return type:

float

powertrain_efficiency(rpm=-1, torque=-1)[source]#

Calculates the system efficiency of the powertrain.

Uses system efficiency if it is set, otherwise uses the product of the individual efficiencies.

If velocity (v, m/s) is provided and a motor efficiency map exists, will pull that.

Returns:

System efficiency of the powertrain

Return type:

float

v_to_rpm(v, ratio)[source]#
class suboptimumg.vehicle.powertrain.powertrain.Powertrain(vehicle_model)[source]#

Bases: object

Parameters:

vehicle_model (VehicleModel)