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.

  • 6,917 calculations in 1,248 source files
  • 143 exact
  • 6,286 in 64-bit
  • 335 with a 32-bit step
  • Last reviewed

Calculations

  • Normal of a tilted plane

    The unit normal of a plane from its tilt and compass bearing.

    n = (h_x·sin β, h_y·sin β, cos β), h = north·cos az + east·sin az

    Solar array layout on roofs and ground pv.js
    • BimCraft
    • CivilCraft
    64-bit
  • Tilt and azimuth of a normal

    The tilt from horizontal and the compass bearing a plane faces.

    tilt = acos(clamp(n_z, −1, 1)); azimuth = (atan2(n·east, n·north) + 360) mod 360

    Solar array layout on roofs and ground pv.js
    • BimCraft
    • CivilCraft
    64-bit
  • Axes of a plane from its normal

    The along-eave and up-slope directions of a roof face.

    u = (−n_y, nₓ, 0) ÷ √(nₓ² + n_y²); v = n × u

    Solar array layout on roofs and ground pv.js
    • BimCraft
    • CivilCraft
    64-bit
  • Roof faces from triangles

    Groups upward triangles into planes and gives each plane's normal, tilt, azimuth, area and centroid.

    n = (B − A) × (C − A) ÷ |…|; area = |…| ÷ 2; face normal = unit(Σ area·n); centroid = Σ area·mid ÷ Σ area

    Solar array layout on roofs and ground pv.js
    • BimCraft
    • CivilCraft
    64-bit
  • Point inside the face's triangles

    Tests whether a point in the face's own axes lies in any of its triangles.

    barycentric l₁, l₂, l₃ ≥ −eps ÷ √|d|

    Solar array layout on roofs and ground pv.js
    • BimCraft
    • CivilCraft
    64-bit
  • Modules fitted in a roof face

    The positions and corners of the modules that fit inside a face with a setback.

    position = (s₀ + col × (across + gap), t₀ + row × (along + gap)); corner = centroid + s·u + t·v

    Solar array layout on roofs and ground pv.js
    • BimCraft
    • CivilCraft
    64-bit
  • Row spacing without winter shade

    The distance between ground rows that leaves no shade at the winter solstice.

    h = slant × sin β; shadow = h ÷ tan α × max(0, cos Δaz); pitch = slant × cos β + shadow

    Solar array layout on roofs and ground pv.js
    • BimCraft
    • CivilCraft
    64-bit
  • Ground rows of tables

    The tables and modules of a ground array with their corners, the pitch and the ground cover ratio.

    table width = n × across + (n − 1) × gap; row origin = origin − facing × pitch × r; GCR = slant ÷ pitch

    Solar array layout on roofs and ground pv.js
    • BimCraft
    • CivilCraft
    64-bit
  • Compass frame of the site

    The north and east unit vectors in the model's plan.

    north = n ÷ |n|; east = (north_y, −northₓ)

    Sun position and light on a tilted plane for solar pv-sun.js
    • BimCraft
    • CivilCraft
    64-bit
  • Clock hour for a solar hour

    The clock time at which the sun's time is a given hour.

    clock = solar − (equation of time + 4 × longitude − 60 × time zone) ÷ 60

    Sun position and light on a tilted plane for solar pv-sun.js
    • BimCraft
    • CivilCraft
    64-bit
  • Sun direction in model axes

    The sun's altitude, azimuth and direction for a solar hour, turned to the model's north.

    dir = east × dₓ + north × d_y, with d_z unchanged; ω = 15° × (solar hour − 12)

    Sun position and light on a tilted plane for solar pv-sun.js
    • BimCraft
    • CivilCraft
    64-bit
  • Daily extraterrestrial radiation

    The energy on a horizontal plane above the atmosphere in one day.

    δ = 23.45° × sin(2π(284 + n) ÷ 365); ω_s = acos(−tan φ · tan δ); H₀ = 24 ÷ π × G_on ÷ 1000 × (cos φ cos δ sin ω_s + ω_s sin φ sin δ)

    Sun position and light on a tilted plane for solar pv-sun.js
    • BimCraft
    • CivilCraft
    64-bit
  • Monthly diffuse fraction

    The share of a month's daily light that is diffuse, from the clearness index.

    ω_s ≤ 81.4°: 1.391 − 3.56 k + 4.189 k² − 2.137 k³; else 1.311 − 3.022 k + 3.427 k² − 1.821 k³

    Sun position and light on a tilted plane for solar pv-sun.js
    • BimCraft
    • CivilCraft
    64-bit
  • Hourly share of the day's light

    The share of a day's total and diffuse light that falls in one hour.

    r_d = π ÷ 24 × (cos ω − cos ω_s) ÷ (sin ω_s − ω_s cos ω_s); r_t = (a + b cos ω) × r_d

    Sun position and light on a tilted plane for solar pv-sun.js
    • BimCraft
    • CivilCraft
    64-bit
  • Hourly light from a typed monthly total

    Spreads a typed daily total over the hours and splits it into diffuse and direct light.

    I = H × r_t ÷ Σ r_t; I_d = min(I, H_d × r_d ÷ Σ r_d); DNI = min((GHI − DHI) ÷ cos z, 0.8 × G_on)

    Sun position and light on a tilted plane for solar pv-sun.js
    • BimCraft
    • CivilCraft
    64-bit
  • Light on a tilted plane

    The direct, sky and ground-reflected light on a module plane in one hour.

    beam = DNI × cos θ; sky = DHI × (1 + cos β) ÷ 2; ground = GHI × ρ × (1 − cos β) ÷ 2; IAM = max(0, 1 − b₀(1 ÷ cos θ − 1))

    Sun position and light on a tilted plane for solar pv-sun.js
    • BimCraft
    • CivilCraft
    64-bit
  • Overcurrent device size

    The smallest standard device that is at least the required current.

    smallest x in the list with x ≥ amps − 1e-9

    Solar one-line currents, devices and wires pv-oneline.js
    • BimCraft
    64-bit
  • Wire size

    The smallest wire whose ampacity, after derating, is at least the required current.

    smallest wire with ampacity × derate ≥ amps − 1e-9

    Solar one-line currents, devices and wires pv-oneline.js
    • BimCraft
    64-bit
  • A run on the diagram

    Records one run with its current, required current, device and wire.

    device and wire from the required current; stored current and required current rounded to 0.1 A

    Solar one-line currents, devices and wires pv-oneline.js
    • BimCraft
    64-bit
  • DC currents of an array

    The current of one string circuit and of the array's combined output, with the required values.

    per circuit = I_sc factor × continuous factor × I_sc; output = strings × I_sc; required = factor × output

    Solar one-line currents, devices and wires pv-oneline.js
    • BimCraft
    64-bit
  • Run from the DC disconnect to the inverter

    The current, device and wire of the run into each inverter.

    Solar one-line currents, devices and wires pv-oneline.js
    • BimCraft
    64-bit
  • AC current of an inverter

    The output current of one inverter at the service voltage.

    I = P_ac × 1000 ÷ (V × √3) for three-phase; I = P_ac × 1000 ÷ V for single-phase

    Solar one-line currents, devices and wires pv-oneline.js
    • BimCraft
    64-bit
  • Grid position from GeoTIFF tags

    The transform from cell column and row to map coordinates.

    x₀ = tie_X − tie_I × scale_X; y₀ = tie_Y + tie_J × scale_Y; pixel-is-point: x₀ −= ½(a + b), y₀ −= ½(d + e)

    Elevation grids read from GeoTIFF and ASCII files raster.js
    • BimCraft
    • CivilCraft
    64-bit
  • Cell size

    The single cell size of a square, north-up grid.

    cell = a when b = d = 0 and |a + e| < 1e-9 × |a|

    Elevation grids read from GeoTIFF and ASCII files raster.js
    • BimCraft
    • CivilCraft
    64-bit
  • ASCII grid header

    The size, cell size and lower-left corner of an ASCII grid.

    corner = center − cell ÷ 2 when the header gives cell centers

    Elevation grids read from GeoTIFF and ASCII files raster.js
    • BimCraft
    • CivilCraft
    64-bit
  • ASCII grid position

    The transform of an ASCII grid, with its origin at the top-left corner.

    top = yll + rows × dy

    Elevation grids read from GeoTIFF and ASCII files raster.js
    • BimCraft
    • CivilCraft
    64-bit
  • Elevation from a stored sample

    Turns one stored sample into an elevation, or into no value.

    z = v × scale + offset

    Elevation grids read from GeoTIFF and ASCII files raster.js
    • BimCraft
    • CivilCraft
    64-bit
  • Reading a window of cells

    Reads part of the grid, optionally every step-th cell, into an array of elevations.

    columns = ceil((c₁ − c₀) ÷ step); rows = ceil((r₁ − r₀) ÷ step)

    Elevation grids read from GeoTIFF and ASCII files raster.js
    • BimCraft
    • CivilCraft
    64-bit
  • Lowest and highest elevation

    The minimum and maximum elevation shown for a grid.

    Elevation grids read from GeoTIFF and ASCII files raster.js
    • BimCraft
    • CivilCraft
    64-bit
  • Position of a georeferenced picture

    The transform and bounding box of a picture read at a reduced size.

    sₓ = width ÷ w, s_y = height ÷ h; affine = [x₀, a·sₓ, b·s_y, y₀, d·sₓ, e·s_y]

    Elevation grids read from GeoTIFF and ASCII files raster.js
    • BimCraft
    • CivilCraft
    64-bit
  • Device spot on the nearest wall face

    The wall face nearest the pointer, the distance along it and the direction the device faces.

    s = clamp((p − a)·u, 0, L); distance to face = ||(p − a)·n| − t ÷ 2|; angle = atan2(side·n_y, side·nₓ)

    Electrical devices: positions, loads and circuit amps res-elec.js
    • BimCraft
    64-bit
  • Point on a wall face

    The plan point on a wall's face at a distance along the wall.

    at = a + s·u + side × (t ÷ 2)·n

    Electrical devices: positions, loads and circuit amps res-elec.js
    • BimCraft
    64-bit
  • Stored device position and body

    The device's placement, box and the X, Y and Angle kept for it.

    placement angle = angle × 180 ÷ π − 90; X, Y = round(mm ÷ unit, 6); Angle = round(degrees, 4)

    Electrical devices: positions, loads and circuit amps res-elec.js
    • BimCraft
    64-bit
  • Ceiling height of a level

    The height ceiling-mounted devices are placed at.

    middle value of the sorted wall heights; else max(2000, level height − 300)

    Electrical devices: positions, loads and circuit amps res-elec.js
    • BimCraft
    64-bit
  • Nominal voltage of a device

    The voltage used for a circuit's current, from the device kind and the unit system.

    metric: 230 V, three-phase socket 400 V; feet and inches: 120 V, cooker, heater, charger and three-phase socket 240 V

    Electrical devices: positions, loads and circuit amps res-elec.js
    • BimCraft
    Exact
  • Circuit schedule

    The device count, load, current and voltage of each circuit.

    watts = Σ load; volts = highest nominal voltage on the circuit; amps = watts ÷ volts, to 1 decimal

    Electrical devices: positions, loads and circuit amps res-elec.js
    • BimCraft
    64-bit
  • Device schedule total

    The rows of the device schedule and the total load.

    total watts = round(Σ load)

    Electrical devices: positions, loads and circuit amps res-elec.js
    • BimCraft
    64-bit
  • Default footing size

    The footing's width and depth from the foundation kind, the number of stories and the wall material.

    width = table inches (+ 4 under masonry or concrete) × 25.4; depth = 10 in from 24 in wide, else 8 in

    Foundation parts and quantities res-foundation.js
    • BimCraft
    Exact
  • Outline offset inward

    A polygon moved inward by a distance, with mitred corners.

    corner = intersection of the two neighboring edges, each moved by d along its left normal

    Foundation parts and quantities res-foundation.js
    • BimCraft
    64-bit
  • Parts of a foundation

    The slab, edge beam, stem wall and footing outlines with their bottom and top heights.

    footing ring between offsets (t_stem − w_foot) ÷ 2 and (t_stem + w_foot) ÷ 2; footing top = −bottom + depth

    Foundation parts and quantities res-foundation.js
    • BimCraft
    64-bit
  • Footings stepped to the ground

    Splits each wall's footing and stem into runs whose underside steps down with the ground.

    underside = min(floor((ground − bottom) ÷ step) × step, −bottom), step = 8 × 25.4 mm; sampled every 600 mm

    Foundation parts and quantities res-foundation.js
    • BimCraft
    64-bit
  • Cutting a strip between two cross lines

    Keeps the part of a wall's strip between two distances along the wall.

    t = f_a ÷ (f_a − f_b); point = a + t × (b − a)

    Foundation parts and quantities res-foundation.js
    • BimCraft
    64-bit
  • Ground height under the foundation

    The ground's height relative to the floor at a plan point.

    world = M · (x, y); height = ground(world) − level elevation

    Foundation parts and quantities res-foundation.js
    • BimCraft
    64-bit
  • Quantities of a ring or slab

    Area, length, width, height and volume of a slab, stem wall or footing.

    a = |A_outer| − |A_inner|; length = (P_outer + P_inner) ÷ 2; width = a ÷ length; volume = a × h

    Foundation parts and quantities res-foundation.js
    • BimCraft
    64-bit
  • Quantities of a stepped footing or stem

    The length and volume of a footing or stem wall made of stepped pieces.

    volume = Σ |A_piece| × height; length = Σ P_piece ÷ 2

    Foundation parts and quantities res-foundation.js
    • BimCraft
    64-bit
  • Lumber size for a span

    Picks the smallest size in a span table whose maximum span reaches the span, or the largest size flagged as over.

    first size with span ≤ max + 1e-6 mm

    Wall, floor and roof framing layout res-framing.js
    • BimCraft
    64-bit
  • Span table column for a spacing

    Chooses the 16 inch or the 24 inch column of a span table from the framing spacing.

    |spacing − 609.6| < 50 → 24 inch column, else 16 inch column

    Wall, floor and roof framing layout res-framing.js
    • BimCraft
    64-bit
  • Header size for an opening

    Picks a two-ply header size from the rough opening width, or three plies of 2x12 flagged as over.

    first size with width ≤ max + 1e-6 mm; non-bearing: 2x4 up to 8 ft

    Wall, floor and roof framing layout res-framing.js
    • BimCraft
    64-bit
  • Board feet of a piece

    The board feet of one piece from its nominal size and its length.

    bf = t_nominal × d_nominal × (L ÷ 304.8) ÷ 12

    Wall, floor and roof framing layout res-framing.js
    • BimCraft
    64-bit
  • Stud layer position across a wall

    Finds where the stud layer sits across the wall's thickness, from the wall type's layers.

    y = ±(t ÷ 2 − Σ layers before − layer thickness)

    Wall, floor and roof framing layout res-framing.js
    • BimCraft
    64-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.