Skip to content

roliveira-82/lambda-formulas-public

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lambda — Auditable formulas

Public repository of the math behind Lambda — a fuel-mixture calculator for Brazilian performance engine builders (preparadores).

What's here

  • src/formulas.ts — Pearson/Turner 2015 (mass-weighted AFR), Anderson 2011 (molar octane), stoichiometric balance, 4 mixing modes (volume → AFR, target AFR → composition, injector calibration)
  • src/formulas.test.ts — 61 unit tests (mathematical invariants + reference values from the ICE literature)
  • src/fuels.ts — fuel library: Brazilian gasolines (E30 Comum/Premium/Podium), ethanols (hydrous/anhydrous), race fuels (VP C16, VP MS109, Sunoco Standard 110) and methanol
  • src/types.ts — TypeScript types (Fuel, Recipe, MixtureResult, CorrectionResult)

What's NOT here

  • App code (UI, auth, billing, persistence) — closed, in a private repo
  • Stripe/Cognito/mail integrations
  • Customer custom fuels — the public library is the stock set only

Why split it out

The app is proprietary, but the math is auditable. If a builder wants to check how we compute the AFR of E30 or an E70 blend, it's right here. Pull requests with formula fixes or extra references are welcome.

Install

npm install lambda-formulas
# or
pnpm add lambda-formulas

Quick use

import { calculateModeA, DEFAULT_FUELS_BY_ID } from "lambda-formulas";

const result = calculateModeA({
  components: [
    { fuelId: "gasoline-c-e30", volumeFraction: 0.7 },
    { fuelId: "ethanol-hydrous", volumeFraction: 0.3 },
  ],
  fuelsById: DEFAULT_FUELS_BY_ID,
});

console.log(result.afrStoich); // 11.83
console.log(result.density);   // 0.758 kg/L
console.log(result.ron);       // 100.4

Run tests

pnpm install
pnpm test

61 tests covering mathematical invariants and reference values from the literature (Heywood, Pulkrabek, Pearson, Anderson).

License

MIT — use, modify, fork. Attribution appreciated.

Canonical references

Brazilian technical standards

  • ANP Resolution 988/2025 — Brazilian E30 gasoline (30% anhydrous ethanol by volume)
  • ANP Resolution 907/2022 — fuel ethanol (EAC and EHC)
  • ASTM D86 — density
  • ASTM D2699 / D2700 — RON / MON octane

ICE literature

  • Heywood, J.B. (2018) Internal Combustion Engine Fundamentals, 2nd ed. — ch. 3 (stoichiometric combustion)
  • Pulkrabek, W.W. (2003) Engineering Fundamentals of the Internal Combustion Engine
  • Pearson, R.J., Turner, J.W.G. et al. (2015) "Iso-stoichiometric fuel blends: Characterization of physicochemical properties for mixtures of gasoline, ethanol, methanol and water" — Proc. IMechE, Part D
  • Anderson, J.E. et al. (2010) "Octane Numbers of Ethanol−Gasoline Blends: Measurements and Predictions" — Energy & Fuels
  • Anderson, J.E. et al. (2011) "Octane Numbers of Ethanol- and Methanol-Gasoline Blends Estimated from Molar Concentrations" — Energy & Fuels

Found a bug?

Found a bug or a discrepancy with the literature? Open an issue or send a PR. Email: roberto@microforge.app

The closed app

Lambda uses these formulas plus UI, persistence, PDF and cloud sync. Free and no signup; Pro is R$ 348/year, with a 14-day money-back guarantee.

About

Open-source formulas for Lambda fuel mixture calculator (Pearson/Turner, Anderson 2011, ANP 2025)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors