external_torque¶
- property HelicalGear.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 HelicalGear >>> from gearpy.units import InertiaMoment, Torque >>> gear = HelicalGear( ... 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 ... ) -> 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