StartLimitCurrent¶
- class StartLimitCurrent(encoder: AbsoluteRotaryEncoder, tachometer: Tachometer, motor: DCMotor, target_angular_position: AngularPosition, limit_electric_current: Current)¶
Bases:
RuleBaseStartLimitCurrentobject.It can be used to make a gradual start of the powertrain’s motion and limit the
motorabsorbed electric current to be lower than or equal to alimit_electric_currentvalue. It computes apwmto apply to themotorup until theencoder’starget’sangular_positionequalstarget_angular_position.For an optimal
pwmmanagement, it is suggested to set themotoras thetachometer’starget.Methods¶
apply()It computes the
pwmto apply to themotorin order to limit its absorbed electric current to be lower or equal tolimit_electric_current, until theencoder’stargetrotating object’sangular_positionequals thetarget_angular_position.
Raises
TypeErrorIf
encoderis not an instance ofAbsoluteRotaryEncoder,If
tachometeris not an instance ofTachometer,If
motoris not an instance ofDCMotor,if
target_angular_positionis not an instance ofAngularPosition,if
limit_electric_currentis not an instance ofCurrent.
ValueErrorIf the
motorcannot computeelectric_currentproperty (DCMotor.electric_current),if
limit_electric_currentis negative or null.
See Also
- apply() None | float | int¶
It computes the
pwmto apply to themotorin order to limit its absorbed electric current to be lower or equal tolimit_electric_current, until theencoder’stargetrotating object’sangular_positionequals thetarget_angular_position.Returns¶
floatorintorNonePWM value to apply to the
motorin order to limit its absorbed electric current to be lower or equal tolimit_electric_current
Notes
It checks the applicability condition, defined as:
\[\theta \le \theta_t\]where:
\(\theta\) is the
encoder’stargetangular_position,\(\theta_t\) is the
target_angular_position.
If the applicability condition is not met, then it returns
None, otherwise it computes thepwmas:\[D \left( \dot{\theta} \right) = \frac{1}{2} \, \left( \frac{\dot{\theta}}{\dot{\theta}_0} + \frac{i_{lim}}{i_{max}} + \sqrt{ \left( \frac{\dot{\theta}}{\dot{\theta}_0} \right)^2 + \left( \frac{i_{lim}}{i_{max}} \right)^2 + 2 \frac{\dot{\theta}}{\dot{\theta}_0} \frac{i_{lim} - 2 i_0}{i_{max}} } \right)\]where:
\(\dot{\theta}\) is the
tachometer’starget’s angular speed,\(\dot{\theta}_0\) is the
motorno load angular speed (DCMotor.no_load_speed),\(i_{lim}\) is the
limit_electric_currentparameter,\(i_{max}\) is the
motormaximum electric current (DCMotor.maximum_electric_current),\(i_0\) is the
motorno load electric current (DCMotor.no_load_electric_current).