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
-
What a wire end connects to
Joins a wire end to other wire ends, to pins and to the middle of other wires that it touches.
connected when distance² ≤ tol², tol = 0.05
Schematic wires, pins and connections addons/electrical/lib/wires.js64-bit- CadCraft
-
Where a wire number goes
The middle and direction of the longest segment of a net, for its wire number.
x = (aₓ + bₓ) ÷ 2; y = (a_y + b_y) ÷ 2; rot = atan2(Δy, Δx) turned into (−π ÷ 2, π ÷ 2]
Schematic wires, pins and connections addons/electrical/lib/wires.js64-bit- CadCraft
-
Which wire a wire number belongs to
Assigns each wire number to the nearest wire within reach.
nearest segment with d² ≤ 3²
Schematic wires, pins and connections addons/electrical/lib/wires.js64-bit- CadCraft
-
Junction dots
Places a dot at each junction and removes dots that no longer mark one.
a dot marks a junction when d² ≤ max(tol, 0.2)²
Schematic wires, pins and connections addons/electrical/lib/wires.js64-bit- CadCraft
-
Transform of a placed symbol
The matrix that takes a symbol's own coordinates to the drawing.
a = cos r × sx; b = sin r × sx; c = −sin r × sy; d = cos r × sy; e = x − (a bₓ + c b_y); f = y − (b bₓ + d b_y)
Schematic wires, pins and connections addons/electrical/lib/symbols.js64-bit- CadCraft
-
A point through the transform
Applies a symbol's matrix to a point.
x′ = a x + c y + e; y′ = b x + d y + f
Schematic wires, pins and connections addons/electrical/lib/symbols.js64-bit- CadCraft
-
Pin positions of a placed symbol
The drawing positions of a symbol's connection points.
Schematic wires, pins and connections addons/electrical/lib/symbols.js64-bit- CadCraft
-
Pin offsets written to the block
Formats a pin offset for the block's EL attribute text.
text = round(n × 1000) ÷ 1000
Schematic wires, pins and connections addons/electrical/lib/symbols.js64-bit- CadCraft
-
Attribute text kept upright
Decides which attribute texts of a rotated symbol would read upside down and turns them half round.
turn when cos(rot + text rot) ≤ −1e-9
Schematic wires, pins and connections addons/electrical/lib/symbols.js64-bit- CadCraft
-
Sheet points on the 2.5 mm grid
Moves a picked point on a sheet to the nearest point of the 2.5 mm grid.
x = round(x ÷ 2.5) × 2.5
Schematic wires, pins and connections addons/electrical/main.jsExact- CadCraft
-
A wire point landing on a pin or wire
Moves a picked wire point onto a pin, a wire end or a wire when it is within 2 units of one.
candidate when d² ≤ 2²; a wire's middle is ranked with d² + 0.25
Schematic wires, pins and connections addons/electrical/main.js64-bit- CadCraft
-
A wire cut under a new symbol
Cuts a wire between two pins of a symbol placed on it.
pin on the wire when d² < 1e-4 and 1e-6 < u < 1 − 1e-6
Schematic wires, pins and connections addons/electrical/main.js64-bit- CadCraft
-
PV one-line layout
Positions the symbols and wires of a solar one-line diagram from the column and row of each node.
x = x₀ + col × pitch x; y = y₀ − row × pitch y; wire bend at (sx + ex) ÷ 2
Schematic wires, pins and connections addons/electrical/lib/pvoneline.js64-bit- CadCraft
-
Transform of a schematic symbol
The matrix that takes a symbol's pin offsets to the drawing.
a = cos r × sx; b = sin r × sx; c = −sin r × sy; d = cos r × sy; e = x − (a bₓ + c b_y); f = y − (b bₓ + d b_y)
Wire harness and control cabinet layout addons/harness/lib/schem.js64-bit- CadCraft
-
Squared distance from a point to a wire segment
How far a wire end or pin is from a wire segment.
u = clamp((p − a)·(b − a) ÷ |b − a|², 0, 1); d² = |p − (a + u (b − a))|²
Wire harness and control cabinet layout addons/harness/lib/schem.js64-bit- CadCraft
-
Which wires and pins are connected
Joins wire ends to other ends, to pins and to wires they touch, to find the nets.
connected when distance² ≤ tol², tol = 0.05
Wire harness and control cabinet layout addons/harness/lib/schem.js64-bit- CadCraft
-
A point in a rail's frame
The distance along a rail and off its axis of a drawing point, in millimeters.
s = (Δx cos r + Δy sin r) ÷ k; off = (−Δx sin r + Δy cos r) ÷ k
Wire harness and control cabinet layout addons/harness/lib/cabinet.js64-bit- CadCraft
-
A rail position back in the drawing
The drawing point at a distance along a rail.
x = x₀ + (s cos r − off sin r) × k; y = y₀ + (s sin r + off cos r) × k
Wire harness and control cabinet layout addons/harness/lib/cabinet.js64-bit- CadCraft
-
Modules on a rail
Which modules sit on a rail, and the stretch of rail each covers.
s₀ = s − w ÷ 2; s₁ = s + w ÷ 2
Wire harness and control cabinet layout addons/harness/lib/cabinet.js64-bit- CadCraft
-
Modules past the end or overlapping
Flags a module that hangs past the rail or overlaps the next one.
past when s₀ < −0.01 or s₁ > len + 0.01; overlap when next s₀ < s₁ − 0.01
Wire harness and control cabinet layout addons/harness/lib/cabinet.js64-bit- CadCraft
-
Free length on a rail
The rail length not taken by modules.
free = max(0, len − Σ module widths)
Wire harness and control cabinet layout addons/harness/lib/cabinet.js64-bit- CadCraft
-
Where a new module sits
The center of a new module on a rail: inside the rail, and flush to a neighbor when close.
c = clamp(s, w ÷ 2, len − w ÷ 2); c = neighbor edge ± w ÷ 2 when within 3 mm
Wire harness and control cabinet layout addons/harness/lib/cabinet.js64-bit- CadCraft
-
Drawing units per millimeter
The factor between the drawing and millimeters.
k = (1 ÷ per) × (1 ÷ 25.4 for inch rules)
Wire harness and control cabinet layout addons/harness/main.js64-bit- CadCraft
-
A harness moved, turned or scaled
Applies a move, rotation or scale to a harness: its nodes and its scale.
k′ = k × √(m₀² + m₁²); node′ = M · node
Wire harness and control cabinet layout addons/harness/main.js64-bit- CadCraft
-
Module positions in millimeters
Each placed module's position for routing wires to it.
x mm = x ÷ k; y mm = y ÷ k
Wire harness and control cabinet layout addons/harness/main.js64-bit- CadCraft
-
Total length of a harness
The summed length of a harness's segments for the bill of materials.
mm = Σ segment length
Wire harness and control cabinet layout addons/harness/main.js64-bit- CadCraft
-
Wire count and bundle diameter per segment
The number of wires in each harness segment and the diameter of their bundle, kept on the harness.
od = round(bundleDiameter × 10) ÷ 10
Wire harness and control cabinet layout addons/harness/main.js64-bit- CadCraft
-
Rail length and angle from two points
The length in millimeters and the angle of a rail drawn between two points.
len = √(Δx² + Δy²) ÷ k; rot = atan2(Δy, Δx)
Wire harness and control cabinet layout addons/harness/main.js64-bit- CadCraft
-
Modules placed in a row
Places every remaining module along a rail, one after the other.
center = s + w ÷ 2; s ← s + w; stop when s + w > len + 1e-9
Wire harness and control cabinet layout addons/harness/main.js64-bit- CadCraft
-
Segment length and bundle labels
The length written beside each harness segment, and its wire count and diameter.
mm = typed length, or √(Δx² + Δy²) ÷ k; label = round(mm)
Wire harness and control cabinet layout addons/harness/lib/draw.js64-bit- CadCraft
-
A run moved, turned or scaled
Applies a move, rotation, scale or mirror to a run's centerline and its scale.
p′ = M · p; sc = √|det M|; k′ = k ÷ sc; z′ = z × sc
Duct runs, fittings and schedule addons/hvac/lib/duct.js64-bit- CadCraft
-
Section width in drawing units
The drawn width of a duct section.
width = w ÷ k
Duct runs, fittings and schedule addons/hvac/lib/duct.js64-bit- CadCraft
-
Branches found on mains
Finds where a run's end sits on another run's centerline, the angle between them and how far the branch is cut back.
sin = |t_main × t_branch|; cut = (W_main ÷ 2) ÷ sin; opening = W_branch ÷ sin; angle = round(asin(sin) × 180 ÷ π × 10) ÷ 10
Duct runs, fittings and schedule addons/hvac/lib/duct.js64-bit- CadCraft
-
Elbows, transitions and straight pieces
The fittings of a run and the start and end of each straight piece along its centerline.
T = R tan(θ ÷ 2), R = r × W; mitred: T = (W ÷ 2) tan(θ ÷ 2); elbow length = R θ or 2T; transition L = max(max(ΔW ÷ 2, ΔH) ÷ tan 15° ÷ k, minimum)
Duct runs, fittings and schedule addons/hvac/lib/duct.js64-bit- CadCraft
-
Length in feet or meters
Converts a length in drawing units to feet or meters.
feet = du × k ÷ 12; meters = du × k ÷ 1000
Duct runs, fittings and schedule addons/hvac/lib/duct.js64-bit- CadCraft
-
Sheet-metal area of a length of duct
The surface area of a length of duct in square feet or square meters.
ft² = perimeter × du × k ÷ 144; m² = perimeter × du × k ÷ 1e6
Duct runs, fittings and schedule addons/hvac/lib/duct.js64-bit- CadCraft
-
Elbow area and angle
The sheet-metal area of an elbow and the angle in its name.
area = perimeter × centerline length; name angle = round(θ × 180 ÷ π)
Duct runs, fittings and schedule addons/hvac/lib/duct.js64-bit- CadCraft
-
Transition area
The sheet-metal area of a transition between two sizes.
rectangular: bottom + top + two sides as trapezoids over their slant lengths; other: (pₐ + p_b) ÷ 2 × slant length
Duct runs, fittings and schedule addons/hvac/lib/duct.js64-bit- CadCraft
-
Straight pieces
The length and area of each straight piece of a run.
du = s₁ − s₀; length = lenOut(du); area = perimeter × du
Duct runs, fittings and schedule addons/hvac/lib/duct.js64-bit- CadCraft
-
Schedule totals
The total duct length, total sheet-metal area and number of fittings.
length = Σ rows; area = Σ duct areas + Σ fitting areas
Duct runs, fittings and schedule addons/hvac/lib/duct.js64-bit- CadCraft
-
A run in the other unit system
Converts a run's sizes and airflows between inches with cfm and millimeters with L/s.
size × 25.4 or ÷ 25.4; airflow × 0.47194745 or ÷ 0.47194745
Duct runs, fittings and schedule addons/hvac/lib/duct.js64-bit- CadCraft
-
A typed duct size
Reads a size such as 24x12 or Ø14.
Duct runs, fittings and schedule addons/hvac/main.js64-bit- CadCraft
-
A point pulled onto a run's centerline
Moves a point picked inside a duct's outline onto its centerline, to start or end a branch there.
inside when distance ≤ W ÷ 2 + 1e-9
Duct runs, fittings and schedule addons/hvac/main.js64-bit- CadCraft
-
Schedule table in the drawing
The rows of the duct schedule placed in the drawing.
shown length and area = value.toFixed(1), trailing zeros removed
Duct runs, fittings and schedule addons/hvac/main.js64-bit- CadCraft
-
Schedule CSV
Writes the duct schedule as CSV.
length, perimeter, area: 3 decimals; velocity: 0 decimals (inch units) or 2; friction rate: 4 decimals
Duct runs, fittings and schedule addons/hvac/main.js64-bit- CadCraft
-
Liters per second in one cfm
The factor that converts airflow from cubic feet per minute to liters per second.
1 cfm = 0.3048³ ÷ 60 × 1000 L/s = 0.4719474432 L/s exactly
Duct network pressure: drawing adapter addons/hvac/lib/ductnet.js64-bit- CadCraft
-
Millimeters per drawing unit
The factors that take a run's coordinates, sizes and airflow to millimeters and L/s.
draw = k × 25.4 (inch) or k; size = 25.4 or 1; lps = CFM_LPS or 1
Duct network pressure: drawing adapter addons/hvac/lib/ductnet.js64-bit- CadCraft
-
Turn at a corner
The angle a run turns through at a corner, in degrees.
turn = acos(u·v ÷ (|u| |v|)) × 180 ÷ π
Duct network pressure: drawing adapter addons/hvac/lib/ductnet.js64-bit- CadCraft
-
Runs handed to the engine
Each run's vertices in millimeters, its section size in millimeters, and its free ends with their airflow.
vertex mm = p × draw; w mm = w × size; z mm = z × draw
Duct network pressure: drawing adapter addons/hvac/lib/ductnet.js64-bit- CadCraft
-
Fan point matched to a run end
Finds the run end the fan sits on and takes its height.
nearest end by √(Δx² + Δy²); accepted when ≤ 60 mm
Duct network pressure: drawing adapter addons/hvac/lib/ductnet.js64-bit- CadCraft
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.