Lumina Lighting Design Suite
Projects New design Fixtures Criteria Reference Docs Sign in Create an account

Validation


php tests/run.php              # the full suite
php tests/run.php --verbose    # show every assertion
php tests/run.php --group=cf   # one group
php tests/smoke-http.php       # every HTTP route against a running server
php tests/smoke-flow.php       # write paths with a real session and CSRF token

On Windows:


.\tests\smoke-fastcgi.ps1      # IIS-style request handling through php-cgi.exe
.\tests\smoke-iis.ps1          # the real IIS engine, via IIS Express
php bin/doctor.php             # the deployed environment rather than the code

What a good test looks like here

A test that compares the engine against itself proves only that it is consistent. Every assertion in this suite is checked against one of four things:

  1. A closed-form result. The flux of a Lambertian emitter is exactly pi times its peak intensity.

The mean exitance of a uniformly reflective enclosure is exactly rho·Phi / (A(1−rho)).

  1. A conservation law. Configuration factors from an interior point to all faces of a closed box sum

to exactly 1. Emitted flux must equal absorbed flux.

  1. A published figure. Form factors from the Hottel and Howell catalogues, the Erbs diffuse

fraction correlation, Guth's position index chart, published sunrise and sunset times, the range of coefficients of utilisation in manufacturer troffer tables.

  1. An independent numerical route. The lumen method integrates over solid angle; the grid samples

point by point. They share no code, so agreement means something. Monte Carlo integration checks the analytic configuration factors.

Where a test can only verify internal consistency, it says so.

Groups

cf — configuration factors

The mathematical foundation of the interreflection solve.

| Assertion | Expected | Achieved | | --- | --- | --- | | Closure from an interior point to all six faces | exactly 1 | 1.00000000 in five geometries including corners and thin corridors | | Opposed unit squares at distance 1 | 0.199825 (Hottel) | 0.199826 | | Perpendicular unit squares sharing an edge | 0.200044 (Howell) | 0.200043 | | Reciprocity, unequal rectangles | A_i F_ij = A_j F_ji | within 0.05 per cent | | Analytic against Monte Carlo | same integral | within 1.2 per cent, which is the sampling noise floor | | Surface behind or edge-on to the element | exactly 0 | 0 |

photometry — file readers and flux integration

Ideal distributions are checked against their analytic flux: pi·I0 for a cosine emitter, 4pi·I0 for an isotropic source, 2pi·I0 over a hemisphere. Beam angles round trip: asking for a 30 degree beam measures back as 30. Downward flux fractions match the requested split.

Both readers are exercised on hand-written files with known content, including a four-plane IES table and a rotationally symmetric EULUMDAT file, then round-tripped through the IES writer. Symmetry folding is checked against the mirror relations it implements.

law — inverse square and cosine laws

An isotropic source of 4pi·1000 lm has I = 1000 cd in every direction, so every illuminance is computable by hand:

| Geometry | Closed form | Engine | | --- | --- | --- | | Directly below at 4 m | 62.5 lx | 62.4992 | | At 3 m offset, r = 5, cos = 4/5 | 32 lx | 31.9996 | | Vertical plane facing the source, cos = 3/5 | 24 lx | 23.9997 | | Cylindrical, E = I cos(eps)/(pi r²) | 7.6394 lx | 7.6393 |

Also asserted: doubling the distance quarters the illuminance, doubling the flux doubles it, a surface receives nothing from behind, and a tilted narrow beam lands where its aim vector points with an offset of h·tan(tilt).

radiosity — interreflection against the closed-form balance

In an enclosure of uniform reflectance the steady state has an exact solution. At reflectances of 0.2, 0.5 and 0.8 the solver matches it to within 1 per cent, and the error falls monotonically with subdivision:

| Subdivision | Patches | Error against the closed form | | --- | --- | --- | | 2 | 32 | 0.554 per cent | | 3 | 54 | 0.301 per cent | | 4 | 96 | 0.169 per cent | | 5 | 150 | 0.108 per cent |

Monotonic convergence is the signature of a correct discretisation. A black room is asserted to produce exactly zero interreflected light.

engine — independent routes must agree

The lumen method and the point-by-point grid agree to within 2 per cent on the test office, and within half a per cent on the shipped tutorials. The direct and interreflected components are asserted to sum to the total at every grid point, so the split is a partition rather than an approximation. Linearity is checked end to end: doubling every luminaire's flux doubles every result including interreflection.

The EN 12464-1 grid spacing rule is checked at five room sizes against p = 0.2·5^(log10 d).

Light output ratio and the coefficient of utilisation are checked against their definitions, and the resulting CU of 0.63 for a recessed troffer at RCR 2.5 with 70/50/20 reflectances is asserted to fall inside the 0.55 to 0.70 range published in manufacturer CU tables. That is the engine agreeing with the industry, not with itself.

