baratilab/mechanical-engineering-skills

tolerance-stackup

Runs 1-D tolerance stack-ups (worst-case, RSS, Monte Carlo) on a dimension chain, ranks contributors, and estimates reject rate against a gap spec.

ソースを見る

使い方

  1. インストールコマンドをコピーし、自分の環境へ導入する前にソースを確認します。
  2. 必要なツール、認証情報、対応環境を原文で確認します。
  3. 入力と成果物を指定し、出力を資料と照合します。
npx skills add https://github.com/baratilab/mechanical-engineering-skills --skill tolerance-stackup

開始前の確認

  • 導入にはモデル契約、API枠、ファイルへのアクセス許可は含まれません。
  • スター数や導入数は活動の指標であり、独立した品質・安全性試験ではありません。
リポジトリの原文

見出し、例、コード、表、リンク、参照画像を含む原文を表示しています。

Tolerance Stack-up

Workflow

  1. Define the gap. Name the gap being studied and its spec (LSL / USL). Draw the loop in text:

Housing face → bore bottom (+) → bearing (−) → spacer (−) → gear hub (−) → gap.

  1. Build the chain CSV (scripts/example_chain.csv shows the format). Rules:
  • Go around the loop in one direction; dimensions pointing the "positive" way are +1, the rest -1.
  • Enter unequal tolerances as plus/minus (both positive numbers). The script handles mean shift.
  • dist: normal for controlled processes (set cpk), uniform for unknown processes or purchased parts with no data.
  • Convert GD&T to ± equivalents first: position Ø0.2 → ±0.1 radial; flatness/parallelism add as their own rows.
  1. Run:
bash
   python scripts/stackup.py chain.csv --lsl 0.10 --usl 0.60 --out stack
  1. Interpret
  • Worst-case OK → done; tolerances can be loosened.
  • Worst-case fails but RSS / MC passes → acceptable for high volume if the processes really are in control; state the predicted ppm.
  • MC reject > 2700 ppm (beyond ±3σ) → redesign: tighten the top 1–2 contributors only, or add an adjustment (shim, slotted hole).
  1. Recommend tolerance reallocation: tighten the contributors with the largest pct_rss first; loosen the ones under 5%.

Output format

  • Loop diagram (text) and the chain table
  • Results table: Nominal | Worst-case min/max | RSS min/max | MC ±3σ | Reject ppm
  • Contributor chart (stack_contrib.png) and histogram (stack_hist.png)
  • 2–3 concrete recommendations

Limits

1-D linear stacks only. For 2-D/3-D stacks (angular errors, chains with rotation), linearize with sensitivity coefficients: enter direction as the partial derivative ∂gap/∂xᵢ instead of ±1, and say so in the report.

同じリポジトリから

関連する Skills

すべての Skills