dc_motor_characteristics_animation¶
- dc_motor_characteristics_animation(motor: DCMotor, time: list[Time], interval: float | int | None = 200, torque_speed_curve: bool | None = True, torque_current_curve: bool | None = True, angular_speed_unit: str | None = 'rad/s', torque_unit: str | None = 'Nm', current_unit: str | None = 'A', figsize: tuple | None = None, line_color: str | None = None, marker_color: str | None = None, marker_size: float | int | None = None, padding: float | int | None = 0.1, show: bool | None = True) FuncAnimation¶
It generates an animation of a
DCMotortorque-speed and torque-current characteristic curves and relative working points during the simulation.Each simulated time step is a frame on the animation.
It generates two subplots, one for each characteristic curve. It is possible to isolate a single characteristic to be plotted with optional parameters
torque_speed_curveandtorque_current_curve.The characteristic curves can be modified by the motor pulse width modulation
DCMotor.pwm.Plotted values’ units are managed with optional parameters
angular_speed_unit,torque_unitandcurrent_unit.Aesthetic parameters are managed with optional parameters
figsize,line_color,marker_color,marker_sizeandpadding.Parameters¶
motorDCMotorDC motor whose characteristic curves and working point have to be animated.
timelistThe list of
Timecomputed by the solver.intervalfloatorint, optionalDelay between animation frames in milliseconds. If not provided defaults to
200.torque_speed_curvebool, optionalWhether to plot the torque-speed characteristic curve. Default is
True.torque_current_curvebool, optionalWhether to plot the torque-current characteristic curve. Default is
True.angular_speed_unitstr, optionalSymbol of the unit of measurement to which convert the angular speed values in the plot. It must be a string. Default is
'rad/s'. SeeAngularSpeed.unitfor more details.torque_unitstr, optionalSymbol of the unit of measurement to which convert the torque values in the plot. It must be a string. Default is
'Nm'. SeeTorque.unitfor more details.current_unitstr, optionalSymbol of the unit of measurement to which convert the electric current values in the plot. It must be a string. Default is
'A'. SeeCurrent.unitfor more details.figsizetuple, optionalWidth and height of the window size, in inches. If not provided defaults to
[6.4, 4.8].line_colorstr, optionalColor of the characteristic curve lines. If not provided defaults to
'#1f77b4'.marker_colorstr, optionalColor of the motor working point marker. If not provided defaults to
'#ff7f0e'.marker_sizefloatorint, optionalSize, in points, of the motor working point marker. If not provided defaults to
6.paddingfloatorint, optionalExtra-space to be taken around each motor characteristics extreme points. It is expressed in percent points of the extreme point value. Default is
0.1, so it is taken 10% space around each characteristic extreme points.showbool, optionalWhether to show the animation. Default is
True.
Raises
TypeErrorIf
motoris not an instance ofDCMotor,if
timeis not alist,if an element of
timeis not an instance ofTime,if
torque_speed_curveis not abool,if
torque_current_curveis not abool,if
angular_speed_unitis not astr,if
torque_unitis not astr,if
current_unitis not astr,if
figsizeis not atuple,if
line_coloris not astr,if
marker_coloris not astr,if
showis not abool.
ValueErrorIf
timeis an emptylist,if both
torque_speed_curveandtorque_current_curveare set toFalse,if
torque_current_curveis set toTruebutmotorcannot computeDCMotor.electric_currentproperty,if
figsizehas not exactly two elements: one for width and the other for height,if
paddingis negative.