spring_design
Helical compression spring of round wire from wire and coil diameter, active coils, moduli, free length and load: rate, deflection, shear stress with the Wahl factor (Bergstrasser and direct-shear alongside), solid length and clash allowance by end type, buckling (critical deflection and the never-buckles free length), surge frequency, safety factor against a given allowable shear stress. Material figures are inputs; no strength table is built in.
- Field
- Mechanics, CAD and finite elements
- Version
- 0.1.0
- Runs as
- Compiled (Rust)
- Typical run
- 0.05 s
Compiled from source: run sh packs/install.sh once before admitting it.
Known answers it must pass
r0001closed forms k = G d^4/(8 D^3 Na), Kw = (4C-1)/(4C-4) + 0.615/C, tau = Kw 8FD/(pi d^3): d = 2, D = 16, Na = 10, G = 80 GPa, F = 39.0625 N give k = 3.90625 N/mm and y = 10 mm exactly, C = 8, Kw = 31/28 + 0.615/8, KB = 34/29, Ks = 17/16, tau = Kw 625/pi MPa, energy = k y^2/2 = 0.1953125 J (1e-9: exact arithmetic)passed
rate_N_per_mm3.90625 ± 3.9e-093.90625lockedunder 0.01 % of the tolerance useddeflection_mm10 ± 1e-0810lockedunder 0.01 % of the tolerance usedspring_index8 ± 8e-128lockedunder 0.01 % of the tolerance usedwahl_factor1.18402 ± 1.2e-091.18402lockedunder 0.01 % of the tolerance usedbergstrasser_factor1.17241 ± 1.2e-091.17241lockedunder 0.01 % of the tolerance useddirect_shear_factor1.0625 ± 1.1e-091.0625lockedunder 0.01 % of the tolerance usedshear_stress_uncorrected_MPa198.944 ± 2e-07198.944lockedunder 0.01 % of the tolerance usedshear_stress_MPa235.553 ± 2.4e-07235.553lockedunder 0.01 % of the tolerance usedenergy_stored_J0.195312 ± 2e-100.195312lockedunder 0.01 % of the tolerance usedr0002solid length and clash, squared and ground ends (Nt = Na + 2, Ls = d Nt, p = (L0 - 2d)/Na): d = 2, Na = 10, L0 = 50 give Nt = 12, Ls = 24 mm, pitch 4.6 mm, travel 26 mm, force at solid 26 k = 101.5625 N; at F = 39.0625 N length 40 mm, margin 16 mm, allowance 62.5/39.0625 = 1.6; allowable 500 MPa gives safety factor 500/(Kw 625/pi) and 500/(Kw 1625/pi) at solid (1e-9: exact arithmetic)passed
total_coils12 ± 1.2e-1112lockedunder 0.01 % of the tolerance usedsolid_length_mm24 ± 2.4e-1124lockedunder 0.01 % of the tolerance usedpitch_mm4.6 ± 4.6e-094.6lockedunder 0.01 % of the tolerance usedtravel_to_solid_mm26 ± 2.6e-1126lockedunder 0.01 % of the tolerance usedforce_at_solid_N101.562 ± 1e-07101.562lockedunder 0.01 % of the tolerance usedlength_at_load_mm40 ± 4e-0840lockedunder 0.01 % of the tolerance usedclash_margin_mm16 ± 1.6e-0816lockedunder 0.01 % of the tolerance usedclash_allowance1.6 ± 1.6e-091.6lockedunder 0.01 % of the tolerance usedshear_stress_at_solid_MPa612.437 ± 6.1e-07612.437lockedunder 0.01 % of the tolerance usedsafety_factor2.12267 ± 2.1e-092.12267lockedunder 0.01 % of the tolerance usedsafety_factor_at_solid0.81641 ± 8.2e-100.81641lockedunder 0.01 % of the tolerance usedsolid_at_load= falsefalselockedexact matchall_ok= truetruelockedexact matchr0003textbook: Shigley, Mechanical Engineering Design, Example 10-1 (no. 16 music wire d = 0.037 in, OD 7/16 in so D = 0.4005 in, squared ends, 12.5 total turns so Na = 10.5, G = 11.85 Mpsi, load 6.46 lbf, L0 = 2.06 in), converted to SI. Book: k = 4.13 lbf/in, y = 1.56 in, C = 10.8, KB = 1.124, Ls = (Nt + 1) d = 0.4995 in, pitch 0.186 in, stress at that load = Ssy = 145.9 kpsi. Tolerances 0.5 % (1 % on y) because the book carries three figures and rounds between steps (its k is 0.35 % above the closed form); Ls is exactpassed
rate_N_per_mm0.723274 ± 0.00360.720761locked69 % of the tolerance useddeflection_mm39.624 ± 0.439.6367locked3.2 % of the tolerance usedspring_index10.8 ± 0.05410.8243locked45 % of the tolerance usedbergstrasser_factor1.124 ± 0.00111.12408locked6.9 % of the tolerance usedtotal_coils12.5 ± 1.3e-1112.5lockedunder 0.01 % of the tolerance usedsolid_length_mm12.6873 ± 1.3e-0812.6873lockedunder 0.01 % of the tolerance usedpitch_mm4.7244 ± 0.0244.71472locked41 % of the tolerance usedshear_stress_bergstrasser_MPa1005.95 ± 51002.2locked74 % of the tolerance usedr0004buckling closed form (Shigley eqs. 10-10 to 10-12): E = 200, G = 80 GPa give C1 = 5/6, C2 = 2 pi^2/3; D = 16 mm between flat plates (alpha = 0.5): never buckles below 32 pi sqrt(2/3) = 82.0832 mm; L0 = 100 mm gives lambda = 3.125, y_cr = 100 (5/6)(1 - sqrt(1 - (2 pi^2/3)/3.125^2)) = 35.7358 mm; load 39.0625 N deflects 10 mm so margin = y_cr/10 and no buckling (1e-9: exact arithmetic)passed
buckling_slenderness3.125 ± 3.1e-123.125lockedunder 0.01 % of the tolerance usedstable_free_length_mm82.0832 ± 8.2e-0882.0832lockedunder 0.01 % of the tolerance usedbuckling_deflection_mm35.7358 ± 3.6e-0835.7358lockedunder 0.01 % of the tolerance usedbuckling_margin3.57358 ± 3.6e-093.57358lockedunder 0.01 % of the tolerance usedabsolutely_stable= falsefalselockedexact matchbuckles= falsefalselockedexact matchr0005buckling, same spring on pivoted ends (alpha = 1): lambda = 6.25, never-buckles length halves to 16 pi sqrt(2/3) = 41.0416 mm, y_cr = 100 (5/6)(1 - sqrt(1 - (2 pi^2/3)/6.25^2)) = 7.34180 mm, below the 10 mm deflection: buckles, verdict fails (1e-9: exact arithmetic)passed
buckling_slenderness6.25 ± 6.3e-126.25lockedunder 0.01 % of the tolerance usedstable_free_length_mm41.0416 ± 4.1e-0841.0416lockedunder 0.01 % of the tolerance usedbuckling_deflection_mm7.3418 ± 7.3e-097.3418lockedunder 0.01 % of the tolerance usedbuckles= truetruelockedexact matchall_ok= falsefalselockedexact matchr0006textbook: Shigley eq. 10-13 and Example 10-1(g), steel springs never buckle when L0 < 2.63 D/alpha: E = 207, G = 79.3 GPa, D = 0.4005 in = 10.1727 mm, alpha = 0.5 give the book's 2.11 in = 53.594 mm (0.5 %: the book rounds the coefficient to 2.63, the closed form gives 2.626); L0 = 50 mm is below it, so absolutely stablepassed
stable_free_length_mm53.594 ± 0.2753.4224locked64 % of the tolerance usedabsolutely_stable= truetruelockedexact matchbuckles= falsefalselockedexact matchr0007surge closed form f = (1/2) sqrt(k/m) = d/(2 pi D^2 Na) sqrt(G/(2 rho)), m = rho pi^2 d^2 D Na/4: d = 2 mm, D = 16 mm, Na = 10, G = 81 GPa, rho = 8000 kg/m^3 give sqrt(G/(2 rho)) = 2250 m/s exactly, f = 878.90625/pi = 279.76455 Hz, m = 1.28 pi^2 = 12.63309 g; drive at 10 Hz gives ratio f/10 (1e-9: exact arithmetic)passed
surge_frequency_Hz279.765 ± 2.8e-07279.765lockedunder 0.01 % of the tolerance usedactive_mass_g12.6331 ± 1.3e-0812.6331lockedunder 0.01 % of the tolerance usedsurge_ratio27.9765 ± 2.8e-0827.9765lockedunder 0.01 % of the tolerance usedr0008surge with one end free, f = (1/4) sqrt(k/m): half the two-plate value, 439.453125/pi = 139.88227 Hz (1e-9: exact arithmetic)passed
surge_frequency_Hz139.882 ± 1.4e-07139.882lockedunder 0.01 % of the tolerance usedr0009surge check: the two-plate spring above (f = 878.90625/pi Hz) driven at 20 Hz gives ratio 43.9453125/pi = 13.98823 < 15, so the verdict fails on resonance alone (1e-9: exact arithmetic)passed
surge_ratio13.9882 ± 1.4e-0813.9882lockedunder 0.01 % of the tolerance usedall_ok= falsefalselockedexact matchr0010overload: F = 150 N exceeds the force at solid 101.5625 N (same spring as the first case), so the spring is solid: deflection capped at the travel 26 mm, length = Ls = 24 mm, clash margin 0, allowance (101.5625 - 150)/150 = -0.3229166667, verdict failspassed
solid_at_load= truetruelockedexact matchdeflection_mm26 ± 2.6e-0826lockedunder 0.01 % of the tolerance usedlength_at_load_mm24 ± 2.4e-0824lockedunder 0.01 % of the tolerance usedclash_margin_mm0 ± 1e-090lockedunder 0.01 % of the tolerance usedclash_allowance-0.322917 ± 3.2e-10-0.322917lockedunder 0.01 % of the tolerance usedshear_stress_MPa612.437 ± 6.1e-07612.437lockedunder 0.01 % of the tolerance usedall_ok= falsefalselockedexact match
Each line is one reading the kernel checked. The bright band is the tolerance; the needle is the value the instrument actually returned when it was admitted. A needle near the centre line used little of its tolerance.
Inputs
| Name | Unit | Default | Meaning |
|---|---|---|---|
wire_diameter_mm | mm | 2.0 | Wire diameter d. |
mean_coil_diameter_mm | mm | 16.0 | Mean coil diameter D = outside diameter minus the wire diameter. Must exceed the wire diameter. |
active_coils | 1 | 10.0 | Active coils Na (the ones that deflect). Fractions allowed. |
shear_modulus_GPa | GPa | 79.3 | Shear modulus G of the wire. Default: carbon spring steel. |
elastic_modulus_GPa | GPa | 207.0 | Elastic modulus E of the wire, used by the buckling check only. Must exceed G. Default: carbon steel. |
free_length_mm | mm | 50.0 | Unloaded length L0. Must exceed the solid length. |
load_N | N | 40.0 | Compressive working load F. |
end_type | squared_ground | How the end coils are finished: sets total coils, solid length and pitch. | |
end_fixity | fixed_fixed | How the ends are held, for buckling (alpha = 0.5, 0.707, 1, 2) and surge (1/2 sqrt(k/m), or 1/4 with a free end). fixed_fixed is a spring between flat parallel plates. | |
density_kg_per_m3 | kg/m^3 | 7850.0 | Wire density, for the surge frequency. Default: steel. |
allowable_shear_MPa | MPa | Allowable shear stress of the wire (its torsional yield strength, from the datasheet). Leave out and strength is not judged. | |
min_safety_factor | 1 | 1.2 | Required allowable / Wahl shear stress at the load. |
min_clash_allowance | 1 | 0.15 | Required (force at solid - load) / load: the reserve before the coils touch. |
operating_frequency_Hz | Hz | Frequency of the applied load, to compare with the surge frequency. Optional. | |
min_surge_ratio | 1 | 15.0 | Required surge frequency / operating frequency (15 to 20 is the usual rule). Judged only when an operating frequency is given. |
Readings
| Name | Unit | Meaning |
|---|---|---|
spring_index | 1 | |
rate_N_per_mm | N/mm | |
deflection_mm | mm | |
length_at_load_mm | mm | |
wahl_factor | 1 | |
bergstrasser_factor | 1 | |
direct_shear_factor | 1 | |
shear_stress_MPa | MPa | |
shear_stress_uncorrected_MPa | MPa | |
shear_stress_bergstrasser_MPa | MPa | |
shear_stress_static_MPa | MPa | |
total_coils | 1 | |
solid_length_mm | mm | |
pitch_mm | mm | |
travel_to_solid_mm | mm | |
force_at_solid_N | N | |
shear_stress_at_solid_MPa | MPa | |
clash_margin_mm | mm | |
clash_allowance | 1 | |
solid_at_load | ||
buckling_slenderness | 1 | |
stable_free_length_mm | mm | |
absolutely_stable | ||
buckling_deflection_mm | mm | |
buckling_margin | 1 | |
buckles | ||
active_mass_g | g | |
surge_frequency_Hz | Hz | |
surge_ratio | 1 | |
safety_factor | 1 | |
safety_factor_at_solid | 1 | |
energy_stored_J | J | |
outer_diameter_mm | mm | |
inner_diameter_mm | mm | |
wire_length_mm | mm | |
all_ok | ||
problems | ||
advisories | ||
files |
Try the call
Change a value and the command updates. Nothing runs here; paste it into your terminal or give it to your agent.