Resources Numerical accuracy
Calculations
Every calculation under our calculation policies: what it works out, its formula and the precision it runs at. Open one to see its code as it is in the released app.
Calculations
-
Friction factor
The Darcy friction factor from the Reynolds number and relative roughness.
Re < 2000: f = 64 ÷ Re; Re > 4000: f = 0.25 ÷ log₁₀(ε ÷ 3.7D + 5.74 ÷ Re^0.9)²; a linear blend between
Pipe, duct and gas networks fluid.js Every app64-bit -
Colebrook–White friction factor
The implicit friction factor, offered for comparison.
1 ÷ √f = −2 log₁₀(ε ÷ 3.7D + 2.51 ÷ (Re √f))
Pipe, duct and gas networks fluid.js Every app64-bit -
Head loss of a link
The loss of a pipe, fitting, pump or gas pipe as a function of flow.
Hazen–Williams: h = 10.67 L Q^1.852 ÷ (C^1.852 D^4.871); Darcy–Weisbach: h = (f L ÷ D + K) Q|Q| ÷ (2 g A²); pump: H = ω² h₀ − a Q²
Pipe, duct and gas networks fluid.js Every app64-bit -
Network iteration
Updates every node head and link flow until they balance.
(A₂₁ D⁻¹ A₁₂) ΔH = −A₂₁ D⁻¹ F₁ − (q − A₂₁ Q); ΔQ = −D⁻¹ (loss − ΔH)
Pipe, duct and gas networks fluid.js Every app64-bit -
Node pressure
The pressure reported at each node.
water: p = (H − z) × 998.2 × g; gas: p = √(max(p², 0))
Pipe, duct and gas networks fluid.js Every app64-bit -
Link flow, loss and velocity
The results reported for each link.
loss = H_from − H_to; v = Q ÷ (π D² ÷ 4)
Pipe, duct and gas networks fluid.js Every app64-bit -
Hardy Cross loop corrections
A second, independent way to balance flows in loops given by hand.
ΔQ = −Σ dir × h(Q) ÷ Σ h′(Q) per loop
Pipe, duct and gas networks fluid.js Every app64-bit -
Dense linear solve
Solves the nodal equations of the pipe network and the load-flow Jacobian.
Gaussian elimination with partial pivoting
Pipe, duct and gas networks numeric.js Every app64-bit -
Bus admittance matrix
The admittances that link every pair of buses.
y = 1 ÷ (r + jx); Yff = (y + jb ÷ 2) ÷ |a|²; Yft = −y ÷ conj(a); Ytt = y + jb ÷ 2
Load flow and short-circuit currents power.js Every app64-bit -
Power injected at each bus
Real and reactive power from the voltages.
Pᵢ = Σ Vᵢ Vⱼ (G cos δ + B sin δ); Qᵢ = Σ Vᵢ Vⱼ (G sin δ − B cos δ)
Load flow and short-circuit currents power.js Every app64-bit -
Load flow iteration
Corrects angles and voltages until the power balances.
J Δx = (P_sched − P, Q_sched − Q); stop when max |mismatch| < 1e-9 pu
Load flow and short-circuit currents power.js Every app64-bit -
Reactive limits of generator buses
Switches a voltage-controlled bus to a fixed reactive power when it passes its limit.
switch when Q_g > Qmax + 1e-9 or Q_g < Qmin − 1e-9
Load flow and short-circuit currents power.js Every app64-bit -
Branch flows and losses
Power at both ends of each branch and the loss in it.
S_f = V_f conj(I_f); loss = P_f + P_t
Load flow and short-circuit currents power.js Every app64-bit -
Per-unit base
Ohms to per unit on a voltage and power base.
Z_base = kV² ÷ MVA; z_pu = z ÷ Z_base
Load flow and short-circuit currents power.js Every app64-bit -
Feeder voltage drop
The three-phase voltage drop of a feeder.
ΔV ≈ √3 I (R cos φ + X sin φ), φ = acos(pf)
Load flow and short-circuit currents power.js Every app64-bit -
Sequence impedance matrices
The impedance seen from every bus in the positive, negative and zero sequence.
Z = Y⁻¹ for each sequence
Load flow and short-circuit currents shortcircuit.js Every app64-bit -
Sequence to phase values
Phase currents and voltages from the sequence components.
I_a = I₀ + I₁ + I₂; I_b = I₀ + a² I₁ + a I₂; I_c = I₀ + a I₁ + a² I₂, a = −½ + j√3 ÷ 2
Load flow and short-circuit currents shortcircuit.js Every app64-bit -
Fault current
Initial and peak fault current, fault power, and the voltages and branch currents during the fault.
3-phase: I₁ = c ÷ (Z₁ + Z_f); line to ground: I₁ = c ÷ (Z₁ + Z₂ + Z₀ + 3Z_f); i_p = κ √2 I_k, κ = 1.02 + 0.98 e^(−3R/X)
Load flow and short-circuit currents shortcircuit.js Every app64-bit -
Complex division
a ÷ b for the impedances and currents of the fault study.
a ÷ b = a conj(b) ÷ (b_re² + b_im²)
Load flow and short-circuit currents numeric.js Every app64-bit -
Complex matrix inverse
Inverts a sequence admittance matrix.
Gauss–Jordan elimination with pivoting by magnitude
Load flow and short-circuit currents numeric.js Every app64-bit -
Curve constants
The constants of the IEC and IEEE inverse-time curves and the cable factors.
IEC normal inverse k = 0.14, α = 0.02; IEEE very inverse A = 19.61, B = 0.491, p = 2; cable k: copper PVC 115
Protection curves and grading protection.js Every app64-bit -
Relay operating time
How long a relay takes to trip at a current.
IEC: t = TMS × k ÷ (M^α − 1); IEEE: t = TD ÷ divisor × (A ÷ (M^p − 1) + B), M = I ÷ pickup
Protection curves and grading protection.js Every app64-bit -
Fuse or breaker curve from points
The operating time of a device given as a table of current and time.
ln t = ln t₀ + (ln I − ln I₀) ÷ (ln I₁ − ln I₀) × (ln t₁ − ln t₀)
Protection curves and grading protection.js Every app64-bit -
Cable damage time
How long a cable can carry a fault current.
t = (k S ÷ I)²
Protection curves and grading protection.js Every app64-bit -
Grading margin
The time between a downstream and an upstream device at each fault current.
margin = t_up − t_down; ok when margin ≥ the grading interval (0.3 s by default)
Protection curves and grading protection.js Every app64-bit -
Pickup and cable checks
Pickup against load and the smallest fault, and clearing time against the cable.
pickup ≥ 1.05 × load; pickup ≤ smallest fault ÷ 1.5; clearing time ≤ (k S ÷ I)²
Protection curves and grading protection.js Every app64-bit -
Point to segment distance
The distance from a point to a track center line or a polygon edge.
t = clamp(((p − a) · (b − a)) ÷ |b − a|², 0, 1); d = |p − (a + t (b − a))|
Board geometry and clearances geom.js Every app64-bit -
Orientation of three points
Which side of a line a point lies on.
o = (b − a) × (c − a)
Board geometry and clearances geom.js Every app64-bit -
Segment crossing test
Whether two segments cross or touch.
cross when the orientation signs differ on both segments; touch when an orientation is 0 and the point lies in the other's box
Board geometry and clearances geom.js Every app64-bit -
Segment to segment distance
The distance between two track center lines or edges.
0 when they cross; else the least of four point-to-segment distances
Board geometry and clearances geom.js Every app64-bit -
Point in polygon
Whether a point lies inside a zone, a pad or the board outline.
even-odd rule along a ray in +x
Board geometry and clearances geom.js Every app64-bit -
Polygon area
The signed area of a closed polygon.
A = ½ Σ (xᵢ yᵢ₊₁ − xᵢ₊₁ yᵢ)
Board geometry and clearances geom.js Every app64-bit -
Polygon to polygon distance
The distance between two closed shapes.
0 when one first vertex is inside the other; else the least edge-to-edge distance
Board geometry and clearances geom.js Every app64-bit -
Gap between copper shapes
The edge-to-edge clearance between two tracks, pads or zones.
gap = max(0, center-line distance − r₁ − r₂)
Board geometry and clearances geom.js Every app64-bit -
Rotation of a point
A pad or outline point turned by an angle in degrees.
(x cos θ − y sin θ, x sin θ + y cos θ), θ = degrees × π ÷ 180
Board geometry and clearances geom.js Every app64-bit -
Pad position on the board
Where a footprint pad sits on the board, with its shape for the clearance check.
world = part position + R(part rotation) × (±x, y)
Board geometry and clearances board.js Every app64-bit -
Coordinate and aperture format
How a position and an aperture size are written in a Gerber file.
X, Y = round(mm × 10⁶); size = 6 decimals
Gerber and drill file numbers gerber.js Every app64-bit -
Pad as a flash or a region
A pad, or its grown copy for the solder mask, in the file.
axis-aligned: aperture (w + 2 × grow) by (h + 2 × grow); else a 4-corner region rotated by the pad angle
Gerber and drill file numbers gerber.js Every app64-bit -
Drill sizes and positions
The tool table and hole positions of the drill files.
tool size = 3 decimals; X, Y = 4 decimals of a millimeter
Gerber and drill file numbers gerber.js Every app64-bit -
Board size in the job file
The board's width and height stated in the job file.
size = extent of the outline, 4 decimals
Gerber and drill file numbers gerber.js Every app64-bit -
Coordinate scale when reading
The factor that turns the file's integers into coordinates.
scale = 10^(−decimals of X)
Gerber and drill file numbers gerber.js Every app64-bit -
Coordinates when reading
Each X and Y of a Gerber file as a number.
x = integer × scale
Gerber and drill file numbers gerber.js Every app64-bit -
Drill file when reading
Tool diameters and hole positions read back from a drill file.
decimal text to the nearest 64-bit number
Gerber and drill file numbers gerber.js Every app64-bit -
Real number when reading
An 8-byte GDSII real as a number.
value = sign × (mantissa ÷ 2⁵⁶) × 16^(exponent − 64)
GDSII layout: reals, flattening, areas and checks gds.js Every app64-bit -
Real number when writing
A number as an 8-byte GDSII real.
mantissa = round(v × 2⁵⁶) after scaling v into [1/16, 1) by powers of 16
GDSII layout: reals, flattening, areas and checks gds.js Every appExact -
Database unit
User units per database unit and meters per database unit, read from the file.
two 8-byte reals from the UNITS record
GDSII layout: reals, flattening, areas and checks gds.js Every app64-bit -
Integers written to the stream
Coordinates, widths, layers and array counts as the file stores them.
coordinates and widths: 32-bit signed; layers and counts: 16-bit signed
GDSII layout: reals, flattening, areas and checks gds.js Every app64-bit -
Placement transform
A referenced cell's points reflected, magnified, rotated and moved.
(x, y) → mag × (x, ±y), rotated by the angle in degrees, then translated
GDSII layout: reals, flattening, areas and checks gds.js Every app64-bit -
Nested placements
The combined transform of a cell placed inside a placed cell.
mag = mag_parent × mag_child; angle = angle_parent ± angle_child; reflection toggles
GDSII layout: reals, flattening, areas and checks gds.js Every app64-bit -
Array placement
The position of each copy in a rows-by-columns array.
position(i, j) = origin + i × (c − o) ÷ cols + j × (r − o) ÷ rows
GDSII layout: reals, flattening, areas and checks gds.js Every app64-bit
A calculation is added only after its source was read. Each statement can be checked in the code shown on its policy's page; the app repositories are public. When a release changes a calculation, its page says so until it has been read again.