pyPRB 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pyprb-1.0.0/.gitignore +109 -0
- pyprb-1.0.0/License +21 -0
- pyprb-1.0.0/PKG-INFO +215 -0
- pyprb-1.0.0/README.rst +176 -0
- pyprb-1.0.0/docs/requirements.txt +2 -0
- pyprb-1.0.0/pyPRB/__init__.py +69 -0
- pyprb-1.0.0/pyPRB/__version__.py +5 -0
- pyprb-1.0.0/pyPRB/core.py +486 -0
- pyprb-1.0.0/pyPRB/processing/__init__.py +32 -0
- pyprb-1.0.0/pyPRB/processing/_vibration_extractor.py +339 -0
- pyprb-1.0.0/pyPRB/processing/fft_extraction.py +230 -0
- pyprb-1.0.0/pyPRB/processing/iq_demodulation.py +263 -0
- pyprb-1.0.0/pyPRB/processing/least_squares_fit.py +210 -0
- pyprb-1.0.0/pyPRB/processing/synchronous_averaging.py +321 -0
- pyprb-1.0.0/pyproject.toml +75 -0
- pyprb-1.0.0/requirements.txt +3 -0
pyprb-1.0.0/.gitignore
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
*.egg-info/
|
|
24
|
+
.installed.cfg
|
|
25
|
+
*.egg
|
|
26
|
+
MANIFEST
|
|
27
|
+
|
|
28
|
+
# PyInstaller
|
|
29
|
+
# Usually these files are written by a python script from a template
|
|
30
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
31
|
+
*.manifest
|
|
32
|
+
*.spec
|
|
33
|
+
|
|
34
|
+
# Installer logs
|
|
35
|
+
pip-log.txt
|
|
36
|
+
pip-delete-this-directory.txt
|
|
37
|
+
|
|
38
|
+
# Unit test / coverage reports
|
|
39
|
+
htmlcov/
|
|
40
|
+
.tox/
|
|
41
|
+
.coverage
|
|
42
|
+
.coverage.*
|
|
43
|
+
.cache
|
|
44
|
+
nosetests.xml
|
|
45
|
+
coverage.xml
|
|
46
|
+
*.cover
|
|
47
|
+
.hypothesis/
|
|
48
|
+
|
|
49
|
+
# Translations
|
|
50
|
+
*.mo
|
|
51
|
+
*.pot
|
|
52
|
+
|
|
53
|
+
# Django stuff:
|
|
54
|
+
*.log
|
|
55
|
+
.static_storage/
|
|
56
|
+
.media/
|
|
57
|
+
local_settings.py
|
|
58
|
+
|
|
59
|
+
# Flask stuff:
|
|
60
|
+
instance/
|
|
61
|
+
.webassets-cache
|
|
62
|
+
|
|
63
|
+
# Scrapy stuff:
|
|
64
|
+
.scrapy
|
|
65
|
+
|
|
66
|
+
# Sphinx documentation
|
|
67
|
+
docs/_build/
|
|
68
|
+
docs/build/
|
|
69
|
+
docs/source/api/
|
|
70
|
+
|
|
71
|
+
# PyBuilder
|
|
72
|
+
target/
|
|
73
|
+
|
|
74
|
+
# Jupyter Notebook
|
|
75
|
+
.ipynb_checkpoints
|
|
76
|
+
|
|
77
|
+
# pyenv
|
|
78
|
+
.python-version
|
|
79
|
+
|
|
80
|
+
# celery beat schedule file
|
|
81
|
+
celerybeat-schedule
|
|
82
|
+
|
|
83
|
+
# SageMath parsed files
|
|
84
|
+
*.sage.py
|
|
85
|
+
|
|
86
|
+
# Environments
|
|
87
|
+
.env
|
|
88
|
+
.venv
|
|
89
|
+
env/
|
|
90
|
+
venv/
|
|
91
|
+
ENV/
|
|
92
|
+
env.bak/
|
|
93
|
+
venv.bak/
|
|
94
|
+
|
|
95
|
+
# Spyder project settings
|
|
96
|
+
.spyderproject
|
|
97
|
+
.spyproject
|
|
98
|
+
|
|
99
|
+
# Rope project settings
|
|
100
|
+
.ropeproject
|
|
101
|
+
|
|
102
|
+
# mkdocs documentation
|
|
103
|
+
/site
|
|
104
|
+
|
|
105
|
+
# mypy
|
|
106
|
+
.mypy_cache/
|
|
107
|
+
|
|
108
|
+
# VSCode
|
|
109
|
+
.vscode/
|
pyprb-1.0.0/License
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) Gašper Krivic 2025
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
pyprb-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pyPRB
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Static and dynamic rotor balancing using portable measurement equipment calculations based on Brüel & Kjær guide.
|
|
5
|
+
Project-URL: homepage, https://github.com/ladisk/pyPRB
|
|
6
|
+
Project-URL: documentation, https://github.com/ladisk/pyPRB
|
|
7
|
+
Project-URL: source, https://github.com/ladisk/pyPRB
|
|
8
|
+
Author-email: Gašper Krivic <gasper.krivic@fs.uni-lj.si>
|
|
9
|
+
Maintainer-email: Gašper Krivic <gasper.krivic@fs.uni-lj.si>
|
|
10
|
+
License-Expression: MIT
|
|
11
|
+
License-File: License
|
|
12
|
+
Keywords: balancing,dynamics,mechanical-engineering,rotor,vibration
|
|
13
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
14
|
+
Classifier: Intended Audience :: Science/Research
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
23
|
+
Classifier: Topic :: Scientific/Engineering
|
|
24
|
+
Requires-Python: >=3.9
|
|
25
|
+
Requires-Dist: numpy>=1.20.0
|
|
26
|
+
Requires-Dist: tabulate>=0.8.0
|
|
27
|
+
Provides-Extra: dev
|
|
28
|
+
Requires-Dist: build; extra == 'dev'
|
|
29
|
+
Requires-Dist: matplotlib>=3.5.0; extra == 'dev'
|
|
30
|
+
Requires-Dist: pytest; extra == 'dev'
|
|
31
|
+
Requires-Dist: sphinx; extra == 'dev'
|
|
32
|
+
Requires-Dist: sphinx-book-theme; extra == 'dev'
|
|
33
|
+
Requires-Dist: sphinx-copybutton>=0.5.2; extra == 'dev'
|
|
34
|
+
Requires-Dist: twine; extra == 'dev'
|
|
35
|
+
Requires-Dist: wheel; extra == 'dev'
|
|
36
|
+
Provides-Extra: plot
|
|
37
|
+
Requires-Dist: matplotlib>=3.5.0; extra == 'plot'
|
|
38
|
+
Description-Content-Type: text/x-rst
|
|
39
|
+
|
|
40
|
+
Rotor Balancing
|
|
41
|
+
===============
|
|
42
|
+
|
|
43
|
+
A Python package for static and dynamic rotor balancing calculations based on the methodology described in "Static and Dynamic Balancing using portable measuring equipment" by John Vaughan (Brüel & Kjær Application Note).
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
Features
|
|
47
|
+
--------
|
|
48
|
+
|
|
49
|
+
* **VibrationVector**: Represents unbalance by means of a vector
|
|
50
|
+
* **MassVector**: Represents a mass placed at an angular position on a rotor
|
|
51
|
+
* **StaticBalancing**: Single-plane balancing for rotors
|
|
52
|
+
* **DynamicBalancing**: Two-plane balancing for rotors
|
|
53
|
+
* **VibrationExtractor**: Extracts vibration vectors from time-domain signals
|
|
54
|
+
* **detect_rotation_freq**: Detects rotation frequency from a trigger signal
|
|
55
|
+
* Four pluggable extraction methods: **IQDemodulation** (default),
|
|
56
|
+
**LeastSquaresFit**, **SynchronousAveraging**, **FFTExtraction**
|
|
57
|
+
|
|
58
|
+
Installation
|
|
59
|
+
------------
|
|
60
|
+
|
|
61
|
+
Install from PyPI:
|
|
62
|
+
|
|
63
|
+
.. code-block:: bash
|
|
64
|
+
|
|
65
|
+
pip install pyPRB
|
|
66
|
+
|
|
67
|
+
Or install from source:
|
|
68
|
+
|
|
69
|
+
.. code-block:: bash
|
|
70
|
+
|
|
71
|
+
git clone https://github.com/ladisk/pyPRB.git
|
|
72
|
+
cd pyPRB
|
|
73
|
+
pip install .
|
|
74
|
+
|
|
75
|
+
For development installation:
|
|
76
|
+
|
|
77
|
+
.. code-block:: bash
|
|
78
|
+
|
|
79
|
+
pip install -e .[dev]
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
Quick Start
|
|
83
|
+
-----------
|
|
84
|
+
|
|
85
|
+
Static Balancing Example
|
|
86
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
87
|
+
|
|
88
|
+
.. code-block:: python
|
|
89
|
+
|
|
90
|
+
from pyPRB import VibrationVector, MassVector, StaticBalancing
|
|
91
|
+
|
|
92
|
+
# Initial measurements
|
|
93
|
+
V_0 = VibrationVector(amplitude=3.4, phase=116) # No trial mass
|
|
94
|
+
V_1 = VibrationVector(amplitude=1.8, phase=42) # With trial mass
|
|
95
|
+
|
|
96
|
+
# Trial mass: 2.0 g mounted at 0° on the rotor
|
|
97
|
+
trial_mass = MassVector(2.0, 0.0)
|
|
98
|
+
|
|
99
|
+
# Create balancer
|
|
100
|
+
balancer = StaticBalancing(V_0, V_1, trial_mass=trial_mass)
|
|
101
|
+
|
|
102
|
+
# Display measurement table
|
|
103
|
+
print(balancer)
|
|
104
|
+
|
|
105
|
+
# Compute compensation
|
|
106
|
+
comp_mass = balancer.compute_compensation()
|
|
107
|
+
# Output: Compensation mass: 2.01 g at position -30.8° on the rotor.
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
Dynamic Balancing Example
|
|
111
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
112
|
+
|
|
113
|
+
.. code-block:: python
|
|
114
|
+
|
|
115
|
+
from pyPRB import VibrationVector, MassVector, DynamicBalancing
|
|
116
|
+
|
|
117
|
+
# Initial measurements (no trial masses)
|
|
118
|
+
V_1_0 = VibrationVector(7.2, 238) # Plane 1
|
|
119
|
+
V_2_0 = VibrationVector(13.5, 296) # Plane 2
|
|
120
|
+
|
|
121
|
+
# With trial mass in Plane 1
|
|
122
|
+
V_1_1 = VibrationVector(4.9, 114) # Plane 1
|
|
123
|
+
V_2_1 = VibrationVector(9.2, 347) # Plane 2
|
|
124
|
+
|
|
125
|
+
# With trial mass in Plane 2
|
|
126
|
+
V_1_2 = VibrationVector(4.0, 79) # Plane 1
|
|
127
|
+
V_2_2 = VibrationVector(12.0, 292) # Plane 2
|
|
128
|
+
|
|
129
|
+
# Trial masses: 2.5 g each, mounted at 0° on their respective planes
|
|
130
|
+
trial_mass_1 = MassVector(2.5, 0.0)
|
|
131
|
+
trial_mass_2 = MassVector(2.5, 0.0)
|
|
132
|
+
|
|
133
|
+
# Create balancer
|
|
134
|
+
balancer = DynamicBalancing(
|
|
135
|
+
V_1_0, V_2_0, V_1_1, V_2_1, V_1_2, V_2_2,
|
|
136
|
+
trial_mass_1=trial_mass_1, trial_mass_2=trial_mass_2
|
|
137
|
+
)
|
|
138
|
+
|
|
139
|
+
# Display measurement table
|
|
140
|
+
print(balancer)
|
|
141
|
+
|
|
142
|
+
# Compute compensations for both planes
|
|
143
|
+
comp_mass_1, comp_mass_2 = balancer.compute_compensation()
|
|
144
|
+
# Output:
|
|
145
|
+
# +---------+---------------------+------------+
|
|
146
|
+
# | Plane | Compensation Mass | Position |
|
|
147
|
+
# +=========+=====================+============+
|
|
148
|
+
# | 1 | 2.95 g | 50.2° |
|
|
149
|
+
# +---------+---------------------+------------+
|
|
150
|
+
# | 2 | 2.84 g | -81.9° |
|
|
151
|
+
# +---------+---------------------+------------+
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
Extracting Vibration Vectors from Measurements
|
|
155
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
156
|
+
|
|
157
|
+
.. code-block:: python
|
|
158
|
+
|
|
159
|
+
import numpy as np
|
|
160
|
+
from pyPRB import (
|
|
161
|
+
VibrationExtractor, detect_rotation_freq,
|
|
162
|
+
MassVector, StaticBalancing,
|
|
163
|
+
)
|
|
164
|
+
|
|
165
|
+
# Synthetic signals (B&K Example 2)
|
|
166
|
+
sample_rate = 10000 # Hz
|
|
167
|
+
f0_true = 25.0 # rotation frequency (Hz)
|
|
168
|
+
duration = 5.0 # s
|
|
169
|
+
t = np.arange(0, duration, 1 / sample_rate)
|
|
170
|
+
rng = np.random.default_rng(0)
|
|
171
|
+
|
|
172
|
+
trigger = np.sign(np.sin(2 * np.pi * f0_true * t))
|
|
173
|
+
signal_run0 = (3.4 * np.cos(2 * np.pi * f0_true * t + np.deg2rad(116))
|
|
174
|
+
+ 0.05 * rng.standard_normal(len(t)))
|
|
175
|
+
signal_run1 = (1.8 * np.cos(2 * np.pi * f0_true * t + np.deg2rad(42))
|
|
176
|
+
+ 0.05 * rng.standard_normal(len(t)))
|
|
177
|
+
|
|
178
|
+
# 1. Detect rotation frequency from the trigger signal
|
|
179
|
+
f0 = detect_rotation_freq(trigger, sample_rate=sample_rate, max_freq=50.0)
|
|
180
|
+
|
|
181
|
+
# 2. Create extractor (default method: IQ demodulation)
|
|
182
|
+
extractor = VibrationExtractor(sample_rate=sample_rate, rotation_freq=f0)
|
|
183
|
+
|
|
184
|
+
# 3. Extract vibration vectors for each measurement run
|
|
185
|
+
V_0 = extractor.get_vibration_vector(signal_run0, trigger)
|
|
186
|
+
V_1 = extractor.get_vibration_vector(signal_run1, trigger)
|
|
187
|
+
|
|
188
|
+
# 4. Use the vectors for balancing
|
|
189
|
+
trial_mass = MassVector(2.0, 0.0)
|
|
190
|
+
balancer = StaticBalancing(V_0, V_1, trial_mass=trial_mass)
|
|
191
|
+
comp_mass = balancer.compute_compensation()
|
|
192
|
+
# Output: Compensation mass: 2.01 g at position -30.8° on the rotor.
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
Balancing procedure
|
|
196
|
+
-------------------
|
|
197
|
+
|
|
198
|
+
Static Balancing
|
|
199
|
+
~~~~~~~~~~~~~~~~
|
|
200
|
+
|
|
201
|
+
For a rotor with unbalance in a single plane:
|
|
202
|
+
|
|
203
|
+
1. Measure initial vibration vector **V₀**
|
|
204
|
+
2. Add known trial mass **m** and measure resulting vibration **V₁**
|
|
205
|
+
3. Compute compensation mass with `StaticBalancing`
|
|
206
|
+
|
|
207
|
+
Dynamic Balancing
|
|
208
|
+
~~~~~~~~~~~~~~~~~
|
|
209
|
+
|
|
210
|
+
For a rotor requiring two-plane balancing:
|
|
211
|
+
|
|
212
|
+
1. Measure initial vibration vectors in both planes: **V₁,₀** and **V₂,₀**
|
|
213
|
+
2. Add trial mass **m₁,₁** in plane 1, measure: **V₁,₁** and **V₂,₁**
|
|
214
|
+
3. Add trial mass **m₂,₂** in plane 2, measure: **V₁,₂** and **V₂,₂**
|
|
215
|
+
4. Compute compensation masses in both planes with `DynamicBalancing`
|
pyprb-1.0.0/README.rst
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
Rotor Balancing
|
|
2
|
+
===============
|
|
3
|
+
|
|
4
|
+
A Python package for static and dynamic rotor balancing calculations based on the methodology described in "Static and Dynamic Balancing using portable measuring equipment" by John Vaughan (Brüel & Kjær Application Note).
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
Features
|
|
8
|
+
--------
|
|
9
|
+
|
|
10
|
+
* **VibrationVector**: Represents unbalance by means of a vector
|
|
11
|
+
* **MassVector**: Represents a mass placed at an angular position on a rotor
|
|
12
|
+
* **StaticBalancing**: Single-plane balancing for rotors
|
|
13
|
+
* **DynamicBalancing**: Two-plane balancing for rotors
|
|
14
|
+
* **VibrationExtractor**: Extracts vibration vectors from time-domain signals
|
|
15
|
+
* **detect_rotation_freq**: Detects rotation frequency from a trigger signal
|
|
16
|
+
* Four pluggable extraction methods: **IQDemodulation** (default),
|
|
17
|
+
**LeastSquaresFit**, **SynchronousAveraging**, **FFTExtraction**
|
|
18
|
+
|
|
19
|
+
Installation
|
|
20
|
+
------------
|
|
21
|
+
|
|
22
|
+
Install from PyPI:
|
|
23
|
+
|
|
24
|
+
.. code-block:: bash
|
|
25
|
+
|
|
26
|
+
pip install pyPRB
|
|
27
|
+
|
|
28
|
+
Or install from source:
|
|
29
|
+
|
|
30
|
+
.. code-block:: bash
|
|
31
|
+
|
|
32
|
+
git clone https://github.com/ladisk/pyPRB.git
|
|
33
|
+
cd pyPRB
|
|
34
|
+
pip install .
|
|
35
|
+
|
|
36
|
+
For development installation:
|
|
37
|
+
|
|
38
|
+
.. code-block:: bash
|
|
39
|
+
|
|
40
|
+
pip install -e .[dev]
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
Quick Start
|
|
44
|
+
-----------
|
|
45
|
+
|
|
46
|
+
Static Balancing Example
|
|
47
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
48
|
+
|
|
49
|
+
.. code-block:: python
|
|
50
|
+
|
|
51
|
+
from pyPRB import VibrationVector, MassVector, StaticBalancing
|
|
52
|
+
|
|
53
|
+
# Initial measurements
|
|
54
|
+
V_0 = VibrationVector(amplitude=3.4, phase=116) # No trial mass
|
|
55
|
+
V_1 = VibrationVector(amplitude=1.8, phase=42) # With trial mass
|
|
56
|
+
|
|
57
|
+
# Trial mass: 2.0 g mounted at 0° on the rotor
|
|
58
|
+
trial_mass = MassVector(2.0, 0.0)
|
|
59
|
+
|
|
60
|
+
# Create balancer
|
|
61
|
+
balancer = StaticBalancing(V_0, V_1, trial_mass=trial_mass)
|
|
62
|
+
|
|
63
|
+
# Display measurement table
|
|
64
|
+
print(balancer)
|
|
65
|
+
|
|
66
|
+
# Compute compensation
|
|
67
|
+
comp_mass = balancer.compute_compensation()
|
|
68
|
+
# Output: Compensation mass: 2.01 g at position -30.8° on the rotor.
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
Dynamic Balancing Example
|
|
72
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
73
|
+
|
|
74
|
+
.. code-block:: python
|
|
75
|
+
|
|
76
|
+
from pyPRB import VibrationVector, MassVector, DynamicBalancing
|
|
77
|
+
|
|
78
|
+
# Initial measurements (no trial masses)
|
|
79
|
+
V_1_0 = VibrationVector(7.2, 238) # Plane 1
|
|
80
|
+
V_2_0 = VibrationVector(13.5, 296) # Plane 2
|
|
81
|
+
|
|
82
|
+
# With trial mass in Plane 1
|
|
83
|
+
V_1_1 = VibrationVector(4.9, 114) # Plane 1
|
|
84
|
+
V_2_1 = VibrationVector(9.2, 347) # Plane 2
|
|
85
|
+
|
|
86
|
+
# With trial mass in Plane 2
|
|
87
|
+
V_1_2 = VibrationVector(4.0, 79) # Plane 1
|
|
88
|
+
V_2_2 = VibrationVector(12.0, 292) # Plane 2
|
|
89
|
+
|
|
90
|
+
# Trial masses: 2.5 g each, mounted at 0° on their respective planes
|
|
91
|
+
trial_mass_1 = MassVector(2.5, 0.0)
|
|
92
|
+
trial_mass_2 = MassVector(2.5, 0.0)
|
|
93
|
+
|
|
94
|
+
# Create balancer
|
|
95
|
+
balancer = DynamicBalancing(
|
|
96
|
+
V_1_0, V_2_0, V_1_1, V_2_1, V_1_2, V_2_2,
|
|
97
|
+
trial_mass_1=trial_mass_1, trial_mass_2=trial_mass_2
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
# Display measurement table
|
|
101
|
+
print(balancer)
|
|
102
|
+
|
|
103
|
+
# Compute compensations for both planes
|
|
104
|
+
comp_mass_1, comp_mass_2 = balancer.compute_compensation()
|
|
105
|
+
# Output:
|
|
106
|
+
# +---------+---------------------+------------+
|
|
107
|
+
# | Plane | Compensation Mass | Position |
|
|
108
|
+
# +=========+=====================+============+
|
|
109
|
+
# | 1 | 2.95 g | 50.2° |
|
|
110
|
+
# +---------+---------------------+------------+
|
|
111
|
+
# | 2 | 2.84 g | -81.9° |
|
|
112
|
+
# +---------+---------------------+------------+
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
Extracting Vibration Vectors from Measurements
|
|
116
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
117
|
+
|
|
118
|
+
.. code-block:: python
|
|
119
|
+
|
|
120
|
+
import numpy as np
|
|
121
|
+
from pyPRB import (
|
|
122
|
+
VibrationExtractor, detect_rotation_freq,
|
|
123
|
+
MassVector, StaticBalancing,
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
# Synthetic signals (B&K Example 2)
|
|
127
|
+
sample_rate = 10000 # Hz
|
|
128
|
+
f0_true = 25.0 # rotation frequency (Hz)
|
|
129
|
+
duration = 5.0 # s
|
|
130
|
+
t = np.arange(0, duration, 1 / sample_rate)
|
|
131
|
+
rng = np.random.default_rng(0)
|
|
132
|
+
|
|
133
|
+
trigger = np.sign(np.sin(2 * np.pi * f0_true * t))
|
|
134
|
+
signal_run0 = (3.4 * np.cos(2 * np.pi * f0_true * t + np.deg2rad(116))
|
|
135
|
+
+ 0.05 * rng.standard_normal(len(t)))
|
|
136
|
+
signal_run1 = (1.8 * np.cos(2 * np.pi * f0_true * t + np.deg2rad(42))
|
|
137
|
+
+ 0.05 * rng.standard_normal(len(t)))
|
|
138
|
+
|
|
139
|
+
# 1. Detect rotation frequency from the trigger signal
|
|
140
|
+
f0 = detect_rotation_freq(trigger, sample_rate=sample_rate, max_freq=50.0)
|
|
141
|
+
|
|
142
|
+
# 2. Create extractor (default method: IQ demodulation)
|
|
143
|
+
extractor = VibrationExtractor(sample_rate=sample_rate, rotation_freq=f0)
|
|
144
|
+
|
|
145
|
+
# 3. Extract vibration vectors for each measurement run
|
|
146
|
+
V_0 = extractor.get_vibration_vector(signal_run0, trigger)
|
|
147
|
+
V_1 = extractor.get_vibration_vector(signal_run1, trigger)
|
|
148
|
+
|
|
149
|
+
# 4. Use the vectors for balancing
|
|
150
|
+
trial_mass = MassVector(2.0, 0.0)
|
|
151
|
+
balancer = StaticBalancing(V_0, V_1, trial_mass=trial_mass)
|
|
152
|
+
comp_mass = balancer.compute_compensation()
|
|
153
|
+
# Output: Compensation mass: 2.01 g at position -30.8° on the rotor.
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
Balancing procedure
|
|
157
|
+
-------------------
|
|
158
|
+
|
|
159
|
+
Static Balancing
|
|
160
|
+
~~~~~~~~~~~~~~~~
|
|
161
|
+
|
|
162
|
+
For a rotor with unbalance in a single plane:
|
|
163
|
+
|
|
164
|
+
1. Measure initial vibration vector **V₀**
|
|
165
|
+
2. Add known trial mass **m** and measure resulting vibration **V₁**
|
|
166
|
+
3. Compute compensation mass with `StaticBalancing`
|
|
167
|
+
|
|
168
|
+
Dynamic Balancing
|
|
169
|
+
~~~~~~~~~~~~~~~~~
|
|
170
|
+
|
|
171
|
+
For a rotor requiring two-plane balancing:
|
|
172
|
+
|
|
173
|
+
1. Measure initial vibration vectors in both planes: **V₁,₀** and **V₂,₀**
|
|
174
|
+
2. Add trial mass **m₁,₁** in plane 1, measure: **V₁,₁** and **V₂,₁**
|
|
175
|
+
3. Add trial mass **m₂,₂** in plane 2, measure: **V₁,₂** and **V₂,₂**
|
|
176
|
+
4. Compute compensation masses in both planes with `DynamicBalancing`
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Rotor Balancing Package
|
|
3
|
+
=======================
|
|
4
|
+
|
|
5
|
+
A Python package for static and dynamic rotor balancing calculations based on
|
|
6
|
+
the influence coefficient method described in "Static and Dynamic Balancing
|
|
7
|
+
using portable measuring equipment" by John Vaughan, Bruel & Kjaer.
|
|
8
|
+
|
|
9
|
+
Classes
|
|
10
|
+
-------
|
|
11
|
+
VibrationVector
|
|
12
|
+
Represents vibration measurements as vectors with amplitude and phase.
|
|
13
|
+
|
|
14
|
+
MassVector
|
|
15
|
+
Represents a mass placed at an angular position on a rotor.
|
|
16
|
+
|
|
17
|
+
StaticBalancing
|
|
18
|
+
Performs single-plane (static) balancing calculations.
|
|
19
|
+
|
|
20
|
+
DynamicBalancing
|
|
21
|
+
Performs two-plane (dynamic) balancing calculations.
|
|
22
|
+
|
|
23
|
+
Examples
|
|
24
|
+
--------
|
|
25
|
+
Static balancing:
|
|
26
|
+
|
|
27
|
+
>>> from pyPRB import VibrationVector, MassVector, StaticBalancing
|
|
28
|
+
>>> V_0 = VibrationVector(3.4, 116) # initial vibration vector
|
|
29
|
+
>>> V_1 = VibrationVector(1.8, 42) # vibration vector after trial mass
|
|
30
|
+
>>> trial_mass = MassVector(2.0, 0.0)
|
|
31
|
+
>>> balancer = StaticBalancing(V_0, V_1, trial_mass=trial_mass)
|
|
32
|
+
>>> comp_mass = balancer.compute_compensation()
|
|
33
|
+
|
|
34
|
+
Dynamic balancing:
|
|
35
|
+
|
|
36
|
+
>>> from pyPRB import VibrationVector, MassVector, DynamicBalancing
|
|
37
|
+
>>> V_1_0 = VibrationVector(7.2, 238)
|
|
38
|
+
>>> V_2_0 = VibrationVector(13.5, 296)
|
|
39
|
+
>>> V_1_1 = VibrationVector(4.9, 114)
|
|
40
|
+
>>> V_2_1 = VibrationVector(9.2, 347)
|
|
41
|
+
>>> V_1_2 = VibrationVector(4.0, 79)
|
|
42
|
+
>>> V_2_2 = VibrationVector(12.0, 292)
|
|
43
|
+
>>> trial_mass_1 = MassVector(2.5, 0.0)
|
|
44
|
+
>>> trial_mass_2 = MassVector(2.5, 0.0)
|
|
45
|
+
>>> balancer = DynamicBalancing(V_1_0, V_2_0, V_1_1, V_2_1,
|
|
46
|
+
... V_1_2, V_2_2,
|
|
47
|
+
... trial_mass_1=trial_mass_1,
|
|
48
|
+
... trial_mass_2=trial_mass_2)
|
|
49
|
+
>>> comp_mass_1, comp_mass_2 = balancer.compute_compensation()
|
|
50
|
+
"""
|
|
51
|
+
|
|
52
|
+
from .core import VibrationVector, MassVector, StaticBalancing, DynamicBalancing
|
|
53
|
+
from .processing import VibrationExtractor, IQDemodulation, LeastSquaresFit, SynchronousAveraging, FFTExtraction, detect_rotation_freq
|
|
54
|
+
from .__version__ import __version__, __author__, __email__
|
|
55
|
+
|
|
56
|
+
# Define what gets imported with "from pyPRB import *"
|
|
57
|
+
__all__ = [
|
|
58
|
+
'VibrationVector',
|
|
59
|
+
'MassVector',
|
|
60
|
+
'StaticBalancing',
|
|
61
|
+
'DynamicBalancing',
|
|
62
|
+
'VibrationExtractor',
|
|
63
|
+
'IQDemodulation',
|
|
64
|
+
'LeastSquaresFit',
|
|
65
|
+
'SynchronousAveraging',
|
|
66
|
+
'FFTExtraction',
|
|
67
|
+
'detect_rotation_freq',
|
|
68
|
+
'__version__',
|
|
69
|
+
]
|