plot

Powertrain.plot(elements: list[RotatingObject | str] | None = None, variables: list[str] | None = None, angular_position_unit: str | None = 'rad', angular_speed_unit: str | None = 'rad/s', angular_acceleration_unit: str | None = 'rad/s^2', torque_unit: str | None = 'Nm', force_unit: str | None = 'N', stress_unit: str | None = 'MPa', current_unit: str | None = 'A', time_unit: str | None = 'sec', figsize: tuple | None = None) None

It plots time variables for selected elements in the powertrain’s elements.

It generates a grid of subplots, one column for each selected element of the powertrain’s elements and one row for each selected time variable.

The available elements are listed in elements and the available variables are: 'angular position', 'angular speed', 'angular acceleration', 'torque', 'driving torque' and 'load torque'. The motor can have additional variables electric current and pwm while gears can have additional variables tangential force, bending stress and contact stress, depending on instantiation parameters.

The time variables are plotted in the described order, from the top row to the bottom one; torques are grouped together in a single row as well as stresses are grouped together. Plotted values’ units are managed with optional parameters.

Elements to be plotted can be passed as instances or names (str) in a list.

Parameters

elementslist, optional

Elements of the powertrain’s elements which time variables have to be plotted. Each single element can be passed as instance or name (str). Default is all elements in the powertrain’s elements.

variableslist, optional

Time variables to be plotted. Default is all available time variables.

angular_position_unitstr, optional

Symbol of the unit of measurement to which convert the angular position values in the plot. It must be a str. Default is 'rad'. See AngularPosition.unit for more details.

angular_speed_unitstr, optional

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

angular_acceleration_unitstr, optional

Symbol of the unit of measurement to which convert the angular acceleration values in the plot. It must be a str. Default is 'rad/s^2'. See AngularAcceleration.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 str. Default is 'Nm'. See Torque.unit for more details.

force_unitstr, optional

Symbol of the unit of measurement to which convert the force values in the plot. It must be a str. Default is 'N'. See Force.unit for more details.

stress_unitstr, optional

Symbol of the unit of measurement to which convert the stress values in the plot. It must be a str. Default is 'MPa'. See Stress.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 str. Default is 'A'. See Current.unit for more details.

time_unitstr, optional

Symbol of the unit of measurement to which convert the time values in the plot. It must be a str. Default is 'sec'. See Time.unit for more details.

figsizetuple, optional

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

Raises

TypeError
  • If elements is not a list,

  • if an element of elements is not an instance of RotatingObject or a str,

  • if variables is not a list,

  • if an element of variables is not a str,

  • if angular_position_unit is not a str,

  • if angular_speed_unit is not a str,

  • if angular_acceleration_unit is not a str,

  • if torque_unit is not a str,

  • if force_unit is not a str,

  • if stress_unit is not a str,

  • if current_unit is not a str,

  • if time_unit is not a str,

  • if figsize is not a tuple,

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

ValueError
  • If elements is an empty list,

  • if an element of elements is not in elements,

  • if variables is an empty list,

  • if an element of variables is not a valid time variable,

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