glare — Guth index and the UGR formula

Position index against the Guth chart: 1.0 on the line of sight, about 3.35 at 30 degrees directly above, about 1.47 at 30 degrees lateral. Lateral displacement is asserted to be less severe than vertical, which is the qualitative shape of the chart.

The formula's response is checked rather than just its value. Halving the luminaire flux halves the background luminance and quarters the summation, so UGR must fall by 8·log10(2) = 2.4 points. A narrower optic at the same output must glare less, because high-angle intensity is what reaches the observer:


wide 120 degree beam: UGR 24.92
narrow 50 degree beam: UGR 20.66

sky — sky models, solar position, climate

| Assertion | Expected | Achieved | | --- | --- | --- | | Tregenza patch count | 145 | 145 | | Tregenza solid angles | exactly 2 pi | 6.283185, exact to 1e-9 | | Overcast Eh from patches | (7/9) pi Lz | within 0.5 per cent | | Overcast horizon to zenith | 1:3 | 0.3333 | | CIE general sky type 1, horizon to zenith | 1:3 | 0.3349 | | Equinox noon altitude | 90 − latitude | within 0.6 degrees at four latitudes | | Solstice declination | ±23.44 degrees | ±23.438 | | London sunrise, 21 June | 04:43 published | 04:43 | | London sunset, 21 June | 21:21 published | 21:22 | | London day length, 21 December | about 7 h 50 m | within 9 minutes | | Arctic polar night detected | no sunrise | detected |

The general sky reproducing the same 1:3 ratio as the Moon and Spencer form is a genuine cross-check: the two use completely different functional forms, so agreement validates the transcribed gradation coefficients.

The Erbs correlation is evaluated directly from the published polynomial and the piecewise branches are asserted to meet at Kt = 0.22 and 0.80, since a discontinuity there would show up as a jump in the annual energy.

daylight — behaviour rather than absolute values

Absolute daylight factors depend on the sky model, so the tests check the properties that must hold:

  • The maximum daylight factor respects the half-sky bound: a point immediately beside a fully glazed wall

sees half the sky, so DF cannot exceed 100·tau/2.

  • Daylight factor falls monotonically with distance from the window.
  • The sky, externally reflected and internally reflected components sum to the total.
  • Increasing the external obstruction angle reduces daylight monotonically, checked at 0, 20, 40 and 60

degrees.

  • Adding a second identical window on the opposite wall roughly doubles the average, because the

transport is linear in sky luminance.

  • Occupied hours match the declared schedule exactly.
  • Summer exceeds winter indoors at a temperate latitude.

energy — conservation of hours

The strongest assertion here is arithmetic. With a pure on/off schedule the driver curve is the identity at full output, so annual energy must equal installed power times full-load hours exactly; it matches to within 1 per cent. Simulated hours are asserted to total 8760: every hour of the year accounted for once.

Finding a bug this way: an earlier version divided the holiday share by 24, which silently added about
3.7 per cent to annual energy. The exact-arithmetic test caught it. A tolerance-based test would not
have.

Also asserted: occupancy control saves energy even with no daylight model, savings are never negative, the driver curve gives exactly 55 per cent power at 50 per cent output, and each control strategy responds correctly to daylight above, at and below its target.

exports — structural validity

Every writer is checked for the structure its format requires: the ZIP local header and end-of-central directory records, the PDF header, catalog, page tree, xref offset and trailer, the OPC parts an XLSX needs, the CSV byte order mark, and the DXF header, version, units, entities and layer table.

Spreadsheet column naming is checked past Z, where base-26 without a zero digit is easy to get wrong: index 27 is AA, 52 is AZ, 702 is ZZ, 703 is AAA.

e2e — the shipped tutorials

Each tutorial project is recalculated from scratch and asserted to be compliant, to agree between the lumen method and the grid, to conserve flux, to account for all 8760 hours, and to produce a positive whole-life cost. Because they are designed to pass, a failure means the engine or the reference data moved, which makes them a regression guard rather than a demonstration.


Open plan office: Eavg 537 lx, Uo 0.892, UGR 17.3, LPD 4.74 W/m2, 244 ms
Warehouse:        Eavg 250 lx, Uo 0.852, UGR 20.7, LPD 2.50 W/m2, 154 ms
Classroom:        Eavg 432 lx, Uo 0.817, UGR 18.8, LPD 3.81 W/m2, 194 ms

Caching is asserted to be transparent: the same inputs must give the same answer, and a cache that changes the result would be worse than no cache.

Current status


tests/run.php            293 passed, 0 failed, 0 skipped in about 3.3 s
tests/smoke-http.php      51 passed, 0 failed
tests/smoke-flow.php      64 passed, 0 failed
tests/smoke-fastcgi.ps1    8 passed, 0 failed
tests/smoke-iis.ps1       32 passed, 0 failed

