DCMotor

class DCMotor(name: str, inertia_moment: InertiaMoment, no_load_speed: AngularSpeed, maximum_torque: Torque, no_load_electric_current: Current | None = None, maximum_electric_current: Current | None = None)

Bases: MotorBase

DCMotor object.

Attributes

namestr

Name of the DC motor.

drivesRotatingObject

Rotating object driven by DC motor, it can be a Flywheel or a gear (SpurGear, HelicalGear, WormGear, WormWheel).

angular_positionAngularPosition

Angular position of the DC motor.

angular_speedAngularSpeed

Angular speed of the DC motor.

angular_accelerationAngularAcceleration

Angular acceleration of the DC motor.

no_load_speedAngularSpeed

No load angular speed of the DC motor.

maximum_torqueTorque

Maximum torque developed by the DC motor.

torqueTorque

Net torque applied on the DC motor.

driving_torqueTorque

Driving torque developed by the DC motor.

load_torqueTorque

Load torque applied on the DC motor by its driven gear.

inertia_momentInertiaMoment

Moment of inertia of the DC motor.

no_load_electric_currentCurrent

No load electric current absorbed by the DC motor.

maximum_electric_currentCurrent

Maximum electric current absorbed by the DC motor.

electric_current_is_computablebool

Whether is possible to compute the electric_current absorbed by the DC motor.

electric_currentCurrent

Electric current absorbed by the DC motor.

pwmfloat or int

Pulse Width Modulation duty cycle of the supply voltage of the DC motor.

time_variablesdict

Time variables of the DC motor.

Methods

compute_torque()

It computes the driving_torque developed by the DC motor.

compute_electric_current()

It computes the electric_current absorbed by the DC motor.

update_time_variables()

It updates time_variables dictionary by appending the last value of each time variable to corresponding list.

property angular_acceleration: AngularAcceleration

Angular acceleration of the DC motor. It must be an instance of AngularAcceleration.

Returns

AngularAcceleration

Angular acceleration of the DC motor.

Raises

TypeError

If angular_acceleration is not an instance of AngularAcceleration.

property angular_position: AngularPosition

Angular position of the DC motor. It must be an instance of AngularPosition.

Returns

AngularPosition

Angular position of the DC motor.

Raises

TypeError

If angular_position is not an instance of AngularPosition.

property angular_speed: AngularSpeed

Angular speed of the DC motor. It must be an instance of AngularSpeed.

Returns

AngularSpeed

Angular speed of the DC motor.

Raises

TypeError

If angular_speed is not an instance of AngularSpeed.

compute_electric_current() None

It computes the electric_current absorbed by the DC motor.

The absorbed electric current depends on the two constants no_load_electric_current and maximum_electric_current and the two variables driving_torque and pwm of the DC motor.

The computed electric current has the same unit of maximum_electric_current.

Notes

The computation is based on the following relationship:

\[i \left( T \right) = \left( i_{max}^D - i_0 \right) \frac{T}{T_{max}^D} + i_0\]

where:

  • \(i\) is the electric_current absorbed by the DC motor,

  • \(T\) is the DC motor developed driving_torque,

  • \(i_{max}^D\) is the maximum electric current absorbed by the DC motor keeping into account pwm,

  • \(i_0\) is the no_load_electric_current absorbed by the DC motor,

  • \(T_{max}^D\) is the DC motor maximum torque developed by the DC motor keeping into account pwm.

The maximum torque can be computed as:

\[T_{max}^D \left( D \right) = T_{max} \frac{D \, i_{max} - i_0}{i_{max} - i_0}\]

and the maximum electric current can be computed as:

\[i_{max}^D \left( D \right) = D \, i_{max}\]

where:

If the pwm is lower than a critical threshold, then the motor cannot develop any torque, so the electric_current will depend only on pwm value. The critical pwm value can be computed as:

\[D_{lim} = \frac{i_0}{i_{max}}\]

and the relative electric current can be computed as:

\[i_{lim} \left( D \right) = D \, i_{max}\]
compute_torque() None

It computes the driving_torque developed by the DC motor.

The driving torque depends on the two constants no_load_speed and maximum_torque and the two variables angular_speed and pwm of the DCMotor.

The computed torque has the same unit of maximum_torque.

Notes

The computation is based on the following relationship:

\[T \left( \dot{\theta} , T_{max}^D , \dot{\theta}_0^D \right) = T_{max}^D \left( 1 - \frac{\dot{\theta}}{\dot{\theta}_0^D} \right)\]

where:

  • \(T\) is the DC motor developed driving torque driving_torque,

  • \(\dot{\theta}\) is the actual DC motor angular speed angular_speed,

  • \(T_{max}^D\) is the DC motor maximum torque developed by the DC motor keeping into account pwm,

  • \(\dot{\theta}_0^D\) is the DC motor no load angular speed keeping into account pwm.

The maximum torque can be computed as:

\[T_{max}^D \left( D \right) = T_{max} \frac{D \, i_{max} - i_0}{i_{max} - i_0}\]

and the no load angular speed can be computed as:

\[\dot{\theta}_0^D \left( D \right) = D \, \dot{\theta}_0\]

where:

If the pwm is lower than a critical threshold, then the motor cannot develop any torque, so the driving_torque will be null. The critical pwm value can be computed as:

\[D_{lim} = \frac{i_0}{i_{max}}\]
property drives: RotatingObject

