solver¶
- class Solver(powertrain: Powertrain)
Bases:
objectSolverobject.Methods¶
run()It runs the powertrain simulation.
Raises
TypeErrorIf
powertrainis not an instance ofPowertrain,if the first element in
powertrainis not an instance ofMotorBase,if an element of
powertrainis not an instance ofRotatingObject.
ValueErrorIf
Powertrain.elementsis an emptytuple.
- 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_discretizationTimeIntervalTime discretization to be used for the simulation.
simulation_timeTimeIntervalDuration of the simulation.
motor_controlMotorControlBase, optionalRules to control the powertrain motor.
stop_conditionStopCondition, optionalSimulation stopping condition.
Raises
TypeErrorIf
time_discretizationis not an instance ofTimeInterval,if
simulation_timeis not an instance ofTimeInterval,if
motor_controlis not an instance ofMotorControlBase,if
stop_conditionis not an instance ofStopCondition,if function
external_torqueof one gear in the powertrain elements does not return an instance ofTorque,
ValueErrorIf
time_discretizationis greater or equal tosimulation_time,if function
external_torquehas not been defined for any gear of the powertrain.
Notes
If
Powertrain.timeis an emptylist, it performs the simulation starting the time from0 sec; otherwise it concatenates another simulation to existing values of time and time variables.