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
-
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 -
Path outline
A path with a width turned into a polygon.
offset = ± half width along the corner bisector ÷ max(0.2, cos of the half angle)
GDSII layout: reals, flattening, areas and checks gds.js Every app64-bit -
Database units to user units
Flattened coordinates in the file's user unit, usually micrometers.
x_user = x_db × userPerDb
GDSII layout: reals, flattening, areas and checks gds.js Every app64-bit -
Shapes and area per layer
How many shapes each layer has and their total area.
area = Σ |shoelace area|
GDSII layout: reals, flattening, areas and checks gds.js Every app64-bit -
Width, spacing and area checks
Shapes that are narrower, closer or smaller than a rule allows.
area < minArea − 1e-12; 0 < distance < minSpace − 1e-12; facing-edge width < minWidth − 1e-12
GDSII layout: reals, flattening, areas and checks gds.js Every app64-bit -
Narrowest width of a shape
The smallest distance between two edges that face each other across the inside.
distance from one edge's line to the other, for antiparallel edges that overlap
GDSII layout: reals, flattening, areas and checks gds.js Every app64-bit -
Half-perimeter wire length
The estimate of total connection length reported before and after placement.
Σ over nets of (x_max − x_min) + (y_max − y_min)
Board placement and routing place.js Every app64-bit -
Overlap and outline penalties
The cost added when courtyards overlap or reach outside the board.
cost = 50 × (overlap area + area outside the margin)
Board placement and routing place.js Every app64-bit -
Annealing schedule
How the search cools from large moves to small ones.
T₀ = max(1, 0.15 (W + H)); T_end = 0.002 (W + H); T ← T × (T_end ÷ T₀)^(1 ÷ iterations)
Board placement and routing place.js Every app64-bit -
Final part positions
The positions stored on the board when placement ends.
x, y = round(value × 1000) ÷ 1000
Board placement and routing place.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.