ross.stochastic.ST_BearingElement
Contents
ross.stochastic.ST_BearingElement#
- class ross.stochastic.ST_BearingElement(n, kxx, cxx, mxx=None, kyy=None, kxy=0, kyx=0, cyy=None, cxy=0, cyx=0, myy=None, mxy=0, myx=0, frequency=None, tag=None, n_link=None, scale_factor=1, is_random=None)#
Random bearing element.
Creates an object containing a list with random instances of BearingElement.
Considering constant coefficients, use an 1-D array to make it random. Considering varying coefficients to the frequency, use a 2-D array to make it random (*see the Examples below).
- Parameters:
- n: int
Node which the bearing will be located in
- kxx: float, 1-D array, 2-D array
Direct stiffness in the x direction.
- cxx: float, 1-D array, 2-D array
Direct damping in the x direction.
- kyy: float, 1-D array, 2-D array, optional
Direct stiffness in the y direction. (defaults to kxx)
- kxy: float, 1-D array, 2-D array, optional
Cross coupled stiffness in the x direction. (defaults to 0)
- kyx: float, 1-D array, 2-D array, optional
Cross coupled stiffness in the y direction. (defaults to 0)
- cyy: float, 1-D array, 2-D array, optional
Direct damping in the y direction. (defaults to cxx)
- cxy: float, 1-D array, 2-D array, optional
Cross coupled damping in the x direction. (defaults to 0)
- cyx: float, 1-D array, 2-D array, optional
Cross coupled damping in the y direction. (defaults to 0)
- frequency: array, optional
Array with the frequencies (rad/s).
- tag: str, optional
A tag to name the element Default is None.
- n_link: int, optional
Node to which the bearing will connect. If None the bearing is connected to ground. Default is None.
- scale_factor: float, optional
The scale factor is used to scale the bearing drawing. Default is 1.
- is_randomlist
List of the object attributes to become stochastic. Possibilities:
[“kxx”, “kxy”, “kyx”, “kyy”, “cxx”, “cxy”, “cyx”, “cyy”]
- Attributes:
- elements_listlist
display the list with random bearing elements.
Methods
- __init__(n, kxx, cxx, mxx=None, kyy=None, kxy=0, kyx=0, cyy=None, cxy=0, cyx=0, myy=None, mxy=0, myx=0, frequency=None, tag=None, n_link=None, scale_factor=1, is_random=None)#
- plot_random_var(var_list=None, histogram_kwargs=None, plot_kwargs=None)#
Plot histogram and the PDF.
This function creates a histogram to display the random variable distribution.
- Parameters:
- var_listlist, optional
List of random variables, in string format, to plot. Default is plotting all the random variables.
- histogram_kwargsdict, optional
Additional key word arguments can be passed to change the plotly.go.histogram (e.g. histnorm=”probability density”, nbinsx=20…). *See Plotly API to more information.
- plot_kwargsdict, optional
Additional key word arguments can be passed to change the plotly go.figure (e.g. line=dict(width=4.0, color=”royalblue”), opacity=1.0, …). *See Plotly API to more information.
- Returns:
- figPlotly graph_objects.Figure()
A figure with the histogram plots.
Examples
>>> import ross.stochastic as srs >>> elm = srs.st_bearing_example() >>> fig = elm.plot_random_var(["kxx"]) >>> # fig.show()
- random_var(is_random, *args)#
Generate a list of objects as random attributes.
This function creates a list of objects with random values for selected attributes from ross.BearingElement.
- Parameters:
- is_randomlist
List of the object attributes to become stochastic.
- *argsdict
Dictionary instanciating the ross.BearingElement class. The attributes that are supposed to be stochastic should be set as lists of random variables.
- Returns:
- f_listgenerator
Generator of random objects.