bstart-trb 0.2.1__tar.gz → 0.2.2__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.
- bstart_trb-0.2.2/LOGS.md +135 -0
- bstart_trb-0.2.2/PKG-INFO +289 -0
- bstart_trb-0.2.2/README_PYPI.md +276 -0
- {bstart_trb-0.2.1 → bstart_trb-0.2.2}/bstart_trb/__init__.py +6 -6
- bstart_trb-0.2.2/bstart_trb/models.py +332 -0
- {bstart_trb-0.2.1 → bstart_trb-0.2.2}/bstart_trb/wrapper.py +51 -50
- {bstart_trb-0.2.1 → bstart_trb-0.2.2}/pyproject.toml +1 -1
- {bstart_trb-0.2.1 → bstart_trb-0.2.2}/uv.lock +10 -5
- bstart_trb-0.2.1/PKG-INFO +0 -153
- bstart_trb-0.2.1/README_PYPI.md +0 -140
- bstart_trb-0.2.1/bstart_trb/models.py +0 -330
- {bstart_trb-0.2.1 → bstart_trb-0.2.2}/.gitignore +0 -0
- {bstart_trb-0.2.1 → bstart_trb-0.2.2}/.python-version +0 -0
- {bstart_trb-0.2.1 → bstart_trb-0.2.2}/BUILDING.md +0 -0
- {bstart_trb-0.2.1 → bstart_trb-0.2.2}/LICENSE +0 -0
- {bstart_trb-0.2.1 → bstart_trb-0.2.2}/PACKAGE_SUMMARY.md +0 -0
- {bstart_trb-0.2.1 → bstart_trb-0.2.2}/PUBLISHING.md +0 -0
- {bstart_trb-0.2.1 → bstart_trb-0.2.2}/README.md +0 -0
- {bstart_trb-0.2.1 → bstart_trb-0.2.2}/README_EN.md +0 -0
- {bstart_trb-0.2.1 → bstart_trb-0.2.2}/bstart_trb/_taper_slice.cp311-win_amd64.pyd +0 -0
- {bstart_trb-0.2.1 → bstart_trb-0.2.2}/bstart_trb/_taper_slice.pyi +0 -0
- {bstart_trb-0.2.1 → bstart_trb-0.2.2}/bstart_trb/libtaper_sl.J4R3HUMRYTOGZPKAVTEOISVEHZMIJTJT.gfortran-win_amd64.dll +0 -0
- {bstart_trb-0.2.1 → bstart_trb-0.2.2}/bstart_trb/py.typed +0 -0
- {bstart_trb-0.2.1 → bstart_trb-0.2.2}/demo.xlsx +0 -0
- {bstart_trb-0.2.1 → bstart_trb-0.2.2}/main.py +0 -0
- {bstart_trb-0.2.1 → bstart_trb-0.2.2}/meson.build +0 -0
- {bstart_trb-0.2.1 → bstart_trb-0.2.2}/test_install.py +0 -0
bstart_trb-0.2.2/LOGS.md
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
# 开发日志
|
|
2
|
+
|
|
3
|
+
## 2026-02-05 - v0.2.1 发布到 PyPI
|
|
4
|
+
|
|
5
|
+
### 问题解决
|
|
6
|
+
|
|
7
|
+
#### 1. Fortran 模块编译问题
|
|
8
|
+
|
|
9
|
+
**问题描述:**
|
|
10
|
+
运行 `main.py` 时报错 `RuntimeError: Fortran 计算核心未编译`
|
|
11
|
+
|
|
12
|
+
**解决步骤:**
|
|
13
|
+
|
|
14
|
+
1. 检查系统 gfortran 编译器 - 已安装 v16.0.0
|
|
15
|
+
2. 运行 `python slice_wrapper/build.py` 编译 Fortran 模块
|
|
16
|
+
3. 发现 DLL 加载失败:`.pyd` 文件无法找到依赖的 DLL
|
|
17
|
+
4. 将 `.libs/` 目录中的 DLL 复制到 `.pyd` 同级目录
|
|
18
|
+
5. 发现 NumPy 版本不兼容:系统 Python 使用 NumPy 1.x 编译,但 uv 环境使用 NumPy 2.x
|
|
19
|
+
6. 使用 `uv run python slice_wrapper/build.py` 在正确的环境中重新编译
|
|
20
|
+
7. 编译成功,模块可用
|
|
21
|
+
|
|
22
|
+
**关键点:**
|
|
23
|
+
- `.pyd` 文件是 Python 版本特定的(如 `cp311` = Python 3.11.x)
|
|
24
|
+
- 需要在目标 Python 环境中编译才能正确链接 NumPy
|
|
25
|
+
- Windows 上的 DLL 需要与 `.pyd` 文件放在同一目录
|
|
26
|
+
|
|
27
|
+
#### 2. 包名重构
|
|
28
|
+
|
|
29
|
+
**需求:** 将导入方式从 `from slice_wrapper import ...` 改为 `from bstart_trb import ...`
|
|
30
|
+
|
|
31
|
+
**操作:**
|
|
32
|
+
1. 重命名 `slice_wrapper/` → `bstart_trb/`
|
|
33
|
+
2. 更新 `main.py` 中的导入语句
|
|
34
|
+
3. 更新 `pyproject.toml` 的包配置
|
|
35
|
+
|
|
36
|
+
#### 3. PyPI 打包配置
|
|
37
|
+
|
|
38
|
+
**需求:**
|
|
39
|
+
- 包含 `.pyd` 和 `.dll` 文件
|
|
40
|
+
- 排除 `.f90` 源文件和 `build.py`
|
|
41
|
+
|
|
42
|
+
**pyproject.toml 配置:**
|
|
43
|
+
|
|
44
|
+
```toml
|
|
45
|
+
[build-system]
|
|
46
|
+
requires = ["hatchling"]
|
|
47
|
+
build-backend = "hatchling.build"
|
|
48
|
+
|
|
49
|
+
[tool.hatch.build.targets.wheel]
|
|
50
|
+
packages = ["bstart_trb"]
|
|
51
|
+
artifacts = [
|
|
52
|
+
"*.pyd",
|
|
53
|
+
"*.dll",
|
|
54
|
+
]
|
|
55
|
+
exclude = [
|
|
56
|
+
"*.f90",
|
|
57
|
+
"build.py",
|
|
58
|
+
"_taper_slice/**",
|
|
59
|
+
"__pycache__/**",
|
|
60
|
+
]
|
|
61
|
+
|
|
62
|
+
[tool.hatch.build.targets.wheel.force-include]
|
|
63
|
+
"bstart_trb/_taper_slice.cp311-win_amd64.pyd" = "bstart_trb/_taper_slice.cp311-win_amd64.pyd"
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
**关键点:**
|
|
67
|
+
- `artifacts` 配置告诉 hatch 包含通常被忽略的二进制文件
|
|
68
|
+
- `force-include` 确保 `.pyd` 文件一定被包含
|
|
69
|
+
- 删除 `_taper_slice/` 子目录,避免重复的 DLL 文件
|
|
70
|
+
|
|
71
|
+
#### 4. 依赖精简
|
|
72
|
+
|
|
73
|
+
**问题:** 原配置包含了 `pandas`, `openpyxl`, `plotly` 等不必要的依赖
|
|
74
|
+
|
|
75
|
+
**解决:**
|
|
76
|
+
|
|
77
|
+
```toml
|
|
78
|
+
dependencies = [
|
|
79
|
+
"numpy>=2.0.0",
|
|
80
|
+
]
|
|
81
|
+
|
|
82
|
+
[project.optional-dependencies]
|
|
83
|
+
demo = [
|
|
84
|
+
"openpyxl>=3.1.5",
|
|
85
|
+
"pandas>=2.0.0",
|
|
86
|
+
"plotly>=5.0.0",
|
|
87
|
+
]
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
用户如需 demo 依赖可以安装:`pip install bstart-trb[demo]`
|
|
91
|
+
|
|
92
|
+
### 版本发布历史
|
|
93
|
+
|
|
94
|
+
| 版本 | 日期 | 说明 |
|
|
95
|
+
|------|------|------|
|
|
96
|
+
| 0.2.1 | 2026-02-05 | 修复 README,精简依赖 |
|
|
97
|
+
| 0.2.0 | 2026-02-05 | 首次成功发布,包名改为 bstart_trb |
|
|
98
|
+
|
|
99
|
+
### 构建命令参考
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
# 编译 Fortran 模块
|
|
103
|
+
uv run python bstart_trb/build.py
|
|
104
|
+
|
|
105
|
+
# 复制 DLL 到包目录(如果需要)
|
|
106
|
+
Copy-Item "bstart_trb\_taper_slice\.libs\*.dll" -Destination "bstart_trb\" -Force
|
|
107
|
+
|
|
108
|
+
# 构建包
|
|
109
|
+
uv build
|
|
110
|
+
|
|
111
|
+
# 检查 wheel 内容
|
|
112
|
+
python -m zipfile -l dist\bstart_trb-*.whl
|
|
113
|
+
|
|
114
|
+
# 上传到 PyPI
|
|
115
|
+
uv run twine upload dist/*
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### 测试验证
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
# 在新目录创建测试环境
|
|
122
|
+
mkdir test_env && cd test_env
|
|
123
|
+
uv init --name test-pkg
|
|
124
|
+
uv add bstart-trb==0.2.1 --refresh
|
|
125
|
+
|
|
126
|
+
# 测试导入
|
|
127
|
+
uv run python -c "from bstart_trb import slice_stress, is_fortran_available; print(is_fortran_available())"
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### 注意事项
|
|
131
|
+
|
|
132
|
+
1. **Python 版本兼容性**:当前仅支持 Python 3.11(`cp311`)
|
|
133
|
+
2. **平台支持**:当前仅支持 Windows x64
|
|
134
|
+
3. **编译依赖**:编译需要 gfortran 和 MSVC
|
|
135
|
+
4. **版本覆盖**:PyPI 不允许覆盖已发布版本,需递增版本号
|
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: bstart-trb
|
|
3
|
+
Version: 0.2.2
|
|
4
|
+
Summary: Add your description here
|
|
5
|
+
License-File: LICENSE
|
|
6
|
+
Requires-Python: >=3.11
|
|
7
|
+
Requires-Dist: numpy>=2.0.0
|
|
8
|
+
Provides-Extra: demo
|
|
9
|
+
Requires-Dist: openpyxl>=3.1.5; extra == 'demo'
|
|
10
|
+
Requires-Dist: pandas>=2.0.0; extra == 'demo'
|
|
11
|
+
Requires-Dist: plotly>=5.0.0; extra == 'demo'
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
|
|
14
|
+
# BSTART-TRB
|
|
15
|
+
|
|
16
|
+
**Cylindrical/Tapered Roller Bearing Slice Stress Calculation Module**
|
|
17
|
+
|
|
18
|
+
A high-performance Python package for calculating contact stress distribution in roller bearings using the slice method with Fortran computational core.
|
|
19
|
+
|
|
20
|
+
## Features
|
|
21
|
+
|
|
22
|
+
- 🚀 **Fast Fortran Core**: Compiled Fortran code via f2py for optimal performance
|
|
23
|
+
- 📦 **Pre-compiled Binary**: No Fortran compiler required for installation
|
|
24
|
+
- 🎯 **Type-Safe**: Complete type hints and IDE support
|
|
25
|
+
- 🔬 **Accurate**: Uses influence coefficient method based on elastic contact theory
|
|
26
|
+
- 📊 **Flexible**: Supports various crown types (linear, circular, logarithmic)
|
|
27
|
+
|
|
28
|
+
## Installation
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
pip install bstart-trb
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
**Note**: This package includes pre-compiled binaries for Windows (x64) + Python 3.11. Support for other platforms coming soon.
|
|
35
|
+
|
|
36
|
+
## Quick Start
|
|
37
|
+
|
|
38
|
+
```python
|
|
39
|
+
from bstart_trb import (
|
|
40
|
+
slice_stress,
|
|
41
|
+
RollerParams,
|
|
42
|
+
RacewayParams,
|
|
43
|
+
CrownType,
|
|
44
|
+
RacewayType,
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
# Define cylindrical roller parameters
|
|
48
|
+
roller = RollerParams(
|
|
49
|
+
d1=10.0, # Small end diameter (mm)
|
|
50
|
+
d2=10.0, # Large end diameter (mm)
|
|
51
|
+
length=9.6, # Effective length (mm)
|
|
52
|
+
alfa=0.0, # Half cone angle (degrees)
|
|
53
|
+
tilt=0.0, # Tilt angle (degrees)
|
|
54
|
+
crown_type=CrownType.LOGARITHMIC,
|
|
55
|
+
curve_q=14100.0, # Design load (N)
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
# Define outer ring raceway parameters
|
|
59
|
+
raceway = RacewayParams(
|
|
60
|
+
diameter=-150.0, # Negative for concave surface (mm)
|
|
61
|
+
raceway_type=RacewayType.OUTER,
|
|
62
|
+
fai=0.0, # Half cone angle (degrees)
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
# Calculate slice stress distribution
|
|
66
|
+
result = slice_stress(roller, raceway, load=1340.86, n_slice=30)
|
|
67
|
+
|
|
68
|
+
# Access scalar results
|
|
69
|
+
print(f"Converged: {result.converged}")
|
|
70
|
+
print(f"Max stress: {result.max_stress:.0f} MPa")
|
|
71
|
+
print(f"Mean stress: {result.mean_stress:.0f} MPa")
|
|
72
|
+
print(f"Contact deflection: {result.deflection:.6f} mm")
|
|
73
|
+
print(f"Stress uniformity: {result.stress_uniformity:.2%}")
|
|
74
|
+
print(f"Contact slices: {result.contact_slices}/{result.n_slice}")
|
|
75
|
+
|
|
76
|
+
# Access array results
|
|
77
|
+
print(f"Stress distribution: {result.stress}") # MPa per slice
|
|
78
|
+
print(f"Contact half-widths: {result.half_width}") # mm per slice
|
|
79
|
+
print(f"Slice forces: {result.slice_force}") # N per slice
|
|
80
|
+
|
|
81
|
+
# Get slice positions along roller length
|
|
82
|
+
positions = result.get_slice_positions(roller.length) # mm
|
|
83
|
+
print(f"Slice positions: {positions}")
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Return Value: `SliceResult`
|
|
87
|
+
|
|
88
|
+
The `slice_stress()` function returns a `SliceResult` object containing:
|
|
89
|
+
|
|
90
|
+
### Array Attributes
|
|
91
|
+
|
|
92
|
+
| Attribute | Type | Unit | Description |
|
|
93
|
+
|-----------|------|------|-------------|
|
|
94
|
+
| `stress` | `NDArray[float64]` | MPa | Contact stress at each slice center |
|
|
95
|
+
| `half_width` | `NDArray[float64]` | mm | Contact half-width at each slice |
|
|
96
|
+
| `slice_force` | `NDArray[float64]` | N | Contact force at each slice |
|
|
97
|
+
|
|
98
|
+
### Scalar Attributes
|
|
99
|
+
|
|
100
|
+
| Attribute | Type | Unit | Description |
|
|
101
|
+
|-----------|------|------|-------------|
|
|
102
|
+
| `n_slice` | `int` | - | Number of slices |
|
|
103
|
+
| `deflection` | `float` | mm | Roller deformation |
|
|
104
|
+
| `equilibrium_load` | `float` | N | Equilibrium load (should match input) |
|
|
105
|
+
| `equilibrium_moment` | `float` | N·mm | Equilibrium moment |
|
|
106
|
+
| `converged` | `bool` | - | Whether the iteration converged |
|
|
107
|
+
| `error_code` | `int` | - | 0=success, 1=solve failed, 2=invalid n_slice, 3=invalid load |
|
|
108
|
+
|
|
109
|
+
### Computed Properties
|
|
110
|
+
|
|
111
|
+
| Property | Type | Unit | Description |
|
|
112
|
+
|----------|------|------|-------------|
|
|
113
|
+
| `max_stress` | `float` | MPa | Maximum contact stress |
|
|
114
|
+
| `min_stress` | `float` | MPa | Minimum contact stress (non-zero) |
|
|
115
|
+
| `mean_stress` | `float` | MPa | Mean contact stress (contact zone only) |
|
|
116
|
+
| `contact_slices` | `int` | - | Number of slices in contact (stress > 0) |
|
|
117
|
+
| `stress_uniformity` | `float` | 0~1 | Stress uniformity (1 = perfectly uniform) |
|
|
118
|
+
|
|
119
|
+
### Methods
|
|
120
|
+
|
|
121
|
+
| Method | Returns | Description |
|
|
122
|
+
|--------|---------|-------------|
|
|
123
|
+
| `get_slice_positions(roller_length)` | `NDArray[float64]` | Center position of each slice (mm) |
|
|
124
|
+
| `get_slice_width(roller_length)` | `float` | Width of each slice (mm) |
|
|
125
|
+
| `get_slice_spacing(roller_length)` | `float` | Spacing between slice centers (mm) |
|
|
126
|
+
|
|
127
|
+
## Other Functions
|
|
128
|
+
|
|
129
|
+
### `batch_slice_stress()`
|
|
130
|
+
|
|
131
|
+
Calculate stress for multiple loads at once:
|
|
132
|
+
|
|
133
|
+
```python
|
|
134
|
+
from bstart_trb import batch_slice_stress
|
|
135
|
+
|
|
136
|
+
loads = [1340.0, 1128.3, 689.2, 324.8]
|
|
137
|
+
results = batch_slice_stress(roller, raceway, loads, n_slice=30)
|
|
138
|
+
|
|
139
|
+
for i, result in enumerate(results):
|
|
140
|
+
print(f"Load {loads[i]:.1f}N: Max stress {result.max_stress:.0f} MPa")
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### `is_fortran_available()`
|
|
144
|
+
|
|
145
|
+
Check if Fortran core is available:
|
|
146
|
+
|
|
147
|
+
```python
|
|
148
|
+
from bstart_trb import is_fortran_available
|
|
149
|
+
|
|
150
|
+
if is_fortran_available():
|
|
151
|
+
print("Fortran core ready")
|
|
152
|
+
else:
|
|
153
|
+
print("Fortran core not compiled")
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
## Enum Types
|
|
157
|
+
|
|
158
|
+
### `CrownType` - Crown Modification Types
|
|
159
|
+
|
|
160
|
+
| Value | Name | Description |
|
|
161
|
+
|-------|------|-------------|
|
|
162
|
+
| 0 | `STRAIGHT` | No crown modification - high edge stress |
|
|
163
|
+
| 1 | `ARC` | Circular crown - requires arc radius |
|
|
164
|
+
| 2 | `LOGARITHMIC` | Logarithmic crown (recommended) - optimal stress distribution |
|
|
165
|
+
|
|
166
|
+
### `RacewayType` - Raceway Types
|
|
167
|
+
|
|
168
|
+
| Value | Name | Description |
|
|
169
|
+
|-------|------|-------------|
|
|
170
|
+
| 0 | `PLANE` | Flat surface contact |
|
|
171
|
+
| 1 | `INNER` | Inner ring raceway (convex surface) |
|
|
172
|
+
| 2 | `OUTER` | Outer ring raceway (concave surface) - use negative diameter |
|
|
173
|
+
|
|
174
|
+
## Key Parameters Explained
|
|
175
|
+
|
|
176
|
+
### Roller Parameters
|
|
177
|
+
|
|
178
|
+
| Parameter | Unit | Description |
|
|
179
|
+
|-----------|------|-------------|
|
|
180
|
+
| `d1` | mm | Roller small end diameter (equal to d2 for cylindrical) |
|
|
181
|
+
| `d2` | mm | Roller large end diameter |
|
|
182
|
+
| `length` | mm | Effective roller length |
|
|
183
|
+
| `alfa` | deg | Roller half cone angle (0 for cylindrical) |
|
|
184
|
+
| `tilt` | deg | Roller tilt angle (see below) |
|
|
185
|
+
| `crown_type` | - | Crown modification type (see enum) |
|
|
186
|
+
| `curve_q` | N | Design load for crown optimization (see below) |
|
|
187
|
+
|
|
188
|
+
### Raceway Parameters
|
|
189
|
+
|
|
190
|
+
| Parameter | Unit | Description |
|
|
191
|
+
|-----------|------|-------------|
|
|
192
|
+
| `diameter` | mm | Raceway diameter (**negative for outer ring**) |
|
|
193
|
+
| `raceway_type` | - | Inner/Outer raceway type |
|
|
194
|
+
| `fai` | deg | Raceway half cone angle |
|
|
195
|
+
|
|
196
|
+
### Calculation Parameters
|
|
197
|
+
|
|
198
|
+
| Parameter | Unit | Description |
|
|
199
|
+
|-----------|------|-------------|
|
|
200
|
+
| `load` | N | Applied load on roller |
|
|
201
|
+
| `n_slice` | - | Number of slices (default 30, max 50) |
|
|
202
|
+
|
|
203
|
+
### Understanding `curve_q` (Design Load)
|
|
204
|
+
|
|
205
|
+
The `curve_q` parameter determines the logarithmic crown profile. It affects stress distribution:
|
|
206
|
+
|
|
207
|
+
| Condition | Stress Distribution |
|
|
208
|
+
|-----------|---------------------|
|
|
209
|
+
| `load == curve_q` | **Uniform** - optimal crown compensation |
|
|
210
|
+
| `load < curve_q` | Center high, edge low - edge may lose contact |
|
|
211
|
+
| `load > curve_q` | Edge high, center low - edge stress concentration |
|
|
212
|
+
|
|
213
|
+
**Tip**: Set `curve_q` to your most common operating load.
|
|
214
|
+
|
|
215
|
+
### Understanding `tilt` (Tilt Angle)
|
|
216
|
+
|
|
217
|
+
Roller tilt causes asymmetric stress distribution:
|
|
218
|
+
|
|
219
|
+
```
|
|
220
|
+
tilt = 0 (normal): tilt > 0 (tilted):
|
|
221
|
+
┌──────────────────┐ ┌──────────────────┐
|
|
222
|
+
│ uniform stress │ │ high │ low │
|
|
223
|
+
└──────────────────┘ └──────────────────┘
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
Sources of tilt: shaft deflection, mounting errors, housing deformation.
|
|
227
|
+
|
|
228
|
+
### Why Outer Ring Uses Negative Diameter?
|
|
229
|
+
|
|
230
|
+
Hertz contact theory sign convention:
|
|
231
|
+
- **Positive curvature** → Convex surface (roller, inner ring)
|
|
232
|
+
- **Negative curvature** → Concave surface (outer ring)
|
|
233
|
+
|
|
234
|
+
Example: Outer ring with 150mm diameter → `diameter = -150.0`
|
|
235
|
+
|
|
236
|
+
## What is Slice Calculation?
|
|
237
|
+
|
|
238
|
+
The slice method divides the roller-raceway contact into multiple slices along the roller length to accurately calculate stress distribution. This is essential for:
|
|
239
|
+
|
|
240
|
+
- Capturing edge stress concentration effects
|
|
241
|
+
- Analyzing the impact of crown modifications
|
|
242
|
+
- Predicting bearing life more accurately
|
|
243
|
+
- Understanding load distribution along roller length
|
|
244
|
+
|
|
245
|
+
## Theory
|
|
246
|
+
|
|
247
|
+
This package implements the **influence coefficient method** based on elastic half-space contact theory:
|
|
248
|
+
|
|
249
|
+
1. Discretizes roller into slices
|
|
250
|
+
2. Calculates elastic coupling between slices (influence coefficient matrix)
|
|
251
|
+
3. Solves linear system using Gaussian elimination
|
|
252
|
+
4. Iterates to convergence for contact area and load balance
|
|
253
|
+
|
|
254
|
+
The method is more accurate than simplified Hertz formulas as it accounts for:
|
|
255
|
+
- Elastic coupling between slices
|
|
256
|
+
- Dynamic contact area determination
|
|
257
|
+
- Edge loading effects
|
|
258
|
+
- Crown modification influence
|
|
259
|
+
|
|
260
|
+
## Requirements
|
|
261
|
+
|
|
262
|
+
- Python >= 3.11
|
|
263
|
+
- NumPy >= 2.0.0
|
|
264
|
+
|
|
265
|
+
## Platform Support
|
|
266
|
+
|
|
267
|
+
| Platform | Status |
|
|
268
|
+
|----------|--------|
|
|
269
|
+
| Windows (x64) | ✅ Supported |
|
|
270
|
+
| Linux | 🚧 Coming soon |
|
|
271
|
+
| macOS | 🚧 Coming soon |
|
|
272
|
+
|
|
273
|
+
## License
|
|
274
|
+
|
|
275
|
+
MIT License - See LICENSE file for details.
|
|
276
|
+
|
|
277
|
+
## Author
|
|
278
|
+
|
|
279
|
+
Gu Lei
|
|
280
|
+
|
|
281
|
+
## References
|
|
282
|
+
|
|
283
|
+
- Harris, T.A., Kotzalas, M.N. - *Rolling Bearing Analysis*, 5th Edition
|
|
284
|
+
- Johnson, K.L. - *Contact Mechanics*
|
|
285
|
+
- ISO/TS 16281:2008 - Rolling bearings calculation methods
|
|
286
|
+
|
|
287
|
+
## Contributing
|
|
288
|
+
|
|
289
|
+
Contributions are welcome! Please feel free to submit issues or pull requests.
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
# BSTART-TRB
|
|
2
|
+
|
|
3
|
+
**Cylindrical/Tapered Roller Bearing Slice Stress Calculation Module**
|
|
4
|
+
|
|
5
|
+
A high-performance Python package for calculating contact stress distribution in roller bearings using the slice method with Fortran computational core.
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- 🚀 **Fast Fortran Core**: Compiled Fortran code via f2py for optimal performance
|
|
10
|
+
- 📦 **Pre-compiled Binary**: No Fortran compiler required for installation
|
|
11
|
+
- 🎯 **Type-Safe**: Complete type hints and IDE support
|
|
12
|
+
- 🔬 **Accurate**: Uses influence coefficient method based on elastic contact theory
|
|
13
|
+
- 📊 **Flexible**: Supports various crown types (linear, circular, logarithmic)
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
pip install bstart-trb
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
**Note**: This package includes pre-compiled binaries for Windows (x64) + Python 3.11. Support for other platforms coming soon.
|
|
22
|
+
|
|
23
|
+
## Quick Start
|
|
24
|
+
|
|
25
|
+
```python
|
|
26
|
+
from bstart_trb import (
|
|
27
|
+
slice_stress,
|
|
28
|
+
RollerParams,
|
|
29
|
+
RacewayParams,
|
|
30
|
+
CrownType,
|
|
31
|
+
RacewayType,
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
# Define cylindrical roller parameters
|
|
35
|
+
roller = RollerParams(
|
|
36
|
+
d1=10.0, # Small end diameter (mm)
|
|
37
|
+
d2=10.0, # Large end diameter (mm)
|
|
38
|
+
length=9.6, # Effective length (mm)
|
|
39
|
+
alfa=0.0, # Half cone angle (degrees)
|
|
40
|
+
tilt=0.0, # Tilt angle (degrees)
|
|
41
|
+
crown_type=CrownType.LOGARITHMIC,
|
|
42
|
+
curve_q=14100.0, # Design load (N)
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
# Define outer ring raceway parameters
|
|
46
|
+
raceway = RacewayParams(
|
|
47
|
+
diameter=-150.0, # Negative for concave surface (mm)
|
|
48
|
+
raceway_type=RacewayType.OUTER,
|
|
49
|
+
fai=0.0, # Half cone angle (degrees)
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
# Calculate slice stress distribution
|
|
53
|
+
result = slice_stress(roller, raceway, load=1340.86, n_slice=30)
|
|
54
|
+
|
|
55
|
+
# Access scalar results
|
|
56
|
+
print(f"Converged: {result.converged}")
|
|
57
|
+
print(f"Max stress: {result.max_stress:.0f} MPa")
|
|
58
|
+
print(f"Mean stress: {result.mean_stress:.0f} MPa")
|
|
59
|
+
print(f"Contact deflection: {result.deflection:.6f} mm")
|
|
60
|
+
print(f"Stress uniformity: {result.stress_uniformity:.2%}")
|
|
61
|
+
print(f"Contact slices: {result.contact_slices}/{result.n_slice}")
|
|
62
|
+
|
|
63
|
+
# Access array results
|
|
64
|
+
print(f"Stress distribution: {result.stress}") # MPa per slice
|
|
65
|
+
print(f"Contact half-widths: {result.half_width}") # mm per slice
|
|
66
|
+
print(f"Slice forces: {result.slice_force}") # N per slice
|
|
67
|
+
|
|
68
|
+
# Get slice positions along roller length
|
|
69
|
+
positions = result.get_slice_positions(roller.length) # mm
|
|
70
|
+
print(f"Slice positions: {positions}")
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Return Value: `SliceResult`
|
|
74
|
+
|
|
75
|
+
The `slice_stress()` function returns a `SliceResult` object containing:
|
|
76
|
+
|
|
77
|
+
### Array Attributes
|
|
78
|
+
|
|
79
|
+
| Attribute | Type | Unit | Description |
|
|
80
|
+
|-----------|------|------|-------------|
|
|
81
|
+
| `stress` | `NDArray[float64]` | MPa | Contact stress at each slice center |
|
|
82
|
+
| `half_width` | `NDArray[float64]` | mm | Contact half-width at each slice |
|
|
83
|
+
| `slice_force` | `NDArray[float64]` | N | Contact force at each slice |
|
|
84
|
+
|
|
85
|
+
### Scalar Attributes
|
|
86
|
+
|
|
87
|
+
| Attribute | Type | Unit | Description |
|
|
88
|
+
|-----------|------|------|-------------|
|
|
89
|
+
| `n_slice` | `int` | - | Number of slices |
|
|
90
|
+
| `deflection` | `float` | mm | Roller deformation |
|
|
91
|
+
| `equilibrium_load` | `float` | N | Equilibrium load (should match input) |
|
|
92
|
+
| `equilibrium_moment` | `float` | N·mm | Equilibrium moment |
|
|
93
|
+
| `converged` | `bool` | - | Whether the iteration converged |
|
|
94
|
+
| `error_code` | `int` | - | 0=success, 1=solve failed, 2=invalid n_slice, 3=invalid load |
|
|
95
|
+
|
|
96
|
+
### Computed Properties
|
|
97
|
+
|
|
98
|
+
| Property | Type | Unit | Description |
|
|
99
|
+
|----------|------|------|-------------|
|
|
100
|
+
| `max_stress` | `float` | MPa | Maximum contact stress |
|
|
101
|
+
| `min_stress` | `float` | MPa | Minimum contact stress (non-zero) |
|
|
102
|
+
| `mean_stress` | `float` | MPa | Mean contact stress (contact zone only) |
|
|
103
|
+
| `contact_slices` | `int` | - | Number of slices in contact (stress > 0) |
|
|
104
|
+
| `stress_uniformity` | `float` | 0~1 | Stress uniformity (1 = perfectly uniform) |
|
|
105
|
+
|
|
106
|
+
### Methods
|
|
107
|
+
|
|
108
|
+
| Method | Returns | Description |
|
|
109
|
+
|--------|---------|-------------|
|
|
110
|
+
| `get_slice_positions(roller_length)` | `NDArray[float64]` | Center position of each slice (mm) |
|
|
111
|
+
| `get_slice_width(roller_length)` | `float` | Width of each slice (mm) |
|
|
112
|
+
| `get_slice_spacing(roller_length)` | `float` | Spacing between slice centers (mm) |
|
|
113
|
+
|
|
114
|
+
## Other Functions
|
|
115
|
+
|
|
116
|
+
### `batch_slice_stress()`
|
|
117
|
+
|
|
118
|
+
Calculate stress for multiple loads at once:
|
|
119
|
+
|
|
120
|
+
```python
|
|
121
|
+
from bstart_trb import batch_slice_stress
|
|
122
|
+
|
|
123
|
+
loads = [1340.0, 1128.3, 689.2, 324.8]
|
|
124
|
+
results = batch_slice_stress(roller, raceway, loads, n_slice=30)
|
|
125
|
+
|
|
126
|
+
for i, result in enumerate(results):
|
|
127
|
+
print(f"Load {loads[i]:.1f}N: Max stress {result.max_stress:.0f} MPa")
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### `is_fortran_available()`
|
|
131
|
+
|
|
132
|
+
Check if Fortran core is available:
|
|
133
|
+
|
|
134
|
+
```python
|
|
135
|
+
from bstart_trb import is_fortran_available
|
|
136
|
+
|
|
137
|
+
if is_fortran_available():
|
|
138
|
+
print("Fortran core ready")
|
|
139
|
+
else:
|
|
140
|
+
print("Fortran core not compiled")
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## Enum Types
|
|
144
|
+
|
|
145
|
+
### `CrownType` - Crown Modification Types
|
|
146
|
+
|
|
147
|
+
| Value | Name | Description |
|
|
148
|
+
|-------|------|-------------|
|
|
149
|
+
| 0 | `STRAIGHT` | No crown modification - high edge stress |
|
|
150
|
+
| 1 | `ARC` | Circular crown - requires arc radius |
|
|
151
|
+
| 2 | `LOGARITHMIC` | Logarithmic crown (recommended) - optimal stress distribution |
|
|
152
|
+
|
|
153
|
+
### `RacewayType` - Raceway Types
|
|
154
|
+
|
|
155
|
+
| Value | Name | Description |
|
|
156
|
+
|-------|------|-------------|
|
|
157
|
+
| 0 | `PLANE` | Flat surface contact |
|
|
158
|
+
| 1 | `INNER` | Inner ring raceway (convex surface) |
|
|
159
|
+
| 2 | `OUTER` | Outer ring raceway (concave surface) - use negative diameter |
|
|
160
|
+
|
|
161
|
+
## Key Parameters Explained
|
|
162
|
+
|
|
163
|
+
### Roller Parameters
|
|
164
|
+
|
|
165
|
+
| Parameter | Unit | Description |
|
|
166
|
+
|-----------|------|-------------|
|
|
167
|
+
| `d1` | mm | Roller small end diameter (equal to d2 for cylindrical) |
|
|
168
|
+
| `d2` | mm | Roller large end diameter |
|
|
169
|
+
| `length` | mm | Effective roller length |
|
|
170
|
+
| `alfa` | deg | Roller half cone angle (0 for cylindrical) |
|
|
171
|
+
| `tilt` | deg | Roller tilt angle (see below) |
|
|
172
|
+
| `crown_type` | - | Crown modification type (see enum) |
|
|
173
|
+
| `curve_q` | N | Design load for crown optimization (see below) |
|
|
174
|
+
|
|
175
|
+
### Raceway Parameters
|
|
176
|
+
|
|
177
|
+
| Parameter | Unit | Description |
|
|
178
|
+
|-----------|------|-------------|
|
|
179
|
+
| `diameter` | mm | Raceway diameter (**negative for outer ring**) |
|
|
180
|
+
| `raceway_type` | - | Inner/Outer raceway type |
|
|
181
|
+
| `fai` | deg | Raceway half cone angle |
|
|
182
|
+
|
|
183
|
+
### Calculation Parameters
|
|
184
|
+
|
|
185
|
+
| Parameter | Unit | Description |
|
|
186
|
+
|-----------|------|-------------|
|
|
187
|
+
| `load` | N | Applied load on roller |
|
|
188
|
+
| `n_slice` | - | Number of slices (default 30, max 50) |
|
|
189
|
+
|
|
190
|
+
### Understanding `curve_q` (Design Load)
|
|
191
|
+
|
|
192
|
+
The `curve_q` parameter determines the logarithmic crown profile. It affects stress distribution:
|
|
193
|
+
|
|
194
|
+
| Condition | Stress Distribution |
|
|
195
|
+
|-----------|---------------------|
|
|
196
|
+
| `load == curve_q` | **Uniform** - optimal crown compensation |
|
|
197
|
+
| `load < curve_q` | Center high, edge low - edge may lose contact |
|
|
198
|
+
| `load > curve_q` | Edge high, center low - edge stress concentration |
|
|
199
|
+
|
|
200
|
+
**Tip**: Set `curve_q` to your most common operating load.
|
|
201
|
+
|
|
202
|
+
### Understanding `tilt` (Tilt Angle)
|
|
203
|
+
|
|
204
|
+
Roller tilt causes asymmetric stress distribution:
|
|
205
|
+
|
|
206
|
+
```
|
|
207
|
+
tilt = 0 (normal): tilt > 0 (tilted):
|
|
208
|
+
┌──────────────────┐ ┌──────────────────┐
|
|
209
|
+
│ uniform stress │ │ high │ low │
|
|
210
|
+
└──────────────────┘ └──────────────────┘
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
Sources of tilt: shaft deflection, mounting errors, housing deformation.
|
|
214
|
+
|
|
215
|
+
### Why Outer Ring Uses Negative Diameter?
|
|
216
|
+
|
|
217
|
+
Hertz contact theory sign convention:
|
|
218
|
+
- **Positive curvature** → Convex surface (roller, inner ring)
|
|
219
|
+
- **Negative curvature** → Concave surface (outer ring)
|
|
220
|
+
|
|
221
|
+
Example: Outer ring with 150mm diameter → `diameter = -150.0`
|
|
222
|
+
|
|
223
|
+
## What is Slice Calculation?
|
|
224
|
+
|
|
225
|
+
The slice method divides the roller-raceway contact into multiple slices along the roller length to accurately calculate stress distribution. This is essential for:
|
|
226
|
+
|
|
227
|
+
- Capturing edge stress concentration effects
|
|
228
|
+
- Analyzing the impact of crown modifications
|
|
229
|
+
- Predicting bearing life more accurately
|
|
230
|
+
- Understanding load distribution along roller length
|
|
231
|
+
|
|
232
|
+
## Theory
|
|
233
|
+
|
|
234
|
+
This package implements the **influence coefficient method** based on elastic half-space contact theory:
|
|
235
|
+
|
|
236
|
+
1. Discretizes roller into slices
|
|
237
|
+
2. Calculates elastic coupling between slices (influence coefficient matrix)
|
|
238
|
+
3. Solves linear system using Gaussian elimination
|
|
239
|
+
4. Iterates to convergence for contact area and load balance
|
|
240
|
+
|
|
241
|
+
The method is more accurate than simplified Hertz formulas as it accounts for:
|
|
242
|
+
- Elastic coupling between slices
|
|
243
|
+
- Dynamic contact area determination
|
|
244
|
+
- Edge loading effects
|
|
245
|
+
- Crown modification influence
|
|
246
|
+
|
|
247
|
+
## Requirements
|
|
248
|
+
|
|
249
|
+
- Python >= 3.11
|
|
250
|
+
- NumPy >= 2.0.0
|
|
251
|
+
|
|
252
|
+
## Platform Support
|
|
253
|
+
|
|
254
|
+
| Platform | Status |
|
|
255
|
+
|----------|--------|
|
|
256
|
+
| Windows (x64) | ✅ Supported |
|
|
257
|
+
| Linux | 🚧 Coming soon |
|
|
258
|
+
| macOS | 🚧 Coming soon |
|
|
259
|
+
|
|
260
|
+
## License
|
|
261
|
+
|
|
262
|
+
MIT License - See LICENSE file for details.
|
|
263
|
+
|
|
264
|
+
## Author
|
|
265
|
+
|
|
266
|
+
Gu Lei
|
|
267
|
+
|
|
268
|
+
## References
|
|
269
|
+
|
|
270
|
+
- Harris, T.A., Kotzalas, M.N. - *Rolling Bearing Analysis*, 5th Edition
|
|
271
|
+
- Johnson, K.L. - *Contact Mechanics*
|
|
272
|
+
- ISO/TS 16281:2008 - Rolling bearings calculation methods
|
|
273
|
+
|
|
274
|
+
## Contributing
|
|
275
|
+
|
|
276
|
+
Contributions are welcome! Please feel free to submit issues or pull requests.
|