Skip to content

animagr/EngineeringPaperStandalone

Repository files navigation

⚠️ Project no longer maintained, see EngineeringPapyr instead!!!

EngineeringPaper.xyz — Standalone Edition

A standalone build of EngineeringPaper.xyz that runs entirely in the browser with no server required, and also includes a new Annotation/Note field for the Math cell, and EVA/RSS analysis cells aimed for circuit designers.

Fork notice: This is a fork of the original EngineeringPaper.xyz, based on version 20260313. The upstream project is hosted at EngineeringPaper.


What Is EngineeringPaper.xyz?

A web app for engineering calculations with:

  • Automatic unit conversion and dimensional analysis
  • Plotting and data tables
  • Systems of equations
  • Documentation cells with rich text

Calculations run in-browser using Pyodide (Python compiled to WebAssembly) with SymPy as the computation engine.


What's Different in Standalone Mode

This fork removes all server dependencies. Everything runs locally:

Feature Original Standalone
Computation In-browser (Pyodide/SymPy) Same
.epxyz save/load Local file Same
Markdown export Local file Same
DOCX export Server-side (pandoc) In-browser via pandoc-wasm
PDF export Server-side Browser print dialog
LaTeX export Server-side Hidden (not available)
Shareable links Server-required Hidden
Example sheets Server-required Hidden
Prebuilt tables Server-required Hidden

DOCX export uses pandoc-wasm (the full pandoc engine compiled to WebAssembly). Equations are converted to native Word OMML format — editable in Microsoft Word, not images. The WASM binary (~58 MB) loads on-demand the first time you export to DOCX.


New Features in This Fork

Annotation Column for Math Cells

Math cells have an optional annotation column to the right for units descriptions, notes, or labels (e.g., "velocity", "kg/m^3").

  • Click a math cell to reveal the annotation input
  • Saves automatically and persists with the sheet
  • Included in Markdown/DOCX export as *[annotation]*
  • Hidden on narrow screens (< 500px)

Extreme Value Analysis (EVA) Cell

A new cell type that finds worst-case min/max of an output expression by evaluating all 2^n combinations of input parameter bounds, plus sensitivity analysis.

Usage:

  1. Define parameters on the sheet (e.g., V = 10 [V], R = 1000 [Ω], I = V / R =)
  2. Insert an EVA cell (button 0 in the insert menu, or the Analytics icon)
  3. Set the Query field to the expression to evaluate (e.g., I=)
  4. Add parameter rows with Parameter name, Min, and Max values

How it works:

  • Evaluates all 2^n combinations of min/max bounds (max 20 parameters)
  • Shows nominal value plus extreme min and max
  • Sensitivity analysis: varies each parameter while holding others at midpoint, reports percentage contribution (sorted highest to lowest)

Root Sum Square (RSS) Analysis Cell

A statistical tolerance analysis cell that computes the RSS error envelope. Unlike EVA's worst-case (all tolerances at extremes simultaneously), RSS assumes parameter variations are independent and combines them as root-sum-of-squares — giving a realistic statistical bound (~3-sigma for uniform distributions).

Usage:

  1. Define parameters on the sheet (e.g., V = 10 [V], R = 1000 [Ω], I = V / R =)
  2. Insert an RSS cell (Analytics icon in the toolbar or insert menu)
  3. Set the Query field to the expression to evaluate (e.g., I=)
  4. Add parameter rows with Parameter name, Min, Nominal, and Max values

How it works:

  • Evaluates the query at all-nominal to get the baseline output
  • For each parameter, computes the output deviation when that parameter moves to its worst-case limit (all others held at nominal)
  • RSS total = sqrt(delta_1^2 + delta_2^2 + ... + delta_n^2)
  • RSS Min = nominal - RSS total, RSS Max = nominal + RSS total
  • Sensitivity: reports % of RSS variance (delta_i^2 / sum of all delta^2) per parameter, sorted highest first

Why % of RSS variance (not arithmetic %):

In RSS, errors combine as variances (squares). A source contributing 50% of RSS variance contributes sqrt(0.5) = 71% of the RSS voltage. Ranking by variance contribution correctly identifies which tolerance to tighten for maximum RSS reduction.

