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, title_decimals: int | None = 2, show: bool | None = True) FuncAnimation

It generates an animation of a DCMotor torque-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_curve and torque_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_unit and current_unit.

Aesthetic parameters are managed with optional parameters figsize, line_color, marker_color, marker_size and padding.

Parameters

motorDCMotor

DC motor whose characteristic curves and working point have to be animated.

timelist

The list of Time computed by the solver.

intervalfloat or int, optional

Delay between animation frames in milliseconds. If not provided defaults to 200.

torque_speed_curvebool, optional

Whether to plot the torque-speed characteristic curve. Default is True.

torque_current_curvebool, optional

Whether to plot the torque-current characteristic curve. Default is True.

angular_speed_unitstr, optional

Symbol of the unit of measurement to which convert the angular speed values in the plot. It must be a string. Default is 'rad/s'. See AngularSpeed.unit for more details.

torque_unitstr, optional

Symbol of the unit of measurement to which convert the torque values in the plot. It must be a string. Default is 'Nm'. See Torque.unit for more details.

current_unitstr, optional

Symbol of the unit of measurement to which convert the electric current values in the plot. It must be a string. Default is 'A'. See Current.unit for more details.

figsizetuple, optional

Width and height of the window size, in inches. If not provided defaults to [6.4, 4.8].

line_colorstr, optional

Color of the characteristic curve lines. If not provided defaults to '#1f77b4'.

marker_colorstr, optional

Color of the motor working point marker. If not provided defaults to '#ff7f0e'.

marker_sizefloat or int, optional

Size, in points, of the motor working point marker. If not provided defaults to 6.

paddingfloat or int, optional

Extra-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.

Added in version 1.3.0.

title_decimalsint, optional

Number of decimals for time and PWM value reported in the title.

showbool, optional

Whether to show the animation. Default is True.

Raises

TypeError
  • If motor is not an instance of DCMotor,

  • if time is not a list,

  • if an element of time is not an instance of Time,

  • if interval is not a float or an int,

  • if torque_speed_curve is not a bool,

  • if torque_current_curve is not a bool,

  • if angular_speed_unit is not a str,

  • if torque_unit is not a str,

  • if current_unit is not a str,

  • if figsize is not a tuple,

  • if an element of figsize is not a float or an int,

  • if line_color is not a str,

  • if marker_color is not a str,

  • if marker_size is not a float or an int,

  • if padding is not a float or an int,

  • if title_decimals is not a int,

  • if show is not a bool.

ValueError
  • If time is an empty list,

  • if both torque_speed_curve and torque_current_curve are set to False,

  • if torque_current_curve is set to True but motor cannot compute DCMotor.electric_current property,

  • if figsize has not exactly two elements: one for width and the other for height,

  • if padding is negative.