MBSE iNsightsMBSE iNsights

· 11 min read

Tolerance Stacks in SysML v2: How Far to Take Them, and Why

Readers pushed back on a one-line tolerance stack, and they were right about real stacks. Here is an O-ring seal with six toleranced inputs, a reusable calculation block, worst-case and Monte Carlo results, and a pragmatic look at when a stack belongs in the system model at all.

This week I posted Recipe 20 from How to Model Anything in SysML v2 on LinkedIn: a bearing stack on a shaft, with the worst-case gap derived from the parts and a requirement that the gap never goes negative. The comments were better than the post. Engineers who do tolerance analysis for a living pointed out what a one-line stack leaves out, and one asked a direct question: what would a reusable calculation block look like?

This article answers that question with a bigger example, takes each objection in turn, and ends with the question underneath all of them: should a tolerance stack be in the system model at all?

The recipe, in short

Recipe 20 gives every toleranced dimension a nominal value and two deviations, keeps each dimension on the part it belongs to, and derives the gap from the parts:

attribute def Toleranced {
    attribute nominal : LengthValue;
    attribute upper : LengthValue;   // upper deviation
    attribute lower : LengthValue;   // lower deviation
    attribute max : LengthValue = nominal + upper;
    attribute min : LengthValue = nominal + lower;
}

The shaft assembly’s minGap is the shortest bore minus the longest parts, 0.15 mm, and a requirement checks it. That is a useful pattern, and it is also the simplest possible stack: four dimensions, one direction, one characteristic, and plain addition.

What the comments raised

Paraphrasing the main points, because they are the right list for anyone deciding how far to take this:

  1. Real stacks are bigger. An O-ring seal with three components needs at least five input dimensions and at least five calculated characteristics, each with a pass/fail limit. The same formulas apply to every seal, so they belong in a calculation block, not copied into each assembly.
  2. Linear is often an oversimplification. Rotational degrees of freedom are left out.
  3. With several dimensions, worst case is pessimistic. Tolerances and results should be treated as distributions, and the calculation done statistically.
  4. Most of this belongs in dedicated tolerance tools, and linking a requirement to their results is often a manual transfer.
  5. Let Model-Based Definition capture the stack, with the tolerances on the CAD model, and bring the result back into the SysML model as a margin, traced to the analysis that produced it.
  6. Just because you can doesn’t mean you should.
  7. Treat the total as a part in its own right, so the other dimensions comply with it, not the other way around.

All seven are fair. The first three are modeling questions, and the model below answers them as far as a system model reasonably can. The last four are about where the work belongs, and I’ll come back to them.

A bigger stack: a static O-ring seal

The example is an end cap sealed into a housing bore by an O-ring in a groove on the cap. Three components, six toleranced inputs:

  • the housing’s bore diameter
  • the cap’s groove root diameter, groove width and outside diameter
  • the O-ring’s cross-section and inside diameter

From those come a few intermediate values (the gland depth at its extremes and the radial play between cap and bore) and the four characteristics a seal designer checks, each at its worst case:

  • Squeeze: how much the ring’s cross-section is compressed, as a fraction of its free size.
  • Gland fill: how much of the groove the ring occupies.
  • Stretch: how far the ring is stretched onto the groove root.
  • Extrusion gap: the clearance the ring could be pushed into under pressure.

The comment asked for at least five characteristics. A fifth, such as the smaller cross-section a stretched ring ends up with, slots in the same way: one more formula and one more requirement.

The calculation block

The answer to the direct question is a calc def: a reusable calculation with inputs and one result. In SysML v1 a constraint block did double duty, holding both the formulas that compute values and the conditions they must meet. SysML v2 separates the two. A calc def computes a value. A constraint def, and every constraint, is a Boolean expression that is either true or false, which is what the requirements below use to state their limits. One calc def per formula:

calc def GlandDepth {
    in bore : LengthValue;  in grooveRoot : LengthValue;
    return : LengthValue = (bore - grooveRoot) / 2;
}
calc def Squeeze {
    in section : LengthValue;  in depth : LengthValue;
    return : Real = (section - depth) / section;
}
calc def GlandFill {
    in section : LengthValue;  in depth : LengthValue;  in width : LengthValue;
    return : Real = 0.7854 * section * section / (depth * width);   // pi/4
}
calc def Stretch {
    in grooveRoot : LengthValue;  in ringBore : LengthValue;
    return : Real = (grooveRoot - ringBore) / ringBore;
}

The formulas are invoked from one part definition, SealedJoint, which says which worst case each characteristic takes:

