# Cylindrical Roller Bearing Slice Calculation Guide

This document provides a detailed introduction to the slice calculation principles and implementation logic for Cylindrical Roller Bearings (CRB) in the BSTART system.

---

## Table of Contents

- [1. Slice Calculation Overview](#1-slice-calculation-overview)
- [2. Load Distribution Calculation](#2-load-distribution-calculation)
- [3. Roller Slice Stress Calculation](#3-roller-slice-stress-calculation)
- [4. Input/Output Format](#4-inputoutput-format)
- [5. Usage Examples](#5-usage-examples)
- [6. Relationship with Life Calculation](#6-relationship-with-life-calculation)
- [7. Edge Effect and Crowning](#7-edge-effect-and-crowning)
- [8. Roller Tilt Angle Explained](#8-roller-tilt-angle-explained)
- [9. f2py Wrapper (Direct Python Call)](#9-f2py-wrapper-direct-python-call)
- [10. Complete Calculation Flow](#10-complete-calculation-flow)
- [References](#references)

---

## 1. Slice Calculation Overview

### 1.1 What is Slice Calculation

The contact zone of a cylindrical roller bearing is a line contact, where the contact stress between the roller and raceway is non-uniformly distributed along the roller length. To accurately calculate the stress distribution, the roller is divided into multiple **slices (strips)** along the axial direction, and the contact stress of each slice is calculated separately.

```
Roller Slice Diagram:
┌─────────────────────────────────────────────┐
│  1  │  2  │  3  │ ... │ n-1 │  n  │         │ ← Roller
└─────────────────────────────────────────────┘
  ↑      ↑      ↑           ↑      ↑
  σ₁     σ₂     σ₃         σₙ₋₁   σₙ          ← Slice Stress
```

### 1.2 Necessity of Slice Calculation

| Traditional Method | Slice Method |
|-------------------|--------------|
| Assumes uniform stress distribution | Calculates actual stress distribution |
| Ignores edge effects | Captures edge stress concentration |
| Conservative life estimation | More accurate life prediction |

### 1.3 Related Files

| File | Function |
|------|----------|
| `CRB_main.py` | Main program for CRB calculation |
| `CRB_C.py` | C DLL interface for load distribution |
| `TAPER_FORTRAN.py` | Fortran program interface for slice stress |
| `CRB_load.dll` | C-compiled load distribution library |
| `TAPER.exe` | Fortran-compiled stress calculation program |

---

## 2. Load Distribution Calculation

### 2.1 Calculation Principle

Under radial load, each roller bears different loads. The maximum load occurs in the load direction (usually at 0° position), and decreases as the angle increases.

Load distribution formula:
$$Q_j = Q_{max} \cdot \left(1 - \frac{1}{2\varepsilon}\left(1 - \cos\psi_j\right)\right)^n$$

Where:
- $Q_j$: Load on the j-th roller (N)
- $Q_{max}$: Maximum roller load (N)
- $\varepsilon$: Load distribution parameter
- $\psi_j$: Azimuth angle of the j-th roller (rad)
- $n$: Load-deflection exponent (line contact $n = 10/9$)

### 2.2 Code Implementation

Load distribution is calculated via C DLL (`CRB_C.py`):

```python
def c_wfk(z: int, pd: float, l: float, fr: float, r1: float, r2: float):
    """
    Calculate load distribution for cylindrical roller bearing
    
    Parameters:
        z: Number of rollers
        pd: Radial clearance (mm)
        l: Roller length (mm)
        fr: Radial load (N)
        r1: Roller radius (mm)
        r2: Raceway radius (mm)
    
    Returns:
        dict: {angle: [contact deformation, contact load]}
    """
    clib = ctypes.CDLL('./CRB_load.dll')
    clib.CRB.restype = TestStruct
    
    value = clib.CRB(
        ctypes.c_double(z), 
        ctypes.c_double(pd),
        ctypes.c_double(l), 
        ctypes.c_double(fr),
        ctypes.c_double(r1), 
        ctypes.c_double(r2)
    )
    
    # Parse results
    c_dict = {}
    for i in range(z):
        angle = value.array[i*3] * 180 / math.pi  # Azimuth angle (degrees)
        deformation = value.array[i*3 + 1]         # Contact deformation
        load = value.array[i*3 + 2]                # Contact load
        c_dict[angle] = [deformation, load]
    
    return c_dict
```

### 2.3 Output Example

```python
# 14 rollers, radial load 4450N
c_dict = {
    0.0: [0.0023, 1928.5],      # 0° roller: maximum load
    25.7: [0.0019, 1456.2],     # 25.7° roller
    51.4: [0.0012, 892.1],      # 51.4° roller
    77.1: [0.0005, 324.8],      # 77.1° roller
    102.9: [0.0, 0.0],          # 102.9° roller: no contact
    # ... other rollers
}
```

---

## 3. Roller Slice Stress Calculation

### 3.1 Slice Parameters

| Parameter | Description | Default | Limit |
|-----------|-------------|---------|-------|
| `n` | Number of slices (strips) | 30 | **Max 50** (f90) / 30 (original FOR) |
| `m1` | Crown type: 0-straight, 1-arc, 2-logarithmic | 2 (logarithmic) | - |
| `m2` | Raceway type: 0-plane, 1-inner, 2-outer | 1 or 2 | - |

**⚠️ Slice Number Limitation**:
- Original `TAPER_A.FOR` uses fixed arrays `dimension p(30),a(30),d(30,30)`, max 30 slices
- New `taper_slice.f90` uses `MAX_SLICES = 50`, max 50 slices
- For more slices, modify the array size limit in source code and recompile

### 3.2 TAPER Class Parameter Description

```python
class TAPER:
    def __init__(self, d1, d2, l, alfa, q, tilt, m1, n, m2, dr1, fai, curveQ):
        """
        Fortran program interface
        
        Parameters:
            d1: Roller small-end diameter (mm)
            d2: Roller large-end diameter (mm) (d1=d2 for cylindrical roller)
            l: Roller effective length (mm)
            alfa: Roller half-cone angle (°) (alfa=0 for cylindrical roller)
            q: Roller load (N)
            tilt: Roller tilt angle (°)
            m1: Crown type - 0:straight, 1:arc, 2:logarithmic
            n: Number of slices (strips) ← Key parameter
            m2: Raceway type - 0:plane, 1:inner, 2:outer
            dr1: Raceway diameter (mm)
            fai: Raceway half-cone angle (°)
            curveQ: Design load (N) (for logarithmic crown calculation)
        """
```

### 3.3 Stress Calculation Principle

#### 3.3.1 Simplified Hertz Formula (Reference)

The traditional Hertz elliptical contact stress formula is:

$$\sigma_i = \frac{2 \cdot q_i}{\pi \cdot a_i \cdot b_i}$$

Where:
- $\sigma_i$: Maximum contact stress of the i-th slice (MPa)
- $q_i$: Line load of the i-th slice (N/mm)
- $a_i, b_i$: Contact ellipse semi-axes (mm)

However, this formula assumes independent slices and ignores elastic coupling between slices.

#### 3.3.2 Fortran Implementation: Influence Coefficient Method

TAPER.exe (source `fortran/TAPER_A.FOR`) uses the more accurate **Elastic Half-Space Influence Coefficient Method**:

**Core Algorithm Steps:**

1. **Build influence coefficient matrix [d]**
   - `infmat` subroutine (lines 324-347)
   - Calculate elastic coupling relationships between slices
   - Use Gaussian integration to compute influence coefficients (`calf`, `f` subroutines)

2. **Solve linear equations [d]{p}={s}**
   - `gauss` subroutine (lines 387-440)
   - Use Gaussian elimination
   - Where {s} is the gap array, {p} is the contact stress array

3. **Iterative convergence**
   - Dual iteration in `contac` subroutine
   - Outer loop: Load equilibrium iteration (adjusting deflection dc)
   - Inner loop: Contact zone convergence iteration

**Key Code Snippet:**

```fortran
c     Calculate influence coefficient matrix and solve for stress p()
      call infmat(n,h,a,d)           ! Build influence coefficient matrix
      call gauss(t0,n,ierror,d,p,s)  ! Solve equations, get stress

c     Calculate new contact half-width from stress
      do 24 i=1,n
24    a(i)=1.767e-5*r(i)*p(i)        ! Hertz relationship
```

Where `t0 = 4*(1-v²)/(π*E)` is the material constant (v=0.3 Poisson's ratio, E=206GPa elastic modulus).

**Comparison with Simplified Formula:**

| Feature | Simplified Hertz | Influence Coefficient Method |
|---------|------------------|------------------------------|
| Slice coupling | Not considered | Coupled via influence matrix |
| Contact zone | Fixed | Iteratively determined |
| Accuracy | Approximate | Exact (elastic half-space theory) |
| Complexity | O(n) | O(n³) |

Logarithmic crowning can optimize stress distribution and reduce edge stress concentration.

#### 3.3.3 Important Clarification: Load is NOT Evenly Distributed to Slices

**Common Misconception**: If total load q=3000N and n=100 slices, does each slice get 30N?

**Answer: NO!**

The Fortran program input is **total load q**, not per-slice load. The actual calculation flow:

```
Input: Total load q=3000N, slices n=100

Step 1: Estimate overall deflection
        dc = 3.84e-5 × q^0.9 / rl^0.8

Step 2: Calculate gap for each slice
        s(i) = dc - z(i)    (z depends on crowning and tilt)

Step 3: Build n×n influence coefficient matrix [d]
        d(i,j) represents elastic influence of slice j on slice i

Step 4: Solve equation system [d]{p} = {s}
        Get stress p(i) for each slice

Step 5: Calculate equilibrium load
        q1 = π × Σ(p(i) × a(i)) × h

Step 6: If |q1 - q| / q > 0.5%
        Adjust dc, return to Step 2

Output: Slice stress p(i) (MPa) — Non-uniform distribution!
```

**Why is slice stress non-uniform?**

1. **Coupling effect of influence coefficient matrix**: Each slice's deformation is affected by other slices' loads
2. **Edge effect**: Edge slices have only one-sided neighbors "helping to carry load", higher stress
3. **Crowning**: Intentionally reduces edge gap to compensate for edge effect
4. **Tilt**: When tilt≠0, one side contacts tightly, the other may separate

### 3.4 Code Implementation (Legacy - File Parameter Passing)

```python
# CRB_main.py (legacy implementation, via INPUT_TAPER.dat file)

class CRB:
    def __init__(self, z, Pd, l, l_total, fr, r1, r2, r3, curveQ):
        """
        Cylindrical roller bearing calculation class
        
        Parameters:
            z: Number of rollers
            Pd: Radial clearance (mm)
            l: Roller effective length (mm)
            l_total: Roller total length (mm)
            fr: Radial load (N)
            r1: Roller radius (mm)
            r2: Inner raceway radius (mm)
            r3: Outer raceway radius (mm)
            curveQ: Design load (N)
        """
        self.n_slice = 30  # Number of slices
    
    def CRB_Main(self):
        """Main calculation flow"""
        # 1. Calculate load distribution
        c_dict, a_list = c_wfk(self.z, self.Pd, self.l, self.fr, self.r1, self.r2)
        
        # 2. Inner raceway slice stress calculation
        roller_inner = TAPER(
            d1=2*self.r1, d2=2*self.r1,  # Roller diameter
            l=self.l,                     # Roller effective length
            alfa=0,                       # Half-cone angle (0 for cylindrical)
            q=0,                          # Load (assigned later)
            tilt=0,                       # Tilt angle
            m1=2,                         # Logarithmic crown
            n=30,                         # Number of slices ← Key parameter
            m2=1,                         # Inner ring
            dr1=2*self.r2,               # Inner raceway diameter
            fai=0,                        # Raceway half-cone angle
            curveQ=self.curveQ           # Design load
        )
        
        # Calculate slice stress for each roller
        line_dict_inner = {}
        for angle, values in c_dict.items():
            load = values[1]  # This roller's load
            roller_inner.q = load
            roller_inner.write_dat()
            roller_inner.run_exe()
           
            # Read 30 slice stress values
            with open('TAPER.txt', 'r') as f:
                stresses = []
                for line in f.readlines()[1::2]:
                    stresses += line.strip().split()
                line_dict_inner[angle] = stresses
        
        # 3. Outer raceway slice stress calculation (similar)
        roller_outer = TAPER(..., m2=2, dr1=2*(-self.r3), ...)
        # ...
        
        return c_dict, line_dict_inner, line_dict_outer
```

---

## 4. Input/Output Format

### 4.1 Input File (INPUT_TAPER.dat)

```
10.0      10.0      9.6       0.0       1340.859878 
0.0       2         30        2         -150.0    0.0       14100.0   
```

| Line | Parameters | Description |
|------|------------|-------------|
| 1 | d1, d2, l, alfa, q | Small-end dia, large-end dia, effective length, half-cone angle, load |
| 2 | tilt, m1, **n**, m2, dr1, fai, curveQ | Tilt angle, crown type, **slice count**, raceway type, raceway dia, raceway half-cone angle, design load |

#### Why Two Half-Cone Angles (alfa and fai)?

**1. Roller half-cone angle `alfa`**
- Describes the **roller's own** conical shape
- Cylindrical roller: `alfa = 0`
- Tapered roller: `alfa > 0` (typical 10°-15°)

**2. Raceway half-cone angle `fai`**
- Describes the **raceway's** conical shape
- Cylindrical roller bearing: `fai = 0` (raceway is cylindrical)
- Tapered roller bearing: `fai > 0` (raceway is conical)

**Why separate them?**

Theoretically, in tapered roller bearings, the roller and raceway half-cone angles should be equal (`alfa = fai`) for perfect line contact.

But in practical design and calculation, separating them allows:

1. **Handle manufacturing tolerances** - Actual half-cone angles may differ slightly
2. **More general calculation model** - Same code handles both CRB and TRB
3. **Handle special contacts** - Can also handle roller-plane contact (`fai = 0`, `m2 = 0`)

**For Cylindrical Roller Bearings (CRB):**
- `alfa = 0` (roller is cylindrical)
- `fai = 0` (raceway is cylindrical)

### 4.2 Output File (TAPER.txt)

```
  1269.  1092.  1061.  1041.  1028.  1018.  1011.  1005.  1001.   998.
   995.   993.   991.   990.   990.   990.   990.   991.   993.   995.
   998.  1001.  1005.  1011.  1018.  1028.  1041.  1061.  1092.  1269.
```

30 values corresponding to contact stress (MPa) of 30 slices.

Observations:
- High stress at both ends (edge effect): 1269 MPa
- Low and uniform stress in the middle: ~990 MPa
- Logarithmic crowning effectively reduces edge stress concentration

### 4.3 Stress Distribution Visualization

After calculation, stress distribution plots are generated:
- `inner.png`: Inner raceway contact stress distribution
- `outer.png`: Outer raceway contact stress distribution

```python
def make_report(self):
    """Generate report and charts"""
    # ... calculation ...
    
    # Plot inner raceway stress distribution
    plt.figure(figsize=(6, 4), dpi=200)
    for angle in df_inner.index:
        plt.plot(
            df_inner.loc[angle, :].keys(),  # X: Slice position
            df_inner.loc[angle, :].values,   # Y: Stress value
            label=f'{angle}°'
        )
    plt.xlabel("Distance along roller (mm)")
    plt.ylabel("Contact stress (MPa)")
    plt.title("Inner Raceway Contact Stress")
    plt.savefig('inner.png')
```

---

## 5. Usage Examples

### 5.1 Complete Calculation Flow

```python
from CRB_main import CRB

# Create cylindrical roller bearing object
crb = CRB(
    z=14,           # 14 rollers
    Pd=0.041,       # Radial clearance 0.041mm
    l=9.6,          # Roller effective length 9.6mm
    l_total=10,     # Roller total length 10mm
    fr=4450,        # Radial load 4450N
    r1=5,           # Roller radius 5mm
    r2=55,          # Inner raceway radius 55mm
    r3=75,          # Outer raceway radius 75mm
    curveQ=14100    # Design load 14100N
)

# Execute calculation and generate report
crb.make_report()
```

### 5.2 Parameter Adjustment

To modify slice count, edit the `n` parameter in `CRB_main.py`:

```python
# Default 30 slices
roller_inner = TAPER(..., n=30, ...)

# Finer calculation (e.g., 50 slices)
roller_inner = TAPER(..., n=50, ...)
```

---

## 6. Relationship with Life Calculation

Stress distribution from slice calculation enables more accurate life prediction:

1. **Traditional method**: Use average stress to calculate L10 life
2. **Slice method**: Consider stress distribution, calculate life based on maximum stress or cumulative damage

$$L_{10} = \left(\frac{Q_c}{Q_{eq}}\right)^{10/3}$$

Where $Q_{eq}$ can be calculated as equivalent load based on slice stress distribution.

---

## 7. Edge Effect and Crowning

### 7.1 Edge Loading

For an ideal cylindrical roller (no crowning), if both roller and raceway are perfect straight generatrix surfaces, stress should theoretically be uniform. However, in reality, **edge stress concentration** occurs (edge stress tends to infinity):

```
Stress distribution without crowning:

Stress
  ↑        ∞           ∞
  |       /|           |\
  |      / |           | \
  |     /  |___________|  \
  |    /                   \
  +-----------------------------→ Roller length
       Edge    Uniform    Edge
```

This is because at the roller ends, the contact zone abruptly terminates, causing stress to spike.

### 7.2 Purpose of Crowning

To reduce edge stress concentration, **crowning** is applied:

| Crown Type | m1 | Characteristics |
|------------|-----|-----------------|
| Straight | 0 | No modification, high edge stress |
| Arc | 1 | Simple modification, requires arc radius specification |
| Logarithmic | 2 | Optimal modification, theoretically achieves uniform stress |

**Logarithmic Crown Design Principle:**

$$z = t_1 \cdot \ln\left(\frac{1}{1-(2y/l)^2}\right)$$

Where:
- $z$: Roller end relief (crown amount), unit mm
- $y$: Position along roller axis (origin at roller center), unit mm
- $l$: Roller effective length (i.e., rl), unit mm
- $t_1$: Logarithmic crown amplitude parameter, unit mm

#### t₁ and curveQ Calculation Formula

**Core Formula** (from TAPER_A.FOR line 58):

$$t_1 = \frac{1}{2} \cdot t_0 \cdot \frac{curveQ}{rl}$$

Where $t_0$ is the **material elastic constant**:

$$t_0 = \frac{4(1-\nu^2)}{\pi \cdot E}$$

| Parameter | Meaning | Typical Value | Unit |
|-----------|---------|---------------|------|
| $t_1$ | Logarithmic crown amplitude | Calculated | mm |
| $t_0$ | Material elastic constant | 5.626×10⁻⁶ | mm²/N |
| $\nu$ | Poisson's ratio | 0.3 (steel) | - |
| $E$ | Elastic modulus | 2.06×10⁵ | MPa |
| $curveQ$ | Design load | User input | N |
| $rl$ | Roller effective length | User input | mm |

**Numerical Calculation Example:**

For steel (ν=0.3, E=206000 MPa):

$$t_0 = \frac{4 \times (1-0.3^2)}{3.14159 \times 206000} = \frac{4 \times 0.91}{647118} \approx 5.626 \times 10^{-6} \text{ mm}^2/\text{N}$$

Simplified form:

$$t_1 = 2.813 \times 10^{-6} \cdot \frac{curveQ}{rl} \quad \text{(mm)}$$

**Verification Example:**

Assuming curveQ = 14100 N, rl = 9.6 mm:

$$t_1 = 2.813 \times 10^{-6} \times \frac{14100}{9.6} = 4.13 \times 10^{-3} \text{ mm} = 4.13 \text{ μm}$$

#### Logarithmic Crown Curve Characteristics

| Position | y value | z(y) value | Description |
|----------|---------|------------|-------------|
| Center | 0 | 0 | No modification |
| 1/4 point | ±rl/4 | 0.134×t₁ | Minor modification |
| Near end | ±0.4995rl | 6.2×t₁ | Rapidly increasing |
| Extreme end | ±0.49995rl | 8.5×t₁ | Tends to infinity |

When actual load q = curveQ, stress distribution is uniform.

### 7.3 Role of Design Load curveQ

#### 7.3.1 Physical Meaning of curveQ

curveQ is the "reference load for designing logarithmic crown". It determines the roller end relief (crown amount).

**Design Goal**: The purpose of logarithmic crowning is to achieve uniform contact stress distribution along the roller length at a specific load.

```
Without crowning (ideal):        Without crowning (actual):
Stress                           Stress    ∞           ∞
  ↑  ________________                ↑   /|           |\
  |  |              |               |  / |           | \
  |  |              |               | /  |___________|  \
  +------------------→              +--------------------→
     Roller length                    Roller length
   (Theoretically uniform)        (Edge stress concentration)
```

Logarithmic crowning compensates for this edge stress concentration.

#### 7.3.2 Relationship Between curveQ and Actual Load q

| Relationship | Stress Distribution | Description |
|--------------|---------------------|-------------|
| q = curveQ | Uniform | **Optimal state** - Crown perfectly compensates edge effect |
| q < curveQ | Higher in middle, lower at edges | Crown too large, edges may lose contact |
| q > curveQ | Higher at edges, lower in middle | Crown insufficient, edge concentration not fully eliminated |

#### 7.3.3 Engineering Application Recommendations

In practical design:

1. **If working load range is known**: curveQ is typically chosen as the most common expected load
2. **Conservative design**: curveQ can be chosen larger to ensure edges don't have excessive stress at high loads
3. **Bearing catalog**: e.g., curveQ=14100N in the example means the roller's logarithmic crown is designed for 14100N load

#### 7.3.4 One-Sentence Summary

**curveQ determines "at which load the stress distribution is most uniform"**.

### 7.4 Raceway Diameter dr1 Sign Convention

In Hertz contact theory, sign convention distinguishes convex and concave surfaces:

- **Positive curvature radius** → Convex surface (e.g., roller)
- **Negative curvature radius** → Concave surface (e.g., outer ring raceway)

Therefore, `dr1=-150.0` in INPUT_TAPER.dat means:
- This is a concave raceway (outer ring)
- Absolute diameter value is 150mm
- Curvature radius aa = 0.5 × (-150) = -75mm

Equivalent curvature radius calculation (outer ring contact m2=2):

$$r = \frac{a \cdot aa}{aa - a} = \frac{5 \times (-75)}{(-75) - 5} = \frac{-375}{-80} = 4.6875 \text{ mm}$$

---

## 8. Roller Tilt Angle Explained

### 8.1 Physical Meaning of tilt

Roller tilt angle `tilt` represents the angle between the roller axis and raceway axis (unit: degrees).

```
Roller Tilt Diagram:

                 Normal state (tilt=0)          Tilted state (tilt>0)
               ┌─────────────────┐       ┌─────────────────┐
               │     roller      │       │     roller   ╱  │
               │  ═══════════    │       │  ═══════════╱   │
               │                 │       │            ╱    │
               └─────────────────┘       └───────────╱─────┘
                                                   tilt angle
```

### 8.2 Effect of tilt on Stress Distribution

#### 8.2.1 No Tilt (tilt=0) and No Crowning

Even without tilt, due to **edge effect**, stress distribution is still non-uniform:

```
Stress distribution (tilt=0, m1=0):

Stress
  ↑        ∞           ∞      ← Edge stress theoretically infinite
  |       /|           |\
  |      / |           | \
  |     /  |___________|  \
  |    /                   \
  +-----------------------------→ Roller length
       Edge    Uniform    Edge
```

**Reason**: Boundary characteristics of influence coefficient matrix cause edge slice stress concentration.

#### 8.2.2 With Tilt (tilt>0)

Tilt causes **asymmetric** stress distribution:

```
Stress distribution (tilt>0, m1=0):

Stress
  ↑   
  |    ∞
  |   /|
  |  / |
  | /  |
  |/   |_______________        ← Large end may lose contact (stress=0)
  +----------------------------→ Roller length
   Small end      Large end
   (Load concentrated)  (Load small/none)
```

#### 8.2.3 Mathematical Analysis

In the `gaps` subroutine, gap for each slice is calculated as:

```fortran
! For straight roller (m1=0):
z = (y + rl/2.) * tilt
s(i) = dc - z
```

| Position | y | z | s(i) = dc - z |
|----------|---|---|---------------|
| Small end | -rl/2 | 0 | dc (normal contact) |
| Middle | 0 | rl/2 × tilt | dc - rl/2 × tilt |
| Large end | +rl/2 | rl × tilt | dc - rl × tilt (may lose contact) |

When `rl × tilt > dc`, the large end will separate from contact.

### 8.3 Sources of tilt

Main causes of roller tilt:

| Source | Description |
|--------|-------------|
| Shaft deflection | Shaft bends under load, causing inner ring to tilt relative to outer ring |
| Installation error | Inner/outer rings not coaxial or parallel |
| Housing deformation | Deformation due to load |
| Bearing clearance | Large clearance may cause tilt during operation |

### 8.4 How to Obtain tilt

#### 8.4.1 Method 1: Simplified Shaft Deflection Calculation (Recommended)

Based on simplified mechanics of materials model, calculate shaft deflection angle under load:

```
    F1         F2          F3
    ↓          ↓           ↓
────○──────────○───────────○────
   ▲                       ▲
  Bearing 1               Bearing 2
   (θ₁)                    (θ₂)
```

Deflection angle θ is the tilt value at that location.

Input parameters:
- Shaft geometry: diameter and length of each segment
- Bearing positions
- Load positions and magnitudes
- Material: Elastic modulus E

#### 8.4.2 Method 2: Empirical Estimation

Per ISO/TS 16281 and Harris recommendations:

| Condition | Typical tilt Range |
|-----------|-------------------|
| High precision installation | 0.5' ~ 2' (0.008° ~ 0.033°) |
| Normal installation | 2' ~ 5' (0.033° ~ 0.083°) |
| Load-induced tilt | Depends on shaft stiffness |

**Note**: 1' = 1/60°

#### 8.4.3 Method 3: Finite Element Analysis

Use ANSYS/Abaqus for complete shaft-bearing system analysis to obtain the most accurate tilt values.

### 8.5 tilt Usage in Current Code

| Module | Uses tilt |
|--------|-----------|
| C module (gl_crb_ext) | ❌ Assumes tilt=0 |
| Fortran module (taper_slice) | ✅ As input parameter |
| CRB_main.py (new version) | ❌ Does not call slice calculation |
| TAPER_FORTRAN.py (legacy) | ✅ Requires manual input |

### 8.6 tilt Position in INPUT_TAPER.dat

```
10.0      10.0      9.6       0.0       1340.859878 
0.0       2         30        2         -150.0    0.0       14100.0   
↑
tilt=0.0 (First parameter in second line, unit: degrees)
```

---

## 9. f2py Wrapper (Direct Python Call)

### 9.1 Overview

To avoid passing parameters via files, **f2py** is used to wrap Fortran code as a Python-callable module.

### 9.2 File Locations

| File | Description |
|------|-------------|
| `fortran_wrapper/taper_slice.f90` | Fortran 90 source code |
| `fortran_wrapper/_taper_slice.cpython-312-darwin.so` | Compiled Python extension |

### 9.3 Compilation Method

```bash
cd fortran_wrapper
uv run python -m numpy.f2py -c taper_slice.f90 -m _taper_slice
```

### 9.4 Python Call Example

```python
import sys
sys.path.insert(0, 'fortran_wrapper')
import _taper_slice

# Calculate slice stress
result = _taper_slice.taper_calculate(
    d1=10.0,        # Roller small-end diameter (mm)
    d2=10.0,        # Roller large-end diameter (mm)
    rl=9.6,         # Roller effective length (mm)
    alfa=0.0,       # Roller half-cone angle (deg)
    q=1340.86,      # Roller load (N) - from load distribution calculation
    tilt=0.0,       # Roller tilt angle (deg)
    m1=2,           # Crown type: 0=straight, 1=arc, 2=logarithmic
    n_slice=30,     # Number of slices
    m2=2,           # Raceway type: 0=plane, 1=inner, 2=outer
    dr1=-150.0,     # Raceway diameter (mm), negative for concave
    fai=0.0,        # Raceway half-cone angle (deg)
    curveq=14100.0  # Design load (N)
)

# Parse results
p, a, q_slice, dc, q1, qm, ierr = result

print(f"Error code: {ierr}")
print(f"Roller deflection: {dc:.6f} mm")
print(f"Slice forces (N): {[f'{x:.2f}' for x in q_slice]}")
print(f"Equilibrium load: {q1:.2f} N")
print(f"Slice stresses (MPa): {[f'{x:.0f}' for x in p]}")
```

### 9.5 Return Value Description

| Return Value | Type | Description |
|--------------|------|-------------|
| p | array(n) | Contact center stress for each slice (MPa) |
| a | array(n) | Contact half-width for each slice (mm) |
| q_slice | array(n) | Contact force for each slice (N) |
| dc | float | Roller deflection (mm) |
| q1 | float | Equilibrium load (N) |
| qm | float | Equilibrium moment (N·mm) |
| ierr | int | Error code: 0=success, 1=equation solving failed |

---

## 10. Complete Calculation Flow

### 10.1 Two-Stage Calculation

```
Stage 1: C Module (gl_crb_ext) - Load Distribution Calculation
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Input:
  - z=14 (number of rollers)
  - Fr=4450N (radial load)
  - Pd, l, r1, r2 (geometric parameters)

         ↓ Newton iteration

Output:
  {0°: 1340.86N, 25.7°: 1128.3N, 51.4°: 689.2N, ...}
  └─ Contact load for each roller


Stage 2: Fortran Module (taper_slice) - Slice Stress Calculation
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

For each loaded roller:

  Input:
    - q = 1340.86N (this roller's load)
    - Roller geometric parameters
    - n=30 (number of slices)

         ↓ Influence coefficient method iteration

  Output:
    30 slice contact stresses (MPa)
```

### 10.2 Code Example

```python
import sys
sys.path.insert(0, 'fortran_wrapper')
import gl_crb_ext
import _taper_slice

# Stage 1: Load distribution calculation
load_dist = gl_crb_ext.calculate_load_distribution(
    z=14, pd=0.041, l=9.6, fr=4450, r1=5, r2=55
)

# Stage 2: Calculate slice stress for each loaded roller
for angle, (deformation, load) in load_dist.items():
    if load > 0:  # Only calculate loaded rollers
        result = _taper_slice.taper_calculate(
            d1=10.0, d2=10.0, rl=9.6, alfa=0.0,
            q=load,  # Use this roller's actual load
            tilt=0.0, m1=2, n_slice=30, m2=2,
            dr1=-150.0, fai=0.0, curveq=14100.0
        )
        p, a, q_slice, dc, q1, qm, ierr = result
        print(f"{angle}° roller: load={load:.1f}N, max stress={max(p):.0f}MPa, slice force sum={sum(q_slice):.1f}N")
```

---

## References

### Standards and Specifications

1. ISO 281:2007 - Rolling bearings — Dynamic load ratings and rating life
2. ISO/TS 16281:2008 - Rolling bearings — Methods for calculating the modified reference rating life

### Core Theoretical Works

3. **Harris, T.A., Kotzalas, M.N.** - *Rolling Bearing Analysis*, 5th Edition, CRC Press, 2006
   - Chapter 6: Contact Stress and Deformation
   - Chapter 8: Roller Bearing Loads
   - Core reference for **Influence Coefficient Method**, detailed elastic contact analysis methods

4. **Johnson, K.L.** - *Contact Mechanics*, Cambridge University Press, 1985
   - Chapter 4: Normal Contact of Elastic Solids - Line Loading
   - Chapter 9: Rolling Contact
   - Classic work on **elastic half-space theory**, theoretical basis for TAPER_A.FOR influence coefficient matrix algorithm

5. **Lundberg, G. & Palmgren, A.** - *Dynamic Capacity of Rolling Bearings*, 1947
   - Foundational work on rolling contact fatigue life theory
   - Theoretical source for load-life exponent p=10/3 (line contact roller bearings)

### Chinese Reference

6. "Analysis, Calculation and Application of Rolling Bearings" - Deng Si'er, China Machine Press

### TAPER_A.FOR Code Source

TAPER_A.FOR source code (Version 8.0, Jun. 4, 2007) was written by **F.K. Wu**.

The program uses the **Influence Coefficient Method** based on Johnson's elastic contact mechanics theory, solving through the following steps:

1. Discretize the roller into n strips (slices)
2. Based on elastic half-space assumption, establish elastic coupling relationships between strips (influence coefficient matrix)
3. Use Gaussian elimination to solve the linear equation system
4. Iteratively converge to obtain contact stress distribution for each strip

This method is more accurate than simplified Hertz formulas and can handle:
- Edge loading
- Non-uniform stress distribution
- Different crowning types (straight, arc, logarithmic)
- Dynamic determination of contact zone
