ross.GearElement
Contents
ross.GearElement#
- class ross.GearElement(n, m, Id, Ip, n_teeth, pitch_diameter=None, base_diameter=None, pr_angle=None, helix_angle=0, bore_diameter=None, material=Material(name='Steel', rho=7.81000e+03, G_s=8.12000e+10, E=2.11000e+11, specific_heat=0.00000e+00, thermal_conductivity=0.00000e+00, color='#525252'), tag=None, scale_factor=1.0, color='Goldenrod')#
A gear element.
This class creates a gear element from input data of inertia and mass.
- Parameters:
- n: int
Node in which the gear will be inserted.
- mfloat, pint.Quantity
Mass of the gear element (kg).
- Idfloat, pint.Quantity
Diametral moment of inertia.
- Ipfloat, pint.Quantity
Polar moment of inertia.
- n_teethint
Number of teeth.
- base_diameterfloat, pint.Quantity
Base diameter (m). If given pitch_diameter is not necessary.
- pitch_diameterfloat, pint.Quantity
Pitch diameter (m). If given base_diameter is not necessary.
- pr_anglefloat, pint.Quantity, optional
The normal pressure angle (rad). Default is 20 deg (converted to rad).
- helix_angle: float, pint.Quantity, optional
Helix angle for helical gears (rad). Default is 0, representing spur gear.
- bore_diameterfloat, pint.Quantity, optional
Inner diameter, the radius of the shaft on which the gear is mounted (m). If provided, it could be used to calculate gear mesh stiffness. Default is None.
- materialross.Material, optional
Gear’s construction material. If provided, it could be used to calculate gear mesh stiffness. Default is steel.
- tagstr, optional
A tag to name the element. Default is None.
- scale_factor: float or str, optional
The scale factor is used to scale the gear drawing. For gears it is also possible to provide ‘mass’ as the scale factor. In this case the code will calculate scale factors for each gear based on the gear with the higher mass. Notice that in this case you have to create all gears with the scale_factor=’mass’. Default is 1.
- colorstr, optional
A color to be used when the element is represented. Default is ‘Goldenrod’.
Examples
>>> gear = GearElement( ... n=0, m=4.67, Id=0.015, Ip=0.030, ... pitch_diameter=0.187, n_teeth=26, ... pr_angle=Q_(22.5, "deg"), helix_angle=0, ... ) >>> gear.base_radius 0.086382...
Methods
- C()#
Damping matrix for an instance of a disk element.
This method will return the damping matrix for an instance of a disk element.
- Returns:
- Cnp.ndarray
A matrix of floats containing the values of the damping matrix.
Examples
>>> disk = disk_example() >>> disk.C() array([[0., 0., 0., 0., 0., 0.], [0., 0., 0., 0., 0., 0.], [0., 0., 0., 0., 0., 0.], [0., 0., 0., 0., 0., 0.], [0., 0., 0., 0., 0., 0.], [0., 0., 0., 0., 0., 0.]])
- G()#
Gyroscopic matrix for an instance of a disk element.
This method will return the gyroscopic matrix for an instance of a disk element.
- Returns:
- G: np.ndarray
Gyroscopic matrix for the disk element.
Examples
>>> disk = DiskElement(0, 32.58972765, 0.17808928, 0.32956362) >>> disk.G().round(2) array([[ 0. , 0. , 0. , 0. , 0. , 0. ], [ 0. , 0. , 0. , 0. , 0. , 0. ], [ 0. , 0. , 0. , 0. , 0. , 0. ], [ 0. , 0. , 0. , 0. , 0.33, 0. ], [ 0. , 0. , 0. , -0.33, 0. , 0. ], [ 0. , 0. , 0. , 0. , 0. , 0. ]])
- K()#
Stiffness matrix for an instance of a disk element.
This method will return the stiffness matrix for an instance of a disk element.
- Returns:
- Knp.ndarray
A matrix of floats containing the values of the stiffness matrix.
Examples
>>> disk = disk_example() >>> disk.K().round(2) array([[0., 0., 0., 0., 0., 0.], [0., 0., 0., 0., 0., 0.], [0., 0., 0., 0., 0., 0.], [0., 0., 0., 0., 0., 0.], [0., 0., 0., 0., 0., 0.], [0., 0., 0., 0., 0., 0.]])
- Kdt()#
Dynamic stiffness matrix for an instance of a disk element.
Stiffness matrix for the disk element associated with the transient motion. It needs to be multiplied by the angular acceleration when considered in time dependent analyses.
- Returns:
- Kdtnp.ndarray
A matrix of floats containing the values of the dynamic stiffness matrix.
Examples
>>> disk = disk_example() >>> disk.Kdt().round(2) array([[0. , 0. , 0. , 0. , 0. , 0. ], [0. , 0. , 0. , 0. , 0. , 0. ], [0. , 0. , 0. , 0. , 0. , 0. ], [0. , 0. , 0. , 0. , 0. , 0. ], [0. , 0. , 0. , 0.33, 0. , 0. ], [0. , 0. , 0. , 0. , 0. , 0. ]])
- M()#
Mass matrix for an instance of a disk element.
This method will return the mass matrix for an instance of a disk element.
- Returns:
- Mnp.ndarray
A matrix of floats containing the values of the mass matrix.
Examples
>>> disk = DiskElement(0, 32.58972765, 0.17808928, 0.32956362) >>> disk.M().round(2) array([[32.59, 0. , 0. , 0. , 0. , 0. ], [ 0. , 32.59, 0. , 0. , 0. , 0. ], [ 0. , 0. , 32.59, 0. , 0. , 0. ], [ 0. , 0. , 0. , 0.18, 0. , 0. ], [ 0. , 0. , 0. , 0. , 0.18, 0. ], [ 0. , 0. , 0. , 0. , 0. , 0.33]])
- __init__(n, m, Id, Ip, n_teeth, pitch_diameter=None, base_diameter=None, pr_angle=None, helix_angle=0, bore_diameter=None, material=Material(name='Steel', rho=7.81000e+03, G_s=8.12000e+10, E=2.11000e+11, specific_heat=0.00000e+00, thermal_conductivity=0.00000e+00, color='#525252'), tag=None, scale_factor=1.0, color='Goldenrod')#
- static calculate_Id(Ip, m, width)#
Calculate the diametral moment of inertia of a disk from its geometry.
- Parameters:
- Ipfloat
Polar moment of inertia of the disk element (kg.m^2).
- mfloat
Mass of the disk element (kg).
- widthfloat
Width of the disk (m).
- Returns:
- Idfloat
Diametral moment of inertia of the disk element (kg.m^2).
- static calculate_Ip(m, i_d, o_d)#
Calculate the polar moment of inertia of a disk from its geometry.
- Parameters:
- mfloat
Mass of the disk element (kg).
- i_dfloat
Inner diameter of the disk (m).
- o_dfloat
Outer diameter of the disk (m).
- Returns:
- Ipfloat
Polar moment of inertia of the disk element (kg.m^2).
- static calculate_mass(rho, width, i_d, o_d)#
Calculate the mass of a disk from its geometry.
- Parameters:
- rhofloat
Density of the disk material (kg/m^3).
- widthfloat
Width of the disk (m).
- i_dfloat
Inner diameter of the disk (m).
- o_dfloat
Outer diameter of the disk (m).
- Returns:
- massfloat
Mass of the disk element (kg).
- static calculate_width(rho, m, i_d, o_d)#
Calculate the width of a disk from its geometry and mass.
- Parameters:
- rhofloat
Density of the disk material (kg/m^3).
- mfloat
Mass of the disk element (kg).
- i_dfloat
Inner diameter of the disk (m).
- o_dfloat
Outer diameter of the disk (m).
- Returns:
- widthfloat
Width of the disk element (m).
- dof_local_index()#
Get the local index for a element specific degree of freedom.
- Returns:
- local_index: namedtupple
A named tuple containing the local index.
Examples
>>> # Example using BearingElement >>> from ross.bearing_seal_element import bearing_example >>> bearing = bearing_example() >>> bearing.dof_local_index() LocalIndex(x_0=0, y_0=1, z_0=2)
- dof_mapping()#
Degrees of freedom mapping.
Returns a dictionary with a mapping between degree of freedom and its index.
- Returns:
- dof_mappingdict
A dictionary containing the degrees of freedom and their indexes.
Examples
The numbering of the degrees of freedom for each node.
Being the following their ordering for a node:
x_0 - horizontal translation y_0 - vertical translation z_0 - axial translation alpha_0 - rotation around horizontal beta_0 - rotation around vertical theta_0 - torsion around axial
>>> disk = disk_example() >>> disk.dof_mapping() {'x_0': 0, 'y_0': 1, 'z_0': 2, 'alpha_0': 3, 'beta_0': 4, 'theta_0': 5}
- classmethod from_geometry(n, material, width, i_d, o_d, n_teeth, pr_angle=None, helix_angle=0, tag=None, scale_factor=1.0, color='Goldenrod')#
Create a gear element from geometry properties.
This class method will create a gear element from geometry data. Properties are calculated as per [Friswell, 2010], appendix 1 for a hollow cylinder:
Mass:
\(m = \rho \pi w (d_o^2 - d_i^2) / 4\)
Polar moment of inertia:
\(I_p = m (d_o^2 + d_i^2) / 8\)
Diametral moment of inertia:
\(I_d = \frac{1}{2} I_p + \frac{1}{12} m w^2\)
Where \(\rho\) is the material density, \(w\) is the gear width, \(d_o\) is the outer diameter and \(d_i\) is the inner diameter.
- Parameters:
- nint
Node in which the gear will be inserted.
- materialross.Material
Gear’s construction material.
- widthfloat, pint.Quantity
The face width of the gear considering that the gear body has the same thickness (m).
- i_dfloat, pint.Quantity
Bore, inner diameter, the diameter of the shaft on which the gear is mounted (m).
- o_dfloat, pint.Quantity
Pitch diameter (m).
- n_teethint
Number of teeth.
- pr_anglefloat, pint.Quantity, optional
The normal pressure angle (rad). Default is 20 deg (converted to rad).
- helix_angle: float, pint.Quantity, optional
Helix angle for helical gears (rad). Default is 0, representing spur gear.
- tagstr, optional
A tag to name the element. Default is None.
- scale_factor: float, optional
The scale factor is used to scale the gear drawing. Default is 1.
- colorstr, optional
A color to be used when the element is represented. Default is ‘Goldenrod’.
- Attributes:
- mfloat
Mass of the gear element.
- Idfloat
Diametral moment of inertia.
- Ipfloat
Polar moment of inertia.
Examples
>>> from ross.materials import steel >>> gear = GearElement.from_geometry(0, steel, 0.07, 0.05, 0.28, 50) >>> gear.base_radius 0.131556... >>>
- classmethod from_table(file, sheet_name=0, tag=None, scale_factor=None, color=None)#
Instantiate one or more disks using inputs from an Excel table.
A header with the names of the columns is required. These names should match the names expected by the routine (usually the names of the parameters, but also similar ones). The program will read every row bellow the header until they end or it reaches a NaN.
- Parameters:
- filestr
Path to the file containing the disk parameters.
- sheet_nameint or str, optional
Position of the sheet in the file (starting from 0) or its name. If none is passed, it is assumed to be the first sheet in the file.
- taglist, str, optional
Tag or list of tags for the disk elements. Default is None
- scale_factor: list, float, optional
Scale factor or list of scale factors for the disk elements patches. The scale factor is used to scale the disk drawing. If None, a default list of 1s is used.
- colorlist, str, optional
A color or list of colors to be used when the element is represented. If None, a default list of ‘Firebrick’ is used.
- Returns:
- disklist
A list of disk objects.
Examples
>>> import os >>> file_path = os.path.dirname(os.path.realpath(__file__)) + '/tests/data/shaft_si.xls' >>> list_of_disks = DiskElement.from_table(file_path, sheet_name="More") >>> list_of_disks[0] DiskElement(Id=0.0, Ip=0.0, m=15.12, color='Firebrick', n=3, scale_factor=1, tag=None)
- get_class_name_prefix(index=None)#
Extract prefix of the class name preceding ‘Element’, insert spaces before uppercase letters, and append an index number at the end.
- Parameters:
- indexint, optional
The index number to append at the end of the resulting string. Default is None.
- Returns:
- prefixstr
The processed class name prefix.
Examples
>>> # Example using BearingElement >>> from ross.bearing_seal_element import bearing_example >>> bearing = bearing_example() >>> bearing.get_class_name_prefix() 'Bearing'
- classmethod get_subclasses()#
Get all subclasses of the Element class.
- Returns:
- subclasseslist
A list containing all subclasses of the Element class.
- classmethod load(file)#
Load an element from a .toml or .json file.
- Parameters:
- filestr, pathlib.Path
The name of the file the element will be loaded from.
- Returns:
- The element object.
- classmethod read_toml_data(data)#
Read and parse data stored in a .toml or .json file.
The data passed to this method needs to be according to the format saved by the .save() method.
- Parameters:
- datadict
Dictionary obtained from toml.load() or json.load().
- Returns:
- The element object.
Examples
>>> # Example using BearingElement >>> from tempfile import tempdir >>> from pathlib import Path >>> from ross.bearing_seal_element import bearing_example >>> from ross.bearing_seal_element import BearingElement >>> # create path for a temporary file >>> file = Path(tempdir) / 'bearing1.toml' >>> bearing1 = bearing_example() >>> bearing1.save(file) >>> bearing1_loaded = BearingElement.load(file) >>> bearing1 == bearing1_loaded True
- save(file)#
Save the element in a .toml or .json file.
This function will save the element to a .toml or .json file. The file will have all the argument’s names and values that are needed to reinstantiate the element.
- Parameters:
- filestr, pathlib.Path
The name of the file the element will be saved in. The format is determined by the file extension (.toml or .json).
Examples
>>> # Example using DiskElement >>> from tempfile import tempdir >>> from pathlib import Path >>> from ross.disk_element import disk_example >>> # create path for a temporary file >>> file = Path(tempdir) / 'disk.toml' >>> disk = disk_example() >>> disk.save(file)
- summary()#
Present a summary for the element.
A pandas series with the element properties as variables.
- Returns:
- A pandas series.
Examples
>>> # Example using DiskElement >>> from ross.disk_element import disk_example >>> disk = disk_example() >>> disk.summary() n 0 n_l 0 n_r 0...