fuelCellPem — PEM Fuel Cell Simulator
A desktop app that shows, hour by hour, how a PEM fuel cell behaves over a full day of use.
What it is
A desktop application that simulates a PEM (Proton Exchange Membrane) fuel cell over a 24-hour period. The user enters the stack characteristics and a daily load profile, and the app interactively shows how much hydrogen is consumed, how much water is produced, how much heat is generated, how efficient the cell is, and how much energy it delivers — with daily, monthly, and annual totals.
It's the natural companion to the Electrolysis App: where that one simulates producing hydrogen, this one simulates the reverse path, turning hydrogen back into electricity.
How it works
The user sets the stack parameters and draws the usage profile by dragging bars directly on a chart (or typing an exact value), with shortcuts for typical profiles like a continuous 24-hour run or just daylight hours. On every change, the app recalculates the hourly operation from the cell's physical model and updates charts, averages, and totals in real time. Input fields validate what's typed and warn about invalid values, and the interface offers undo/redo, JSON import and export of the inputs, and a full PDF export of the results.
The model was ported from a reference Python notebook and systematically validated against it: an automated test suite compares the app's outputs with the notebook's across a wide range of scenarios, including extreme cases and absurd inputs, making sure nothing breaks or produces invalid results.
Tech stack
- C# / .NET with Avalonia UI (cross-platform desktop)
- Interactive charts and PDF report export
- xUnit for automated testing (including headless UI tests)
- Python + SciPy to generate the reference data used for validation
- Git and GitHub Actions for continuous integration and release publishing
Technical highlights
- Faithful port of a scientific model from Python to C#, with parity verified against the original implementation
- Large-scale validation against the reference, covering a wide grid of parameter combinations
- Input robustness: accepts comma or dot as the decimal separator, rejects invalid values, and guards against numeric overflow and infinite loops
- JSON import and export with proper error handling (invalid, locked, or oversized files) without crashing the app
- Drag-to-edit interface with undo/redo and PDF report export
- Layered code organization: physics model, data, UI, and tests
- CI pipeline that builds, tests, and publishes releases automatically