Skip to main content

pcb_toolkit/
constants.rs

1//! Physical constants used across calculators.
2
3/// Speed of light in vacuum (m/s).
4pub const SPEED_OF_LIGHT_MS: f64 = 299_792_458.0;
5
6/// Speed of light in vacuum (in/ns) — convenience for transmission line calcs.
7/// Exact: 299_792_458 m/s × (1 in / 0.0254 m) × (1 s / 1e9 ns) = 11.80285...
8pub const SPEED_OF_LIGHT_IN_NS: f64 = 11.803;
9
10/// Permeability of free space µ₀ (H/m).
11pub const MU_0: f64 = 1.256_637_061_435_9e-6;
12
13/// Permittivity of free space ε₀ (F/m).
14pub const EPSILON_0: f64 = 8.854_187_817e-12;
15
16/// Copper resistivity at 20°C (Ω·cm).
17pub const COPPER_RESISTIVITY_OHM_CM: f64 = 1.724e-6;
18
19/// Copper temperature coefficient (1/°C).
20pub const COPPER_TEMP_COEFF: f64 = 0.00393;
21
22/// Copper melting point (°C) — used in Onderdonk fusing equation.
23pub const COPPER_MELTING_POINT_C: f64 = 1064.62;
24
25/// 4/π — geometric correction for coaxial/via capacitance.
26pub const FOUR_OVER_PI: f64 = 1.273_239_544_735_162_8;
27
28/// 1 mil in meters.
29pub const MIL_TO_M: f64 = 2.54e-5;
30
31/// 1 inch in centimeters.
32pub const INCH_TO_CM: f64 = 2.54;
33
34/// Kirschning-Jansen dispersion constant a.
35pub const KJ_DISPERSION_A: f64 = 0.457;
36
37/// Kirschning-Jansen dispersion constant b.
38pub const KJ_DISPERSION_B: f64 = 0.67;