Rotating object driven by DC motor, it can be a Flywheel or a gear (SpurGear, HelicalGear, WormGear, WormWheel). It must be an instance of RotatingObject.

To set this property use add_fixed_joint.

Returns

RotatingObject

Rotating object driven by the DC motor.

Raises

TypeError

If drives is not an instance of RotatingObject.

property driving_torque: Torque

Driving torque developed by the DC motor. It must be an instance of Torque.

Returns

Torque

Driving torque developed by the DC motor.

Raises

TypeError

If driving_torque is not an instance of Torque.

See Also

compute_torque()

property electric_current: Current | None

Electric current absorbed by the DC motor. It must be an instance of Current.

Returns

Current

Electric current absorbed by the DC motor.

Raises

TypeError

If electric_current is not an instance of Current.

property electric_current_is_computable: bool

Whether is possible to compute the electric_current absorbed by the DC motor.

The electric current computation depends on the value of no_load_electric_current and maximum_electric_current, so if these optional parameters have been set at DC motor instantiation, then it is possible to compute the absorbed electric current and this property is True, otherwise is False.

Returns

bool

Whether is possible to compute the electric current absorbed by the DC motor.

property inertia_moment: InertiaMoment

Moment of inertia of the DC motor’s rotor. It must be an instance of InertiaMoment.

Once set at the DC motor instantiation, it cannot be changed afterward.

Returns

InertiaMoment

Moment of inertia of the DC motor’s rotor.

Raises

TypeError

If inertia_moment is not an instance of InertiaMoment.

property load_torque: Torque

Load torque applied on the DC motor by its driven gear. It must be an instance of Torque.

Returns

Torque

Load torque applied on the DC motor by its driven gear.

Raises

TypeError

If load_torque is not an instance of Torque.

property maximum_electric_current: Current | None

Maximum electric current absorbed by the DC motor. It must be an instance of Current. Its value must be positive and greater than no_load_electric_current.

It is the maximum electric current the DC motor can absorb when its rotor is kept still by the load.

Once set at the DC motor instantiation, it cannot be changed afterward.

Returns

Current

Maximum electric current absorbed by the DC motor.

Raises

TypeError

If maximum_electric_current is not an instance of Current.

ValueError
property maximum_torque: Torque

Maximum torque developed by the DC motor. It must be an instance of Torque. Its value must be positive.

It is the maximum torque the DC motor can develop when its rotor is kept still by the load.

Once set at the DC motor instantiation, it cannot be changed afterward.

Returns

Torque

Maximum torque developed by the DC motor.

Raises

TypeError

If maximum_torque is not an instance of Torque.

ValueError

If maximum_torque is negative or null.

property name: str

Name of the DC motor. 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 DC motor instantiation, it cannot be changed afterward.

Returns

str

Name of the DC motor.

Raises

TypeError

If name is not a str.

ValueError

If name is an empty str.

property no_load_electric_current: Current | None

No load electric current absorbed by the DC motor. It must be an instance of Current. Its value must be positive or null and lower than maximum_electric_current.

It is the electric current absorbed by the DC motor when no load is applied to its rotor.

Once set at the DC motor instantiation, it cannot be changed afterward.

Returns

Current

No load electric current of the DC motor.

Raises

TypeError

If no_load_electric_current is not an instance of Current.

ValueError
property no_load_speed: AngularSpeed

No load angular speed of the DC motor. It must be an instance of AngularSpeed. Its value must be positive.

It is the angular speed at which the DC motor rotates when no load is applied to its rotor.

Once set at the DC motor instantiation, it cannot be changed afterward.

Returns

AngularSpeed

No load angular speed of the DC motor.

Raises

TypeError

If no_load_speed is not an instance of AngularSpeed.

ValueError

If no_load_speed is negative or null.

property pwm: float | int

Pulse Width Modulation duty cycle of the supply voltage of the DC motor.

It must be a float or an int within -1 and 1.

In general the duty cycle can be between 0 and 1, but pwm can be between -1 and 1, in order to take into account the voltage sign with respect to the direction of rotation:

  • if pwm is positive, then the supply voltage pushes the motor to rotate in the positive direction,

  • if pwm is negative, then the supply voltage pushes the motor to rotate in the negative direction,

  • if pwm is null, then the supply voltage is null to and the motor does not develop any driving torque.

The pwm value has an impact on the driving_torque developed and the electric_current absorbed by the DC motor.

Returns

float or int

Pulse Width Modulation duty cycle of the supply voltage of the DC motor.

Raises

TypeError

If pwm is not a float or an int.

ValueError

If pwm is not within -1 and 1.

property time_variables: dict[str, list[UnitBase]]

Time variables of the DC motor. Each time variable is stored as a dictionary key-value pair. The available time variables are:

'electric current' is listed among time variables only if it is computable indeed, depending on which motor parameters was set at DC motor instantiation; see electric_current_is_computable for more details.

Corresponding values of the dictionary are lists of the respective time variable values.

At each time iteration, the Solver appends every time variables’ values to the relative list in the dictionary.

Returns

dict

Time variables of the DC motor.

property torque: Torque

Net torque applied on the DC motor. It must be an instance of Torque.

It is computed as the difference between driving_torque and load_torque.

Returns

Torque

Net torque applied on the DC motor.

Raises

TypeError

If torque is not an instance of Torque.

update_time_variables() None

It updates time_variables dictionary by appending the last value of each time variable (key of the dictionary) to corresponding list (value of the dictionary).