part def SealedJoint {
    doc /* A static radial O-ring seal: a bore, a grooved cap, a ring. */
    part housing { attribute bore : Toleranced; }
    part cap {
        attribute grooveRoot : Toleranced;
        attribute grooveWidth : Toleranced;
        attribute outside : Toleranced;
    }
    part oRing {
        attribute section : Toleranced;
        attribute insideDia : Toleranced;
    }
    attribute depthMin : LengthValue = GlandDepth(housing.bore.min, cap.grooveRoot.max);
    attribute depthMax : LengthValue = GlandDepth(housing.bore.max, cap.grooveRoot.min);
    attribute playMax : LengthValue = (housing.bore.max - cap.outside.min) / 2;
    // cap pushed fully to one side: the far gland is deeper by the play,
    // the near gland shallower; at the near side the bore cancels out
    attribute depthNearMin : LengthValue = GlandDepth(cap.outside.min, cap.grooveRoot.max);
    attribute squeezeMin : Real = Squeeze(oRing.section.min, depthMax + playMax);
    attribute squeezeMax : Real = Squeeze(oRing.section.max, depthNearMin);
    attribute fillMax : Real = GlandFill(oRing.section.max, depthMin, cap.grooveWidth.min);
    attribute stretchMin : Real = Stretch(cap.grooveRoot.min, oRing.insideDia.max);
    attribute stretchMax : Real = Stretch(cap.grooveRoot.max, oRing.insideDia.min);
    attribute gapMax : LengthValue = 2 * playMax;   // extrusion gap, far side
}

My usual rule is to start with usages and write a definition only when reuse is discovered or known. Here it is known: every O-ring gland in a product takes the same four formulas, so SealedJoint and the calc defs earn their place on the first seal.

Picking each worst case by hand is valid here because each characteristic moves in one direction with each input. Squeeze, for example, is smallest with the thinnest ring in the deepest gland. A characteristic that rises and then falls with an input would need its extremes searched, which is a job for a tolerance tool.

A SysML v2 general view. The part definition SealedJoint has a parts compartment listing housing, cap and oRing, and an attributes compartment listing depthMin, depthMax, playMax, depthNearMin, squeezeMin, squeezeMax, fillMax, stretchMin, stretchMax and gapMax with their types. Beside it are four calc definitions, GlandDepth, Squeeze, GlandFill and Stretch, each with a parameters compartment of in parameters and a result compartment holding its formula.
The calculation block. SealedJoint names the three components and the derived worst-case values; each calc def holds one formula, with its parameters and its result expression.

One seal, with its numbers

A particular seal is a usage of SealedJoint that states the six toleranced inputs. These values are illustrative, chosen to be realistic for a 50 mm bore and a 3.53 mm cross-section ring:

part endCapJoint : SealedJoint {
    part :>> housing { attribute :>> bore {
        :>> nominal = 50.00 [mm];  :>> upper = 0.05 [mm];  :>> lower = 0 [mm]; } }
    part :>> cap {
        attribute :>> grooveRoot {
            :>> nominal = 44.50 [mm];  :>> upper = 0 [mm];  :>> lower = -0.05 [mm]; }
        attribute :>> grooveWidth {
            :>> nominal = 4.70 [mm];  :>> upper = 0.10 [mm];  :>> lower = 0 [mm]; }
        attribute :>> outside {
            :>> nominal = 49.90 [mm];  :>> upper = 0 [mm];  :>> lower = -0.05 [mm]; }
    }
    part :>> oRing {
        attribute :>> section {
            :>> nominal = 3.53 [mm];  :>> upper = 0.10 [mm];  :>> lower = -0.10 [mm]; }
        attribute :>> insideDia {
            :>> nominal = 43.70 [mm];  :>> upper = 0.40 [mm];  :>> lower = -0.40 [mm]; }
    }
    attribute squeezeCpk : Real = squeezeStudy.squeezeCpk;   // from SEAL-A01
}

Each characteristic gets its own requirement, so each passes or fails on its own. The limits are example values; take yours from your seal supplier’s design guide for your material, hardness, pressure and the fluid’s swell, which is why many guides set the gland fill limit lower than 85%:

requirement <'SEAL-R01'> squeezeInRange {
    subject j :> endCapJoint;
    require constraint { j.squeezeMin >= 0.10 and j.squeezeMax <= 0.30 }
}
requirement <'SEAL-R02'> glandNotOverfilled {
    subject j :> endCapJoint;
    require constraint { j.fillMax <= 0.85 }
}
requirement <'SEAL-R03'> ringStaysSeated {
    subject j :> endCapJoint;
    require constraint { j.stretchMin > 0 and j.stretchMax <= 0.05 }
}
requirement <'SEAL-R04'> noExtrusion {
    subject j :> endCapJoint;
    require constraint { j.gapMax <= 0.25 [mm] }
}

