Rillwork beta

Engine check: EPA SWMM 5.2.4

Summary. Rillwork runs EPA SWMM 5.2.4, compiled to WebAssembly from EPA's own C source with no changes. All 73 example and regression models in EPA's test suite give the same results as a native build of the same source. Against EPA's own Windows build, the only differences are tiny rounding differences in the maths library.

The engine

What we compared

Every model in EPA's test suite (73 models: EPA's examples and the extran, routing, swc, update and user regression sets) was run in four builds of the same source:

Builds compared
BuildCompiler and maths libraryRole
WebAssemblyEmscripten (clang), musl maths libraryWhat Rillwork runs
Native, same maths libraryclang for x86-64 Windows, musl maths libraryIsolates the CPU target from everything else
EPA release settingsMicrosoft C compiler, EPA's own CMake release build (fast floating point)EPA's Windows build
Strict floating pointMicrosoft C compiler, strict IEEE floating pointShows how much EPA's own builds differ from each other

For each model we compared the binary results file (.out), value by value, and the text report (.rpt), ignoring only the three wall-clock lines (analysis begun, ended, elapsed time).

Results

Results of the comparison
ComparisonResult
WebAssembly vs native build with the same maths library73 of 73 models: bit-identical results files. Reports identical, apart from one extra warning line explained below.
WebAssembly vs EPA's Windows release buildMost models bit-identical; the rest differ by last-digit rounding. Typical largest difference: under 0.001 % of a series' peak. Largest: a few rounding-sensitive models (for example EPA's user5, user1 and Example1).
EPA's release build vs EPA's strict build (same compiler)Differences of the same order on the same models: this is the spread EPA's own Windows program already has.
WebAssembly in the browser vs WebAssembly in Node73 of 73 identical results files and reports.

One EPA model (ncdc_format.inp) stops with an input error in every build, EPA's included; that counts as the same result.

The differences, explained

  1. Maths-library rounding. Functions such as pow, exp and log can round the last bit differently in Microsoft's C runtime and in musl. A native build that uses musl's maths functions is bit-identical to the WebAssembly build on every model, so nothing else differs. How much a model's results move depends on how sensitive that model is to rounding; EPA's fast and strict Windows builds already differ by the same amount.
  2. An extra "WARNING 09" on some models. For rain time series with a single point, EPA's code converts a very large number to an integer, which C leaves undefined. On x86-64 it gives no warning; in WebAssembly the report adds "time series interval greater than recording interval". The results files are bit-identical. Fixing it would mean changing EPA's code, which we do not do.
  3. Line endings and file paths. EPA's Windows program reads text files with Windows line endings and Windows paths. The wrapper converts line endings and stages data files under the names the model uses, so the engine sees the same input it would on Windows.

What this does not cover

The check shows that Rillwork runs EPA's engine faithfully. It does not show that a model is right for a project: the inputs, the method and the engineering judgement remain the responsibility of the engineer using the software.

Source of this summary: the project's engine-gate report (docs/ENGINE-GATE.md in the Rillwork source), generated by its native-vs-WebAssembly comparison scripts, and the browser gate (docs/BROWSER-GATE.md).

Try it now, free