snapshot

Powertrain.snapshot(target_time: Time, 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', driving_torque_unit: str | None = 'Nm', load_torque_unit: str | None = 'Nm', force_unit: str | None = 'N', stress_unit: str | None = 'MPa', current_unit: str | None = 'A', print_data: bool | None = True) DataFrame

It computes a snapshot of the time variables of the elements in the powertrain at the specified target_time.

It returns a pandas.DataFrame with the computed time variables. Each element in the powertrain’s elements is a row of the DataFrame, while the columns are the time variables '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 parameters 'tangential force', 'bending stress' and 'contact stress', depending on instantiation parameters.

It is possible to select the variables to be printed with the variables parameter.

Each time variable is converted to the relative unit passed as optional parameter.

If the target_time is not among simulated time steps in the time property, it computes a linear interpolation from the two closest simulated time steps.

Parameters

target_timeTime

The time to which compute the powertrain time variables’ snapshot. It must be an instance of Time, whose value must be within minimum and maximum simulated time steps in time property.

variableslist, optional

Time variables to be printed. It must be a list. 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 DataFrame. 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 DataFrame. 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 DataFrame. 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 DataFrame. It must be a str. Default is 'Nm'. See Torque.unit for more details.

driving_torque_unitstr, optional

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

load_torque_unitstr, optional

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

print_databool, optional

Whether to print the computed time variables DataFrame. Default is True.

Returns

pandas.DataFrame

The DataFrame containing time variables values at the specified target_time for each element in the powertrain’s elements.

Raises

TypeError
  • If an element of time is not an instance of Time,

  • if target_time is not an instance of Time,

  • 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 driving_torque_unit is not a str,

  • if load_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 print_data is not a bool.

ValueError
  • If time is an empty list,

  • if target_time is outside simulation interval,

  • if variables is an empty list,

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