HTTP smoke test

tests/smoke-http.php walks every route against a running server and checks the status, the content type and a marker string that proves the page rendered rather than returning an empty 200. It also verifies that state-changing POST endpoints reject a request with no CSRF token instead of acting on it.

Request resolution across web servers

The request group covers a class of bug that unit tests on the calculation engine cannot reach: the same application code has to recover the requested URL from server variables that differ per web server. Apache and the PHP development server leave the original URL in REQUEST_URI; the IIS URL Rewrite module overwrites it with the rewrite target and keeps the original in UNENCODED_URL and HTTP_X_ORIGINAL_URL. Reading only REQUEST_URI resolves every IIS route to /index.php.

The group asserts path resolution for a site root, a virtual directory and a host with no rewriting at all, on both server families, plus trailing-slash and percent-encoding normalisation and the base path derived from SCRIPT_NAME. Two assertions are security rather than correctness: because HTTP_X_ORIGINAL_URL shares a namespace with client-supplied request headers, a request carrying that header must not be able to choose its own route, so the variable is trusted only on IIS and only when REQUEST_URI shows a rewrite actually happened.

tests/smoke-fastcgi.ps1 then drives php-cgi.exe directly with the environment IIS supplies, which exercises the same resolution through a real SAPI boundary rather than a simulated $_SERVER. It includes two negative controls, without which the suite could pass vacuously: a request naming an unknown original URL must still produce a 404, and a request where the original URL is unrecoverable must not reach the endpoint the other cases assert on. The script skips cleanly if php-cgi.exe is not installed, and needs no IIS.

The real IIS engine

tests/smoke-iis.ps1 closes the remaining gap by running the application on IIS Express: the same core engine, configuration system and URL Rewrite module as full IIS, as an unprivileged user process. It verifies what no simulation can, because these behaviours live in the web server rather than in PHP:

  • The URL Rewrite module genuinely rewrites, and the route still resolves.
  • The base path is derived correctly at a site root and at a /lumina sub-application, with

generated links and asset URLs carrying the mount point.

  • Static files bypass the rewrite, are served by IIS with the right content type, and pick up the

cache header from public/assets/web.config.

  • httpErrors existingResponse="PassThrough" really does preserve the application's own 404 body and

its non-standard 419 CSRF response, instead of IIS substituting an error page.

  • requestFiltering refuses a request for a .sqlite path.
  • A binary PNG survives the FastCGI boundary intact, checked against the PNG file signature.

This suite earned its place immediately: it found two defects that every simulated test had passed. The data/web.config guard used <handlers><clear /></handlers>, and system.webServer/handlers ships locked (overrideModeDefault="Deny"), so that directory would have answered HTTP 500.19 rather than denying access cleanly. Separately, a nested application inherits its parent's web.config and then re-declares the same rewrite rule name and the same requestFiltering entries, which IIS rejects as duplicate collection keys — also a 500.19. Both shipped web.config files now begin their rule collection with <clear /> and precede every <add> with a matching <remove>, and doctor.php checks for locked sections so the first defect cannot recur.

Comparison against DIALux or AGi32

The suite does not include a comparison against commercial tools, because doing it properly means distributing their output, which their licences govern. If you have access to one, the honest way to compare is:

  1. Export a fixture's photometric file from Lumina, or import the same manufacturer file into both.
  2. Build the identical room: dimensions, working plane, reflectances, maintenance factor and grid.
  3. Match the grid explicitly. Different grids give different minima, and that difference is usually

larger than any difference between the engines.

  1. Compare the average first. It depends only on flux transfer and should agree closely. Then compare

the minimum, which is the most grid-sensitive figure.

  1. Check whether the other tool's coefficient of utilisation is referenced to lamp or luminaire lumens

before comparing it with anything.

Expect the average illuminance to agree within a few per cent for a rectangular room with diffuse surfaces. Larger differences usually come from a different maintenance factor, a different task area definition, or one tool including furniture that the other does not.

Known limitations

These are scope boundaries, not defects, and they are where results will differ from a full ray tracer:

  • Room surfaces are diffuse reflectors. Specular and glossy interreflection is not modelled.
  • Furniture, partitions and other internal obstructions are ignored unless drawn as room geometry.
  • Non-rectangular plans use the bounding rectangle for interreflection, which is noted in every affected

result. The direct component is exact for the real outline.

  • External obstruction is a single altitude angle per window, not a modelled skyline.
  • The climate data shipped with each location is modelled from latitude and climate class, not measured

weather.

  • Beam angle is reported as undefined for distributions whose peak sits off axis, because a single cone

angle would be misleading there.