Example modules

Examples, which can be run locally. For instructions on how to use openTorsion, please refer to Tutorials.

opentorsion.examples.forced_response

opentorsion.examples.forced_response.forced_response()

First a model of a windmill is created as a system of three lumped masses connected by two shafts. The assembly is given harmonic excitation as input. Finally, the system response is calculated and plotted.

opentorsion.examples.forced_response.generator_torque(rpm)

Generator torque as a function of rotor rotating speed.

opentorsion.examples.forced_response.get_windmill_excitation(rpm)

Cogging torque and torque ripple as harmonic excitation. (Table III from https://doi.org/10.1109/TIE.2010.2087301)

opentorsion.examples.roll

opentorsion.examples.roll.back_to_back_testbench()

Example of a powertrain with shaft, lumped mass and gear elements.

opentorsion.examples.windmill

opentorsion.examples.windmill.windmill_assembly()

A shaft-line Finite Element Model of a windmill based on model presented in https://doi.org/10.1109/TIE.2010.2087301. A mechanical shaft-line FEM consists of shaft elements, disk elements/lumped masses (optional) and gear elements (optional). Elements are initiated by calling Shaft(), Disk() or Gear(). The elements take as inputs the element node number and element parameter values (refer to shaft_element.py, disk_element.py and gear_element.py documentation).

opentorsion.examples.ICE_example

Calculates the steady-state torsional vibration in the crankshaft of an internal combustion engine. Torque produced by each cylinder is calculated from the force produced by the pressure from ignition which is scaled according to the rotation speed of the crankshaft. Torsional vibration analysis based on https://doi.org/10.1243/14644193JMBD126 The model is based on Fig.4 of the original article.

opentorsion.examples.ICE_example.ICE_example.calculate_cylinder_torque(speed_rpm, num_points=500)

Calculates the torque produced by a single cylinder at given rpm. Torque is based on the tangential force caused by the pressure in the cylinder and the tangential component of the oscillating inertial force from the crankshaft spinning.

Parameters:
speed_rpm: float

Current rotation speed in rpm

num_points: float, optional

Number of points for the x-axis

Returns:
M_t: ndarray

The torque produced by the cylinder

alpha: ndarray

Angles for which the cylinder torques are given

opentorsion.examples.ICE_example.ICE_example.calculate_dft_components(signal, t, num_harmonics)

Calculates dft components and harmonics (0,0.5,1,…) for the given signal, to be used at stedy-state vibration calculations.

Parameters:
signal: ndarray

Cylinder torque

t: ndarray

Crankshaft rotation angle

num_harmonics: float

Number of harmonics considered

Returns:
complex ndarray

The first num_harmonics complex components of the Fourier transform

complex ndarray

The first num_harmonics components of the harmonics

opentorsion.examples.ICE_example.ICE_example.calculate_response(crankshaft, rpm)

Calculates the crankshaft’s response to excitation at given rpm.

Parameters:
crankshaft: openTorsion Assembly class instance

Opentorsion Assembly of the crankshaft

rpm: float

Current rotation speed in rpm

Returns:
sum_response: ndarray

Array containing maximum vibratory torque at current rotation speed for each shaft

opentorsion.examples.ICE_example.ICE_example.crankshaft_assembly()

A shaft-line Finite Element Model of a crankshaft based on model presented in https://doi.org/10.1243/14644193JMBD126 Fig.4.

Returns:
assembly: openTorsion Assembly class instance

The created opentorsion assembly

opentorsion.examples.ICE_example.ICE_example.peak_pressures()

Load digitized peak pressure from csv and pass it to interpolator

opentorsion.examples.ICE_example.ICE_example.plot_results(rpms, vibratory_torque)

Plots the vibratory torque in wanted shafts for each considered engine speed.

Parameters:
rpms: ndarray

All considered engine speeds in rpm

vibratory_torque: ndarray

Matrix containing maximum vibratory torque at each rotation speed for each shaft. Each row correspond to an engine speed and each column to a shaft.

Returns:
shaft_8: ndarray

Array containing maximum vibratory torque at all considered engine speeds for shaft between flywheel and 6th cylinder

shaft_1: ndarray

Array containing maximum vibratory torque at all considered engine speeds for shaft between crankshaft pulley and gear train

opentorsion.examples.ICE_example.ICE_example.pressure_curve()

Load digitized pressure curve from csv and pass it to interpolator

opentorsion.examples.ICE_example.ICE_example.relative_damping_C(assembly, d, w)

Updates the damping matrix C of assembly when using frequency dependent relative damping.

Parameters:
assembly: openTorsion Assembly class instance

The assembly of whose damping matrix is to be updated

d: float

Loss factor property, used to calculate relative damping

w: float

Angular frequency of the system, used to calculate relative damping

Returns:
C: ndarray

The damping matrix assembled with new component specific damping coefficients

opentorsion.examples.ICE_example.ICE_example.scaled_cylinder_pressure(rpm, num_points)

Scales the cylinder pressure curve based on the variation of peak pressure with engine speed.

Returns:
angles: np.ndarray

Angles for which the cylinder pressures are given

scaled_curve: np.ndarray

The scaled pressure curve scaled to the given rpm corresponding to the angles. (Pa)