Statistical Tolerance Stackups
Analyze tolerance chains with worst-case, RSS, and Monte Carlo methods. Visualize distributions, calculate Cpk, and export data for deeper analysis.
Tolerance Workflow
TDT models tolerances using three entity types. Features define dimensions on components. Both Mates and Stackups use features for different analyses: Mates calculate fit between two mating features, while Stackups analyze cumulative tolerance chains.
# Create features on components $ tdt feat new --title "Housing Bore" -c CMP@1 -t internal ✓ Created feature FEAT@1 $ tdt feat new --title "Shaft OD" -c CMP@2 -t external ✓ Created feature FEAT@2 # Create a stackup and add contributors $ tdt tol new --title "Bearing Clearance" --target-nominal 0.05 \ --target-upper 0.10 --target-lower 0.02 ✓ Created stackup TOL@1 $ tdt tol add TOL@1 +FEAT@1 ~FEAT@2 ✓ Added 2 contributors to stackup TOL@1
Analysis Methods
TDT calculates three different analyses, each providing unique insights into your tolerance chain's behavior.
| Method | Description | Best For |
|---|---|---|
| Worst-Case | All dimensions at their extreme limits simultaneously. Most conservative. | Safety-critical, 100% yield requirement |
| RSS (Root Sum Square) | Statistical combination assuming normal distributions. Calculates Cpk. | Production planning, capability analysis |
| Monte Carlo | 10,000+ random samples from actual distributions. Most realistic. | Complex chains, non-normal distributions |
$ tdt tol analyze TOL@1 --iterations 50000 ⚙ Analyzing stackup TOL@1 with 3 contributors... ✓ Analysis complete for stackup TOL@1 Target: Clearance = 0.05 (LSL: 0.02, USL: 0.10) Worst-Case Analysis: Range: 0.01 to 0.09 Margin: 0.01 Result: pass RSS (Statistical) Analysis: Mean: 0.05 ±3σ: 0.018 Margin: 0.012 Cpk: 1.33 Yield: 99.99% Monte Carlo (50000 iterations): Mean: 0.0501 Std Dev: 0.0061 Range: 0.027 to 0.074 95% CI: 0.038 to 0.062 Yield: 99.87%
Distribution Visualization
The --histogram flag displays an ASCII histogram showing the
Monte Carlo distribution with spec limits marked. In-spec samples appear
in green, out-of-spec in red.
Distribution Histogram (10000 samples, 20 bins): 0.425 │░░ │ 67 0.445 │░░░░░░░░ │ 278 0.465 │░░░░░░░░░░░░░░░░░░░░ │ 722 ◄LSL 0.485 │██████████████████████████████████████ │ 1347 0.505 │██████████████████████████████████████████████████│ 1823 0.525 │█████████████████████████████████████ │ 1318 ◄USL 0.545 │░░░░░░░░░░░░░░░░░░░░░░ │ 785 0.565 │░░░░░░░░░░ │ 342 0.585 │░░░ │ 112 └──────────────────────────────────────────────────┘ Legend: LSL=0.480 USL=0.520 (█ in-spec, ░ out-of-spec)
--bins N
CSV Export for External Analysis
Export raw Monte Carlo samples to CSV for analysis in Excel, Python, R, or any statistical tool. Perfect for custom visualizations or deeper analysis.
# Export Monte Carlo samples $ tdt tol analyze TOL@1 --csv > samples.csv $ head -10 samples.csv sample,value,in_spec 1,0.515109,1 2,0.473383,1 3,0.506680,1 4,0.530796,0 5,0.498786,1 6,0.471828,0 7,0.525510,0 8,0.501505,1 9,0.487642,1 # Import into Python for custom analysis $ python3 -c " import pandas as pd df = pd.read_csv('samples.csv') print(f'Yield: {df.in_spec.mean()*100:.2f}%') print(f'Mean: {df.value.mean():.4f}') print(f'Std: {df.value.std():.4f}') " Yield: 66.99% Mean: 0.5002 Std: 0.0207
GD&T Support
Features support full GD&T (Geometric Dimensioning and Tolerancing) with all standard symbols and material modifiers.
Position
True position tolerance with MMC/LMC bonus tolerance calculation
Concentricity
Coaxiality control for features of size
Cylindricity
Combined roundness and straightness for cylindrical features
Parallelism
Surface or axis parallelism to datum
Perpendicularity
Surface or axis perpendicularity to datum
Runout
Circular and total runout for rotating parts
Quick Reference
# Create stackup tdt tol new --title "Gap Analysis" --target-nominal 0.5 \ --target-upper 0.8 --target-lower 0.2 # Add features (+ positive, ~ negative direction) tdt tol add TOL@1 +FEAT@1 +FEAT@2 ~FEAT@3 # Run analysis with histogram tdt tol analyze TOL@1 --histogram --bins 30 # Run with more iterations for better accuracy tdt tol analyze TOL@1 --iterations 100000 # Export for external analysis tdt tol analyze TOL@1 --csv > tolerance_data.csv # List all stackups with results tdt tol list # Show stackup details tdt tol show TOL@1