When RSS is valid:

  • Error sources are independent (separate physical components or mechanisms)
  • Error sources are uncorrelated (no shared cause — e.g., two resistors on different packages)
  • Transfer function is approximately linear over the tolerance range

When RSS is NOT valid (use EVA instead):

  • Parameters are correlated (e.g., resistors from the same reel track together)
  • A single root cause drives multiple parameters (e.g., a supply rail feeding multiple stages)
  • The transfer function is highly nonlinear over the tolerance range

Examples

See Example.epxyz and Example.docx for the new features.


How to Build and Run

One-time setup

Prerequisites:

After installing Node.js, close and reopen your terminal, then verify it's in your PATH:

node --version

If this prints a version number, you're ready. If not, add Node.js to your PATH manually or reinstall with the "Add to PATH" option checked.

Windows users: Run npm install from Git Bash, not PowerShell or cmd. Some dependencies require bash to build.

npm install

Build the standalone version

npm run build:standalone

Output goes to public/.

Note: Warnings are expected during build, safe to ignore. Inherited from source.

Serve locally

npm run start:standalone

Opens at http://localhost:8788


Packaging as a Windows Executable

Produces a single EngineeringPaper.exe (~330 MB) with Node.js and all assets embedded. No prior software installation required on the target machine — double-click to launch.

Build the exe

npm run package:win

Runs npm run build:standalone first; packages everything into dist/EngineeringPaper.exe.

Build with verbose output

npm run build:standalone
npx pkg launcher.cjs --config package.json --targets node20-win-x64 --output dist/EngineeringPaper --debug

Clean up after build

Remove build artifacts but keep the exe:

rm -rf public/build public/fonts node_modules

Run

Double-click dist/EngineeringPaper.exe, or from a terminal:

./dist/EngineeringPaper.exe

The server starts at http://localhost:8788 and your default browser opens automatically. Press Ctrl+C in the terminal to stop.

If port 8788 is already in use (e.g. another instance is running), the exe will print an error and exit.

Choosing a browser (browser.txt)

By default, the exe opens your system's default browser. To use a specific browser, create a browser.txt file in the same folder as the exe (dist/browser.txt).

For Chrome:

chrome

For Firefox:

firefox

For a specific browser path:

C:\Program Files\Google\Chrome\Application\chrome.exe

The file should contain just one line with the browser name or full path. Delete the file (or leave it empty) to revert to system default.

You can also override via command line:

./dist/EngineeringPaper.exe --browser firefox

Troubleshooting: port 8788 already in use

If the exe opens the browser but shows an old version, a previous server process may still be running. Kill it first:

netstat -ano | findstr :8788
taskkill /PID <pid> /F

Then relaunch the exe.


Files Added for Packaging

File Purpose
launcher.cjs Streaming HTTP server + browser launcher (CommonJS, embedded by pkg)
dist/EngineeringPaper.exe Final executable (gitignored)

Technical Details

Standalone compile flag

ROLLUP_STANDALONE=1 sets the __STANDALONE__ boolean at build time via @rollup/plugin-replace. Code guarded by __STANDALONE__ disables server-dependent features and routes exports through local alternatives.

Key file changes

File Change
package.json Added build:standalone, dev:standalone, start:standalone, package:win scripts; added cross-env, @rollup/plugin-replace, @rollup/plugin-url, pandoc-wasm, @yao-pkg/pkg dependencies
rollup.config.js Reads ROLLUP_STANDALONE env var; skips _worker.ts bundle; injects __STANDALONE__ boolean; handles .wasm files as URL assets
src/App.svelte Guards server features; routes DOCX/PDF export locally; hides server-dependent UI
src/DownloadDocumentModal.svelte Updates export labels; hides LaTeX and shareable link options
src/docxExport.ts (new) Wraps pandoc-wasm for in-browser DOCX generation
src/cells/ExtremeValueCell.svelte.ts (new) EVA cell model
src/ExtremeValueCell.svelte (new) EVA cell UI
src/cells/RssCell.svelte.ts (new) RSS cell model
src/RssCell.svelte (new) RSS cell UI
public/dimensional_analysis.py EVA/RSS evaluation and sensitivity analysis

License

MIT license, same as original.

See the original EngineeringPaper project for license information.

Releases

No releases published

Packages

 
 
 

Contributors