SpurGear¶
- class SpurGear(name: str, n_teeth: int, inertia_moment: InertiaMoment, module: Length | None = None, face_width: Length | None = None, elastic_modulus: Stress | None = None)¶
Bases:
GearBaseSpurGearobject.Attributes¶
namestrName of the spur gear.
n_teethintNumber of gear teeth.
inertia_momentInertiaMomentMoment of inertia of the gear.
moduleLengthUnit of the gear teeth size.
reference_diameterLengthReference diameter of the gear.
face_widthLengthFace width of the gear.
elastic_modulusStressElastic modulus of the material of the gear.
lewis_factorfloatFactor used to compute stresses on the gear tooth.
driven_byRotatingObjectRotating object that drives the gear, for example a
DCMotor, aFlywheelor another gear (SpurGear,HelicalGear,WormGear,WormWheel).drivesRotatingObjectRotating object driven by the gear, it can be a
Flywheelor another gear (SpurGear,HelicalGear,WormGear,WormWheel).master_gear_ratiofloatGear ratio of the mating between the gear and its driving gear.
master_gear_efficiencyfloatorintEfficiency of the gear mating between the gear and its driving gear.
mating_role:RoleThe role of the gear in the gear mating.
angular_positionAngularPositionAngular position of the gear.
angular_speedAngularSpeedAngular speed of the gear.
angular_accelerationAngularAccelerationAngular acceleration of the gear.
torqueTorqueNet torque applied on the gear.
driving_torqueTorqueDriving torque applied on the gear by its driving gear.
load_torqueTorqueLoad torque applied on the gear by its driven gear or an external load.
tangential_forceForceTangential force applied on the gear teeth by the mating gear.
tangential_force_is_computableboolWhether is possible to compute the
tangential_forceon the gear teeth.bending_stressStressBending stress applied on the gear teeth by the mating gear.
bending_stress_is_computableboolWhether is possible to compute the
bending_stresson the gear teeth.contact_stressStressThe stress generated by the contact with mating gear teeth.
contact_stress_is_computableboolWhether is possible to compute the
contact_stresson the gear teeth.time_variablesdictTime variables of the gear.
Methods¶
compute_tangential_force()It computes the
tangential_forceapplied on the gear teeth by the mating gear.compute_bending_stress()It computes the
bending_stressapplied on the gear teeth by the mating gear.compute_contact_stress()It computes the
contact_stressgenerated by the contact with mating gear teeth.external_torque()Custom function to compute the external torque applied on the gear.
update_time_variables()It updates
time_variablesdictionary by appending the last value of each time variable to corresponding list.
- property angular_acceleration: AngularAcceleration¶
Angular acceleration of the gear. It must be an instance of
AngularAcceleration.Returns¶
AngularAccelerationAngular acceleration of the gear.
Raises
TypeErrorIf
angular_accelerationis not an instance ofAngularAcceleration.
- property angular_position: AngularPosition¶
Angular position of the gear. It must be an instance of
AngularPosition.Returns¶
AngularPositionAngular position of the gear.
Raises
TypeErrorIf
angular_positionis not an instance ofAngularPosition.
- property angular_speed: AngularSpeed¶
Angular speed of the gear. It must be an instance of
AngularSpeed.Returns¶
AngularSpeedAngular speed of the gear.
Raises
TypeErrorIf
angular_speedis not an instance ofAngularSpeed.
- property bending_stress: Stress¶
Bending stress applied on the gear teeth by the mating gear. It must be an instance of
Stress.Returns¶
StressBending stress applied on the gear teeth by the mating gear.
Raises
TypeErrorIf
bending_stressis not an instance ofStress.
See Also
- property bending_stress_is_computable: bool¶
Whether is possible to compute the
bending_stresson the gear teeth.The bending stress computation depends on the value of
moduleandface_width, so if these optional parameters have been set at spur gear instantiation, then it is possible to compute the bending stress and this property isTrue, otherwise isFalse.Returns¶
boolWhether is possible to compute the bending stress on the gear teeth.
See Also
- compute_bending_stress() None¶
It computes the
bending_stressapplied on the gear teeth by the mating gear.Notes
The bending stress computation is based on the following assumptions:
the tooth is stressed by the overall force acting on the tip of the tooth itself,
the most unfavorable situation is considered in the calculation, as if there is only one pair of teeth in contact within the contact segment,
the component of the overall force that determines the bending on the tooth is the only one considered and, for simplicity, is taken as having a value equal to the tangential force on the reference diameter,
the radial component of the overall force that causes a compressive stress on the tooth is neglected.
The bending stress is computed with the following formula:
\[\sigma_b = \frac{F_t}{m \, b \, Y_{LW}}\]where:
\(F_t\) is the
tangential_forceapplied on the tooth,\(m\) is the gear
module,\(b\) is the gear tooth
face_width,\(Y_{LW}\) is the gear
lewis_factor.
- compute_contact_stress() None¶
It computes the
contact_stressgenerated by the contact with mating gear teeth.Raises
ValueErrorIf a gear mating between two gears has not been set,
if
mating_roleisMatingMasterand its slave gear missesmoduleparameter,if
mating_roleisMatingMasterand its slave gear misseselastic_modulusparameter,if
mating_roleisMatingSlaveand its master gear missesmoduleparameter,if
mating_roleisMatingSlaveand its master gear misseselastic_modulusparameter.
Notes
The contact stress computation is based on the following assumptions:
perfect elasticity of the materials the two mating gear,
absence of friction forces in the contact point,
small size of the contact surface compared to the size of the bodies between which contact occurs.
The contact stress is computed with the following formula:
\[\sigma_c = 0.262922 \, \sqrt{\frac{4 \, F_t}{b \, \cos \alpha \, \sin \alpha} \left( \frac{1}{D_1} + \frac{1}{D_2} \right) \, \frac{E_1 \, E_2}{E_1 + E_2}}\]where:
\(F_t\) is the
tangential_forcetangential force applied on the tooth,\(b\) is the gear
face_width,\(\alpha\) is the pressure angle of the gear, always equal to 20 degrees,
\(D_1\) is the gear
reference_diameter,\(D_2\) is the mating gear
reference_diameter,\(E_1\) is the gear
elastic_modulus,\(E_2\) is the mating gear
elastic_modulus.
- compute_tangential_force() None¶
It computes the
tangential_forceapplied on the gear teeth by the mating gear.Considering a gear mating:
if the gear is the master one, then it takes into account the
load_torquefor the computation,if the gear is the slave one, then it take into account the
driving_torquefor the computation.
The tangential force is computed dividing the just described reference torque by the reference radius (half of the
reference_diameter).Raises
ValueErrorIf a gear mating between two gears has not been set.
- property contact_stress: Stress¶
Stress generated by the contact with mating gear teeth. It must be an instance of
Stress.Returns¶
StressThe stress generated by the contact with mating gear teeth.
Raises
TypeErrorIf
contact_stressis not an instance ofStress.
See Also
- property contact_stress_is_computable: bool¶
Whether is possible to compute the
contact_stressforce on the gear teeth.The contact stress computation depends on the value of
module,face_widthandelastic_modulus, so if these optional parameters have been set at spur gear instantiation, then it is possible to compute the contact stress and this property isTrue, otherwise isFalse.Returns¶
boolWhether is possible to compute the contact stress on the gear teeth.
See Also
- property driven_by: RotatingObject¶
Rotating object that drives the gear, for example a
DCMotor, aFlywheelor another gear (SpurGear,HelicalGear,WormGear,WormWheel). It must be aRotatingObject.To set this property use
add_gear_matingoradd_fixed_joint.Returns¶
RotatingObjectMaster rotating object that drives the gear.
Raises
TypeErrorIf
driven_byis not an instance ofRotatingObject.
- property drives: RotatingObject¶
Rotating object driven by the gear, it can be a
Flywheelor another gear (SpurGear,HelicalGear,WormGear,WormWheel). It must be aRotatingObject.To set this property use
add_gear_matingoradd_fixed_joint.Returns¶
RotatingObjectRotating object driven by the gear.
Raises
TypeErrorIf
drivesis not an instance ofRotatingObject.
- property driving_torque: Torque¶
Driving torque applied on the gear by its driving gear. It must be an instance of
Torque.Returns¶
TorqueDriving torque applied on the gear by its driving gear.
Raises
TypeErrorIf
driving_torqueis not an instance ofTorque.
- property elastic_modulus: Stress | None¶
Elastic modulus of the material of the gear. It must be an instance of
Stress. It must be positive.Returns¶
StressElastic modulus of the material of the gear.
Raises
TypeErrorIf
elastic_modulusis not an instance ofStress.ValueErrorIf
elastic_modulusvalue is negative or null.
- property external_torque: Callable[[AngularPosition, AngularSpeed, Time], Torque]¶
Custom function to compute the external torque applied on the gear. It must be a function with parameters
angular_position,angular_speedandtime. The function must return an instance ofTorque.Returns¶
CallableThe function to compute the external torque applied on the gear.
Raises
TypeErrorIf
external_torque()is not callable.KeyErrorIf
external_torque()misses parametersangular_position,angular_speedortime.
Examples
Constant torque, not dependent on
angular_position,angular_speedortime.>>> from gearpy.mechanical_objects import SpurGear >>> from gearpy.units import InertiaMoment, Torque >>> gear = SpurGear(name = 'gear', n_teeth = 10, inertia_moment = InertiaMoment(1, 'kgm^2')) >>> gear.external_torque = lambda angular_position, angular_speed, time: Torque(5, 'Nm')
Torque dependent on
angular_positionandtime.In this case the gear gets a periodic load, dependent on time, and an extra load dependent on its angular position. The dependence by angular position may be used to model cases where cams are involved.
>>> import numpy as np >>> from gearpy.units import AngularPosition, AngularSpeed, Time >>> def custom_external_torque(angular_position: AngularPosition, ... angular_speed: AngularSpeed, ... time: Time): ... return Torque(value = angular_position.sin() + ... np.cos(time.to('sec').value), ... unit = 'Nm') >>> gear.external_torque = custom_external_torque
Torque dependent on
angular_position,angular_speedandtime.With respect ot the previous case, the gear gets an extra load dependent on its angular speed. The dependence by angular speed may be used to model cases where air friction is not negligible.
>>> def complex_external_torque(angular_position: AngularPosition, ... angular_speed: AngularSpeed, ... time: Time): ... return Torque(value = angular_position.sin() + ... 0.001*(angular_speed.to('rad/s').value)**2 + ... np.cos(time.to('sec').value), ... unit = 'Nm') >>> gear.external_torque = complex_external_torque
- property face_width: Length | None¶
Face width of the gear. It must be an instance of
Length.Returns¶
LengthFace width of the gear.
Raises
TypeErrorIf
face_widthis not an instance ofLength.
- property inertia_moment: InertiaMoment¶
Moment of inertia of the gear. It must be an instance of
InertiaMoment.Once set at the spur gear instantiation, it cannot be changed afterward.
Returns¶
InertiaMomentMoment of inertia of the gear.
Raises
TypeErrorIf
inertia_momentis not an instance ofInertiaMoment.
- property lewis_factor: float | None¶
Factor used to compute stresses on the gear tooth.
It is a tabular value that in general depends on the number of gear teeth and the pressure angle. In this case, the considered pressure angle is always 20 degrees, so the Lewis factor depends only on the number of gear teeth
n_teeth.Returns¶
floatFactor used to compute stresses on the gear tooth.
- property load_torque: Torque¶
Load torque applied on the gear by its driven gear or an external load. It must be an instance of
Torque.Returns¶
TorqueLoad torque applied on the gear by its driven gear or an external load.
Raises
TypeErrorIf
load_torqueis not an instance ofTorque.
- property master_gear_efficiency: float | int¶
Efficiency of the gear mating between the gear and its driving gear. It must be a
floator anintwithin0and1.To set this property use
add_gear_matingoradd_fixed_joint.Returns¶
Raises
TypeErrorIf
master_gear_efficiencyis not afloator anint.ValueErrorIf
master_gear_efficiencyis not within0and1.
- property master_gear_ratio: float¶
Gear ratio of the mating between the gear and its driving gear. It must be a positive a
float.If the gear is fixed to another driving
RotatingObject, then the ratio is1, otherwise it is defined as the ratio between the gear number of teethn_teethand the same parameter of the master (driving) gear.To set this property use
add_gear_matingoradd_fixed_joint.Returns¶
floatGear ratio of the mating between the gear and its driving gear.
Raises
TypeErrorIf
master_gear_ratiois not afloat.ValueErrorIf
master_gear_ratiois negative or null.
- property mating_role: Role¶
Role of the gear in the gear mating.
If the gear drives the mate one, then it is the “master” gear and its role is
MatingMaster, otherwise it is the “slave” one and its role isMatingSlave.To set this parameter use
add_gear_mating.Returns¶
RoleThe role of the gear in the gear mating.
Raises
ValueErrorIf
mating_roleis not a subclass ofRole.
- property module: Length | None¶
Unit of the gear teeth size. It must be an instance of
Length.Once set at the spur gear instantiation, it cannot be changed afterward.
Returns¶
LengthUnit of the gear teeth size.
- property n_teeth: int¶
Number of gear teeth. It must be a positive integer.
Once set at the spur gear instantiation, it cannot be changed afterward.
Returns¶
intNumber of gear teeth.
- property name: str¶
Name of the spur gear. It must be a non-empty
str.It must be a unique name, not shared by other elements in the powertrain elements.
Once set at the spur gear instantiation, it cannot be changed afterward.
Returns¶
strName of the spur gear.
- property reference_diameter: Length | None¶
Reference diameter of the gear. It must be an instance of
Length.It is computed as the product of
n_teethtimesmoduleat the spur gear instantiation and it cannot be changed afterward.Returns¶
LengthReference diameter of the gear.
- property tangential_force: Force¶
Tangential force applied on the gear teeth by the mating gear. It must be an instance of
Force.Returns¶
ForceTangential force applied on the gear teeth by the mating gear.
Raises
TypeErrorIf
tangential_forceis not an instance ofForce.
See Also
- property tangential_force_is_computable: bool¶
Whether is possible to compute the
tangential_forceon the gear teeth.The tangential force computation depends on the value of
module, so if this optional parameter has been set at spur gear instantiation, then it is possible to compute the tangential force and this property isTrue, otherwise isFalse.Returns¶
boolWhether is possible to compute the tangential force on the gear teeth.
See Also
- property time_variables: dict[str, list[UnitBase]]¶
Time variables of the gear. Each time variable is stored as a dictionary key-value pair. The available time variables are:
angular_position:'angular position',angular_speed:'angular speed',angular_acceleration:'angular acceleration',torque:'torque',driving_torque:'driving torque',load_torque:'load torque',tangential_force:'tangential force',bending_stress:'bending stress',contact_stress:'contact stress'.
'tangential force','bending stress'and'contact stress'are listed among time variables only if they are computable indeed, depending on which gear parameters are set at gear instantiation; seetangential_force_is_computable,bending_stress_is_computableandcontact_stress_is_computablefor more details.Corresponding values of the dictionary are lists of the respective time variable values.
At each time iteration, the
Solverappends every time variables’ values to the relative list in the dictionary.Returns¶
dictTime variables of the gear.
See Also
- property torque: Torque¶
Net torque applied on the gear. It must be an instance of
Torque.It is computed as the difference between
driving_torqueandload_torque.Returns¶
TorqueNet torque applied on the gear.
- update_time_variables() None¶
It updates
time_variablesdictionary by appending the last value of each time variable (key of the dictionary) to corresponding list (value of the dictionary).