Example: Stator Whine of an Inverter Driven Motor#
A 10 kW permanent magnet machine drives a compressor at up to 10 125 rpm, and the prototype whines. The second order force wave of the field presses the stator into an oval at twice the electrical frequency, 1350 Hz at rated speed, and the oval mode of the stator sits right there. The clamp pressure of the laminated stack varies between production units, so the resonance is a random variable. The model answers three questions of the acoustic engineer:
With which probability does the force order cross the oval resonance inside the dwell band of the variable speed drive?
How fast do the teeth move at rated speed, in expectation and in the tail?
How much clamp stiffness must a redesign add so that 99 percent of production stays out of the dwell band?
Left: the stator ring with its twelve teeth, deformed into the oval mode and coloured from inward (blue) to outward (red). The orange strokes are the radial force on every tooth, the dashed orange curve the standing force wave and the green blocks the four mounting bolts. Right: the response of a tooth by exact modal superposition. The oval pair at 1343.6 and 1349.3 Hz sits under the force order at 1350 Hz, inside the dwell band of the drive.
The ring is solved by eigensystem() with exact mode
based gradients, the response comes from
modal_superposition(), the modes are followed across
the tolerance by track_modes() (all three on the
Modal Dynamics page), and the clamp is redesigned by gradient descent through
the eigensystem and the Monte Carlo samples. The exact volume moments of
Uncertain Geometry give the mass of the cast bracket that carries
the machine. The full runnable source is examples/stator_whine/model.py.
Every array in it, from the tooth angles to the force wave, is
jax.numpy inside the graph, so the ring assembly itself is traced and
differentiable.
Step 1: The stator ring and its oval pair#
The stiffness of the ring is the periodic second difference (the beam bending inside the stack) plus the mounting spring of each tooth, modulated by the four mounting bolts at order four. The bolts lift the gauge freedom of the oval pair, splitting it into two standing waves 6 Hz apart:
N_TEETH, R_PITCH, TOOTH_MASS = 12, 0.09, 0.35
K_STACK, K_MOUNT, BOLT_ECC, ZETA = 2.4e7, 1.05e6, 0.2, 0.05
THETA = jnp.arange(N_TEETH) * 2 * jnp.pi / N_TEETH
_eye = jnp.eye(N_TEETH) # the periodic second difference: the beam in the ring
_diff = jnp.roll(_eye, 1, axis=1) + jnp.roll(_eye, -1, axis=1) - 2.0 * _eye
K0 = K_STACK * (_diff.T @ _diff) + jnp.diag(K_MOUNT * (1.0 + BOLT_ECC * jnp.cos(4 * THETA)))
M0 = TOOTH_MASS * jnp.eye(N_TEETH)
W_NOM, Q_NOM = physics.eigensystem(K0, M0) # exact eigenpairs, exact gradients
F_NOM = jnp.asarray(physics.natural_frequencies(K0, M0).evaluate()) / (2 * jnp.pi) # [Hz]
The periodic difference operator is two shifts of the identity that wrap around the ring, so the whole assembly is one traced expression: the eigen solver sees the stiffness as a graph node, and the gradients of the calibration and of the clamp design flow through it into the tolerance and the stiffness scale. The mode shapes it returns are drawn as the oblique scenes of the figure below.
Left: the bending mode at 448 Hz, one nodal diameter, an exactly repeated pair whose orientation is free. Right: the oval mode at 1343.6 Hz, two nodal diameters, the shape the force wave (dashed orange) presses the ring into. The ring is the laminated stack with its twelve tooth stubs and the four mounting bolts (green) on the top face. The dashed circle is the undeformed pitch circle, and the amplitude is exaggerated.
Step 2: The excitation and the dwell band#
With four pole pairs at 10 125 rpm the fundamental field runs at 675 Hz electrical, so the second order force wave presses at 1350 Hz, exactly where the prototype’s oval pair sits. The drive dwells between 95 and 105 percent of rated speed, which spans 1282 to 1418 Hz of the force order:
POLE_PAIRS, RATED_RPM, FORCE_AMP = 4, 10125.0, 3.0
F_ELECTRIC = POLE_PAIRS * RATED_RPM / 60.0 # 675 Hz
F_FORCE = 2 * F_ELECTRIC # 1350 Hz, the second order force
OMEGA_RATE = 2 * jnp.pi * F_FORCE
FORCE = FORCE_AMP * jnp.cos(2 * THETA) # standing second order wave [N]
DWELL = (0.95 * F_FORCE, 1.05 * F_FORCE) # the drive dwells between 95 and 105 percent
CROSS_TARGET = 0.01 # at most one percent of units at risk
Step 3: The clamp tolerance as a random variable#
The clamp pressure of the stack varies between production units, which multiplies the stack bending stiffness by a lognormal tolerance. Because the eigensystem broadcasts one leading batch dimension, the whole production spread is one native call, and the oval frequency is an expression over the tolerance sample axis:
clamp_scale = prp.Param("clamp_scale", init=1.5, bounds=(1.0, 4.0)) # the redesign only adds clamp
mu_tol = prp.Param("mu_tol", init=0.0) # mean of the log clamp tolerance
sigma_tol = prp.Param("sigma_tol", init=0.12, transform="softplus") # spread of the tolerance
tolerance = prp.RandomVariable("clamp", prp.LogNormal(mu=mu_tol, sigma=sigma_tol))
scale = clamp_scale * tolerance # carries the sample axis
stiffness = op("ring_stiffness", lambda s: s[..., None, None] * K0, scale)
eigenvalues, modes = physics.eigensystem(stiffness, M0)
omega_oval = physics.natural_frequencies(stiffness, M0)[..., OVAL] # lower oval mode [rad/s]
f_oval = op("oval_hz", lambda w: w / (2 * jnp.pi), omega_oval) # [Hz]
Step 4: The model: a tap test, the crossing, the whine#
Three uncertain attributes capture the questions of the acoustic engineer. Production line tap tests measure the oval frequency with an instrument noise, the crossing of the dwell band is a Bernoulli whose probability is a hard indicator over the sample axis, and the tooth velocity at rated speed comes from the exact modal superposition:
oval_frequency = prp.UncertainAttribute(
"oval_frequency", prp.Gaussian(mean=f_oval, sigma=tap_noise), unit="Hz",
domain="oval mode natural frequency measured by a production tap test",
)
crossing = prp.UncertainAttribute(
"resonance_crossing",
prp.Bernoulli(prob=op("dwell_crossing", lambda f: ((f >= DWELL[0]) & (f <= DWELL[1])).astype(jnp.float32), f_oval)),
domain="the oval resonance is crossed inside the dwell band of the drive",
)
response = physics.modal_superposition(stiffness, M0, FORCE, OMEGA_RATE, ZETA)
velocity = op("tooth_velocity", lambda x: OMEGA_RATE * jnp.abs(x[..., 0]), response) # [m/s]
whine_velocity = prp.UncertainAttribute(
"whine_velocity", prp.Gaussian(mean=velocity, sigma=1e-9), unit="m/s",
domain="radial tooth velocity at rated speed under the second order force",
)
model = prp.ProbabilityModel(oval_frequency, crossing, whine_velocity)
Step 5: Calibration to production tap tests#
Forty eight production stators went through the tap test. The tap noise of
the instrument is known and the prototype clamp is the as built state, so only
the tolerance is fitted, by maximum likelihood through the eigensystem, with
parameter_uncertainty() giving the standard error of
the fit:
cal = prp.calibrate(
compiled, "oval_frequency", records, trainable=["mu_tol", "sigma_tol"],
init_params={"clamp_scale": raw(clamp_scale, AS_BUILT)}, n_steps=800, learning_rate=0.03,
)
unc = prp.parameter_uncertainty(
compiled, {"oval_frequency": records}, result=cal, trainable=["mu_tol", "sigma_tol"]
)
Left: the 48 production tap tests (histogram) against the predictive distribution of the calibrated model (curve), which marginalizes over the clamp tolerance and the tap noise. The dwell band of the drive is shaded. Right: the calibration converges in a few hundred steps to a log stiffness tolerance of 0.116 with a standard error of 0.003, an offset of 0.028 and a tap noise of 4.0 Hz.
Step 6: Resonance crossing and whine at rated speed#
With the tolerance calibrated, the compiled model answers the as built questions directly. The crossing probability is the expectation of the Bernoulli attribute with its Monte Carlo standard error, the whine velocity is sampled over the same tolerance, and its tail is summarized by the conditional value at risk:
est = compiled.assess("resonance_crossing", params=params) # P + standard error
v_draws = jnp.asarray(compiled.sample("whine_velocity", key, (4096,), params=params))
q05, q50, q95 = [float(q) for q in jnp.percentile(v_draws, jnp.asarray([5.0, 50.0, 95.0]))]
compiled.cvar("whine_velocity", 0.95, params=params) # the noisy tail
Left: the oval frequency across production, as built (blue) and with the redesigned clamp (green), against the shaded dwell band. The crossing probability falls from 0.613 to 0.002. Right: the crossing probability assessed by the compiled model over a range of clamp stiffness scales, with the as built prototype and the gradient based design marked. The tooth velocity at rated speed falls with it, from a median of 7.85 to 1.80 mm/s.
The same response over the whole speed sweep is the resonance surface below: the tooth velocity at the force order, over the shaft speed of the drive and the clamp stiffness scale, one batched modal superposition over 31 stiffness scales and 161 speeds.
The tooth velocity at the force order over the speed of the drive and the clamp stiffness scale, in dB relative to 1 mm/s. The force order sweeps 533 to 1600 Hz with the speed. The orange line on the surface is the oval resonance, which moves to higher speed as the clamp stiffens. As built it passes through the dwell band (translucent walls) at rated speed, while the redesign at a scale of 1.50 sits clear of it.
Step 7: Mode tracking across the tolerance#
Across the production spread, modes reorder, so mode three of one stator is
not mode three of the next. track_modes() matches the
modes of every tolerance draw to the prototype by the modal assurance
criterion:
draws = clamp_draws(32, seed=3, mu=mu_fit, sigma=sigma_fit)
env = {"clamp": draws, "clamp_scale": raw(clamp_scale, 1.0)}
modes_drawn = jnp.asarray(modes.evaluate(env)) # [32, 12, 12], one native call
indices, macs = physics.track_modes(Q_NOM, modes_drawn)
The lowest MAC of every reference mode over 32 tolerance draws, each bar labelled with the frequency of the prototype mode. The oval pair (green) stays tracked with a MAC of one, because the four bolts fix the orientation of its two standing waves. The other pairs have identical frequencies on this symmetric mount, so their shapes are free to rotate inside the pair, and the MAC reports that honestly with values between 0.5 and 0.65.
Step 8: The cast bracket, with exact volume moments#
The machine sits in a cast aluminium bracket whose outer surfaces carry a casting tolerance: every surface point wanders around its nominal position, and one shared die wear draw breathes the whole casting along the rays from its centroid. The exact mean and variance of the volume follow from the Isserlis pairings of the vertex covariance (see Uncertain Geometry for the precise scope of the exactness claim), and the mass distribution is the volume times the density:
exact = solid_volume_moments(bracket["vertices"], bracket["faces"], bracket["covariance"])
check = montecarlo_solid_volume(bracket["vertices"], bracket["faces"], bracket["covariance"],
n_samples=8192, seed=1)
inertia = jnp.asarray(bracket["solid"].inertia().evaluate()) * bracket["density"]
Left: the mean casting (shaded) with fourteen drawn casts (orange) and the one sigma ellipsoid of every visible corner (green), the tolerance drawn 25 times larger than it is. Right: the volumes of 8192 Monte Carlo casts against the exact mean and the exact one sigma band. The Monte Carlo mean sits 0.06 percent from the exact mean with a standard error of 0.007 percent, and the mass at 2700 kg/m3 is 1.555 kg with a standard deviation of 9.9 g.
Step 9: Designing the clamp by gradient descent#
The redesign question is an optimization: the lightest clamp that keeps at most one percent of production inside the dwell band. The objective is the clamp stiffness scale (its cost), and the constraint is the crossing probability over 256 common tolerance draws, whose gradient flows through the danger margin, the oval frequency, the eigensystem and the samples:
margin = op("crossing_margin", lambda f: (f - DWELL[1]) / 30.0, f_oval) # smooth, positive when clear
danger = 1.0 / (1.0 + prp.exp(margin))
objective = clamp_scale * 1.0 # clamp cost grows with the scale
constraint = prp.log(prp.mean(danger)) - float(jnp.log(CROSS_TARGET))
result = prp.optimize(
objective, wrt=[clamp_scale], constraints=[constraint], penalty_weight=200.0,
n_steps=400, learning_rate=0.05, extra_env={"clamp": design_draws},
)
The optimizer lands on a scale of 1.50 without a grid search, which lifts the oval pair to 1644 Hz, clear of the dwell band, and the compiled model confirms the crossing probability of the design.
Results#
=== Stator ring as built ===
oval pair: 1343.6 and 1349.3 Hz, force order at 1350 Hz
dwell band of the drive: 1282 to 1418 Hz
=== Calibration to production tap tests ===
records: 48 stators, mean 1366 Hz, sd 81 Hz
clamp tolerance: sigma = 0.116 +/- 0.003 on the log stiffness
mean offset: mu = 0.028, tap noise 4.0 Hz
=== Resonance crossing at rated operation (as built) ===
P(crossing inside the dwell band) = 0.613 +/- 0.012
oval frequency: median 1362 Hz, 90% interval [1237, 1503] Hz
tooth velocity: median 7.85 mm/s, 90% interval [3.68, 10.09] mm/s
CVaR95 tooth velocity: 10.10 mm/s
=== Mode tracking across the tolerance draw ===
oval modes: tracked to columns 3 and 4 of every draw
MAC of the oval pair: 1.0000 and 1.0000 over 32 draws
lowest MAC of all modes: 0.51 (an exactly repeated pair, free to rotate)
=== Design of the clamp ===
clamp stiffness scale: 1.50 (oval pair now at 1644 Hz)
P(crossing inside the dwell band) = 0.0024 +/- 0.0013
tooth velocity at rated: median 1.798 mm/s (was 7.85 mm/s)
=== Cast mounting bracket ===
volume: mean 5.760063e-04 m3, sd 3.67e-06 m3 (analytical_gaussian, exact)
Monte Carlo cross check: 5.760380e-04 +/- 4.08e-08 m3 over 8192 draws (montecarlo)
mass at 2700 kg/m3: 1.555 kg +/- 9.9 g
inertia of the mean bracket about its centroid: [0.001296 0.002333 0.002696] kg m2
As built, three of every five machines whine in the dwell band at rated speed. A clamp stiffness scale of 1.50 lifts the oval pair to 1644 Hz and keeps the crossing probability at a quarter of a percent, with the tooth velocity four times lower. The bracket adds 1.555 kg of cast aluminium to the mass budget, with its own tolerance contributing ten grams of standard deviation.
Primitives exercised#
Feature |
Used for |
|---|---|
The ring eigenproblem over the whole tolerance sample axis, with exact mode based gradients (Fox and Kapoor 1968, Dailey 1989) |
|
The tooth velocity at rated speed by exact superposition, with the damping ratio as an argument of the model |
|
Matching the modes of every tolerance draw to the prototype by the modal assurance criterion |
|
|
The clamp tolerance of the stack stiffness over the production spread |
The tolerance fitted to production tap tests, with standard errors |
|
|
Crossing probability with its standard error, whine velocity distribution and tail |
The clamp stiffness scale against the crossing target, by gradient through the eigensystem |
|
Exact mean and variance of the bracket volume, and so of its mass, cross checked by Monte Carlo |
|
The bracket itself, with the exact inertia of its mean body |
Running it#
$ python examples/stator_whine/model.py
The model runs in about four minutes on a laptop CPU, entirely on the free tier.