Resources Numerical accuracy Calculation policy

Assistant and window read-outs of radio link and coverage

The numbers the assistant tools return for radio links and coverage, and the coverage read-out in the geotechnical and telecom window.

How the precision is kept

The assistant rounds every number it returns to 3 decimals in the unit it reports. The coverage grid of received power is a Float32Array, and both the coverage map values and the farthest-covered distance are taken from it.

Open item. Return the received power from telecom.js coverage in a Float64Array so the covered decision and the farthest distance are made on 64-bit values.

Calculations under this policy

4 calculations in 2 source files. The code is read from the released app when this page loads. It is the calculation people run, not a copy kept for this page.

geo-agent.js CivilCraft 0.8.1 32-bit in part 3 calculations Reviewed

Tests None found by the review

Assistant rounding to 3 decimals

64-bit

Rounds a result to 3 decimals before the assistant is given it.

round(v × 1000) ÷ 1000

The value is rounded to a step of 0.001 in whatever unit the tool reports (meters, feet, kN, dB, km). Non-finite values become null, and Infinity becomes the text 'infinite'.

  • geo-agent.js
  • line 31
  • CivilCraft 0.8.1
const r3 = (v) => (Number.isFinite(v) ? Math.round(v * 1000) / 1000 : v === Infinity ? 'infinite' : null);

Coverage share and map

32-bit in part

The share of the area covered, the farthest covered point and a coarse map of received power.

map cell = r3(p) when p ≥ sensitivity, else null

Each map value p is read from the 32-bit grid r.pr, compared with the sensitivity, and rounded to 3 decimals, so the value shown is a 32-bit number rounded. The farthest-covered distance came from runCover, which also picks covered cells from the 32-bit grid.

  • geo-agent.js
  • lines 123 to 125
  • CivilCraft 0.8.1
run: (a) => { const c = find('covers', a.cover, 'coverage'), r = runCover(c, U(), ground()); if (!r.ok) throw new ToolErr('failed', 'Too many cells for that radius and cell size (' + r.problems[0].cells + ').', ['Use a larger cell size.']);
  const stride = Math.max(1, Math.ceil(r.nx / 40)), rows = []; for (let j = 0; j < r.ny; j += stride) { const row = []; for (let i = 0; i < r.nx; i += stride) { const p = r.pr[i + r.nx * j]; row.push(p >= c.sensitivity ? r3(p) : null); } rows.push(row); }
  return { note: AID, units: { length: U() }, coveredShare: r3(r.covered), farthestCovered: r3(r.farthest), cellsOverKnownGround: r.cells, cellSize: c.step, mapStride: stride, mapDbm: rows, findings: codes(r.problems) }; } },
geo-ui.js CivilCraft 0.8.1 32-bit in part 1 calculation Reviewed

Tests None found by the review

Coverage read-out in the window

32-bit in part

The share covered, the farthest covered distance and the cell count shown for a coverage item.

covered % = covered × 100; farthest = distance as returned

The window multiplies the covered fraction from telecom.js coverage by 100 and prints 1 decimal, and prints the farthest distance with no decimals. That distance is chosen in geo-run.js runCover by testing the 32-bit grid value against the sensitivity.

  • geo-ui.js
  • line 311
  • CivilCraft 0.8.1
return [svg(coverSvg(c, r)), kv([[t('geo.cover.covered'), fixed(r.covered * 100, 1) + ' %'], [t('geo.cover.farthest'), fixed(r.farthest, 0) + ' ' + lenU()], [t('geo.cover.cells'), String(r.cells)]]), note(t('geo.cover.note'))];

In detail

Method
Rounding with Math.round(v × 1000) ÷ 1000 for the assistant; covered cells are those whose received power is at least the receiver sensitivity.
Number types
r.pr is a Float32Array in telecom.js coverage (NaN where the ground is unknown). Rounding and distances are 64-bit.
Tolerances
Rounding step 0.001 of the reported unit. Link unavailability is rounded to 1e-9.
Limits
The assistant gets rounded values, not the stored ones. The coverage comparison with the sensitivity is made on a 32-bit dBm value.

Approach: 32-bit step, flagged

One step stores or exchanges 32-bit values that reach a number a person reads. It is listed here with its open item, and the step is either moved to 64-bit or the app will warn where the number is read.

Every policy that takes this approach