WormGear¶
- class WormGear(name: str, n_starts: int, inertia_moment: InertiaMoment, helix_angle: Angle, pressure_angle: Angle, reference_diameter: Length | None = None)¶
Bases:
RotatingObjectWormGearobject.Attributes¶
namestrName of the worm gear.
n_startsintNumber of starts, which refers to the number of independent threads running around the length of the thread.
inertia_momentInertiaMomentMoment of inertia of the gear.
helix_angleAngleHelix angle of the worm gear.
pressure_angleAnglePressure angle of the worm gear.
reference_diameterLengthReference diameter of the gear.
self_lockingboolWhether the
WormGearcannot be moved by the matingWormWheel.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 threads by the mating gear.
tangential_force_is_computableboolWhether is possible to compute the
tangential_forceon the gear threads.time_variablesdictTime variables of the gear.
Methods¶
compute_tangential_force()It computes the
tangential_forceapplied on the gear threads by the mating gear.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.
- compute_tangential_force() None¶
It computes the
tangential_forceapplied on the gear threads 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 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_worm_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_worm_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 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 WormGear >>> from gearpy.units import InertiaMoment, Torque, Angle >>> gear = WormGear( ... name='gear', ... n_starts=1, ... inertia_moment=InertiaMoment(1, 'kgm^2'), ... pressure_angle = Angle(20, 'deg'), ... helix_angle = Angle(10, 'deg') ... ) >>> 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 ... ) -> Torque: >>> 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 ... ) -> Torque: >>> 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 helix_angle: Angle¶
Helix angle of the worm gear. It must be an instance of
Angle.The maximum allowable value of helix angle depends on the
pressure_angle.Once set at the worm gear instantiation, it cannot be changed afterward.
Returns¶
AngleThe helix angle of the worm gear.
Raises
TypeErrorIf
helix_angleis not an instance ofAngle.ValueErrorIf
helix_angleis greater than the maximum allowable helix angle, depending onpressure_anglevalue.
- property inertia_moment: InertiaMoment¶
Moment of inertia of the gear. It must be an instance of
InertiaMoment.Once set at the worm gear instantiation, it cannot be changed afterward.
Returns¶
InertiaMomentMoment of inertia of the gear.
Raises
TypeErrorIf
inertia_momentis not an instance ofInertiaMoment.
- 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_worm_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 worm gear is fixed to another driving
RotatingObject, then the ratio is1, otherwise it is defined as the ratio between the worm gear number of startsn_startsand the driving wheel gear number of teethWormWheel.n_teeth.To set this property use
add_worm_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_worm_gear_mating.Returns¶
RoleThe role of the gear in the gear mating.
Raises
ValueErrorIf
mating_roleis not a subclass ofRole.
- property n_starts: int¶
Number of starts, which refers to the number of independent threads running around the length of the thread. It must be a positive
intequal to or greater than1.Once set at the worm gear instantiation, it cannot be changed afterward.
Returns¶
intNumber of starts, which refers to the number of independent threads running around the length of the thread.
- property name: str¶
Name of the worm 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 worm gear instantiation, it cannot be changed afterward.
Returns¶
strName of the worm gear.
- property pressure_angle: Angle¶
Pressure angle of the worm gear. It must be an instance of
Angleand its value must be one of: 14.5 deg, 20 deg, 25 deg or 30 deg.Once set at the worm gear instantiation, it cannot be changed afterward.
Returns¶
AngleThe pressure angle of the worm gear.
Raises
TypeErrorIf
pressure_angleis not an instance ofAngle.ValueErrorIf
pressure_anglevalue is not among available ones: 14.5 deg, 20 deg, 25 deg or 30 deg.
- property reference_diameter: Length | None¶
Reference diameter of the gear. It must be an instance of
Length.Once set at the worm gear instantiation, it cannot be changed afterward.
Returns¶
LengthReference diameter of the gear.
Raises
TypeErrorIf
reference_diameteris not an instance ofLength.
- property self_locking: bool¶
Whether the
WormGearcannot be moved by the matingWormWheel.The gear mating can be self-locking if the amount of friction is high enough with respect to the gear pressure and helix angles.
If the mating is self-locking, then the
WormGearcannot be moved by the matingWormWheel.To set this property use
add_worm_gear_mating.Returns¶
- property tangential_force: Force¶
Tangential force applied on the gear threads by the mating gear. It must be an instance of
Force.Returns¶
ForceTangential force applied on the gear threads 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 threads.The tangential force computation depends on the value of
reference_diameter, so if this optional parameter has been set at worm 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 threads.
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'
'tangential force'is listed among time variables only if they are computable indeed, depending on which gear parameters are set at gear instantiation; seetangential_force_is_computable.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).