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
-
Combining runs over different days
Joins the results of several runs of the same site into one, weighting each by its number of days.
hours = Σ (hoursᵢ × daysᵢ) ÷ Σ daysᵢ
Hours of direct sun on the ground and on walls sunhours.js32-bit in part- CivilCraft
-
Ground hours as CSV
Writes each ground cell's center and its hours of sun a day.
x, y to 3 decimals; hours to 2 decimals
Hours of direct sun on the ground and on walls sunhours.js32-bit in part- CivilCraft
-
Wall hours as CSV
Writes each wall's facing direction and the hours of sun a day on each floor.
facing = round((90 − normal·180 ÷ π) mod 360); hours to 2 decimals
Hours of direct sun on the ground and on walls sunhours.js64-bit- CivilCraft
-
Turn angle at a point
The signed turn of the line at a point of intersection.
Δ = atan2 of the leg after − atan2 of the leg before, wrapped to (−π, π]
Why a curve does not fit, and the radius or length that would solve-why.js64-bit- CivilCraft
-
Tangent length of each curve
The turn and the tangent length each curve takes on either side of its point.
T = r × tan(|Δ| ÷ 2)
Why a curve does not fit, and the radius or length that would solve-why.js64-bit- CivilCraft
-
Largest radius that fits
The largest radius at a point that fits between its neighbors' curves as they are.
room = min(d_before − T_before, d_after − T_after); r_max = room ÷ tan(|Δ| ÷ 2)
Why a curve does not fit, and the radius or length that would solve-why.js64-bit- CivilCraft
-
Overlapping curves and the fixes offered
Finds neighboring curves whose tangents overlap and offers radii that fit.
overlap when Tₐ + T_b > L + 1e-9; both scaled by f = L ÷ (Tₐ + T_b); offered radius = floor(r × 100 + 1e-9) ÷ 100
Why a curve does not fit, and the radius or length that would solve-why.js64-bit- CivilCraft
-
Vertical curves that do not fit
Finds vertical curves longer than the room between their neighbors and offers the longest length that fits.
A = (g₂ − g₁) × 100; L = K × |A| when given by K; room = 2 × min(back, forward); offered L = floor(room × 100 + 1e-9) ÷ 100; K = L ÷ |A|
Why a curve does not fit, and the radius or length that would solve-why.js64-bit- CivilCraft
-
Stations to stake
Every multiple of the step between two stations, both ends, and the alignment's own curve points in between.
sta = k × step for whole k; neighbors closer than 1e-6 merged
Staking reports staking.js64-bit- CivilCraft
-
Stake position
The coordinates of a stake at a station and an offset to the right or left.
x = xₚ + off × sin(dir); y = yₚ − off × cos(dir)
Staking reports staking.js64-bit- CivilCraft
-
Stake rows with cut or fill
One row per station and offset with design elevation, ground elevation and cut or fill.
cf = ground − design (positive = cut)
Staking reports staking.js64-bit- CivilCraft
-
Survey points against the alignment
Each survey point's station and offset on the alignment, the design there and the cut or fill to the point's own elevation.
cf = point elevation − design
Staking reports staking.js64-bit- CivilCraft
-
Staking table as CSV
Writes the stake rows to a CSV file.
northing, easting, design, ground and cut or fill to 3 decimals; offset and the C/F column to 2 decimals
Staking reports staking.js64-bit- CivilCraft
-
Millimeters per project unit
The factor from project feet or meters to millimeters.
m: 1000; ft: 1,200,000 ÷ 3937 (US survey foot)
Drainage structure types and their library items structs.jsExact- CivilCraft
-
Inside and outside size of a structure
The inside and outside width and length, the wall and the frame of a structure in project units.
inside = size ÷ P; outside = inside + 2 × wall ÷ P; P = 12 (inches per foot) or 1000 (mm per m)
Drainage structure types and their library items structs.js64-bit- CivilCraft
-
Plan shapes of a type
The outside wall, inside wall and frame opening of a type as plan shapes in millimeters.
r = round₆((size × M) ÷ 2); M = 25.4 (inch) or 1 (mm)
Drainage structure types and their library items structs.js64-bit- CivilCraft
-
Round outline as a polygon
The outline of a round structure's body as points on a circle.
pᵢ = (r·cos(2π·i ÷ n), r·sin(2π·i ÷ n)), n = 48
Drainage structure types and their library items structs.js64-bit- CivilCraft
-
Library item of a type
The library item for a type: its body from the underside of the floor slab to the rim, its sizes, and every parameter in millimeters.
H = depth × U + base × M; body = outline from −H to 0; parameters as text of (value × factor)
Drainage structure types and their library items structs.js64-bit- CivilCraft
-
Type read back from a library item
Turns a library item's millimeter parameters back into a type in the project's units.
value = millimeters ÷ M (sizes) or ÷ U (sump, depth)
Drainage structure types and their library items structs.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
-
Received power at each grid cell
The received power at every cell around the transmitter and the share of cells at or above the receiver's sensitivity.
Pr = Pt + Gt + Gr − (FSPL + J(v_max) + other); covered = cells with Pr ≥ sensitivity ÷ known cells
Radio coverage over the terrain telecom.js32-bit in part- CivilCraft
-
Diffraction parameter
The parameter that measures how far an obstruction rises into the path, used for the knife-edge loss.
v = h × √(2(d₁ + d₂) ÷ (λ·d₁·d₂))
Radio coverage over the terrain telecom.js64-bit- CivilCraft
-
Length of a polyline
The plan length of a polyline.
L = Σ √(Δx² + Δy²)
Section cut from the ground along any line terrain-section.js64-bit- CivilCraft
-
Point at a distance along a line
The point and direction at a distance along a polyline.
u = (d − length before the segment) ÷ segment length, clamped to [0, 1]; p = a + (b − a)·u
Section cut from the ground along any line terrain-section.js64-bit- CivilCraft
-
Nearest point on a line
The distance along a polyline and the offset to the side of the point nearest to a given point.
u = ((p − a)·(b − a)) ÷ |b − a|², clamped; d = length before + u·|b − a|; offset = ± distance, sign from the cross product
Section cut from the ground along any line terrain-section.js64-bit- CivilCraft
-
Crossing of two segments
Where two segments cross, as fractions along each.
den = r × s; t = ((q − p) × s) ÷ den; u = ((q − p) × r) ÷ den
Section cut from the ground along any line terrain-section.js64-bit- CivilCraft
-
First crossing of two polylines
The first place one polyline crosses another, with the distance along each.
d_a = length before + t·|segment a|; d_b = length before + u·|segment b|
Section cut from the ground along any line terrain-section.js64-bit- CivilCraft
-
Line square to a polyline
A straight line square to a polyline at a distance along it, a set length to each side.
right = (sin dir, −cos dir); p = c − right × left; q = c + right × right length
Section cut from the ground along any line terrain-section.js64-bit- CivilCraft
-
Section along a line
The points of the ground along a line: distance, offset, coordinates and elevation at every triangle edge crossing and line vertex.
d = length before + t·|segment|; o = d − origin; z from the surface at (x, y)
Section cut from the ground along any line terrain-section.js64-bit- CivilCraft
-
Elevation of a section at an offset
The elevation of a cut section at any offset, between its points.
z = z₀ + (z₁ − z₀)·(o − o₀) ÷ (o₁ − o₀)
Section cut from the ground along any line terrain-section.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.