Component Classes

The PyProp module contains multiple classes which can be used to model propulsion systems.

class pyprop.Battery(**kwargs)

Defines a battery.

Parameters:
  • name (str, optional) – Name of the battery to be used.
  • manufacturer (str, optional) – Manufacturer of the battery.
  • capacity (float, optional) – Capacity of the battery in mAh.
  • resistance (float, optional) – Internal resistance of the battery in Ohms.
  • voltage (float) – Nominal voltage of the battery in Volts.
  • weight (float) – Weight of the battery in ounces.
  • I_max (float) – Maximum current draw of the battery in Amps. Defaults to infinity.
  • chemistry (str) – Chemistry type of the battery.
  • cell_arrangement (tuple) – The number of series and parallel cells in the battery. The first element should be the number of series cells and the second element should be the number of parallel cells. Defaults to (0, 0).
write_to_database()

Saves this component’s information to the user database. Doing this allows the component to be used in optimization schemes that query the database.

This function will replace duplicate components (i.e. same name). The database is stored in your Python site-packages folder. The name is `user_components.db`.

class pyprop.Motor(**kwargs)

Defines an electric motor.

Parameters:
  • name (str, optional) – Name of the motor to be used.
  • manufacturer (str, optional) – Manufacturer of the motor.
  • Kv (float, optional) – Kv rating (also called the speed constant) of the motor.
  • resistance (float, optional) – DC resistance of the motor in Ohms.
  • I_no_load (float) – No-load current of the motor in amps. Defaults to 0.0
  • I_max (float) – Maximum current that can be handled by the motor in amps. Defaults to infinity.
  • gear_ratio (float, optional) – Gear ratio of the motor. A value greater than unity will correspond to the output shaft of the motor turning slower than the motor itself. Defaults to 1.0.
  • weight (float) – Weight of the motor in ounces.
write_to_database()

Saves this component’s information to the user database. Doing this allows the component to be used in optimization schemes that query the database.

This function will replace duplicate components (i.e. same name). The database is stored in your Python site-packages folder. The name is `user_components.db`.

class pyprop.ESC(**kwargs)

Defines an electronic speed controller (ESC).

Parameters:
  • name (str, optional) – Name of the ESC to be used.
  • manufacturer (str, optional) – Manufacturer of the ESC.
  • resistance (float, optional) – Equivalent “on” resistance of the ESC in Ohms.
  • I_max (float) – Maximum current that can be sourced by the ESC in amps. Defaults to infinity.
  • weight (float) – Weight of the ESC in ounces.
write_to_database()

Saves this component’s information to the user database. Doing this allows the component to be used in optimization schemes that query the database.

This function will replace duplicate components (i.e. same name). The database is stored in your Python site-packages folder. The name is `user_components.db`.

class pyprop.DatabaseFitProp(record)

Defines a propeller by database fits. Note that for this type of prop, the diameter and pitch are stored in inches.

Parameters:record (list) – SQL database record defining this prop. This class should be initialized using the pyprop.create_component_from_database() function.
diameter

Diameter of the prop in inches.

Type:float
pitch

Pitch of the prop in inches. Note that this is the pitch reported by the manufacturer. The actual propeller pitch may not be constant.

Type:float
get_advance_ratio(w, V)

Determines the advance ratio from angular velocity in rad/s and velocity in ft/s.

Parameters:
  • w (float) – Angular velocity in rad/s.
  • V (float) – Velocity in ft/s.
Returns:

Advance ratio.

Return type:

float

get_diameter()

Returns the prop diameter in feet.

get_power_coef(w, V)

Returns the power coefficient for the prop at the given angular velocity and freestream velocity.

Parameters:
  • w (float) – Angular velocity of the prop in radians per second.
  • V (float) – Freestream velocity in feet per second.
Returns:

Power coefficient.

Return type:

float

get_thrust_coef(w, V)

Returns the thrust coefficient for the prop at the given angular velocity and freestream velocity.

Parameters:
  • w (float) – Angular velocity of the prop in radians per second.
  • V (float) – Freestream velocity in feet per second.
Returns:

Thrust coefficient.

Return type:

float

get_torque_coef(w, V)

Returns the torque coefficient for the prop at the given angular velocity and freestream velocity.

Parameters:
  • w (float) – Angular velocity of the prop in radians per second.
  • V (float) – Freestream velocity in feet per second.
Returns:

Torque coefficient.

Return type:

float

get_velocity(rpm, J)

Determines the velocity from the rpm and advance ratio.

Parameters:
  • rpm (float) – Angular velocity in rpm.
  • J (float) – Advance ratio.
Returns:

Velocity in ft/s.

Return type:

float

plot_coefs(rpm_lims=[0.0, 35000.0], J_lims=[0.0, 1.4])

Plot thrust and torque coefficients as functions of rpm and advance ratio.