At worst case, everything passes:

CharacteristicWorst caseExample limit
Squeeze, smallest (cap pushed to one side)15.5%at least 10%
Squeeze, largest (cap pushed to one side)26.3%at most 30%
Gland fill, largest80.1%at most 85%
Stretch, smallest0.8%above 0%
Stretch, largest2.8%at most 5%
Extrusion gap, largest (cap pushed to one side)0.20 mmat most 0.25 mm

The model is deliberately simplified in one place: supplier guides also reduce the cross-section slightly when the ring is stretched. That is one more input to Squeeze when you need it.

Checked by the reasoner

I didn’t take those numbers from a spreadsheet. I ran the model through the SysML v2 Semantic Reasoner (SSR 1.26.2), which reasons over the whole model as the single source of truth. It evaluates every calc def from the stated tolerances, through the definition, the redefinitions and the nested Toleranced values, and checks each requirement against the result. All five come back satisfied, with the same values as the table.

The more useful test is a failing one. Loosen the bore’s upper deviation from 0.05 mm to 0.30 mm, and the reasoner reports two broken claims, each with the value it computed and the formula that produced it:

endCapJoint is claimed to satisfy squeezeInRange, but does not
  j.squeezeMin = 0.0816327 (= ORingSeal::Squeeze(oRing.section.min, (depthMax + playMax)))
endCapJoint is claimed to satisfy noExtrusion, but does not
  j.gapMax = 0.45 mm (= (2 * playMax))

The extrusion gap was the expected failure. The squeeze was not: the larger bore deepens the far-side gland until the ring is squeezed only 8.2%. That is the point of keeping the stack in a model that can answer for itself. Change one tolerance, and every characteristic that depends on it is rechecked, including the ones nobody thought to look at.

Beyond one dimension

The objection that linear stacks leave out rotation is right, and a 1D model cannot fix it. What it can do is include the positional effects that are still one-dimensional. In this seal, the cap is not held centered: it can sit anywhere within its radial play. Pushed to one side, the gland on the far side gets deeper by the play and the gland on the near side gets shallower by the same amount, and the gap on the far side is the full diametral clearance. That is why the smallest squeeze uses depthMax + playMax, the largest squeeze uses the near-side depth (where the bore cancels out, leaving the cap’s outside diameter and its groove root), and the largest gap is twice the play. Centered, the model would report 18.4% to 24.2% squeeze and a 0.10 mm largest gap, all three optimistic.

Gland fill is the exception. It compares the ring’s cross-section with the groove’s, around the whole circumference, and moving the cap sideways doesn’t change the area of the annulus between the bore and the groove root. So fill is checked centered.

Tilt is another matter. If the cap can cock in the bore, the gland depth varies around the circumference, and that is 3D geometry with form and orientation tolerances. A 3D tolerance analysis tool is the right place for it. The system model’s job is to hold the result, which is the next point.

Distributions, not just limits

Worst case assumes every dimension sits at its worst limit at once. With six inputs, that is pessimistic, and treating dimensions as distributions gives a more realistic answer.

For Recipe 20’s bearing stack, the simplest statistical method, root sum of squares, puts the gap’s three-sigma lower bound at 0.26 mm against 0.15 mm worst case. It starts from each dimension’s mean (the bearings’ one-sided tolerance shifts theirs) and assumes each process is centered on that mean, independent and normal, with three standard deviations equal to half the tolerance.

For the seal, the characteristics are not simple sums, so I ran a Monte Carlo: one million builds, each dimension normal about the middle of its limits with a standard deviation of one sixth of the tolerance, cut off at the drawing limits (out-of-tolerance parts are rejected at inspection), and the cap resting against one side, as it would on a horizontal axis. Squeeze is checked at both sides: the far side against the 10% floor, the near side against the 30% ceiling. The far side averaged 19.3% and the near side 23.5%, and the process capability index (Cpk) came out at 2.96, the lower of the two sides.

