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
-
Routing one reach
The outflow hydrograph of a pipe from its inflow hydrograph.
O₂ = max(0, c₀·I₂ + c₁·I₁ + c₂·O₁) on a step of max(Δt, 2KX); values between steps by linear interpolation
Storm hydrographs routed through the pipe network storm-route.js64-bit- CivilCraft
-
Travel time and weighting of each pipe
The routing constants K and X of each pipe from its length, slope and rational peak flow.
c = 1.5 × max(V, 0.1); K = L ÷ c ÷ 60; X = clamp(½(1 − Q ÷ (T·S·c·L)), 0, ½)
Storm hydrographs routed through the pipe network storm-route.js64-bit- CivilCraft
-
Summing flows and reading peaks
Adds the hydrographs arriving at each structure and reads each pipe's peak in, peak out, attenuation and share of capacity.
att = max(0, 1 − peak out ÷ peak in); ratio = peak out ÷ capacity; over when peak out > capacity × (1 + 1e-9)
Storm hydrographs routed through the pipe network storm-route.js64-bit- CivilCraft
-
Hydrograph as CSV
Writes a structure's hydrograph as minutes and flow.
minutes to 3 decimals; flow to 6 decimals
Storm hydrographs routed through the pipe network storm-route.js64-bit- CivilCraft
-
Search box around a point
The longitude and latitude box that holds a radius in meters around a point.
Δlat = r ÷ 111320; Δlon = r ÷ (111320 × max(0.01, cos lat))
Address to site: parcel area, distances and shares site-sources.js64-bit- CivilCraft
-
Ring area
The signed area of one polygon ring.
A = ½ Σ (xᵢ·yᵢ₊₁ − xᵢ₊₁·yᵢ)
Address to site: parcel area, distances and shares site-sources.js64-bit- CivilCraft
-
Polygon area in square meters
The area of a polygon with holes, scaled to square meters.
A = (Σ |outer ring| − Σ |holes|) × kx × ky
Address to site: parcel area, distances and shares site-sources.js64-bit- CivilCraft
-
Meters per degree at the site
The factors that turn longitude and latitude differences into meters, and the search window.
kx = 111320 × cos(lat); ky = 111320
Address to site: parcel area, distances and shares site-sources.js64-bit- CivilCraft
-
Distance to each building
The distance from the point to each building and the building's footprint area.
d = √(((cx − x)·kx)² + ((cy − y)·ky)²), c = center of the building's bounding box
Address to site: parcel area, distances and shares site-sources.js64-bit- CivilCraft
-
Ground slope under a table
The slope of the ground under one table, from a plane fitted through its sample points.
least squares z = a + b·x + c·y on centered points; b = (Sxz·Syy − Syz·Sxy) ÷ d, c = (Syz·Sxx − Sxz·Sxy) ÷ d, d = Sxx·Syy − Sxy²
Ground-mounted solar arrays on terrain solar.js64-bit- CivilCraft
-
Table size and the shadow rule
The width, slant length, plan depth and height of one table, and how fast the winter shadow drops behind a row.
D = Ls·cos β; H = Ls·sin β; shadow drop per meter = tan(α) ÷ max(0.2, cos Δ)
Ground-mounted solar arrays on terrain solar.js64-bit- CivilCraft
-
One table on its piles
Tests a table position: inside the region, off kept-out ground, not too steep, and how high its lower edge must stand.
z₀ = max over samples of (z_ground − dq·tan β + clearance); pile = z₀ − z_ground at the lower edge; slope = atan(|gradient|)
Ground-mounted solar arrays on terrain solar.js64-bit- CivilCraft
-
Row spacing on the ground
Steps back from each placed table to the first position where its shadow no longer reaches the next table's lower edge.
accept when q ≥ q_top + 0.02 and z₀ ≥ z_top − (q − q_top)·tanE − 1e-6; otherwise q += step
Ground-mounted solar arrays on terrain solar.js64-bit- CivilCraft
-
Module count and installed power
The number of modules and the installed power of the array.
modules = tables × per row × stacked; kWp = round(modules × Wp ÷ 10) ÷ 100
Ground-mounted solar arrays on terrain solar.js64-bit- CivilCraft
-
Terrain horizon
The highest angle of the terrain seen from a point, in each 5 degrees of bearing.
elevation angle = max over d of atan2(z(d) − (z₀ + observer height), d)
Ground-mounted solar arrays on terrain solar.js64-bit- CivilCraft
-
Hours hidden by the horizon
Marks the hours of the year when the sun is below the terrain horizon as fully shaded before the yield is computed.
shaded when sun altitude < horizon elevation at round(azimuth ÷ 5) × 5 degrees
Ground-mounted solar arrays on terrain solar.js64-bit- CivilCraft
-
Follower behind a leader (tractrix)
Where a rear axle ends up when the point that pulls it moves along a straight piece.
α₁ = 2·atan(tan(α₀ ÷ 2) × e^(−d ÷ L)); follower = B + L × (−w turned by α₁)
Vehicle swept paths swept.js64-bit- CivilCraft
-
Steady-state turning radii
The radius each rear axle and hitch runs on when the front axle follows a circle for ever.
r = √(max(0, R² − L²)); hitch = √(r² + c²)
Vehicle swept paths swept.js64-bit- CivilCraft
-
Stepping along the path
Cuts the path into steps no longer than the step length, with a point and travel direction on every line and arc.
step = max(0.001, shortest wheelbase ÷ 40); k = ceil(L ÷ step); s = s₀ + L·j ÷ k
Vehicle swept paths swept.js64-bit- CivilCraft
-
One step forward or reversing
Moves every unit of the vehicle for one step: the tractor behind its front axle, each trailer behind its hitch, or the chain pushed from the last axle when reversing.
heading = atan2(leader − follower); hitch = axle − c·(cos θ, sin θ)
Vehicle swept paths swept.js64-bit- CivilCraft
-
Steering angle and limit checks
The steering angle at each step and the largest steering and articulation angles, checked against the vehicle's limits.
δ = atan(wheelbase × Δheading ÷ ±Δlength); articulation = heading of the unit ahead − heading of the unit, wrapped to (−π, π]
Vehicle swept paths swept.js64-bit- CivilCraft
-
Body corners at a step
The four corners of a unit's body from its rear axle position and heading.
corner = axle + a·(cos θ, sin θ) + b·(−sin θ, cos θ)
Vehicle swept paths swept.js64-bit- CivilCraft
-
Swept area and outline
The area the bodies sweep and its outline.
cell h = narrowest width ÷ 40 (× 1.5 until the grid fits); area = filled cells × h²
Vehicle swept paths swept.js64-bit- CivilCraft
-
Alignment as a path with bulges
Turns an alignment's lines and arcs into the path the vehicle follows.
bulge = ± tan(Δ ÷ 4)
Vehicle swept paths swept.js64-bit- CivilCraft
-
Free-space path loss
The loss in decibels between two antennas in free space.
FSPL = 20·log₁₀(d km) + 20·log₁₀(f MHz) + 32.44
Radio links, fiber budgets and tower loads telecom.js64-bit- CivilCraft
-
Fresnel zone radius
The radius of the first (or nth) Fresnel zone at a point along the path.
F = 17.32 × √(n·d₁·d₂ ÷ (f·(d₁ + d₂))) (km, GHz, meters)
Radio links, fiber budgets and tower loads telecom.js64-bit- CivilCraft
-
Earth bulge
How far the curve of the earth rises into the line between two points.
h = d₁·d₂ ÷ (12.74·k) (km, meters)
Radio links, fiber budgets and tower loads telecom.js64-bit- CivilCraft
-
Line of sight clearance
The clearance of the straight line between the antennas over the terrain at every sample, and its ratio to the Fresnel radius.
line = z_A + (z_B − z_A)·d₁ ÷ D; clearance = line − (terrain + clutter + bulge); ratio = clearance ÷ F₁
Radio links, fiber budgets and tower loads telecom.js64-bit- CivilCraft
-
Link budget
The received power and the fade margin of a link.
Pr = Pt + Gt + Gr − cable losses − FSPL − other; margin = Pr − sensitivity
Radio links, fiber budgets and tower loads telecom.js64-bit- CivilCraft
-
Mast height for clearance
The lowest tower height at one end that clears a set fraction of the Fresnel zone along the path.
first h = h₀ + 0.5·j with clearance ≥ fraction × F₁
Radio links, fiber budgets and tower loads telecom.js64-bit- CivilCraft
-
Fiber loss budget
The loss of a fiber run and the longest run a power budget allows.
loss = L·α + splices·Ls + connectors·Lc + margin; max L = (budget − connectors·Lc − margin − splices·Ls) ÷ α
Radio links, fiber budgets and tower loads telecom.js64-bit- CivilCraft
-
Fiber route length and cable to order
The plan length of a route, the cable length with slack and spare loops, and the splice and hand-hole counts.
length = Σ √(Δx² + Δy²); cable = length × (1 + slack) + 2 × spare; splices = ceil(length ÷ spacing) − 1
Radio links, fiber budgets and tower loads telecom.js64-bit- CivilCraft
-
Wind on antennas
The wind force on each antenna and the shear and moment at the tower base.
q = ½·ρ·V²; F = q·Cd·A; M = Σ F·h
Radio links, fiber budgets and tower loads telecom.js64-bit- CivilCraft
-
Multipath outage of a hop
The share of the worst month and of the year a hop is expected to be out from multipath fading.
P = 2.5 × 10⁻⁶·C·f·d³·10^(−F ÷ 10) (worst month); 6 × 10⁻⁷·C·f·d³·10^(−F ÷ 10) (year); seconds = P × 365.25 × 86400
Radio links, fiber budgets and tower loads telecom.js64-bit- CivilCraft
-
Tower base shear, moment and overturning
The wind on the tower shaft and its antennas, and the safety factor of a square footing against overturning.
shaft: Σ over 10 slices of q·Cf·solidity·width·Δz at mid-height; FS = W·1000·footing ÷ 2 ÷ M
Radio links, fiber budgets and tower loads telecom.js64-bit- CivilCraft
-
Knife-edge diffraction loss
The extra loss when one obstruction rises into the path.
v = h·√(2(d₁ + d₂) ÷ (λ·d₁·d₂)); J(v) = 6.9 + 20·log₁₀(√((v − 0.1)² + 1) + v − 0.1) for v > −0.78, else 0
Radio links, fiber budgets and tower loads telecom.js64-bit- CivilCraft
-
Tower leg forces and buckling
The compression and tension in a tower leg from the wind moment and the weight, and the leg's Euler buckling load.
4 legs: wind = M ÷ (2w); 3 legs: wind = M ÷ (w·√3 ÷ 2); Pcr = π²·E·I ÷ (K·L)²
Radio links, fiber budgets and tower loads telecom.js64-bit- CivilCraft
-
Unit factors
The factors that turn project units (ft, in, gpm, psi or m, mm, L/s, kPa) into the SI values the solver works in.
ft = 0.3048 m; in = 0.0254 m; gpm = 6.30902e-5 m³/s; psi per ft = 0.433527; kPa per m = 9.80665
Water mains network: heads, flows and pressures water.js64-bit- CivilCraft
-
Pump curve fit
Turns one or three pump curve points into the head a pump adds at any flow.
H = H₀ − r·Qⁿ; n = ln((H₀ − H₂) ÷ (H₀ − H₁)) ÷ ln(Q₂ ÷ Q₁); r = (H₀ − H₁) ÷ Q₁ⁿ
Water mains network: heads, flows and pressures water.js64-bit- CivilCraft
-
Hazen-Williams head loss
The friction head loss in a pipe for a given flow, length, diameter and C factor, in SI.
h = 10.67 × L × |Q|^1.852 ÷ (C^1.852 × D^4.871) × sign(Q)
Water mains network: heads, flows and pressures water.js64-bit- CivilCraft
-
Pipe resistance and minor-loss coefficients
The two coefficients each pipe carries into the solver: friction resistance and minor loss.
r = 10.67 × L ÷ (C^1.852 × D^4.871); m = 8K ÷ (π² g D⁴)
Water mains network: heads, flows and pressures water.js64-bit- CivilCraft
-
Head loss and its gradient for one link
The head loss across a pipe, valve or pump at the current flow, and its derivative, for each solver pass.
pipe: f = (r·|q|^0.852 + m·|q|)·q, g = 1.852·r·|q|^0.852 + 2·m·|q|; pump: f = −(H₀ − r·qⁿ), g = r·n·qⁿ⁻¹
Water mains network: heads, flows and pressures water.js64-bit- CivilCraft
-
Node equations for one pass
Builds the linear system for the unknown heads from the link coefficients, demands and fixed heads, and solves it.
Q = P·(Hₐ − H_b) + Y; P = 1 ÷ g; Y = Q − f ÷ g; Σ flows at each node = demand
Water mains network: heads, flows and pressures water.js64-bit- CivilCraft
-
Flow update and convergence test
Updates every link flow from the new heads and decides when the network is solved.
stop when Σ|Q_new − Q_old| ÷ Σ|Q_new| < 1e−7 and no valve or pump changed status
Water mains network: heads, flows and pressures water.js64-bit- CivilCraft
-
Linear solve for the heads
Solves the symmetric positive definite system for the unknown node heads.
A = L·Lᵀ, forward and back substitution; or conjugate gradient with z = r ÷ diag(A)
Water mains network: heads, flows and pressures water.js64-bit- CivilCraft
-
Heads, pressures, velocities and head loss per 1000
The numbers shown for each node and pipe, converted back to project units, and the limit checks on them.
pressure = (H − z) × p factor; v = |Q| ÷ (π D² ÷ 4); loss per 1000 = |Hₐ − H_b| ÷ (L ÷ 1000)
Water mains network: heads, flows and pressures water.js64-bit- CivilCraft
-
Available fire flow
The largest draw at one node that keeps the lowest pressure in the network at or above the residual pressure.
bisection on the draw: 40 halvings of [lo, hi], each one a full network solve
Water mains network: heads, flows and pressures water.js64-bit- CivilCraft
-
Tank levels over time
Steps the network through the day and moves each tank level by the flow into it.
level₊ = level + inflow × Δt ÷ (π d² ÷ 4), clamped to [min level, max level]
Water mains network: heads, flows and pressures water.js64-bit- CivilCraft
-
EPANET-format export
Writes the network as EPANET-format text for other programs.
written value = round(v × 10⁴) ÷ 10⁴
Water mains network: heads, flows and pressures water.js64-bit- CivilCraft
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.