Parameters:
  • rpm_lims (list, optional) – Limits for plotting in rpm. Defaults to [0.0, 35000.0].
  • J_lims (list, optional) – Limits for plotting in advance ratio. Defaults to [0.0, 1.4].
class pyprop.DatabaseDataProp(record)

Defines a propeller by tabulated data. Note that for this type of prop, the diameter and pitch are stored in inches.

Parameters:record (list) – SQL database record defining this prop. This class should be initialized using the pyprop.create_component_from_database() function.
diameter

Diameter of the prop in inches.

Type:float
pitch

Pitch of the prop in inches. Note that this is the pitch reported by the manufacturer. The actual propeller pitch may not be constant.

Type:float
get_advance_ratio(w, V)

Determines the advance ratio from angular velocity in rad/s and velocity in ft/s.

Parameters:
  • w (float) – Angular velocity in rad/s.
  • V (float) – Velocity in ft/s.
Returns:

Advance ratio.

Return type:

float

get_diameter()

Returns the prop diameter in feet.

get_power_coef(w, V)

Returns the power coefficient for the prop at the given angular velocity and freestream velocity.

Parameters:
  • w (float) – Angular velocity of the prop in radians per second.
  • V (float) – Freestream velocity in feet per second.
Returns:

Power coefficient.

Return type:

float

get_thrust_coef(w, V)

Returns the thrust coefficient for the prop at the given angular velocity and freestream velocity.

Parameters:
  • w (float) – Angular velocity of the prop in radians per second.
  • V (float) – Freestream velocity in feet per second.
Returns:

Thrust coefficient.

Return type:

float

get_torque_coef(w, V)

Returns the torque coefficient for the prop at the given angular velocity and freestream velocity.

Parameters:
  • w (float) – Angular velocity of the prop in radians per second.
  • V (float) – Freestream velocity in feet per second.
Returns:

Torque coefficient.

Return type:

float

get_velocity(rpm, J)

Determines the velocity from the rpm and advance ratio.

Parameters:
  • rpm (float) – Angular velocity in rpm.
  • J (float) – Advance ratio.
Returns:

Velocity in ft/s.

Return type:

float

plot_coefs(rpm_lims=[0.0, 35000.0], J_lims=[0.0, 1.4])

Plot thrust and torque coefficients as functions of rpm and advance ratio.

Parameters:
  • rpm_lims (list, optional) – Limits for plotting in rpm. Defaults to [0.0, 35000.0].
  • J_lims (list, optional) – Limits for plotting in advance ratio. Defaults to [0.0, 1.4].
class pyprop.BladeElementProp(name, input_dict, airfoil_dict=None)

Defines the performance of a propeller using blade element theory. Note that for this type of prop, the diameter and pitch are stored in feet.

Parameters:
  • name (str) – Name of the prop.
  • input_dict (dict, str) –

    Dictionary describing the geometry of the prop. Can also be a path to a JSON file containing the same information. This dictionary should have the following structure:

    {
    “airfoils” : {
    “<AIRFOIL_NAME>” : {
    Defined according to the AirfoilDatabase input. More info at https://airfoildatabase.readthedocs.io.

    }

    }, “geometry” : {

    ”n_blades” : int
    Number of blades on the propeller.
    ”hub_radius” : float
    Radius of the center hub.
    ”weight” : float
    Weight of the prop.
    ”diameter” : float
    Diameter of the prop.
    ”geom_pitch” : float or array, optional
    Pitch length based on the geometric chord line.

    or

    ”aero_pitch” : float or array, optional
    Pitch length based on the zero-lift line.

    or

    ”twist” : float or array, optional
    Twist angle of the chord line; can be a constant float or given as an array where the first column is the fractional radial position along the blade and the second column is the local twist angle.
    ”chord” : float or array
    Chord length of the prop; can be a constant float, an array (as with “twist”), or an elliptic planform can be specified using [“elliptic”, 1.0], where the number is the root chord length.
    ”rotation” : str
    direction of rotation, either “CW” or “CCW”
    ”airfoil” : str or array
    Airfoil section of the blade; either a single string, in which case the section is constant, or an array (as with “twist”) where the local section is given in the second column; must be the name of an airfoil listed under “airfoils”.
    ”grid” : int
    Number of grid points to use on the prop.

    }

    }

  • airfoil_dict (dict, optional) – Dictionary of airfoils to be used by the prop. This is only needed if these have not already been given in input_dict.
name
Type:str
k

Number of blades on the prop.

Type:int
diameter

Diameter of the prop in feet.

Type:float
weight

Weight of the prop in lbf.

Type:float
get_advance_ratio(w, V)

Determines the advance ratio from angular velocity in rad/s and velocity in ft/s.

Parameters:
  • w (float) – Angular velocity in rad/s.
  • V (float) – Velocity in ft/s.
