solver

class Solver(powertrain: Powertrain)

Bases: object

Solver object.

Methods

run()

It runs the powertrain simulation.

Raises

TypeError
  • If powertrain is not an instance of Powertrain,

  • if the first element in powertrain is not an instance of MotorBase,

  • if an element of powertrain is not an instance of RotatingObject.

ValueError

If Powertrain.elements is an empty tuple.

run(time_discretization: TimeInterval, simulation_time: TimeInterval, motor_control: MotorControlBase | None = None, stop_condition: StopCondition | None = None) None

It runs the powertrain simulation.

The simulation is performed in several steps:

  • it computes the whole powertrain equivalent moment of inertia with respect to the last gear, by multiplying each element’s moment of inertia, starting from the motor, by it gear ratio with respect to the following element in the powertrain elements and sum them up,

  • for each time step and for each powertrain element, it computes:

    • the angular position and angular speed, from the last element in the powertrain elements to the first one,

    • the driving torque, load torque, net torque, electrical current for motors (if computable), tangential force, bending stress and contact stress for gears (if computable), motor control rules (if available), simulation stopping condition (if available),

    • the angular acceleration of each powertrain element,

  • for each time step it performs a time integration to compute angular position and speed of the last element in the powertrain elements.

Parameters

time_discretizationTimeInterval

Time discretization to be used for the simulation.

simulation_timeTimeInterval

Duration of the simulation.

motor_controlMotorControlBase, optional

Rules to control the powertrain motor.

stop_conditionStopCondition, optional

Simulation stopping condition.

Raises

TypeError
  • If time_discretization is not an instance of TimeInterval,

  • if simulation_time is not an instance of TimeInterval,

  • if motor_control is not an instance of MotorControlBase,

  • if stop_condition is not an instance of StopCondition,

  • if function external_torque of one gear in the powertrain elements does not return an instance of Torque,

ValueError
  • If time_discretization is greater or equal to simulation_time,

  • if function external_torque has not been defined for any gear of the powertrain.

Notes

If Powertrain.time is an empty list, it performs the simulation starting the time from 0 sec; otherwise it concatenates another simulation to existing values of time and time variables.