Resources Numerical accuracy Calculation policy

Solar array site and saved summary

The latitude and longitude kept for a ground PV array and the numbers the file keeps for its plan.

How the precision is kept

The array's own place is found from the project's coordinate system at the middle of the region and is rounded before it is kept. The yield is rounded to whole kWh in the saved summary.

Calculations under this policy

2 calculations in 1 source file. 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.

solar-run.js CivilCraft 0.8.1 64-bit 2 calculations Reviewed

Tests None found by the review

Array position from the coordinate system

64-bit

The latitude and longitude of the middle of the array's region.

c = mean of corners; (lon, lat) = toLonLat(c); rounded to 1e-5°

The corner mean is accumulated as x / n per corner in 64-bit numbers. The result is rounded to 5 decimals of a degree before it is returned, so positions are kept to about 1 m.

  • solar-run.js
  • lines 37 to 46
  • CivilCraft 0.8.1
export async function crsSite(project, poly) {
  const crs = project.state.crs;
  if (!crs || !poly?.length) return null;
  try {
    const { frame } = await import('./crs.js');
    const c = poly.reduce((m, p) => ({ x: m.x + p.x / poly.length, y: m.y + p.y / poly.length }), { x: 0, y: 0 });
    const [lon, lat] = frame(crs).toLonLat(c.x, c.y);
    return Number.isFinite(lat) && Number.isFinite(lon) ? { lat: Math.round(lat * 1e5) / 1e5, lon: Math.round(lon * 1e5) / 1e5 } : null;
  } catch { return null; }
}

Saved plan summary

64-bit

The counts, kWp and yearly kWh the file keeps for an array.

kWh = round(annual AC kWh)

The yearly yield is rounded to a whole kWh when stored. Count, modules and kWp are copied from the plan unchanged.

  • solar-run.js
  • lines 60 to 63
  • CivilCraft 0.8.1
export function summaryOf(plan, y = null) {
  if (!plan?.ok) return null;
  return { count: plan.count, modules: plan.modules, kwp: plan.kwp, ...(y?.ok ? { kwh: Math.round(y.res.total.acKwh) } : {}) };
}

In detail

Method
Mean of the region corners, projected back to longitude and latitude by the project's coordinate frame, then rounded.
Number types
64-bit numbers throughout.
Tolerances
Latitude and longitude are rounded to 1e-5 degree, about 1.1 m of latitude.
Limits
The rounded site position is what the solar plan then uses.

Approach: 64-bit, stated limit

The arithmetic is 64-bit, but the method or the data sets the accuracy: a solver tolerance, a mesh, a step size, a datum shift, a table. The limit is stated where the result is shown.

Every policy that takes this approach