Two cautions. A standard deviation of one sixth of the tolerance assumes every input process has a Cpk of about 1.0; that is an assumption, not measured data, and real capability needs real measurements. And because every input is cut off at its limits and the worst case already passes, no build can fail here. The statistics pay off when worst case fails. Double the machined tolerances on the bore, the groove root and the cap’s outside diameter, and worst case flags the extrusion gap at 0.30 mm against the 0.25 mm limit. The same Monte Carlo says 1.5% of builds would exceed it. Whether 1.5% is acceptable, or worth a backup ring, is an engineering call. The worst case says no and stops there; the statistics give you the number to decide with.

That run did not happen in SysML, and it shouldn’t. But its result belongs in the model, attached to the joint it describes, with the requirement it answers:

analysis <'SEAL-A01'> squeezeStudy {
    doc /* Monte Carlo of 1,000,000 builds, run in a separate tool. Each
           dimension is normal about its mid-limit with sigma = tolerance / 6,
           cut off at the drawing limits; the cap rests against one side.
           Squeeze checked at both sides; Cpk is the lower of the two. */
    subject j :> endCapJoint;
    return attribute squeezeCpk : Real = 2.96;   // the tool's result
}
requirement <'SEAL-R05'> squeezeCapable {
    subject j :> endCapJoint;
    require constraint { j.squeezeCpk >= 1.33 }
}

This is the pattern two of the comments described: the dedicated tool does the calculation, and the model holds the result as a value with its provenance, traced to the requirement. A margin is one subtraction away: the worst-case squeeze is 3.7 points inside its ceiling and 5.5 above its floor. The analysis case records how the number was produced, the joint carries it, and SEAL-R05 checks it against a capability target. A Cpk of 1.33 is a common minimum.

A SysML v2 general view. The part usage endCapJoint, defined by the part definition SealedJoint, has an attribute squeezeCpk equal to squeezeStudy.squeezeCpk. Five satisfy edges run from it to the requirements SEAL-R01 squeezeInRange, SEAL-R02 glandNotOverfilled, SEAL-R03 ringStaysSeated, SEAL-R04 noExtrusion and SEAL-R05 squeezeCapable, each showing its require constraint. Below endCapJoint, the analysis SEAL-A01 squeezeStudy has subject j subsetting endCapJoint and a result of 2.96.
The seal in the system model. endCapJoint is defined by SealedJoint and satisfies five requirements, one per characteristic plus a capability requirement on the Monte Carlo result recorded by the analysis SEAL-A01.

The manual transfer is a real cost today. It can be scripted, though: SysML v2 has a standard API (the Systems Modeling API and Services), so where the model lives in a repository that implements it, a tolerance tool’s export can update the analysis result instead of someone retyping it.

Should a stack be in the system model at all?

No, not as a rule. Most stacks belong in detailed design, in CAD and a tolerance tool, owned by the mechanical engineer who owns the geometry. If a stack lives inside one part, or one designer’s assembly, and no system requirement depends on it, putting it in the architecture model adds a copy to keep in sync and nothing else. The comment about doing it just because you can is the right default.

It can be useful, though, in a few situations:

  • The stack crosses an ownership boundary. Here the housing, the cap and the O-ring could come from three different teams or suppliers. Each sees only its own drawing. The architecture model is where interfaces between owners already live, and a stack is an interface agreement in numbers.
  • A system requirement depends on it. The seal exists because of a sealing requirement, perhaps an ingress protection rating or a pressure hold. With the stack in the model, the line from that requirement to the six toleranced dimensions is explicit, and so is the evidence that each characteristic passes.
  • You want change impact for free. When a supplier offers a cheaper ring with a looser cross-section tolerance, the question is which requirements that touches. A model with the stack in it answers that in the design review instead of after the parts arrive.
  • The budget comes before the geometry. Early in a program there is no CAD, but there is a gap, a squeeze range or a clearance that the system needs. Treating that total as a budget, the way one comment suggested, and allocating tolerances to the parts from it is architecture work. Detailed design then designs to the allocation.
  • The same stack repeats. A product with a dozen sealed joints uses one SealedJoint and a dozen sets of numbers, and every joint is checked the same way.

The pragmatic split is the one the comments pointed at. The system model holds the budget, the interface dimensions, the characteristics that system requirements depend on, and the verdict. The tolerance tool does the heavy statistics and the 3D geometry, and hands back a result the model can trace. Neither has to do the other’s job.

Recipe 20 and the other 74 recipes are in How to Model Anything in SysML v2. Thanks to everyone who commented on the post. This article is better because of you.

Get the next article by email

One email when a new article goes live, usually Thursday morning. SysML v2 and MBSE practice, no filler. Unsubscribe with one click.

More of this, on video

Walkthroughs in SysML v2 and MBSE tooling, with the model on screen.

Subscribe on YouTube