API Reference
Assembly
- class opentorsion.assembly.Assembly(shaft_elements, disk_elements=None, gear_elements=None)
Bases:
object
This class assembles the multi-degree of freedom system matrices, includes functions for modal analysis and response analysis.
- Attributes:
- shaft_elementslist
List containing the shaft elements
- disk_elementslist
List containing the disk elements
- gear_elementslist
List containing the gear elements
Methods
C_modal
(M, K[, xi])Full damping matrix for mechanical system obtained from modal damping matrix
E
()Assembles the gear constraint matrix
T
(E)Method for determining gear constraint transformation matrix
Assembles the damping matrix
Assembles the stiffness matrix
Assembles the mass matrix
Returns the number of degrees of freedom in the model
continuous_2_discrete
(A, B, ts)C2D computes a discrete-time model of a system (A_c,B_c) with sample time ts.
Solve system eigenmodes
modal_analysis
([C])Calculates the eigenvalues and eigenfrequencies of the assembly
nongearK
()Assembles the stiffness matrix when gears are not considered
ss_response
(excitations, omegas[, C])Calculation of the steady-state torsional response.
state_matrix
([C])Assembles the state matrices for eigenvalue calculation
state_space
([C])State space matrices of the second order system.
Calculates the undamped eigenvalues and eigenvectors of the assembly
vibratory_torque
(excitations, omegas, k_shafts)Vibratory torque calculation at one rotating speed.
- C_modal(M, K, xi=0.02)
Full damping matrix for mechanical system obtained from modal damping matrix
- Parameters:
- Mndarray
Assembly mass matrix, included for debugging reasons
- Kndarray
Assembly stiffness matrix, included for debugging reasons
- xifloat, optional
Modal damping factor, default is 0
- Returns:
- ndarray
The full damping matrix
- E()
Assembles the gear constraint matrix
- Returns:
- ndarray
The gear constraint matrix
- T(E)
Method for determining gear constraint transformation matrix
- Parameters:
- Endarray
The gear constraint matrix
- Returns:
- ndarray
The gear constraint transformation matrix
- assemble_C()
Assembles the damping matrix
- Returns:
- ndarray
The damping matrix assembled with component specific damping coefficients
- assemble_K()
Assembles the stiffness matrix
- Returns:
- ndarray
The stiffness matrix
- assemble_M()
Assembles the mass matrix
- Returns:
- ndarray
The mass matrix
- check_dof()
Returns the number of degrees of freedom in the model
- Returns:
- int
Number of degrees of freedom of the assembly
- continuous_2_discrete(A, B, ts)
C2D computes a discrete-time model of a system (A_c,B_c) with sample time ts. The function returns matrices Ad, Bd of the discrete-time system.
Parameters
- A: ndarray
Continuous system state matrix A
- B: ndarray
Continuous system input matrix B
- ts: float
Sample time for the discrete system
- Returns:
- Ad: ndarray
Discrete system state matrix A
- Bd: ndarray
Discrete system input matrix B
- eigenmodes()
Solve system eigenmodes
- Returns:
- complex ndarray
Eigenmode array, columns correspond to modes left to right starting from zero
- modal_analysis(C=None)
Calculates the eigenvalues and eigenfrequencies of the assembly
- Returns:
- ndarray
The undamped eigenfrequencies in rad/s
- ndarray
The damped eigenfrequencies in rad/s
- ndarray
The damping ratios
- nongearK()
Assembles the stiffness matrix when gears are not considered
- ss_response(excitations, omegas, C=None)
Calculation of the steady-state torsional response.
- Parameters:
- excitations: complex ndarray
A numpy array containing the excitationse each row corresponds to one node, and each column corresponds to one frequency.
- omegas: ndarray
Angular frequencies of the excitations
- C: ndarray, optional
Damping matrix, if not given, uses the default damping matrix
- Returns:
- complex ndarray
Displacement response
- complex ndarray
Speed response
- state_matrix(C=None)
Assembles the state matrices for eigenvalue calculation
- Parameters:
- Cndarray, optional
Damping matrix
- Returns:
- ndarray
The state matrix
- ndarray
The input matrix
- state_space(C=None)
State space matrices of the second order system.
- Parameters:
- C: ndarray, optional
Damping matrix, if not given, uses the default damping matrix
- Returns:
- A_sys: ndarray
State matrix A
- B_sys: ndarray
Input matrix B
- undamped_modal_analysis()
Calculates the undamped eigenvalues and eigenvectors of the assembly
- Returns:
- complex ndarray
The eigenvalues of the undamped assembly
- complex ndarray
The eigenvectors of the undamped assembly
- vibratory_torque(excitations, omegas, k_shafts, C=None)
Vibratory torque calculation at one rotating speed.
- Parameters:
- excitations: complex ndarray
A numpy array containing the excitationse each row corresponds to one node, and each column corresponds to one frequency.
- omegas: ndarray
Angular frequencies of the excitations
- k_shafts: ndarray
Stiffness values of the shafts
- C: ndarray, optional
Damping matrix, if not given, uses the default damping matrix
- Returns:
- ndarray
Vibratory torque at each shaft resulting from each excitation
Shaft element
- class opentorsion.elements.shaft_element.Shaft(nl, nr, L=None, odl=None, idl=0, G=80000000000.0, E=200000000000.0, rho=8000, k=None, I=0.0, c=0.0)
Bases:
object
A 2-degree of freedom shaft object A shaft with a constant circular cross-section can be defined using length and diameter values. Other types of shafts are defined using stiffness and moment of inertia values. Giving either the stiffness or inertia value overrides the given geometry.
Methods
C
()Damping matrix of a shaft element
K
()Stiffness matrix of a shaft element
M
()Mass matrix of a shaft element
- C()
Damping matrix of a shaft element
- K()
Stiffness matrix of a shaft element
- M()
Mass matrix of a shaft element
Disk element
- class opentorsion.elements.disk_element.Disk(node, I, c=0, k=0)
Bases:
object
A disk object
Methods
C
()Damping matrix of a disk element
K
()Stiffness matrix of a disk element
M
()Mass Matrix of 1 DOF disk element
- C()
Damping matrix of a disk element
- Returns:
- C: ndarray
Damping matrix of disk element
- K()
Stiffness matrix of a disk element
- Returns:
- K: ndarray
Stiffness matrix of the disk element
- M()
Mass Matrix of 1 DOF disk element
- Returns:
- M: ndarray
Mass matrix of the disk element
Gear element
- class opentorsion.elements.gear_element.Gear(node, I, R, parent=None)
Bases:
object
A gear object Gears consist of two parts, parent gear and child gear. One gear can have multiple children, but only one parent. Either radius or teeth count can be used, as long as the the use is constant.
Methods
C
()Damping matrix of a gear element.
K
()Stiffness matrix of a gear element.
M
()Mass Matrix of 1 DOF gear element.
- C()
Damping matrix of a gear element. Gears are assumed to have no damping.
- Returns:
- M: ndarray
Mass matrix of the gear element
- K()
Stiffness matrix of a gear element. Gears are assumed to be rigid.
- Returns:
- M: ndarray
Mass matrix of the gear element
- M()
Mass Matrix of 1 DOF gear element.
- Returns:
- M: ndarray
Mass matrix of the gear element
Excitation models
- class opentorsion.excitation.SystemExcitation(dofs, omegas, shape=None, harmonic=True, transient=False)
Bases:
object
This class is for building system excitation matrices.
- Attributes:
- dofsint
Number of degrees of freedom of the system
- omegasndarray
Array of excitation frequencies
- Undarray
Array of excitation amplitudes
Methods
add_harmonic
(node, amplitudes)Adds a harmonic excitaiton based on the omegas and amplitudes of the excitation this method should extensively check if all of the excitations have same size of omegas
add_sweep
(node, amplitude)Adds a sweep excitation with the given uniform amplitude to the given node
Excitation amplitudes for steady-state and vibratory torque analysis
excitation_frequencies
(interval)Excitation frequencies for steady-state and vibratory torque analysis
time_domain_excitation
(nodes, data)Excitation matrix for transient analysis.
- add_harmonic(node, amplitudes)
Adds a harmonic excitaiton based on the omegas and amplitudes of the excitation this method should extensively check if all of the excitations have same size of omegas
- Parameters:
- nodeint
Node number where excitation is inputted
- amplitudesndarray
Harmonic excitation amplitudes
- add_sweep(node, amplitude)
Adds a sweep excitation with the given uniform amplitude to the given node
- Parameters:
- nodeint
Node number where excitation is inputted
- amplitudendarray
Harmonic excitation amplitudes
- excitation_amplitudes()
Excitation amplitudes for steady-state and vibratory torque analysis
- Returns:
- ndarray
The excitation amplitude matrix
- excitation_frequencies(interval)
Excitation frequencies for steady-state and vibratory torque analysis
- Parameters:
- intervallist
Lowest and highest excitation frequency values
- Returns:
- ndarray
Excitation frequencies evenly spaced over the specified interval
- time_domain_excitation(nodes, data)
Excitation matrix for transient analysis. The function takes as input the node numbers where excitation data is inputted and the time domain excitation data. The excitation data must be listed in the same order as the listed nodes. The excitation data arrays must be of equal length.
- Parameters:
- nodes: list, int
List of nodes where excitation data is inputted
- data: list, ndarray
Excitation amplitudes as a list of (1 x n) shaped numpy arrays
- Returns:
- ndarray
Excitation matrix in time domain, containing excitation amplitudes for each time step
- class opentorsion.excitation.TransientExcitations(ts, t_excite, magnitude)
Bases:
object
This class is for creating transient excitations. The excitations currently availible are step and impulse.
- Attributes:
- tsfloat
Time step size
- t_excitefloat
Time instance for applying the excitation
- magnitudefloat
Excitation magnitude
Methods
impulse_next
(t)Calculates the next impulse excitation.
step_next
(t)Calculates the next step excitation.
- impulse_next(t)
Calculates the next impulse excitation.
- Parameters:
- tfloat
Current time step
- Returns:
- float
Torque magnitude of the next excitation
- step_next(t)
Calculates the next step excitation.
- Parameters:
- tfloat
Current time step
- Returns:
- float
Torque magnitude of the next step excitation
Plots
- class opentorsion.plots.Plots(assembly)
Bases:
object
This class includes plotting functions
- Attributes:
- assemblyopenTorsion Assembly class instance
Methods
Plots the given assembly as disk and spring elements
plot_campbell
([frequency_range_rpm, ...])Plots the Campbell diagram
plot_eigenmodes
([modes])Updated eigenmode plot.
plot_on_ax
(assembly, ax[, alpha])Plots disk and spring elements
torque_response_plot
(omegas, T[, show_plot])Plots forced response amplitude as a function of rotational speed.
- plot_assembly()
Plots the given assembly as disk and spring elements
- plot_campbell(frequency_range_rpm=[0, 1000], num_modes=5, harmonics=[1, 2, 3, 4], operating_speeds_rpm=[])
Plots the Campbell diagram
- Parameters:
- frequency_rangelist, optional
Analysis frequency range, default is 0 to 100 Hz
- num_modesint, optional
Number of modes to be plotted
- harmonicslist, optional
List containing the harmonic multipliers
- plot_eigenmodes(modes=5)
Updated eigenmode plot. Geared systems not supported. The eigenvectors are plotted over the assembly schematic, and the trajectories are plotted with dashed lines. Each plotted eigenvector is rotated so that the node with maximum abs displacement has phase of 0
- Parameters:
- modesint
Number of eigenodes to be plotted
- plot_on_ax(assembly, ax, alpha=1)
Plots disk and spring elements
- torque_response_plot(omegas, T, show_plot=False)
Plots forced response amplitude as a function of rotational speed.