Returns:

Advance ratio.

Return type:

float

get_diameter()

Returns the prop diameter in feet.

get_power_coef(w, V)

Returns the power coefficient for the prop at the given angular velocity and freestream velocity.

Parameters:
  • w (float) – Angular velocity of the prop in radians per second.
  • V (float) – Freestream velocity in feet per second.
Returns:

Power coefficient.

Return type:

float

get_thrust_coef(w, V)

Returns the thrust coefficient for the prop at the given angular velocity and freestream velocity.

Parameters:
  • w (float) – Angular velocity of the prop in radians per second.
  • V (float) – Freestream velocity in feet per second.
Returns:

Thrust coefficient.

Return type:

float

get_torque_coef(w, V)

Returns the torque coefficient for the prop at the given angular velocity and freestream velocity.

Parameters:
  • w (float) – Angular velocity of the prop in radians per second.
  • V (float) – Freestream velocity in feet per second.
Returns:

Torque coefficient.

Return type:

float

get_velocity(rpm, J)

Determines the velocity from the rpm and advance ratio.

Parameters:
  • rpm (float) – Angular velocity in rpm.
  • J (float) – Advance ratio.
Returns:

Velocity in ft/s.

Return type:

float

plot_angles_over_zeta(w, V)

Plots the aerodynamic pitch angle, the induced angle of attack, the downwash angle, and the local angle of attack as a function of distance along the blade.

Parameters:
  • w (float) – Angular velocity in rad/s.
  • V (float) – Forward velocity in ft/s.
plot_coefs(rpm_lims=[0.0, 35000.0], J_lims=[0.0, 1.4])

Plot thrust and torque coefficients as functions of rpm and advance ratio.

Parameters:
  • rpm_lims (list, optional) – Limits for plotting in rpm. Defaults to [0.0, 35000.0].
  • J_lims (list, optional) – Limits for plotting in advance ratio. Defaults to [0.0, 1.4].
class pyprop.PropulsionUnit(prop, motor, battery, esc, altitude=0.0)

Defines a full electric propulsion unit.

Parameters:
prop

Propeller object being used in the propulsion unit.

Type:DatabaseFitProp, DatabaseDataProp, or BladeElementProp
motor

Motor object being used in the propulsion unit.

Type:Motor
battery

Battery object being used in the propulsion unit.

Type:Battery
esc

ESC object being used in the propulsion unit.

Type:ESC
I_motor

Current being drawn by the motor under the last calculated conditions.

Type:float
calc_batt_life(v_cruise, T_req)

Determines how long the battery will last based on a required thrust and cruise speed. This assumes nominal cell capacity and constant battery discharge voltage.

Parameters:
  • v_cruise (float) – Cruise velocity in feet per second.
  • T_req (float) – Required thrust in lbf.
Returns:

  • float – Flight time in minutes
  • float – Corresponding throttle setting

calc_cruise_throttle(v_cruise, T_req, max_iter=1000)

Computes required throttle setting for a given thrust and cruise speed.

Parameters:
  • v_cruise (float) – Cruise velocity in ft/s.
  • T_req (float) – Required thrust in lbf.
  • max_iter (int, optional) – Maximum iterations for the secant method. Defaults to 1000.
Returns:

Throttle setting required for given thrust and velocity.

Return type:

float

calc_cruise_thrust(v_cruise, throttle, max_iter=1000)

Computes thrust produced at a given cruise speed and throttle setting.

Parameters:
  • v_cruise (float) – Freestream velocity in feet per second.
  • throttle (float) – Throttle setting.
  • max_iter (int, optional) – Maximum iterations for the secant method. Defaults to 1000.
Returns:

Thrust in lbf.

Return type:

float

calc_motor_torque(throttle, revs)

Computes motor torque (ft*lbf) given throttle setting and revolutions (rpm).

Parameters:
  • throttle (float) – Throttle setting.
  • revs (float) – Angular velocity of the motor in rpm.
Returns:

Torque produced by the motor in Nm.

Return type:

float

get_electric_power()

Returns the power sourced by the battery for the last calculated condition.

Returns:Electrical power sourced in Watts.
Return type:float
get_weight()

Returns weight of electrical components in pounds.

Returns:Weight of the propulsion system in pounds. Note, the weight of the prop will be included only if the prop is of type BladeElementProp.
Return type:float
plot_thrust_curves(v_lims, n_vel=10, n_thr=10)

Plots thrust curves for the propulsion unit through the range of specified velocities.

Parameters:
  • v_lims (list) – Limits for the range of airspeeds to be plotted.
  • n_vel (int) – Number of velocity values to plot. Defaults to 10.
  • n_thr (int) – Number of throttle values to plot. Throttle is ranged from 0 to 1. Defaults to 10.