# Example 13 - Uncertainties on bearings coefficients¶

In this example, we use the rotor seen in Example 5.9.4 from .

This system is the same as that of Example 3, except that now, we’ll considerer some level of uncertainties on bearing direct coefficients (kxx, kyy, cxx, cyy).

import ross as rs
import ross.stochastic as srs
import numpy as np

# Deterministic Shaft Elements
Steel = rs.steel
shaft = [rs.ShaftElement(L=0.25, material=Steel, idl=0, odl=0.05) for i in range(6)]

# Deterministic Disk Elements
disk1 = rs.DiskElement.from_geometry(
n=2,
material=Steel,
width=0.07,
i_d=0.05,
o_d=0.28,
)

disk2 = rs.DiskElement.from_geometry(
n=4,
material=Steel,
width=0.07,
i_d=0.05,
o_d=0.35,
)
disks = [disk1, disk2]


In this example, let’s consider an uniform distribuition for the coefficients. Because it’s a demonstrative example, we’ll not use too many samples, to avoid taking too long to run the simulation.

We can use numpy.random package to generate random values for our variables.

## Stochastic Bearing Elements¶

# random variables must have the same size
kxx = np.random.uniform(low=1e6, high=3e6, size=50)
cxx = np.random.uniform(low=1e2, high=2e2, size=50)

bearing1 = srs.ST_BearingElement(n=0, kxx=kxx, cxx=cxx, is_random=["kxx", "cxx"])
bearing2 = srs.ST_BearingElement(n=6, kxx=kxx, cxx=cxx, is_random=["kxx", "cxx"])
bearings = [bearing1, bearing2]

# Building random instances for a rotor model

rand_rotor = srs.ST_Rotor(
shaft_elements=shaft, disk_elements=disks, bearing_elements=bearings
)

# Number of samples
print("Number of samples:", len(list(iter(rand_rotor))))

Number of samples: 50


## Plotting a random sample¶

We can use numpy.random.choice to take a random rotor object. Then, we can use the same functions than to Rotor class.

sample = np.random.choice(list(iter(rand_rotor)))
sample.plot_rotor()