Getting Started
Installation
There are (atleast) two ways to install this module.
Install using pip in your current Python environment
Download the repository and put pyvib folder in your project
Pip install
Within your current Python environment (either global, through virtualenv, or Anaconda), run the following code to install from the git repository:
pip install git+https://github.com/andrek10/bearing-vibration-diagnostics-toolbox.git@master
This will install PyVib to your activated environment, including all the dependencies.
Project install
The repository can be cloned or downloaded, and then put the pyvib folder in your project folder.
To install the required packages, you may use pip to install them. Navigate to the pyvib folder and run the following command:
pip install -r requirements.txt
Example
Here follows an example on running some of the code in the repository.
For this example, we will use the bearing simulator to make some signals, and perform a diagnosis.
import numpy as np
import matplotlib.pyplot as plt
import pyvib
def main():
# Simulate some vibration data
fs = 250.0 / 60.0 # Reference shaft frequency [Hz]
Fs = 51200.0 # Vibration sampling rate [Hz]
Fs_s = Fs # Position sampling rate [Hz]
t = np.arange(0, 60.0, step=1/Fs) # Time array [s]
v = fs + fs*0.1*np.sin(t) # Make shaft velocity with disturbance [rev/s]
s = np.cumsum(v)/Fs # Integrate shaft velocity [rev]
fo = 5.12 # Fault order (number of bearing fault impacts per revolution) [orders]
vib = pyvib.bearing.bearingsimulation(t, s, fo) # Simulated vibration signal in [m/s2]
# Perform order tracking to remove frequency variations
ds = 1.0/(np.round(Fs/fs)) # Desired delta shaft position between each order tracked vibration sample
s_ot, vib_ot = pyvib.signal.ordertrack(t, vib, t, s, ds)
# Remove synchronous components with time synchronous average
vib_ot = pyvib.signal.tsaremove(vib_ot, Fs, fs)
# Make an envelope of the signal
env = pyvib.signal.envelope(vib_ot)
# FFT of the envelope
Y, df = pyvib.fft.fft(env, Fs)
# Plot the envelope FFT as a function of orders (1 is shaft speed, 2 is 2x shaft speed etc.)'
# In the envelope spectrum, you can see harmonics of the bearing fault order
do = df/fs
fig, ax = plt.subplots()
pyvib.plt.plotfft(Y, do, ax, xlim=[0, 30])
ax.set_xlabel('Shaft orders')
ax.set_ylabel('Envelope FFT Amplitude')
ax.set_title('Envelope Spectrum')
fig.tight_layout()
if __name__ == '__main__':
main()
plt.show()