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 --verbose ⚙ 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 Capability: Cp=1.33, Cpk=1.33 Yield: 99.99% Sensitivity Analysis (% variance contribution): Housing Depth: 45.2% Cover Height: 32.1% Gasket: 22.7% Monte Carlo (50000 iterations): Mean: 0.0501 Std Dev: 0.0061 Range: 0.027 to 0.074 95% CI: 0.038 to 0.062 Performance: Pp=1.31, Ppk=1.30 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
3D SDT Analysis
TDT supports full 3D tolerance analysis using Small Displacement Torsor (SDT) theory. Propagate 6-DOF geometric deviations through kinematic chains with Jacobian matrices. Integrates with ASME Y14.5 GD&T controls for familiar datum-based analysis.
6-DOF Torsors
3 translations (u, v, w) + 3 rotations (α, β, γ) per feature
Jacobian Propagation
Transform deviations through kinematic chains with 6×6 matrices
Geometry Classes
Plane, Cylinder, Sphere, Cone - each with DOF constraints
Braille Visualization
Terminal-based chain schematics and deviation ellipses
# Run 3D torsor-based analysis $ tdt tol analyze TOL@1 --3d ⚙ Running 3D SDT analysis for stackup TOL@1... ✓ 3D Analysis complete Result Torsor (6-DOF): Translation: u=±0.15 v=±0.12 w=±0.08 mm Rotation: α=±0.002 β=±0.001 γ=±0.003 rad Sensitivity by DOF: Housing Bore: u=45% v=38% Shaft OD: u=32% v=28% Bearing Race: u=23% v=34% # 3D analysis with visualization $ tdt tol analyze TOL@1 --3d --visualize Chain Schematic: ┌────┐ ┌────┐ ┌────┐ │CMP1│──||───│CMP2│──||───│CMP3│ → Functional └────┘ └────┘ └────┘ Direction
| Geometry Class | Description | Constrained DOF |
|---|---|---|
| Plane | Flat surface (datum A typical) | w, α, β |
| Cylinder | Holes, shafts, pins | u, v, α, β |
| Sphere | Ball features | u, v, w |
| Cone | Tapered features | u, v, α, β |
GD&T Integration (ASME Y14.5)
TDT's 3D analysis integrates seamlessly with ASME Y14.5 GD&T controls. Define features with standard callouts - position, perpendicularity, parallelism - and TDT automatically converts them to torsor bounds for chain analysis. Supports MMC/LMC bonus tolerance calculation.
Position
Document true position tolerance with material modifiers
Concentricity
Document coaxiality requirements
Cylindricity
Document form tolerance for cylindrical features
Parallelism
Document parallelism requirements to datum
Perpendicularity
Document perpendicularity requirements to datum
Runout
Document runout requirements 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 # Verbose output (shows Cp, Cpk, Pp, Ppk, sensitivity) tdt tol analyze TOL@1 --verbose # Include GD&T position tolerances in calculations tdt tol analyze TOL@1 --with-gdt # Custom sigma level (4σ = more conservative) tdt tol analyze TOL@1 --sigma 4.0 # Mean shift factor (Bender method for process drift) tdt tol analyze TOL@1 --mean-shift 1.5 # Export for external analysis tdt tol analyze TOL@1 --csv > tolerance_data.csv # 3D SDT analysis (requires features with geometry_3d) tdt tol analyze TOL@1 --3d # 3D analysis with braille visualization tdt tol analyze TOL@1 --3d --visualize # 3D Monte Carlo simulation tdt tol analyze TOL@1 --3d --method-3d monte-carlo # List all stackups with results tdt tol list # Show stackup details tdt tol show TOL@1