external_torque

property WormWheel.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_speed and time. The function must return an instance of Torque.

Returns

Callable

The function to compute the external torque applied on the gear.

Raises

TypeError

If external_torque is not callable.

KeyError

If external_torque misses parameters angular_position, angular_speed or time.

Examples

Constant torque, not dependent on angular_position, angular_speed or time.

>>> from gearpy.mechanical_objects import WormWheel
>>> from gearpy.units import InertiaMoment, Torque
>>> gear = WormWheel(
...     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_position and time.

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_speed and time.

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